id
stringlengths
33
34
updated
timestamp[s]
published
timestamp[s]
title
stringlengths
9
212
summary
stringlengths
75
2.46k
author
sequence
arxiv:doi
stringlengths
0
71
link
list
arxiv:journal_ref
sequence
arxiv:primary_category
dict
category
sequence
content
stringlengths
0
1.25M
http://arxiv.org/abs/2302.10706v2
2023-02-22T14:03:41
2023-02-21T14:51:08
Variational Boosted Soft Trees
Gradient boosting machines (GBMs) based on decision trees consistently demonstrate state-of-the-art results on regression and classification tasks with tabular data, often outperforming deep neural networks. However, these models do not provide well-calibrated predictive uncertainties, which prevents their use for decision making in high-risk applications. The Bayesian treatment is known to improve predictive uncertainty calibration, but previously proposed Bayesian GBM methods are either computationally expensive, or resort to crude approximations. Variational inference is often used to implement Bayesian neural networks, but is difficult to apply to GBMs, because the decision trees used as weak learners are non-differentiable. In this paper, we propose to implement Bayesian GBMs using variational inference with soft decision trees, a fully differentiable alternative to standard decision trees introduced by Irsoy et al. Our experiments demonstrate that variational soft trees and variational soft GBMs provide useful uncertainty estimates, while retaining good predictive performance. The proposed models show higher test likelihoods when compared to the state-of-the-art Bayesian GBMs in 7/10 tabular regression datasets and improved out-of-distribution detection in 5/10 datasets.
[ "Tristan Cinquin", "Tammo Rukat", "Philipp Schmidt", "Martin Wistuba", "Artur Bekasov" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10706v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10706v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "stat.ML" ]
Variational Boosted Soft Trees 3 2 0 2 b e F 2 2 ] G L . s c [ 2 v 6 0 7 0 1 . 2 0 3 2 : v i X r a Tristan Cinquin University of Tuebingen1 [email protected] Tammo Rukat Deekard1 [email protected] Philipp Schmidt Amazon [email protected] Martin Wistuba Amazon [email protected] Artur Bekasov Amazon [email protected] Abstract 1 INTRODUCTION Gradient boosting machines (GBMs) based on decision trees consistently demonstrate state-of- the-art results on regression and classification tasks with tabular data, often outperforming deep neural networks. However, these models do not provide well-calibrated predictive uncertainties, which prevents their use for decision making in high-risk applications. The Bayesian treatment is known to improve predictive uncertainty cali- bration, but previously proposed Bayesian GBM methods are either computationally expensive, or resort to crude approximations. Variational infer- ence is often used to implement Bayesian neural networks, but is difficult to apply to GBMs, be- cause the decision trees used as weak learners are non-differentiable. In this paper, we propose to implement Bayesian GBMs using variational inference with soft decision trees, a fully differ- entiable alternative to standard decision trees in- troduced by Irsoy et al. Our experiments demon- strate that variational soft trees and variational soft GBMs provide useful uncertainty estimates, while retaining good predictive performance. The pro- posed models show higher test likelihoods when compared to the state-of-the-art Bayesian GBMs in 7/10 tabular regression datasets and improved out-of-distribution detection in 5/10 datasets. 1Work done while at Amazon. Proceedings of the 26th International Conference on Artificial Intel- ligence and Statistics (AISTATS) 2023, Valencia, Spain. PMLR: Volume 206. Copyright 2023 by the author(s). Tabular data, often combining both real valued and cate- gorical variables, is common in machine learning appli- cations (Borisov et al., 2021; Hoang and Wiegratz, 2021; Clements et al., 2020; Ebbehoj et al., 2021; Mustafa and Rahimi Azghadi, 2021). A number of these applications require uncertainty estimates, in addition to the model's predictions. Predictive uncertainty is particularly important when using the model for making decisions associated with risk, as common in healthcare (Abdullah et al., 2022; Kompa et al., 2021) or finance (Bew et al., 2019; Gonzalvez et al., 2019). In order to make optimal decisions, we require the uncertainty estimates to be well-calibrated: the predictive distribution returned by the model should capture the true likelihood of the targets (Guo et al., 2017). A decision tree is a predictive model that is fit by recur- sively partitioning the feature space. These models are fast, interpretable and support categorical data without addi- tional pre-processing. To increase their expressivity without exacerbating overfitting, multiple decision trees can be com- bined into an ensemble using gradient boosting (Freund and Schapire, 1997; Friedman, 2001). Gradient boosting machines (GBM) are an expressive class of machine learn- ing models trained by sequentially fitting an ensemble of weak learners (e.g. decision trees). At each iteration, the gradient boosting procedure fits an additional weak learner that would minimize the training error when added to the ensemble. These models demonstrate state-of-the-art re- sults on tabular data (Bojer and Meldgaard, 2021; Liu et al., 2021), often out-performing deep neural networks (Borisov et al., 2021; Shwartz-Ziv and Armon, 2022). While GBM models demonstrate good predictive perfor- mance, they do not provide well-calibrated predictive un- certainties (Niculescu-Mizil and Caruana, 2012). Bayesian methods are known to improve predictive uncertainties by explicitly capturing the epistemic uncertainty, a type of un- certainty that results from learning with finite data (Kristiadi Variational Boosted Soft Trees et al., 2020; Mitros and Namee, 2019). Bayesian GBMs have been proposed, and indeed improve upon the predic- tive uncertainties of standard GBMs (Chipman et al., 1998; Linero and Yang, 2017; Ustimenko and Prokhorenkova, 2020). Current methods rely on Markov chain Monte Carlo (MCMC) to sample from the posterior, however, and do not scale well to larger models and datasets. Alternative approximate sampling methods have been proposed by He and Hahn (2020) and Malinin et al. (2020). These methods make the sampling procedure more efficient, but degrade the quality of the resulting predictive uncertainties. More scalable approximate inference methods such as the Laplace approximation or variational inference are difficult to apply to GBMs, because the decision trees used as weak learners are non-differentiable. Unlike standard decision trees that route the input to a unique leaf based on a series of binary conditions, soft deci- sion trees (Irsoy et al., 2012) compute a convex combination of all leaves, weighing their values by a series of learned gating functions. As a result, soft decision trees are fully differentiable, and therefore amenable to scalable Bayesian inference methods that are common in Bayesian deep learn- ing (Blundell et al., 2015; Cobb and Jalaian, 2020; Immer et al., 2020). In this work we propose to implement Bayesian GBMs by using soft trees as week learners in a GBM, and performing variational inference on the resulting model. In particular, we make the following contributions: 1. We propose a method for performing variational in- ference in soft decision trees. The chosen variational distribution allows trading-off memory and computa- tion for a richer posterior approximation. 2. We increase the expressivity of the model by using variational soft trees as weak learners in a GBM. 3. We run experiments to demonstrate that the pro- posed models perform well on tabular data, yielding useful predictive uncertainties in regression, out-of- distribution detection and contextual bandits. 2 BACKGROUND 2.1 Bayesian inference Bayesian inference provides a theoretical framework for reasoning about model uncertainty, and has been shown to improve calibration of machine learning models in prac- tice (Mitros and Namee, 2019; Kristiadi et al., 2020). In Bayesian inference we place a prior on the model parame- ters θ, and use the Bayes rule to define the posterior distri- bution having observed the data: p(θ | D) ∝ p(D | θ)p(θ) (1) where D = {xi, yi}n i=1 is the training data, p(θ) is the prior distribution, and p(D | θ) the likelihood. The predictive distribution of a new target y∗ given a feature vector x∗ is then computed as p(y∗ | x∗) = Eθ∼p(θ | D)[p(y∗ | x∗, θ)] (2) The posterior distribution in the Bayesian paradigm explic- itly captures epistemic or model uncertainty that results from learning with finite data. Epistemic uncertainty is one of the two fundamental types of uncertainty (alongside the aleatoric or data uncertainty), and capturing it was shown to be especially important in risk-aware decision making (Riquelme et al., 2018; Abdullah et al., 2022; Deisenroth and Rasmussen, 2011), active learning (Kirsch et al., 2019) and Bayesian optimisation (Gonzalvez et al., 2019; Krause et al., 2006; Springenberg et al., 2016). Unfortunately, the posterior distribution is typically intractable and requires numerical approximation. Variational inference Variational inference (VI) is an ap- proximate inference method which selects a distribution q∗ within a variational family Q that best approximates the posterior p. More formally, we select the distribution q∗ such that: q∗ = argmin q∈Q DKL(q (cid:107) p) = argmin q∈Q (cid:20) log Eθ∼q q(θ) p(θ | D) (cid:21) . (3) In practice, we define a parametric variational distribution qφ and use standard optimization methods like stochastic gradient descent to minimize the KL loss w.r.t. φ. We then use q∗(θ) instead of p(θ | D) to approximate the predictive distribution in Equation (2). In this paper, we focus on VI because it can capture arbitrarily complex, high-dimensional posteriors, assuming the chosen variational family is suffi- ciently expressive. At the same time, VI can scale to large datasets when combined with stochastic optimisation (Hoff- man et al., 2013; Swiatkowski et al., 2020; Tomczak et al., 2020; Tran et al., 2015). Other commonly used approximate inference methods are Markov chain Monte Carlo (MCMC) (Welling and Teh, 2011) and the Laplace approximation (Immer et al., 2020). MCMC samples from the posterior directly, but does not scale well to large models and datasets. The Laplace ap- proximation is more scalable, but assumes that the posterior can be approximated well with a Gaussian distribution. 2.2 Decision trees Decision trees are predictive models trained by recursively partitioning the input space and fitting a simple model (often constant) in each partition (leaf). At each non-terminal node of the tree, the model forwards the input to a child T. Cinquin, T. Rukkat, P. Schmidt, M. Wistuba, A. Bekasov based on a binary condition. For example, at a particular node the model might route the input x to the left sub-tree if x[i] ≤ τ , and to the right sub-tree otherwise, where i indexes a particular feature and τ is a threshold. The splits are determined by greedily optimizing a chosen criterion at each node. For instance, in the regression setting the feature index i and threshold τ could be selected to minimize the sum of square errors of the induced partition. The splitting hyperplanes are always parallel to the axes of the feature space. Predictions are made by forwarding x to a unique leaf and outputting the class (for classification) or the real value (for regression) associated with this particular leaf. Soft decision trees First introduced by Irsoy et al. (2012), soft decision trees use sigmoid gating functions to "soften" the binary routing at each node. More formally, the output f (x) of a soft decision tree is computed as the sum of the leaf outputs fl(x) weighted by the probability pl(x) that the input x is routed to the leaf l: f (x) = (cid:88) l∈L pl(x)fl(x), (4) where L is the set of leaf nodes. The probability pl(x) is defined as the product of probabilities returned by the soft gating functions on the path from the root to the leaf l. Details on the exact form of pl and fl are provided in Section 4.1. The sigmoid gating functions allow learning non-axis-aligned decision boundaries and smooth functions. This results in a differentiable model that can be trained by gradient descent, and yet performs well on tabular data (Feng et al., 2020; Irsoy et al., 2012; Linero and Yang, 2017; Luo et al., 2021). Computing the prediction of a soft tree requires evaluating all the leaves, and is therefore more expensive than doing so for the standard decision tree. In practice, however, a shallow soft decision tree can match the performance of a deep hard decision tree, which alleviates some of the computational overhead (Irsoy et al., 2012). Multiple variations of a soft decision tree exist. The tree depth can be fixed (Feng et al., 2020; Kontschieder et al., 2015; Luo et al., 2021) or adjusted dynamically by greedily adding new nodes while the validation loss decreases (Irsoy et al., 2012). Furthermore, the sigmoid gating functions can be based on linear models (Feng et al., 2020; Frosst and Hin- ton, 2017; Irsoy et al., 2012; Luo et al., 2021), multi-layer perceptrons (Feng et al., 2020; Kontschieder et al., 2015), or convolutional neural networks (Ahmeto ̆glu et al., 2018). Likewise, the leaves of the tree can output constant values (Feng et al., 2020; Frosst and Hinton, 2017; Kontschieder et al., 2015; Luo et al., 2021), or be defined using complex models such as neural networks (Ahmeto ̆glu et al., 2018). To address the exponential increase in prediction cost as the soft tree grows, Frosst and Hinton (2017) propose to only consider the most probable path from the root to a leaf. This method requires special regularization encouraging nodes to make equal use of each sub-tree to work and performs worse than averaging over all leaves, but is more efficient. In addition to state-of-the-art performance on tabular data, soft decision trees can be preferred to neural networks due to their greater interpretability (Frosst and Hinton, 2017). As soft trees rely on hierarchical decisions, one can examine the weights of the soft gating functions and gain insight into the learned function. In prior work, neural networks have been distilled into into soft trees to make their decisions ex- plainable, both in the context of image classification (Frosst and Hinton, 2017) and reinforcement learning (Coppens et al., 2019). Soft decision trees are similar to hierarchical mixtures of experts (HME, Jordan and Jacobs, 1993). While HMEs and soft decision trees share the same architecture, HMEs explic- itly model the assignment of each input to a leaf using latent variables. Therefore, HMEs are trained using the expecta- tion maximisation algorithm (EM, Dempster et al., 1977), rather than by maximising the log-likelihood. Jordan and Jacobs find that, when compared to the standard maximum likelihood with backpropagation, fitting an HME using EM requires fewer passes over the data, but the resulting models demonstrate higher test error. 2.3 Gradient boosting machines A gradient boosting machine (GBM) (Friedman, 2001) se- quentially combines a set of weak learners (e.g. decision trees) into an ensemble to obtain a stronger learner. At each iteration, a weak learner is trained to minimize the error of the existing ensemble, and is subsequently added to the ensemble. More formally, at iteration t the GBM combines the existing ensemble ft(x) = (cid:80)t j=1 γjhj(x) with an ad- ditional learner ht+1 ∈ H from some function class H s.t. ft+1(x) = ft(x) + γt+1ht+1(x) minimizes the training loss. Finding the optimal weak learner ht+1 is intractable in general, so the optimization problem is simplified by taking a step in the direction of the steepest decrease of the loss L in function space: ft+1(x) = ft(x) − γt+1 n (cid:88) i=1 ∇ftL(ft(xi), yi), (5) (cid:80)n i=1 is the training data. where D = {xi, yi}n In other words, each weak learner ht+1 is fit to match i=1 ∇ftL(ft(xi), yi). Taking multiple gradient −γt+1 boosting steps minimizes the training loss and yields an accurate model. GBMs demonstrate state-of-the-art perfor- mance on tabular data for both classification and regression tasks: models that win Kaggle1 competitions are commonly based on GBMs (Bojer and Meldgaard, 2021; Liu et al., 2021). 1https://www.kaggle.com Variational Boosted Soft Trees 3 RELATED WORK Bayesian hierarchical mixture of experts Prior work performed Bayesian inference on the parameters of HMEs using variational inference. These methods consider an ap- proximate posterior which factorizes the parameters into groups (leaf function, node gating function, latent variables, prior parameters) and places isotropic Gaussian priors on the leaf and node model parameters, as well as Gamma hyper-priors. Waterhouse et al. (1995) perform inference by iteratively optimizing the VI objective with respect to each group of parameters separately, keeping the others fixed. However, for tractability they use the Laplace approxima- tion on the node gating function parameters and hence do not get a lower bound on the evidence. Ueda and Ghahra- mani (2002) propose to model the joint distribution over both input and output variables, which allows to derive the variational posterior without approximations for a tree of height 1. However, capturing the input distribution is both expensive and unnecessary for regression and classification. Also this method does not apply to deeper trees. Finally, Bishop and Svensen (2012) derive a tractable lower bound on the variational inference objective, which is then opti- mised by iteratively updating the parameters of each factor of the variational posterior, keeping the others fixed. In contrast, we consider a simpler model which does not explicitly capture the assignment of data samples to leaves with latent variables. Furthermore, our proposed variational posterior is more expressive and can capture correlations between all the parameters of the model. Finally, we fit our model to optimise the variational objective using the reparameterization trick from Kingma and Welling (2013) and stochastic gradient descent. Bayesian gradient boosted trees Previous work on Bayesian GBMs uses MCMC to sample from the Bayesian posterior. Chipman et al. (1998) suggest performing infer- ence in a GBM using a Gibbs sampler which iteratively samples each tree conditioned on the other trees in the en- semble. This method, BART, requires a long burn-in period (≈1000 iterations). Pratola et al. (2017) improve BART with a heteroscedastic noise model at the cost of making inference slower, as it is performed on both the mean and noise models. In order to speed up the convergence of the BART sampler, He and Hahn (2020) propose Accelerated BART (XBART). Rather than making small changes to a given tree at each iteration, XBART grows an entirely new tree. This speeds up mixing considerably requiring only 15 burn-in iterations. As a mechanism for variable selection, the authors also propose placing a Dirichlet prior on the input features, improving performance on high-dimensional data. In parallel, Ustimenko and Prokhorenkova (2020) draw analogies between gradient boosting and MCMC, and prove that a set of modifications is enough to cast gradient boosting with Gaussian noise as stochastic gradient Langevin dynam- ics in function space. The resulting algorithm, stochastic gradient Langevin boosting (SGLB), allows to draw multi- ple samples from the posterior by training an ensemble of GBMs with targets perturbed by Gaussian noise. To reduce the memory and time complexity of SGLB, Malinin et al. (2020) introduce virtual ensembles. Taking advantage of the additive structure of GBMs, virtual ensembles collect multiple sub-ensembles by running a single SGLB model. However, faster training comes at the cost of higher corre- lation among models, thus reducing the effective sample size. Soft gradient boosting machine Just like decision trees, soft decision trees can be combined into ensembles to im- prove their predictive performance. Gradient boosting is a particularly successful method for doing so, hence Luo et al. (2021) experiment with combining soft trees using gradient boosting, and find the resulting method to be highly effective on tabular data. Similarly, Feng et al. (2020) sug- gest to fit soft GBMs by directly minimizing the gradient boosting loss using stochastic gradient descent. As each weak learner is updated in parallel, this method diverges significantly from the gradient boosting framework. An alternative line of research aims to arrive at a Bayesian soft GBM by making BART "smoother". Linero and Yang (2017) propose soft BART (SBART), a model which replaces the standard decision trees in BART with soft trees. Empiri- cally, fitting the resulting method is significantly slower than BART. Maia et al. (2022) suggest putting Gaussian process priors on each leaf in a BART model, demonstrating that this method performs better than BART and SBART, but is also slower. 4 METHODS 4.1 Variational soft trees In this section we propose a variational soft tree (VST), a model that has the same architecture as a fixed depth soft decision tree (Figure 1), but where we perform variational inference to approximate the full posterior distribution. We then sample from the posterior approximation to compute the predictive distribution in Equation (2) by Monte Carlo integration. We consider two variations of the variational soft tree: one with constant leaves as in (Feng et al., 2020; Frosst and Hinton, 2017; Kontschieder et al., 2015; Luo et al., 2021), and another with linear leaves, where each leaf outputs an affine function of the input. Linear leaves allow the model to represent piecewise linear functions, which are strictly more expressive than piecewise constant functions. In fact, a piecewise linear function can represent any dif- ferentiable scalar function in the limit of infinite pieces by setting each piece to the derivative of the function. Linear leaves use two additional parameter vectors per leaf, and in T. Cinquin, T. Rukkat, P. Schmidt, M. Wistuba, A. Bekasov model. In the constant leaf model, the output at each leaf is independent of the input: p(y | x, l, ψ) = p(y | l, ψ) = N (cid:0)y | μl, softplus(αl)2(cid:1), (10) (11) where ψ = {(μl, αl)}l∈L. In the linear leaf model, on the other hand, the parameters of the Gaussian are linear in the input: p(y | x, l, ψ) = N (cid:0)y | μl(x), σ2 l (x)(cid:1) μl(x) = wT l x + bl (cid:16) σl(x) = softplus (cid:17) l x + ˆbl ˆwT (12) (13) (14) where ψ = (cid:111) (cid:110) (wl, bl, ˆwl, ˆbl) and softplus(x) = l∈L log(1 + exp(x)). We use softplus functions to constrain the standard deviation parameters to remain strictly positive, while ensuring numerical stability (Blundell et al., 2015). Prior We use a spherical, zero centered Gaussian prior for the model parameters: p(θ) = N (cid:0)θ | 0, τ 2I(cid:1). (15) Note that for a constant leaf model we put this prior on the inverse softplus of the standard deviation at each leaf, which restricts the variance to stay strictly positive. Variational posterior We use the variational distribution proposed by Tomczak et al. (2020), which is a Normal distribution with a low-rank covariance matrix: q(θ) = N (cid:0)θ | μ, diag[σ2] + V V T (cid:1) (16) where σ ∈ Rp and V is a matrix of rank k. The hyperpa- rameter k determines the rank of the covariance matrix, and hence the expressivity of the posterior. If θ ∈ Rp, choosing k = p allows learning arbitrary covariance matrices, but increases the memory requirements and computational cost. As a result, in our experiments we typically choose k < p. This choice of the variational posterior and the prior admits an analytical KL-divergence which is detailed in Section 1.1 in the supplementary material. 4.2 Gradient boosted variational soft trees In order to increase the expressivity of the variational soft tree, we propose to use these models as weak learners in a gradient boosting machine that we refer to as a variational soft GBM (VSGBM). More formally, the model is defined as Fθ(x) = T (cid:88) t=1 fθt(x) + (cid:15) where (cid:15) ∼ N (cid:0)(cid:15) | 0, σ2(cid:1) (17) (a) Soft tree (b) Bayesian soft tree Figure 1: Standard vs. Bayesian soft decision tree. In a standard soft tree each weight is assigned a fixed value, while in a Bayesian soft tree each weight is a distribution. our experiments had a marginal effect on the computation cost. To our knowledge, we are the first to consider soft decision trees with linear leaves. Likelihood We define the likelihood of the soft tree as p(y | x, θ) = (cid:88) l∈L P (l | x, φ)p(y | x, l, ψ), (6) where L is the set of tree leaves (terminal nodes) and θ = {φ, ψ} are the parameters of the soft tree. P (l | x, φ), the first term inside the sum in Equation (6), is the probability that the input x is routed to the leaf l, defined as: P (l | x, φ) = (cid:89) (cid:104) n∈Path(l) P (r | n, x, φ)n(cid:38)l P (¬r | n, x, φ)l(cid:46)n(cid:105) , (7) where Path(l) the set of tree nodes on the path from the root to the leaf l, n(cid:38)l = 1 if the leaf l is in the right subtree of node n, l(cid:46)n = 1 if it is in the left subtree, and P (r | n, x, φ) is the probability that x is routed to the right subtree at the node n, with P (¬r | n, x, φ) = 1 − P (r | n, x, φ). We parametrize P (r | n, x, φ) using a soft gating function fφ: P (r | n, x, φ) = fφ(x, n), (8) restricting fφ(x, n) ∈ [0, 1] for all x and n. In this work, we choose a simple linear gating function (Feng et al., 2020; Frosst and Hinton, 2017; Irsoy et al., 2012; Luo et al., 2021): fφ(x, n) = σ(cid:0)β(cid:0)wT n x + bn (cid:1)(cid:1), (9) where σ is the standard sigmoid function, β is an inverse temperature parameter used to regularize the function during training (Frosst and Hinton, 2017), and φ = {(wn, bn)}n∈N are the parameters of the function for the set of tree nodes N . The second term inside the sum in Equation (6), p(y | x, l, ψ), is the predictive probability when the input x is routed to the leaf l. In this work, we consider two varia- tions of this term: a constant leaf model, and a linear leaf μ!σ!μ"σ"μ#σ#μ$σ$p!1−p!p!x1−p"1−p#p"p#p"xp#xp!1−p!x1−p"1−p#p"p#xxp!p#p"μ!σ!μ#σ#μ$σ$μ"σ"μ!σ!μ"σ"μ#σ#μ$σ$p!1−p!p!x1−p"1−p#p"p#p"xp#xp!1−p!x1−p"1−p#p"p#xxp!p#p"μ!σ!μ#σ#μ$σ$μ"σ" Variational Boosted Soft Trees Algorithm 1: Gradient boosted variational soft trees Input: Prior parameters aσ and bσ T the number of soft trees in the GBM Data: {X, y} Fit variational soft tree fθ1 to {X, y} for t ∈ [2, . . . T ] do Sample parameters for all models fθj : θj ∼ qj for j = 1 . . . t − 1 Compute the residual vector: rt = y − (cid:80)t−1 Fit the new model fθt to {X, rt} j=1 fθj (X) end Sample parameters θ = {θj}T Compute final residuals r = y − Fθ(X) Sample σ2 ∼ inverse-Gamma(aσ + n, bσ + rT r) j=1 where θj ∼ qj where fθt is a variational soft tree with parameters θt, T is the number of trees in the ensemble and σ is a scale param- eter. We consider variational soft trees fθt that output the estimated mean value of the target and no standard devia- tion. Hence the variational soft GBM has a homoskedastic (input-independent) variance model. Heteroskedastic (input- dependent) uncertainty could in principle be modeled by returning the predictive variances from the weak learners alongside the predictive means, and combining them up- stream. In our early experiments this configuration proved to be costly to train (it doubles the number of model param- eters), and made the training unstable (the gradient boosting loss had high variance). In prior work Pratola et al. (2017) train a separate ensemble to capture aleatoric uncertainty, likely to avoid this instability. Inspired by He and Hahn (2020), we place an inverse-Gamma(aσ, bσ) prior on σ2, yielding an inverse-Gamma(aσ + n, bσ + rT r) posterior, where n is the number of data samples and r = y − Fθ(X) is the residual vector. The variational soft GBM is fit following the procedure described in Algorithm 1. Once trained, samples from the approximate posterior of the variational soft GBM are obtained by drawing parameters from the variational distribution of each variational soft tree model in the ensemble. The predictive distribution is then approximated by Monte Carlo integration of the likelihood as per Equation (2), i.e. by aggregating the predictions of the variational soft trees as defined by Equation (17) for different posterior samples. 5 EXPERIMENTS lated. When reporting results, we bold the highest score, as well as any score if its error bar and the highest score's error bar overlap, considering the difference to not be statistically significant. 5.1 Regression We consider a suite of regression datasets used by Malinin et al. (2020) described in Table 4 in supplementary material. We perform 10-fold cross validation on the training data and report the mean and standard deviation of the test log- likelihood and root mean square error (RMSE) of our mod- els across the folds. We compare our variational soft deci- sion trees (VST) and variational soft GBM (VSGBM) with two Bayesian GBMs (XBART (He and Hahn, 2020) and SGLB (Ustimenko and Prokhorenkova, 2020)), an ensem- ble of neural networks, and XGBoost (Chen and Guestrin, 2016). When comparing models to VSTs, we consider base- lines with an ensemble size of one, and otherwise multiple ensemble members when comparing with the VSGBM. The only exception is the ensemble of deep neural networks for which we always use an ensemble of ten models to measure epistemic uncertainty. Variational soft decision tree We find that our model performs well in terms of test log-likelihood and RMSE across the considered datasets (see Tables 1 and 6), which confirms that soft decision trees are well-suited to tabular data (Luo et al., 2021). VSTs outperform the baselines on 7/10 datasets in terms of log-likelihood, and 3/10 datasets in terms of RMSE, also matching the log-likehood and RMSE of best performing baselines on 1/10 and 3/10 datasets re- spectively. In addition, soft decision trees with linear leaves perform better than equivalent constant leaf models on 8/10 datasets in terms of log-likelihood and 5/10 in terms of RMSE, bringing evidence that linear leaf models are more expressive than constant leaf models. VSTs are less competitive when trained on small datasets like boston (506 training examples) and yacht (308 training examples). We hypothesize that in these cases the model underfits the data due to the choice of the prior. The param- eters of the prior were chosen by hyper-parameter tuning with the validation ELBO objective, and the underfitting behavior could be an artifact of this tuning procedure. An al- ternative hypothesis is that a normal prior is simply ill-suited to this model. Choosing priors for complex, deep models is difficult, and is an active research direction in Bayesian deep learning (Flam-Shepherd, 2017; Fortuin et al., 2021; Krishnan et al., 2020; Vladimirova et al., 2018). In this section we evaluate the variational soft tree and varia- tional soft GBM on regression, out-of-distribution detection and multi-armed bandits. Although we are not measuring model calibration directly, like prior work we assume that model calibration and performance on these tasks are corre- Variational soft GBM VSGBMs perform competitively in terms of log-likelihood compared to the baselines (see Tables 1 and 6), yielding the best log-likelihood on 7/10 datasets. The VSGBMs perform on par with baselines on power and boston, worse on yacht but better on the other T. Cinquin, T. Rukkat, P. Schmidt, M. Wistuba, A. Bekasov Table 1: Test log-likelihood of evaluated methods on regression datasets. We find that variational soft decision trees (VST) and variational soft GBMs (VSGBM) perform strongly compared to baselines in terms of test log-likelihood, both methods out-performing them on 7/10 datasets. MODEL POWER PROTEIN BOSTON NAVAL YACHT SONG CONCRETE ENERGY KIN8NM WINE DEEP ENSEMBLE -1.404 ± 0.001 -1.422 ± 0.000 -1.259 ± 0.007 -1.412 ± 0.000 -1.112 ± 0.009 -1.415 ± 0.001 -1.390 ± 0.001 -1.677 ± 0.073 -1.416 ± 0.000 -1.725 ± 0.075 XBART (1 TREE) SGLB (1 TREE) VST (CONST.) VST (LINEAR) XBART SGLB VSGBM (CONST.) VSGBM (LINEAR) -0.096 ± 0.003 -1.425 ± 0.027 -0.032 ± 0.010 0.024 ± 0.002 -0.001 ± 0.006 -0.500 ± 0.001 -0.002 ± 0.011 -0.015 ± 0.011 -1.136 ± 0.003 -1.499 ± 0.002 -0.719 ± 0.005 -0.631 ± 0.011 -1.136 ± 0.003 -1.204 ± 0.002 -1.039 ± 0.005 -1.051 ± 0.012 -0.508 ± 0.042 -1.361 ± 0.044 -0.920 ± 0.002 -0.682 ± 0.004 -0.462 ± 0.054 -0.504 ± 0.013 -0.567 ± 0.062 -0.462 ± 0.054 -0.485 ± 0.419 -1.410 ± 0.009 -0.555 ± 0.088 -0.335 ± 0.026 0.008 ± 0.130 -0.877 ± 0.004 0.573 ± 0.311 0.542 ± 0.295 1.110 ± 0.021 -0.891 ± 0.047 0.193 ± 0.024 -0.754 ± 0.005 1.116 ± 0.023 -0.018 ± 0.009 0.045 ± 0.912 -0.033 ± 0.049 -1.151 ± 0.006 -1.305 ± 0.007 -0.733 ± 0.010 -0.579 ± 0.002 -1.018 ± 0.002 -0.907 ± 0.001 -0.933 ± 0.008 -0.729 ± 0.019 -0.793 ± 0.079 -1.748 ± 0.050 -0.999 ± 0.006 -0.461 ± 0.070 -0.581 ± 0.024 -0.931 ± 0.010 -0.465 ± 0.040 -0.591 ± 0.079 -0.848 ± 0.567 -1.078 ± 0.006 -0.710 ± 0.280 0.377 ± 0.123 -0.462 ± 0.054 -0.232 ± 0.009 -0.227 ± 0.038 0.057 ± 0.134 -1.153 ± 0.014 -1.659 ± 0.015 -0.877 ± 0.014 -0.707 ± 0.012 -1.057 ± 0.007 -1.125 ± 0.002 -0.457 ± 0.021 -0.363 ± 0.031 -1.250 ± 0.008 -1.559 ± 0.033 1.458 ± 0.615 3.067 ± 1.168 -1.251 ± 0.010 -1.220 ± 0.006 -1.192 ± 0.007 -1.167 ± 0.004 (a) Variational soft tree (b) XBART (c) SGLB Figure 2: Variational soft trees (VST) show high uncertainty in the tails outside of the data support while closely agreeing with the mean inside the support. Sampled function show more diversity in tails with VSTs than with XBART and SGLB. The VST uses linear leaves, while XBART and SGLB use constant leaves. datasets. However, VSGBMs are less competitive in terms of RMSE when compared to XGBoost that yields smaller RMSE on all but three datasets. Compared to other base- lines, VSGBM consistently outperforms the deep ensem- ble, and performs favorably when compared to SGLB and XBART. In addition, we find that VSGBMs with linear leaves perform slightly better than equivalent constant leaf models, outperforming them on 4/10 datasets in terms of log-likelihood and 3/10 in terms of RMSE, while also match- ing the log-likelihod and RMSE of constant leaves on 5/10 and 6/10 datasets respectively. Compared to a VST, a VSGBM performs better in terms of RMSE on all datasets but two where both models score equally well. However, VSTs obtain higher log-likelihoods than VSGBMs on 5/10 datasets, equivalent scores on 2/10 and performs worse on 3/10. We explain this by the simpler variance model used in the VSGBM, which does not allow for heteroskedastic (input dependent) uncertainty. Uncertainty estimation visualization An important property of a reliable predictive model is its increased pre- dictive uncertainty for inputs in regions with little training data. To understand if VSTs demonstrate this behavior, we plot functions sampled from the variational posterior for simple synthetic datasets, and compare them to functions sampled from XBART and SGLB posteriors. We plot the sampled functions in Figures 2 and 5. We find that VSTs indeed capture the uncertainty outside of the support of the data better than both XBART and SGLB: functions agree with the true mean within the support of the data, but diverge outside of it. 5.2 OOD detection Out-of-distribution (OOD) data is data that is sampled from a distribution that is sufficiently different from the train- ing data distribution. It has been observed in prior work (Ma and Hernández-Lobato, 2021; Tomczak et al., 2020) that an effective Bayesian model will show high epistemic uncertainty when presented with OOD data, so we further evaluate our models by testing if their epistemic uncertainty is predictive of OOD data. Following the setup of Malinin et al. (2020), we define OOD data by selecting a subset of data from a different dataset. To perform OOD detection, we compute the epis- temic uncertainty of each sample under our models and evaluate how well a single splitting threshold separates the epistemic uncertainty of in-distribution and OOD samples, as proposed by Mukhoti et al. (2021). Epistemic uncertainty is measured as the variance of the mean prediction with respect to samples from the posterior or the ensemble. The detection performance is quantified using the area under the receiver operating characteristic curve (AUROC). We report the mean and standard deviation of the AUROC of each model across 10 folds of cross-validation. As before, we compare our VSTs and VSGBMs with XBART, SGLB 0.00.20.40.60.81.0x21012yTraining dataTargetSample from predictive0.00.20.40.60.81.0x21012y0.00.20.40.60.81.0x21012y Variational Boosted Soft Trees Table 2: OOD detection AUROC scores with variational soft trees (VST) and variational soft GBMs (VSGBM) against baselines (higher is better). Variational soft decision trees and variational soft GBMs perform well on out of distribution detection, yielding the best score on 6/10 and 5/10 datasets respectively. MODEL POWER PROTEIN BOSTON NAVAL YACHT SONG CONCRETE ENERGY KIN8NM WINE DEEP ENSEMBLE 0.540 ± 0.015 0.504 ± 0.003 0.545 ± 0.023 1.000 ± 0.000 0.691 ± 0.088 0.510 ± 0.007 0.767 ± 0.042 0.554 ± 0.036 0.508 ± 0.005 0.547 ± 0.019 XBART (1 TREE) SGLB (1 TREE) VST (CONST.) VST (LINEAR) XBART SGLB VSGBM (CONST.) VSGBM (LINEAR) 0.562 ± 0.018 0.593 ± 0.025 0.591 ± 0.025 0.618 ± 0.024 0.572 ± 0.011 0.600 ± 0.011 0.569 ± 0.018 0.571 ± 0.010 0.684 ± 0.015 0.760 ± 0.018 0.866 ± 0.018 0.920 ± 0.019 0.678 ± 0.016 0.874 ± 0.006 0.890 ± 0.011 0.950 ± 0.016 0.656 ± 0.042 0.732 ± 0.039 0.712 ± 0.020 0.698 ± 0.020 0.741 ± 0.041 0.738 ± 0.027 0.775 ± 0.101 0.795 ± 0.025 0.578 ± 0.050 0.770 ± 0.021 0.884 ± 0.024 1.000 ± 0.000 0.912 ± 0.033 0.907 ± 0.011 1.000 ± 0.000 1.000 ± 0.000 0.603 ± 0.021 0.607 ± 0.035 0.718 ± 0.048 0.655 ± 0.015 0.607 ± 0.026 0.662 ± 0.036 0.663 ± 0.055 0.618 ± 0.020 0.608 ± 0.033 0.589 ± 0.035 0.560 ± 0.025 0.601 ± 0.015 0.565 ± 0.013 0.697 ± 0.029 0.586 ± 0.014 0.602 ± 0.006 0.671 ± 0.028 0.723 ± 0.018 0.677 ± 0.049 0.840 ± 0.013 0.818 ± 0.020 0.763 ± 0.024 0.666 ± 0.033 0.763 ± 0.023 0.852 ± 0.141 0.969 ± 0.003 0.863 ± 0.045 0.996 ± 0.003 0.837 ± 0.146 0.973 ± 0.007 0.901 ± 0.018 0.993 ± 0.008 0.525 ± 0.010 0.519 ± 0.005 0.529 ± 0.016 0.586 ± 0.011 0.541 ± 0.011 0.508 ± 0.004 0.562 ± 0.015 0.608 ± 0.012 0.548 ± 0.016 0.571 ± 0.021 0.796 ± 0.010 0.742 ± 0.036 0.549 ± 0.021 0.613 ± 0.019 0.625 ± 0.019 0.688 ± 0.027 Table 3: Cumulative regret of the bandits using variational soft trees (VST) vs. baselines. We find that VST performs competitively compared to baselines, achieving the lowest cumulative regret on 2/4 bandits. BANDIT FINANCIAL EXPLORATION MUSHROOM JESTER RANDOM POLICY VST SGLB XBART 1682.05 ± 20.23 357.47 ± 34.32 613.12 ± 45.96 984.86 ± 47.59 18904.95 ± 24.37 7054.60 ± 748.79 9469.07 ± 1197.60 5039.93 ± 322.63 1791.28 ± 29.61 1412.55 ± 5.64 DOESN'T WORK 1577.70 ± 61.56 7845.28 ± 26.99 6048.99 ± 42.26 5762.89 ± 82.10 6305.43 ± 31.97 SGLB as before. We do not experiment with VSGBMs in the bandit setting due to computational cost. In this set- ting, the model has to be re-trained after every update, and training a VSGBM is expensive: boosting is sequential by nature, and VST weak learners require a number of gradient descent iterations to converge. Each bandit simulation is run five times with different random seeds, and we report the mean and the standard deviation of the cumulative regret across the simulations. The predictive uncertainty of VST is competitive in this setting as well, as shown in Table 3. The VST obtains the lowest cumulative regret on the mushroom and financial datasets, converging to near zero instantaneous regret on the latter (see Figure 4). On the jester dataset, the VST demonstrates second best cumulative regret, although the performance of all three models is comparable to the random policy. We explain this by the difficulty of the regression problem in this particular dataset. Finally, just like on jester, the VST shows second best cumulative regret on the explo- ration dataset. 6 DISCUSSION In this work we proposed to perform variational inference to approximate the Bayesian posterior of a soft decision tree. We use a variational distribution that allows trading off memory and computation for a richer posterior approxima- tion. Using soft decision trees models as weak learners, we build a variational soft GBM that is more expressive than the individual trees, but preserves their well-calibrated predic- tive uncertainty. We find that both variational soft trees and variational soft GBMs perform well on tabular data com- pared to strong baselines, and provide useful uncertainty Figure 3: OOD detection AUROC score vs. the rank of the variational posterior covariance matrix in variational soft trees (VST). The quality of the OOD detection generally increases with the rank of the approximate posterior covari- ance. As we consider a large number of different model and dataset configurations, we only present the ones for which the increase in AUROC is most significant. The rightmost point of each plot corresponds to a full rank covariance approximation. and a deep ensemble. We find that variational soft decision trees perform well on OOD detection, outperforming baselines on 6/10 datasets and tying on others (see Table 2). VSGBMs also perform well, yielding the best scores on 5/10 datasets and addition- ally matching best baselines on 2/10 (see Table 2). However, the improvements over the top baselines are less significant than with variational soft decision trees. As expected, we find that increasing the rank of the approximate variational posterior increases the OOD performance, although the sig- nificance of the improvement depends on the dataset (see Figure 3). This effect is most prominent with variational soft decision trees, and is less so in VSGBMs. 5.3 Bandits We further evaluate the VST by using it in Thompson sam- pling (Thompson, 1933) on four different multi-armed ban- dit problems (see Section 2.3 in the supplementary material for more detail on the datasets), comparing to XBART and 050100150200250Rank of variational posterior covariance0.550.600.650.700.75OOD detection AUROCwine linearwine constantboston linearyacht constant T. Cinquin, T. Rukkat, P. Schmidt, M. Wistuba, A. Bekasov (a) Financial (b) Mushroom (c) Jester (d) Exploration Figure 4: Bandit results. We find that the variational soft tree (VST) converges to near zero instantaneous regret on the financial bandit and performs competitively compared to baselines in the bandit setting. estimates for OOD detection and multi-armed bandits. An important direction for future work is to speed up the training of variational soft trees and GBMs. This is es- pecially important when working in the low-data regime (<104 samples), where our models are slower than the base- line based on standard decision trees, and in the context of multi-armed bandits, where the model needs to be up- dated repeatedly. For the latter, an alternative direction is to adapt our models for continual learning by implement- ing an efficient Bayesian update, which would accelerate sequential learning tasks like multi-armed bandits, Bayesian optimization and active learning. Finally, addapting VST and VSGBM to the classification setting is an interesting direction for future work. Classification with tabular data is important in many applications, many of which might also benefit from well-calibrated predictive uncertainties (Ebbehoj et al., 2021; Mustafa and Rahimi Azghadi, 2021). References Borisov, V., Leemann, T., Sessler, K., Haug, J., Pawelczyk, M., and Kasneci, G. (2021). Deep neural networks and tabular data: A survey. Bradbury, J., Frostig, R., Hawkins, P., Johnson, M. J., Leary, C., Maclaurin, D., Necula, G., Paszke, A., VanderPlas, J., Wanderman-Milne, S., and Zhang, Q. (2018). JAX: Com- posable transformations of Python+NumPy programs. Chen, T. and Guestrin, C. (2016). XGBoost: A scalable tree boosting system. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discov- ery and Data Mining, San Francisco, CA, USA, August 13-17, 2016, pages 785–794. Chipman, H. A., George, E. I., and McCulloch, R. E. (1998). Bayesian cart model search. Journal of the American Statistical Association, 93(443):935–948. Clements, J. M., Xu, D., Yousefi, N., and Efimov, D. (2020). Sequential deep learning for credit risk monitoring with tabular financial data. Abdullah, A., Hassan, M., and Mustafa, Y. (2022). A review on Bayesian deep learning in healthcare: Applications and challenges. IEEE Access, 10:1–1. Cobb, A. D. and Jalaian, B. (2020). Scaling Hamiltonian Monte Carlo inference for Bayesian neural networks with symmetric splitting. Ahmeto ̆glu, A., ̇Irsoy, O., and Alpaydın, E. (2018). Convolu- tional soft decision trees. In K ̊urková, V., Manolopoulos, Y., Hammer, B., Iliadis, L., and Maglogiannis, I., edi- tors, Artificial Neural Networks and Machine Learning – ICANN 2018, pages 134–141, Cham. Springer Interna- tional Publishing. Bew, D., Harvey, C. R., Ledford, A., Radnor, S., and Sin- clair, A. (2019). Modeling analysts' recommendations via Bayesian machine learning. The Journal of Financial Data Science, 1(1):75–98. Coppens, Y., Efthymiadis, K., Lenaerts, T., and Nowé, A. (2019). Distilling deep reinforcement learning policies in soft decision trees. In IJCAI 2019. Deisenroth, M. and Rasmussen, C. (2011). Pilco: A model- based and data-efficient approach to policy search. pages 465–472. Dempster, A. P., Laird, N. M., and Rubin, D. B. (1977). Maximum likelihood from incomplete data via the EM algorithm. JOURNAL OF THE ROYAL STATISTICAL SOCIETY, SERIES B, 39(1):1–38. Bishop, C. M. and Svensen, M. (2012). Bayesian hierarchi- Dua, D. and Graff, C. (2017). UCI machine learning reposi- cal mixtures of experts. tory. Blundell, C., Cornebise, J., Kavukcuoglu, K., and Wierstra, D. (2015). Weight uncertainty in neural networks. Bojer, C. S. and Meldgaard, J. P. (2021). Kaggle forecast- ing competitions: An overlooked learning opportunity. International Journal of Forecasting, 37(2):587–603. Ebbehoj, A., Thunbo, M., Andersen, O. E., Glindtvad, M. V., and Hulman, A. (2021). Transfer learning for non-image data in clinical research: a scoping review. medRxiv. Feng, J., Xu, Y.-X., Jiang, Y., and Zhou, Z.-H. (2020). Soft gradient boosting machine. 0100020003000Simulation steps050010001500Cumulative regretXBartSGLBVSTRandom policy0200040006000Simulation steps050010001500Cumulative regretXBartVSTRandom policy050001000015000Simulation steps02000400060008000Cumulative regretXBartSGLBVSTRandom policy05000100001500020000Simulation steps050001000015000Cumulative regretXBartSGLBVSTRandom policy Variational Boosted Soft Trees Flam-Shepherd, D. (2017). Mapping Gaussian process pri- ors to Bayesian neural networks. Fortuin, V., Garriga-Alonso, A., Ober, S. W., Wenzel, F., Rätsch, G., Turner, R. E., van der Wilk, M., and Aitchison, L. (2021). Bayesian neural network priors revisited. Freund, Y. and Schapire, R. E. (1997). A decision-theoretic generalization of on-line learning and an application to boosting. Journal of Computer and System Sciences, 55(1):119–139. Friedman, J. H. (2001). Greedy function approximation: A gradient boosting machine. The Annals of Statistics, 29(5):1189 – 1232. Frosst, N. and Hinton, G. (2017). Distilling a neural network into a soft decision tree. Goldberg, K., Roeder, T., Gupta, D., and Perkins, C. (2001). Eigentaste: A constant time collaborative filtering algo- rithm. Information Retrieval, 4:133–151. Gonzalvez, J., Lezmi, E., Roncalli, T., and Xu, J. (2019). Fi- nancial applications of Gaussian processes and Bayesian optimization. Graf, F., Kriegel, H.-P., Schubert, M., Pölsterl, S., and Cav- allaro, A. (2011). 2D image registration in CT images using radial image descriptors. Medical image computing and computer-assisted intervention : MICCAI ... Inter- national Conference on Medical Image Computing and Computer-Assisted Intervention, 14 Pt 2:607–14. Guo, C., Pleiss, G., Sun, Y., and Weinberger, K. Q. (2017). On calibration of modern neural networks. In Interna- tional conference on machine learning, pages 1321–1330. PMLR. He, J. and Hahn, P. R. (2020). Stochastic tree ensembles for regularized nonlinear regression. Hennigan, T., Cai, T., Norman, T., and Babuschkin, I. (2020). Haiku: Sonnet for JAX. Hoang, D. and Wiegratz, K. (2021). Machine learning methods in finance: Recent applications and prospects. Hoffman, M. D., Blei, D. M., Wang, C., and Paisley, J. (2013). Stochastic variational inference. Journal of Ma- chine Learning Research, 14(40):1303–1347. Immer, A., Korzepa, M., and Bauer, M. (2020). Improving predictions of Bayesian neural nets via local linearization. Irsoy, O., Yildiz, O., and Alpaydın, E. (2012). Soft decision trees. pages 1819–1822. Jordan, M. and Jacobs, R. (1993). Hierarchical mixtures of experts and the EM algorithm. In Proceedings of 1993 International Conference on Neural Networks (IJCNN- 93-Nagoya, Japan), volume 2, pages 1339–1344 vol.2. Kingma, D. P. and Ba, J. (2014). Adam: A method for stochastic optimization. Kingma, D. P. and Welling, M. (2013). Auto-encoding variational Bayes. Kirsch, A., van Amersfoort, J., and Gal, Y. (2019). Batch- bald: Efficient and diverse batch acquisition for deep Bayesian active learning. Kompa, B., Snoek, J., and Beam, A. (2021). Second opinion needed: communicating uncertainty in medical machine learning. npj Digital Medicine, 4. Kontschieder, P., Fiterau, M., Criminisi, A., and Rota Bulò, S. (2015). Deep neural decision forests. pages 1467– 1475. Krause, A., Guestrin, C., Gupta, A., and Kleinberg, J. (2006). Near-optimal sensor placements: Maximizing informa- tion while minimizing communication cost. In 2006 5th International Conference on Information Processing in Sensor Networks, pages 2–10. Krishnan, R., Subedar, M., and Tickoo, O. (2020). Specify- ing weight priors in Bayesian deep neural networks with empirical Bayes. Proceedings of the AAAI Conference on Artificial Intelligence, 34(04):4477–4484. Kristiadi, A., Hein, M., and Hennig, P. (2020). Being Bayesian, even just a bit, fixes overconfidence in ReLU networks. Linero, A. R. and Yang, Y. (2017). Bayesian regression tree ensembles that adapt to smoothness and sparsity. Liu, Z., Pavao, A., Xu, Z., Escalera, S., Ferreira, F., Guyon, I., Hong, S., Hutter, F., Ji, R., Jacques Junior, J. C. S., Li, G., Lindauer, M., Luo, Z., Madadi, M., Nierhoff, T., Niu, K., Pan, C., Stoll, D., Treguer, S., Wang, J., Wang, P., Wu, C., Xiong, Y., Zela, A., and Zhang, Y. (2021). Winning solutions and post-challenge analyses of the ChaLearn AutoDL challenge 2019. IEEE Transactions on Pattern Analysis and Machine Intelligence. Luo, H., Cheng, F., Yu, H., and Yi, Y. (2021). SDTR: Soft decision tree regressor for tabular data. IEEE Access, 9:55999–56011. Ma, C. and Hernández-Lobato, J. M. (2021). Functional variational inference based on stochastic process gener- ators. In Ranzato, M., Beygelzimer, A., Dauphin, Y., Liang, P., and Vaughan, J. W., editors, Advances in Neu- ral Information Processing Systems, volume 34, pages 21795–21807. Curran Associates, Inc. Maia, M., Murphy, K., and Parnell, A. C. (2022). GP- BART: A novel Bayesian additive regression trees ap- proach using Gaussian processes. arXiv e-prints, page arXiv:2204.02112. Malinin, A., Prokhorenkova, L., and Ustimenko, A. (2020). Uncertainty in gradient boosting via ensembles. Mitros, J. and Namee, B. M. (2019). On the validity of Bayesian neural networks for uncertainty estimation. Mukhoti, J., Kirsch, A., van Amersfoort, J., Torr, P. H. S., and Gal, Y. (2021). Deep deterministic uncertainty: A simple baseline. T. Cinquin, T. Rukkat, P. Schmidt, M. Wistuba, A. Bekasov Mustafa, A. and Rahimi Azghadi, M. (2021). Automated machine learning for healthcare and clinical notes analy- sis. Computers, 10(2). the 28th International Conference on International Con- ference on Machine Learning, ICML'11, page 681–688, Madison, WI, USA. Omnipress. Niculescu-Mizil, A. and Caruana, R. A. (2012). Obtaining calibrated probabilities from boosting. Pratola, M., Chipman, H., George, E., and McCulloch, R. (2017). Heteroscedastic BART using multiplicative re- gression trees. Riquelme, C., Tucker, G., and Snoek, J. (2018). Deep Bayesian bandits showdown: An empirical comparison of Bayesian deep networks for Thompson sampling. Shwartz-Ziv, R. and Armon, A. (2022). Tabular data: Deep learning is not all you need. Information Fusion, 81:84– 90. Springenberg, J. T., Klein, A., Falkner, S., and Hutter, F. (2016). Bayesian optimization with robust Bayesian neu- ral networks. In Lee, D., Sugiyama, M., Luxburg, U., Guyon, I., and Garnett, R., editors, Advances in Neu- ral Information Processing Systems, volume 29. Curran Associates, Inc. Swiatkowski, J., Roth, K., Veeling, B. S., Tran, L., Dillon, J. V., Snoek, J., Mandt, S., Salimans, T., Jenatton, R., and Nowozin, S. (2020). The k-tied normal distribution: A compact parameterization of Gaussian mean field posteri- ors in Bayesian neural networks. Thompson, W. R. (1933). On the likelihood that one un- known probability exceeds another in view of the evi- dence of two samples. Biometrika, 25(3-4):285–294. Tomczak, M., Swaroop, S., and Turner, R. (2020). Effi- cient low rank Gaussian variational inference for neural networks. In Larochelle, H., Ranzato, M., Hadsell, R., Balcan, M., and Lin, H., editors, Advances in Neural Information Processing Systems, volume 33, pages 4610– 4622. Curran Associates, Inc. Tran, D., Ranganath, R., and Blei, D. M. (2015). The variational Gaussian process. Ueda, N. and Ghahramani, Z. (2002). Bayesian model search for mixture models based on optimizing variational bounds. Neural Networks, 15(10):1223–1241. Ustimenko, A. and Prokhorenkova, L. (2020). SGLB: Stochastic gradient Langevin boosting. Vladimirova, M., Verbeek, J., Mesejo, P., and Arbel, J. (2018). Understanding priors in Bayesian neural networks at the unit level. Waterhouse, S., MacKay, D., and Robinson, A. (1995). Bayesian methods for mixtures of experts. In Touretzky, D., Mozer, M., and Hasselmo, M., editors, Advances in Neural Information Processing Systems, volume 8. MIT Press. Welling, M. and Teh, Y. W. (2011). Bayesian learning via stochastic gradient Langevin dynamics. In Proceedings of Variational Boosted Soft Trees 1 Additional method details 1.1 Variational inference We use the variational distribution proposed by Tomczak et al. (2020), which is a normal distribution with a low-rank covariance matrix: q(θ) = N (cid:0)θ | μ, diag[σ2] + V V T (cid:1) (18) where μ ∈ Rp is the mean of the normal distribution over parameters, diag[σ2] ∈ Rp×p is the diagonal component of the covariance with σ ∈ Rp, and V ∈ Rp×k is the rank k component of the covariance. The hyperparameter k determines the rank of the covariance matrix, and hence the expressivity of the posterior. Choosing k = p allows learning arbitrary covariance matrices, but increases the memory requirements and computational cost. As a result, in our experiments we typically choose k < p. We fit the variational soft tree by maximizing the evidence lower bound (ELBO): ELBO = Eθ∼q(θ)[log p(y | x, θ)] − DKL(q(θ) (cid:107) p(θ)). We compute a Monte Carlo estimate of the expectation: Eθ∼q[log p(y | x, θ)] ≈ 1 m m (cid:88) i=1 (cid:16) log p y | x, θ(i)(cid:17) , (19) (20) where θ(i) ∼ q(θ). For the chosen posterior in Equation (18) and an isotropic Gaussian prior p(θ) = N (θ | 0, γI), the KL divergence term is available in a closed form: DKL(q(θ) (cid:107) p(θ)) = 1 2 (cid:34) p (cid:88) d=1 (cid:18) σ2 d γ − log σ2 d (cid:19) + 1 γ k (cid:88) i=1 ||vi||2 2 − ∆ + 1 γ ||μ||2 2 + p(log γ − 1) , (21) (cid:35) where V = [v1, . . . vk] ∈ Rp×k, σ ∈ Rp and ∆ = log det(Ik + V T diag[σ2]−1V ). 2 Experimental details 2.1 Regression We consider a suite of regression datasets from Malinin et al. (2020) to measure the expressivity of our model. Table 4 summarizes the number of examples and features in each dataset. We preprocess the datasets by encoding categorical variables as one-hot vectors and normalizing each feature to have zero mean and unit variance. We further split the datasets into train (80%) and test (20%) data, and perform 10-fold cross validation on the training data. We report the mean and the standard deviation of the test log-likelihood and root mean square error (RMSE) across all folds. Table 4: Regression dataset description DATASET BOSTON NAVAL POWER PROTEIN YACHT SONG CONCRETE ENERGY KIN8NM WINE NUMBER SAMPLES NUMBER FEATURES 506 13 11 934 16 9 568 4 45 730 9 308 6 514 345 90 1 030 8 768 8 8 192 8 1 599 11 2.2 OOD detection Following the setup from Malinin et al. (2020), we consider the test data to be the in-distribution (ID) data, and create a dataset of OOD data by taking a subset of the song dataset of the same size. We select a subset of features from the song dataset in order to match the feature dimension of the ID dataset. The only exception is the song dataset itself, for which we use the Relative location of CT slices on axial axis dataset from Graf et al. (2011) as OOD data. In both settings, categorical features are encoded as one-hot vectors, and all features are normalized to have zero mean and unit variance. We use a one-node decision tree to find the splitting threshold for the epistemic uncertainty that would separate ID and ODD data. T. Cinquin, T. Rukkat, P. Schmidt, M. Wistuba, A. Bekasov 2.3 Bandit We consider the following datasets for our bandit experiments: Financial The financial bandit (Riquelme et al., 2018) was created by pulling the stock prices of d = 21 publicly traded companies in NYSE and Nasdaq, for the last 14 years for a total of n = 3713 samples. For each day, the context was the price difference between the beginning and end of the session for each stock. The arms are synthetically created to be a linear combination of the contexts, representing k = 8 different portfolios. Jester This bandit problem is taken from Riquelme et al. (2018). The Jester dataset (Goldberg et al., 2001) provides continuous ratings in [−10, 10] for 100 jokes from 73 421 users. The authors find a complete subset of n = 19 181 users rating all 40 jokes. We take d = 32 of the ratings as the context of the user, and k = 8 as the arms. The agent recommends one joke, and obtains the reward corresponding to the rating of the user for the selected joke. Exploration The exploration bandit tests the extent to which the models explore the different arms. The reward function of each arm is sparse and requires maintaining high uncertainty to discover the context values for which the reward is high. The reward given input x and selected arm a is given by: r(x, a) = σ(β(x + α − offset[a])) − σ(β(x − α − offset[a])) + (cid:15) (22) where σ(x) = 1 / (1 + e−x) is the sigmoid function, α, β ∈ R are constants, (cid:15) ∼ N (0, δ2), and offset[a] is a function mapping each arm a to a particular offset. Intuitively, this reward is composed of a smooth unit valued "bump" per arm and is otherwise 0. The positions of the "bumps" across arms are disjoint and barely overlap. Furthermore, the context is sampled uniformly at random in the interval [−1, 1]. We run this bandit for 20 000 steps. Mushroom This bandit problem is taken from Riquelme et al. (2018). The Mushroom Dataset (Dua and Graff, 2017) contains n = 7 310 samples, 22 attributes per mushroom, and two classes: poisonous and safe. The agent must decide whether to eat a given mushroom or not. Eating a safe mushroom provides reward of 5. Eating a poisonous mushroom delivers reward 5 with probability 1/2 and reward -35 otherwise. If the agent does not eat a mushroom, then the reward is 0. 2.4 Implementation We implement the variational soft decision tree and variational soft GBM using the Jax (Bradbury et al., 2018) and DM- Haiku (Hennigan et al., 2020) Python libraries. We fit our models using the Adam (Kingma and Ba, 2014) optimizer. Hyperparameter optimization was conducted using Amazon SageMaker's2 automatic model tuning that uses Bayesian optimisation to explore the hyperparameter space. We define the set of hyperparameters that the Bayesian optimisation needs to explore, as well as the optimization objective. The service then runs a series of model tuning jobs with different hyperparameters to find the set of values which minimize the objective. We use the same hyperparameter ranges as (He and Hahn, 2020) and (Ustimenko and Prokhorenkova, 2020), summarized in Table 5. Table 5: Hyperparameter tuning ranges. VSGBM XBART XGBOOST DEEP ENSEMBLE VST SGLB LEARNING RATE PRIOR SCALE MAX. DEPTH BETA NUM. LEARNERS PRIOR SIGMA ALPHA PRIOR SIGMA BETA [0.0001, 0.001] [0.01, 2.5] {1, . . . , 5} [1, 50] {1, . . . , 10} [2.5, 5] [0.1, 5] S TAU BETA NUM. LEARNERS BURN-IN ALPHA KAPPA [1, 300] [1, 300] [0.75, 2] [1, 100] {15} {0.95} {3} LEARNING RATE TREE DEPTH LAMBDA ALPHA NUM. LEARNERS [0.001, 0.1] {1, . . . , 6} [0.001, 1] [0.001, 1] {1, . . . , 1000} LEARNING RATE NUM. LAYERS HIDDEN DIM. DROPOUT RATE PRIOR SCALE [0.0001, 0.001] {2, . . . , 5} {10, . . . , 50} [0.1, 0.4] [0.001, 2.5] LEARNING RATE PRIOR SCALE MAX. DEPTH BETA [0.0001, 0.001] [0.01, 2.5] {1, . . . , 5} [1, 50] LEARNING RATE TREE DEPTH NUM. LEARNERS {0.001, 0.01, 0.1} {3, . . . , 6} {1, . . . , 1000} 3 Additional experimental results 3.1 Regression In this section we present additional regression results reporting the root mean square error (RMSE) of evaluated methods across the considered baselines, see Table 6. We find that the VST performs well in terms of test RMSE across datasets: 2https://aws.amazon.com/sagemaker/ Variational Boosted Soft Trees Table 6: Test RMSE of evaluated methods on regression datasets. We find that variational soft decision trees (VST) compares well with baselines in terms of test RMSE, out-performing them on 3/10 datasets and matching the RMSE of the best baselines on three. Variational soft GBM (VSGBM) performs competitively in terms of RMSE compared to SGLB, deep ensemble and XBART, but is generally weaker than XGBoost. This is unsurprising as XGBoost is the state-of-the-art for fitting tabular data. MODEL POWER PROTEIN BOSTON NAVAL YACHT SONG CONCRETE ENERGY KIN8NM WINE DEEP ENSEMBLE 0.986 ± 0.001 1.003 ± 0.001 0.870 ± 0.004 0.993 ± 0.001 0.685 ± 0.002 0.999 ± 0.001 0.972 ± 0.001 1.007 ± 0.009 0.998 ± 0.001 1.013 ± 0.011 XBART (1 TREE) SGLB (1 TREE) XGBOOST (1 TREE) VST (CONST.) VST (LINEAR) XBART SGLB XGBOOST VSGBM (CONST.) VSGBM (LINEAR) 0.243 ± 0.001 0.280 ± 0.006 0.242 ± 0.003 0.239 ± 0.001 0.242 ± 0.001 0.233 ± 0.001 0.453 ± 0.001 0.173 ± 0.003 0.238 ± 0.001 0.242 ± 0.001 0.693 ± 0.003 0.869 ± 0.002 0.828 ± 0.001 0.827 ± 0.008 0.798 ± 0.011 0.692 ± 0.003 0.822 ± 0.001 0.614 ± 0.004 0.652 ± 0.006 0.663 ± 0.012 0.356 ± 0.026 0.483 ± 0.025 0.397 ± 0.077 0.538 ± 0.004 0.469 ± 0.003 0.303 ± 0.022 0.583 ± 0.004 0.261 ± 0.012 0.363 ± 0.025 0.297 ± 0.009 0.339 ± 0.125 0.830 ± 0.007 0.703 ± 0.001 0.359 ± 0.033 0.376 ± 0.002 0.152 ± 0.045 0.649 ± 0.002 0.057 ± 0.001 0.111 ± 0.060 0.074 ± 0.018 0.052 ± 0.003 0.405 ± 0.007 0.056 ± 0.006 0.477 ± 0.027 0.500 ± 0.004 0.051 ± 0.003 0.300 ± 0.004 0.041 ± 0.006 0.142 ± 0.107 0.134 ± 0.005 0.680 ± 0.007 0.958 ± 0.007 0.795 ± 0.003 0.710 ± 0.010 0.633 ± 0.006 0.576 ± 0.003 0.834 ± 0.001 0.450 ± 0.001 0.563 ± 0.004 0.483 ± 0.007 0.474 ± 0.046 0.541 ± 0.010 0.454 ± 0.021 0.592 ± 0.005 0.423 ± 0.066 0.355 ± 0.012 0.593 ± 0.002 0.285 ± 0.014 0.347 ± 0.016 0.341 ± 0.014 0.406 ± 0.267 0.193 ± 0.003 0.059 ± 0.005 0.483 ± 0.099 0.281 ± 0.044 0.292 ± 0.295 0.318 ± 0.002 0.050 ± 0.001 0.227 ± 0.015 0.183 ± 0.037 0.703 ± 0.013 0.740 ± 0.002 0.776 ± 0.010 0.550 ± 0.010 0.530 ± 0.018 0.590 ± 0.007 0.778 ± 0.001 0.479 ± 0.019 0.348 ± 0.009 0.316 ± 0.010 0.815 ± 0.006 0.827 ± 0.004 0.854 ± 0.020 0.788 ± 0.009 0.781 ± 0.008 0.815 ± 0.008 0.857 ± 0.002 0.735 ± 0.014 0.781 ± 0.008 0.769 ± 0.006 (a) VST (b) XBART (c) SGLB Figure 5: In-between uncertainty. Variational soft trees (VST) show high uncertainty between the two blobs of data while closely agreeing with the true mean inside of the data support. The plot for the VST was generated with the linear leaf model. our model outperforms the baselines on 3/10 datasets and matching the RMSE of the top baselines on 3/10. This further confirms that soft decision trees perform well on tabular data (Luo et al., 2021). We observe that VSGBMs are generally weaker in terms of RMSE compared to XGBoost. XGBoost yields a smaller RMSE on all but three datasets, where VSGBM performs better on one and ties on two. This result is not surprising as XGBoost is the gold standard for fitting tabular data. Compared to other baselines, VSGBM systematically outperforms deep ensembles, and performs favorably compared to SGLB and XBART. Compared to a single variational soft tree, VSGBMs perform better in terms of RMSE on all datasets but two where they ties. 3.2 Uncertainty visualization In order to demonstrate the quality of the predictive uncertainty of our model, we present additional plots of functions sampled from the VST, comparing these to samples from XBART and SGLB. See Figure 2 and Figure 5. We find that variational soft decision trees model the uncertainty outside of the support of the data better than XBART and SGLB: functions agree with the true mean within the support of the data, but diverge outside of it. 3.3 Regression visualization To test the flexiblity of the VST in the regression setting, we fit our model to a step function (Figure 6) and a Daubechies wavelet (Figure 7) as done in (Linero and Yang, 2017), and plot functions sampled from our model. We see that the VST captures the non-smooth step function as well as the hard decision trees used in XBART and SGLB. On the Daubechies wavelet, however, we find that a VST of a reasonable depth (5) underfits. VSGBM visually improves the fit over a VST, but still underfits the data compared to SGLB and XBART. We hypothesize that this effect is due to the choice of zero mean Gaussian prior on the node weights wn in VSTs and VSGBMs, which encourages smooth functions. This phenomenon is particularly visible when fitting the Daubechies wavelet, a complex function that fluctuates at different frequencies and amplitudes. As expected, increasing the amount of training data reduces underfitting. 0.00.20.40.60.81.0x21012yTraining dataTargetSample from predictive0.00.20.40.60.81.0x21012y0.00.20.40.60.81.0x21012y T. Cinquin, T. Rukkat, P. Schmidt, M. Wistuba, A. Bekasov (a) VST (RMSE: 0.2121) (b) XBART (RMSE: 0.0982) (c) SGLB (RMSE: 0.3014) Figure 6: Step function. The variational soft decision tree (VST) can fit this non-smooth function. The plot for the VST was generated with the linear leaf model. (a) VST (RMSE: 0.2346) (b) VSGBM (RMSE: 0.2534) (c) XBART (RMSE: 0.1186) (d) SGLB (RMSE: 0.1503) Figure 7: Daubechies wavelet. The variational soft tree (VST) and variational soft GBM (VSGBM) underfit this complex function. 0.00.20.40.60.81.0x21012yTraining dataTargetSample from predictive0.00.20.40.60.81.0x21012y0.00.20.40.60.81.0x21012y0.00.20.40.60.81.0x1.00.50.00.51.01.5yTraining dataTargetSample from predictive0.00.20.40.60.81.0x1.00.50.00.51.01.52.0y0.00.20.40.60.81.0x1.00.50.00.51.01.5y0.00.20.40.60.81.0x1.00.50.00.51.01.5y
http://arxiv.org/abs/2302.10701v1
2023-02-21T14:40:25
2023-02-21T14:40:25
Scalable Infomin Learning
The task of infomin learning aims to learn a representation with high utility while being uninformative about a specified target, with the latter achieved by minimising the mutual information between the representation and the target. It has broad applications, ranging from training fair prediction models against protected attributes, to unsupervised learning with disentangled representations. Recent works on infomin learning mainly use adversarial training, which involves training a neural network to estimate mutual information or its proxy and thus is slow and difficult to optimise. Drawing on recent advances in slicing techniques, we propose a new infomin learning approach, which uses a novel proxy metric to mutual information. We further derive an accurate and analytically computable approximation to this proxy metric, thereby removing the need of constructing neural network-based mutual information estimators. Experiments on algorithmic fairness, disentangled representation learning and domain adaptation verify that our method can effectively remove unwanted information with limited time budget.
[ "Yanzhi Chen", "Weihao Sun", "Yingzhen Li", "Adrian Weller" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10701v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10701v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI", "cs.IT", "math.IT", "stat.ML" ]
3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 1 0 7 0 1 . 2 0 3 2 : v i X r a Scalable Infomin Learning Yanzhi Chen1, Weihao Sun2, Yingzhen Li3, Adrian Weller1,4 1University of Cambridge, 2Rutgers University, 3Imperial College London, 4Alan Turing Institute Abstract The task of infomin learning aims to learn a representation with high utility while being uninformative about a specified target, with the latter achieved by minimis- ing the mutual information between the representation and the target. It has broad applications, ranging from training fair prediction models against protected at- tributes, to unsupervised learning with disentangled representations. Recent works on infomin learning mainly use adversarial training, which involves training a neural network to estimate mutual information or its proxy and thus is slow and difficult to optimise. Drawing on recent advances in slicing techniques, we pro- pose a new infomin learning approach, which uses a novel proxy metric to mutual information. We further derive an accurate and analytically computable approx- imation to this proxy metric, thereby removing the need of constructing neural network-based mutual information estimators. Experiments on algorithmic fair- ness, disentangled representation learning and domain adaptation verify that our method can effectively remove unwanted information with limited time budget. 1 Introduction Learning representations that are uninformative about some target but still useful for downstream applications is an important task in machine learning with many applications in areas including algorithmic fairness [1, 2, 3, 4], disentangled representation learning [5, 6, 7, 8], information bottle- neck [9, 10], and invariant representation learning [11, 12, 13, 14]. A popular method for the above task is adversarial training [1, 2, 3, 4, 7, 11, 15], where two neural networks, namely the encoder and the adversary, are trained jointly to compete with each other. The encoder's goal is to learn a representation with high utility but contains no information about the target. The adversary, on the contrary, tries to recover the information about the target from the learned representation as much as possible. This leads to a minmax game similar to that in generative adversarial networks [16]. Adversarial training is effective with a strong adversary, however, it is often challenging to train the adversary thoroughly in practice, due to time constraints and/or optimisation difficulties [17, 18]. In fact, recent studies have revealed that adversarial approaches may not faithfully produce an infomin representation in some cases [18, 19, 20, 21, 22]. This motivates us to seek a good, adversarial training-free alternative for scalable infomin learning. In this work, we propose a new method for infomin learning which is almost as powerful as using a strong adversary but is highly scalable. Our method is inspired by recent advances in information theory which proposes to estimate mutual information in the sliced space [23]. We highlight the following contributions: • We show that for infomin learning, an accurate estimate of mutual information (or its bound) is unnecessary: testing and optimising statistical independence in some sliced spaces is sufficient; • We develop an analytical approximation to such sliced independence test, along with a scalable algorithm for infomin learning based on this approximation. No adversarial training is required. 36th Conference on Neural Information Processing Systems (NeurIPS 2022). Importantly, the proposed method can be applied to a wide range of infomin learning tasks without any constraint on the form of variables or any assumption about the distributions. This contrasts our method to other adversarial training-free methods which are either tailored for discrete or univariate variables [22, 24, 25, 25, 26] or rely on variational approximation to distributions [10, 12, 19, 27]. 2 Background Infomin representation learning. Let X ∈ RD be the data, Y ∈ RD(cid:48) be the target we want to predict from X. The task we consider here is to learn some representation Z = f (X) that is useful for predicting Y but is uninformative about some target T ∈ Rd. Formally, this can be written as min f L(f (X); Y ) + β * I(f (X); T ) (1) where f is an encoder, L is some loss function quantifying the utility of Z for predicting Y and I(f (X); T ) quantifies the amount of information left in Z about T . β controls the trade-off between utility and uninformativeness. Many tasks in machine learning can be seen as special cases of this objective. For example, by setting T to be (a set of) sensitive attributes e.g. race, gender or age, we arrive at fair representation learning [1, 2, 21, 28]. When using a stochastic encoder, by setting Y to be X and T to be some generative factors e.g., a class label, we arrive at disentangled representation learning [5, 6, 7, 8]. Similarly, the information bottleneck method [9, 10] corresponds to setting T = X, which learns representations expressive for predicting Y while being compressive about X. Adversarial training for infomin learning. A key ingredient in objective (1) is to quantify I(f (X); T ) as the informativeness between f (X) and T . One solution is to train a predictor for T from f (X) and use the prediction error as a measure of I(f (X); T ) [1, 3, 4, 29]. Another ap- proach is to first train a classifier to distinguish between samples from p(Z, T ) vs. p(Z)p(T ) [7, 15] or to distinguish samples Z ∼ p(Z|T ) with different T [2, 11], then use the classification error to quantify I(f (X); T ). All these methods involve the training of a neural network t to provide a lower-bound estimate to I(f (X); T ), yielding a minmax optimisation problem min f max t L(f (X); Y ) + β * ˆIt(f (X); T ) (2) where ˆIt(f (X); T ) is an estimator constructed using t that lower-bounds I(f (X); T ). The time complexity of optimising (2) is O(L1L2) where L1 and L2 are the number of gradient steps for the min and the max step respectively. The strength of t is crucial for the quality of the learned repre- sentation [18, 19, 20, 21, 22]. For a strong adversary, a large L2 is possibly needed, but this means a long training time. Conversely, a weak adversary may not produce a truly infomin representation. 3 Methodology We propose an alternative to adversarial training for optimising (1). Our idea is to learn representa- tion by the following objective, which replaces I(f (X); T ) in objective (1) with its 'sliced' version: (3) L(f (X); Y ) + β * SI(f (X); T ), min f where SI denotes the sliced mutual information, which was also considered in [23]. Informally, SI is a 'facet' of mutual information that is much easier to estimate (ideally has closed form) but can still to some extent reflect the dependence between Z and T . Optimising (3) is then equivalent to testing and minimising the dependence between Z and T from one facet. Importantly, while testing dependence through only a single facet may be insufficient, by testing and minimising dependence through various facets across a large number of mini-batches we eventually see I(Z; T ) → 0. We show one instance for realising SI whose empirical approximation ˆSI has an analytic expres- sion. The core of our method is Theorem 1, which is inspired by [4, 23]. Theorem 1. Let Z ∈ RD and T ∈ Rd be two random variables that have moments. Z and T are statistically independent if and only if SI(Z, T ) = 0 where SI(Z, T ) is defined as follows SI(Z; T ) = sup h,g,θ,φ ρ(h(θ(cid:62)Z), g(φ(cid:62)T )), (4) where ρ is the Pearson correlation, h, g : R → R are Borel-measurable non-constant functions, and θ ∈ SD−1, φ ∈ Sd−1 are vectors on the surfaces on D-dimensional and d-dimensional hyperspheres. 2 Proof. See the Appendix. We call θ and φ the slices for Z and T respectively, and θ(cid:62)Z, φ(cid:62)T the sliced Z and T respectively. We sketch here how this result relates to [4, 23]. [23] considers SI(Z; T ), defined as the expected mutual information E[I(θ(cid:62)Z, φ(cid:62)T )] of the sliced Z and T , where the expectation is taken over respective Haar measures θ ∈ SD−1, φ ∈ Sd−1. Instead of considering the mutual information I(θ(cid:62)Z, φ(cid:62)T ) in the average case, we handle Pearson correlation over the supreme functions h, g as defined above, which links to R ́enyi's maximal correlation [4, 30, 31, 32] and has some interesting properties suitable for infomin representation learning. Intuitively, Theorem 1 says that in order to achieve I(Z; T ) → 0, we need not estimate I(Z; T ) in the original space; rather we can test (and maximise) independence in the sliced space as realised by (4). Other realisations of the sliced mutual information SI may also be used. The major merit of the realisation (4) is it allows an analytic expression for its empirical approximation, as shown below. Analytic approximation to SI. An empirical approximation to (4) is i Z), gj(φ(cid:62) ρ(hi(θ(cid:62) j T )), SI(Z; T ) ≈ sup i,j sup hi,gj where θi ∼ U(SD−1), i = 1, ..., S, φj ∼ U(Sd−1), j = 1, ..., S. (5) i.e., we approximate (4) by randomly sampling a number of slices θ, φ uniformly from the surface of two hyperspheres SD−1 and Sd−1 and pick those slices where the sliced Z and the sliced T are maximally associated. With a large number of slices, it is expected that (5) will approximate (4) well. We refer to [23] for a theoretical analysis on the number of required slices in estimator-agnostic settings. In Appendix B we also investigate empirically how this number will affect performance. For each slicing direction, we further assume that the supreme functions hi, gj : R → R for that direction can be well approximated by K-order polynomials given sufficiently large K, i.e. hi(a) ≈ ˆhi(a) = K (cid:88) k=0 wikσ(a)k, gj(a) ≈ ˆgj(a) = K (cid:88) k=0 vjkσ(a)k, where σ(*) is a monotonic function which maps the input to the range of [−1, 1]. Its role is to en- sure that σ(a) always has finite moments, so that the polynomial approximation is well-behaved. Note that no information will be lost by applying σ(*). Here we take σ(*) as the tanh function. In Appendix A we also investigate theoretically the approximation error of this polynomial approxi- mation scheme. Other approximation schemes such as random feature model [33] can also be used to approximate hi and gj, which will be explored in the future. In this work, we simply set K = 3. With this polynomial approximation, the solving of each functions hi, gj in (5) reduces to finding their weights wi, vj: sup hi,gj i = [1, σ(θ(cid:62) Z (cid:48) ρ(hi(θ(cid:62) i Z), gj(φ(cid:62) i Z), ..., σ(θ(cid:62) i Z)K], i Z (cid:48) ρ(w(cid:62) j T )) ≈ sup wi,gj j = [1, σ(φ(cid:62) T (cid:48) i, v(cid:62) j T (cid:48) j), j T ), ..., σ(φ(cid:62) j T )K] This is known as canonical correlation analysis (CCA) [34] and can be solved analytically by eigen- decomposition. Hence we can find the weights for all pairs of hi, gj by S2 eigendecompositions. In fact, the functions hi, gj for all i, j can be solved simultaneously by performing a larger eigende- composition only once. We do this by finding w, v that maximise the following quantity: ˆSI Θ,Φ(Z; T ) = sup w,v ρ(w(cid:62)Z (cid:48), v(cid:62)T (cid:48)), (6) where Z (cid:48) i = [1, σ(θ(cid:62) 1, ..., Z (cid:48) Z (cid:48) = [Z (cid:48) i], i Z)K], i Z), ..., σ(θ(cid:62) θi ∼ U(SD−1), i = 1, ..., S, 1, ..., T (cid:48) T (cid:48) = [T (cid:48) j] T (cid:48) j = [1, σ(φ(cid:62) φj ∼ U(Sd−1), j = 1, ..., S. S into two 'long' vectors Z (cid:48) ∈ R(K+1)S and 1, ...T (cid:48) That is, we first concatenate all Z (cid:48) T (cid:48) ∈ R(K+1)S respectively, then solve a CCA problem corresponding to Z (cid:48) and T (cid:48). We then use (6) to replace (5). The theoretical basis for doing so is grounded by Theorem 2, which tells that the solution of (6) yields an upper bound of (5), provided that the polynomial approximation is accurate. j T ), ..., σ(φ(cid:62) S and T (cid:48) j T )K] 1, ...Z (cid:48) 3 Theorem 2. Provided that each hi, gj in (5) are K-order polynomials , given the sampled Θ = j=1, we have ˆSI Θ,Φ(Z; T ) ≤ (cid:15) ⇒ supi,j suphi,gj ρ(hi(θ(cid:62) {θi}S i=1, Φ = {φj}S i Z), gj(φ(cid:62) j T )) ≤ (cid:15). Proof. See Appendix A. The intuition behind the proof of Theorem 2 is that if all Z (cid:48) correlation, each of them alone can not either. i and T (cid:48) j as a whole cannot achieve a high The benefits for solving fi, gj for all slices jointly are two-fold. (a) The first benefit is better com- putational efficiency, as it avoids invoking a for loop and only uses matrix operation. This has better affinity to modern deep learning infrastructure and libraries (e.g. Tensorflow [35] and PyTorch [36]) which are optimised for matrix-based operations. In addition to computational efficiency, another benefit for solving gj, hj jointly is (b) the stronger power in independence testing. More specifically, while some sliced directions may individually be weak for detecting dependence, they together as a whole can compensate for each other, yielding a more powerful test. This also echos with [37]. Algorithm 1 Adversarial Infomin Learning Algorithm 2 Slice Infomin Learning Input: data D = {X (n), Y (n), T (n)}N Output: Z = f (X) that optimises (1) Hyperparams: β, N (cid:48), L1, L2 Parameters: encoder f , MI estimator t n=1 Input: data D = {X (n), Y (n), T (n)}N Output: Z = f (X) that optimises (1) Hyperparams: β, N (cid:48), L, S Parameters: encoder f , weights w, v in ˆSI n=1 for l1 in 1 to L1 do sample mini-batch B from D sample D(cid:48) from D whose size N (cid:48) < N (cid:66) Max-step for l2 in 1 to L2 do t ← t + η∇t ˆIt(f (X); T ) with data in D(cid:48) end for (cid:66) Min-step f ← f −η∇f [L(f (X); Y )+β ˆIt(f (X); T )] with data in B end for return Z = f (X) for l in 1 to L do sample mini-batch B from D sample D(cid:48) from D whose size N (cid:48) < N (cid:66) Max-step sample S slices Θ = {θi}S j=1 solve the weights w, v in ˆSI (6) analytically with Θ, Φ, D(cid:48) by eigendecomposition (cid:66) Min-step f ← f −η∇f [L(f (X); Y )+β ˆSI(f (X); T )] with data in B i=1, Φ = {φj}S end for return Z = f (X) Mini-batch learning algorithm. Given the above approximation (6) to SI, we can now elaborate the details of our mini-batch learning algorithm. In each iteration, we execute the following steps: • Max-step. Sample S slices Θ = {θi}S j=1 and a subset of the data D(cid:48) ⊂ D. Learn the weights w, v of ˆSI(Z; T ) (6) with the sampled Θ, Φ and the data in D(cid:48) by eigendecomposition; • Min-step. Update f by SGD: f ← f −η∇f [L(f (X), Y )+β ˆSI(f (X), T )] with Z = f (X) where the parameters w, v of ˆSI(f (X), T ) is learned in the max-step: ˆSI(Z, T ) = ρ(w(cid:62)Z (cid:48), v(cid:62)T (cid:48)). i=1, Φ = {φj}S The whole learning procedure is shown in Algorithm 2. We note that the data in the subset D(cid:48) can be different from the mini-batch B and its size can be much larger than the typical size of a mini-batch. Compared to that of adversarial methods [1, 2, 3, 4, 11, 21] as shown in Algorithm 1, we replace neu- ral network training in the max-step with a analytic eigendecomposition step, which is much cheaper to execute. As discussed in Sec 2, if the network t is not trained thoroughly (due to e.g. insufficient gradient steps L2 in the max-step), it may not provide a sensible estimate to It(f (X); T ) and can hence a weak adversary. Our method does not suffer from this issue as ˆSI is solved analytically. Finally, as an optional strategy, we can improve our method by actively seeking more informative slices for independence testing by optimising the sampled slices with a few gradient steps (e.g. 1-3): Θ ← Θ − ξ∇Θ ˆSI Θ,Φ(Z, T ), (7) which is still cheap to execute. Such a strategy can be useful when most of the sampled slices are ineffective in detecting dependence, which typically happens in later iterations where I(Z; T ) ≈ 0. Φ ← Φ − ξ∇Φ ˆSI Θ,Φ(Z, T ) 4 4 Related works Neural mutual information estimators. A set of neural network-based methods [38, 39, 40, 41] have been proposed to estimate the mutual information (MI) between two random variables, most of which work by maximising a lower bound of MI [42]. These neural MI estimators are in general more powerful than non-parametric methods [43, 44, 45, 46] when trained thoroughly, yet the time spent on training may become the computational bottleneck when applied to infomin learning. Upper bound for mutual information. Another line of method for realising the goal of infomin learning without adversarial training is to find an upper bound for mutual information [10, 12, 19, 47, 48]. However, unlike lower bound estimate, upper bound often requires knowledge of either the conditional densities or the marginal densities [42] which are generally not available in practice. As such, most of these methods introduce a variational approximation to these densities whose choice/estimate may be difficult. Our method on the contrary needs not to approximate any densities. Slicing techniques. A series of successes have been witnessed for the use of slicing methods in machine learning and statistics [49], with applications in generative modelling [50, 51, 52, 53], statistical test [54] and mutual information estimate [23]. Among them, the work [23] who proposes the concept of sliced mutual information is very related to this work and directly inspires our method. Our contribution is a novel realisation of sliced mutual information suitable for infomin learning. Fair machine learning. One application of our method is to encourage the fairness of a predictor. Much efforts have been devoted for the same purpose, however most of the existing methods can either only work at the classifier level [4, 24, 25, 55], or only focus on the case where the sensitive attribute is discrete or univariate [22, 26, 28, 55, 56], or require adversarial training [1, 2, 3, 4, 11, 21]. Our method on the contrary has no restriction on the form of the sensitive attribute, can be used in both representation level and classifier level, and require no adversarial training of neural networks. Disentangled representation learning. Most of the methods in this field work by penalising the discrepancy between the joint distribution P = q(Z) and the product of marginals Q = (cid:81)D d q(Zd) [6, 7, 27, 57, 58].1 However, such discrepancy is often non-trivial to estimate, so one has to resort to Monte Carlo estimate (β-TCVAE [27]), to train a neural network estimator (FactorVAE [7]) or to assess the discrepancy between P and Q by only their moments (DIP-VAE [57]). Our method avoids assessing distribution discrepancy directly and instead perform independence test in the sliced space. 5 Experiments We evaluate our approach on four tasks: independence testing, algorithmic fairness, disentangled representation learning, domain adaptation. Code is available at github.com/cyz-ai/infomin. Evaluation metric. To assess how much information is left in the learned representation Z ∈ RD about the target T ∈ RK, we calculate the R ́enyi's maximal correlation ρ∗(Z, T ) between Z and T : ρ∗(Z, T ) = sup h,g ρ(h(Z), g(T )) (8) which has the properties ρ∗(Z, T ) = 0 if and only if Z ⊥ T and ρ∗(Z, T ) = 1 if h(Z) = g(T ) for some deterministic functions h, g [30]. One can also understand this metric as the easiness of predicting (the transformed) T from Z, or vice versa.2 As there is no analytic solution for the supre- mum in (8), we approximate them by two neural networks h, g trained with SGD. Early stopping and dropout are applied to avoid overfitting. The reliability of this neural approximation has been verified by the literature [4] and is also confirmed by our experiments; see Appendix B. This metric is closely related to existing metrics/losses used in fairness and disentangled represen- tation learning such as demographic parity (DP) [24] and total correlation (TC) [7]. For example, if ρ∗(Z, T ) → 0 then it is guaranteed that ˆY ⊥ T for any predictor ˆY = F (Z), so ρ∗(Z, T ) is an upper bound for DP . Similarly, ρ∗(Z, T ) coincides with TC which also assesses whether Z ⊥ T . In additional to this metric, we will also use some task-specific metric; see each experiment below. Baselines. We compare the proposed method (denoted as "Slice") with the following approaches: 1Note there exist methods based on group theory [59, 60, 61] which do not assess distribution discrepancy. 2It can be shown ρ∗(Z, T ) is equivalent to the normalised mean square error between h(Z) and g(T ). 5 (a) a (b) a2 (c) sin(a) (d) tanh(a) Figure 1: Comparison of the test power of different independence test methods. The x-axis corre- sponds to different values for the dependence level α and the y-axis corresponds to the test power. 1 DK (cid:80)D d (cid:80)K k ρ(Zd; Tk). • Pearson, which quantifies I(Z; T ) by the Pearson correlation coefficient It was used in [5, 57] as an easy-to-compute proxy to MI to learn disentangled representations; • dCorr, i.e. distance correlation, a non-parametric method for the quantifying the independence between two vectors [46]. It was applied in [41] as a surrogate to MI for representation learning; • Neural R ́enyi, an adversarial method for fair machine learning [25] which quantifies I(Z; T ) by the R ́enyi correlation ρ∗(Z, T ) = suph,g ρ(h(Z), g(T )) with h, g approximated by neural net- works. It can be seen as training a predictor to predict (the transformed) T from Z and is closely related to many existing methods in algorithmic fairness and domain adaptation [1, 2, 3, 4, 29]; • Neural TC, an adversarial method for learning disentangled representation [7, 62] which quanti- fies I(Z; T ) by the total correlation T C(Z, T ) = KL[p(Z, T )(cid:107)p(Z)p(T )]. To computes TC, a classifier is trained to classify samples from p(Z, T ) and samples from p(Z)p(T ). This method can also be seen as a variant of the popular MINE method [38] for mutual information estimate. • v-CLUB, i.e. variational contrastive log upper bound, which introduces a (learnable) variational distribution q(T |Z) to form an upper bound of MI [47]: I(Z; T ) ≤ Ep(Z,T )[log q(T |Z)] − Ep(Z)p(T )[log q(T |Z)]. Like adversarial method, q(T |Z) can be learned by a few gradient steps. For a fair comparison, for adversarial training-based approaches (i.e. Neural R ́enyi, Neural TC), we ensure that the training time of the neural networks in these methods is at least the same as the execution time of our method or longer. We do this by controlling the number of adversarial steps L2 in Algorithm 1. The same setup is used for v-CLUB. See each experiment for the detailed time. Hyperparameter settings. Throughout our experiments, we use 200 slices. We find that this setting is robust across different tasks. An ablation study on the number of slices is given in Appendix B. The order of the polynomial used in (6) namely K is set as K = 3 and is fixed across different tasks. Computational resource. All experiments are done with a single NVIDIA GeForce Tesla T4 GPU. 5.1 Independence testing We first verify the efficacy of our method as a light-weight but powerful independence test. For this purpose, we investigate the test power of the proposed method on various synthetic dataset with different association patterns between two random variables X ∈ R10, Y ∈ R10 and compared to that of the baselines. The test power is defined as the ability to discern samples from the joint distribution p(X, Y ) and samples from the product of marginal p(X)p(Y ) and is expressed as a probability p ∈ [0, 1]. The data is generated as Y = (1 − α)(cid:104)t(AX)(cid:105) + α(cid:15), Xd ∼ U[−3, 3], Add = 1, Adk = 0.2, (cid:15) ∼ N ((cid:15); 0, I), α ∈ (0, 1) and (cid:104)*(cid:105) is a scaling operation that scales the operand to the range of [0, 1] according to the minimum and maximum values in the population. The function t(*) determines the association pattern between X and Y and is chosen from one of the following: t(a) = a, a2, sin(a), tanh(a). The factor α controls the strength of dependence between X and Y . All tests are done on 100 samples and are repeated 1,000 times. We choose this sample number as it is a typical batch size in mini-batch learning. For methods involving the learning of parameters (i.e. Slice, Neural R ́enyi, Neural TC), we learn their parameters from 10,000 samples. The time for learning the parameters of Slice, Neural R ́enyi and Neural TC are 0.14s, 14.37s, 30.18s respectively. For completeness, we also compare with the 'optimal test' which calculates the R ́enyi correlation ρ∗(X, Y ) = ρ(h(X), g(Y )) with the functions h, g exactly the same as the data generating process. 6 Table 1: Learning fair representations on the US Census Demographic dataset. Here the utility of the representation is measured by ρ∗(Z, Y ), while ρ∗(Z, T ) is used to quantify the fairness of the representation. Training time is also provided as the seconds required per max step. N/A Pearson dCorr Slice Neural R ́enyi Neural TC vCLUB ρ∗(Z, Y ) ↑ ρ∗(Z, T ) ↓ 0.95 ± 0.00 0.95 ± 0.00 0.95 ± 0.00 0.95 ± 0.01 0.95 ± 0.01 0.95 ± 0.02 0.94 ± 0.02 0.92 ± 0.02 0.84 ± 0.08 0.47 ± 0.08 0.07 ± 0.02 0.23 ± 0.10 0.27 ± 0.03 0.16 ± 0.10 time (sec./max step) 0.000 0.012 0.087 0.102 0.092 0.097 0.134 Table 2: Learning fair representations on the UCI Adult dataset. Here the utility of the representation is measured by ρ∗(Z, Y ), while ρ∗(Z, T ) is used to quantify the fairness of the representation. N/A Pearson dCorr Slice Neural R ́enyi Neural TC vCLUB ρ∗(Z, Y ) ↑ ρ∗(Z, T ) ↓ 0.99 ± 0.00 0.99 ± 0.00 0.97 ± 0.01 0.98 ± 0.01 0.97 ± 0.01 0.98 ± 0.02 0.97 ± 0.02 0.94 ± 0.02 0.91 ± 0.06 0.71 ± 0.06 0.08 ± 0.02 0.17 ± 0.08 0.36 ± 0.13 0.26 ± 0.12 time (sec./max step) 0.000 0.015 0.071 0.112 0.107 0.131 0.132 Figure 1 shows the power of different methods under various association patterns t and dependence levels α. Overall, we see that the proposed method can effectively detect dependence in all cases, and has a test power comparable to neural network-based methods. Non-parametric tests, by contrast, fail to detect dependence in quadratic and periodic cases, possibly due to insufficient power. Neural TC is the most powerful test among all the methods considered, yet it requires the longest time to train. We also see that the proposed method is relatively less powerful when α ≥ 0.8, but in such cases the statistical dependence between X and Y is indeed very weak (also see Appendix B). The results suggest that our slice method can provide effective training signals for infomin learning tasks. 5.2 Algorithmic fairness For this task, we aim to learn fair representations Z ∈ R80 that are minimally informative about some sensitive attribute T . We quantify how sensitive Z is w.r.t T by R ́enyi correlation ρ∗(Z, T ) calculated using two neural nets. Smaller ρ∗(Z, T ) is better. The utility of the learned representation i.e., L(Z; Y ) is quantified by ρ∗(Z, Y ). This formulation for utility, as aforementioned, is equivalent to measuring how well we can predict Y from Z. In summary, the learning objective is: max ρ∗(Z; Y ) − β ˆI(Z; T ), where ˆI(Z; T ) is estimated by the methods mentioned above. For each dataset considered, we use 20,000 data for training and 5,000 data for testing respectively. We carefully tune the hyperparameter β for each method so that the utility ρ∗(Z; Y ) of that method is close to that of the plain model (i.e. the model trained with β = 0, denoted as N/A below; other experiments below have the same setup). For all methods, we use 5, 000 samples in the max step (so N (cid:48) = 5, 000 in Algorithm 1, 2). US Census Demographic data. This dataset is an extraction of the 2015 American Community Survey, with 37 features about 74,000 census tracts. The target Y to predict is the percentage of children below poverty line in a tract, and the sensitive attribute T is the ratio of women in that tract. The result is shown in Table 1. From the table we see that the proposed slice method produces highly fair representation with good utility. The low ρ∗(Z, T ) value indicates that it is unlikely to predict T from Z in our method. While adversarial methods can also to some extent achieve fairness, it is still not comparable to our method, possibly because the allocated training time is insufficient (in Appendix B we study how the effect of the training time). Non-parameteric methods can not produce truly fair representation, despite they are fast to execute. v-CLUB, which estimates an upper bound of MI, achieves better fairness than adversarial methods on average, but has a higher variance [63]. UCI Adult data. This dataset contains census data for 48,842 instances, with 14 attributes describ- ing their education background, age, race, marital status, etc. Here, the target Y to predict is whether the income of an instance is higher than 50,000 USD, and the sensitive attribute T is the race group. The result is summarised in Table 2. Again, we see that the proposed slice method outperforms other methods in terms of both fairness and utility. For this dataset, Neural R ́enyi also achieves good fairness, although the gap to our method is still large. Neural TC, by contrast, can not achieve a 7 (a) Adversarial training (b) Slice Figure 2: Label swapping experiments on Dsprite dataset. Left: the original image X. Middle: reconstructing X ≈ G(Z, T ) using Z = E(X) and the true label T . Right: reconstructing X (cid:48) = G(Z, T (cid:48)) using Z = E(X) and a swapped label T (cid:48) (cid:54)= T . Changing T should only affects the style. (a) Adversarial training (b) Slice Figure 3: Label swapping experiments on CMU-PIE dataset. Left: the original image X. Middle: reconstructing X ≈ G(Z, T ) using Z = E(X) and the true label T . Right: reconstructing X (cid:48) = G(Z, T (cid:48)) using Z = E(X) and a swapped label T (cid:48) (cid:54)= T . Changing T only affect the expression. comparable level of fairness under the time budget given - a phenomenon also observed in the US Census dataset. This is possibly because the networks in Neural TC require longer time to train. The v-CLUB method does not work very satisfactorily on this task, possibly because the time allocated to learn the variational distribution q(Z|T ) is not enough, leading to a loose upper bound of I(Z; T ). 5.3 Disentangled representation learning We next apply our method to the task of disentangled representation learning, where we wish to discover some latent generative factors irrelevant to the class label T . Here, we train a conditional autoencoder X ≈ G(Z, T ) to learn representation Z = E(X) which encodes label-irrelevant in- formation of X. The target to recover is Y = X. The utility of Z is therefore quantified as the reconstruction error: L(Z; Y ) = E[(cid:107)G(Z, T ) − X(cid:107)2 2], resulting in the following learning objective: max E[(cid:107)G(Z, T ) − X(cid:107)2 2] − β ˆI(Z; T ). The conditional autoencoder uses a architecture similar to that of a convolutional GAN [64], with the difference being that we insert an adaption layer Z (cid:48) = MLP(Z, T ) before feeding the features to the decoder. See Appendix B for the details of its architecture. All images are resized to 32 × 32. For all methods, we use 10, 000 samples in the max step (so N (cid:48) = 10, 000 in Algorithms 1 and 2). Dsprite. A 2D shape dataset [65] where each image is generated by four latent factors: shape, rotation, scale, locations. Here the class label T is the shape, which ranges from (square, ellipse, heart). For this dataset, we train the autoencoder 100 iterations with a batch size of 512. The dimen- sionality of the representation for this task is 20 i.e. Z ∈ R20. As in the previous experiments, we provide quantitative comparisons of the utility and disentanglement of different methods in Table 3. In addition, we provide a qualitative comparison in Figure 2 which visualises the original image, the reconstructed image and the reconstructed image with a swapped label. From Table 3, we see that the proposed method achieve very low ρ∗(Z, T ) while maintaining good MSE, suggesting that we 8 Table 3: Learning label-irrelevant representations on the Dsprite dataset. Here the utility of the representation is measured by MSE, while ρ∗(Z, T ) is used to quantify the level of disentanglement of the representation. Training time is also provided as the seconds needed per max step. Acc( ˆT ) is the accuracy trying to predict T from Z. As there are 3 classes, the ideal value for Acc( ˆT ) is 0.33. MSE ↓ ρ∗(Z, T ) ↓ Acc( ˆT ) time (sec./max step) N/A Pearson dCorr Slice Neural R ́enyi Neural TC vCLUB 0.37 ± 0.01 0.44 ± 0.02 0.55 ± 0.03 0.50 ± 0.01 0.61 ± 0.04 0.49 ± 0.03 0.65 ± 0.04 0.91 ± 0.03 0.81 ± 0.07 0.62 ± 0.07 0.08 ± 0.02 0.48 ± 0.05 0.34 ± 0.06 0.22 ± 0.08 0.98 ± 0.01 0.89 ± 0.03 0.76 ± 0.05 0.32 ± 0.02 0.55 ± 0.04 0.54 ± 0.04 0.48 ± 0.03 0.000 0.201 0.412 0.602 0.791 0.812 0.689 Table 4: Learning label-irrelevant representations on the CMU-PIE dataset. Here the utility of the representation is measured by MSE, while ρ∗(Z, T ) is used to quantify the level of disentanglement of the representation. Training time is also provided as the seconds needed per max step. Acc( ˆT ) is the accuracy trying to predict T from Z. As there are 2 classes, the ideal value for Acc( ˆT ) is 0.50∗. N/A Pearson dCorr Slice Neural R ́enyi Neural TC vCLUB 1.81 ± 0.04 0.76 ± 0.04 1.85 ± 0.05 MSE ↓ ρ∗(Z, T ) ↓ Acc( ˆT ) time (sec./max step) *For the plain model, Acc( ˆT ) is not necessarily around 1.0, as Z does not encode all content of the image. 1.99 ± 0.12 0.39 ± 0.06 0.76 ± 0.04 0.36 ± 0.04 0.73 ± 0.03 2.46 ± 0.06 2.15 ± 0.07 0.55 ± 0.03 0.76 ± 0.03 0.07 ± 0.01 0.51 ± 0.03 0.27 ± 0.07 0.71 ± 0.06 2.08 ± 0.08 0.91 ± 0.00 0.68 ± 0.05 0.16 ± 0.06 2.02 ± 0.10 0.841 0.750 0.621 0.332 0.000 0.184 0.581 may have discovered the true label-irrelevant generative factor for this dataset. This is confirmed vi- sually by Figure 2(b), where by changing T in reconstruction we only change the style. By contrast, the separation between T and Z is less evident in adversarial approach, as can be seen from Table 3 as well as from Figure 2(a) (see e.g. the reconstructed ellipses in the third column of the figure. They are more like a interpolation between ellipses and squares). CMU-PIE. A colored face image dataset [66] where each face image has different pose, illumina- tion and expression. We use its cropped version [67]. Here the class label T is the expression, which ranges from (neutral, smile). We train an autoencoder with 200 iteration and a batch size of 128. The dimensionality of the representation for this task is 128 i.e. Z ∈ R128. Figure 3 and Table 4 shows the qualitative and quantitative results respectively. From Figure 3, we see that our method can well disentangle expression and non-expression representations: one can easily modify the expression of a reconstructed image by only changing T . Other visual factors of the image including pose, illu- mination, and identity remain the same after changing T . Adversarial approach can to some extent achieve disentanglement between Z and T , however such disentanglement is imperfect: not all of the instances can change the expression by only modifying T . This is also confirmed quantitatively by Table 4, where one can see the relatively high ρ∗(Z, T ) values in adversarial methods. For this task, v-CLUB also achieves a low ρ∗(Z, T ) value, though it is still outperformed by our method. 5.4 Domain adaptation We finally consider the task of domain adaptation, where we want to learn some representation Z that can generalise across different datasets. For this task, a common assumption is that we have assess to two dataset Ds = {X (i), Y (i)}n j=1 whose classes are the same but are collected differently. Only the data in Ds has known labels. Following [47], we learn Z as follows: i=1 and Dt = {X (j)}m Zc = fc(X), Zd = fd(X) Lc = EX,Y ∈Ds [Y (cid:62) log C(Zc)], Ld = EX∈Ds [log D(Zd)] + EX∈Dt[log(1 − D(Zd))], min Lc + Ld + β ˆI(Zc, Zd), where Zc, Zd are disjoint parts of Z that encode the content information and the domain information of X separately. C is the content classifier that maps X to a (K − 1)-simplex (K is the number of classes) and D is the domain classifier that distinguishes the domain from which X comes. Since the 9 (a) M → MM, adversarial (b) M → MM, slice (c) C → S, adversarial (d) C → S, slice Figure 4: T-SNE plots of the learned content representations Zc in domain adaptation tasks. (a)(c) show the cases when the adversary is not trained thoroughly (i.e. L2 in Algorithm 1 is set too small). Table 5: Learning domain-invariant representations. Here Acc( ˆYs) and Acc( ˆYt) are the classifica- tion accuracy in the source and the target domains respectively. Time used per max step is given. MNIST → MNIST-M CIFAR10 → STL10 N/A Slice Neural TC vCLUB N/A Slice Neural TC vCLUB Acc( ˆYs) ↑ Acc( ˆYt) ↑ ρ∗(Zc, Zd) ↓ time (sec./step) 99.3 ± 0.04 99.2 ± 0.02 99.2 ± 0.04 99.0 ± 0.03 46.3 ± 0.03 98.5 ± 0.45 80.1 ± 0.17 93.8 ± 0.10 0.86 ± 0.05 0.06 ± 0.01 0.64 ± 0.04 0.49 ± 0.12 0.000 2.578 3.282 3.123 Acc( ˆYs) ↑ Acc( ˆYt) ↑ ρ∗(Zc, Zd) ↓ time (sec./step) 93.0 ± 0.03 92.5 ± 0.03 92.4 ± 0.03 92.1 ± 0.04 75.9 ± 0.09 82.3 ± 0.03 80.8 ± 0.08 78.5 ± 0.11 0.43 ± 0.05 0.08 ± 0.01 0.39 ± 0.07 0.42 ± 0.09 0.000 3.146 3.222 3.080 classifier C only sees labels in Ds, we call Ds the source domain and Dt the target domain. For the two encoders fc and fd, we use Resnets [68] with 7 blocks trained with 100 iterations and a batch size of 128. Here Zc, Zd ∈ R256. We use N (cid:48) = 5, 000 samples in the max step for all methods. MNIST → MNIST-M. Two digit datasets with the same classes but different background colors. Both datasets have 50,000 training samples. Table 5 shows the result, indicating that our method can more effectively remove the information about the domain. This is further confirmed by the T-SNE [69] plot in Figure 4, where one can hardly distinguish the samples of Zc from the two domains. This naturally leads to a higher target domain accuracy Acc( ˆYt) than other methods. CIFAR10 → STL10. Two datasets of natural images sharing 9 classes. There are 50,000 and 5,000 training samples in the two datasets respectively. Following existing works [47, 70, 71], we remove the non-overlapping classes from both datasets. Table 5 and Figure 4 show the result. Again, we see that our method can more effectively remove domain information from the learned representation. 6 Conclusion This work proposes a new method for infomin learning without adversarial training. A major chal- lenge is how to estimate mutual information accurately and efficiently, as MI is generally intractable. We sidestep this challenge by only testing and minimising dependence in a sliced space, which can be achieved analytically, and we showed this is sufficient for our goal. Experiments on algorithmic fairness, disentangled representation learning and domain adaptation verify our method's efficacy. Through our controlled experiments, we also verify that adversarial approaches indeed may not pro- duce infomin representation reliably – an observation consistent with recent studies. This suggests that existing adversarial approaches may not converge to good solutions, or may need more time for convergence, with more gradient steps needed to train the adversary fully. The result also hints at the potential of diverse randomisation methods as an alternative to adversarial training in some cases. While we believe our method can be used in many applications for societal benefit (e.g. for promot- ing fairness), since it is a general technique, one must always be careful to prevent societal harms. Acknowledgement AW acknowledges support from a Turing AI Fellowship under grant EP/V025279/1, The Alan Tur- ing Institute, and the Leverhulme Trust via CFI. YC acknowledges funding from Cambridge Trust. 10 References [1] David Madras, Elliot Creager, Toniann Pitassi, and Richard Zemel. Learning adversarially fair and transferable representations. In International Conference on Machine Learning, pages 3384–3393. PMLR, 2018. [2] Harrison Edwards and Amos Storkey. Censoring representations with an adversary. In ICLR, 2016. [3] Yanai Elazar and Yoav Goldberg. Adversarial removal of demographic attributes from text In Proceedings of the 2018 Conference on Empirical Methods in Natural Language data. Processing, pages 11–21, 2018. [4] Vincent Grari, Boris Ruf, Sylvain Lamprier, and Marcin Detyniecki. Fairness-aware neural R ́eyni minimization for continuous features. arXiv preprint arXiv:1911.04929, 2019. [5] Brian Cheung, Jesse A Livezey, Arjun K Bansal, and Bruno A Olshausen. Discovering hidden factors of variation in deep networks. arXiv preprint arXiv:1412.6583, 2014. [6] Irina Higgins, Loic Matthey, Arka Pal, Christopher Burgess, Xavier Glorot, Matthew Botvinick, Shakir Mohamed, and Alexander Lerchner. beta-VAE: Learning basic visual con- cepts with a constrained variational framework. 2016. [7] Hyunjik Kim and Andriy Mnih. Disentangling by factorising. In International Conference on Machine Learning, pages 2649–2658. PMLR, 2018. [8] Francesco Locatello, Stefan Bauer, Mario Lucic, Gunnar Raetsch, Sylvain Gelly, Bernhard Sch ̈olkopf, and Olivier Bachem. Challenging common assumptions in the unsupervised learn- ing of disentangled representations. In International Conference on Machine Learning, pages 4114–4124. PMLR, 2019. [9] Naftali Tishby and Noga Zaslavsky. Deep learning and the information bottleneck principle. In 2015 IEEE information theory workshop (ITW), pages 1–5. IEEE, 2015. [10] Alexander A Alemi, Ian Fischer, Joshua V Dillon, and Kevin Murphy. Deep variational infor- mation bottleneck. arXiv preprint arXiv:1612.00410, 2016. [11] Qizhe Xie, Zihang Dai, Yulun Du, Eduard Hovy, and Graham Neubig. Controllable invariance through adversarial feature learning. Advances in neural information processing systems, 30, 2017. [12] Proteek Chandan Roy and Vishnu Naresh Boddeti. Mitigating information leakage in image representations: A maximum entropy approach. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 2586–2594, 2019. [13] Ayush Jaiswal, Daniel Moyer, Greg Ver Steeg, Wael AbdAlmageed, and Premkumar Natarajan. Invariant representations through adversarial forgetting. In Proceedings of the AAAI Confer- ence on Artificial Intelligence, pages 4272–4279, 2020. [14] Renjie Xie, Wei Xu, Jiabao Yu, Aiqun Hu, Derrick Wing Kwan Ng, and A Lee Swindle- hurst. Disentangled representation learning for rf fingerprint extraction under unknown chan- nel statistics. arXiv preprint arXiv:2208.02724, 2022. [15] Pengyu Cheng, Weituo Hao, and Lawrence Carin. Estimating total correlation with mutual information bounds. arXiv preprint arXiv:2011.04794, 2020. [16] Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. Advances in neural information processing systems, 27, 2014. [17] Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. Advances in neural information processing systems, 29, 2016. [18] Congzheng Song and Vitaly Shmatikov. Overlearning reveals sensitive attributes. arXiv preprint arXiv:1905.11742, 2019. [19] Daniel Moyer, Shuyang Gao, Rob Brekelmans, Aram Galstyan, and Greg Ver Steeg. Invari- ant representations without adversarial training. Advances in Neural Information Processing Systems, 31, 2018. 11 [20] Rui Feng, Yang Yang, Yuehan Lyu, Chenhao Tan, Yizhou Sun, and Chunping Wang. Learning fair representations via an adversarial framework. arXiv preprint arXiv:1904.13341, 2019. [21] Jiaming Song, Pratyusha Kalluri, Aditya Grover, Shengjia Zhao, and Stefano Ermon. Learning controllable fair representations. In The 22nd International Conference on Artificial Intelli- gence and Statistics, pages 2164–2173. PMLR, 2019. [22] Mislav Balunovic, Anian Ruoss, and Martin Vechev. Fair normalizing flows. In International Conference on Learning Representations, 2021. [23] Ziv Goldfeld and Kristjan Greenewald. Sliced mutual information: A scalable measure of statistical dependence. Advances in Neural Information Processing Systems, 34, 2021. [24] J ́er ́emie Mary, Cl ́ement Calauzenes, and Noureddine El Karoui. Fairness-aware learning for continuous attributes and treatments. In International Conference on Machine Learning, pages 4382–4391. PMLR, 2019. [25] Sina Baharlouei, Maher Nouiehed, Ahmad Beirami, and Meisam Razaviyayn. R\'enyi fair inference. arXiv preprint arXiv:1906.12005, 2019. [26] Ray Jiang, Aldo Pacchiano, Tom Stepleton, Heinrich Jiang, and Silvia Chiappa. Wasserstein fair classification. In Uncertainty in Artificial Intelligence, pages 862–872. PMLR, 2020. [27] Ricky TQ Chen, Xuechen Li, Roger B Grosse, and David K Duvenaud. Isolating sources of disentanglement in variational autoencoders. Advances in neural information processing systems, 31, 2018. [28] Rich Zemel, Yu Wu, Kevin Swersky, Toni Pitassi, and Cynthia Dwork. Learning fair represen- tations. In International conference on machine learning, pages 325–333. PMLR, 2013. [29] Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, Franc ̧ois Laviolette, Mario Marchand, and Victor Lempitsky. Domain-adversarial training of neural networks. The journal of machine learning research, 17(1):2096–2030, 2016. [30] Alfr ́ed R ́enyi. On measures of dependence. Acta mathematica hungarica, 10(3-4):441–451, 1959. [31] Hans Gebelein. Das statistische problem der korrelation als variations-und eigenwertproblem und sein zusammenhang mit der ausgleichsrechnung. ZAMM-Journal of Applied Mathematics and Mechanics/Zeitschrift f ̈ur Angewandte Mathematik und Mechanik, 21(6):364–379, 1941. [32] Hermann O Hirschfeld. A connection between correlation and contingency. In Mathematical Proceedings of the Cambridge Philosophical Society, volume 31, pages 520–524. Cambridge University Press, 1935. [33] David Lopez-Paz, Philipp Hennig, and Bernhard Sch ̈olkopf. The randomized dependence coefficient. Advances in neural information processing systems, 26, 2013. [34] Harold Hotelling. Relations between two sets of variates. Biometrika, 28(3/4):321–377, 1936. [35] Mart ́ın Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, et al. {TensorFlow}: a system for In 12th USENIX symposium on operating systems design {Large-Scale} machine learning. and implementation (OSDI 16), pages 265–283, 2016. [36] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. Advances in neural information processing systems, 32, 2019. [37] Ziv Goldfeld, Kristjan Greenewald, Theshani Nuradha, and Galen Reeves. k-sliced mu- arXiv preprint information: A quantitative study of scalability with dimension. tual arXiv:2206.08526, 2022. [38] Mohamed Ishmael Belghazi, Aristide Baratin, Sai Rajeshwar, Sherjil Ozair, Yoshua Bengio, Aaron Courville, and Devon Hjelm. Mutual information neural estimation. In International conference on machine learning, pages 531–540. PMLR, 2018. [39] R Devon Hjelm, Alex Fedorov, Samuel Lavoie-Marchildon, Karan Grewal, Phil Bachman, Adam Trischler, and Yoshua Bengio. Learning deep representations by mutual information estimation and maximization. arXiv preprint arXiv:1808.06670, 2018. 12 [40] Aaron Van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv e-prints, pages arXiv–1807, 2018. [41] Yanzhi Chen, Dinghuai Zhang, Michael Gutmann, Aaron Courville, and Zhanxing Zhu. Neural approximate sufficient statistics for implicit models. arXiv preprint arXiv:2010.10079, 2020. [42] Ben Poole, Sherjil Ozair, Aaron Van Den Oord, Alex Alemi, and George Tucker. On variational bounds of mutual information. In International Conference on Machine Learning, pages 5171– 5180. PMLR, 2019. [43] Arthur Gretton, Kenji Fukumizu, Choon Teo, Le Song, Bernhard Sch ̈olkopf, and Alex Smola. A kernel statistical test of independence. Advances in neural information processing systems, 20, 2007. [44] Francis R Bach and Michael I Jordan. Kernel independent component analysis. Journal of machine learning research, 3(Jul):1–48, 2002. [45] Barnab ́as P ́oczos, Zoubin Ghahramani, and Jeff Schneider. Copula-based kernel dependency measures. arXiv preprint arXiv:1206.4682, 2012. [46] G ́abor J Sz ́ekely and Maria L Rizzo. Partial distance correlation with methods for dissimilari- ties. The Annals of Statistics, 42(6):2382–2412, 2014. [47] Pengyu Cheng, Weituo Hao, Shuyang Dai, Jiachang Liu, Zhe Gan, and Lawrence Carin. Club: In International conference on A contrastive log-ratio upper bound of mutual information. machine learning, pages 1779–1788. PMLR, 2020. [48] Boxin Wang, Shuohang Wang, Yu Cheng, Zhe Gan, Ruoxi Jia, Bo Li, and Jingjing Liu. In- fobert: Improving robustness of language models from an information theoretic perspective. arXiv preprint arXiv:2010.02329, 2020. [49] Kimia Nadjahi, Alain Durmus, L ́ena ̈ıc Chizat, Soheil Kolouri, Shahin Shahrampour, and Umut Simsekli. Statistical and topological properties of sliced probability divergences. Advances in Neural Information Processing Systems, 33:20802–20812, 2020. [50] Ishan Deshpande, Ziyu Zhang, and Alexander G Schwing. Generative modeling using the sliced wasserstein distance. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 3483–3491, 2018. [51] Soheil Kolouri, Phillip E Pope, Charles E Martin, and Gustavo K Rohde. Sliced wasserstein auto-encoders. In International Conference on Learning Representations, 2018. [52] Mark Rowland, Jiri Hron, Yunhao Tang, Krzysztof Choromanski, Tamas Sarlos, and Adrian Weller. Orthogonal estimation of wasserstein distances. In The 22nd International Conference on Artificial Intelligence and Statistics, pages 186–195. PMLR, 2019. [53] Yang Song, Sahaj Garg, Jiaxin Shi, and Stefano Ermon. Sliced score matching: A scalable approach to density and score estimation. In Uncertainty in Artificial Intelligence, pages 574– 584. PMLR, 2020. [54] Wenbo Gong, Yingzhen Li, and Jos ́e Miguel Hern ́andez-Lobato. Sliced kernelized stein dis- crepancy. arXiv preprint arXiv:2006.16531, 2020. [55] Yilun Xu, Hao He, Tianxiao Shen, and Tommi S Jaakkola. Controlling directions orthogonal to a classifier. In International Conference on Learning Representations, 2021. [56] Evgenii Chzhen, Christophe Denis, Mohamed Hebiri, Luca Oneto, and Massimiliano Pon- til. Fair regression with wasserstein barycenters. Advances in Neural Information Processing Systems, 33:7321–7331, 2020. [57] Abhishek Kumar, Prasanna Sattigeri, and Avinash Balakrishnan. Variational inference of disentangled latent concepts from unlabeled observations. arXiv preprint arXiv:1711.00848, 2017. [58] Christopher P Burgess, Irina Higgins, Arka Pal, Loic Matthey, Nick Watters, Guillaume Des- jardins, and Alexander Lerchner. Understanding disentangling in β-vae. arXiv preprint arXiv:1804.03599, 2018. [59] Irina Higgins, David Amos, David Pfau, Sebastien Racaniere, Loic Matthey, Danilo Rezende, and Alexander Lerchner. Towards a definition of disentangled representations. arXiv preprint arXiv:1812.02230, 2018. 13 [60] Robin Quessard, Thomas Barrett, and William Clements. Learning disentangled representa- tions and group structure of dynamical environments. Advances in Neural Information Pro- cessing Systems, 33:19727–19737, 2020. [61] Xinqi Zhu, Chang Xu, and Dacheng Tao. Commutative lie group vae for disentanglement In International Conference on Machine Learning, pages 12924–12934. PMLR, learning. 2021. [62] Elliot Creager, David Madras, J ̈orn-Henrik Jacobsen, Marissa Weis, Kevin Swersky, Toniann Pitassi, and Richard Zemel. Flexibly fair representation learning by disentanglement. In Inter- national conference on machine learning, pages 1436–1445. PMLR, 2019. [63] Jiaming Song and Stefano Ermon. Understanding the limitations of variational mutual infor- mation estimators. In International Conference on Learning Representations, 2019. [64] Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015. [65] Loic Matthey, Irina Higgins, Demis Hassabis, and Alexander Lerchner. dsprites: Disentangle- ment testing sprites dataset. https://github.com/deepmind/dsprites-dataset/, 2017. [66] Ralph Gross, Iain Matthews, Jeffrey Cohn, Takeo Kanade, and Simon Baker. Multi-pie. Image and vision computing, 28(5):807–813, 2010. [67] Yu Tian, Xi Peng, Long Zhao, Shaoting Zhang, and Dimitris N Metaxas. Cr-gan: learning complete representations for multi-view generation. In Proceedings of the 27th International Joint Conference on Artificial Intelligence, pages 942–948, 2018. [68] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recogni- tion, pages 770–778, 2016. [69] Laurens Van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of machine learning research, 9(11), 2008. [70] Geoff French, Michal Mackiewicz, and Mark Fisher. Self-ensembling for visual domain adap- tation. In International Conference on Learning Representations, 2018. [71] Rui Shu, Hung Bui, Hirokazu Narui, and Stefano Ermon. A dirt-t approach to unsupervised domain adaptation. In International Conference on Learning Representations, 2018. 14
http://arxiv.org/abs/2302.10698v1
2023-02-21T14:36:18
2023-02-21T14:36:18
Unpaired Translation from Semantic Label Maps to Images by Leveraging Domain-Specific Simulations
Photorealistic image generation from simulated label maps are necessitated in several contexts, such as for medical training in virtual reality. With conventional deep learning methods, this task requires images that are paired with semantic annotations, which typically are unavailable. We introduce a contrastive learning framework for generating photorealistic images from simulated label maps, by learning from unpaired sets of both. Due to potentially large scene differences between real images and label maps, existing unpaired image translation methods lead to artifacts of scene modification in synthesized images. We utilize simulated images as surrogate targets for a contrastive loss, while ensuring consistency by utilizing features from a reverse translation network. Our method enables bidirectional label-image translations, which is demonstrated in a variety of scenarios and datasets, including laparoscopy, ultrasound, and driving scenes. By comparing with state-of-the-art unpaired translation methods, our proposed method is shown to generate realistic and scene-accurate translations.
[ "Lin Zhang", "Tiziano Portenier", "Orcun Goksel" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10698v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10698v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.CV", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.CV", "cs.LG" ]
3 2 0 2 b e F 1 2 ] V C . s c [ 1 v 8 9 6 0 1 . 2 0 3 2 : v i X r a Unpaired Translation from Semantic Label Maps to Images by Leveraging Domain-Specific Simulations Lin Zhang1, Tiziano Portenier1, Orcun Goksel1,2 1 Computer-assisted Applications in Medicine, Computer Vision Lab, ETH Zurich, Switzerland 2 Department of Information Technology, Uppsala University, Sweden Abstract Photorealistic image generation from simulated label maps are necessitated in several contexts, such as for medical training in virtual reality. With conventional deep learning methods, this task requires images that are paired with semantic annotations, which typically are unavailable. We introduce a contrastive learning framework for generating photorealistic images from simulated label maps, by learning from unpaired sets of both. Due to potentially large scene differences between real images and label maps, existing unpaired image translation methods lead to artifacts of scene modification in synthesized images. We utilize simulated images as surrogate targets for a contrastive loss, while ensuring consistency by utilizing features from a reverse translation network. Our method enables bidirectional label-image translations, which is demonstrated in a variety of scenarios and datasets, including laparoscopy, ultrasound, and driving scenes. By comparing with state-of-the-art unpaired translation methods, our proposed method is shown to generate realistic and scene-accurate translations. Keywords- Image translation, Simulated training, Medical training in VR, Contrastive learning, Adversarial learning, GAN 1 Introduction Photorealistic image simulation has been an active research area for decades with a wide range of applications from movie- and game-industries [1, 2] to medical imaging for surgical training [3–6]. Extensive research in modelling imaging physics [5–7] and material representations [8, 9] has substan- tially improved simulation realism in different applications, but there is still a very perceiveable visual difference between the state-of-the-art simulators and real world images. Recent progress in deep learning has paved the way for synthesizing photorealistic images by learning image features from large-scale real data. Among them, generative adversarial networks [10] have shown promising results in generating photorealistic images. Methods were shown to successfully generate images from noise inputs with controlled styles at different level of details learned from given domains [11–13] as well as to achieve semantic image synthesis [14–18] given paired label and target images. In the absence of paired training samples, methods based on cycle consistency loss [19, 20], shared latent space [21, 22], layer normalizations [23] and more recently contrastive loss [24,25] have been investigated with varying levels of success. As opposed to the widely used cyclic approaches, contrastive learning (CL) based unpaired image translation methods focus on translating in single direction by relaxing the strong bijective assumption, which has achieved impressive results in various unpaired translation settings [24]. Compared to image- level feature contrasting for unsupervised classification and segmentation, patch-level contrasting is employed in [24] which enforces structural similarity between images. Various approaches have been accordingly proposed for bridging the appearance gap between synthetic and real images [26–29], also further improved by leveraging auxiliary simulation information such as simulated semantic maps [30] and geometry buffers (G-buffers) generated during 3D computer graphics rendering [31]. A parallel line of work investigate photographic transfer [32–35], aiming at translating the appearance of reference images to simulated contents; however, such methods require lengthy and difficult-to-parametrize optimizations for each single target image. All above work aim to improve the realism of existing, sub-realistic (e.g., simulated) images and hence require the existence of preceding, complex simulation and rendering methods. Funding was provided partially by the Medtech Science and Innovation Centre, Uppsala, Sweden. Corresponding author: Orcun Goksel ([email protected]) 1 style and images I content Figure 1: Overview of unpaired label-image translation by leveraging domain-specific simulations. (a) An illustration of the simulation/generation pipeline from 3D computer graphics (CG) model to label-maps Lcontent style with the subscript indicating the style domain and superscript indicating the content domain. R and S denote the real and simulated domains, respectively. Note that the goal is to generate images I S R with realistic appearance for simulated content, based on (i.e. consistent with) label-maps LS S of simulated scenes. To that end, one can collect and use many real-life images I R R , but these will not one-to-one match existing simulated content therefore preventing classical (b) A schematic summary of existing unpaired image translation approaches supervised training. CycleGAN [19], CUT [24], and ConPres [30], as well as our proposed methods SimIT, SimIT-C, and SimIT-PC. We define the label-to-image mapping function as G : L → I and the image-to- label mapping function as F : I → L, with the label domain L and image domain I. Both G and F are parameterized with a deep neural network consisting of an encoder and a decoder, i.e. G(*) = GD(GE(*)) and F (*) = F D(F E(*)). Contrastive loss is computed on features obtained from the mappings M G(*) = H(GE(*)) or M F(*) = H(F E(*)), where H maps the generator encoder latent to a feature space Z. 2 Manipulation, contact physics, deformation, viewing perspective, ... Learning-basedLabel-to-Image TranslationOur goal3D ModelsLabel-map L!!Real images I""Translated Image I"!(a)Cycle consistencyGFCycleGANL!!I""ConPresGGSemantic-consistency lossL!!I!!I""SimIT-CGL!!I!!I""Contrastive lossZM#M#(b)GContrastive lossM#L!!I""ZCUTM#SceneGeometric processingProjective transform, cross-sectional slice, ...(simple)Simulated Image I!!Image simulationImaging physics, CG rendering, shading, acoustics, heuristics, ...(often complex)Conventional simulation pipelinesSimulation parametersObject properties, textures, surface roughness , lighting, internal composition, imaging parameters, ...SimITGL!!I!!I""Contrastive lossZM$M$SimIT-PCGL!!I""Contrastive lossZM#M#L!! S → I S Photorealistic image generation directly from simulated scene layouts, so-called label-maps, would obviate any complex and computationally-intensive simulation/rendering process in real-time, by learning the internals of such rendering into a generative model during a non-time-critical offline learning stage. Such label-maps can typically be extracted easily from existing simulation pipelines, only given 3D objects models and a vantage point (thus a scene), i.e. without a need to tune model- specific parameters nor to compute complex physical interactions. To illustrate this further, a generic simulation pipeline is given in Figure 1(a). Given the above motivation, we aim to generate images I with realistic appearance but simulation-controlled content, i.e. I S R as appearance and content of a representation are hereafter indicated in sub- and super-script, respectively. With this conven- tion, the methods from the literature mentioned earlier mostly target image-to-image translation of I S S → I S R . In comparison, label-to-image translation as we intend is often more challenging due to the large domain shift between these two representations. Generating simulated images from labels, i.e. LS S translation, was studied in [9] for accelerating simulated image generation in real-time, for which a conditional GAN with supervised per-pixel loss was shown to provide promising results. This, however, relatively simpler compared to our goal of generating I S R, since the former can be cast as a paired translation problem where the paired data (LS S, I S S ) is typically available from conventional simulation pipelines. In contrast for our desired target of I S R, there exists no such paired label data. A large domain gap together with the lack of paired data make our intended label-to-realistic-image translation very challenging, and, to the best of our knowledge, without any working solution so far. In this work we target the above problem of photorealistic image generation directly from label- maps. To facilitate the learning of appearance information from real images I R R , we propose to utilize any available physics-based simulation to generate intermediate image representations I S S . We utilize these as a stepping stone to help bridge the domain gap between the labels LS S and their real-image counterparts I S R as desired. To that end, we introduce a contrastive learning based image translation framework that leverages physics-based simulations/rendering in the training of unpaired label-to-image translation, but without needing such simulations during the real-time inference stage. Compared to the existing works [9, 26, 30, 31], our proposed method performs image generation and realism enhancement simultaneously in a single step. We demonstrate our method on enhancing medical image simulators for training, as well as car driving simulators for entertainment. Our proposed solution builds on a bidirectional (cyclic) translation idea. As a by-product of this design, it can also perform the inverse operation of image-to-label translation, i.e. semantic image segmentation is also learned meanwhile in an unsupervised fashion without seeing any annotations of real images. We also evaluate such segmentation outcomes in this work, as they opens future possibilities of alleviating annotation efforts. 2 Results 2.1 Compared methods Proposed method. We call our proposed method for generating realistic images from simulated semantic label-maps, with the target style learned from real images while retaining overall content matching the simulated scene, as Simulation-based Image Translation framework (SimIT). Realistic and scene-accurate translation given unpaired data is herein enabled by two major contributions: 1. To address missing label-image pair information, we leverage existing physics-based simulations by using the simulated images (that are inherently paired with corresponding label-maps) as surrogate targets for contrastive learning. 2. To enforce content/structure preservation, we devise a method that contrasts domain-specific image features extracted from a translation network that is trained using a cycle consistency loss. This further enables bidirectional translation, i.e. in both label-to-image and image-to-label directions. Compared methods. We evaluate SimIT comparatively to the following three state-of-the-art unpaired image translation methods: CycleGAN [19] is a conventional approach with cyclic con- sistency loss by employing separate generators and discriminators in each direction. CUT [24] is a 3 unidirectional translation framework based on patch-based multi-scale contrastive loss computed on generator features. ConPres [30] is a multi-domain translation framework that leverages simulated label-image pairs to retain structural content. Together with cycle-consistency and contrastive losses, ConPres proposes a regularization loss for semantic consistency, which enforces a generator to create the same output for paired images and label-maps. Consequently, ConPres can be used for both image-to-image and label-to-image translation. The latter being the focus herein, we employ that use-case of ConPres in our comparisons. High-level conceptual schematics of above-mentioned three approaches are illustrated in Figure 1(b). To further evaluate our two major contributions listed above, we ablated them cu- Ablations. mulatively from SimIT, resulting in the following reduced models for comparison: SimIT-C (SimIT without cycle loss) is a unidirectional version of SimIT, i.e. without learning an inverse translation from image to labels, where the contrastive loss is then computed using features from the label-to-image generator, c.f. SimIT-C in Figure 1(b). SimIT-CS (SimIT-C without leveraging simulations) does not utilize any simulation information, where the contrastive loss is then computed between semantic label-maps and translated images, similarly to CUT in Figure 1(b). 2.2 Evaluation All results are evaluated on unseen test data. We employ the non-parametric two-sided Wilcoxon signed-rank test to assess differences between paired test results and report statistical significance with p-value. Methodological and implementation details are given later in the Methods. We compared the methods on three different applications (more details given in the Methods): Laparoscopy training. As physics-based simulation, computer-graphics rendering techniques were employed [36, 37], to simulate synthetic laparoscopic images from a 3D abdominal model. During the rendering of each frame, a camera projection of anatomical labels provided the corresponding semantic label-maps. This simulated dataset with paired image and label-maps are herein called as LaparoSim. For the laparoscopy application, we employed two different datasets of real images, thus evaluating two different target styles, called herein: Style-C, represented by the public Cholec dataset containing 80 videos of cholecystectomy surgeries [38]; and Style-H, represented by a single, in-house laparoscopic surgery video clip with a length of 13 minutes. Sample images can be seen in Figure 2. The simulated images were generated using a ray-tracing framework [6] Ultrasound training. from a second trimester fetal model, by emulating a convex ultrasound probe at multiple locations and orientations on the abdominal surface, with imaging settings following [30]. Semantic label-map is rendered as a cross-section through the anatomical surfaces at the ultrasound center imaging plane. We refer this simulated dataset as USSim. For the targeted real-image style, sample ultrasound images were collected using a GE Voluson E10 machine during standard fetal screening exams of 24 patients. We refer this as GE-E10 style. Gaming. As the gaming simulation, we used the GTA dataset [39] containing image-label pairs from a car-driving game. For the real image style, we used the Cityscapes dataset [40] containing images of street scenes from German cities. 2.3 Experiments Label-to-image translation. For the laparoscopy training application, we present the results in Figure 2 for separately training two different styles. As seen qualitatively in Figure 2(b), CycleGAN and CUT hallucinate inexistent tissue regions, e.g., fat tissues. ConPres achieves structural preserva- tion by leveraging information from LaparoSim label-image pairs, but fails completely in generating tissue textures, which leads to highly unrealistic image style. Going from label-to-image, our method SimIT is seen to outperform the state-of-the-art in terms of anatomical content preservation as well as in achieving a realistic image appearance. This observation is substantiated by the quantitative evaluation in Table 1(a), where image realism is empirically measured using Frechet and Kernel Incep- tion Distances (FID and KID, respectively) between translated and real image sets, and the content 4 Figure 2: (a) Examples of real laparoscopic images with two different appearances: Style-C for the public Cholec80 dataset and Style-H for an in-house single-video dataset. (b) Qualitative comparison of images translated from input LaparpSim label-maps, using the proposed SimIT and alternative methods. For reference purposes, conventionally simulated/rendered LaparoSim images are shown on the right. (c) Quantitative evaluation of structural preservation via Structure Similarity Index Metric (SSIM). Using a paired test, distributions of pair-wise differences over the test set are shown by comparing SimIT to each alternative method and ablated variant, i.e. the larger the positive difference is, the more superior SimIT is with respect to another method. Significance is indicated with respect to SimIT (represented with the dotted lines) or between different models (|-|), with P-values of ≤ 0.0001 (****). (d) Qualitative comparison of our proposed method SimIT to its ablated variants, with translated images zoomed in on the white field-of-view shown in the simulated image as reference. 5 (a)(b)(d)LaparoSimSSIM (Relative to SimIT)SimIT-CSSimIT-CSimITReal image examples: Style-CStyle-CReal image examples: Style-HStyle-HStyle-CStyle-Ht************CycleGANCUTConPres03060SSIM [%]************(c)****CycleGANCUTConPres03060********************LaparoSimTranslatedTranslatedCycleGANImageLabel (input)LaparoSimImage (reference)CUTConPresSimITSimIT-CSSimIT-CSimIT-CSSimIT-CStyle-CStyle-HStyle-CStyle-HStyle-CStyle-H Table 1: Quantitative metrics reported as mean(std). Arrows indicate direction of superiority; ↑ meaning the higher the better, and ↓ the lower. KID is reported in 10−2 unit. Best results are marked bold. (a) Laparoscopy Style-C Style-H Method Simulation s CycleGAN [19] CUT [24] ConPres [30] r e h t O s SimIT-CS SimIT-C SimIT r u O Content Realism Content Realism FID ↓ SSIM [%] ↑ KID ↓ 17.76 257.39 14.46 254.61 12.85 234.65 380.70 36.72 202.24 10.40 12.65 210.94 11.97 214.22 - 39.21(6.80) 49.79(13.75) 71.12(3.96) 41.77(7.98) 58.05(7.34) 75.56(2.42) SSIM [%] ↑ KID ↓ 201.32 212.42 222.81 379.82 147.06 175.38 161.29 - 50.50(10.62) 58.74(6.77) 75.76(5.56) 56.15(5.23) 72.87(2.12) 83.69(1.63) FID ↓ 12.42 13.73 13.42 36.80 7.03 11.61 7.13 (b) Ultrasound Method Simulation s CycleGAN [19] CUT [24] ConPres [30] r e h t O s SimIT-CS SimIT-C SimIT r u O Content IoU [%] ↑ - 2.33(1.10) 3.39(1.47) 5.01(1.95) 2.97(1.30) 9.50(4.42) 20.54(6.80) Realism FID ↓ KID ↓ 38.14 297.24 2.02 46.67 1.63 46.62 7.74 95.31 3.57 56.70 2.33 46.10 6.14 79.02 (c) Gaming Method Simulation s CycleGAN [19] CUT [24] ConPres [30] r e h t O s SimIT-CS SimIT-C SimIT r u O mAP ↑ – 14.12 12.42 15.44 13.74 20.76 22.34 Content pixAcc ↑ – 55.54 53.10 60.33 56.22 63.12 68.83 Realism classAcc ↑ FID ↓ KID ↓ 7.78 3.04 3.42 10.39 0.81 1.89 2.60 101.82 65.20 66.54 120.63 43.04 57.05 60.46 – 24.40 22.06 26.38 23.19 32.57 33.07 preservation is measured via the structural similarity index measure (SSIM) between translated and corresponding simulated images. Note that SimIT also achieves the lowest SSIM standard devia- tion, indicating its consistent content preservation over the test samples. A test-image wise paired comparison of all methods with respect to SimIT is presented in Figure 2(c), which shows ConPres as the closest contender in terms of content preservation (SSIM) but with largely unrealistic image translation, as also demonstrated qualitatively (Figure 2(b)) and tabulated empirically (Table 1(a)). Compared to the proposed method SimIT, its ablated variants, SimIT-C and SimIT-CS perform substantially poorer as seen quantitatively in Table 1(a) and Figure 2(c), and qualitatively in Fig- ure 2(d). This demonstrates the importance of our proposed method components. SimIT-CS lacks our proposed component for utilizing simulations with a contrastive loss in learning the label-to-image translation, and as such it can be seen as a variant of CUT implemented in our framework. With no explicit label-to-image pairs provided, SimIT-CS then learns to simply emulate all structures seen in the real examples, hence erroneously changing the image content as seen in the presented examples. Using simulated images as surrogate targets for contrastive loss (SimIT-C in Figure 2(d)) largely pre- vents such superfluous content generation. Still SimIT-C only uses the features from a label domain for contrasting, and such features cannot be well aligned with image features. With the proposed method SimIT, the addition of a custom cycle loss allows for training a bidirectional translation, 6 where the features from an encoder operating on images can then instead be used for contrasting. With such domain-consistent features, content preservation is further enhanced, as seen both quan- titatively given the error of SimIT-C in Figure 2(c), and qualitatively by visually comparing these variants in Figure 2(d). Evaluation on ultrasound training and gaming applications further confirms the superior perfor- mance of our proposed method on label-to-image translation task (Figures 3 and 4). Translated ultra- sound image examples in Figure 3(b) demonstrate that the alternative methods are not always correct with the echogenecity (brightness) profile of different anatomical regions, e.g., outside the uterus is sometimes black and sometimes white, and the same for the amniotic fluid. ConPres preserves the echogenecity better than CycleGAN and CUT by leveraging simulated label-image pairs, however, it is biased towards interpreting input labels as pixel intensities. In comparison, SimIT can retain cor- rect echogenecity of each region, which can be seen by comparing to the reference simulated images, while translating into a realistic appearance in the style of GE-E10 images. Furthermore, our method successfully preserves fine anatomical structures, e.g., the ribs in the top row example, whereas the other compared methods fail with such detail. We herein assess content preservation for ultrasound images based on the alignment of bone surfaces, delineated by a phase-symmetry based bone-surface estimation method [41] as exemplified in Figure 3(c). Alignment is then quantified by the intersec- tion over union (IoU) score of bone surface pixels extracted from translated and simulated (reference) images (cf. Figure 3(e) and Table 1(b)). When comparing image realism via FID/KID scores, SimIT does not yield the best values, which is hypothetically caused by the large scene difference between real and simulated training images, as illustrated in Figure 3(d). Since the alternative methods do not enforce strict restrictions on content preservation, they hallucinate content in an unconstrained manner, which helps lower their FID/KID scores; nevertheless, such arbitrary content does not match the input label-maps, hence not fit for our purposes, as also quantified by the structural preservation scores, i.e. IoU for the ultrasound training experiment. For the gaming experiment, similarly to ultrasound experiment above, CUT and CycleGAN largely hallucinate content, ignoring the input GTA label-maps and hence do not satisfy the desired content preservation criterion. For example, as seen in Figure 4(b), the sky is erroneously filled with trees, since the real Cityscapes images contain more trees and less sky compared to the simulated GTA dataset [31]. Then, the discriminator can easily differentiate between real and fake images by looking at the image top region, which in return encourages the generator to hallucinate more trees in the sky. In comparison to CycleGAN and CUT, the domain-consistent deep features used in our proposed SimIT explicitly encourages content preservation. To evaluate structural consistency, we apply on the translated images the pretrained semantic segmentation network DRN [42] following [24] and report the resulting segmentation metrics: mean average precision (mAP), pixel accuracy (pixAcc), class accuracy (classAcc) – see the Methods for details. SimIT achieves the best scores among all the methods for these content preservation metrics. Evaluating image realism using FID/KID scores (Table 1(c)), SimIT outperforms the state-of-the-art, while faring suboptimal compared to its ablated variants, which however in turn fail at successfully retaining content. This well indicates the conflicting nature between content preservation and image realism, especially in the presence of substantial layout differences between simulated and real image sets. Image-to-label translation. By introducing the cyclic loss to train our framework with domain- consistent features, at the end of the training we also obtain a generator that can translate real images to label-maps, i.e. a semantic segmenter for real images. Note that such segmenter is trained truly unsupervised, i.e. without requiring any annotation of any real image. To evaluate the segmentation outcome of image-to-label translations of SimIT, we compare resulting label-maps to semantic seg- mentations for the datasets where such annotations are available, i.e. the CholecSeg8k dataset as the Style-C target for our laparoscopy application and the Cityscapes dataset for our gaming application. For laparoscopy comparison, we report upper-bound segmentation results from a ResNet50 network trained on annotated images from the CholecSeg8k dataset introduced by [43], which is a subset of Cholec data [38]. In Figure 5(a) a sample input image is shown together with its supervised ResNet50 segmentation as upper-bound; the semantic map predicted by SimIT used as a segmenter; and the ground-truth annotation for this test image. Average segmentation scores are reported in 7 Figure 3: Ultrasound training experiment results: (a) Examples of real ultrasound images with the style of GE-E10 ultrasound machine. (b) Visual examples of images translated using SimIT compared to alternative methods. (c) Qualitative results of SimIT compared to its ablated variants, with bone surfaces visualized in purple and green respectively for those from translated and simulated (reference) images. (d) Probability maps of containing content at each location, averaged over the training images. A big scene distribution difference can be observed between simulated and target images. (e) Quantitative evaluation of structural preservation. To this end, a paired test is employed to compare the IoU scores between the bone maps extracted from the simulated and translated images. The difference is computed by subtracting the score of other models from SimIT, i.e. the larger the positive difference is, the more superior SimIT is with respect to another method. Significance is indicated with respect to our proposed model SimIT (marked with dotted lines) or between different models (|-|), with P-values of ≤ 0.0001 (****). 8 Scene distributionBone Extraction ScoreRelative to SimIT(d)10(b)(c)(e)USSimLabel (input)TranslatedCycleGANCUTConPresSimITUSSimSimIT-CSGE-E10USSimSimIT-CSimITTranslatedImage (reference)Bone SurfaceBone SurfaceImage (reference)USSimCycleGANCUTConPresSimIT-CSSimIT-C502040IoU [%]************************Real image examples: GE-E10 Style(a) Figure 4: Gaming experiment results: (a) Examples of images from Cityscapes dataset. (b) Visual examples of images translated using SimIT compared to alternative methods. (c) Qualitative results of SimIT compared to its ablated variants. Figure 5(c). For the gaming application, we compare SimIT with the segmentation network DRN [42], a standard technique for the Cityscapes dataset. DRN was trained on the labelled training set, acting as a supervised upper-bound herein. A qualitative sample comparison is shown in Figure 5(b) with quantitative results tabulated in Figure 5(d). SimIT presents a fair performance despite not having seen any labeled real images and while not specifically targeting such segmentation problem. For the ultrasound application, SimIT was trained with gray-scale label-maps, as this performed well for the main focus of label-to-image translation and also using one-hot label encoding (performed for the other two applications) was less stable in the parametrization of ultrasound training. Without one-hot labels, our trained network fails to estimate meaningful label-maps from real ultrasound images. This is mainly due to having nearly 80 different tissue classes and some classes with similar ultrasound texture and appearance, which makes the segmentation problem very challenging and, given no one-hot labels, also ill-posed as then a grayscale regression problem. 3 Discussion In this work we present a contrastive learning based unpaired image-label translation framework, by leveraging domain-specific simulations to generate photorealistic images from synthetic semantic label-maps. We demonstrate the superior content-preservation performance of our proposed method across several datasets. Our bidirectional framework as a by-product affords an image segmenter, which is demonstrated herein to provide approximate segmentations of real images. Note that such segmentation by our method requires no annotations of real images in training, and it utilizes merely existing computational simulation outputs. As demonstrated in Figures 2 to 4(b), the unsupervised losses between label and image representations, i.e. the cycle consistency loss [19] and the contrastive loss [24], may lead to scene modification and semantic flipping, i.e. the content not being preserved semantically consistently. To mitigate these, we leverage simulated images as intermediate image representation to bridge the 9 Real image examples: Cityscapes-Style(a)GTALabel(input)GTAImage (reference)TranslatedCycleGANCUTConPresSimIT(b)(c)GTASimIT-CSSimIT-CSimITTranslatedImage (reference) Figure 5: (a) A visual example of semantic label-maps predicted by SimIT compared with the super- vised baseline ResNet50, with the label legend shown on the bottom. (b) Visual examples of semantic maps predicted by SimIT compared with DRN. (c) Quantitative segmentation results on the Cholec- Seg8k dataset. We report average F1 scores for six label classes over 213 test images over 213 test images. (d) Quantitative segmentation results on the Cityscapes dataset over 500 test images. gap between the source and target domains. Among compared methods, ConPres is the closest to our work, as it also leverages simulated pairs to enforce content preservation. To encourage the generator encoder to extract content-related features, ConPres uses a unified generator for three translation tasks: label-to-image, image-to-image, and image-to-label. This, however, complicates the generator's task, leading to sub-optimal results in the label-to-image direction. In comparison, we suggest to utilize task-specific generators, relaxing the constraints of each generator. We accordingly leverage simulated images as surrogate targets only for loss computation, not as an additional generation task. During our preliminary experiments, we found out that using pixel-level supervised losses, e.g., L1/L2 loss, to assess content similarity between simulated and translated images is problematic due to the intrinsic appearance shift, lighting variations, and texture differences between two domains. We also experimented with employing the discriminator as a feature extractor for computing feature-level losses, e.g., the perceptual loss [44], but the results were again not satisfactory. In comparison to the above, the currently utilized patch-based contrastive loss is less affected by any appearance shift, and can therefore successfully discern and focus on content dissimilarity. Together with our utilization of adaptive discriminator augmentation and limited discriminator receptive field, the contrasting of image features from the proposed addition of an image-to-label network has endowed results with substantial content preservation without degrading image realism. The above-mentioned challenge of measuring image content similarity during training also reflects on the evaluation of inference results for structural preservation. For the gaming application experi- ment, we have employed a pretrained segmentation network to assess the content difference between simulated and translated images. This approach is only feasible when a large amount of annotated images from the target domain are available to train a segmentation network. When such segmen- tation method is not available, choosing surrogate metrics for quantifying structural similarity is a non-trivial task. Compared to metrics based on pixel-wise difference, SSIM is relatively less sensitive 10 Image (Input)GTResNet50SimITImage (Input)GTDRNSimIT(a)(b)(c)(d) to appearance shifts. Thus, we used SSIM to capture structural differences between laparoscopic im- ages. However, SSIM is less suitable for ultrasound images due to highly directional artifacts and the inherent speckle noise. In ultrasound, bone surfaces are major anatomical landmarks which appear consistently as hyperechoic bands due to their relatively higher acoustic impedance [45]. We thus use bone surfaces extracted from simulated and translated ultrasound images using a phase-symmetry based method (described further in the Methods) for assessing structural preservation in ultrasound. As noted from the qualitative results shown in Figures 2 to 4, SimIT is not capable of recovering image features, which are not encoded in label-maps, such as lighting and depth information in la- paroscopy and gaming applications, and the acoustic shadows in the ultrasound application. Auxiliary scene information, e.g., geometry and material information from the simulation, can be potentially in- tegrated into SimIT as additional inputs, which can be a potential future direction to further improve content preservation. Our proposed method can also have other uses. For instance, in fields where annotated data is scarce and/or cannot be distributed due to privacy concerns, such as for medical image segmentation, there have been generative methods [46,47] that produce image and label-map pairs based on random vectors, e.g., to train supervised methods with large datasets. In such a problem setting, our method can generate label-conditional images to establish a control on the generated dataset, which can help in, e.g., creating balanced classes, removing biases in the original dataset, and emphasizing certain pathology. 4 Methods Herein we use the notation X z y to represent the domain of any sample, where X is the representation from {L:label-map, I:image}, and y and z are, respectively, the style (appearance) and content of such representation from {S:simulated, R:real}. We aim to learn a generator G : LS S (cid:55)→ IS R which maps a simulated label-map LS R while preserving the simulation- consistent semantic content, i.e. (*)S. S to a real-appearing image I S S ∈ LS R ∈ IS S, I R Generator G is divided into an encoder GE for extracting content-related features and a decoder GD for generating target appearance. It is possible to collect many real image examples {I R R} and also to simulate label-image pairs (LS S ), but paired data of the intended source-target translation, i.e. (LS S ), is inexistent and very challenging to procure. The unpaired data described above does not allow for direct supervision in learning G. Existing unpaired methods often change both content and style together, and the ones that aim content preservation only targets image-to-image translation, with methods we show herein not to simply extend to label-to-image translation targeted herein. An overview of the methods can be followed in Figure 6. R ∈ IR S, I S Generative adversarial training. For learning a generator G and its discriminator DI differentiating images I as real or fake, a non-saturating GAN loss with the R1 regularization [48] is used, i.e. : GAN({LS LG S}, {I R R }) = EI [log(DI (I R R ) − 1)] + EL[log DI (G(LS S))] + γI 2 EI [(cid:107)∇DI (I R R )(cid:107)2] (1) with the regularization parameter γI . S ∈ IS S} during training, which can have paired input label-maps {LS Label-to-image translation guided by simulation. Herein we propose to leverage information from simulations to achieve semantic preservation while learning G. To that end, we utilize simu- S ∈ LS lated (synthetic) images {I S S} generated from the existing simulation framework (Figure 1(a)) and available for training. We encour- age scene-consistent translations using a contrastive loss [24] on image patches, where corresponding patches from the source and translated images (positive pairs) are brought closer in a learned feature space. This space is defined as a projection of the manifold learned by the generator encoder, as illustrated in Figure 6(b). Meanwhile non-corresponding (arbitrary) patches are treated as negative samples and hence pushed farther apart in that feature space. Compared to the pixel-wise supervised losses, contrastive loss is known to be less affected by image appearance. It was utilized in [24] for unpaired image-to-image translation, i.e. when both source and target are of the same representation 11 Figure 6: (a) Schematic overview of our proposed method SimIT with (b) an illustration of contrastive loss. (c) Schematic overview of the ablated version SimIT-C, and (d) SimIT-CS. (e) Schematics of the generator architecture. The number below each convolutional block indicates the channel number. For G the input channel number is the number of classes (#class) and the output channel number is the number of image channels (3 for RGB images), for F vice versa. being in image domain I. However, for label-to-image translation, the source and target representa- tions differ, i.e. while each pixel in L denotes a label, each pixel in I denotes a color. Thus, directly contrasting label and image features cannot successfully guide the network for the intended task; as also seen with the suboptimal performance of our ablation variant SimIT-CS. To alleviate this problem, herein we leverage available simulated images I S S as "surrogate" source images. This implicitly enables the use of existing simulated images I S S ). Note that these images that require com- plex rendering operations are used for loss computation during the training of our method, so they are not needed during inference. This is in contrast to the earlier works [30, 31] where the rendered images are used as an input to the translation network and are thus complex rendering operations are still required during inference in real-time. S ∈ IS R (cid:55)→ LR Bidirectional label-image translation framework. To extract domain-consistent feature rep- resentations, we propose to employ an additional generator F : IR S with F (*) = F D(F E(*)) consisting of an encoder F E and a decoder F D, acting in the opposite direction for translating I → L, i.e. mapping an image back to a label-map. Unlike [24] which contrasts features from GE operating on the source domain L with labels, we propose to contrast the features of the segmenter encoder F E trained to extract features for inferring semantic content from images, and it is thus more suited for comparing image similarity. Patch-based contrastive loss. For an input image x and its translated image ˆx = GD(GE(x)), j (F E(ˆx)), with a light-weight projection head we contrast feature maps zF H G as a query feature j at a given spatial location s within the feature map ˆzF j of the translated image, the corresponding input feature zF,s+ at the same location (denoted by +) is considered as a positive sample, while j any other input feature zF,s− at arbitrary locations act as negative samples. Noise contrastive loss (NCE) [24] for the j-th layer feature can then be computed as the sum of contrastive loss for several j (F E(x)) and ˆzF j mapping the features of j-th hidden layer in F E for training G. Given ˆzF,s j = H G j = H G j 12 (e) Generator Architecture!I!"D!Real/Fake?I!!L##G$G%L→IL""lNCEL""&L"!D"L""I!!F$F%I→LReal/Fake?I""lNCEL""I""lNCEL""L!"#I!!lNCEI!!L$%!S+SS−S+(b) Contrastive LossF$H&,...,)*(a) SimIT(d) SimIT-CS(c) SimIT-C#class3...6412825625625625625625625625612864643#classesdown/up sampling blocksresidual blocksskip connectionsinput layeroutput layerL##L## Sj at randomly sampled spatial locations as follows: LNCE,j(zF j , ˆzF j ) = Sj (cid:88) s=1 LCE(ˆzF,s j , zF,s+ j , zF,s− j ) with LCE(z, z+, z−) = − log (cid:20) exp(d(z, z+)/τ ) exp(d(z, z+)/τ ) + (cid:80) z− exp(d(z, z−)/τ ) (cid:21) , (2) (3) where z is the feature vector of query; z+ and z− are the feature vectors of positive and negative samples, respectively; d(z1, z2) is a distance metric between two latent vectors (herein the cosine distance); and τ is a temperature parameter controlling the smoothing of joint likelihoods. We herein propose to leverage the simulated image domain as surrogate source domain by comput- S paired S)) and simulated image I S ing contrastive loss between the translated image ˆI S to LS R = GD(GE(LS S, i.e. : LF CL (cid:0){LS S}(cid:1) = EL LNCE,j (cid:16) H G j J (cid:88) j=1 (cid:0)F E(I S S )(cid:1), H G j (cid:0)F E( ˆI S R)(cid:1)(cid:17) (4) computed over J feature layers to contrast information at different resolutions. For a more expressive and distinctive label space, we herein encode label-maps as one-hot repre- sentations, which prevents misinterpretation of categorical labels suitable for class separation as pixel intensities for regression. Learning image-to-label translation using cycle consistency loss. In this work, we treat and train the image-to-label translator F to perform pixel-wise semantic labeling task, known as image segmentation. Based on our cyclic framework, we use the existing label-to-image mapping network G to assess such segmentation accuracy, hence also obviating a need for pixel-wise annotations of real images, which are difficult to procure. With that, we compute a cycle reconstruction loss between R and the image reconstructed from the predicted label-map ̃I R a real image I R R )). Image similarity is measured using the NCE loss, as it is less sensitive to appearance shifts, as follows R = G(F (I R LCYC (cid:0){I R R }(cid:1) = EL LNCE,j (cid:16) H F j J (cid:88) j=1 (cid:0)F E(I R R )(cid:1), H F j (cid:0)F E( ̃I R R )(cid:1)(cid:17) (5) with the projection head H F j for the label representation direction, we employ a GAN training objective LF to the original direction G, but with a different regularization parameter γL. for the j-th layer feature of encoder F . For F and its discriminator DL S}) similar GAN({I R R }, {LS Training objective. A schematic illustration of the proposed method SimIT summarizing the above components is shown in Figure 6(a). Network training is performed by alternately optimizing the following two losses: LG({LS LF({LS S}, {I R S}, {I R R }) = LG R }) = LF GAN(LS GAN(LS S, I R S, I R R ) + λG * LF CL(LS S) R ) + λF * LCYC(I R R ) (6) (7) with the loss weighting parameters λG and λF . We compare our full model against the ablated variant SimIT-C by excluding the inverse mapping LF with the cyclic loss, as seen in Figure 6(c). Further ablating the paired simulation images yield the variant SimIT-CS that instead uses the labels for contrasting (Figure 6(d)). For both ablated variants, encoder GE is used for computing the contrastive loss LG CL. Network architecture. We build our method on the StyleGAN2 framework [12] for adversarial training. We accordingly use a ResNet-based generator architecture [24] with four down- and up- sampling layers and 6 residual blocks (Figure 6(d)). We use skip connections between the down- 13 and upsampling layers to avoid information loss. For the image synthesis decoder GE we use weight demodulation [12] w(cid:48)(cid:48) ijk = (cid:113)(cid:80) w(cid:48) ijk i,k w(cid:48) ijk2 + (cid:15) with w(cid:48) ijk = si * wijk (8) where wijk is the convolution weight from the i-th input feature map to the j-th output feature map; k denotes the spatial footprint of the convolution; and the multiplier si is set to 1. To provide stochastic means for texture synthesis, especially important to generate the noisy speckle patterns of ultrasound images, we perturb each feature layer with an additive Gaussian (noise) image scaled by learned weights following [11]. The output layer for G and F is linear and sigmoid, respectively. We use ReLU activation for all intermediate layers. For both DI and DL, we adopt the feedforward discriminator architecture in [12]. In training we use randomly cropped image patches, which enables the discriminator to ignore global scene differences between simulation and real domains. Experimental data utilization. LaparoSim consists of 1850 synthetic laparoscopic image-label pairs simulated from a 3D abdominal model. We randomly split this data into train-validation-test sets with 80-10-10% ratio. Style-C consist of 2100 images from the Cholec dataset. We excluded all frames with surgical tools, since surgical tools are not handled in our simulation. For Style-C testing, we used the 213 frames that has ground-truth labels provided in [43], and the remaining frames were used as Style-C training data. Style-H consists of 2262 frames in total, which was randomly split in 80-20% ratio, respectively, for training and testing. Some Style-H images had major blurring artifacts due to camera motion, so we manually removed any blurry frames, since we treat the frames separately without any temporal information and such temporal effect is also not represented in the label-maps. All the images were resized to 256 × 432. USSim consists of 6669 simulated image-label pairs, which we resized to 256 × 354 and randomly split into training-validation-test sets with 80-10-10% ratio. GE-E10 style consists of 2328 ultrasound images from 24 patients. We randomly selected images from 20 patients for training and 4 for testing, resulting in 1902 training images and 426 test images. GTA dataset [39] contains 24 966 image-label pairs. We followed its original train-validation-test split. Cityscapes dataset [40] contains 3475 image-label pairs of street scenes from German cities. We used its original training set for our network training, and its validation set with ground-truth labels for testing our semantic segmentation output. As in [24], we resized all the images to 256 × 256. Implementation. We implemented our method in PyTorch [49]. We used Adam [50] optimizer with parameters β = (0, 0.99) and a learning rate of 10−3 for G and 10−4 for F . We applied adaptive discriminator augmentation using its default hyperparameters [51]. The generator is trained on image patches of size 256×256 while the discriminator receptive field is 64×64. Our network training involves alternating updates of G and F . We trained our models for 400 epochs. To compute the contrastive loss, we extract features from the four (stride-2) convolution layers in the encoder at 256 locations randomly selected for each mini-batch. We use a two-layer MLP with 256 units at each layer and ReLU activation for H G, and the identity mapping for H F. NCE temperature parameter τ is set to 0.07 following [24]. Generator loss weighting λG is set to 5 for all the experiments. λF is set to 1 for the laparoscopy and ultrasound, and 0.5 for the gaming experiment. R1 regularization parameters γI and γL are set to 0.01 and 1.0, respectively, for all the experiments. For all compared methods we used their public implementations provided by the corresponding authors with their default hyperparameters. Evaluation metrics. We use the following for quantitative evaluation: • Image realism. Fr ́echet inception distance (FID) [52] is common for assessing the quality of images generated by GANs, by comparing the feature distribution between two sets of images, herein real and translated, using feature vectors of an ImageNet-pretrained Inception network. Kernel inception distance (KID) [53] is an alternative metric to evaluate GAN performance. KID is computed as the squared maximum mean-discrepancy between the features of Inception network. KID is then not biased by the number of samples used, unlike FID. • Content preservation. For laparoscopy images, content preservation is assessed using structural similarity between simulated and translated images, quantified via Structural similarity index (SSIM) 14 (μ2 x+μ2 x+σ2 y+c1)(σ2 computed as SSIM(x, y)= (2μxμy+c1)(2σxy+c2) y+c2) with regularization constants c1 and c2, local intensity means μx and μy, local standard deviations σx and σy, and σxy being covariance between x and y. To compute this metric, we used the python package scikit-image with its default parameters. For ultrasound images, due to potential artifacts, typical speckle noise, and a lack of sharp edges, we instead used the similarity of bone surfaces for assessing structure preservation. To that end, we extracted bone surfaces from each image using [41]. This method is based on local phase symmetry in B-mode images, and operates by aggregating images filtered by log-Gabor kernels with different orientations r and scales m defined as (cid:32) Gr,m(ω, φ) = exp − log(ω/ω0)2 2 log(κm/ω0)2 − (φ − φr)2 2σ2 φ (cid:33) , (9) where parameters φr, ω0, κm, and σφ define the filter orientation, center frequency, scaling factor, and angular bandwidth of the employed filters, respectively. Following [45], we set κm/ω0 = 0.25 and φr = [ 1 6 π]. To assess preservation, we report intersection over union (IoU) of pixels belonging to bone surfaces extracted from corresponding simulated and translated images. We exclude from computations the top 25 pixels of images corresponding to skin reflections. 6 π, 5 6 π, 3 • Segmentation. For the laparoscopic CholecSeg8k dataset, we trained a semantic segmentation network with ResNet50 architecture initialized with weights pretrained on the ImageNet using the pytorch segmentation library [54], following the training settings from a public implementation on the Kaggle repository of this dataset. We randomly picked video24 for validation, video{09,17,26,28,43} for testing, and the rest for training. We report F1 score for six classes that are also in our simulation. For the Cityscapes dataset in the gaming application, we trained a segmentation network suggested for this dataset in [24], with the DRN-D22 architecture [42] at 256×128 resolution with the default parameters from its public implementation. Following [24], we report Cityscapes semantic segmentation results using mean average precision (mAP) over the classes; pixel-wise accuracy (pixAcc) as the percentage of correctly classified pixels; and average class accuracy (classAcc) over given classes. Appendix Additional sample images of image-to-label and label-to-image translations are shown in Figures 7 and 8, respectively. References [1] M. Masuch and N. R ̈ober, "Game graphics beyond realism: Then, now and tomorrow," in Level UP: Digital Games Research Conference. DIGRA, Faculty of Arts, University of Utrecht, 2004. [2] A. Tewari, O. Fried, J. Thies, V. Sitzmann, S. Lombardi, K. Sunkavalli, R. Martin-Brualla, T. Simon, J. Saragih, M. Niessner et al., "State of the art on neural rendering," in Computer Graphics Forum, vol. 39, no. 2, 2020, pp. 701–727. [3] A. F. Frangi, S. A. Tsaftaris, and J. L. Prince, "Simulation and synthesis in medical imaging," IEEE Transactions on Medical Imaging (TMI), vol. 37, no. 3, pp. 673–679, 2018. [4] M. A. ElHelw, B. P. Lo, A. Darzi, and G.-Z. Yang, "Real-time photo-realistic rendering for surgical simulations with graphics hardware," in International Workshop on Medical Imaging and Virtual Reality, 2004, pp. 346–352. [5] B. Burger, S. Bettinghausen, M. Radle, and J. Hesser, "Real-time GPU-based ultrasound simu- lation using deformable mesh models," IEEE Transactions on Medical Imaging (TMI), vol. 32, no. 3, pp. 609–618, 2013. 15 [6] O. Mattausch, M. Makhinya, and O. Goksel, "Realistic ultrasound simulation of complex surface models using interactive monte-carlo path tracing," in Computer Graphics Forum, vol. 37, no. 1, 2018, pp. 202–213. [7] M. Pharr, W. Jakob, and G. Humphreys, Physically based rendering: From theory to implemen- tation, 2016. [8] T. Weyrich, J. Lawrence, H. P. Lensch, S. Rusinkiewicz, T. Zickler et al., "Principles of appearance acquisition and representation," Foundations and Trends® in Computer Graphics and Vision, vol. 4, no. 2, pp. 75–191, 2009. [9] L. Zhang, V. Vishnevskiy, and O. Goksel, "Deep network for scatterer distribution estimation for ultrasound image simulation," IEEE Transactions on Ultrasonics, Ferroelectrics, and Frequency Control (TUFFC), vol. 67, no. 12, pp. 2553–2564, 2020. [10] I. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. Courville, and Y. Bengio, "Generative adversarial nets," Advances in Neural Information Processing Systems (NeurIPS), vol. 27, 2014. [11] T. Karras, S. Laine, and T. Aila, "A style-based generator architecture for generative adversarial networks," in IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2019, pp. 4401–4410. [12] T. Karras, S. Laine, M. Aittala, J. Hellsten, J. Lehtinen, and T. Aila, "Analyzing and improving the image quality of stylegan," in IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2020, pp. 8110–8119. [13] T. Karras, M. Aittala, S. Laine, E. H ̈ark ̈onen, J. Hellsten, J. Lehtinen, and T. Aila, "Alias-free generative adversarial networks," Advances in Neural Information Processing Systems (NeurIPS), vol. 34, pp. 852–863, 2021. [14] P. Isola, J.-Y. Zhu, T. Zhou, and A. A. Efros, "Image-to-image translation with conditional ad- versarial networks," in IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017, pp. 1125–1134. [15] T. Park, M.-Y. Liu, T.-C. Wang, and J.-Y. Zhu, "Semantic image synthesis with spatially-adaptive normalization," in IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2019, pp. 2337–2346. [16] T.-C. Wang, M.-Y. Liu, J.-Y. Zhu, A. Tao, J. Kautz, and B. Catanzaro, "High-resolution image synthesis and semantic manipulation with conditional gans," in IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2018, pp. 8798–8807. [17] X. Liu, G. Yin, J. Shao, X. Wang et al., "Learning to predict layout-to-image conditional con- volutions for semantic image synthesis," Advances in Neural Information Processing Systems (NeurIPS), vol. 32, 2019. [18] L. Jiang, C. Zhang, M. Huang, C. Liu, J. Shi, and C. C. Loy, "Tsit: A simple and versatile frame- work for image-to-image translation," in European Conference on Computer Vision (ECCV), 2020, pp. 206–222. [19] J.-Y. Zhu, T. Park, P. Isola, and A. A. Efros, "Unpaired image-to-image translation using cycle- consistent adversarial networks," in IEEE International Conference on Computer Vision (ICCV), 2017, pp. 2223–2232. [20] Z. Yi, H. Zhang, P. Tan, and M. Gong, "Dualgan: Unsupervised dual learning for image-to- image translation," in IEEE International Conference on Computer Vision (ICCV), 2017, pp. 2849–2857. 16 [21] X. Huang, M.-Y. Liu, S. Belongie, and J. Kautz, "Multimodal unsupervised image-to-image translation," in European Conference on Computer Vision (ECCV), 2018, pp. 172–189. [22] M.-Y. Liu, T. Breuel, and J. Kautz, "Unsupervised image-to-image translation networks," Ad- vances in Neural Information Processing Systems (NeurIPS), vol. 30, 2017. [23] J. Kim, M. Kim, H. Kang, and K. Lee, "U-gat-it: Unsupervised generative attentional net- works with adaptive layer-instance normalization for image-to-image translation," arXiv preprint arXiv:1907.10830, 2019. [24] T. Park, A. A. Efros, R. Zhang, and J.-Y. Zhu, "Contrastive learning for unpaired image-to- image translation," in European Conference on Computer Vision (ECCV). Springer, 2020, pp. 319–345. [25] C. Zheng, T.-J. Cham, and J. Cai, "The spatially-correlative loss for various image translation tasks," in IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021, pp. 16 407–16 417. [26] A. Shrivastava, T. Pfister, O. Tuzel, J. Susskind, W. Wang, and R. Webb, "Learning from simu- lated and unsupervised images through adversarial training," in IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017, pp. 2107–2116. [27] S. Vitale, J. I. Orlando, E. Iarussi, and I. Larrabide, "Improving realism in patient-specific ab- dominal ultrasound simulation using CycleGANs," International Journal of Computer Assisted Radiology and Surgery (IJCARS), vol. 15, no. 2, pp. 183–192, 2020. [28] J. Hoffman, E. Tzeng, T. Park, J.-Y. Zhu, P. Isola, K. Saenko, A. Efros, and T. Darrell, "Cy- cada: Cycle-consistent adversarial domain adaptation," in International Conference on Machine Learning (ICML), 2018, pp. 1989–1998. [29] L. Sharan, G. Romano, S. Koehler, H. Kelm, M. Karck, R. De Simone, and S. Engelhardt, "Mutually improved endoscopic image synthesis and landmark detection in unpaired image-to- image translation," IEEE Journal of Biomedical and Health Informatics, vol. 26, no. 1, pp. 127– 138, 2021. [30] D. Tomar, L. Zhang, T. Portenier, and O. Goksel, "Content-preserving unpaired translation from simulated to realistic ultrasound images," in International Conference on Medical Image Computing and Computer-Assisted Intervention (MICCAI). Springer, 2021, pp. 659–669. [31] S. R. Richter, H. A. Al Haija, and V. Koltun, "Enhancing photorealism enhancement," IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI), 2022. [32] Y. Li, C. Fang, J. Yang, Z. Wang, X. Lu, and M.-H. Yang, "Universal style transfer via feature transforms," Advances in Neural Information Processing Systems (NeurIPS), vol. 30, 2017. [33] F. Luan, S. Paris, E. Shechtman, and K. Bala, "Deep photo style transfer," in IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017, pp. 4990–4998. [34] X. Huang and S. Belongie, "Arbitrary style transfer in real-time with adaptive instance normal- ization," in IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017. [35] X. Li, S. Liu, J. Kautz, and M.-H. Yang, "Learning linear transformations for fast image and video style transfer," in IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2019, pp. 3809–3817. [36] M. Harders, Surgical scene generation for virtual reality-based training in medicine. Springer Science & Business Media, 2008. [37] S. Tuchschmid, "High fidelity surgical simulator for hysteroscopy," Ph.D. dissertation, ETH Zurich, 2010. 17 [38] A. P. Twinanda, S. Shehata, D. Mutter, J. Marescaux, M. De Mathelin, and N. Padoy, "Endonet: a deep architecture for recognition tasks on laparoscopic videos," IEEE Transactions on Medical Imaging (TMI), vol. 36, no. 1, pp. 86–97, 2016. [39] S. R. Richter, V. Vineet, S. Roth, and V. Koltun, "Playing for data: Ground truth from computer games," in European Conference on Computer Vision (ECCV), 2016, pp. 102–118. [40] M. Cordts, M. Omran, S. Ramos, T. Rehfeld, M. Enzweiler, R. Benenson, U. Franke, S. Roth, and B. Schiele, "The cityscapes dataset for semantic urban scene understanding," in IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016. [41] I. Hacihaliloglu, R. Abugharbieh, A. J. Hodgson, and R. N. Rohling, "Bone surface localization in ultrasound using image phase-based features," Ultrasound in Medicine & Biology, vol. 35, no. 9, pp. 1475–1487, 2009. [42] F. Yu, V. Koltun, and T. Funkhouser, "Dilated residual networks," in IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017, pp. 472–480. [43] W.-Y. Hong, C.-L. Kao, Y.-H. Kuo, J.-R. Wang, W.-L. Chang, and C.-S. Shih, "Cholecseg8k: a semantic segmentation dataset for laparoscopic cholecystectomy based on cholec80," arXiv preprint arXiv:2012.12453, 2020. [44] J. Johnson, A. Alahi, and L. Fei-Fei, "Perceptual losses for real-time style transfer and super- resolution," in European Conference on Computer Vision (ECCV), 2016, pp. 694–711. [45] F. Ozdemir, C. Tanner, and O. Goksel, "Delineating bone surfaces in b-mode images constrained by physics of ultrasound propagation," arXiv preprint arXiv:2001.02001, 2020. [46] G. Kwon, C. Han, and D.-s. Kim, "Generation of 3D brain mri using auto-encoding generative adversarial networks," in International Conference on Medical Image Computing and Computer Assisted Intervention(MICCAI), 2019, pp. 118–126. [47] W. H. Pinaya, P.-D. Tudosiu, J. Dafflon, P. F. Da Costa, V. Fernandez, P. Nachev, S. Ourselin, and M. J. Cardoso, "Brain imaging generation with latent diffusion models," in MICCAI Work- shop Deep Generative Models, 2022, pp. 117–126. [48] L. Mescheder, A. Geiger, and S. Nowozin, "Which training methods for GANs do actually con- verge?" in International Conference on Machine Learning (ICML), 2018, pp. 3481–3490. [49] A. Paszke, S. Gross, F. Massa, A. Lerer, J. Bradbury, G. Chanan, T. Killeen, Z. Lin, N. Gimelshein, L. Antiga et al., "Pytorch: An imperative style, high-performance deep learn- ing library," preprint arXiv:1912.01703, 2019. [50] D. P. Kingma and J. Ba, "Adam: A method for stochastic optimization," in International Con- ference on Learning Representations (ICLR), 2015, pp. 1–15. [51] T. Karras, M. Aittala, J. Hellsten, S. Laine, J. Lehtinen, and T. Aila, "Training generative adversarial networks with limited data," Advances in Neural Information Processing Systems (NeurIPS), vol. 33, pp. 12 104–12 114, 2020. [52] M. Heusel, H. Ramsauer, T. Unterthiner, B. Nessler, and S. Hochreiter, "Gans trained by a two time-scale update rule converge to a local nash equilibrium," Advances in Neural Information Processing Systems (NeurIPS), vol. 30, 2017. [53] M. Bi ́nkowski, D. J. Sutherland, M. Arbel, and A. Gretton, "Demystifying mmd gans," arXiv preprint arXiv:1801.01401, 2018. [54] P. Iakubovskii, "Segmentation models pytorch," https://github.com/qubvel/segmentation models.pytorch, 2019. 18 Figure 7: Additional qualitative label-to-image translation results for the laparoscopic simulation ap- plication Style-C (top three rows) and Style-H (next three rows), the ultrasound simulation application (next thre rows), and the gaming application (last three rows). 19 LaparoSim Style-CLaparoSim Style-HGTA CityscapesUSSim GE-E10TranslatedCycleGANCUTSimIT-CSimIT-CSSimITConPresSimulatedSimulatedImage (ref)Label (input) R ), reconstructed image G(F (I R Figure 8: Additional image-to-label translation results of SimIT with the input real image I R R , trans- lated result F (I R R )), and ground truth label-maps for reference; for (a) in-house laparoscopic, (b) CholecSeg8k, and (c) Cityscapes images. No ground-truth annotation is available for the dataset in (a). Note that although the reconstructed images are generated from translated images, they are ordered in-reverse to place the same representations with the input and GT next to each other for easier visual comparison. 20 (a)(c)Image(input)SimITReconstructedTranslatedImage(input)SimITReconstructedTranslated(b)Label(GT)Image(input)SimITReconstructedTranslatedLabel(GT)
http://arxiv.org/abs/2302.10692v1
2023-02-21T14:22:01
2023-02-21T14:22:01
On Inductive Biases for Machine Learning in Data Constrained Settings
Learning with limited data is one of the biggest problems of machine learning. Current approaches to this issue consist in learning general representations from huge amounts of data before fine-tuning the model on a small dataset of interest. While such technique, coined transfer learning, is very effective in domains such as computer vision or natural langage processing, it does not yet solve common problems of deep learning such as model interpretability or the overall need for data. This thesis explores a different answer to the problem of learning expressive models in data constrained settings: instead of relying on big datasets to learn neural networks, we will replace some modules by known functions reflecting the structure of the data. Very often, these functions will be drawn from the rich literature of kernel methods. Indeed, many kernels can reflect the underlying structure of the data, thus sparing learning parameters to some extent. Our approach falls under the hood of "inductive biases", which can be defined as hypothesis on the data at hand restricting the space of models to explore during learning. We demonstrate the effectiveness of this approach in the context of sequences, such as sentences in natural language or protein sequences, and graphs, such as molecules. We also highlight the relationship between our work and recent advances in deep learning. Additionally, we study convex machine learning models. Here, rather than proposing new models, we wonder which proportion of the samples in a dataset is really needed to learn a "good" model. More precisely, we study the problem of safe sample screening, i.e, executing simple tests to discard uninformative samples from a dataset even before fitting a machine learning model, without affecting the optimal model. Such techniques can be used to prune datasets or mine for rare samples.
[ "Grégoire Mialon" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10692v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10692v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 2 9 6 0 1 . 2 0 3 2 : v i X r a Préparée à l'École Normale Supérieure On Inductive Biases for Machine Learning in Data Constrained Settings Soutenue par Grégoire Mialon Le 19 Janvier 2022 École doctorale no386 École Doctorale De Sci- ences Mathématiques de Paris Spécialité Mathématiques Appliquées Composition du jury : Gabriel Peyré Researcher, CNRS Alexandre Gramfort Researcher, INRIA Michael Bronstein Professor, Oxford/Twitter Pascal Frossard Professor, EPFL Rapporteur et Prési- dent du jury Rapporteur Examinateur Examinateur Anna Korba Assistant Professor, ENSAE/CREST Examinatrice Alexandre d'Aspremont Researcher, CNRS Julien Mairal Researcher, INRIA Directeur de thèse Directeur de thèse Abstract Learning with limited data is one of the biggest problems of deep learning. Current, popular approaches to this issue consist in training models on huge amounts of data, labelled or not, before re-training the model on a smaller dataset of interest from the same modality. Intuitively, this technique allows the model to learn a general representation for some kind of data first, such as images. Then, fewer data should be required to learn a specific task for this particular modality. While this approach coined as "transfer learning" is very effective in domains such as computer vision or natural langage processing, it does not solve common problems of deep learning such as model interpretability or the overall need for data. This thesis explores a different answer to the problem of learning expressive models in data constrained settings. Instead of relying on big datasets to learn the parameters of a neural network, we will replace some of them by known functions reflecting the structure of the data. Very often, these functions will be drawn from the rich litterature of kernel methods. Indeed, many kernels can be interpreted, and/or allow for learning with few data. Our approach falls under the hood of "inductive biases", which can be defined as hypothesis on the data at hand restricting the space of models to explore during learning. In the first two chapters of the thesis, we demonstrate the effectiveness of this approach in the context of sequences, such as sentences in natural language or protein sequences, and graphs, such as molecules. We also highlight the relationship between our work and recent advances in deep learning. The last chapter of this thesis focuses on convex machine learning models. Here, rather than proposing new models, we wonder which proportion of the samples in a dataset is really needed to learn a "good" model. More precisely, we study the problem of safe sample screening, i.e, executing simple tests to discard uninformative samples from a dataset even before fitting a machine learning model, without affecting the optimal model. Such techniques can be used to compress datasets or mine for rare samples. i Résumé Apprendre à partir de données limitées est l'un des plus gros problèmes du deep learning. Les approches courantes et populaires de cette question consistent à entraîner un modèle sur d'énormes quantités de données, étiquetées ou non, avant de réentraîner le modèle sur un ensemble de données d'intérêt, plus petit, appartenant à la même modalité. Intuitivement, cette technique permet au modèle d'apprendre d'abord une représentation générale pour un certain type de données, telles que des images. Moins de données seront ensuite nécessaires pour apprendre une tâche spécifique pour cette modalité particulière. Bien que cette approche appelée « apprentissage par transfert » soit très efficace dans des domaines tels que la vision par ordinateur ou le traitement du langage naturel, elle ne résout pas les problèmes courants du deep learning tels que l'interprétabilité des modèles ou le besoin global en données. Cette thèse explore une réponse différente au problème de l'apprentissage de modèles expressifs dans des contextes où les données sont plus rares. Au lieu de s'appuyer sur de grands ensembles de données pour apprendre les paramètres d'un réseau de neurones, nous remplacerons certains de ces paramètres par des fonctions mathématiques connues reflétant la structure des données. Très souvent, ces fonctions seront puisées dans la riche littérature des méthodes à noyau. En effet, de nombreux noyaux peuvent être interprétés, et/ou permettre un apprentissage avec peu de données. Notre approche s'inscrit dans le cadre des « biais inductifs », qui peuvent être définis comme des hypothèses sur les données disponibles restreignant l'espace des modèles à explorer lors de l'apprentissage. Dans les deux premiers chapitres de la thèse, nous démontrons l'efficacité de cette approche dans le cadre de séquences, telles que des phrases en langage naturel ou des séquences protéiques, et de graphes, tels que des molécules. Nous soulignons également la relation entre notre travail et les progrès récents du deep learning. Le dernier chapitre de cette thèse se concentre sur les modèles d'apprentissage automatique convexes. Ici, plutôt que de proposer de nouveaux modèles, nous nous demandons quelle proportion des échantillons d'un jeu de données est vraiment nécessaire pour apprendre un « bon » modèle. Plus précisément, nous étudions le problème du filtrage sûr des échantillons, c'est-à-dire l'exécution de tests simples afin d'éliminer les échantillons non informatifs d'un ensemble de données avant même d'entraîner un modèle d'apprentissage automatique, sans affecter le modèle optimal. De telles techniques peuvent être utilisées pour compresser des jeux de données ou extraire des échantillons rares. ii À mes grands-parents iii Remerciements Comme tout un chacun, j'ai pour habitude de lire les remerciements d'une thèse avec une attention teintée d'attentes. Y figurerai-je, dans ces remerciements ? Vais-je y glaner des détails personnels sur l'impétrant, aujourd'hui chercheur reconnu ? Non, les remerciements ne sont pas une tâche à prendre à la légère. Mon aventure dans le monde de l'intelligence artificielle a commencé grâce à Jean Ponce et Jean-Philippe Vert, qui m'ont gentiment permis de suivre le master recherche Mathématiques, Vision, Apprentissage, et accepté de discuter avec moi de l'opportunité de faire une thèse. J'ai ensuite eu la chance d'être encadré par Julien Mairal et Alexandre d'Aspremont. Ceux-ci m'ont bien souvent prodigué le conseil qui débloquait. Je veux ici les remercier sincèrement pour leur confiance, et pour avoir su créer un climat de travail serein durant ces trois années. Je ne me suis jamais senti esseulé. Ce doctorat a été effectué au sein de l'Institut national de recherche en informatique et en automatique (Inria), encore trop peu connu en France, dont la mission est le développe- ment de la recherche et de la valorisation en sciences et techniques de l'information et de la communication. L'Inria, en particulier le centre de Paris, m'a fourni un environnement de travail plus que confortable. Je pense ainsi à l'efficacité des démarches administrative, à la prévenance de la célèbre équipe communication, celle toute teintée de patience d'Éric Fleury et, plus prosaïquement, au confort de mon bureau. Plus précisément, j'ai fait partie de deux équipes de l'Inria : Sierra, à Paris, et Thoth, à Grenoble. J'ai été magnifiquement bien accueilli dans les deux. Sierra, c'est l'éclectisme scientifique, mais aussi des discussions quotidiennes. Je veux ici remercier Francis Bach pour l'attention qu'il porte au bien-être des doctorants. Thoth, c'est la chaleur de l'équipe et, évidemment, les montagnes. J'aimais mes visites à Grenoble. Merci aux assistantes des deux équipes, Hélène Bessin-Rousseau et Nathalie Gillot, pour leur gentillesse et leur patience, qui m'ont grandement facilité la vie. Cette thèse n'aurait pas été possible sans financement, apporté dans mon cas par l'European Research Council (ERC). Je vais ici profiter de la gourmandise avec laquelle ces remerciements seront peut-être parcourus pour détailler ce système de financement méritant d'être connu au-delà du monde de la recherche scientifique, et qui m'a permis de mener ma recherche sereinement et librement. L'ERC est un organe de l'Union européenne chargé de coordonner les efforts de la recherche entre les États membres de l'Union, et la première agence de financement pan-européenne pour une « recherche à la frontière de la connaissance ». Elle propose sur concours différents financements. Pour un jeune chercheur souhaitant se lancer sur ses propres thématiques, l'ERC propose une Starting Grant : 1,5 millions d'euros sur 5 ans, avec une très grande liberté d'utilisation. L'ERC Starting Grant sur laquelle j'ai été financé a été obtenue dans mon cas par Julien Mairal en 2016 (Projet SOLARIS). J'ai donc, durant ces trois ans, iv toujours eu les moyens de participer à une conférence, une école d'été, ou plus simplement me rendre à Grenoble : là encore, tous les chercheurs n'ont pas cette chance. La présente thèse a bénéficié du supercalculateur Jean Zay. Merci à ses équipes pour son aide et sa gestion, offrant un outil à la fois puissant et simple d'utilisation. Il me reste à présent à remercier celles et ceux dont j'ai eu la chance de croiser le chemin, en demandant par avance pardon à mon lecteur en cas d'oubli. Merci, donc, à Adrien, Alessandro, Francis, Pierre et Umut pour Sierra, et à Justin pour Willow : votre porte était toujours ouverte pour moi et mes diverses interrogations. J'ai une pensée particulière pour Jean-Paul Lomond, dont je garde l'image d'un scientifique inspirant et qui avait le souci d'expliquer au public les grands enjeux de son domaine. Merci à Ghislain, Loïc, et Xavier pour avoir abondamment conseillé le quasi-novice que j'étais sur le développement. Merci à mes comparses de bureau, Benjamin, Manon, Mathieu, Radu, et Thomas : vous avez su endurer mes digressions. Merci à Alex, Alexandre, Antoine, Bruno, Hadrien, Julia, Lenaic, Loucas&Raphaël, Margaux, Rémi, Robin, Ronan, Thomas, Ulysse, Vivien, Yana, Yann, bref, à ma génération de doctorants et ceux du dessus, pour les grands moments scientifiques et moins scientifiques que nous avons partagé. Merci à Luca, notre pièce rapportée de Dyogene et à Arthur, le grand frère de thèse que j'ai connu en dehors du laboratoire. Merci à Antoine, Bertille, Boris, Céline, Elliot, Eloïse, Etienne, Gaspard, Gautier, Oumayma, Pierre-Cyril, Pierre-Louis, Ricardo, Thomas, Wilson, et Yann, la génération suivante, avec laquelle j'aurais aimé passer plus de temps. Merci à Alberto, Dexiong, Mathilde, Thomas, et Valentin, les compagnons de toujours à Grenoble, et l'une de mes motivations pour y retourner. Merci à Alexander, Alexandre, Andrei, Daan, Florent, Houssam, Juliette, Konstantin, Margot, Michael, Mikita, Minttu, Pauline, Theo, et Vladyslav : c'était un plaisir de vous voir à Grenoble et Montbonnot. Merci au jury, Alexandre Gramfort et Gabriel Peyré pour les rapporteurs, Michael Bronstein, Pascal Frossard, et Anna Korba pour les examinateurs : c'était une fierté de vous présenter mon travail et un plaisir d'en discuter. Je remercie enfin ceux qui m'ont entouré ou m'entourent encore de leur amitié et de leur amour. Je pense en particulier à ma famille, ainsi qu'à celle qui est aujourd'hui mon étoile. Paris, le 27 janvier 2022 v Contents 1 Introduction 1.1 The state of machine learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.1 Past and present of machine learning . . . . . . . . . . . . . . . . . . . . 1.1.2 Generalization and other problems of deep learning . . . . . . . . . . . . 1.1.3 A promising but limited answer to the generalization problem: transfer learning from pre-trained models . . . . . . . . . . . . . . . . . . . . . . 1.1.4 Motivation: inductive biases, or another solution to the generalization problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2.1 Kernel methods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2.2 Transformers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3 Outline of the thesis and contributions . . . . . . . . . . . . . . . . . . . . . . . 1.2 Preliminaries 2 Embedding Sets of Features with Optimal Transport Kernels 2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Related Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3 Proposed Embedding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.1 Preliminaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.2 Optimal Transport Embedding and Associated Kernel 2.3.3 From infinite-dimensional kernel embedding to finite dimension . . . . . 2.3.4 Unsupervised and Supervised Learning of Parameter z . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.5 Extensions 2.4 Relation between our Embedding and Self-Attention . . . . . . . . . . . . . . . 2.5 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.5.1 Datasets, Experimental Setup and Baselines . . . . . . . . . . . . . . . . 2.5.2 Results and discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.7 Proofs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.7.1 Proof of Lemma 2.3.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . for multiple references . . . . . . . . . 2.7.2 Relationship between W2 and W z 2 2.8 Additional Experiments and Setup Details . . . . . . . . . . . . . . . . . . . . . 2.8.1 Protein fold recognition . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.8.2 Detection of chromatin profiles . . . . . . . . . . . . . . . . . . . . . . . SST-2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.8.3 vi 1 1 1 3 5 6 7 7 10 11 14 14 16 16 16 19 22 22 23 24 25 25 29 31 32 32 33 33 34 35 38 3 Encoding Graph Structure in Transformers with Kernels on Graphs 3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 Related work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3 Preliminaries about Kernels on Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4 Encoding Graph Structure in Transformers . . . . . . . . . . . . . . . . . . . 3.4.1 Transformer Architectures for Graphs 3.4.2 Encoding Node Positions . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.3 Encoding Topological Structures . . . . . . . . . . . . . . . . . . . . . . 3.5 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5.1 Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5.2 Results and Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5.3 Visualizing attention scores for the Mutagenicity dataset. 3.6 Remark on Generalized Self-attention . . . . . . . . . . . . . . . . . . . . . . . 3.7 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.8 Experimental Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.8.1 General Details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.8.2 Graph Classification Datasets . . . . . . . . . . . . . . . . . . . . . . . . 3.8.3 Graph Regression Dataset . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Sample Screening in Empirical Risk Minimization 4.1 4.2 Preliminaries Safe Loss Functions and Sparsity in the Dual of ERM Formulations Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.1 Fenchel Conjugacy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.2 Empirical Risk Minimization and Duality . . . . . . . . . . . . . . . . . . . 4.2.3 4.3 Safe Rules for Screening Samples . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.1 Principle of SAFE Rules for Data Points . . . . . . . . . . . . . . . . . . 4.3.2 Building the Test Region X . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.3 Extension to Kernel Methods . . . . . . . . . . . . . . . . . . . . . . . . 4.4 Constructing Safe Losses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Inducing Sparsity in the Dual of ERM . . . . . . . . . . . . . . . . . . . 4.4.1 4.4.2 Link Between the Original and Regularized Problems . . . . . . . . . . 4.4.3 Effect of Regularization and Examples . . . . . . . . . . . . . . . . . . . 4.5 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5.1 Accuracy of our safe logistic loss 4.5.2 Safe Screening . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5.3 Dataset Compression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7 Proofs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.1 Proof of Lemma 4.2.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.2 Proof of Lemma 4.3.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.3 Proof of Lemma 4.4.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.4 Lemma 4.7.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.5 Proof of Lemma 4.4.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7.6 Proof of Screening-friendly regression . . . . . . . . . . . . . . . . . . . 4.8 Additional experimental results. . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 42 44 45 46 47 47 49 50 50 51 53 61 61 63 63 63 65 67 67 69 69 69 70 70 70 71 73 74 74 75 75 77 77 78 80 82 85 85 85 86 87 87 87 88 vii 5 Conclusion and Future Work 5.1 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2 Future work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bibliography 89 89 90 92 viii Chapter 1 Introduction 1.1 The state of machine learning Recent advances in machine learning, namely deep learning [Goodfellow et al., 2016], are slowly starting to deliver. Deep language models such as BERT [Devlin et al., 2019] equip search engines to improve the relevance of the results. Researchers in bioinformatics can rely on strong models for protein structure prediction [Jumper et al., 2021], a crucial task to understand the properties of proteins, the building block of life, which would otherwise being costly in terms of time and money. Some programming task could soon be automated with new kinds of programming languages taking instructions in natural language as input [Chen et al., 2021]. These three innovations share one common characteristic: their underlying deep neural networks were trained on very large scale datasets. For example, BERT was trained on 3.3 billion words from a corpus of books and English Wikipedia, representing 33,000 books, or ten times the minimum amount of books a library should contain according to UNESCO. Several language models have followed, trained on datasets a few order of magnitude bigger and this important trend is emerging for many other data modalities. Such an approach to machine learning is an answer to one of its biggest problem: generalization. Roughly, how to handle new, unseen data. We will briefly delve into the definition and history of machine learning, before elaborating on the generalization problem and how it is currently being addressed with pre-trained models. Then, we will explain why and how the following thesis provides a different answer to this problem and finally deliver its outline and contributions. 1.1.1 Past and present of machine learning What is machine learning? In its best known form, machine learning is nothing else but a computer program learning to map an input A to an output B. To do so, the program requires training examples of A and corresponding B, a model whose parameters will be adjusted to fit the examples, and a metric for the model to know whether it does good or not and adjust its parameters accordingly. More precisely, and in many cases, training a machine learning model consists in solving the following problem coined as Empirical Risk Minimization (ERM) i.e given a dataset of n examples xi whose desired mapping is yi, finding a prediction function f parameterized by θ solving: minθ 1 n n X i=1 '(fθ(xi), yi) + λΩ(fθ), (1.1) 1 where ' is a loss term reflecting the discrepancy between a prediction fθ(xi) and the ground truth yi, and Ω a term penalizing the complexity of the solution, according to Occam's razor. Contrarily to pure optimization, whose objective would consist in optimizing the metric for the training data only, machine learning aims at finding a model which will also do well on new, unseen data, an ability coined as generalization. This is why we often add constraints to the ERM problem such as Ω. As such, machine learning is a subfield of artificial intelligence, whose goal is to create computers and programs exhibiting "intelligent" behavior - rigorously defining intelligence being an open question [Chollet, 2019]. But, why would we want a computer program to learn to perform a task, such as predicting the content of an image, instead of directly implementing rules for this task? Because, in many cases, rules defined by a human programmer will be incomplete or nearly impossible to formulate. Think for example about a program designed to identify an animal from its picture. First, a dog could be distinguished from a cat by looking at its nose. But what if the nose is obfuscated? This would require to add an additional rule. And, if this rule cannot be applied, another one, etc. Second, rules can be difficult or even impossible to formulate: how to express what a nose is in terms of pixels? In many cases, letting a program learn its own rules will circumvent this difficulties and expand the spectrum of tasks that can be automated as well as the level of performance. Until recently, and excepted older approaches to neural networks, machine learning mostly relied on models that could be learned using convex optimization: the training procedure often consisted in solving a convex optimization problem, which is well-understood today [Boyd and Vandenberghe, 2004]. Many of these models were linear, or achieved non-linearity via techniques such as the kernel trick (see below) and could lack of expressiveness or ability to generalize compared to more recent approaches such as deep neural networks. Somehow symmetrically, training procedures for deep learning are still not understood today and are an important research topic. Finally, note that there is much more to machine learning than solving problems such as ERM. For example, an important area of machine learning is unsupervised learning, a setting where we only have samples xi but no labels yi and we generally seek to learn a general representation of the data that could be used for downstream tasks: formulating the learning task is therefore a problem in itself. Why is it important? Recent advances in machine learning, namely deep learning (see Good- fellow et al. [2016] for a detailed introduction), raised high expectations in the past years for its promise to help humans executing always more complex tasks with various degrees of supervision: - Machine learning could (and is in the process of) automate tasks with a level of perfor- mance that were previously thought to be a human backyard such as image generation (with techniques such as Generative Adversarial Networks [Goodfellow et al., 2014] and Variational Autoencoders [Kingma and Welling, 2014] among others), sentence generation in natural language [Brown et al., 2020] or simply playing games such as Go [Schrittwieser et al., 2020] to give but a few examples. - Even in contexts where human supervision is essential, machine learning could still be used to handle large amounts of data that would otherwise be intractable for a human, and find subtle patterns in complex data. In bioinformatics for example, the continuous development and declining cost of high-throughput technologies led to a dramatic increase 2 in the quantity of omics data (i.e, genomics, proteomics, metabolomics, metagenomics and transcriptomics) available to practitioners. One famous instance of this trend is the human genome: in the last twenty years, its cost of sequencing (3.3GB) fell from $100,000,000 to $1,000. In this context, machine learning could typically be used as a tool by researchers to find complex relationships between genes, metabolisms and environment resulting in onset and progression of diseases. Where does it come from? Machine learning as a field emerged progressively during the last 80 years, and takes its foundations in statistics, probabilities, linear algebra, and computer science. Exhaustively retracing the history of machine learning would be out of the scope of this introduction and we will simply review (subjectively) pivotal moments of the field. At the heart of machine learning lies linear model fitting, such as linear regression, discovered in the XVIIIe century or Support Vector Machine [Cortes and Vapnik, 1995], which rely on convex optimization for solving the training problem. Such models have been flourishing since the beginning of machine learning and are still of importance today for their simplicity both in terms of interpretability and from a computational point of view. Years 2010 have seen sparse models blossom: adding penalties such as the '1 norm to the training problem encourages the learned models to be sparse, making those even more interpretable and fast to optimize [Bach et al., 2012]. It is now well-known that a combination of increase in the quantity of data and compute power, briefly coined as the Big Data era, triggered the emergence of deep learning which is turning the state of the art in many fields upside down. Indeed, deep learning had been known for a while, but required more data than classical machine learning models to deliver its full potential. In 2012, a Convolutional Neural Network (CNN) designed for image classification, AlexNet, outperformed its non deep competitors at the ImageNet challenge for the first time [Krizhevsky et al., 2012]. Since then, CNNs have been largely adopted as the cornerstone of many computer vision technologies such as image classification, face recognition, character recognition, and many others. This moment was also the spark that ignited massive research and investment in deep learning. In 2016, Lee Sedol, one of the very best Go players at the moment, was defeated by AlphaGo, an algorithm relying on deep reinforcement learning [Silver et al., 2016] to select the best possible moves. This event demonstrated that deep learning was able to achieve superhuman performances in fields that were previously thought to be out of reach for computers. In 2018, BERT, a language model based on transformers, a deep neural network architecture introduced the year before [Vaswani et al., 2017], beat other deep networks on important natural language processing benchmarks [Devlin et al., 2019]. This work triggered a great deal of research on transformers and huge models trained on similarly huge datasets. Deep learning is still reaching new, impressive milestones as of today. 1.1.2 Generalization and other problems of deep learning Although deep learning generated high expectations by outperforming the state of the art on a wide range of tasks, its deployment in real life applications has been dampened for various reasons. - Deep models can express complicated functions but require a lot of data to be able to generalize, i.e make good predictions on data which has not been seen during the training. This can be problematic if one wants to use these models in data constrained settings such as studying the onset of rare diseases. In France for example, it is estimated that there are 3 less than 30,000 people per rare disease, which means even less samples to study (2019). More generally, using many samples is in contradiction with animal intelligence, which seems to acquire deep knowledge of its environment by learning from a small amount of samples. For example, most humans need few pictures of horses to be able to recognize a new horse! Some may even be able to recognize unseen animals from their description. Thinking about how to learn with minimal amount of samples is probably an interesting path towards advancing machine learning. - Deploying deep learning based technologies into real life products, some of them being critical objects such as surveillance systems or self-driving cars, may require interpretability to ensure the system complies with the norm, among other requirements1. Interpretability is also a desirable property of machine learning models in the setting of scientific discovery, as discovering key predictors for a particular phenomenon can suggest new avenues of research. - It is well-known that deep learning models lack of robustness to perturbations that can happen when the model is deployed. Thus, slight modifications to the input of deep models can trigger important responses at the output level. This is the cornerstone of adversarial attacks in vision, where humanly imperceptible modifications of the input image (generally a few pixels) trick the network into predicting an obviously wrong label [Szegedy et al., 2014]. This is an important vulnerability of deep models, which could be exploited to cause accidents with self-driving cars or avoid detection by facial recognition technologies. In Natural Language Processing, it is also possible to retrieve pieces of the training data by querying the model in the correct way [Carlini et al., 2020]. This could be a problem as many large models are pre-trained on huge, private datasets potentially containing sensitive data. - Deep learning is generally associated to high computational and environmental costs [Strubell et al., 2019]. Indeed, the lack of theoretical understanding of the optimization procedures of deep neural networks requires to perform many training iterations to yield a satisfying model in terms of accuracy of predictions. Moreover, the size of the models and datasets, which have grown bigger and bigger in the past few years, and the popularity of such techniques in research and industry made the share of machine learning in overall computations overwhelming. Discussing the energy efficiency of these models would be a research topic on its own: the fact that the hardware is specializing for deep learning, improving its energy efficiency, has to be taken into account, but does it balance the cost of developing and producing these new chips? The energy mix of the country providing electricity to the computing infrastructure also has to be taken into account. Hence, it is very difficult to conclude regarding the real cost of deep learning. Be that as it may, getting to the same level of performance as AlexNet required 44 less compute in 2019 than in 2012 [Hernandez and Brown, 2020]. Significant proportions of machine learning research are dedicated to solving these problems, which are obviously not an exhaustive list of machine learning problems worth studying. This thesis focuses on the generalization problem yet may include a discussion on the other issues throughout the chapters. 1European Commission's proposal for a Regulation on Artificial Intelligence, 2021 4 1.1.3 A promising but limited answer to the generalization problem: trans- fer learning from pre-trained models Today, a popular answer to the problem of generalization lies in transfer learning from large pre-trained models. Definition 1.1.1 (Transfer learning). Transfer learning consists in training a model that has already been trained on a dataset A, on a generally similar dataset B. By "similar", we mean a dataset of the same modality but potentially different distribution. The intuition behind is that knowledge acquired while learning on A could be reused to handle B. For example, a computer vision model trained to classify images of animals could be used as a backbone to classify images of cars since all natural images share features such as edges, curves, or angles. Transfer learning is currently and typically used as follows: a model is trained on a huge dataset on a pretext task, with the aim to learn a general representation that will do well on different downstream tasks. Indeed, it is then possible to train the general model on a smaller, specialized dataset of interest on which training a deep model from scratch would have yielded poor performance or simply been impossible due to the lack of data. For example, language models are trained by predicting masked words in a sentence using the other words. The assumption is that the model will learn a language representation that will enable it to do well on a specialized task, for example predicting whether a movie review is positive or not. This idea is not new and may have been formulated for the first time in 1976 [Bozinovski and Fulgosi, 1976] (although in Croatian). The same wave that carried deep learning, i.e unprecedented availability of computational power and data, enabled to pre-train models on always larger datasets. This was also allowed by the progress of self-supervised learning [He et al., 2020], a learning framework which does not require annotated data, thus giving access to massive, unlabelled corpus (labelling data, a base requirement of supervised learning, is generally costly). Models can now be trained on datasets a few orders of magnitude bigger than what was done a few years ago. When the author began to work on his thesis, transfer learning mainly consisted in using various convolutional neural networks trained on ImageNet, a classification dataset of 1 million images with 1000 labels, as a backbone for solving other computer vision tasks. However, after the emergence of transformers and BERT, this approach became standard for other data modalities. In the field of NLP, language models are now pre-trained on bigger and bigger datasets [Brown et al., 2020], and for various languages [Martin et al., 2020], before being fine-tuned for downstream tasks such as natural language understanding [Wang et al., 2020]. This practice has also been extended to new data modalities such as protein sequences [Rives et al., 2019] or graphs as will be explained in Chapter 3. Models pre-trained on datasets one or two orders of magnitude bigger than ImageNet are also emerging in computer vision [Dosovitskiy et al., 2021]. In the same way as code of deep architectures was publicly released on GitHub, pre-trained models are now often made available and centralized on platforms such as the transformers library from HuggingFace [Wolf et al., 2019]. Pre-trained models are a promising answer to the problem of generalization in machine learning postulating that it is possible to learn a general purpose representation of a given modality, such as images. Indeed, natural images share low-level features such as edges, curves or colors. Avoiding to learn these features from scratch each time a model is trained enables to focus on learning features specific to the dataset, such as wheels or car door is model has to classify models of cars, thus allowing to use deep learning on relatively small datasets. Pre-trained models are currently a popular research topic. 5 The limits of transfer learning. Pre-trained models are currently changing the practice of machine learning. Although these models are quite successful at providing general purpose representations, they do not fundamentally solve the problems that deep learning is facing. In fact, they even underlines some issues: pre-trained models require many data by definition (although they are meant to be trained only once and for all), they are costly to train and manipulate because of their size, they are prone to bias and to adversarial or privacy attacks. GPT-3 [Brown et al., 2020], one of the most famous and strongest language models, was trained on half a trillion words, including Wikipedia and branches of the internet. This is a few thousand times the amount of words a human will hear and read in its lifetime. Although GPT-3 provides impressive performance in terms of natural language understanding or generation, it has also been put in evidence that its family of models, namely Large Language Models (LLM) have some of the undesirable effects described above such as a high computational cost and tendency to exhibit biases [Bender et al., 2021]. Moreover, not all domains provide access to enough data: in many cases, pre-trained models are simply not available, think about the example of rare diseases. Another potential problem of large pre-trained models is their decreasing return with respect to the quantity of data: it becomes more and more difficult to train models on bigger datasets with seemingly diminishing gains in terms of performance on downstream tasks: the current trend may not be sustainable. Finally, data efficient models are believed to be a path towards machine learning models that generalize better. For all these reasons, finding other solutions to improve the generalization of machine learning models is an important problem. 1.1.4 Motivation: inductive biases, or another solution to the generalization problem We provide a different answer to the generalization problem. Instead of training bigger models with more data, we will focus on data constrained settings, i.e datasets ranging from a few hundreds to a few tenths of thousands of samples. We will keep using expressive models such as neural networks yet reduce the number of learnable parameters by replacing them by known mathematical functions, an approach belonging to the wide family of inductive biases. We now define the term inductive bias, relying heavily on the definition provided by Battaglia et al. [2018]. Definition 1.1.2 (Inductive bias). An inductive bias is an hypothesis allowing to prioritize one solution or interpretation over another, independent of the observed data. It expresses assumptions about either the data-generating process (linear least squares reflect the assumption that the data is a line corrupted by Gaussian noise) or the space of solutions (the '1 penalty generally promotes a sparse solution). Why are they useful? Inductive bias are useful as they often trade flexibility of the learning model for improved sample complexity, a useful property in data constrained settings. Another useful feature of many inductive biases is their interpretability, as they are the result of a human made assumption on the data generating process or the space of solutions. A simple example of inductive bias in machine learning is the '1 norm used to penalize the weights of the model, typically in the setting of linear regression. First, this term acts as a regularization: it prevents the model of overfitting by enforcing a simple solution to the training problem. Moreover, it can be interpreted, in the sense that the solution will be sparse in terms of features used to make a prediction. Intuitively, the model will select the most relevant features, a useful 6 behavior in domains such as genomics where there are a few particular genes of interest among thousands of others when it comes to predict the onset of a particular disease. As explained above, not every domain has access to vast amounts of data, such as stock prices in finance or more generally domains with rare events. Other domains may have plenty of data available but require interpretability of the models, such as researchers studying phenomenon in natural science, hence looking for interpretable patterns to further investigate and/or express theories. Goal of this thesis. The object of this thesis is to introduce algorithms for learning in data constrained settings and for various data modalities such as sequences or graphs when pre-trained models are not available or advantageous. By constrained data setting, we mean datasets ranging from a few hundreds to a few tenths of thousands of samples. To do so, we will heavily rely on the previously discussed inductive biases, and particularly on kernel methods which enable to encode inductive biases directly into a model. This thesis also builds on one of the most recent deep learning architecture for dealing with set input data, the transformer. 1.2 Preliminaries In this section, we introduce concepts that will be used in at least two of the three chapters of this thesis. 1.2.1 Kernel methods. What are kernel methods? Kernel methods have been extensively used in machine learning, see Schölkopf and Smola [2001] for a detailed introduction. They consist in mapping data living in some space X to a high or infinite dimensional space H via a kernel function K : X × X 7→ R. The intuition behind this technique is that data lying in a high dimensional space may become more easily separable for linear models. Intuitively, K acts as a measure of similarity between a pair of elements (x, x0) living in H. H is a Reproducing Kernel Hilbert Space (RKHS) associated to the positive definite kernel K via a mapping function Φ : X 7→ H: we have K(x, x0) = hΦ(x), Φ(x0)iH. (1.2) Definition 1.2.1 (Positive definite kernel). K : X × X 7→ R is a positive definite kernel if it is symmetric, i.e ∀(x, x0) ∈ X 2, K(x, x0) = K(x0, x) and satisfies ∀N ∈ N, (x1, . . . , xN ) ∈ X N and (a1, . . . , aN ) ∈ RN : PN j=1 aiajK(xi, xj) ≥ 0. i=1 It can be shown that positive definiteness of K is equivalent to the reproducing property: PN for any function f ∈ H, we have f (x) = hf, Φ(x)iH for all x ∈ H. (1.3) In particular, it is possible to use kernel methods with linear models when the solution to the empirical risk minimization problem can be written in terms of scalar products in X between pairs of samples (x, x0). We will exploit this property to extend some results in the non-linear case in Chapter 4. Then, one only needs to replace these products by the scalar product in H, i.e by K(x, x0), thus obtaining potentially non-linear decision functions. This classical approach has been coined as the kernel trick. The kernel trick has an implication that will be exploited in the context of this thesis: it will be possible to work on non-vectorial 7 data such as graphs or strings, by replacing the scalar products by a well-chosen comparison functions between these objects. For example, in Chapter 2, we will derive an embedding for sets starting from a comparison function between two sets, which is based on the 2-Wasserstein distance between two sets of points x and x0 living respectively in Rn×d and Rn0×d. Finally, the Representer theorem states that any solution to the empirical risk minimization problem has the form: ∀x ∈ X , f (x) = n X i=1 αiK(xi, x). (1.4) Hence, f can be expressed in terms of n evaluations of the kernel K between the input and the n known samples. A famous example of kernel: the Gaussian kernel. The Gaussian kernel, or radial basis function (RBF) will often be used in the context of this thesis. For a pair of elements of X (x, x0), the Gaussian kernel with bandwidth σ is K(x, x0) = e− ||x−x0||2 2 2σ2 . (1.5) The Gaussian kernel has interesting properties: all the points in the feature space actually lie on the unit sphere since we have: K(x, x) = 1 = ||Φ(x)||2 H. (1.6) It is also possible to express the distance induced by the Gaussian kernel in the feature space in terms of distance between x and x0: dK(x, x0) = v u u t2 1 − e− ||x−x0||2 2 2σ2 ! . (1.7) Going further, it is also possible to express the distance between a set of known samples S = {x1, . . . , xn} and a new sample x: dK(x, S) = v u u tC − 2 n n X i=1 ||x−xi||2 2 2σ2 . e− (1.8) Then, given two sets S1 and S2 and a sample x, we can use this distance to know which set x belongs to, using a decision function induced by K, as shown in Figure 1.1. Kernel methods for large scale machine learning. Kernel methods enable to learn non-linear decision functions f using tools from linear optimization. But, reformulating an ERM problem including kernel comparisons for all pairs of input samples may be intractable in the context of today's large datasets, with a number of sample typically greater than 100, 000: such setting requires to compute a kernel matrix which is quadratic in the number of samples. However, in many cases, it is possible to circumvent this issue by computing a low-rank approximation of the kernel matrix which is done in Nyström's approximation described below, or using random Fourier features [Rahimi and Recht, 2007]. In the latter setting, a randomized feature map Ψ is used, such that: K(x, x0) ≈ hΨ(x), Ψ(x0)iRd. (1.9) 8 Figure 1.1: Points in red belong to S1, points in green belong to S2. Level curves for the decision function f = dK(x, S1) − dK(x, S2) are plotted. Left: σ = 1. Right: σ = 0.2 (from Jean-Philippe Vert and Julien Mairal course on Kernel Methods, 2021). For example, Rahimi and Recht [2007] show that it is possible to approximate a shift invariant kernel, i.e a kernel such that K(x, x0) is a function of x − x0, by drawing samples from the Fourier transform of K and applying a cosine transformation on these samples using x. The resulting mapping Ψ(x) is the concatenation of these transforms for each sample: Ψ(x) = r 2 D (cos(ω1x + b1), . . . , cos(ωDx + bD)) , (1.10) with ωi a sample drawn from the Fourier transform p of K, and bi uniformly sampled from [ 0, 2π] . Kernel methods for deep learning. Deep learning made kernel methods seemingly obso- lete, as it allows to learn more expressive decision functions from the data. However, kernel methods remain relevant in the context of deep learning. We now provide two instances of kernel methods used in the context of deep learning, and whose present thesis is in line with. - The RKHS norm ||f ||H acts as a natural regularization term because it controls the variations of the models prediction according to the geometry induced by Φ. Indeed, for all pairs (x, x0): |f (x) − f (x0)| ≤ ||f ||H||Φ(x) − Φ(x0)||H. Bietti and Mairal [2019] showed that it is possible to construct a multi-layer hierarchical kernel whose RKHS contains CNNs but with smooth activations instead of ReLus. Then, Bietti et al. [2019] used approximations of the corresponding RKHS norm to regularize the training of real CNNs (with ReLus activations hence not contained in the RKHS), using various upper-bounds or lower-bounds of ||f ||H as a penalty term in the empirical risk minimization objective, thus improving generalization and robustness of deep convolutional neural networks in the context of small datasets of images. For example, ||f ||H can be upper-bounded as: (1.11) ||f ||H ≤ ω(||W1||, . . . , ||WL||), with ω a function increasing in all its arguments and ||Wi|| the spectral norm of the i-th weight matrix of the network. Then, it is possible to regularize the training problem by using the sum of the spectral norms of the weight matrices as a penalty term. (1.12) 9 - It is possible to get an approximation Ψ for the kernel mapping Φ in the sense that hΨ(x), Ψ(x0)iRd ≈ hΦ(x), Φ(x0)iH [Williams and Seeger, 2001]. In fact, the resulting approximation will have a neural network-like structure, i.e alternating matrix multiplica- tions and non-linearities [Mairal, 2016]: Ψ(x) = K(Z, Z)−1/2K(Z, x), (1.13) where Z ∈ Rk×d is a set of k anchor points. K(Z, x) ∈ Rk denotes the comparison between each anchor and the current query x, and K(Z, Z) ∈ Rk×k is the Gram matrix for the anchors. By choosing a suitable kernel K depending on the data at hand, we are therefore encoding a prior in our model. As opposed to neural networks, it is possible to learn Ψ without labelled data. In a supervised context, Ψ can still be learned using back-propagation. This technique naturally lends itself to contexts where few labelled data is available. We will therefore rely on it in Chapters 2 and 3. 1.2.2 Transformers A recently proposed neural network architecture. Transformers are a kind of deep learning architecture introduced by Vaswani et al. [2017]. This architecture relies mostly on the attention mechanism introduced in the context of machine translation [Bahdanau et al., 2015]. As opposed to common neural network architectures such as fully-connected or convolutional, it takes a set of features such as the words of a sentence or patches composing an image as input, and output a label or another set of features. More precisely, transformers consist in two parts: the encoder and the decoder. The encoder takes a set of n elements X in Rn×din. It outputs another set in Rn×dout. Globally, the feature map X is updated via: The update term is obtained via the self-attention mechanism: X = X + Attention(Q, K, V ). Attention(Q, K, V ) = softmax ! QK> √ dout V ∈ Rn×dout, (1.14) with Q> = WQX > and K> = WKX > respectively the query and key matrices, V > = WV X > the value matrix. WQ, WK, WV in Rdout×din are learned projection matrices. Then, Layer Normalization [Ba et al., 2016] is applied to the output: each element of the output is normalized via statistics computed over all the hidden units in the same layer. Finally, a fully connected feed-forward neural network is applied to each element of the updated feature map X. This neural network is the same for every elements in X. Again, the feature map is updated with a residual connection. The sequence of operations forms a block which can be repeated multiple times to build a deeper transformer encoder. The decoder part of the transformer takes two inputs: the output of the encoder and another input sequence (that will be iteratively built when the transformer is used for translation for example). Here, the attention weights are computed via an attention mechanism between the encoder output sequence and the decoder input sequence. We will not further detail the decoder here since we will not make use of it in the thesis. 10 Position encoding. The sequence of operations detailed above does not take into account the position of the elements in the input set. It is said that the transformer encoder is "permutation equivariant": a permutation of two elements in the input set will simply result in the same permutation in the output set, without further change in the feature map. To circumvent this problem, positional information is added to the input elements when needed. This approach is called position encoding. Position encoding can either be learnable vectors or scalars that are added to the input elements (absolute position encoding) or at the attention mechanism level for a pair of input elements (relative position encoding). For euclidean data such as sentences and images which can be seen respectively as 1D or 2D grids, it is also possible to come up with hand-crafted coordinate systems such as in Vaswani et al. [2017]: P E(i, 2k) = sin (cid:18) P E(i, 2k + 1) = cos (cid:19) i 10002k/din i 10002k/din (cid:18) (cid:19) , (1.15) (1.16) where i is the index of the element in the set, and k the index of the dimension. Position encoding in transformers is less trivial when it comes to non-euclidean data structure such as graphs, as will be detailed in Chapter 3. Early success of transformers. Transformers can be used when one wants to deal with sets of features or sequences (by sequence, we mean a set where the order of the elements matter). Many data modalities can in fact be seen as set or sequences: sentences can be seen as a sequence of word embeddings, images can be seen as a sequence of pixels or patches, and graphs can be seen as Transformers met early success in Natural Language Processing, quickly outperforming state-of-the-art models on various benchmarks as mentioned above. Transformers recently met success in computer vision [Dosovitskiy et al., 2021] or bioinfor- matics [Rives et al., 2019]. This architecture is remarkable because it puts the paradigm "to one data modality corresponds one preferred architecture" into question 2. For example, it has been shown in the context of NLP that transformers scale better than their LSTMs counterpart as can be seen in Figure 1.2, probably due to their improved use of long contexts Kaplan et al. [2020]. LSTMs were however the de facto architecture when it came to dealing with sequences. Today, transformers are the cornerstone of most language models. Current hardware is suited to large matrix multiplications required by the transformer architecture, which enables to train bigger and bigger transformers on bigger and bigger datasets of text, or images, or even both either in the traditional setting of supervised learning, or via the more and more popular self-supervised learning. Ours minds should remain open to different models in the future, but the surprising success of this simple architecture is what motivated its study in this thesis in Chapter 2 and 3. Relevant information on the architecture will be given in these chapters. 1.3 Outline of the thesis and contributions Chapter 2 introduces an embedding inspired from optimal transport to learn on sequences of varying size such as sentences in natural language processing or proteins in bioinformatics, 2How Natural Language Processing is reshaping Machine Learning 11 Figure 1.2: Transformers scale better than LSTMs for a given, big dataset. From Kaplan et al. [2020]. with few annotated data. It can be learned with or without supervision and be used alone or as a global pooling mechanisms within deep architectures. Finally, our embedding has strong links with attention and transformers and can actually be seen as one of the first versions of linearised attention. Chapter 3 builds on the idea of global adaptive pooling introduced in Chapter 2 and introduces one of the first transformers for learning on graphs, GraphiT. Transformers have an interesting inductive bias when it comes to graph but cannot take their structure, a crucial piece of information, into account. We overcome this limitation by introducing two mechanisms for incorporating the structure of a graph into the transformers architecture. GraphiT is able to outperform popular Graph Neural Networks, which are the current de facto architecture for learning on graphs, on datasets of various sizes. GraphiT also demonstrates promising visualization capabilities that could be helpful for scientific applications where interpretation is important, for example in chemo-informatics as molecules can be seen as graphs. Chapter 4 still seeks to learn with few samples while moving away from deep learning, and focuses instead on models that can be learned by solving a convex training problem. More precisely, we explore the problem of safe sample screening, where one wants to delete as many useless samples as possible from the dataset before training a model, without modifying the optimal solution. This is an important task in domains where there is a large amount of trivial observations that are useless for learning. We introduce general rules working for non strongly convex problems as well as a new regularization mechanism to design regression or classification losses allowing for safe screening. 12 This manuscript is based on the following material: - A. Bietti*, G. Mialon*, D. Chen, J. Mairal. "A Kernel Perspective for Regularizing Deep Neural Networks" (ICML, 2019). - G. Mialon, A. d'Aspremont, J. Mairal. "Screening Data Points in Empirical Risk Minimization via Ellipsoidal Regions and Safe Loss Functions" (AISTATS, 2020). - G. Mialon*, D. Chen*, A. d'Aspremont, J. Mairal. "A Trainable Optimal Transport Embedding for Feature Aggregation and its Relationship to Attention" (ICLR, 2021). - G. Mialon*, D. Chen*, M. Selosse*, J. Mairal. "GraphiT: Encoding Graph Structure in Transformers" (preprint arXiv:2106.05667). 13 Chapter 2 Embedding Sets of Features with Optimal Transport Kernels This chapter tackles the problem of learning on sets of features, motivated by the need of performing pooling operations in long biological sequences of varying sizes, with long-range dependencies, and possibly few labeled data. To address this challenging task, we introduce a parametrized representation of fixed size, which embeds and then aggregates elements from a given input set according to the optimal transport plan between the set and a trainable reference. Our approach scales to large datasets and allows end-to-end training of the reference, while also providing a simple unsupervised learning mechanism with small computational cost. Our aggregation technique admits two useful interpretations: it may be seen as a mechanism related to attention layers in neural networks, or it may be seen as a scalable surrogate of a classical optimal transport-based kernel. We experimentally demonstrate the effectiveness of our approach on biological sequences, achieving state-of-the-art results for protein fold recognition and detection of chromatin profiles tasks, and, as a proof of concept, we show promising results for processing natural language sequences. We provide an open-source implementation of our embedding that can be used alone or as a module in larger learning models at https://github.com/claying/OTK. This chapter is based on the following material: - G. Mialon*, D. Chen*, A. d'Aspremont, J. Mairal. "A Trainable Optimal Transport Embedding for Feature Aggregation and its Relationship to Attention" (ICLR, 2021). 2.1 Introduction Many scientific fields such as bioinformatics or natural language processing (NLP) require processing sets of features with positional information (biological sequences such as in Figure 2.1, or sentences represented by a set of local features). These objects are delicate to manipulate due to varying lengths and potentially long-range dependencies between their elements. For 14 CUU GAC AAA GUU GAG GCU GAA GUG CAA AUU GAU AGG UUG AUC ACA GGC L D K V E A E V Q I D R L I T G Figure 2.1: Short part of mRNA sequence for the SARS-Cov-2 spike protein, lying at the surface of the virus. The spike protein is an important part of the infection mechanism and the target of potential treatments. Each triplet codes for an amino acid, represented below. many tasks, the difficulty is even greater since the sets can be arbitrarily large, or only provided with few labels, or both. Deep learning architectures specifically designed for sets have recently been proposed [Lee et al., 2019, Skianis et al., 2020]. Our experiments show that these architectures perform well for NLP tasks, but achieve mixed performance for long biological sequences of varying size with few labeled data. Some of these models use attention [Bahdanau et al., 2015], a classical mechanism for aggregating features. Its typical implementation is the transformer [Vaswani et al., 2017], which has shown to achieve state-of-the-art results for many sequence modeling tasks, e.g, in NLP [Devlin et al., 2019] or in bioinformatics [Rives et al., 2019], when trained with self supervision on large-scale data. Beyond sequence modeling, we are interested in this chapter in finding a good representation for sets of features of potentially diverse sizes, with or without positional information, when the amount of training data may be scarce. To this end, we introduce a trainable embedding, which can operate directly on the feature set or be combined with existing deep approaches. More precisely, our embedding marries ideas from optimal transport (OT) theory [Peyré and Cuturi, 2019] and kernel methods [Schölkopf and Smola, 2001]. We call this embedding OTKE (Optimal Transport Kernel Embedding). Concretely, we embed feature vectors of a given set to a reproducing kernel Hilbert space (RKHS) and then perform a weighted pooling operation, with weights given by the transport plan between the set and a trainable reference. To gain scalability, we then obtain a finite-dimensional embedding by using kernel approximation techniques [Williams and Seeger, 2001]. The motivation for using kernels is to provide a non-linear transformation of the input features before pooling, whereas optimal transport allows to align the features on a trainable reference with fast algorithms [Cuturi, 2013]. Such combination provides us with a theoretically grounded, fixed-size embedding that can be learned either without any label, or with supervision. Our embedding can indeed become adaptive to the problem at hand, by optimizing the reference with respect to a given task. It can operate on large sets with varying size, model long-range dependencies when positional information is present, and scales gracefully to large datasets. We demonstrate its effectiveness on biological sequence classification tasks, including protein fold recognition and detection of chromatin profiles where we achieve state-of-the-art results. We also show promising results in natural language processing tasks, where our method outperforms strong baselines. Contributions. In summary, our contribution is three-fold. - We propose a new method to embed sets of features of varying sizes to fixed size representations that are well adapted to downstream machine learning tasks, and whose parameters can be learned in either unsupervised or supervised fashion. - We demonstrate the scalability and effectiveness of our approach on biological and natural language sequences. 15 - We provide an open-source implementation of our embedding that can be used alone or as a module in larger learning models. 2.2 Related Work Kernel methods for sets and OT-based kernels. The kernel associated with our embed- ding belongs to the family of match kernels [Lyu, 2004, Tolias et al., 2013], which compare all pairs of features between two sets via a similarity function. Another line of research builds kernels by matching features through the Wasserstein distance. A few of them are shown to be positive definite [Gardner et al., 2018] and/or fast to compute [Rabin et al., 2011, Kolouri et al., 2016]. Except for few hyper-parameters, these kernels yet cannot be trained end-to-end, as opposed to our embedding that relies on a trainable reference. Efficient and trainable kernel embeddings for biological sequences have also been proposed by Chen et al. [2019a,b]. Our work can be seen as an extension of these earlier approaches by using optimal transport rather than mean pooling for aggregating local features, which performs significantly better for long sequences in practice. Deep learning for sets. Deep Sets [Zaheer et al., 2017] feed each element of an input set into a feed-forward neural network. The outputs are aggregated following a simple pooling operation before further processing. Lee et al. [2019] propose a Transformer inspired encoder- decoder architecture for sets which also uses latent variables. Skianis et al. [2020] compute some comparison costs between an input set and reference sets. These costs are then used as features in a subsequent neural network. The reference sets are learned end-to-end. Unlike our approach, such models do not allow unsupervised learning. We will use the last two approaches as baselines in our experiments. Interpretations of attention. Using the transport plan as an ad hoc attention score was proposed by Chen et al. [2019c] in the context of network embedding to align data modalities. Our work goes beyond and uses the transport plan as a principle for pooling a set in a model, with trainable parameters. Tsai et al. [2019] provide a view of Transformer's attention via kernel methods, yet in a very different fashion where attention is cast as kernel smoothing and not as a kernel embedding. 2.3 Proposed Embedding 2.3.1 Preliminaries We handle sets of features in Rd and consider sets x living in X = n x | x = {x1, . . . , xn} such that x1, . . . , xn ∈ Rd for some n ≥ 1o . Elements of X are typically vector representations of local data structures, such as k-mers for sequences, patches for natural images, or words for sentences. The size of x denoted by n may vary, which is not an issue since the methods we introduce may take a sequence of any size as input, while providing a fixed-size embedding. We now revisit important results on optimal transport and kernel methods, which will be useful to describe our embedding and its computation algorithms. 16 Figure 2.2: Discrete optimal transport consists in finding the transport plan (between points with masses) minimizing a given transportation cost based on the distance between the masses, from the red ones to the blue ones. Here, all masses are identical except the biggest, which is twice the others. Optimal transport. Our pooling mechanism will be based on the transport plan between x and x0 seen as weighted point clouds or discrete measures, which is a by-product of the optimal transport problem [Villani, 2008, Peyré and Cuturi, 2019]. OT has indeed been widely used in alignment problems [Grave et al., 2019]. Throughout the chapter, we will refer to the Kantorovich relaxation of OT with entropic regularization, detailed for example in [Peyré and Cuturi, 2019]. Let a in ∆n (probability simplex) and b in ∆n0 be the weights of the discrete measures P with respective locations x and x0, where δx is the Dirac at position x. Let C in Rn×n0 be a matrix representing the pairwise costs for aligning the elements of x and x0. The entropic regularized Kantorovich relaxation of OT from x to x0 is j bjδx0 and P i aiδxi j min P∈U (a,b) X ij CijPij − εH(P), (2.1) where H(P) = − P controls the sparsity of P, and U is the space of admissible couplings between a and b: ij Pij(log(Pij) − 1) is the entropic regularization with parameter ε, which U (a, b) = {P ∈ Rn×n0 + : P1n = a and P>1n0 = b}. The problem is typically solved by using a matrix scaling procedure known as Sinkhorn's algorithm [Sinkhorn and Knopp, 1967, Cuturi, 2013]. In practice, a and b are uniform measures since we consider the mass to be evenly distributed between the points. P is called the transport plan, which carries the information on how to distribute the mass of x in x0 with minimal cost. A simple representation of the problem can be seen in Figure 2.2. Our method uses optimal transport to align features of a given set to a learned reference. Sinkhorn's Algorithm: Fast Computation of Pκ(x, z). Without loss of generality, we consider here κ the linear kernel. We recall that Pκ(x, z) is the solution of an optimal transport problem, which can be efficiently solved by Sinkhorn's algorithm [Peyré and Cuturi, 2019] involving matrix multiplications only. Specifically, Sinkhorn's algorithm is an iterative matrix scaling method that takes the opposite of the pairwise similarity matrix K with entry Kij := hxi, zji as input C and outputs the optimal transport plan Pκ(x, z) = Sinkhorn(K, ε). 17 Each iteration step ' performs the following updates u('+1) = 1/n Ev(') and v('+1) = 1/p E>u(') , (2.2) where E = eK/ε. Then the matrix diag(u('))Ediag(v(')) converges to Pκ(x, z) when ' tends to ∞. However when ε becomes too small, some of the elements of a matrix product Ev or E>u become null and result in a division by 0. To overcome this numerical stability issue, computing the multipliers u and v is preferred (see e.g. [Peyré and Cuturi, 2019, Remark 4.23]). This algorithm can be easily adapted to a batch of data points x, and with possibly varying lengths via a mask vector masking on the padding positions of each data point x, leading to GPU-friendly computation. More importantly, all the operations above at each step are differentiable, which enables z to be optimized through back-propagation. Consequently, this module can be injected into any deep networks. Kernel methods. Kernel methods [Schölkopf and Smola, 2001] map data living in a space X to a reproducing kernel Hilbert space H, associated to a positive definite kernel K through a mapping function φ : X → H, such that K(x, x0) = hφ(x), φ(x0)iH. Even though φ(x) may be infinite-dimensional, classical kernel approximation techniques [Williams and Seeger, 2001] provide finite-dimensional embeddings ψ(x) in Rk such that K(x, x0) ≈ hψ(x), ψ(x0)i. Our embedding for sets relies in part on kernel method principles and on such a finite-dimensional approximation. Attention and transformers. We clarify the concept of attention - a mechanism yielding a context-dependent embedding for each element of x - as a special case of non-local opera- tions [Wang et al., 2017, Buades et al., 2011], so that it is easier to understand its relationship to the OTK. Let us assume we are given a set x ∈ X of length n. A non-local operation on x is a function Φ : X 7→ X such that Φ(x)i = n X j=1 w(xi, xj)v(xj) = W(x)> i V(x), where W(x)i denotes the i-th column of W(x), a weighting function, and V(x) corresponds to [v(x1), . . . , v(xn)]>, an embedding. In contrast to operations on local neighborhood such as convolutions, non-local operations theoretically account for long range dependencies between elements in the set. In attention and the context of neural networks, w is a learned function reflecting the relevance of each other elements xj with respect to the element xi being embedded and given the task at hand. In the context of the chapter, we compare to a type of attention coined as dot-product self-attention, which can typically be found in the encoder part of the transformer architecture [Vaswani et al., 2017]. Transformers are neural network models relying mostly on a succession of an attention layer followed by a fully-connected layer. Transformers can be used in sequence-to-sequence tasks - in this setting, they have an encoder with self- attention and a decoder part with a variant of self-attention -, or in sequence to label tasks, with only the encoder part. The chapter deals with the latter. The name self-attention means that the attention is computed using a dot-product of linear transformations of xi and xj, and x attends to itself only. In its matrix formulation, dot-product self-attention is a non-local operation whose matching vector is W(x)i = Softmax WQxix>W > K √ dk ! , 18 where WQ ∈ Rn×dk and WK ∈ Rn×dk are learned by the network. In order to know which xj are relevant to xi, the network computes scores between a query for xi (WQxi) and keys of all the elements of x (WKx). The softmax turns the scores into a weight vector in the simplex. Moreover, a linear mapping V(x) = WV x, the values, is also learned. WQ and WK are often shared [Kitaev et al., 2020]. A drawback of such attention is that for a sequence of length n, the model has to store an attention matrix W with size O(n2). More details can be found in Vaswani et al. [2017]. 2.3.2 Optimal Transport Embedding and Associated Kernel We now present the OTKE, an embedding and pooling layer which aggregates a variable-size set or sequence of features into a fixed-size embedding. We start with an infinite-dimensional variant living in a RKHS, before introducing the finite-dimensional embedding that we use in practice. Infinite-dimensional embedding in RKHS. Given a set x and a (learned) reference z in X with p elements, we consider an embedding Φz(x) which performs the following operations: (i) initial embedding of the elements of x and z to a RKHS H; (ii) alignment of the elements of x to the elements of z via optimal transport; (iii) weighted linear pooling of the elements x into p bins, producing an embedding Φz(x) in Hp, which is illustrated in Figure 2.3. Before introducing more formal details, we note that our embedding relies on two main ideas: - Global similarity-based pooling using references. Learning on large sets with long-range interactions may benefit from pooling to reduce the number of feature vectors. Our pooling rule follows an inductive bias akin to that of self-attention: elements that are relevant to each other for the task at hand should be pooled together. To this end, each element in the reference set corresponds to a pooling cell, where the elements of the input set are aggregated through a weighted sum. The weights simply reflect the similarity between the vectors of the input set and the current vector in the reference. Importantly, using a reference set enables to reduce the size of the "attention matrix" from quadratic to linear in the length of the input sequence. - Computing similarity weights via optimal transport. A computationally efficient similarity score between two elements is their dot-product [Vaswani et al., 2017]. In this chapter, we rather consider that elements of the input set should be pooled together if they align well with the same part of the reference. Alignment scores can efficiently be obtained by computing the transport plan between the input and the reference sets: Sinkhorn's algorithm indeed enjoys fast solvers [Cuturi, 2013]. We are now in shape to give a formal definition. Definition 2.3.1 (The optimal transport kernel embedding). Let x = (x1, . . . , xn) in X be an input set of feature vectors and z = (z1, . . . , zp) in X be a reference set with p elements. Let κ be a positive definite kernel, e.g., Gaussian kernel, with RKHS H and φ : Rd → H, its associated kernel embedding. Let κ be the n × p matrix which carries the comparisons κ(xi, zj), before alignment. 19 Then, the transport plan between x and z, denoted by the n × p matrix P(x, z), is defined as the unique solution of (2.1) when choosing the cost C = −κ, and our embedding is defined as Φz(x) := √ p × n X i=1 P(x, z)i1φ(xi), . . . , n X i=1 P(x, z)ipφ(xi) ! = √ p × P(x, z)>φ(x), where φ(x) := [φ(x1), . . . , φ(xn)]>. Interestingly, it is easy to show that our embedding Φz(x) is associated to the positive definite kernel Kz(x, x0) := n X i,i0=1 Pz(x, x0)ii0κ(xi, x0 i0) = hΦz(x), Φz(x0)i, (2.3) with Pz(x, x0) := p × P(x, z)P(x0, z)>. This is a weighted match kernel, with weights given by optimal transport in H. The notion of pooling in the RKHS H of κ arises naturally if p ≤ n. The elements of x are non-linearly embedded and then aggregated in "buckets", one for each element in the reference z, given the values of P(x, z). This process is illustrated in Figure 2.3. We acknowledge here the concurrent work by Kolouri et al. [2021], where a similar embedding is used for graph representation. We now expose the benefits of this kernel formulation, and its relation to classical non-positive definite kernel. Kernel interpretation. Thanks to the gluing lemma [see, e.g., Peyré and Cuturi, 2019], Pz(x, x0) is a valid transport plan and, empirically, a rough approximation of P(x, x0). Kz can therefore be seen as a surrogate of a well-known kernel [Rubner et al., 2000], defined as KOT(x, x0) := n X i,i0=1 P(x, x0) ii0κ(xi, x0 i0). (2.4) When the entropic regularization ε is equal to 0, KOT is equivalent to the 2-Wasserstein distance W2(x, x0) with ground metric dκ induced by kernel κ. KOT is generally not positive definite (see Peyré and Cuturi [2019], Chapter 8.3) and computationally costly (the number of transport plans to compute is quadratic in the number of sets to process whereas it is linear for Kz). Now, we show the relationship between this kernel and our kernel Kz, which is proved in Appendix 2.7.1. Lemma 2.3.2 (Relation between P(x, x0) and Pz(x, x0) when ε = 0). For any x, x0 and z in X with lengths n, n0 and p, by denoting W z 2 (x, x0) := hPz(x, x0), d2 κ (x, x0)i1/2 we have |W2(x, x0) − W z 2 (x, x0)| ≤ 2 min(W2(x, z), W2(x0, z)). (2.5) This lemma shows that the distance W z 2 resulting from Kz is related to the Wasserstein distance W2; yet, this relation should not be interpreted as an approximation error as our goal is not to approximate W2, but rather to derive a trainable embedding Φz(x) with good computational properties. Lemma 2.3.2 roots our features and to some extent self-attention in a rich optimal transport literature. In fact, W z is equivalent to a distance introduced by Wang 2 et al. [2013b], whose properties are further studied by Moosmüller and Cloninger [2020]. A major difference is that W z crucially relies on Sinkhorn's algorithm so that the references can 2 be learned end-to-end, as explained below. 20 Figure 2.3: The input point cloud x is transported onto the reference z = (z1, . . . , zp) (top), yielding the optimal transport plan Pκ(x, z) used to aggregate the embedded features and form Φz(x) (bottom). 21 x1x2xnz1zpP11P2pPn1φ(x1)φ(x2)...φ(xn)Φz(x)1...Φz(x)pP11Pn1P2p 2.3.3 From infinite-dimensional kernel embedding to finite dimension In some cases, φ(x) is already finite-dimensional, which allows to compute the embedding Φz(x) explicitly. This is particularly useful when dealing with large-scale data, as it enables us to use our method for supervised learning tasks without computing the Gram matrix, which grows quadratically in size with the number of samples. When φ is infinite or high-dimensional, it is nevertheless possible to use an approximation based on the Nyström method [Williams and Seeger, 2001], which provides an embedding ψ : Rd → Rk such that hψ(xi), ψ(x0 j )iRk ≈ κ(xi, x0 j ). Concretely, the Nyström method consists in projecting points from the RKHS H onto a linear subspace F, which is parametrized by k anchor points F = Span(φ(w1), . . . , φ(wk)). The corresponding embedding admits an explicit form ψ(xi) = κ(w, w)−1/2κ(w, xi), where κ(w, w) is the k × k Gram matrix of κ computed on the set w = {w1, . . . , wk} of anchor points and κ(w, xi) is in Rk. Then, there are several ways to learn the anchor points: (a) they can be chosen as random points from data; (b) they can be defined as centroids obtained by K-means, see Zhang et al. [2008]; (c) they can be learned by back-propagation for a supervised task, see Mairal [2016]. Using such an approximation within our framework can be simply achieved by (i) replacing κ by a linear kernel and (ii) replacing each element xi by its embedding ψ(xi) in Rk and considering a reference set with elements in Rk. By abuse of notation, we still use z for the new parametrization. The embedding, which we use in practice in all our experiments, becomes simply Φz(x) = √ = √ p × n X i=1 P(ψ(x), z)i1ψ(xi), . . . , P(ψ(x), z)ipψ(xi) ! n X i=1 p × P(ψ(x), z)>ψ(x) ∈ Rp×k, (2.6) where p is the number of elements in z. Next, we discuss how to learn the reference set z. 2.3.4 Unsupervised and Supervised Learning of Parameter z In the fashion of the Nyström approximation, the p elements of z Unsupervised learning. can be defined as the centroids obtained by K-means applied to all features from training sets in X . A corollary of Lemma 2.3.2 suggests another algorithm: a bound on the deviation term between W2 and W z 2 for m samples (x1, . . . , xm) is indeed E 2 := 1 m2 m X i,j=1 |W2(xi, xj) − W z 2 (xi, xj)|2 ≤ 4 m X m i=1 W 2 2 (xi, z). (2.7) The right-hand term corresponds to the objective of the Wasserstein barycenter problem [Cuturi and Doucet, 2013], which yields the mean of a set of empirical measures (here the x's) under the OT metric. The Wasserstein barycenter is therefore an attractive candidate for choosing z. K-means can be seen as a particular case of Wasserstein barycenter when m = 1 [Cuturi and Doucet, 2013, Ho et al., 2017] and is faster to compute. In practice, both methods yield similar results, see Appendix 2.8, and we thus chose K-means to learn z in unsupervised settings throughout the experiments. The anchor points w and the references z may be then computed 22 using similar algorithms; however, their mathematical interpretation differs as exposed above. The task of representing features (learning w in Rd for a specific κ) is decoupled from the task of aggregating (learning the reference z in Rk). Supervised learning. As mentioned in Section 2.3.1, P(ψ(x), z) is computed using Sinkhorn's algorithm, recalled in introduction, which can be easily adapted to batches of samples x, with possibly varying lengths, leading to GPU-friendly forward computations of the embedding Φz. More important, all Sinkhorn's operations are differentiable, which enables z to be optimized with stochastic gradient descent through back-propagation [Genevay et al., 2018], e.g., for minimizing a classification or regression loss function when labels are available. In practice, a small number of Sinkhorn iterations (e.g., 10) is sufficient to compute P(ψ(x), z). Since the anchors w in the embedding layer below can also be learned end-to-end [Mairal, 2016], our embedding can thus be used as a module injected into any model, e.g, a deep network, as demonstrated in our experiments. 2.3.5 Extensions Integrating positional information into the embedding. The discussed embedding and kernel do not take the position of the features into account, which may be problematic when dealing with structured data such as images or sentences. To this end, we borrow the idea of convolutional kernel networks, or CKN [Mairal, 2016, Mairal et al., 2014], and penalize the similarities exponentially with the positional distance between a pair of elements in the input and reference sequences. More precisely, we multiply P(ψ(x), z) element-wise by a distance matrix S defined as: Sij = e − 1 σ2 pos (i/n−j/p)2 , and replace it in the embedding. With similarity weights based both on content and position, the kernel associated to our embedding can be viewed as a generalization of the CKNs (whose similarity weights are based on position only), with feature alignment based on optimal transport. When dealing with multi-dimensional objects such as images, we just replace the index scalar i with an index vector of the same spatial dimension as the object, representing the positions of each dimension. Using multiple references. A naive reconstruction using different references z1, . . . , zq in X may yield a better approximation of the transport plan. In this case, the embedding of x becomes Φz1,...,zq (x) = 1/√ q (Φz1(x), . . . , Φzq (x)) , (2.8) with q the number of references (the factor 1/√ q comes from the mean). Using Eq. (2.5), we can obtain a bound similar to (2.7) for a data set of m samples (x1, . . . , xm) and q references (see Appendix 2.7.2 for details). To choose multiple references, we tried a K-means algorithm with 2-Wasserstein distance for assigning clusters, and we updated the centroids as in the single-reference case. Using multiple references appears to be useful when optimizing z with supervision (see Appendix 2.8). 23 Table 2.1: Relationship between Φz and transformer self-attention. k: a function describing how the transformer integrates positional information; n: sequence length; q: number of references or attention heads; d: dimension of the embeddings; p: number of supports in z. Typically, p (cid:28) d. In recent transformer architectures, positional encoding requires learning additional parameters (∼ qd2). Self-Attention Φz Attention score Size of score Alignment w.r.t: Learned + Shared Nonlinear mapping W = W >Q O(n2) x itself W and Q Feed-forward Position encoding Nb. parameters Supervision k(ti, t0 j) ∼ qd2 Needed P O(np) z z φ or ψ n − j ( i − 1 σ2 e pos n0 )2 qpd Not needed 2.4 Relation between our Embedding and Self-Attention Our embedding and a single layer of transformer encoder, recalled in introduction, share the same type of inductive bias, i.e, aggregating features relying on similarity weights. We now clarify their relationship. Our embedding is arguably simpler (see respectively size of attention and number of parameters in Table 2.1), and may compete in some settings with the transformer self-attention as illustrated in Section 2.5. Shared reference versus self-attention. There is a correspondence between the values, attention matrix in the transformer and φ, P in Definition 2.3.1, yet also noticeable differences. On the one hand, Φz aligns a given sequence x with respect to a reference z, learned with or without supervision, and shared across the data set. Our weights are computed using optimal transport. On the other hand, a transformer encoder performs self-alignment: for a given xi, features are aggregated depending on a similarity score between xi and the elements of x only. The similarity score is a matrix product between queries Q and keys K matrices, learned with supervision and shared across the data set. In this regard, our work complements a recent line of research questioning the dot-product, learned self-attention [Raganato et al., 2020, Weiqiu et al., 2020]. Self-attention-like weights can also be obtained with our embedding by computing P(x, zi)P(x, zi)> for each reference i. In that sense, our work is related to recent research on efficient self-attention [Wang et al., 2020, Choromanski et al., 2020], where a low-rank approximation of the self-attention matrix is computed. Position smoothing and relative positional encoding. Transformers can add an abso- lute positional encoding to the input features [Vaswani et al., 2017]. Yet, relative positional encoding [Dai et al., 2019] is a current standard for integrating positional information: the position offset between the query element and a given key can be injected in the attention score [Tsai et al., 2019], which is equivalent to our approach. The link between CKNs and our kernel, provided by this positional encoding, stands in line with recent works casting attention and convolution into a unified framework [Andreoli, 2019]. In particular, Cordonnier et al. 24 [2020] show that attention learns convolution in the setting of image classification: the kernel pattern is learned at the same time as the filters. In the transformer architecture, the succession Multiple references and attention heads. of blocks composed of an attention layer followed by a fully-connected layer is called a head, with each head potentially focusing on different parts of the input. Successful architectures have a few heads in parallel. The outputs of the heads are then aggregated to output a final embedding. A layer of our embedding with non-linear kernel κ can be seen as such a block, with the references playing the role of the heads. As some recent works question the role of attention heads [Voita et al., 2019, Michel et al., 2019], exploring the content of our learned references z may provide another perspective on this question. More generally, visualization and interpretation of the learned references could be of interest for biological sequences. [Mialon et al., 2021a] was proposed at the same time as a line of Efficient transformers. work coined as "efficient transformers". These works sought to improve transformers both in terms of memory and computational cost [Beltagy et al., 2020, Kitaev et al., 2020]. We refer the reader to the following survey [Tay et al., 2020]. Although our work does not aim at challenging transformers since we are rather interested in data constrained settings, it is interesting to note that OTKE fits in different families of the taxonomy proposed by Tay et al. [2020]: anchors z can be seen as a memory and P(x, zi) as a factorized approximation of an attention matrix. 2.5 Experiments We now show the effectiveness of our embedding OTKE in tasks where samples can be expressed as large sets with potentially few labels, such as in bioinformatics. We evaluate our embedding alone in unsupervised or supervised settings, or within a model in the supervised setting. We also consider NLP tasks involving shorter sequences and relatively more labels. Note that experiments in bioinformatics (SCOP1.75 and DeepSEA) were conducted by Dexiong Chen in the context of Mialon et al. [2021a] and already presented in Dexiong Chen's PhD thesis [Chen, 2020]. Hence, they are not a contribution of the present thesis. However, as these supplementary experiments provide insightful results and discussion, we kept it in the main manuscript for completeness. 2.5.1 Datasets, Experimental Setup and Baselines In unsupervised settings, we train a linear classifier with the cross entropy loss between true labels and predictions on top of the features provided by our embedding (where the references z and Nyström anchors w have been learned without supervision), or an unsupervised baseline. In supervised settings, the same model is initialized with our unsupervised method and then trained end-to-end (including z and w) by minimizing the same loss. We use an alternating optimization strategy to update the parameters for both SCOP and SST datasets, as used by Chen et al. [2019a,b]. We train for 100 epochs with Adam on both data sets: the initial learning rate is 0.01, and get halved as long as there is no decrease in the validation loss for 5 epochs. The hyper-parameters we tuned include number of supports and references p, q, 25 Table 2.2: Classification accuracies for 5000 samples of CIFAR-10 using CKN features [Mairal, 2016] and forming Gram matrix. A random baseline would yield 10%. Dataset Kernel Mean Pooling Flatten Sliced-Wasserstein [Kolouri et al., 2016] Sliced-Wasserstein [Kolouri et al., 2016] + sin. pos enc. [Devlin et al., 2019] KOT KOT + our pos enc. Kz Kz + our pos enc. (3 × 3), 256 Accuracy Runtime 58.5 67.6 63.8 66.0 64.5 67.1 67.9 70.2 ∼ 30 sec ∼ 30 sec ∼ 2 min ∼ 2 min ∼ 20 min ∼ 20 min ∼ 30 sec ∼ 30 sec entropic regularization in OT ε, the bandwidth of Gaussian kernels and the regularization parameter of the linear classifier. The best values of ε and the bandwidth were found stable across tasks, while the regularization parameter needed to be more carefully cross-validated. Additional results and implementation details can be found in Appendix 2.8. Experiments on Kernel Matrices (only for small data sets). Here, we compare the optimal transport kernel KOT (2.4) and its surrogate Kz (2.3) (with z learned without super- vision) to common and other OT kernels. Although our embedding Φz is scalable, the exact kernel require the computation of Gram matrices. For this toy experiment, we therefore use 5000 samples only of CIFAR-10 (images with 32 × 32 pixels), encoded without supervision using a two-layer convolutional kernel network [Mairal, 2016]. The resulting features are 3 × 3 patches living in Rd with d = 256 or 8192. KOT and Kz aggregate existing features depending on the ground cost defined by −κ (Gaussian kernel) given the computed weight matrix P. In that sense, we can say that these kernels work as an adaptive pooling. We therefore compare it to kernel matrices corresponding to mean pooling and no pooling at all (linear kernel). We also compare to a recent positive definite and fast optimal transport based kernel, the Sliced Wasserstein Kernel [Kolouri et al., 2016] with 10, 100 and 1000 projection directions. We add a positional encoding to it so as to have a fair comparison with our kernels. A linear classifier is trained from this matrices. Although we cannot prove that KOT is positive definite, the classifier trained on the kernel matrix converges when ε is not too small. The results can be seen on Table 2.2. Without positional information, our kernels do better than Mean pooling. When the positions are encoded, the Linear kernel is also outperformed. Note that including positions in Mean pooling and Linear kernel means interpolating between these two kernels: in the Linear kernel, only patches with same index are compared while in the Mean pooling, all patches are compared. All interpolations did worse than the Linear kernel. The runtimes illustrate the scalability of Kz. CIFAR-10. Here, we test our embedding on the same data modality: we use CIFAR-10 features, i.e., 60, 000 images with 32 × 32 pixels and 10 classes encoded using a two-layer CKN [Mairal, 2016], one of the baseline architectures for unsupervised learning of CIFAR-10, and evaluate on the standard test set. The very best configuration of the CKN yields a small 26 Table 2.3: Hyperparameter search range for CIFAR-10 Hyperparameter Search range Entropic regularization ε Position encoding bandwidth σpos [1.0; 0.1; 0.01; 0.001] [0.5; 0.6; 0.7; 0.8; 0.9; 1.0] Table 2.4: Classification results using unsupervised representations for CIFAR-10 for two feature configurations (extracted from a 2-layer unsupervised CKN with different number of filters). We consider here our embedding with one reference and different number of supports, learned with K-means, with or without position encoding (PE). Method Nb. supports Flatten Mean pooling Gaussian pooling [Mairal, 2016] 16 × 16 × 256 73.1 64.9 77.5 16 × 16 × 1024 76.1 73.4 82.0 Ours Ours (with PE) Ours Ours (with PE) Ours Ours (with PE) 9 64 144 75.6 78.0 77.9 81.4 78.4 81.8 79.3 82.2 80.1 83.2 80.7 83.4 number (3 × 3) of high-dimensional (16, 384) patches and an accuracy of 85.8%. We will illustrate our embedding on a configuration which performs slightly less but provides more patches (16 × 16), a setting for which it was designed. The input of our embedding are unsupervised features extracted from a 2-layer CKN with kernel sizes equal to 3 and 3, and Gaussian pooling size equal to 2 and 1. We consider the following configurations of the number of filters at each layer, to simulate two different input dimensions for our embedding: • 64 filters at first and 256 at second layer, which yields a 16 × 16 × 256 representation for each image. • 256 filters at first and 1024 at second layer, which yields a 16 × 16 × 1024 representation for each image. Since the features are the output of a Gaussian embedding, κ in our embedding will be the linear kernel. The embedding is learned with one reference and various supports using K-means method described in Section 2.3, and compared to several classical pooling baselines, including the original CKN's Gaussian pooling with pooling size equal to 6. The hyper-parameters are the entropic regularization ε and bandwidth for position encoding σpos. Their search grids are shown in Table 2.3 and the results in Table 2.4. Without supervision, the adaptive pooling of the CKN features by our embedding notably improves their performance. We notice that the position encoding is very important to this task, which substantially improves the performance of its counterpart without it. Sentiment analysis on Stanford Sentiment Treebank. SST-2 [Socher et al., 2013] belongs to the NLP GLUE benchmark [Wang et al., 2019] and consists in predicting whether a 27 Table 2.5: Classification accuracies for SST-2 reported on standard validation set, averaged from 10 different runs (q references × p supports). Method Unsupervised Supervised [CLS] embedding [Devlin et al., 2019] Mean Pooling of BERT features [Devlin et al., 2019] Approximate Rep the Set [Skianis et al., 2020] Rep the Set [Skianis et al., 2020] Set Transformer [Lee et al., 2019] 84.6±0.3 85.3±0.4 Not available. Not available. Not available. Ours (dot-product instead of OT) Ours (Unsupervised: 1 × 300. Supervised: 4 × 30) 85.7±0.9 86.8±0.3 90.3±0.1 90.8±0.1 86.8±0.9 87.1±0.5 87.9±0.8 86.9±1.1 88.1±0.8 movie review is positive. The dataset contains 70, 042 reviews. The test predictions need to be submitted on the GLUE leaderboard, so that we remove a portion of the training set for validation purpose and report accuracies on the actual validation set used as a test set. Our model is one layer of our embedding with φ a Gaussian kernel mapping with 64 Nyström filters in the supervised setting, and a linear mapping in the unsupervised setting. The features used in our model and all baselines are word vectors with dimension 768 provided by the HuggingFace implementation [Wolf et al., 2019] of the pre-trained transformer model BERT [Devlin et al., 2019]. State-of-the-art accuracies are usually obtained after supervised fine-tuning of pre-trained transformers. Training a linear model on pre-trained features after simple pooling (e.g, mean) also yields good results. [CLS], which denotes the BERT embedding used for classification, is also a common baseline. The results are shown in Table 2.5. Additional experiments: Protein fold classification on SCOP 1.75. We follow the protocol described by Hou et al. [2019] for this important task in bioinformatics. The dataset contains 19, 245 sequences from 1, 195 different classes of fold (hence less than 20 labels in average per class). The sequence lengths vary from tens to thousands. Each element of a sequence is a 45-dimensional vector. The objective is to classify the sequences to fold classes, which corresponds to a multiclass classification problem. The features fed to the linear classifier are the output of our embedding with φ the Gaussian kernel mapping on k-mers (subsequences of length k) with k fixed to be 10, which is known to perform well in this task [Chen et al., 2019a]. The number of anchor points for Nyström method is fixed to 1024 and 512 respectively for unsupervised and supervised setting. In the unsupervised setting, we compare our method to state-of-the-art unsupervised method for this task: CKN [Chen et al., 2019a], which performs a global mean pooling in contrast to the global adaptive pooling performed by our embedding. In the supervised setting, we compare the same model to the following supervised models: CKN, Recurrent Kernel Networks (RKN) [Chen et al., 2019b], a CNN with 10 convolutional layers named DeepSF [Hou et al., 2019], Rep the Set [Skianis et al., 2020] and Set Transformer [Lee et al., 2019], using the public implementations by their authors. Rep the Set and Set Transformer are used on the top of a convolutional layer of the same filter size as CKN to extract k-mer features. Their model hyper-parameters, weight decay and learning rate are tuned in the same way as for our models (see Appendix for details). The default architecture of Set Transformer did not perform well due to overfitting. We thus used a shallower architecture with one Induced Set Attention Block (ISAB), one Pooling by Multihead Attention (PMA) and one linear layer, similar to the one-layer architectures of CKN and our model. The results are shown in Table 2.6. 28 Table 2.6: Classification accuracy (top 1/5/10) on test set for SCOP 1.75 for different unsuper- vised and supervised baselines, averaged from 10 different runs (q references × p supports). Method Unsupervised Supervised DeepSF [Hou et al., 2019] CKN [Chen et al., 2019a] RKN [Chen et al., 2019b] Set Transformer [Lee et al., 2019] Approximate Rep the Set [Skianis et al., 2020] Ours (dot-product instead of OT) Ours (Unsup.: 1 × 100 / Sup.: 5 × 10) Not available. 81.8±0.8/92.8±0.2/95.0±0.2 Not available. Not available. Not available. 78.2±1.9/93.1±0.7/96.0±0.4 73.0/90.3/94.5 84.1±0.1/94.3±0.2/96.4±0.1 85.3±0.3/95.0±0.2/96.5±0.1 79.2±4.6/91.5±1.4/94.3±0.6 84.5±0.6/94.0±0.4/95.7±0.4 87.5±0.3/95.5±0.2/96.9±0.1 85.8±0.2/95.3±0.1/96.8±0.1 88.7±0.3/95.9±0.2/97.3±0.1 Table 2.7: Results for prediction of chromatin profiles on the DeepSEA dataset. The metrics are area under ROC (auROC) and area under PR curve (auPRC), averaged over 919 chromatin profiles. Due to the huge size of the dataset, we only provide results based on a single run. Method auROC auPRC DeepSEA [Zhou and Troyanskaya, 2015] Ours with position encoding (Sinusoidal [Vaswani et al., 2017]/Ours) 0.933 0.917/0.936 0.342 0.311/0.360 Additional experiments: Detection of chromatin profiles. Predicting the chromatin features such as transcription factor (TF) binding from raw genomic sequences has been studied extensively in recent years. CNNs with max pooling operations have been shown effective for this task. Here, we consider DeepSEA dataset [Zhou and Troyanskaya, 2015] consisting in simultaneously predicting 919 chromatin profiles, which can be formulated as a multi-label classification task. DeepSEA contains 4, 935, 024 DNA sequences of length 1000 and each of them is associated with 919 different labels (chromatin profiles). Each sequence is represented as a 1000 × 4 binary matrix through one-hot encoding and the objective is to predict which profiles a given sequence possesses. As this problem is very imbalanced for each profile, learning an unsupervised model could require an extremely large number of parameters. We thus only consider our supervised embedding as an adaptive pooling layer and inject it into a deep neural network, between one convolutional layer and one fully connected layer, as detailed in Appendix 2.8.2. In our embedding, φ is chosen to be identity and the positional encoding described in Section 2.3 is used. We compare our model to a state-of-the-art CNN with 3 convolutional layers and two fully-connected layers [Zhou and Troyanskaya, 2015]. The results are shown in Table 2.7. 2.5.2 Results and discussion In protein fold classification, our embedding outperforms all baselines in both unsupervised and supervised settings. Surprisingly, our unsupervised model also achieves better results than most supervised baselines. In contrast, Set Transformer does not perform well, possibly because its implementation was not designed for sets with varying sizes, and tasks with few annotations. In detection of chromatin profiles, our model (our embedding within a deep network) has fewer layers than state-of-the-art CNNs while outperforming them, which advocates for the use of attention-based models for such applications. Our results also suggest that positional information is important (CIFAR-10 results and Appendix 2.8.2), and our Gaussian position 29 encoding outperforms the sinusoidal one introduced in Vaswani et al. [2017]. Note that in contrast to a typical transformer, which would have stored a 1000 × 1000 attention matrix, our attention score with a reference of size 64 is only 1000 × 64, which illustrates the discussion in Section 2.4. In NLP, an a priori less favorable setting since sequences are shorter and there are more data, our supervised embedding gets close to a strong state-of-the-art, i.e. a fully-trained transformer. We observed our method to be much faster than RepSet, as fast as Set Transformer, yet slower than ApproxRepSet (2.8.1). Using the OT plan as similarity score yields better accuracies than the dot-product between the input sets and the references (see Table 2.6; 2.5). Choice of parameters. This paragraph sums up the impact of hyper-parameter choices. Experiments justifying our claims can be found in Appendix 2.8. - Number of references q: for biological sequences, a single reference was found to be enough in the unsupervised case, see Table 2.11. In the supervised setting, Table 2.14 suggests that using q = 5 provides slightly better results but q = 1 remains a good baseline, and that the sensitivity to number of references is moderate. - Number of supports p in a reference: Table 2.11 and Table 2.14 suggest that the sensitivity of the model to the number of supports is also moderate. - Nyström anchors: an anchor can be seen as a neuron in a feed-forward neural network (see expression of ψ in 2.3.3). In unsupervised settings, the more anchors, the better the approximation of the kernel matrix. Then, the performance saturates, see Table 2.12. In supervised settings, the optimal number of anchors points is much smaller, as also observed by Chen et al. [2019a], Fig 6. - Bandwidth σ in Gaussian kernel: σ was chosen as in Chen et al. [2019b] and we did not try to optimize it in this work, as it seemed to already provide good results. Nevertheless, slightly better results can be obtained when tuning this parameter, for instance in SST-2. OTKE and self-supervised methods. Our approach should not be positioned against self-supervision and instead brings complementary features: the OTKE may be plugged in state-of-the-art models pre-trained on large unannotated corpus. For instance, on SCOP 1.75, we use ESM-1 [Rives et al., 2019], pre-trained on 250 millions protein sequences, with mean pooling followed by a linear classifier. As we do not have the computational ressources to fine-tune ESM1-t34, we only train a linear layer on top of the extracted features. Using the same model, we replace the mean pooling by our (unsupervised) OTKE layer, and also only train the linear layer. This results in accuracy improvements as showed in Table 2.8. While training huge self-supervised learning models on large datasets is very effective, ESM1-t34 admits more than 2500 times more parameters than our single-layer OTKE model (260k parameters versus 670M) and our single-layer OTKE outperforms smaller versions of ESM1 (43M parameters). Finally, self-supervised pre-training of a deep model including OTKE on large data sets would be interesting for fair comparison. Multi-layer extension. Extending the OTKE to a multi-layer embedding is a natural yet not straightforward research direction: it is not clear how to find a right definition of intermediate feature aggregation in a multi-layer OTKE model. Note that for DeepSEA, our model with 30 Table 2.8: Classification accuracy (top 1/5/10) results of our unsupervised embedding for SCOP 1.75 with pre-trained ESM models [Rives et al., 2019]. Model Nb parameters Mean Pooling Unsupervised OTKE ESM1-t6-43M-UR50S ESM1-t34-670M-UR50S 43M 670M 84.01/93.17/95.07 94.95/97.32/97.91 85.91/93.72/95.30 95.22/97.32/98.03 single-layer OTKE already outperforms a multi-layer CNN, which suggests that a multi-layer OTKE is not always needed. 2.6 Conclusion We showed the effectiveness of OTKE for pooling in sequences in the context of bioinformatics and natural language processing: our model is more expressive than mean, max or sum and competitive with attention mechanisms in terms of sample complexity and model size. In the next chapter, we will explain how pooling is also an important component of a family of neural networks for graphs (GNNs). This pooling is often limited to the closest neighbors of the graph nodes, which leads to issues when processing graphs with complex interactions between distant nodes. In the philosophy of this chapter, we will see graphs as sequences and aggregate node features across the whole graph, an inductive bias different from that of GNNs. While OTKE used basic position encoding scheme and focused on the pooling mechanism, next chapter will do the opposite, relying on simple attention mechanisms for feature aggregation and introducing new mechanisms, or inductive biases, for encoding the position of the nodes, and more globally the structure of the graph. 31 Appendix Appendix 2.7 contains the proofs skipped in the main part of the chapter; Appendix 2.8 provides additional experimental results as well as details on our protocol for reproducibility. 2.7 Proofs 2.7.1 Proof of Lemma 2.3.2 Proof. First, since Pn0 j=1 pP(x0, z)jk = 1 for any k, we have W2(x, z)2 = = n X p X i=1 n X k=1 p X i=1 k=1 = kuk2 2, P(x, z)ikd2 κ (xi, zk) n0 X j=1 pP(x0, z)jkP(x, z)ikd2 κ (xi, zk) with u a vector in Rnn0p whose entries are q pP(x0, z)jkP(x, z)ikdκ(xi, zk) for i = 1, . . . , n, (x, x0) as an '2-norm of a vector v in j = 1, . . . , n0 and k = 1, . . . , p. We can also rewrite W z 2 Rnn0p whose entries are q ). Then by Minkowski inequality for the '2-norm, we have pP(x0, z)jkP(x, z)ikdκ(xi, x0 j |W2(x, z) − W z 2 (x, x0)| = |kuk2 − kvk2| ≤ ku − vk2   n X p X n0 X pP(x0, z)jkP(x, z)ik(dκ(xi, zk) − dκ(xi, x0 j))2   1/2 =   ≤ i=1 k=1 j=1 n X p X n0 X i=1 k=1 j=1 pP(x0, z)jkP(x, z)ikd2 κ (x0 j, zk)   1/2   = p X n0 X  1/2 P(x0, z)jkd2 κ (x0 j, zk)  j=1 k=1 = W2(x0, z), where the second inequality is the triangle inequality for the distance dκ. Finally, we have (x, x0)| ≤|W2(x, x0) − W2(x, z)| + |W2(x, z) − W z 2 ≤W2(x0, z) + W2(x0, z) =2W2(x0, z), |W2(x, x0) − W z 2 (x, x0)| where the second inequality is the triangle inequality for the 2-Wasserstein distance. By symmetry, we also have |W2(x, x0) − W z 2 (x, x0)| ≤ 2W2(x, z), which concludes the proof. 32 2.7.2 Relationship between W2 and W z Using the relation proved in Appendix 2.7.1, we can obtain a bound on the error term between W2 and W z for a data set of m samples (x1, . . . , xm) and q references (z1, . . . , zq) 2 2 for multiple references E 2 := 1 m2 m X i,j=1 |W2(xi, xj) − W z1,...,zq 2 (xi, xj)|2 ≤ 4 m X q X mq i=1 j=1 W 2 2 (xi, zj). (2.9) When q = 1, the right-hand term in the inequality is the objective to minimize in the Wasserstein barycenter problem [Cuturi and Doucet, 2013], which further explains why we considered it: Once W z is close to the Wasserstein distance W2, Kz will also be close to KOT. We extend here 2 the bound in (2.7) in the case of one reference to the multiple-reference case. The approximate 2-Wasserstein distance W z 2 (x, x0) thus becomes W z1,...,zq 2 (x, x0) := * 1 q q X j=1 Pzj (x, x0), d2 κ (x, x0) +1/2 =   1 q q X j=1  1/2 W zj 2 (x, x0)2  . Then by Minkowski inequality for the '2-norm we have |W2(x, x0) − W z1,...,zq 2 (x, x0)| = ≤  and by (2.7) we have   (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12)   1/2  W2(x, x0)2  −  1 q q X j=1 1 q q X j=1 W zj 2 (x, x0)2   1/2(cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) 1 q q X (W2(x, x0) − W zj 2 (x, x0))2  ,  1/2 j=1 |W2(x, x0) − W z1,...,zq 2 (x, x0)| ≤   4 q q X j=1 min(W2(x, zj), W2(x0, zj))2  .  1/2 Finally the approximation error in terms of Frobenius is bounded by E 2 := 1 m2 m X i,j=1 |W2(xi, xj) − W z1,...,zq 2 (xi, xj)|2 ≤ 4 m X q X mq i=1 j=1 W 2 2 (xi, zj). In particular, when q = 1 that is the case of single reference, we have E 2 ≤ 4 m X m i=1 W 2 2 (xi, z), where the right term equals to the objective of the Wasserstein barycenter problem, which justifies the choice of z when learning without supervision. 2.8 Additional Experiments and Setup Details This section contains additional results for the experiments of the main section; details on our setup, in particular hyper-parameter tuning for our methods and the baselines. 33 2.8.1 Protein fold recognition Dataset description. Our protein fold recognition experiments consider the Structural Classification Of Proteins (SCOP) version 1.75 and 2.06. We follow the data preprocessing protocols in Hou et al. [2019], which yields a training and validation set composed of 14699 and 2013 sequences from SCOP 1.75, and a test set of 2533 sequences from SCOP 2.06. The resulting protein sequences belong to 1195 different folds, thus the problem is formulated as a multi-classification task. The input sequence is represented as a 45-dimensional vector at each amino acid. The vector consists of a 20-dimensional one-hot encoding of the sequence, a 20-dimensional position-specific scoring matrix (PSSM) representing the profile of amino acids, a 3-class secondary structure represented by a one-hot vector and a 2-class solvent accessibility. The lengths of the sequences are varying from tens to thousands. Models setting and hyperparameters. We consider here the one-layer models followed by a global mean pooling for the baseline methods CKN [Chen et al., 2019a] and RKN [Chen et al., 2019b]. We build our model on top of the one-layer CKN model, where κ can be seen as a Gaussian kernel on the k-mers in sequences. The only difference between our model and CKN is thus the pooling operation, which is given by our embedding introduced in Section 2.3. The bandwidth parameter of the Gaussian kernel κ on k-mers is fixed to 0.6 for unsupervised models and 0.5 for supervised models, the same as used in CKN which were selected by the accuracy on the validation set. The filter size k is fixed to 10 and different numbers of anchor points in Nyström for κ are considered in the experiments. The other hyperparameters for our embedding are the entropic regularization parameter ε, the number of supports in a reference p, the number of references q, the number of iterations for Sinkhorn's algorithm and the regularization parameter λ in the linear classifier. The search grid for ε and λ is shown in Table 2.9 and they are selected by the accuracy on validation set. ε plays an important role in the performance and is observed to be stable for the same dataset. For this dataset, it is selected to be 0.5 for all the unsupervised and supervised models. The effect of other hyperparameters will be discussed below. For the baseline methods, the accuracies of PSI-BLAST and DeepSF are taken from Hou et al. [2019]. The hyperparameters for CKN and RKN can be found in Chen et al. [2019b]. For Rep the Set [Skianis et al., 2020] and Set Transformer [Lee et al., 2019], we use the public implementations by the authors. These two models are used on the top of a convolutional layer of the same filter size as CKN to extract k-mer features. As the exact version of Rep the Set does not provide any implementation for back-propagation to a bottom layer of it, we consider the approximate version of Rep the Set only, which also scales better to our dataset. The default architecture of Set Transformer did not perform well due to overfitting. We therefore used a shallower architecture with one ISAB, one PMA and one linear layer, similar to the one-layer architectures of CKN and our model. We tuned their model hyperparameters, weight decay and learning rate. The search grids for these hyperparameters are shown in Table 2.10. Unsupervised embedding. The kernel embedding φ, which is infinite dimensional for the Gaussian kernel, is approximated with the Nyström method using K-means on 300000 k-mers extracted from the same training set as in Chen et al. [2019b]. The reference measures are learned by using either K-means or Wasserstein to update centroids in 2-Wasserstein K-means on 3000 subsampled sequences for RAM-saving reason. We evaluate our model on top of features extracted from CKNs of different dimensions, representing the number of anchor points used to 34 Table 2.9: Hyperparameter search grid for SCOP 1.75 Hyperparameter Search range ε for Sinkhorn λ for classifier (unsupervised setting) λ for classifier (supervised setting) [1.0; 0.5; 0.1; 0.05; 0.01] 1/2range(5,20) [1e-6;1e-5;1e-4;1e-3] Table 2.10: Hyperparameter search grid for SCOP 1.75 baselines. Model and Hyperparameter Search range ApproxRepSet: Hidden Sets × Cardinality ApproxRepSet: Learning Rate ApproxRepSet: Weight Decay Set Transformer: Heads × Dim Hidden Set Transformer: Learning Rate Set Transformer: Weight Decay [20; 30; 50; 100] × [10; 20; 50] [0.0001; 0.0005; 0.001] [1e-5;1e-4;1e-3;1e-2] [1; 4; 8] × [64; 128; 256] [0.0001; 0.0005; 0.001] [1e-5;1e-4;1e-3;1e-2] approximate κ. The number of iterations for Sinkhorn is fixed to 100 to ensure the convergence. The results for different combinations of q and p are provided in Table 2.11. Increasing the number of supports p can improve the performance and then saturate it when p is too large. On the other hand, increasing the number of references while keeping the embedding dimension (i.e. p × q) constant is not significantly helpful in this unsupervised setting. We also notice that Wasserstein Barycenter for learning the references does not outperform K-means, while the latter is faster in terms of computation. Supervised embedding. Our supervised embedding is initialized with the unsupervised method and then trained in an alternating fashion which was also used for CKN: we use an Adam algorithm to update anchor points in Nyström and reference measures z, and the L-BFGS algorithm to optimize the classifier. The learning rate for Adam is initialized with 0.01 and halved as long as there is no decrease of the validation loss for 5 successive epochs. In practice, we notice that using a small number of Sinkhorn iterations can achieve similar performance to a large number of iteration, while being much faster to compute. We thus fix it to 10 throughout the experiments. The accuracy results are obtained by averaging on 10 runs with different seeds following the setting in Chen et al. [2019b]. The results are shown in Table 2.13 with error bars. The effect of the number of supports q is similar to the unsupervised case, while increasing the number of references can indeed improve performance. 2.8.2 Detection of chromatin profiles Dataset description. Predicting the functional effects of non-coding variants from only genomic sequences is a central task in human genetics. A fundamental step for this task is to simultaneously predict large-scale chromatin features from DNA sequences [Zhou and Troyanskaya, 2015]. We consider here the DeepSEA dataset, which consists in simultaneously predicting 919 chromatin profiles including 690 transcription factor (TF) binding profiles for 160 different TFs, 125 DNase I sensitivity profiles and 104 histone-mark profiles. In total, there are 4.4 million, 8000 and 455024 samples for training, validation and test. Each sample consists of 35 Table 2.11: Classification accuracy (top 1/5/10) results of our unsupervised embedding for SCOP 1.75. We show the results for different combinations of (number of references q × number of supports p). The reference measures z are learned with either K-means or Wasserstein barycenter for updating centroids. Nb. filters Method 128 K-means Wass. bary. 1024 K-means q 1 5 10 1 5 10 1 5 10 10 Embedding size (q × p) 100 50 200 76.5/91.5/94.4 72.8/89.9/93.7 62.7/85.8/91.1 77.5/91.7/94.5 77.8/91.7/94.6 76.5/91.0/94.2 79.4/92.4/94.9 78.6/91.9/94.6 78.1/92.2/94.9 78.7/92.1/95.1 78.1/92.1/94.7 78.6/92.2/94.7 64.0/85.9/91.5 70.5/89.1/93.0 63.0/85.7/91.0 71.6/88.9/93.2 76.6/91.3/94.4 75.9/91.4/94.3 77.2/91.4/94.2 78.4/91.7/94.3 77.5/91.9/94.6 77.5/91.9/94.8 77.1/91.9/94.7 77.7/92.0/94.7 84.4/95.0/96.6 81.1/94.0/96.2 79.8/93.5/95.9 84.6/95.0/97.0 84.9/94.8/96.8 83.1/94.6/96.6 85.7/95.3/96.7 84.7/94.4/96.7 84.4/94.7/96.7 85.4/95.2/96.7 85.2/95.0/96.7 84.8/94.9/96.7 Table 2.12: Classification accuracy (top 1/5/10) results of our unsupervised embedding for SCOP 1.75. We show the results for different number of Nyström anchors. The number of references and supports are fixed to 1 and 100. Number of anchors Accuracies 1024 2048 3072 85.8/95.3/96.8 86.6/95.9/97.2 87.8/96.1/97.4 Table 2.13: Classification accuracy (top 1/5/10) of supervised models for SCOP 1.75. The accuracies obtained by averaging 10 different runs. We show the results of using either one reference with 50 supports or 5 references with 10 supports. Here DeepSF is a 10-layer CNN model. Method Runtime Top 1/5/10 accuracy on SCOP 2.06 PSI-BLAST [Hou et al., 2019] DeepSF [Hou et al., 2019] Set Transformer [Lee et al., 2019] ApproxRepSet [Skianis et al., 2020] Number of filters CKN [Chen et al., 2019a] RKN [Chen et al., 2019b] Ours Φz (1 × 50) Φz (5 × 10) - - 3.3h 2h 1.5h - 3.5h 4h 84.53/86.48/87.34 73.00/90.25/94.51 79.15±4.61/91.54±1.40/94.33±0.63 84.51±0.58/94.03±0.44/95.73±0.37 128 512 76.30±0.70/92.17±0.16/95.27±0.17 77.82±0.35/92.89±0.19/95.51±0.20 84.11±0.11/94.29±0.20/96.36±0.13 85.29±0.27/94.95±0.15/96.54±0.12 82.83±0.41/93.89±0.33/96.23±0.12 84.68±0.50/94.68±0.29/96.49±0.18 88.40±0.22/95.76±0.13/97.10±0.15 88.66±0.25/95.90±0.15/97.33±0.14 36 Table 2.14: Classification accuracy (top 1/5/10) results of our supervised embedding for SCOP 1.75. We show the results for different combinations of (number of references q × number of supports p). The reference measures z are learned with K-means. Embedding size (q × p) q = 1 q = 2 q = 5 q = 10 10 50 100 200 88.3/95.5/97.0 87.8/95.8/97.0 87.0/95.1/96.7 84.5/93.6/95.6 88.4/95.8/97.2 89.6/96.2/97.5 88.8/96.0/97.2 89.8/96.0/97.2 87.1/94.9/96.7 86.5/94.9/96.6 87.4/95.4/97.0 88.0/95.7/97.0 87.7/94.9/96.3 87.6/94.9/96.3 87.4/94.7/96.2 85.6/94.4/96.1 Table 2.15: Model architecture for DeepSEA dataset. Model architecture Conv1d(in channels=4, out channels=d, kernel size=16) + ReLU (Ours) EmbeddingLayer(in channels=d, supports=64, references=1, ε = 1.0, PE=True, σpos = 0.1) Linear(in channels=d, out channels=d) + ReLU Dropout(0.4) Linear(in channels=d × 64, out channels=919) + ReLU Linear(in channels=919, out channels=919) a 1000-bp DNA sequence from the human GRCh37 reference. Each sequence is represented as a 1000 × 4 binary matrix using one-hot encoding on DNA characters. The dataset is available at http://deepsea.princeton.edu/media/code/deepsea_train_bundle.v0.9.tar.gz. Note that the labels for each profile are very imbalanced in this task with few positive samples. For this reason, learning unsupervised models could be intractable as they may require an extremely large number of parameters if junk or redundant sequences cannot be filtered out. Model architecture and hyperparameters. For the above reason and fair comparison, we use here our supervised embedding as a module in Deep NNs. The architecture of our model is shown in Table 2.15. We use an Adam optimizer with initial learning rate equal to 0.01 and halved at epoch 1, 4, 8 for 15 epochs in total. The number of iterations for Sinkhorn is fixed to 30. The whole training process takes about 30 hours on a single GTX2080TI GPU. The dropout rate is selected to be 0.4 from the grid [0.1; 0.2; 0.3; 0.4; 0.5] and the weight decay is 1e-06, the same as Zhou and Troyanskaya [2015]. The σpos for position encoding is selected to be 0.1, by the validation accuracy on the grid [0.05; 0.1; 0.2; 0.3; 0.4; 0.5]. The checkpoint with the best validation accuracy is used to evaluate on the test set. Area under ROC (auROC) and area under precision curve (auPRC), averaged over 919 chromatin profiles, are used to measure the performance. The hidden size d is chosen to be either 1024 or 1536. Results and importance of position encoding. We compare our model to the state- of-the-art CNN model DeepSEA [Zhou and Troyanskaya, 2015] with 3 convolutional layers, whose best hyper-parameters can be found in the corresponding paper. Our model outperforms DeepSEA, while requiring fewer layers. The positional information is known to be important in this task. To show the efficacy of our position encoding, we compare it to the sinusoidal encoding used in the original transformer [Vaswani et al., 2017]. We observe that our encoding with properly tuned σpos requires fewer layers, while being interpretable from a kernel point of 37 Table 2.16: Results for prediction of chromatin profiles on the DeepSEA dataset. The metrics are area under ROC (auROC) and area under PR curve (auPRC), averaged over 919 chromatin profiles. The accuracies are averaged from 10 different runs. Armed with the positional encoding (PE) described in Section 2.3, our embedding outperforms the state-of-the-art model and another model of our embedding with the PE proposed in Vaswani et al. [2017]. Method Position encoding DeepSEA - Ours Sinusoidal [Vaswani et al., 2017] auROC auPRC 0.933 0.342 0.917 0.311 Ours (d = 1024) Ours (d = 1536) Ours 0.935 0.354 Ours 0.936 0.360 view. We also find that larger hidden size d performs better, as shown in Table 2.16. ROC and PR curves for all the chromatin profiles and stratified by transcription factors, DNase I-hypersensitive sites and histone-marks can also be found in Figure 2.4. 2.8.3 SST-2 Dataset description. The data set contains 67,349 training samples and 872 validation samples and can be found at https://gluebenchmark.com/tasks. The test set contains 1,821 samples for which the predictions need to be submitted on the GLUE leaderboard, with limited number of submissions. As a consequence, our training and validation set are extracted from the original training set (80% of the original training set is used for our training set and the remaining 20% is used for our validation set), and we report accuracies on the standard validation set, used as a test set. The reviews are padded with zeros when their length is shorter than the chosen sequence length (we choose 30 and 66, the latter being the maximum review length in the data set) and the BERT implementation requires to add special tokens [CLS] and [SEP] at the beginning and the end of each review. In most transformers such as BERT, the Model architecture and hyperparameters. embedding associated to the token [CLS] is used for classification and can be seen in some sense as an embedding of the review adapted to the task. The features we used are the word features provided by the BERT base-uncased version, available at https://huggingface.co/ transformers/pretrained_models.html. For this version, the dimension of the word features is 768. Our model is one layer of our embedding, with φ the Gaussian kernel mapping with varying number of Nyström filters in the supervised setting, and the Linear kernel in the unsupervised setting. We do not add positional encoding as it is already integrated in BERT features. In the unsupervised setting, the output features are used to train a large-scale linear classifier, a Pytorch linear layer. We choose the best hyper-parameters based on the accuracy of a validation set. In the supervised case, the parameters of the previous model, w and z, are optimized end-to-end. In this case, we tune the learning rate. In both case, we tune the entropic regularization parameter of optimal transport and the bandwidth of the Gaussian kernel. The parameters in the search grid are summed up in Table 2.18. The best entropic regularization and Gaussian kernel bandwidth are typically and respectively 3.0 and 0.5 for this data set. The supervised training process takes between half an hour for smaller models (typically 128 filters in w and 3 supports in z) and a few hours for larger models (256 filters and 100 supports) on a single GTX2080TI GPU. The hyper-parameters of the baselines were 38 Figure 2.4: ROC and PR curves for all the chromatin profiles (first row) and stratified by transcription factors (left column), DNase I-hypersensitive sites (middle column) and histone- marks (right column). The profiles with positive samples fewer than 50 on the test set are not taken into account. 39 Table 2.17: Accuracies on standard validation set for SST-2 with our unsupervised features depending on the number of references and supports. The references were computed using K-means on samples for multiple references and K-means on patches for multiple supports. The size of the input BERT features is (length × dimension). The accuracies are averaged from 10 different runs. (q references × p supports) BERT Input Feature Size (30 × 768) (66 × 768) Features [CLS] Flatten Mean pooling Φz (1 × 3) Φz (1 × 10) Φz (1 × 30) Φz (1 × 100) Φz (1 × 300) Pre-trained Fine-tuned Pre-trained Fine-tuned 84.6±0.3 84.9±0.4 85.3±0.3 85.5±0.1 85.1±0.4 86.3±0.3 85.7±0.7 86.8±0.3 90.3±0.1 91.0±0.1 90.8±0.1 90.9±0.1 90.9±0.1 90.8±0.1 90.9±0.1 90.9±0.1 86.0±0.2 85.2±0.3 85.4±0.3 86.5±0.1 85.9±0.3 86.6±0.5 86.6±0.1 87.2±0.1 92.8±0.1 92.5±0.1 92.6±0.2 92.6±0.1 92.6±0.1 92.6±0.1 92.7±0.1 92.7±0.1 Table 2.18: Hyperparameter search grid for SST-2. Hyperparameter Search range Entropic regularization ε λ for classifier (unsupervised setting) Gaussian kernel bandwidth Learning rate (supervised setting) [0.5; 1.0; 3.0; 10.0] 10range(−10,1) [0.4; 0.5; 0.6; 0.7; 0.8] [0.1; 0.01; 0.001] similarly tuned, see 2.19. Mean Pooling and [CLS] embedding did not require any tuning except for the regularization λ of the classifier, which followed the same grid as in Table 2.18. Results and discussion. As explained in Section 2.5, our unsupervised embedding improves the BERT pre-trained features while still using a simple linear model as shown in Table 2.17, and its supervised counterpart enables to get even closer to the state-of-the art (for the BERT base-uncased model) accuracy, which is usually obtained after fine-tuning of the BERT model on the whole data set. This can be seen in Tables 2.20; 2.21. We also add a baseline consisting of one layer of classical self-attention, which did not do well hence was not reported in the main text. Table 2.19: Hyperparameter search grid for SST-2 baselines. Model and Hyperparameter Search range RepSet and ApproxRepSet: Hidden Sets × Cardinality ApproxRepSet: Learning Rate Set Transformer: Heads × Dim Hidden Set Transformer: Learning Rate [4; 20; 30; 50; 100] × [3; 10; 20; 30; 50] [0.0001; 0.001; 0.01] [1; 4] × [8; 16; 64; 128] [0.001; 0.01] 40 Table 2.20: Classification accuracy on standard validation set of supervised models for SST-2, with pre-trained BERT (30 × 768) features. The accuracies of our embedding were averaged from 3 different runs before being run 10 times for the best results for comparison with baselines, cf. Section 2.5. 10 Sinkhorn iterations were used. (q references × p supports). Method Accuracy on SST-2 Number of Nyström filters 32 64 128 Φz (1 × 3) Φz (1 × 10) Φz (1 × 30) Φz (4 × 3) Φz (4 × 10) Φz (4 × 30) 88.38 88.11 88.30 88.07 87.6 88.18 88.38 88.15 88.30 88.26 87.84 88.68 88.18 87.61 88.26 88.30 88.11 88.07 Table 2.21: Classification accuracy on standard validation set of all baselines for SST-2, with pre-trained BERT (30 × 768) features, averaged from 10 different runs. Method Accuracy on SST-2 [CLS] embedding [Devlin et al., 2019] Mean Pooling of BERT features [Devlin et al., 2019] One Self-Attention Layer [Vaswani et al., 2017] Approximate Rep the Set [Skianis et al., 2020] Rep the Set [Skianis et al., 2020] Set Transformer [Lee et al., 2019] Φz (1 × 30) (dot-product instead of OT) 90.3±0.1 90.8 ± 0.1 83.7±0.1 86.8±0.9 87.1±0.5 87.9±0.8 86.9±1.1 41 Chapter 3 Encoding Graph Structure in Transformers with Kernels on Graphs We show that viewing graphs as sets of node features and incorporating structural and positional information into a transformer architecture is able to outperform representations learned with classical graph neural networks (GNNs). Our model, GraphiT, encodes such information by (i) leveraging relative positional encoding strategies in self-attention scores based on positive definite kernels on graphs, and (ii) enumerating and encoding local sub-structures such as paths of short length. We thoroughly evaluate these two ideas on many classification and regression tasks, demonstrating the effectiveness of each of them independently, as well as their combination. In addition to performing well on standard benchmarks, our model also admits natural visualization mechanisms for interpreting graph motifs explaining the predictions, making it a potentially strong candidate for scientific applications where interpretation is important.1 This chapter is based on the following material: - G. Mialon*, D. Chen*, M. Selosse*, J. Mairal. "GraphiT: Encoding Graph Structure in Transformers" (preprint arXiv:2106.05667). 3.1 Introduction Graph-structured data are present in numerous scientific applications and are the subject of growing interest. Examples of such data are as varied as proteins in computational biology [Senior et al., 2020], which may be seen as a sequence of amino acids, but also as a graph representing their tertiary structure, molecules in chemo-informatics [Duvenaud et al., 2015], shapes in computer vision and computer graphics [Verma et al., 2018], electronic health records, or communities in social networks. In the case of molecules for examples, the atoms can be seens 1Code available at https://github.com/inria-thoth/GraphiT. 42 Figure 3.1: A molecule of Theobromin, hypothetically responsible for the positive effect of chocolate on the mood (from Wikipedia). as nodes and chemical bonds as edges as in Figure 3.1. Designing graph representations for machine learning is a particularly active area of research, even though not new [Borgwardt et al., 2020], with a strong effort currently focused on graph neural networks [Bronstein et al., 2017, Chen et al., 2020, Kipf and Welling, 2017, Scarselli et al., 2008, Veličković et al., 2018, Xu et al., 2019]. A major difficulty is to find graph representations that are computationally tractable, adaptable to a given task, and capable of distinguishing graphs with different topological structures and local characteristics. In this work, we are interested in the transformer, which has become the standard architecture for natural language processing [Vaswani et al., 2017], and is gaining ground in computer vision [Dosovitskiy et al., 2021] and computational biology [Rives et al., 2019]. The ability of a transformer to aggregate information across long contexts for sequence data makes it an interesting challenger for GNNs that successively aggregate local information from neighbors in a multilayer fashion. In contrast, a single self-attention layer of the transformer can potentially allow all the nodes of an input graph to communicate. The price to pay is that this core component is invariant to permutations of the input nodes, hence does not take the topological structure of the graph into account and looses crucial information. For sequence data, this issue is addressed by encoding positional information of each token and giving it to the transformer architecture. For graphs, the problem is more challenging as there is no single way to encode node positions. For this reason, there have been few attempts to use vanilla transformers for graph representation. To the best of our knowledge, the closest work to ours seems to be the graph transformer architecture of Dwivedi and Bresson [2021], who propose an elegant positional encoding strategy based on the eigenvectors of the graph Laplacian [Belkin and Niyogi, 2003]. However, they focus on applying attention to neighboring nodes only, as in GNNs, and their results suggest that letting all nodes communicate is not a competitive approach. Our work provides another perspective and reaches a slightly different conclusion; we show that even though local communication is indeed often more effective, the transformer with global communication can also achieve good results. For that, we introduce a set of techniques to encode the local graph structure within our model, GraphiT (encoding graph structure in transformers). More precisely, GraphiT relies on two ingredients that may be combined, or used independently. First, we propose relative positional encoding strategies for weighting 43 attention scores by using positive definite kernels, a viewpoint introduced for sequences in Tsai et al. [2019]. This concept is particularly appealing for graphs since it allows to leverage the rich literature on kernels on graphs Kondor and Vert [2004], Smola and Kondor [2003], which are powerful tools for encoding the similarity between nodes. The second idea consists in computing features encoding the local structure in the graph. To achieve this, we leverage the principle of graph convolutional kernel networks (GCKN) of Chen et al. [2020], which consists in enumerating and encoding small sub-structure (for instance, paths or subtree patterns), which may then be used as an input to the transformer model. We demonstrate the effectiveness of our approach on several classification and regression benchmarks, showing that GraphiT with global or local attention layer can outperform GNNs in various tasks, and also show that basic visualization mechanisms allow us to automatically discover discriminative graph motifs, which is potentially useful for scientific applications where interpretation is important. Contributions. In summary, our contribution is three-folds: - We introduce two mechanism within the transformer architecture to integrate structural information from graphs. - We demonstrate the effectiveness of this approach, which is able to outperform GNNs in various tasks. - We show that basic visualization mechanisms allows to recover meaningful graph motifs. 3.2 Related work Graph kernels. A classical way to represent graphs for machine learning tasks consists in defining a high-dimensional embedding for graphs, which may then be used to perform prediction with a linear models (e.g., support vector machines). Graph kernels typically provide such embeddings by counting the number of occurrences of local substructures that are present within a graph [Borgwardt et al., 2020]. The goal is to choose substructures leading to expressive representations sufficiently discriminative, while allowing fast algorithms to compute the inner-products between these embeddings. For instance, walks have been used for such a purpose [Gärtner et al., 2003], as well as shortest paths [Borgwardt and Kriegel, 2005], subtrees [Harchaoui and Bach, 2007, Mahé and Vert, 2009, Shervashidze et al., 2011], or graphlets [Shervashidze et al., 2009]. Our work uses short paths, but other substructures could be used in principle. Note that graph kernels used in the context of comparing graphs, is a line of work different from the kernels on graphs that we will introduce in Section 3.3 for computing embeddings of nodes. Graph neural networks. Originally introduced in Scarselli et al. [2008], GNNs have been derived as an extension of convolutions for graph-structured data: they use a message passing paradigm in which vectors (messages) are exchanged (passed) between neighboring nodes whose representations are updated using neural networks. Many strategies have been proposed to aggregate features of neighboring nodes (see, e.g, Bronstein et al. [2017], Duvenaud et al. [2015]). The graph attention network (GAT) [Veličković et al., 2018] is the first model to use an attention mechanism for aggregating local information. Recently, hybrid approaches between 44 graph neural networks and graph kernels were proposed in Chen et al. [2020], Du et al. [2019]. Diffusion processes on graphs that are related to the diffusion kernel we consider in our model were also used within GNNs in Klicpera et al. [2019]. Transformers for graph-structured data. Prior to Dwivedi and Bresson [2021], there were some attempts to use transformers in the context of graph-structured data. The authors of Li et al. [2019] propose to apply attention to all nodes, yet without position encoding. In Zhang et al. [2020], a transformer architecture called Graph-BERT is fed with sampled subgraphs of a single graph in the context of node classification and graph clustering. They also propose to encode positions by aggregating different encoding schemes. However, these encoding schemes are either impossible to use in our settings as they require having sampled subgraphs of regular structures as input, or less competitive than Laplacian eigenvectors as observed in Dwivedi and Bresson [2021]. The transformer model introduced in Yun et al. [2019] needs to first transform an heterogeneous graph into a new graph structure via meta-paths, which does not directly operate on node features. To the best of our knowledge, our work is the first to demonstrate that vanilla transformers with appropriate node position encoding can compete with GNNs in graph prediction tasks. 3.3 Preliminaries about Kernels on Graphs Spectral graph analysis. The Laplacian of a graph with n nodes is defined as L = D − A, where D is a n × n diagonal matrix that carries the degrees of each node on the diagonal and A is the adjacency matrix. Interestingly, L is a positive semi-definite matrix such that for all vector u in Rn, u>Lu = P (u[i] − u[j])2, which can be interpreted as the amount of "oscillation" of the vector u, hence its "smoothness', when seen as a function on the nodes of the graph. i∼j The Laplacian is often used via its eigenvalue decomposition L = P , where the eigenvalue λi = u> i Lui characterizes the amount of oscillation of the corresponding eigenvector ui. For this reason, this decomposition is traditionally viewed as the discrete equivalent to the sine/cosine Fourier basis in Rn and associated frequencies. Note that very often the normalized Laplacian I − D− 1 2 is used instead of L, which does not change the above interpretation. Interestingly, it is then possible to define a whole family of positive definite kernels on the graph [Smola and Kondor, 2003] by applying a regularization function r to the spectrum of L. We therefore get a rich class of kernels i λiuiu> i 2 AD− 1 Kr = m X i=1 r(λi)uiu> i , (3.1) = Pm i ui)2/r(λi) from a reproducing kernel associated with the following norm kf k2 r Hilbert space (RKHS), where r : R 7→ R+ is a non-increasing function such that smoother ∗ functions on the graph would have smaller norms in the RKHS. We now introduce two examples. (f > i=1 Diffusion Kernel Kondor and Vert [2004]. which gives: It corresponds to the case r(λi) = e−βλi, KD = m X i=1 e−βλiuiu> i = e−βL = lim p→+∞ (cid:18) I − (cid:19)p . β p L (3.2) 45 Figure 3.2: Diffusion kernel (β = 1) for a molecular graph from the MUTAG dataset used in our experiments. Neighboring nodes have higher values. Note that nodes that are structurally similar, such as 7 and 8, have similar entries. The diffusion kernel can be seen as a discrete equivalent of the Gaussian kernel, a solution of the heat equation in the continuous setting, hence its name. Intuitively, the diffusion kernel between two nodes can be interpreted as the quantity of some substance that would accumulate at the first node after a given amount of time (controlled by β) if we injected the substance at the other node and let it diffuse through the graph. An illustration of the diffusion kernel is presented in Figure 3.2. It is related to the random walk kernel that will be presented below. p-step random walk kernel. By taking r(λi) = (1 − γλi)p , we obtain a kernel that admits an interpretation in terms of p steps of a particular random walk on the graph: KpRW = (I − γL)p. (3.3) It is related to the diffusion kernel by choosing γ = β/p and taking the limit with p → +∞, according to (3.2). Unlike the diffusion kernel which yields a dense matrix, the random walk kernel is sparse and has limited connectivity, meaning that two nodes are connected in KpRW only if there exists a path of length p between them. As these kernels on graphs reflect the structural similarity of the nodes independently of their features, it is natural to use the resulting Gram matrix to encode such a structure within the transformer model, as detailed next. 3.4 Encoding Graph Structure in Transformers In this section, we detail the architecture and structure encoding strategies behind GraphiT. In particular, we build upon the findings of Tsai et al. [2019] for our architectural choices and 46 propose new strategies for encoding structural information in the transformer architecture. 3.4.1 Transformer Architectures for Graphs We process graphs with a vanilla transformer encoder architecture [Vaswani et al., 2017] for solving classification and regression tasks, by seeing graphs as sets of node features. We first present the transformer without encoding the graph structure, before introducing mechanisms for encoding nodes positions in Section 3.4.2, and then topological structures in Section 3.4.3. Specifically, a transformer is composed of a sequence of layers, which process an input set of din features represented by a matrix X in Rn×din, and compute another set in Rn×dout. A critical component is the attention mechanism: Attention(Q, V ) = softmax ! QQ> √ dout V ∈ Rn×dout, (3.4) with Q> = WQX > is called the query matrix, V > = WV X > the value matrix, and WQ, WV in Rdout×din are projection matrices that are learned. Note that following the recommendation of Tsai et al. [2019], we use the same matrix for keys and queries. This allows us to define a symmetric and positive definite kernel on pairs of nodes and thus to combine with other kernels on graph. This also reduces the number of parameters in our models without hurting the performance in practice. During the forward pass, the feature map X is updated in a residual fashion (with either din = dout or with an additional projection matrix when the dimensions do not match, omitted here for simplicity) as follows: X = X + Attention(Q, V ). Note that transformers without position encoding and GNNs are tightly connected: a GNN can be seen as a transformer where aggregation is performed on neighboring nodes only, and a transformer as a GNN processing a fully-connected graph. However, even in this case, differences would remain between common GNNs and Transformers, as the latter use for example LayerNorm and skip-connections. In this work, we will either adopt the local aggregation strategy, or let all nodes communicate in order to test this inductive bias in the context of graphs, where capturing long range interactions between nodes may be useful for some tasks. 3.4.2 Encoding Node Positions The output of the transformer is invariant to permutations in the input data. It is therefore crucial to provide the transformer with information about the data structure. In this section, we revisit previously proposed strategies for sequences and graphs and devise new methods for positional encoding. Note that a natural baseline is simply to adopt a local aggregation strategy similar to Veličković et al. [2018] or Dwivedi and Bresson [2021] for example. Existing Strategies for Sequences and Graphs In NLP, Absolute and relative positional encoding in transformers for sequences. positional information was initially encoded by adding a vector based on sinusoidal functions to each of the input token features Vaswani et al. [2017]. This approach was coined as absolute 47 position encoding and proved to be also useful for other data modalities [Dosovitskiy et al., 2021, Dwivedi and Bresson, 2021]. In relative position encoding, which was proposed later [Parikh et al., 2016, Shaw et al., 2018], positional information is added to the attention logits and in the values. This information only depends on the relative distance between the two considered elements in the input sequence. Absolute positional encoding for graphs. Whereas positional encodings can be hand- crafted or learned relatively easily for sequences and images, which respectively admit a chain or grid structure, this task becomes non-trivial for graphs, whose structure may vary a lot inside a data set, besides the fact that the concept of node position is ill-defined. To address these issues, an absolute position encoding scheme was recently proposed in Dwivedi and Bresson [2021], by leveraging the graph Laplacian (LapPE). More precisely, each node of each graph is assigned a vector containing the first k coordinates of the node in the eigenbasis of the graph normalized Laplacian sorted in ascending order of the eigenvalues. Since the first eigenvector associated to the eigenvalue 0 is constant, the first coordinate is omitted. As detailed in Section 3.3, these eigenvectors oscillate more and more and the corresponding coordinates are often interpreted as Fourier coefficients representing frequency components in increasing order. Note that eigenvectors of the Laplacian computed on different graphs could not be compared to each other in principle, and are also only defined up to a ±1 factor. While this raises a conceptual issue for using them in an absolute positional encoding scheme, it is shown in Dwivedi and Bresson [2021]-and confirmed in our experiments-that the issue is mitigated by the Fourier interpretation, and that the coordinates used in LapPE are effective in practice for discriminating between nodes in the same way as the position encoding proposed in Vaswani et al. [2017] for sequences. Yet, because the eigenvectors are defined up to a ±1 factor, the sign of the encodings needs to be randomly flipped during the training of the network. In the next section, we introduce a novel strategy in the spirit of relative positional encoding that does not suffer from the previous conceptual issue, and can also be combined with LapPE if needed. Relative Position Encoding Strategies by Using Kernels on Graphs Modulating the transformer attention. To avoid the issue of transferability of the abso- lute positional encoding between graphs, we use information on the nodes structural similarity to bias the attention scores. More precisely, and in the fashion of the last chapter, or Tsai et al. [2019] for sequences, we modulate the attention kernel using the Gram matrix of some kernel on graphs described in Section 3.3 as follows: PosAttention(Q, V, Kr) = normalize exp ! ! (cid:12) Kr V ∈ Rn×dout, (3.5) QQ> √ dout with the same Q and V matrices, and Kr a kernel on the graph. "exp" denotes the elementwise exponential of the matrix entries and normalize means '1-normalization on rows such that normalization(exp(u))=softmax(u). The reason for multiplying the exponential of the attention logits before '1-normalizing the rows is that it corresponds to a classical kernel smoothing. Indeed, if we consider the PosAttention output for a node i: PosAttention(Q, V, Kr)i = n X j=1 exp (cid:0)QiQ> j /√ exp (cid:0)QiQ> dout j0/√ (cid:1) × Kr(i, j) dout (cid:1) × Kr(i, j0) Pn j0=1 Vj ∈ Rdout, 48 we obtain a typical smoothing, i.e, a linear combination of features with weights determined by a non-negative kernel, here k(i, j) := exp(QiQ> dout) × Kr(i, j), and summing to 1. In fact, k can be considered as a new kernel between nodes i and j made by multiplying a kernel based on positions (Kr) and a kernel based on content (via Q). As observed in Tsai et al. [2019] for sequences, modulating the attention logits with a kernel on positions is related to relative positional encoding [Shaw et al., 2018], where we bias the attention matrix with a term depending only on the relative difference in positions between the two elements in the input set. Moreover, during the forward pass, the feature map X is updated as follows: j /√ X = X + D− 1 2 PosAttention(Q, V, Kr), (3.6) where D is the matrix of node degrees. We found such a normalization with D−1/2 to be beneficial in our experiments since it reduces the overwhelming influence of highly connected graph components. Note that, as opposed to absolute position encoding, we do not add positional information to the values and the model does not rely on the transferability of eigenvectors between different Laplacians. Interestingly, the choice of the kernel enables to Choice of kernels and parameters. encode a priori knowledge directly within the model architecture, while the parameter has an influence on the attention span. For example, in the diffusion kernel, β can be seen as the duration of the diffusion process. The smaller it is, the more focused the attention on the close neighbors. Conversely, a large β corresponds to an homogeneous attention span. As another example, it is clear that the choice of p in the random walk kernel corresponds to visiting at best p-degree neighbors. In our experiments, the best kernel may vary across datasets, suggesting that long-range global interactions are of different importance depending on the task. For example, on the dataset PROTEINS (see Section 4.5), the vanilla transformer without using any structural information performs very well. 3.4.3 Encoding Topological Structures Position encoding aims at adding positional only information to the feature vector of an input node or to the attentions scores. Substructures is a different type of information, carrying local positional information and content, which has been heavily used within graph kernels, see Section 3.2. In the context of graphs neural networks, this idea was exploited in the graph convolutional kernel network model (GCKN) of Chen et al. [2020], which is a hybrid approach between GNNs and graph kernels based on substructure enumeration (e.g., paths). Among different strategies we experimented, enriching nodes features with the output of a GCKN layer turned out to be a very effective strategy. Graph convolutional kernel networks (GCKN). GCKNs Chen et al. [2020] is a multi- layer model that produces a sequence of graph feature maps akin to a GNN. The main difference is that each layer enumerates local sub-structures at each node (here, paths of length k), encodes them using a kernel embedding, and aggregates the resulting sub-structure representations. This results in a feature map that carries more information about the graph structure than traditional neighborhood aggregation based GNNs, which is appealing for transformers since the vanilla version is blind to the graph structure. 49 Formally, let us consider a graph G with n nodes, and let us denote by Pk(u) the set of paths shorter than or equal to k that start with node u. With an abuse of notation, p in Pk(u) will denote the concatenation of all node features encountered along the path. Then, a layer of GCKN defines a feature map X in Rn×d such that X(u) = X ψ(p), p∈Pk(u) where X(u) is the column of X corresponding to node u and ψ is a d-dimensional embedding of the path features p. More precisely, the path features in Chen et al. [2020] are embedded to a RKHS by using a Gaussian kernel, and a finite-dimensional approximation is obtained by using the Nyström method Williams and Seeger [2001]. The embedding is parametrized and can be learned without or with supervision (see Chen et al. [2020] for details). Moreover, path features of varying lengths up to a maximal length can be used with GCKN. In this work, we evaluate the strategy of encoding a node as the concatenation of its original features and those produced by one GCKN layer. This strategy has proven to be very successful in practice. 3.5 Experiments In this section, we evaluate instances of GraphiT as well as popular GNNs and position encoding baselines on various graph classification and regression tasks. We want to answer several questions: Q1: Can vanilla transformers, when equipped with appropriate position encoding and/or structural information, outperform GNNs in graph classification and regression tasks? Q2: Is kernel-based relative positional encoding more effective than the absolute position encoding provided by the eigenvectors of the Laplacian (LapPE)? Q3: What is the most effective way to encode graph structure information within transformers? We also discuss our results and conduct ablation studies. Finally, we demonstrate the ability of attention scores to highlight meaningful graph features when using kernel-based positional encoding. 3.5.1 Methodology Benchmark and baselines. We benchmark our methods on various graph classification datasets with discrete node labels (MUTAG, PROTEINS, PTC, NCI1) and one regression dataset with discrete node labels (ZINC). These datasets can be obtained e.g via the Pytorch Geometric toolbox [Fey and Lenssen, 2019]. We compare our models to the following GNN models: Molecular Fingerprint (MF) [Duvenaud et al., 2015], Graph Convolutional Networks (GCN) [Kipf and Welling, 2017], Graph Attention Networks (GAT) [Veličković et al., 2018], Graph Isomorphism Networks (GIN) [Xu et al., 2019] and finally Graph Convolutional Kernel Networks (GCKN) [Chen et al., 2020]. In particular, GAT is an important baseline as it uses attention to aggregate neighboring node information. We compare GraphiT to the transformer architecture proposed in Dwivedi and Bresson [2021] and also use their Laplacian absolute position encoding as a baseline for evaluating our graph kernel relative position encoding. All models are implemented in Pytorch and our code is available online at https: //github.com/inria-thoth/GraphiT. 50 Reporting scores. For all datasets except ZINC, we sample ten times random train/val/test splits, of size 80/10/10, respectively. For each split, we evaluate all methods by (i) training several models on the train fold with various hyperparameters; (ii) performing model selection on val, by averaging the validation accuracy of a model on its last 50 epochs; (iii) retraining the selected model on train+val; (iv) estimate the test score by averaging the test accuracy over the last 50 epochs. The results reported in our tables are then averaged over the ten splits. This procedure is a compromise between a double-nested cross validation procedure that would be too computationally expensive and reporting 10-fold cross validation scores that would overestimate the test accuracy. For ZINC, we use the same train/val/test splits as in Dwivedi and Bresson [2021], train GraphiT with 10 layers, 8 heads and 64 hidden dimensions as in Dwivedi and Bresson [2021], and report the average test mean absolute error on 4 independent runs. Optimization procedure and hyperparameter search. Our models are trained with the Adam optimizer by decreasing the learning rate by a factor of 2 each 50 epochs. For classification tasks, we train about the same number (81) of models with different hyperparameters for each GNN and transformer method, thus spending a similar engineering effort on each method. For GNN models, we select the best type of global pooling, number of layers and hidden dimensions from three different values. Regarding transformers, we select the best number of heads instead of global pooling type for three different values. For all considered models, we also select the best learning rate and weight decay from three different values and the number of epochs is fixed to 300 to guarantee the convergence. For the ZINC dataset, we found that a standard warmup strategy suggested for transformers in Vaswani et al. [2017] leads to more stable convergence for larger models. The rest of the hyperparameters remains the same as used in Dwivedi and Bresson [2021]. More details and precise grids for hyperparameter search can be found in Appendix 3.8. 3.5.2 Results and Discussion Comparison of GraphiT and baselines methods. We show our results in Table 3.1. For smaller datasets such as MUTAG, PROTEINS or PTC, our Transformer without positional encoding performs reasonably well compared to GNNs, whereas for NCI1 and ZINC, incor- porating structural information into the model is key to good performance. On all datasets, GraphiT is able to perform as well as or better than the baseline GNNs. In particular on ZINC, GraphiT outperforms all previous baseline methods by a large margin. For this, it seems that the factor D−1/2 in (3.6) is important, allowing to capture more information about the graph structure. The answer to Q1 is therefore positive. Comparison of relative position encoding schemes. Here, we compare our transformer used with different relative positional encoding strategies, including adjacency (1-step RW kernel with γ = 1.0 corresponding to a normalized adjacency matrix D−1/2AD−1/2) which is symmetric but not positive semi-definite, 2 and 3-step RW kernel with γ = 0.5 and a diffusion kernel with β = 1. Unlike the vanilla transformer that works poorly on big datasets including NCI1 and ZINC, keeping all nodes communicate through our diffusion kernel positional encoding can still achieve performances close to encoding methods relying on local communications such as adjacency or p-step kernel encoding. Interestingly, our adjacency encoding, which could be seen as a variant of the neighborhood aggregation of node features used in GAT, is shown to 51 Table 3.1: Average mean classification accuracy/mean absolute error. Method / Dataset Size Classes Max. number of nodes MF [Duvenaud et al., 2015] GCN [Kipf and Welling, 2017] GAT [Veličković et al., 2018] GIN [Xu et al., 2019] GCKN-subtree [Chen et al., 2020] [Dwivedi and Bresson, 2021] [Dwivedi and Bresson, 2021] + LapPE Transformers (T) T + LapPE T + Adj PE T + 2-step RW kernel T + 3-step RW kernel T + Diffusion kernel T + GCKN T + GCKN + 2-step RW kernel T + GCKN + Adj PE MUTAG PROTEINS PTC NCI1 ZINC (no edge feat.) 188 2 28 81.5±11.0 78.9±10.1 80.3±8.5 82.6±6.2 87.8±9.4 79.3±11.6 83.9±6.5 82.2±6.3 85.8±5.9 87.2±9.8 85.3±6.9 83.3±6.3 82.7±7.6 84.4±7.8 90.4±5.8 90.5±7.0 1113 2 620 71.9±5.2 75.8±5.5 74.8±4.1 73.1±4.6 72.0±3.7 65.8±3.1 70.1±3.2 75.6±4.9 74.6±2.7 72.4±4.9 72.8±4.5 76.2±4.4 74.6±4.2 69.5±3.8 72.5±4.6 71.1±6.9 344 2 109 57.3±6.9 54.0±6.3 55.0±6.0 55.0±8.7 62.1±6.4 58.4±8.2 57.7±3.1 58.1±10.5 55.6±5.0 59.9±5.9 62.0±9.4 61.0±6.2 59.1±7.4 61.5±5.8 58.4±7.6 57.9±4.2 4110 2 111 80.6±2.5 75.9±1.6 76.8±2.1 81.7±1.7 79.6±1.8 78.9±1.1 80.0±1.9 70.0±4.5 74.6±1.9 79.7±2.0 78.0±1.5 77.6±3.6 78.9±1.6 78.1±5.1 81.0±1.8 81.4±2.2 12k Reg. 37 0.387±0.019 0.367±0.011 0.384±0.007 0.387±0.015 0.474±0.001 0.359±0.014 0.323±0.013 0.696±0.007 0.507±0.003 0.243±0.005 0.243±0.010 0.244±0.011 0.255±0.010 0.274±0.011 0.213±0.016 0.211±0.010 be very effective on many datasets. In general, sparse local positional encoding seems to be useful for our prediction tasks, which tempers the answer to Q1. In this paragraph, we Comparison of structure encoding schemes in node features. compare different ways of injecting graph structures to the vanilla transformer, including Laplacian PE [Dwivedi and Bresson, 2021] and unsupervised GCKN-path features [Chen et al., 2020]. We observe that incorporating topological structures directly into the features of input nodes is a very useful strategy for vanilla transformers. This yields significant performance improvement on almost all datasets except PROTEINS, by either using the Laplacian PE or GCKN-path features. Among them, GCKN features are observed to outperform Laplacian PE by a large margin, except on MUTAG and PROTEINS (third column of Table 3.2). A possible reason for this exception is that PROTEINS seems to be very specific, such that prediction models do not really benefit from encoding positional information. In particular, GCKN brings a pronounced performance boost on ZINC, suggesting the importance of encoding substructures like paths for prediction tasks on molecules. Combining relative position encoding and structure encoding in node features. Table 3.2 reports the ablation study of the transformer used with or without structure encoding and coupled or not with a relative positional encoding. The results show that relative PE outperforms the topological Laplacian PE, suggesting a positive answer to Q2. However, using both simultaneously improves the results considerably, especially on ZINC. In fact, combining relative position encoding and a structure encoding scheme globally improves the performances. In particular, using the GCKN-path layer features works remarkably well for all datasets except PROTEINS. More precisely, we see that the combination of GCKN with the adjacent matrix PE yields the best results among the other combinations for MUTAG and NCI1. In addition, the GCKN coupled with the 3-step RW kernel achieves the second best performance for ZINC. 52 Table 3.2: Ablation: comparison of different structural encoding schemes and their combinations. Dataset MUTAG PROTEINS PTC NCI1 ZINC Structure encoding in node features None LapPE GCKN None LapPE GCKN None LapPE GCKN None LapPE GCKN None LapPE GCKN T vanilla 82.2±6.3 85.8±5.9 84.4±7.8 75.6±4.9 74.6±2.7 69.5±3.8 58.1±10.5 55.6±5.0 61.5±5.8 70.0±4.5 74.6±1.9 78.1±5.1 0.696±0.007 0.507±0.003 0.274±0.011 Relative positional encoding in attention scores T + 2-step T + 3-step T + Adj 87.2±9.8 86.0±4.2 90.5±7.0 72.4±4.9 74.7±5.2 71.1±6.9 59.9±5.9 57.1±3.8 57.9±4.2 79.7±2.0 78.7±1.9 81.4±2.2 0.243±0.005 0.202±0.011 0.211±0.010 85.3±6.9 84.7±4.7 90.4±5.8 72.8±4.5 75.0±4.7 72.5±4.6 62.0±9.4 58.8±6.6 58.4±7.6 78.0±1.5 78.4±1.3 81.0±1.8 0.243±0.010 0.227±0.030 0.213±0.016 83.3±6.3 83.5±5.2 90.0±6.3 76.2±4.4 74.3±5.3 70.0±5.1 61.0±6.2 57.1±5.3 55.2±8.8 77.6±3.6 78.7±1.5 81.0±1.8 0.244±0.011 0.210±0.003 0.203±0.011 T + Diffusion 82.7±7.6 84.2±7.2 90.0±6.8 74.6±4.2 74.7±5.3 72.4±4.9 59.1±7.4 57.3±7.8 55.9±8.1 78.9±1.6 77.8±1.0 81.0±2.0 0.255±0.010 0.221±0.038 0.218±0.006 The answer to Q3 is therefore combining a structure encoding scheme in node features, such as GCKN, with relative positional encoding. Discussion. Combining transformer and GCKN features results in substantial improvement over the simple sum or mean global pooling used in original GCKN models on ZINC dataset as shown in Table 3.1, which suggests that transformers can be considered as a very effective method for aggregating local substructure features on large datasets at the cost of using much more parameters. This point of view has also been explored in the previous chapter, which introduces a different form of attention for sequence and text classification. A potential limitation of GraphiT is its application to large graphs, as the complexity of the self-attention mechanism scales quadratically with the size of the input sequence. However, and as mentionned in Chapter 2, a recent line of work coined as efficient transformers alleviated these issues both in terms of memory and computational cost and we refer the reader to the following survey [Tay et al., 2020]. 3.5.3 Visualizing attention scores for the Mutagenicity dataset. We now show that the attention yields visualization mechanisms for detecting important graph motifs. In chemistry, a mutagen is a compound that causes genetic mutations. This Mutagenicity. important property is related to the molecular substructures of the compound. The Mutagenicity dataset [Kersting et al., 2016] contains 4337 molecules to be classified as mutagen or not, and aims at better understanding which substructures cause mutagenicity. We train GraphiT with diffusion position encoding on this dataset with the aim to study whether important substructures can be detected. To this end, we feed the model with molecules of the dataset and collect the attention scores of each layer averaged by heads, as can be seen in Figure 3.4 for the molecules of Figure 3.3. 53 (a) Nitrothiopheneamide-methylbenzene (b) Aminofluoranthene Figure 3.3: Examples of molecules from Mutagenicity correctly classified as mutagenetic by our model. 54 COHNS01234567891011121314151617181920212223242526270123456789101112131415161718192021222324252627 Figure 3.4: Attention scores averaged by heads for each layer of our trained model for the compounds in Figures 3.3a (Left) and 3.3b (Right). Top Left: diffusion kernel for 3.3a. Bottom Left: node 8 (N of NO2) is salient. Top Right: diffusion kernel for 3.3b. Bottom Right: node 14 (N of NH2) is salient. 55 0510152025051015202505101520250510152025Layer 10510152025051015202505101520250510152025Layer 10510152025051015202505101520250510152025Layer 20510152025051015202505101520250510152025Layer 205101520250510152025NNLayer 305101520250510152025NNLayer 3 Attention scores interpretation. While the scores in the first layer are close to the diffusion kernel, the following layers get sparser. Since the attention matrix is multiplied on the right by the values, the coefficients of the node aggregation step for the n-th node is given by the n-th row of the attention matrix. As a consequence, salient columns suggest the presence of important nodes. After verification, for many samples of Mutagenicity fed to our model, salient atoms indeed represent important groups in chemistry, many of them being known for causing mutagenicity. In compound 3.3a, the N atom of the nitro group Nitrothiopheneamide-methylbenzene. (NO2) is salient. 3.3a was correctly classified as a mutagen by our model and the nitro group is indeed known for its mutagenetic properties [Chung et al., 1996]. Note how information flows from O atoms to N in the first two layers and then, at the last layer, how every element of the carbon skeleton look at N, i.e the NO2 group. Aminofluoranthene. We can apply the same reasoning for the amino group (NH2) in compound 3.3b [Berry et al., 1985]. We were also able to identify long-range intramolecular hydrogen bounds such as between H and Cl in other samples. 1,2-Dibromo-3-Chloropropane (DBCP). DBCP in Figure 3.5a was used as a soil fumi- gant in various countries. It was banned from use in the United Stated in 1979 after evidences that DBCP causes diseases, male sterility, or blindness, which can be instances of mutagenicity. In Figure 3.6, attention focuses on the carbon skeleton and on the two Bromine (Br) atoms, the latter being indeed known for being associated with mutagenicity [Låg et al., 1994]. Nitrobenzene-nitroimidazothiazole. This compound is shown in Figure 3.5b. As for compound 3.3a in Section 3.5.3, our model puts emphasis on two nitro groups which are indeed known for inducing mutagenicity. Triethylenemelamine. Triethylenemelamine in Figure 3.7 is a compound exhibiting mu- tagenic properties, and is used to induce cancer in experimental animal models. Our model focuses on the three nitrogen atoms of the aziridine groups which are themselves mutagenic compounds. 56 (a) 1,2-Dibromo-3-Chloropropane. (b) Nitrobenzene-nitroimidazothiazole. 57 COClHNBrS012345678910012345678910111213141516171819202122232425 Figure 3.6: Attention scores averaged by heads for each layer of our trained model for the compounds in Figure 3.5a and Figure 3.5b. Top Left: diffusion kernel for 3.5a. Bottom Left: node 3 and 5 (Br) are salient. Top Right: diffusion kernel for 3.5b. Bottom Right: node 5 and 17 (N) are salient. 58 0246810024681002468100246810Layer 10510152025051015202505101520250510152025Layer 10246810024681002468100246810Layer 20510152025051015202505101520250510152025Layer 202468100246810BrBrBrBrLayer 305101520250510152025NNNNLayer 3 Figure 3.7: Triethylenemelamine. 59 COClHNBrS01234567891011121314151617181920212223242526 Figure 3.8: Attention scores averaged by heads for each layer of our trained model for the compound in Figure 3.7. Left: diffusion kernel for 3.7. Right: node 1, 8, and 10 (N) are salient. 60 0510152025051015202505101520250510152025Layer 10510152025051015202505101520250510152025Layer 205101520250510152025NNNNNNLayer 3 3.6 Remark on Generalized Self-attention Tsai et al. [2019] shown that it is actually possible to rewrite self-attention as a kernel smoothing. Kernel smoothing is a solution to the problem of estimating the value of an unknown function for a new input, given the values of the function for some inputs. It consists in outputting a weighted average of the known values, with weights reflecting the similarity between the new sample and the known samples. If we consider the self-attention output for one member of the feature map: Attention(Q, K, V )i = = n X j=1 n X j=1 exp (cid:19) (cid:18) QiK> j√ dout (cid:18) QiK> j0 √ dout exp Pn j0=1 (cid:19) Vj ∈ Rdout k(i, j) j0=1 k(i, j) v(Xj) ∈ Rdout, Pn with Qi = WQXi, Kj = WKXj, v(Xj) = WV Xj. When k is a non-negative kernel function between a pair (i, j), we indeed get a kernel smoothing. In the vanilla transformer [Vaswani et al., 2017], we have: k(i, j) = exp QiK> j√ dout ! . However, different choices for k suggest different transformers architectures. In this chapter, our similarity function was: k(i, j) = exp ! QiK> j√ dout × Kr(i, j), with a first term based on the nodes contents similarity, and a second term based on the nodes structural similarity. Tsai et al. [2019] show that splitting the attention into such terms can be related to relative positional encoding Shaw et al. [2018]. The method introduced in the previous chapter can also be derived from this approach. Indeed, we replaced the attention weights (after the softmax) by the corresponding entries in the optimal transport plan P (which are normalized by design). More generally, inductive bias can be injected into the transformer architecture via an appropriate choice of the similarity function k(i, j). 3.7 Conclusion In this work, we show that using a transformer to aggregate local substructures with appropriate position encoding, GraphiT, is a very effective strategy for graph representation, and that attention scores allow simple model interpretation. Here, the role of inductive bias is twofold: first, the choice of the kernel for comparing the position of the nodes can depend on the properties we expect from the graphs. When long range interactions are expected, kernels on the graph with higher characteristic length should be more appropriate. Second, we also augment the node features with kernel methods for representing the extended neighborhood of a given node: this reflects the assumption that the meaning of a node depends on its neighborhood. 61 On a different note, transformers for graphs also reflect a different inductive bias compared to GNNs: not only neighbors but all nodes should communicate. One of the reasons for the success of transformers lies in their scaling properties: in language modeling for example, it has been shown that for an equal large amount of data, the transformer's loss follows a faster decreasing power law than Long-Short-Term-Memory networks when the size of the model increases [Kaplan et al., 2020]. We believe that an interesting future direction for this work would be to evaluate if GNNs and GraphiT also scale similarly in the context of large self-supervised pre-training, and can achieve a similar success as in natural language processing. 62 Appendix 3.8 Experimental Details In this section, we provide implementation details and additional experimental results. 3.8.1 General Details. Computing infrastructure. Computations were done on a GPU cluster equipped with Tesla V100-16G and Tesla V100-32G. We have monitored precisely the entire computational cost of this research project (including preliminary experiments, designing early and final models, evaluating baselines, running final experiments), which was approximately 20k GPU hours. Position encoding and structure encoding parameters for all datasets. γ for p-step random walk kernels is fixed to 0.5 for both 2- and 3-step random walk kernels. β for the diffusion kernel is fixed to 1.0. Regarding the structure encoding in node features, the dimension of Laplacian positional encoding is set to 8 for ZINC as suggested by Dwivedi and Bresson [2021] and to 2 for graph classification datasets. The path size, the filter number and the bandwidth parameter of the unsupervised GCKN path features (used for structure encoding) are set to 8, 32 and 0.6 respectively for the ZINC dataset whereas the path size is set to 5 for graph classification datasets. Other details. For all instances of GraphiT, the hidden dimensions of the feed-forward hidden layer in each layer of the encoder are fixed to twice of the dimensions of the attention. 3.8.2 Graph Classification Datasets Here, we provide experimental details for MUTAG, PROTEINS, PTC, NCI1 and Mutagenicity datasets. Datasets. These free datasets were collected by Kersting et al. [2016] for academic purpose. MUTAG consists in classifying molecules into mutagenetic or not. PROTEINS consists in classifying proteins into enzymes and non-enzymes. PTC consists in classifying molecules into carcinogenetic or not. NCI1 consists in classifying molecules into positive or negative to cell lung cancer. Mutagenicity consists in classifying compounds into mutagenetic or not. Training splits. For MUTAG, PROTEINS, PTC and NCI1, our outer splits correspond to the splits used in Xu et al. [2019]. Our inner splits that divide their train splits into our train and validation splits are provided in our code. The error bars are computed as the standard deviation of the test accuracies across the 10 outer folds. On the other side, as the purpose of using Mutagenicity is model interpretation, we use simple train, validation and test splits respectively composed of 80%, 10%, and 10% of the whole dataset. 63 Table 3.3: Parameter grid for GNNs trained on MUTAG, PROTEINS, PTC, NCI1. Parameter Grid Layers Hidden dimension Global pooling Learning rate Weight decay [1, 2, 3] [64, 128, 256] [sum, max, mean] [0.1, 0.01, 0.001] [0.1, 0.01, 0.001] Table 3.4: Parameter grid for GCKN trained on MUTAG, PROTEINS, PTC, NCI1. Parameter Grid Path size Hidden dimension Sigma Global pooling Learning rate Weight decay [3, 5, 7] [16, 32, 64] [0.5] [sum, max, mean] [0.001] [0.01, 0.001, 0.0001] Hyperparameter choices. For smaller datasets (MUTAG, PTC, PROTEINS), we use the search grids in Table 3.3 for GNNs, the search grids in Table 3.4 for GCKN and the search grids in Table 3.5 for both GraphiT and the transformer model of Dwivedi and Bresson [2021]. For bigger datasets (NCI1), we use the search grid in Table 3.3 for GNNs, the search grids in Table 3.4 for GCKN and the search grids in Table 3.6 for both GraphiT and the transformer model of Dwivedi and Bresson [2021]. The best models are selected based on the validation scores that are computed as the average of the validation scores over the last 50 epochs. Then, the selected model is retrained on train plus validation sets and the average of the test scores over the last 50 epochs is reported. For Mutagenicity, we train a GraphiT model with 3 layers, 4 heads, 64 hidden dimensions. Initial learning rate was set to 1e-3, weight-decay was fixed to 1e-4 and structural information was encoded only via relative position encoding with the diffusion kernel. Optimization. We use the cross-entropy loss and Adam optimizer with batch size 128 for GNNs and 32 for both GraphiT and the transformer model of Dwivedi and Bresson [2021]. For transformers, we do not observe significant improvement using warm-up strategies on these classification tasks. Thus, we simply follow a scheduler that halves the learning rate after every 50 epochs, as for GNNs. All models are trained for 300 epochs. Table 3.5: Parameter grid for transformers trained on MUTAG, PROTEINS, PTC. Parameter Grid Layers Hidden dimension Heads Learning rate Weight decay [1, 2, 3] [32, 64, 128] [1, 4, 8] [0.001] [0.01, 0.001, 0.0001] 64 Table 3.6: Parameter grid for transformers trained on NCI1. Parameter Grid Layers Hidden dimension Heads Learning rate Weight decay [2, 3, 4] [64, 128, 256] [1, 4, 8] [0.001] [0.01, 0.001, 0.0001] 3.8.3 Graph Regression Dataset Here, we present experimental details and additional experimental results for ZINC dataset. Dataset. ZINC is a free dataset consisting of 250k compounds and the task is to predict the constrained solubility of the compounds, formulated as a graph property regression problem. This problem is crucial for designing generative models for molecules. Each molecular graph in ZINC has the type of heavy atoms as node features (represented by a binary vector using one-hot encoding) and the type of bonds between atoms as edge features. In order to focus on the exploitation of the topological structures of the graphs, we omitted the edge features in our experiments. They could possibly be incorporated into GraphiT through the approach of Dwivedi and Bresson [2021] or considering different kernels on graph for each edge bond type, which is left for future work. Training splits. Following Dwivedi and Bresson [2021], we use a subset of the ZINC dataset composed of respectively 10k, 1k and 1k graphs for train, validation and test split. The error bars are computed as the standard deviation of test accuracies across 4 different runs. In order to make fair comparisons with the most relevant work Hyperparameter choice. Dwivedi and Bresson [2021], we use the same number of layers, number of heads and hidden dimensions, namely 10, 8 and 64. The number of model parameters for our transformers is only 2/3 of that of Dwivedi and Bresson [2021] as we use a symmetric variant for the attention score function in (3.5). Regarding the GNNs, we use the values reported in Dwivedi and Bresson [2021] for GIN, GAT and GCN. In addition, we use the same grid to train the MF model [Duvenaud et al., 2015], i.e., a learning rate starting at 0.001, two numbers of layers (4 and 16) and the hidden dimension equal to 145. Regarding the GCKN-subtree model, we use the same hidden dimension as GNNs, that is 145. We fix the bandwidth parameter to 0.5 and the path size is fixed to 10. We select the global pooling form max, mean, sum and weight decay from 0.001, 0.0001 and 1e-5, similar to the search grid used in Dwivedi and Bresson [2021]. Optimization. Following Dwivedi and Bresson [2021], we use the L1 loss and the Adam optimization method with batch size of 128 for training. Regarding the scheduling of the learning rate, we observe that a standard warm-up strategy used in Vaswani et al. [2017] leads to more stable convergence for larger models (hidden dimension equal to 128). We therefore adopt this strategy throughout the experiments with a warm-up of 2000 iteration steps. 65 Table 3.7: Mean absolute error for regression problem ZINC. The results are computed from 4 different runs following [Dwivedi and Bresson, 2021]. Relative PE in attention score Structural encoding in node features None LapPE GCKN (p=8,d=32) Dwivedi and Bresson [2021] 0.3585±0.0144 0.3233±0.0126 - Transformers with d=64 T T + Adj PE T + 2-step RW kernel T + 3-step RW kernel T + diffusion Setting diagonal to zero, d=64 T T + 2-step T + 3-step T + diffusion Larger models with d=128 T T + Adj PE T + 2-step RW kernel T + 3-step RW kernel T + diffusion Setting diagonal to zero, d=128 0.6964±0.0067 0.5065±0.0025 0.2432±0.0046 0.2020±0.0112 0.2272±0.0303 0.2429±0.0096 0.2099±0.0027 0.2435±0.0111 0.2209±0.0038 0.2548±0.0102 0.2741±0.0112 0.2106±0.0104 0.2133±0.0161 0.2028±0.0113 0.2180±0.0055 0.7041±0.0044 0.2427±0.0053 0.2451±0.0043 0.2468±0.0061 0.5123±0.0232 0.2108±0.0072 0.2054±0.0072 0.2027±0.0084 0.2735±0.0046 0.2176±0.0430 0.1986±0.0091 0.1967±0.0023 0.7044±0.0061 0.4965±0.0338 0.2310±0.0072 0.1911±0.0094 0.2005±0.0064 0.2759±0.0735 0.2044±0.0058 0.2501±0.0328 0.2116±0.0103 0.2371±0.0040 0.2776±0.0084 0.2055±0.0062 0.2136±0.0062 0.2128±0.0069 0.2238±0.0068 T T + 2-step T + 3-step T + diffusion 0.4964±0.0340 0.7044±0.0061 0.2012±0.0038 0.2348±0.0010 0.2402±0.0056 0.2031±0.0076 0.2351±0.0121 0.1985±0.0032 0.2721±0.0099 0.2031±0.0083 0.2019±0.0084 0.2019±0.0018 Additional results. Besides the relatively small models presented in Table 3.1, we also show in Table 3.7 the performance of larger models with 128 hidden dimensions. Increasing the number of hidden dimensions generally results in boosting performance, especially for transformer variants combined with Laplacian positional encoding in node features. While sparse local positional encoding is shown to be more useful compared to the positional encoding with a diffusion kernel, we show here that a variant of diffusion kernel positional encoding outperforms all other sparse local positional encoding schemes. Since the skip-connection in transformers already assigns some weight to each node itself and the diagonal of our kernels on graphs also have important weight, we considered setting these diagonal to zero in order to remove the effect of the attention scores on self-loop. This modification leads to considerable performance improvement on longer range relative positional encoding schemes, especially for the transformer with diffusion kernel positional encoding combined with GCKN in node features, which results in best performance. 66 Chapter 4 Sample Screening in Empirical Risk Minimization In this chapter, we design simple screening tests to automatically discard data samples in empirical risk minimization without losing optimization guarantees. We derive loss functions that produce dual objectives with a sparse solution. We also show how to regularize convex losses to ensure such a dual sparsity-inducing property, and propose a general method to design screening tests for classification or regression based on ellipsoidal approximations of the optimal set. In addition to producing computational gains, our approach also allows us to compress a dataset into a subset of representative points. This chapter is based on the following material: - G. Mialon, A. d'Aspremont, J. Mairal. "Screening Data Points in Empirical Risk Minimization via Ellipsoidal Regions and Safe Loss Functions" (AISTATS, 2020). 4.1 Introduction Let us consider a collection of n pairs (ai, bi)i=1,...,n, where each vector ai in Rp describes a data point and bi is its label. For regression, bi is real-valued, and we address the convex optimization problem min x∈Rp,t∈Rn f (t) + λR(x) s.t. t = Ax − b, (P1) where A = [a1, . . . , an]> in Rn×p carries the feature vectors, and b = [b1, . . . , bn] carries the labels. The function f is a convex loss and measures the fit between data points and the model, and R is a convex regularization function. For classification, the scalars bi are binary labels in {−1, +1}, and we consider instead of (P1) margin-based loss functions, where our problem becomes min x∈Rp,t∈Rn f (t) + λR(x) s.t. t = diag(b)Ax, (P2) The above problems cover a wide variety of formulations such as Lasso [Tibshirani, 1996] and its variants [Zou and Hastie, 2005], logistic regression, support vector machines [Friedman et al., 67 2001], and many more. When R is the '1-norm, the solution is encouraged to be sparse [Bach et al., 2012], which can be exploited to speed-up optimization procedures. A recent line of work has focused on screening tests that seek to automatically discard variables before running an optimization algorithm. For example, El Ghaoui et al. [2010] derive a screening rule from Karush-Kuhn-Tucker conditions, noting that if a dual optimal variable satisfies a given inequality constraint, the corresponding primal optimal variable must be zero. Checking this condition on a set that is known to contain the optimal dual variable ensures that the corresponding primal variable can be safely removed. This prunes out irrelevant features before solving the problem. This is called a safe rule if it discards variables that are guaranteed to be useless; but it is possible to relax the "safety" of the rules [Tibshirani et al., 2012] without losing too much accuracy in practice. The seminal approach by El Ghaoui et al. [2010] has led to a series of works proposing refined tests [Dai and Pelckmans, 2012, Wang et al., 2013a] or dynamic rules [Fercoq et al., 2015] for the Lasso, where screening is performed as the optimization algorithm proceeds, significantly speeding up convergence. Other papers have proposed screening rules for sparse logistic regression [Wang et al., 2014] or other linear models. Whereas the goal of these previous methods is to remove variables, our goal is to design screening tests for data points in order to remove observations that do not contribute to the final model. The problem is important when there is a large amount of "trivial" observations that are useless for learning. This typically occurs in tracking or anomaly detection applications, where a classical heuristic seeks to mine the data to find difficult examples [Felzenszwalb et al., 2009]. A few of such screening tests for data points have been proposed in the literature. Some are problem-specific (e.g. Ogawa et al. [2014] for SVM), others are making strong assumptions on the objective. For instance, the most general rule of Shibagaki et al. [2016] for classification requires strong convexity and the ability to compute a duality gap in closed form. The goal of our work is to provide a more generic approach for screening data samples, both for regression and classification. Such screening tests may be designed for loss functions that induce a sparse dual solution. We describe this class of loss functions and investigate a regularization mechanism that ensures that the loss enjoys such a property. Contributions. Our contributions can be summarized as follows: - We revisit the Ellipsoid method [Bland et al., 1981] to design screening test for samples, when the objective is convex and its dual admits a sparse solution. - We propose a new regularization mechanism to design regression or classification losses that induce sparsity in the dual. This allows us to recover existing loss functions and to discover new ones with sparsity-inducing properties in the dual. - Originally designed for linear models, we extend our screening rules to kernel methods. Unlike the existing literature, our method also works for non strongly convex objectives. - We demonstrate the benefits of our screening rules in various numerical experiments on large-scale classification problems and regression1. 1Our code is available at https://github.com/GregoireMialon/screening_samples. 68 4.2 Preliminaries We now present the key concepts used in this chapter. 4.2.1 Fenchel Conjugacy Definition 4.2.1 (Fenchel conjugate). Let f : Rp → R ∪ {−∞, +∞} be an extended real-valued function. The Fenchel conjugate of f is defined by f ∗(y) = max t∈Rp ht, yi − f (t). The biconjugate of f is naturally the conjugate of f ∗ and is denoted by f ∗∗. The Fenchel- Moreau theorem [Hiriart-Urruty and Lemaréchal, 1993] states that if f is proper, lower semi- continuous and convex, then it is equal to its biconjugate f ∗∗. Finally, Fenchel-Young's inequality gives for all pair (t, y) f (t) + f ∗(y) ≥ ht, yi, with an equality case iff y ∈ ∂f (t). Suppose now that for such a function f , we add a convex term Ω to f ∗ in the definition of the biconjugate. We get a modified biconjugate fμ, written fμ(t) = max y∈Rp = max y∈Rp hy, ti − f ∗(y) − μΩ(y) hy, ti + min z∈Rp {−hz, yi + f (z)} − μΩ(y). The inner objective function is continuous, concave in y and convex in z, such that we can switch min and max according to Von Neumann's minimax theorem to get fμ(t) = min z∈Rp f (z) + max y∈Rp {ht − z, yi − μΩ(y)} = min z∈Rp f (z) + μΩ∗ (cid:18) t − z μ (cid:19) . Definition 4.2.2 (Infimum convolution). fμ is called the infimum convolution of f and Ω∗, which may be written as f (cid:3) Ω∗. Note that fμ is convex as the minimum of a convex function in (t, z). We recover the Moreau- Yosida smoothing [Moreau, 1962, Yosida, 1980] and its generalization when Ω is respectively a quadratic term or a strongly-convex term [Nesterov, 2005]. 4.2.2 Empirical Risk Minimization and Duality Let us consider the convex ERM problem min x∈Rp P (x) = 1 n X n fi(a> i x) + λR(x), (4.1) i=1 which covers both (P1) and (P2) by using the appropriate definition of function fi. We consider the dual problem (obtained from Lagrange duality) max ν∈Rn D(ν) = 1 n n X i=1 −f ∗ i (νi) − λR∗ ! . − A>ν λn (4.2) We always have P (x) ≥ D(ν). Since there exists a pair (x, t) such that Ax = t (Slater's conditions), we have P (x?) = D(ν?) and x? = − A>ν? λn at the optimum. 69 4.2.3 Safe Loss Functions and Sparsity in the Dual of ERM Formulations A key feature of our losses is to encourage sparsity of dual solutions, which typically emerge from loss functions with a flat region. We call such functions "safe losses" since they will allow us to design safe screening tests. Definition 4.2.3 (Safe loss function). Let f : R → R be a continuous convex loss function such that inf t∈R f (t) = 0. We say that f is a safe loss if there exists a non-singleton and non-empty interval I ⊂ R such that t ∈ I =⇒ f (t) = 0. Lemma 4.2.4 (Dual sparsity). Consider the problem (4.1) where R is a convex penalty. Denoting by x? and ν? the optimal primal and dual variables respectively, we have for all i = 1, . . . , n, The proof can be found in Appendix 4.7. i ∈ ∂fi(a> ν? i x?). Remark 4.2.5 (Safe loss and dual sparsity). A consequence of this lemma is that for both classification and regression, the sparsity of the dual solution is related to loss functions that (t). This is the case for safe loss functions defined have "flat" regions-that is, such that 0 ∈ ∂f 0 i above. The relation between flat losses and sparse dual solutions is classical, see Steinwart [2004], Blondel et al. [2019]. 4.3 Safe Rules for Screening Samples In this section, we derive screening rules in the spirit of SAFE [El Ghaoui et al., 2010] to select data points in regression or classification problems with safe losses. 4.3.1 Principle of SAFE Rules for Data Points We recall that our goal is to safely delete data points prior to optimization, that is, we want to train the model on a subset of the original dataset while still getting the same optimal solution as a model trained on the whole dataset. This amounts to identifying beforehand which dual variables are zero at the optimum. Indeed, as discussed in Section 4.2.2, the optimal primal variable x? = − A>ν? only relies on non-zero entries of ν?. To that effect, we make the following λn assumption: Assumption 4.3.1 (Safe loss assumption). We consider problem (4.1), where each fi is a safe loss function. Specifically, we assume that fi(a> i x − bi) for regression, or fi(a> i x) for classification, where φ satisfies Definition 4.2.3 on some interval I. For simplicity, we assume that there exists μ > 0 such that I = [−μ, μ] for regression losses and I = [μ, +∞) for classification, which covers most useful cases. i x) = φ(bia> i x) = φ(a> We may now state the basic safe rule for screening. Lemma 4.3.2 (SAFE rule). Under Assumption 4.3.1, consider a subset X containing the i x − bi ∈ ̊I for all x in X , (resp. optimal solution x?. If, for a given data point (ai, bi), a> i x ∈ ̊I), where ̊I is the interior of I, then this data point can be discarded from the dataset. bia> 70 Proof. From the definition of safe loss functions, fi is differentiable at a> 0. i x? with ν? i = f 0 i (a> i x) = We see now how the safe screening rule can be interpreted in terms of discrepancy between the model prediction a> i x and the true label bi. If, for a set X containing the optimal solution x∗ and a given data point (ai, bi), the prediction always lies in ̊I, then the data point can be discarded from the dataset. The data point screening procedure therefore consists in maximizing i x in classification), linear forms, a> over a set X containing x∗ and check whether they are lower (resp. greater) than the threshold μ. The smaller X , the lower the maximum (resp. the higher the minimum) hence the more data points we can hope to safely delete. Finding a good test region X is critical however. We show how to do this in the next section. i x + bi in regression (resp. minimizing bia> i x − bi and −a> 4.3.2 Building the Test Region X Screening rules aim at sparing computing resources, testing a data point should therefore be easy. As in El Ghaoui et al. [2010] for screening variables, if X is an ellipsoid, the optimization problem detailed above admits a closed-form solution. Furthermore, it is possible to get a smaller set X by adding a first order optimality condition with a subgradient g of the objective evaluated in the center z of this ellipsoid. This linear constraint cuts the final ellipsoid roughly in half thus reducing its volume. Lemma 4.3.3 (Closed-form screening test). Consider the optimization problem i x − bi maximize a> subject to (x − z)>E−1(x − z) ≤ 1 gT (x − z) ≤ 0 (4.3) in the variable x in Rp with E defining an ellipsoid with center z and g is in Rp. Then the maximum is   (cid:16) i z + (a> a> z + 1 a> i i Eai) 1 2γ E(ai − νg)(cid:17)  (ai − νg)>E(ai − νg)(cid:17) 1 2 . 2 − bi if g>Eai < 0 − bi otherwise, with ν = g>Eai g>Eg and γ = (cid:16) 1 2 The proof can be found in Appendix 4.7 and it is easy to modify it for minimizing bia> i x. We can obtain both E and z by using a few steps of the ellipsoid method [Nemirovskii and Yudin, 1979, Bland et al., 1981]. This first-order optimization method starts from an initial ellipsoid containing the solution x∗ to a given convex problem (here 4.1) . It iteratively computes a subgradient in the center of the current ellipsoid, selects the half-ellipsoid containing x∗, and computes the ellipsoid with minimal volume containing the previous half-ellipsoid before starting all over again. Such a method, presented in Algorithm 1, performs closed-form updates of the ellipsoid. It requires O(p2 log( RL )) iterations for a precision (cid:15) starting from a ball of (cid:15) radius R with the Lipschitz bound L on the loss, thus making it impractical for accurately solving high-dimensional problems. Finally, the ellipsoid update formula was also used to screen primal variables for the Lasso problem [Dai and Pelckmans, 2012], although not iterating over ellipsoids in order to get smaller volumes. 71 E k+1 E k g ∈ −∂f (xk) xk Figure 4.1: One step of the ellipsoid method. Algorithm 1 Building ellipsoidal test regions 1: initialization: Given E 0(x0, E0) containing x∗; 2: while k < nbsteps do 3: • Compute a subgradient g of (4.1) in xk; • ̃g ← g/pg>Ekg; • xk+1 ← xk − 1 • Ek+1 ← p2 p2−1 p+1 Ek ̃g; (Ek − 2 p+1 Ek ̃g ̃g>Ek); 4: 5: 6: 7: end while 8: For regression problems: 9: for each sample ai in A do 10: if max|a> 11: Discard ai from A. i x − bi| ≤ μ for x ∈ E nbsteps then end if 12: 13: end for 14: For classification, replace condition |a> i x − bi| ≤ μ by bia> i x ≥ μ in the above expression. 72 Initialization. The algorithm requires an initial ellipsoid E 0(x0, E0) that contains the solution. This is typically achieved by defining the center x0 as an approximate solution of the problem, which can be obtained in various ways. For instance, one may run a few steps of a solver on the whole dataset, or one may consider the solution obtained previously for a different regularization parameter when computing a regularization path, or the solution obtained for slightly different data, e.g., for tracking applications where an optimization problem has to be solved at every time step t, with slight modifications from time t − 1. Once the center x0 is defined, there are many cases where the initial ellipsoid can be safely assumed to be a sphere. For instance, if the objective-let us call it F -is κ-strongly convex, we have the basic inequality κ 2 kx0 − x?k2 ≤ F (x0) − F ?, which can often be upper-bounded by several quantities, e.g., a duality gap [Shibagaki et al., 2016] or simply F (x0) if F is non-negative as in typical ERM problems. Otherwise, other strategies can be used depending on the problem at hand. If the problem is not strongly convex but constrained (e.g. often a norm constraint in ERM problems), the initialization is also natural (e.g., a sphere containing the constraint set). We will see below that one of the most successful applications of screening methods is for computing regularization paths. Given that regularization path for penalized and constrained problems coincide (up to minor details), computing the path for a penalized objective amounts to computing it for a constrained objective, whose ellipsoid initialization is safe as explained above. Even though we believe that those cases cover many (or most) problems of interest, it is also reasonable to believe that guessing the order of magnitude of the solution is feasible with simple heuristics, which is what we do for '1-safe logistic regression. Then, it is possible to check a posteriori that screening was safe and that indeed, the initial ellipsoid contained the solution. Efficient implementation. Since each update of the ellipsoid matrix E is rank one, it is possible to parametrize Ek at step k as Ek = skI − LkDkL> k , with I the identity matrix, Lk is in Rp×k and Dk in Rk×k is a diagonal matrix. Hence, we only have to update D and L while the algorithm proceeds. Complexity of our screening rules. For each step of Algorithm 1, we compute a subgra- dient g in O(np) operations. The ellipsoids are modified using rank one updates that can be stored. As a consequence, the computations at this stage are dominated by the computation of Eg, which is O(pk). As a result, k steps cost O(k2p + npk). Once we have the test set X , we have to compute the closed forms from Lemma 4.3.3 for each data point. This computation is dominated by the matrix-vector multiplications with E, which cost O(kp) using the structure of E. Hence, testing the whole dataset costs O(npk). Since we typically have n (cid:29) k, the cost of the overall screening procedure is therefore O(npk). In contrast, solving the ERM problem without screening would cost O(npT ) where T is the number of passes over the data, with T (cid:29) k. With screening, the complexity becomes O(nsT + npk), where s is the number of data points accepted by the screening procedure. 4.3.3 Extension to Kernel Methods It is relatively easy to adapt our safe rules to kernel methods. Consider for example (P1), where A has been replaced by φ(A) = [φ(a1), . . . , φ(an)]> in Hn, with H a RKHS and φ its mapping 73 function Rp → H. The prediction function x : Rp → R lives in the RKHS, thus it can be written x(a) = hx, φ(a)i, ∀a ∈ Rp. In the setting of an ERM strictly increasing with respect to the RKHS norm and each sample loss, the Representer theorem ensures x(a) = Pn i=1 αiK(ai, a) with αi ∈ R and K the kernel associated to H. If we consider the squared RKHS norm as the regularization term, which is typically the case, the problem becomes: min α∈Rn,t∈Rn f (t) + λ n X i,j=1 αiαjK(ai, aj) s.t. t = Kα − b, (4.4) with K the Gram matrix. The constraint is linear in α (thus satisfying to Lemma 4.4.1) while yielding non-linear prediction functions. The screening test becomes maximizing the linear forms [K]iα − bi and −[K]iα + bi over an ellipsoid X containing α∗. When the problem is convex (it depends on K), X can still be found using the ellipsoid method. We now have an algorithm for selecting data points in regression or classification problems with linear or kernel models. As detailed above, the rules require a sparse dual, which is not the case in general except in particular instances such as support vector machines. We now explain how to induce sparsity in the dual. 4.4 Constructing Safe Losses In this section, we introduce a way to induce sparsity in the dual of empirical risk minimization problems. 4.4.1 Inducing Sparsity in the Dual of ERM When the ERM problem does not admit a sparse dual solution, safe screening is not possible. To fix this issue, consider the ERM problem (P1) and replace f by fμ defined in Section 4.2: min x∈Rp,t∈Rn fμ(t) + λR(x) s.t. t = Ax − b, We have the following result connecting the dual of (P1) with that of (P 0 1 ). Lemma 4.4.1 (Regularized dual for regression). The dual of (P 0 1 ) is max ν∈Rn −hb, νi − f ∗(ν) − λR∗ − ! A>ν λ − μΩ(ν), and the dual of (P1) is obtained by setting μ = 0. (P 0 1 ) (4.5) The proof can be found in Appendix 4.7. We remark that is possible, in many cases, to induce sparsity in the dual if Ω is the '1-norm, or another sparsity-inducing penalty. This is notably true if the unregularized dual is smooth with bounded gradients. In such a case, it is possible to show that the optimal dual solution would be ν? = 0 as soon as μ is large enough [Bach et al., 2012]. We consider now the classification problem (P2) and show that the previous remarks about sparsity-inducing regularization for the dual of regression problems also hold in this new context. 74 Lemma 4.4.2 (Regularized dual for classification). Consider now the modified classification problem The dual of P 0 2 is min x∈Rp,t∈Rn fμ(t) + λR(x) s.t. t = diag(b)Ax. max ν∈Rn −f ∗(−ν) − λR∗ ! A> diag(b)ν λ − μΩ(−ν). (P 0 2 ) (4.6) Proof. We proceed as above with a linear constraint ̃A ̃x = 0 and ̃A = (Id, − diag(b)A). Note that the formula directly provides the dual of regression and classification ERM problems with a linear model such as the Lasso and SVM. 4.4.2 Link Between the Original and Regularized Problems The following results should be understood as an indication that f and fμ are similar objectives. Lemma 4.4.3 (Smoothness of fμ). If f ∗ + Ω is strongly convex, then fμ is smooth. Proof. The lemma follows directly from the fact that fμ = (f ∗ + μΩ)∗ (see the proof of Lemma 4.4.1). The conjugate of a closed, proper, strongly convex function is indeed smooth (see e.g. Hiriart-Urruty and Lemaréchal [1993], chapter X). Lemma 4.4.4 (Bounding the value of P1). Let us denote the optimum objectives of P1, P 0 Pλ, Pλ,μ. If Ω is a norm, we have the following inequalities: 1 by with δ∗ the value of δ at the optimum of Pλ(t) − δ(t). Pλ − δ∗ ≤ Pλ,μ ≤ Pλ, The proof can be found in Appendix 4.7. When μ → 0, δ(t) → 0 hence the objectives can be arbitrarily close. 4.4.3 Effect of Regularization and Examples We start by recalling that the infimum convolution is traditionally used for smoothing an objec- tive when Ω is strongly convex, and then we discuss the use of sparsity-inducing regularization in the dual. It is known that convolving the indicator Euclidean distance to a closed convex set. function of a closed convex set C with a quadratic term Ω (the Fenchel conjugate of a quadratic term is itself) yields the euclidean distance to C fμ(t) = min z∈Rn IC(z) + 1 2μ kt − zk2 2 = min z∈C 1 2μ kt − zk2 2. 75 Huber loss. The '1-loss is more robust to outliers than the '2-loss, but is not differentiable in zero which may induce difficulties during the optimization. A natural solution consists in smoothing it: Beck and Teboulle [2012] for example show that applying the Moreau-Yosida 2 t2 yields the well-known Huber loss, which smoothing, i.e convolving |t| with a quadratic term 1 is both smooth and robust: fμ(t) = ( t2 2μ |t| − μ 2 if |t| ≤ μ, otherwise. Now, we present examples where Ω has a sparsity-inducing effect. 2/2 Squared Hinge loss. Let us now consider a problem with a quadratic loss f : t 7→ k1 − tk2 designed for a classification problem, and consider Ω(x) = kxk1 + 1x(cid:22)0. We have Ω∗(y) = 1y(cid:23)−1, and fμ(t) = n X i=1 [1 − ti − μ, 0]2 +, which is a squared Hinge Loss with a threshold parameter μ and [.]+ = max(0, .). Instead of the quadratic loss in the previous example, choose a robust loss Hinge loss. f : t 7→ k1 − tk1. By using the same function Ω, we obtain the classical Hinge loss of support vector machines fμ(t) = [1 − ti − μ, 0]+. n X i=1 1 2 We see that the effect of convolving with the constraint 1x(cid:22)0 is to turn a regression loss (e.g., square loss) into a classification loss. The effect of the '1-norm is to encourage the loss to be flat (when μ grows, [1 − ti − μ, 0]+ is equal to zero for a larger range of values ti), which corresponds to the sparsity-inducing effect in the dual that we will exploit for screening data points. Screening-friendly regression. Consider now the quadratic loss f : t 7→ ktk2/2 and Ω(x) = kxk1. Then Ω∗(y) = 1kyk∞≤1 (see e.g. Bach et al. [2012]), and fμ(t) = n X i=1 1 2 [|ti| − μ]2 +. (4.7) A proof can be found in Appendix 4.7. As before, the parameter μ encourages the loss to be flat (it is exactly 0 when ktk∞ ≤ μ). Screening-friendly logistic regression. Let us now consider the logistic loss f (t) = log (1 + e−t), which we define only with one dimension for simplicity here. It is easy to show that the infimum convolution with the '1-norm does not induce any sparsity in the dual, because the dual of the logistic loss has unbounded gradients, making classical sparsity-inducing penalties ineffective. However, we may consider instead another penalty to fix this issue: Ω(x) = −x log (−x) + μ|x| for x ∈ [−1, 0]. We have Ω∗(y) = −ey+μ−1. Convolving Ω∗ with f yields fμ(x) = (ex+μ−1 − (x + μ) 0 if x + μ − 1 ≤ 0, otherwise. (4.8) 76 Figure 4.2: Effect of the dual sparsity-inducing regularization on the quadratic loss (4.7) (left) and logistic loss (4.8) (right). After regularization, the loss functions have flat areas. Note that both of them are smooth. Note that this loss is asymptotically robust. Moreover, the entropic part of Ω makes this penalty strongly convex hence fμ is smooth [Nesterov, 2005]. Finally, the '1 penalty ensures that the dual is sparse thus making the screening usable. Our regularization mechanism thus builds a smooth, robust classification loss akin to the logistic loss on which we can use screening rules. If μ is well chosen, the safe logistic loss maximizes the log-likelihood of the data for a probabilistic model which slightly differs from the sigmoid in vanilla logistic regression. The effect of regularization parameter in a few previous cases are illustrated in Figure 4.2. In summary, regularizing the dual with the '1 norm induces a flat region in the loss, which induces sparsity in the dual. The geometry is preserved elsewhere. Note that we do not suggest to use P 0 1 to screen for P1 and P2. and P 0 2 4.5 Experiments We now present experimental results demonstrating the effectiveness of the data screening procedure. Datasets. We consider three real datasets, SVHN, MNIST, RCV-1, and a synthetic one. MNIST (n = 60000) and SVHN (n = 604388) both represent digits, which we encode by using the output of a two-layer convolutional kernel network [Mairal, 2016] leading to feature dimensions p = 2304. RCV-1 (n = 781265) represents sparse TF-IDF vectors of categorized newswire stories (p = 47236). For classification, we consider a binary problem consisting of discriminating digit 9 for MNIST vs. all other digits (resp. digit 1 vs rest for SVHN, 1st category vs rest for RCV-1). For regression, we also consider a synthetic dataset, where data is generated by b = Ax + (cid:15), where x is a random, sparse ground truth, A ∈ Rn×p a data matrix with coefficients in [−1, 1] and (cid:15) ∼ N (0, σ) with σ = 0.01. Implementation details are provided in Appendix. We fit usual models using Scikit-learn [Pedregosa et al., 2011] and Cyanure [Mairal, 2019] for large-scale datasets. 4.5.1 Accuracy of our safe logistic loss The accuracies of the Safe Logistic loss we build is similar to the accuracies obtained with the Squared Hinge and the Logistic losses on the datasets we use in this paper thus making it a realistic loss function, see Table 4.1. 77 f(t)fμ(t)μ=0.8μ=0.4f(t)fμ(t)μ=0.6μ=0.1 Dataset MNIST SVHN RCV-1 Logistic + '1 Logistic + '2 Squared Hinge + '1 Squared Hinge + '2 Safelog + '1 Safelog + '2 0.997 (0.01) 0.997 (0.001) 0.99 (0.0003) 0.99 (0.0003) 0.997 (0.03) 0.997 (0.003) 0.99 (0.03) 0.99 (0.003) 0.975 (1.0) 0.975 (1.0) 0.975 (1.0) 0.974 (1.0) 0.996 (0.0) 0.996 (0.0) 0.989 (0.0) 0.989 (0.0) 0.974 (1e-05) 0.975 (1e-05) Table 4.1: Averaged best accuracies on test set (best λ in a logarithmic grid from λ = 0.00001 to 1.0). 4.5.2 Safe Screening Here, we consider problems that naturally admit a sparse dual solution, which allows safe screening. Interval regression. We first illustrate the practical use of the screening-friendly regression loss (4.7) derived above. It corresponds indeed to a particular case of a supervised learning task called interval regression [Hocking et al., 2013], which is widely used in fields such as economics. In interval regression, one does not have scalar labels but intervals Si containing the true labels ̃bi, which are unknown. The loss is written '(x) = n X i=1 inf bi∈Si (a> i x − bi)2, (4.9) where Si contains the true label ̃bi. For a given data point, the model only needs to predict a value inside the interval in order not to be penalized. When the intervals Si have the same width and we are given their centers bi, (4.9) is exactly (4.7). Since (4.7) yields a sparse dual, we can apply our rules to safely discard intervals that are assured to be matched by the optimal solution. We use an '1 penalty along with the loss. As an illustration, the experiment was done using a toy synthetic dataset (n = 20, p = 2), the signal to recover being generated by one feature only. The intervals can be visualized in Figure 4.3. The "difficult" intervals (red) were kept in the training set. The predictions hardly fit these intervals. The "easy" intervals (blue) were discarded from the training set: the safe rules certify that the optimal solution will fit these intervals. Our screening algorithm was run for 20 iterations of the Ellipsoid method. Most intervals can be ruled out afterwards while the remaining ones yield the same optimal solution as a model trained on all the intervals. Classification. Common sample screening methods such as Shibagaki et al. [2016] require a strongly convex objective. When it is not the case, there is, to the best of our knowledge, no baseline for this case. Thus, when considering classification using the non strongly convex safe logistic loss derived in Section 4.4 along with an '1 penalty, our algorithm is still able to screen samples, as shown in Table 4.2. The algorithm is initialized using an approximate solution to the problem, and the radius of the initial ball is chosen depending on the number of epochs (100 for 10 epochs, 10 for 20 and 1 for 30 epochs), which is valid in practice. 78 Figure 4.3: Safe interval regression on synthetic dataset. Most "easy" samples (in blue) can be discarded while the "difficult" ones (in red) are kept. Epochs 20 30 λ 10−3 10−4 10−5 MNIST SVHN RCV-1 MNIST SVHN RCV-1 0 0.3 35 0 0.01 12 1 8 45 0 27 65 2 17 54 12 42 75 Table 4.2: Percentage of samples screened (i.e that can be thrown away) in an '1 penalized Safe Logistic loss given the epochs made at initialization. The radius is initialized respectively at 10 and 1 for MNIST and SVHN at Epochs 20 and 30, and at 1 and 0.1 for RCV-1. Epochs 20 30 λ 1.0 10−1 10−2 10−3 MNIST SVHN MNIST SVHN 89 / 89 95 / 95 16 / 84 0 / 0 87 / 87 11 / 47 0 / 0 0 / 0 89 / 89 95 / 95 98 / 98 34 / 50 87 / 87 91 / 91 90 / 92 0 / 0 Table 4.3: Percentage of samples screened in an '2 penalized SVM with Squared Hinge loss (Ellipsoid (ours) / Duality Gap [Shibagaki et al., 2016]) given the epochs made at initialization. 79 The Squared Hinge loss allows for safe screening (see 4.2.4). Combined with an '2 penalty, the resulting ERM is strongly convex. We can therefore compare our Ellipsoid algorithm to the baseline introduced by Shibagaki et al. [2016], where the safe region is a ball centered in the with ∆ a duality gap of the ERM problem. current iterate of the solution and whose radius is 2∆ λ Both methods are initialized by running the default solver of scikit-learn with a certain number of epochs. The resulting approximate solution and duality gap are subsequently fed into our algorithm for initialization. Then, we perform one more epoch of the duality gap screening algorithm on the one hand, and the corresponding number of ellipsoid steps computed on a subset of the dataset on the other hand, so as to get a fair comparison in terms of data access. The results can be seen in Table 4.3 for MNIST and SVHN, and in Table 4.4 for RCV-1. While being more general (our approach is neither restricted to classification, nor requires strong convexity), our method performs similarly to the baseline. Figure 4.4 highlights the trade-off between optimizing and evaluating the gap (Duality Gap Screening) versus performing one step of Ellipsoid Screening. Both methods start screening after a correct iterate (i.e. with good test accuracy) is obtained by the solver (blue curve) thus suggesting that screening methods would rather be of practical use when computing a regularization path, or when the computing budget is less constrained (e.g. tracking or anomaly detection) which is the object of next paragraph. Epochs 10 20 λ = 1 λ = 10 λ = 100 7 / 84 80 / 80 68 / 68 85 / 85 80 / 80 68 / 68 Table 4.4: RCV-1 : Percentage of samples screened in an '2 penalized SVM with Squared Hinge loss (Ellipsoid (ours) / Duality Gap) given the epochs made at initialization. Computational gains. As demonstrated in Figure 4.5, computational gains can indeed be obtained in a regularization path setting (MNIST features, Squared Hinge Loss and L2 penalty). Each point of both curves represents an estimator fitted for a given lambda against the corresponding cost (in epochs). Each estimator is initialized with the solution to the previous parameter lambda. On the orange curve, the previous solution is also used to initialize a screening. In this case, the estimator is fit on the remaining samples which further accelerates the path computation. 4.5.3 Dataset Compression We now consider the problem of dataset compression, where the goal is to maintain a good accuracy while using less examples from a dataset. This section should be seen as a proof of concept. A natural scheme consists in choosing the samples that have a higher margin since those will carry more information than samples that are easy to fit. In this setting, our screening algorithm can be used for compression by using the scores of the screening test as a way of ranking the samples. In our experiments, and for a given model, we progressively delete data points according to their score in the screening test for this model, before fitting the model on the remaining subsets. We compare those methods to random deletions in the 80 Figure 4.4: Fraction of samples screened vs Epochs done for two screening strategies along with test accuracy of the current iterate (Sq. Hinge + '2 trained on MNIST). Figure 4.5: Regularization path of a Squared Hinge SVM trained on MNIST. The screening enables computational gains compared to a classical regularization path. 81 dataset and to deletions based on the sample margin computed on early approximations of the solution when the loss admits a flat area ("margin screening"). Classification. We first apply our compression scheme in the context of classification, using again MNIST, SVHN, and RCV-1. We test the combinations of the '1 penalty with the safe logistic loss, and the '2 penalty with the squared hinge loss. Our strategy is effective, as can be seen in Figure 4.6. Lasso regression. The Lasso objective combines an '2 loss with an '1 penalty. Since its dual is not sparse, we will instead apply the safe rules offered by the screening-friendly regression loss (4.7) derived in Section 4.4.3 and illustrated in Figure 4.2, combined with an '1 penalty. We can draw an interesting parallel with the SVM, which is naturally sparse in data points. At the optimum, the solution of the SVM can be expressed in terms of data points (the so-called support vectors) that are close to the classification boundary, that is the points that are the most difficult to classify. Our screening rule yields the analog for regression: the points that are easy to predict, i.e. that are close to the regression curve, are less informative than the points that are harder to predict. In our experiments on synthetic data (n = 100), this does consistently better than random subsampling as can be seen in Figure 4.7. Discussion. For all methods, the degradation in performance is lesser than with random deletions. Nevertheless, in the regime where most samples are deleted (beyond 80%), random deletions tend to do better. This is not surprising since the screening deletes the samples that are "easy" to classify. Then, only the difficult ones and outliers remain, making the prediction task harder compared to a random subsampling. 4.6 Conclusion In this chapter, we saw how common losses could be regularized in their dual to yield safe losses. However, adding a regularization term enforcing sparsity in the dual does not always result in a loss with a flat region. For example, we showed in Section 4.4.3 that the logistic loss could not be regularized with the '1 norm only. Thus, it could be insightful to better understand which regularization is needed for which functions to yield safe losses. More generally, the work initiated in Section 4.4.2 to study the link between an ERM problem and its regularized dual could be further pursued. A limit of this work is the size of the screening region X , whose price for being tractable and generic (i.e not requiring strong convexity of the objective) is its high volume, making typical safe screening (i.e deleting samples before solving the ERM problem) too computationally intensive to be beneficial in most problems. Would it be possible to find a region with smaller volume while remaining generic and tractable? Finally, safe screening techniques where introduced in 2010, at a time when machine learning often consisted in working on a dataset on its laptop or working machine. In this context, reducing the size of a dataset in terms of features and/or samples was valuable to fit models with lower running time. The advent of deep learning popularized the use of massive datasets for training models via clusters of computers, thus making screening rules slightly less relevant today. However, and as stated in introduction, screening rules are still of use to speed solvers up, such as for the Lasso [Massias et al., 2018], and may have other surprising applications, such 82 Figure 4.6: Dataset compression in classification. Left: '1 penalty + Safe Logistic loss. Right: '2 penalty + Squared Hinge loss. Top: MNIST. Middle: SVHN. Down: RCV-1. 83 Figure 4.7: Dataset compression for the Lasso trained on a synthetic dataset. The scores given by the screening yield a ranking that is better than random subsampling. as in differential privacy. More precisely, safe losses might be used in the context of black-box membership inference (see for example Sablayrolles et al. [2019] for a more detailed introduction on these problems). In this setting, the parameters of the model are unknown but it is possible to query it. The objective is to guess whether a particular sample was part of the training set. When samples are in the flat region of a safe loss at the optimum, it means that they are non-support, hence can be deleted without modifying the loss or the model. It may therefore be impossible to guess whether such samples have been used for training. In the future, we plan to work on a new notion of differential privacy, where a model would be private for non-support samples and public for the support samples. 84 Appendix 4.7 Proofs. 4.7.1 Proof of Lemma 4.2.4 Proof. At the optimum, P (x∗) − D(ν∗) = 1 n n X i=1 λR(x) + λR∗ − Adding the null term hx, − A>ν n i − hx, − A>ν n i gives fi(a> i x) + f ∗ i (νi)+ ! AT ν λn = 0. 1 n n X i=1 fi(a> | (νi) − a> i x) + f ∗ i {z ≥0 i xνi } + λ R(x) + R∗ − | ! * − x, − +! A>ν λn = 0, } A>ν λn {z ≥0 since Fenchel-Young's inequality states that each term is greater or equal to zero. We have a null sum of non-negative terms; hence, each one of them is equal to zero. We therefore have for each i = 1 . . . n: i x) + f ∗(νi) = a> which corresponds to the equality case in Fenchel-Young's relation, which is equivalent to i ∈ ∂fi(a> ν∗ i x∗). i xνi, f (a> 4.7.2 Proof of Lemma 4.3.3 Proof. The Lagrangian of the problem writes: L(x, ν, γ) = a> i x − bi + ν (cid:16)1 − (x − z)T E−1(x − z)(cid:17) − γgT (x − z), with ν, γ ≥ 0. When maximizing in x, we get: ∂L ∂x = ai + 2ν(E−1z − E−1x) − γ = 0. We have ν > 0 since the opposite leads to a contradiction. This yields x = z + 1 2ν and (x − z)T E−1(x − z) = 1 at the optimum which gives ν = 1 2 (ai − γ)T E(ai − γ). q (Eai − γEg) 85 Now, we have to minimize 1 2ν (cid:18) 1 2ν To do that, we consider the optimality condition g(ν, γ) = ai z + γ> (cid:18) (Eai − γEg) (cid:19) − (Eai − γEg) (cid:19) . ∂g ∂γ = − 1 2ν aiEg − 1 2ν gT Eai + γ ν gT Eg = 0, . If gT Eai < 0 then γ = 0 in order to avoid a contradiction. which yields γ = gT Eai gT Eg In summary, either gT Eai ≤ 0 hence the maximum is attained in x = z + 1 q to aiz + and is equal to ai i Eai − yi, or gT Eai > 0 and the maximum is attained in x = z + 1 aT − bi with ν = 1 2 2ν E(ai − γg)(cid:17) (ai − γ)T E(ai − γ) and γ = gT Eai gT Eg z + 1 q (cid:16) . 2ν Eai and is equal 2ν E(ai − γEg) 4.7.3 Proof of Lemma 4.4.1 Proof. We can write P 0 1 as minimize subject to ̃f ( ̃x) + λ ̃R( ̃x) ̃A ̃x = −b (4.10) in the variable ̃x = (t, x) ∈ Rn+p with ̃f : ̃x 7→ fμ(t) and ̃R : ̃x 7→ R(x) and ̃A ∈ Rn×(n+p) = (Id, −A). Since the constraints are linear, we can directly express the dual of this problem in terms of the Fenchel conjugate of the objective (see e.g. Boyd and Vandenberghe [2004], 5.1.6). Let us note f0 = ̃f + λ ̃R. For all y ∈ Rn+p, we have (y) = sup hx, yi − ̃f (x) − λ ̃R(x) f ∗ 0 = x∈Rn+p sup x1∈Rn,x2∈Rp hx1, y1i + hx2, y2i − f (x1) − λR(x2) = f ∗ μ (y1) + λR∗ (cid:19) . (cid:18) y2 λ It is known from Beck and Teboulle [2012] that fμ = f (cid:3) Ω∗ μ Clearly, Ω∗∗ μ consequence, f ∗ μ f ∗ μ ). = μΩ∗( . μ = μΩ. If Ω is proper, convex and lower semicontinuous, then Ω = Ω∗∗ . As a = (f ∗ + μΩ)∗∗. If f ∗ + μΩ is proper, convex and lower semicontinuous, then = f ∗ + μΩ, hence = (f ∗ + Ω∗∗ μ )∗ with Ω∗ μ f ∗ 0 (y) = f ∗(y1) + λR∗ + μΩ(y1). (cid:19) (cid:18) y2 λ Now we can form the dual of P 0 1 maximize −h−b, νi − f ∗ 0 by writing (4.11) in the variable ν ∈ Rn. Since − ̃AT ν = (−ν, AT ν) with ν ∈ Rn the dual variable associated to the equality constraints, (− ̃AT ν) (− ̃AT ν) = f ∗(−ν) + λR∗ f ∗ 0 ! AT ν λ + μΩ(−ν). Injecting f ∗ 0 in the problem and setting ν instead of −ν (we optimize in R) concludes the proof. 86 4.7.4 Lemma 4.7.1 Lemma 4.7.1 (Bounding fμ). If μ ≥ 0 and Ω is a norm then f (t) − δ(t) ≤ fμ(t) ≤ f (t), for all t ∈ domf with δ(t) = max k u μ k∗≤1 gT u and g ∈ ∂f (t). Proof. If Ω is a norm, then Ω(0) = 0 and Ω∗ is the indicator function of the dual norm of Ω hence non-negative. Moreover, if μ > 0 then, ∀z ∈ domf and ∀t ∈ Rn, fμ(t) ≤ f (z) + μΩ∗ (cid:18) t − z μ (cid:19) . In particular, we can take t = z hence the right-hand inequality. On the other hand, fμ(t) − f (t) = min f (z) + μIk z−t μ k∗≤1 − f (t) z = min k u μ k∗≤1 f (t + u) − f (t). Since f is convex, As a consequence, f (t + u) − f (t) ≥ gT u with g ∈ ∂f (t). fμ(t) − f (t) ≥ min k u μ k∗≤1 gT u. 4.7.5 Proof of Lemma 4.4.4 Proof. The proof is trivial given the inequalities in Lemma 4.7.1. 4.7.6 Proof of Screening-friendly regression Proof. The Fenchel conjugate of a norm is the indicator function of the unit ball of its dual norm, the '∞ ball here. Hence the infimum convolution to solve fμ(x) = min z∈Rn {f (z) + 1kx−zk∞≤μ} (4.12) Since f (x) = 1 2n kxk2 2 , fμ(x) = min z∈Rn 1 2n zT z + 1kx−zk∞≤μ. If we consider the change of variable t = x − z, we get: fμ(x) = min t∈Rn 1 2n kx − tk2 2 + 1ktk∞≤μ. The solution t∗ to this problem is exactly the proximal operator for the indicator function of the infinity ball applied to x. It has a closed form t∗ = prox (x) 1k.k∞≤μ = x − prox(1k.k∞≤μ)∗(x), 87 using Moreau decomposition. We therefore have Hence, t∗ = x − prox (x). μk.k1 fμ(x) = 1 2n kx − t∗k2 2 = 1 2n kprox (x)k2 2. μk.k1 But, prox μk.k1 (t) = sgn(t) × [|t| − μ]+ for t ∈ R, where [x]+ = max(x, 0). 4.8 Additional experimental results. Reproducibility. The data sets did not require any pre-processing except MNIST and SVHN on which exhaustive details can be found in Mairal [2016]. For both regression and classification, the examples were allocated to train and test sets using scikit-learn's train-test-split (80% of the data allocated to the train set). The experiments were run three to ten times (depending on the cost of the computations) and our error bars reflect the standard deviation. For each fraction of points deleted, we fit three to five estimators on the screened dataset and the random subset before averaging the corresponding scores. The optimal parameters for the linear models were found using a simple grid-search. 88 Chapter 5 Conclusion and Future Work 5.1 Conclusion In this thesis, we showed how inductive biases could be integrated into Main conclusions. models using kernel methods. In the context of sets of features, and starting from the optimal transport kernel between two sets of features, which is interpretable, it is possible to derive an embedding which is reminiscent of transformers [Mialon et al., 2021a]. We can also integrate the structure of a graph in transformers using kernels on the graph [Mialon et al., 2021b]. This creates a promising architecture for graphs that differs from GNNs. On a different note, we explored surprising properties of losses admitting a flat area, which can be used for data pruning, with for example potential applications in anomaly detection or differential privacy [Mialon et al., 2020]. All these projects offer interesting directions for future work. Relationship between transfer learning from pre-trained models and inductive biases. At the beginning of this thesis, we introduced inductive biases as a point of view on the generalization problem that appeared to be opposed to pre-trained models: whereas one requires plenty of data, the other is meant to be data efficient. As demonstrated in Chapter 2 and Chapter 3, these practices can be complementary: it is possible to use a module relying on inductive biases on top of a pre-trained model in a context where labelled data is scarce. This approach was shown to be very effective in the context of classifying protein foldings [Mialon et al., 2021a]. Another example is the architecture of a CNN, which can be seen as an inductive bias focused on image processing. Indeed, small or medium convolution filters exploit locality properties of natural images. It is believed that such an inductive bias is nearly optimal for image processing: self-attention in vision transformers seems to learn the same kind of inductive bias [Cordonnier et al., 2020], thus requiring more data to attain the performance of CNNs [Dosovitskiy et al., 2021]. Note however that the aforementioned work also suggests that when the amount of data grows to be huge – one or two orders of magnitude bigger than ImageNet – transformers perform better than CNNs1. In summary, inductive biases can also be useful in context where data is big but not huge. In the latter case, the picture is not clear as of today: the quantity of data and thz size of the model seems more important than its architecture as suggested by the success of different computer vision architectures such as 1Recent work however shows that improved training procedure of transformers can close the gap with CNNs trained on ImageNet only although the training procedure differs: the transformer is trained using knowledge distilled from a CNN teacher [Touvron et al., 2021b]. 89 ResMLP [Touvron et al., 2021a], DeiT [Touvron et al., 2021b], and BiT [Kolesnikov et al., 2020] 2. Relationship between inductive biases and geometric deep learning. An exciting field of deep learning coined as geometric deep learning recently emerged [Bronstein et al., 2021]. From the point of view of geometric deep learning, and for many problems, there exists regularities under the form of symmetries and invariances. For example, the energy of a molecule is invariant given any rotation of the molecule in the 3D space. These regularities strongly suggest a preferred architecture, and the zoo of deep learning architectures can in fact be classified depending on the invariance they encode. As an example, a transformer is permutation equivariant: any permutation of two elements in its input will result in the same permutation in the output. This makes the transformer an appropriate model for handling unordered sets of features. Some inductive biases discussed in this thesis can naturally be put under the hood of geometrical deep learning, see our discussion on different possible models for handling graphs in Chapter 3, between GNNs and transformers. Other inductive biases such as using an optimal transport geometry for representing sets may require more thinking to find their place in the geometric deep learning perspective. 5.2 Future work At the end of the chapters, we provided short term directions for further work. In this last section, we detail two general avenues of work starting from the conclusion of this thesis. Applications of inductive biases: scientific discovery. Although inductive biases are typically outperformed in the more and more common huge data setting by large pre-trained models, they are still an important tool for machine learning. We believe scientific discovery is an appropriate application for recent machine learning models. First, as opposed to models that will be deployed in production for use by non-experts, which must comply with the norm, often requiring interpretability, guarantees on the error, and other constraints that are not yet compatible with deep learning, scientific machine learning models may stay in the lab. This means that norms are less binding and more human supervision is allowed, thus enabling to leverage the most recent advances in deep learning. Second, scientific data has often been generated by some potentially complex physical law, meaning that there is probably properties such as invariances in the problem or more generally domain knowledge to incorporate in the learning model. AlphaFold2 [Jumper et al., 2021] is a good example for our discussion: first, it is both a complex system relying on deep neural networks (a core block of AlphaFold2 is a deep transformer), yet also a model integrating expert knowledge on proteins via inductive biases (the triangular attention mechanism helps the network to learn a pairwise representations of amino-acids which is compatible with a 3D structure in terms of pairwise distances). As AlphaFold2 should largely be used by experts in bioinformatics, there is to the best of our knowledge no norm to comply with that would be incompatible with deep learning blocks. As many interesting scientific data can be seen as graphs or sequences, and because scientific data may be scarce for some domains such as are disease or econometrics studies, we believe a promising application of our work to be science problems. 2Thus making the bitter lesson of machine learning maybe more true than ever. 90 Inductive biases are elsewhere, for example in different learning paradigms. This thesis focused on integrating inductive biases directly within models. But, inductive biases can be found elsewhere, namely in the learning procedure. The main learning paradigm in machine learning is Empirical Risk Minimization (ERM) that we studied in Chapter 4. ERM consists in minimizing a prediction error on hypothetically i.i.d samples with possibly regularity constraints for the model to hopefully ensure better generalization. Such a learning procedure suffers from various issues, two of them being that labels are required, and that spurious correlations may be learned. The former requires manually annotated samples which can be tedious, expensive or even impossible to obtain. The latter makes generalization more difficult: a famous example being a classifier that would learn to recognize cows. As cow pictures are often taken in green grass, the classifier trained on such data could have difficulties to recognize a cow lying on a beach [Beery et al., 2018]. Different learning procedures can be used to circumvent these issues. In computer vision, self-supervised learning relies on a pretext task to learn general visual representations [He et al., 2020]. These approaches typically aim to minimize the difference between two representations of two different augmentations of the same image. These augmentations are human-engineered: in this sense, this component is an inductive bias and could be used to inject domain knowledge for various data modalities. Invariant Risk Minimization [Arjovsky et al., 2020] (IRM) tackles the problem of spurious correlations in ERM: the inductive bias here is that the model should learn correlations that are stable across different environments, i.e different training distributions. In this sense, inductive biases are broader than integrating domain knowledge into the learning architecture, and progress may be sought by improving the learning paradigms used in machine learning. 91 Bibliography Jean-Marc Andreoli. Convolution, attention and structure embedding. In arXiv preprint arXiv: 1905.01289v5, 2019. Martin Arjovsky, Léon Bottou, Ishaan Gulrajani, and David Lopez-Paz. Invariant risk minimization, 2020. Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. In Advances in Neural Information Processing Systems (NeurIPS), 2016. Francis Bach, Rodolphe Jenatton, Julien Mairal, Guillaume Obozinski, et al. Optimization with sparsity-inducing penalties. Foundations and Trends in Machine Learning, 4(1):1–106, 2012. Dzimitry Bahdanau, Kyunghyun Cho, and Joshua Bengio. Neural machine translation by jointly learning to align and translate. In International Conference on Learning Representations (ICLR), 2015. Peter W. Battaglia, Jessica B. Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, Caglar Gulcehre, Francis Song, Andrew Ballard, Justin Gilmer, George Dahl, Ashish Vaswani, Kelsey Allen, Charles Nash, Victoria Langston, Chris Dyer, Nicolas Heess, Daan Wierstra, Pushmeet Kohli, Matt Botvinick, Oriol Vinyals, Yujia Li, and Razvan Pascanu. Relational inductive biases, deep learning, and graph networks, 2018. Amir Beck and Marc Teboulle. Smoothing and first order methods: a unified framework. SIAM J. Optim Vol. 22, No. 2, 2012. Sara Beery, Grant Van Horn, and Pietro Perona. Recognition in terra incognita. In Proceedings of the European Conference on Computer Vision (ECCV), September 2018. Mikhail Belkin and Partha Niyogi. Laplacian eigenmaps for dimensionality reduction and data represen- tation. Neural computation, 15(6):1373–1396, 2003. Iz Beltagy, Matthew E. Peters, and Arman Cohan. Longformer: The long-document transformer. arXiv:2004.05150, 2020. Emily M. Bender, Timnit Gebru, Angelina McMillan-Major, and Shmargaret Shmitchell. On the dangers of stochastic parrots: Can language models be too big? In Proceedings of the 2021 ACM Conference on Fairness, Accountability, and Transparency, 2021. David L. Berry, Gary M. Schoofs, and William A. Vance. Mutagenicity of nitrofluoranthenes, 3- aminofluoranthene and 1-nitropyrene in Chinese hamster V79 cells. Carcinogenesis, 6(10):1403–1407, 1985. URL https://doi.org/10.1093/carcin/6.10.1403. Alberto Bietti and Julien Mairal. Group invariance, stability to deformations, and complexity of deep convolutional representations. The Journal of Machine Learning Research, 20(1):876–924, 2019. Alberto Bietti, Grégoire Mialon, Dexiong Chen, and Julien Mairal. A kernel perspective for regularizing deep neural networks. In International Conference on Machine Learning (ICML), 2019. Robert G. Bland, Donald Goldfarb, and Michael J. Todd. The ellipsoid method: A survey. Operation Research, 29, 1981. 92 Mathieu Blondel, André F. T. Martins, and Vlad Niculae. Learning classifiers with fenchel-young losses: Generalized entropies, margins, and algorithms. In International Conference on Artificial Intelligence and Statistics (AISTATS), 2019. Karsten Borgwardt and Hans-Peter Kriegel. Shortest-path kernels on graphs. In International conference on data mining (ICDM), 2005. Karsten Borgwardt, Elisabetta Ghisu, Felipe Llinares-López, Leslie O'Bray, and Bastian Rieck. Graph kernels: State-of-the-art and future challenges. arXiv preprint arXiv:2011.03854, 2020. Stephen Boyd and Lieven Vandenberghe. Convex Optimization. Cambridge University Press, 2004. Stevo Bozinovski and Ante Fulgosi. The influence of pattern similarity and transfer of learning upon training of a base perceptron b2. (original in croatian: Utjecaj slicnosti likova i transfera ucenja na obucavanje baznog perceptrona b2). In Proc. Symp. Informatica 3-121-5, Bled, 1976. Michael M. Bronstein, Joan Bruna, Yann LeCun, Arthur Szlam, and Pierre Vandergheynst. Geometric deep learning: Going beyond euclidean data. IEEE Signal Processing Magazine, 34(4):18–42, 2017. Michael M. Bronstein, Joan Bruna, Taco Cohen, and Petar Veličković. Geometric deep learning: Grids, groups, graphs, geodesics, and gauges, 2021. Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners, 2020. Antoni Buades, Bartomeu Coll, and Jean-Michel Morel. Non-Local Means Denoising. Image Processing On Line, 1:208–212, 2011. Nicholas Carlini, Florian Tramer, Eric Wallace, Matthew Jagielski, Ariel Herbert-Voss, Katherine Lee, Adam Roberts, Tom Brown, Dawn Song, Ulfar Erlingsson, et al. Extracting training data from large language models. arXiv preprint arXiv:2012.07805, 2020. Dexiong Chen. Structured Data Modeling with Deep Kernel Machines and Applications in Com- putational Biology. PhD thesis, Université Grenoble Alpes [2020-....], 2020. URL https://tel. archives-ouvertes.fr/tel-03193220. Dexiong Chen, Laurent Jacob, and Julien Mairal. Biological sequence modeling with convolutional kernel networks. Bioinformatics, pages 35(18):3294–3302, 2019a. Dexiong Chen, Laurent Jacob, and Julien Mairal. Recurrent kernel networks. In Advances in Neural Information Processing Systems (NeurIPS), 2019b. Dexiong Chen, Laurent Jacob, and Julien Mairal. Convolutional kernel networks for graph-structured data. In International Conference on Machine Learning (ICML), 2020. Liqun Chen, Guoyin Wang, Chenyang Tao, Dinghan Shen, Pengyu Cheng, Xinyuan Zhang, Wenlin Wang, Yizhe Zhang, and Lawrence Carin. Improving textual network embedding with global attention via optimal transport. In Proceedings of the Annual Meeting of the Association for Computational Linguistics (ACL), 2019c. Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, Alex Ray, Raul Puri, Gretchen Krueger, Michael Petrov, Heidy Khlaaf, Girish Sastry, Pamela Mishkin, Brooke Chan, Scott Gray, Nick Ryder, Mikhail Pavlov, Alethea Power, Lukasz Kaiser, Mohammad Bavarian, Clemens Winter, Philippe Tillet, Felipe Petroski Such, Dave Cummings, Matthias Plappert, Fotios Chantzis, Elizabeth Barnes, Ariel Herbert-Voss, William Hebgen Guss, Alex Nichol, Alex Paino, Nikolas Tezak, Jie Tang, Igor Babuschkin, Suchir Balaji, Shantanu Jain, William Saunders, Christopher Hesse, Andrew N. Carr, Jan Leike, Josh Achiam, Vedant Misra, Evan Morikawa, Alec Radford, Matthew Knight, Miles Brundage, 93 Mira Murati, Katie Mayer, Peter Welinder, Bob McGrew, Dario Amodei, Sam McCandlish, Ilya Sutskever, and Wojciech Zaremba. Evaluating large language models trained on code, 2021. François Chollet. On the measure of intelligence, 2019. Krzysztof Choromanski, Valerii Likhosherstov, David Dohan, Xingyou Song, Andreea Gane, Tamas Sarlos, Peter Hawkins, Jared Davis, David Belanger, Lucy Colwell, and Adrian Weller. Masked language modeling for proteins via linearly scalable long-context transformers. In arXiv:2006.03555v3, 2020. King-Thom Chung, Chris A. Murdock, Yonggui Zhou, S. Edward Stevens Jr., Ying-Sing Li, Cheng-I. Wei, S. Y. Fernando, and Ming-W. Chou. Effects of the nitro-group on the muta- genicity and toxicity of some benzamines. Environmental and Molecular Mutagenesis, 27(1): 67–74, 1996. URL https://onlinelibrary.wiley.com/doi/abs/10.1002/%28SICI%291098-2280% 281996%2927%3A1%3C67%3A%3AAID-EM9%3E3.0.CO%3B2-B. Jean-Baptiste Cordonnier, Andreas Loukas, and Martin Jaggi. On the relationship between self-attention and convolutional layers. In International Conference on Learning Representations (ICLR), 2020. Corinna Cortes and Vladimir Vapnik. Support-vector networks. Machine learning, 20(3):273–297, 1995. Marco Cuturi. Sinkhorn distances: Lightspeed computation of optimal transport. In Advances in Neural Information Processing Systems (NeurIPS), 2013. Marco Cuturi and Arnaud Doucet. Fast computation of wasserstein barycenters. In International Conference on Machine Learning (ICML), 2013. Liang Dai and Kristiaan Pelckmans. An ellipsoid based, two-stage screening test for bpdn. European Signal Processing Conference, pages 654–658, 01 2012. Zihang Dai, Yiming Yang, Jaime Carbonell, Quoc V. Le, and Ruslan Salakhutdinov. Transformer-xl: Attentive language models beyond a fixed-length context. In Proceedings of the Annual Meeting of the Association for Computational Linguistics (ACL), 2019. Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the North American Chapter of the Association for Computational Linguistics (NAACL), 2019. Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representations (ICLR), 2021. Simon S Du, Kangcheng Hou, Russ R Salakhutdinov, Barnabas Poczos, Ruosong Wang, and Keyulu Xu. Graph neural tangent kernel: Fusing graph neural networks with graph kernels. In Advances in Neural Information Processing Systems (NeurIPS), 2019. David Duvenaud, Dougal Maclaurin, Jorge Aguilera-Iparraguirre, Rafael Gómez-Bombarelli, Timothy Hirzel, Alán Aspuru-Guzik, and Ryan P. Adams. Convolutional networks on graphs for learning molecular fingerprints. In Advances in Neural Information Processing Systems (NeurIPS), 2015. Vijay Prakash Dwivedi and Xavier Bresson. A generalization of transformer networks to graphs. AAAI Workshop on Deep Learning on Graphs: Methods and Applications, 2021. Laurent El Ghaoui, Vivian Viallon, and Tarek Rabbani. Safe Feature Elimination for the LASSO and Sparse Supervised Learning Problems. arXiv e-prints, art. arXiv:1009.4219, Sep 2010. Pedro F Felzenszwalb, Ross B Girshick, David McAllester, and Deva Ramanan. Object detection with discriminatively trained part-based models. IEEE transactions on pattern analysis and machine intelligence, 32(9):1627–1645, 2009. Olivier Fercoq, Alexandre Gramfort, and Joseph Salmon. Mind the duality gap: safer rules for the Lasso. In International Conference on Machine Learning (ICML), 2015. 94 Matthias Fey and Jan E. Lenssen. Fast graph representation learning with PyTorch Geometric. In ICLR Workshop on Representation Learning on Graphs and Manifolds, 2019. Jerome Friedman, Trevor Hastie, and Robert Tibshirani. The elements of statistical learning. Springer series in statistics New York, 2001. Andrew Gardner, Christian A. Duncan, Jinko Kanno, and Rastko R. Selmic. On the definiteness of earth mover's distance and its relation to set intersection. IEEE Transactions on Cybernetics, 48(11): 3184–3196, 2018. Thomas Gärtner, Peter Flach, and Stefan Wrobel. On graph kernels: Hardness results and efficient alternatives. In Learning theory and kernel machines, pages 129–143. Springer, 2003. Aude Genevay, Gabriel Peyré, and Marco Cuturi. Learning generative models with sinkhorn divergences. In International Conference on Artificial Intelligence and Statistics (AISTATS), 2018. Ian Goodfellow, Yoshua Bengio, and Aaron Courville. Deep Learning. MIT Press, 2016. http: //www.deeplearningbook.org. Ian J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial networks. In Advances in Neural Information Processing Systems (NeurIPS), 2014. Edouard Grave, Armand Joulin, and Quentin Berthet. Unsupervised alignment of embeddings with wasserstein procrustes. In International Conference on Artificial Intelligence and Statistics (AISTATS), 2019. Zaïd Harchaoui and Francis Bach. Image classification with segmentation graph kernels. In 2007 IEEE Conference on Computer Vision and Pattern Recognition, pages 1–8. IEEE, 2007. Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9729–9738, 2020. Danny Hernandez and Tom B Brown. Measuring the algorithmic efficiency of neural networks. arXiv preprint arXiv:2005.04305, 2020. Jean-Baptiste Hiriart-Urruty and Claude Lemaréchal. Convex Analysis and Minimization Algorithms. Springer, 1993. Jean-Baptiste Hiriart-Urruty and Claude Lemaréchal. Convex Analysis and Minimization Algorithms II. Springer, 1993. Nhat Ho, XuanLong Nguyen, Mikhail Yurochkin, Hung Hai Bui, Viet Huynh, and Dinh Phung. Multilevel clustering via wasserstein means. In International Conference on Machine Learning (ICML), 2017. Toby Hocking, Guillem Rigaill, Jean-Philippe Vert, and Francis Bach. Learning sparse penalties for change-point detection using max margin interval regression. In International Conference on Machine Learning (ICML), 2013. Jie Hou, Badri Adhikari, and Jianlin Cheng. Deepsf: deep convolutional neural network for mappingpro- tein sequences to folds. Bioinformatics, pages 34(8):1295–1303, 2019. John Jumper, Richard Evans, Alexander Pritzel, Tim Green, Michael Figurnov, Olaf Ronneberger, Kathryn Tunyasuvunakool, Russ Bates, Augustin Žídek, Anna Potapenko, Alex Bridgland, Clemens Meyer, Simon A. A. Kohl, Andrew J. Ballard, Andrew Cowie, Bernardino Romera-Paredes, Stanislav Nikolov, Rishub Jain, Jonas Adler, Trevor Back, Stig Petersen, David Reiman, Ellen Clancy, Michal Zielinski, Martin Steinegger, Michalina Pacholska, Tamas Berghammer, Sebastian Bodenstein, David Silver, Oriol Vinyals, Andrew W. Senior, Koray Kavukcuoglu, Pushmeet Kohli, and Demis Hassabis. Highly accurate protein structure prediction with alphafold. Nature, 596(7873):583–589, 2021. Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B. Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models, 2020. 95 Kristian Kersting, Nils M. Kriege, Christopher Morris, Petra Mutzel, and Marion Neumann. Benchmark data sets for graph kernels, 2016. URL http://graphkernels.cs.tu-dortmund.de. Diederik P Kingma and Max Welling. Auto-encoding variational bayes. In International Conference on Learning Representations (ICLR), 2014. Thomas N. Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In International Conference on Learning Representations (ICLR), 2017. Nikita Kitaev, Łukasz Kaiser, and Anselm Levskaya. Reformer: The efficient transformer. In International Conference on Learning Representations (ICLR), 2020. Johannes Klicpera, Stefan Weissenberger, and Stephan Günnemann. Diffusion improves graph learning. In Advances in Neural Information Processing Systems (NeurIPS), 2019. Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, and Neil Houlsby. Big transfer (bit): General visual representation learning. In Proceedings of the European Conference on Computer Vision (ECCV), 2020. Soheil Kolouri, Yang Zou, and Gustavo K. Rohde. Sliced wasserstein kernels for probability distributions. In Proceedings of the Conference on Computer Vision and Pattern Recognition (CVPR), 2016. Soheil Kolouri, Navid Naderializadeh, Gustavo K. Rohde, and Heiko Hoffmann. Wasserstein embedding for graph learning. In International Conference on Learning Representations (ICLR), 2021. Risi Kondor and Jean-Philippe Vert. Diffusion kernels. In Kernel Methods in Computational Biology, pages 171–192. MIT Press, 2004. Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In F. Pereira, C. J. C. Burges, L. Bottou, and K. Q. Weinberger, editors, Advances in Neural Information Processing Systems, volume 25. Curran Associates, Inc., 2012. URL https:// proceedings.neurips.cc/paper/2012/file/c399862d3b9d6b76c8436e924a68c45b-Paper.pdf. Juho Lee, Yoonho Lee, Jungtaek Kim, Adam R. Kosiorek, Seungjin Choi, and Yee Whye Teh. Set transformer: A framework for attention-based permutation invariant neural networks. In International Conference on Machine Learning (ICML), 2019. Yuan Li, Xiaodan Liang, Zhiting Hu, Yinbo Chen, and Eric P. Xing. Graph transformer, 2019. URL https://openreview.net/forum?id=HJei-2RcK7. Marit Låg, James G. Omichinski, Erik Dybing, Sidney D. Nelson, and Erik J. SÞderlund. Mutagenic activity of halogenated propanes and propenes: effect of bromine and chlorine positioning. Chemico- Biological Interactions, 93(1):73–84, 1994. doi: https://doi.org/10.1016/0009-2797(94)90087-6. URL https://www.sciencedirect.com/science/article/pii/0009279794900876. Siwei Lyu. Mercer kernels for object recognition with local features. In Conference on Computer Vision and Pattern Recognition (CVPR), 2004. Pierre Mahé and Jean-Philippe Vert. Graph kernels based on tree patterns for molecules. Machine learning, 75(1):3–35, 2009. Julien Mairal. End-to-end kernel learning with supervised convolutional kernel networks. In Advances in Neural Information Processing Systems (NeurIPS), 2016. Julien Mairal. Cyanure: An open-source toolbox for empirical risk minimization for python, C++, and soon more. arXiv preprint arXiv:1912.08165, 2019. Julien Mairal, Piotr Koniusz, Zaid Harchaoui, and Cordelia Schmid. Convolutional kernel networks. In Advances in Neural Information Processing Systems (NeurIPS), 2014. Louis Martin, Benjamin Muller, Pedro Javier Ortiz Suárez, Yoann Dupont, Laurent Romary, Éric Ville- monte de la Clergerie, Djamé Seddah, and Benoît Sagot. Camembert: a tasty french language model. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, 2020. Mathurin Massias, Alexandre Gramfort, and Joseph Salmon. Celer: a fast solver for the lasso with dual 96 extrapolation. In International Conference on Machine Learning (ICML), 2018. Grégoire Mialon, Alexandre d'Aspremont, and Julien Mairal. Screening data points in empirical risk minimization via ellipsoidal regions and safe loss functions. In International Conference on Artificial Intelligence and Statistics (AISTATS), 2020. Grégoire Mialon, Dexiong Chen, Alexandre d'Aspremont, and Julien Mairal. A trainable optimal In International transport embedding for feature aggregation and its relationship to attention. Conference on Learning Representations (ICLR), 2021a. Grégoire Mialon, Dexiong Chen, Margot Selosse, and Julien Mairal. Graphit: Encoding graph structure in transformers, 2021b. Paul Michel, Omer Levy, and Graham Neubig. Are sixteen heads really better than one? In Advances in Neural Information Processing Systems (NeurIPS), 2019. Caroline Moosmüller and Alexander Cloninger. Linear optimal transport embedding: Provable fast wasserstein distance computation and classification for nonlinear problems, 2020. Jean-Jacques Moreau. Fonctions convexes duales et points proximaux dans un espace hilbertien. CR Acad. Sci. Paris Sér. A MAth, 1962. Arkadi Nemirovskii and David Yudin. Problem complexity and method efficiency in optimization. Nauka (published in English by John Wiley, Chichester, 1983), 1979. Yuri Nesterov. Smooth minimization of non-smooth functions. Mathematical Programming, 103(1): 127–152, 2005. Kohei Ogawa, Yoshiki Suzuki, Shinya Suzumura, and Ichiro Takeuchi. Safe sample screening for support vector machines, 2014. Ankur Parikh, Oscar Täckström, Dipanjan Das, and Jakob Uszkoreit. A decomposable attention model for natural language inference. In Conference on Empirical Methods in Natural Language Processing (EMNLP), 2016. F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12: 2825–2830, 2011. Gabriel Peyré and Marco Cuturi. Computational optimal transport. Foundations and Trends in Machine Learning, 11(5-6):355–206, 2019. Julien Rabin, Gabriel Peyré, Julie Delon, and Marc Bernot. Wasserstein barycenter and its application to texture mixing. In International Conference on Scale Space and Variational Methods in Computer Vision (SSVM), 2011. Alessandro Raganato, Yves Scherrer, and Tiedemann Jörg. Fixed encoder self-attention patterns in transformer-based machine translation. In arXiv preprint arXiv: 2002.10260, 2020. Ali Rahimi and Ben Recht. Random features for large-scale kernel machines. In Advances in Neural Information Processing Systems (NeurIPS), 2007. Alexander Rives, Joshua Meier, Tom Sercu, Siddharth Goyal, Zeming Lin, Jason Liu, Demi Guo, Myle Ott, C. Lawrence Zitnick, Jerry Ma, and Rob Fergus. Biological structure and function emerge from scaling unsupervised learning to 250 million protein sequences. bioRxiv, 2019. doi: 10.1101/622803. URL https://www.biorxiv.org/content/10.1101/622803v4. Yossi Rubner, Carlo Tomasi, and Leonidas J. Guibad. The earth mover's distance as a metric for image retrieval. International Journal of Computer Vision, 40:99–121, 2000. Alexandre Sablayrolles, Matthijs Douze, Cordelia Schmid, Yann Ollivier, and Herve Jegou. White-box vs black-box: Bayes optimal strategies for membership inference. In International Conference on Machine Learning (ICML), 2019. 97 Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. IEEE transactions on neural networks, 20(1):61–80, 2008. Julian Schrittwieser, Ioannis Antonoglou, Thomas Hubert, Karen Simonyan, Laurent Sifre, Simon Schmitt, Arthur Guez, Edward Lockhart, Demis Hassabis, Thore Graepel, et al. Mastering atari, go, chess and shogi by planning with a learned model. Nature, 588(7839):604–609, 2020. Bernhard Schölkopf and Alexander Smola. Learning with kernels: support vector machines, regularization, optimization, and beyond. MIT Press, 2001. A. W. Senior, R. Evans, J. Jumper, J. Kirkpatrick, L. Sifre, T. Green, et al. Improved protein structure prediction using potentials from deep learning. Nature, 577(7792):706–710, 2020. Peter Shaw, Jakob Uszkoreit, and Ashish Vaswani. Self-attention with relative position representations. In Proceedings of the North American Chapter of the Association for Computational Linguistics (NAACL), 2018. Nino Shervashidze, SVN Vishwanathan, Tobias Petri, Kurt Mehlhorn, and Karsten Borgwardt. Efficient graphlet kernels for large graph comparison. In International Conference on Artificial Intelligence and Statistics (AISTATS), 2009. Nino Shervashidze, Pascal Schweitzer, Erik Jan van Leeuwen, Kurt Mehlhorn, and Karsten M Borgwardt. Weisfeiler-Lehman graph kernels. Journal of Machine Learning Research (JMLR), 12:2539–2561, 2011. Atsushi Shibagaki, Masayuki Karasuyama, Kohei Hatano, and Ichiro Takeuchi. Simultaneous Safe Screening of Features and Samples in Doubly Sparse Modeling. In International Conference on Machine Learning (ICML), 2016. David Silver, Aja Huang, Chris J Maddison, Arthur Guez, Laurent Sifre, George Van Den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, et al. Mastering the game of go with deep neural networks and tree search. nature, 529(7587):484–489, 2016. Richard Sinkhorn and Paul Knopp. Concerning nonnegative matrices and doubly stochastic matrices. Pacific Journal of Mathematics, 21(2), 1967. Konstantinos Skianis, Giannis Nikolentzos, Stratis Limnios, and Michalis Vazirgiannis. Rep the set: Neural networks for learning set representations. In International Conference on Artificial Intelligence and Statistics (AISTATS), 2020. Alexander J. Smola and Risi Kondor. Kernels and regularization on graphs. In Bernhard Schölkopf and Manfred K. Warmuth, editors, Learning Theory and Kernel Machines, pages 144–158. Springer Berlin Heidelberg, 2003. Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D Manning, Andrew Ng, and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In Conference on Empirical Methods in Natural Language Processing (EMNLP), 2013. Ingo Steinwart. Sparseness of support vector machines-some asymptotically sharp bounds. In Advances in Neural Information Processing Systems, 2004. Emma Strubell, Ananya Ganesh, and Andrew McCallum. Energy and policy considerations for deep learning in nlp, 2019. Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. In iclr, 2014. Yi Tay, Mostafa Dehghani, Dara Bahri, and Donald Metzler. Efficient transformers: A survey, 2020. Robert Tibshirani. Regression shrinkage and selection via the lasso. Journal of the Royal Statistical Society: Series B (Methodological), 58(1):267–288, 1996. Robert Tibshirani, Jacob Bien, Jerome Friedman, Trevor Hastie, Noah Simon, Jonathan Taylor, and Ryan J Tibshirani. Strong rules for discarding predictors in lasso-type problems. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 74(2):245–266, 2012. 98 Giorgos Tolias, Yannis Avrithis, and Hervé Jégou. To aggregate or not to aggregate: Selective match kernels for image search. In Proceedings of the International Conference on Computer Vision (ICCV), 2013. Hugo Touvron, Piotr Bojanowski, Mathilde Caron, Matthieu Cord, Alaaeldin El-Nouby, Edouard Grave, Gautier Izacard, Armand Joulin, Gabriel Synnaeve, Jakob Verbeek, and Hervé Jégou. Resmlp: Feedforward networks for image classification with data-efficient training, 2021a. Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers & distillation through attention. In International Conference on Machine Learning (ICML), pages 10347–10357. PMLR, 2021b. Yao-Hung Hubert Tsai, Shaojie Bai, Makoto Yamada, Louis-Philippe Morency, and Ruslan Salakhutdinov. Transformer dissection: A unified understanding of transformer's attention via the lens of kernel. In Conference on Empirical Methods in Natural Language Processing (EMNLP), 2019. Ashish Vaswani, Noam Shazeer, Nikki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems (NeurIPS), 2017. Petar Veličković, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Liò, and Yoshua Bengio. Graph attention networks. In International Conference on Learning Representations (ICLR), 2018. Nitika Verma, Edmond Boyer, and Jakob Verbeek. Feastnet: Feature-steered graph convolutions for 3d shape analysis. In Proceedings of the Conference on Computer Vision and Pattern Recognition (CVPR), 2018. Cédric Villani. Optimal Transport: Old and New. Springer, 2008. Elena Voita, David Talbot, Fedor Moiseev, Rico Sennrich, and Ivan Titov. Analyzing multi-head self-attention: Specialized heads do the heavy lifting, the rest can be pruned. In Proceedings of the Annual Meeting of the Association for Computational Linguistics (ACL), 2019. Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. Glue: a multi-task benchmark and analysis platform for natural language understanding. In International Conference on Learning Representations (ICLR), 2019. Jie Wang, Jiayu Zhou, Peter Wonka, and Jieping Ye. Lasso screening rules via dual polytope projection. In Advances in Neural Information Processing Systems (NeurIPS), 2013a. Jie Wang, Jiayu Zhou, Jun Liu, Peter Wonka, and Jieping Ye. A safe screening rule for sparse logistic regression. In Advances in Neural Information Processing Systems (NeurIPS), 2014. Sinong Wang, Belinda Z. Li, Madian Khabsa, Han Fang, and Hao Ma. Linformer: Self-attention with linear complexity. In arXiv preprint arXiv: 2006.04768v3, 2020. Wei Wang, Dejan Slepcev, Saurav Basu, John A. Ozolek, and Gustavo K. Rohde. A linear optimal transportation framework for quantifying and visualizing variations in sets of images. International Journal of Computer Vision, 101(2):254–269, 2013b. Xiaolong Wang, Ross B. Girshick, Abhinav Gupta, and Kaiming He. Non-local neural networks. In Proceedings of the Conference on Computer Vision and Pattern Recognition (CVPR), 2017. You Weiqiu, Simeng Sun, and Mohit Iyyer. Hard-coded gaussian attention for neural machine translation. In Proceedings of the Annual Meeting of the Association for Computational Linguistics (ACL), 2020. Christopher KI Williams and Matthias Seeger. Using the Nyström method to speed up kernel machines. In Advances in Neural Information Processing Systems (NeurIPS), 2001. Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, and Jamie Brew. Huggingface's transformers: State-of-the-art natural language processing. In arXiv preprint arXiv: 1910.03771, 2019. Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? 99 In International Conference on Learning Representations (ICLR), 2019. Kosaku Yosida. Functional analysis. Berlin-Heidelberg, 1980. Seongjun Yun, Minbyul Jeong, Raehyun Kim, Jaewoo Kang, and Hyunwoo Kim. Graph transformer networks. In Advances in Neural Information Processing Systems (NeurIPS), 2019. Manzil Zaheer, Satwik Kottur, Siamak Ravanbhakhsh, Barnabás Póczos, Ruslan Salakhutdinov, and Alexander J. Smola. Deep sets. In Advances in Neural Information Processing Systems (NeurIPS), 2017. Jiawei Zhang, Haopeng Zhang, Congying Xia, and Li Sun. Graph-bert: Only attention is needed for learning graph representations, 2020. Kai Zhang, Ivor W. Tsang, and James T. Kwok. Improved nyström low-rank approximation and error analysis. In International Conference on Machine Learning (ICML), 2008. Jian Zhou and Olga G Troyanskaya. Predicting effects of noncoding variants with deep learning–based sequence model. Nature methods, 12(10):931–934, 2015. Hui Zou and Trevor Hastie. Regularization and variable selection via the elastic net. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 67(2):301–320, 2005. 100 RÉSUMÉ Apprendre à partir de données limitées est l'un des plus gros problèmes du deep learning. Les approches courantes et populaires de cette question consistent à entraîner un modèle sur d'énormes quantités de données, étiquetées ou non, avant de réentraîner le modèle sur un ensemble de données d'intérêt, plus petit, appartenant à la même modalité. Intuitivement, cette technique permet au modèle d'apprendre d'abord une représentation générale pour un certain type de données, telles que des images. Moins de données seront ensuite nécessaires pour apprendre une tâche spécifique pour cette modalité particulière. Bien que cette approche appelée « apprentissage par transfert » soit très efficace dans des domaines tels que la vision par ordinateur ou le traitement du langage naturel, elle ne résout pas les problèmes courants du deep learning tels que l'interprétabilité des modèles ou le besoin global en données. Cette thèse explore une réponse différente au problème de l'apprentissage de modèles expressifs dans des contextes où les données sont plus rares. Au lieu de s'appuyer sur de grands ensembles de données pour apprendre les paramètres d'un réseau de neurones, nous remplacerons certains de ces paramètres par des fonctions mathématiques connues reflétant la structure des données. Très souvent, ces fonctions seront puisées dans la riche littérature des méthodes à noyau. En effet, de nombreux noyaux peuvent être interprétés, et/ou permettre un apprentissage avec peu de données. Notre approche s'inscrit dans le cadre des « biais inductifs », qui peuvent être définis comme des hypothèses sur les données disponibles restreignant l'espace des modèles à explorer lors de l'apprentissage. Dans les deux premiers chapitres de la thèse, nous démontrons l'efficacité de cette approche dans le cadre de séquences, telles que des phrases en langage naturel ou des séquences protéiques, et de graphes, tels que des molécules. Nous soulignons également la relation entre notre travail et les progrès récents du deep learning. Le dernier chapitre de cette thèse se concentre sur les modèles d'apprentissage automatique convexes. Ici, plutôt que de proposer de nouveaux modèles, nous nous demandons quelle proportion des échantillons d'un jeu de données est vraiment nécessaire pour apprendre un « bon » modèle. Plus précisément, nous étudions le problème du filtrage sûr des échantillons, c'est-à-dire l'exécution de tests simples afin d'éliminer les échantillons non informatifs d'un ensemble de données avant même d'entraîner un modèle d'apprentissage automatique, sans affecter le modèle optimal. De telles techniques peuvent être utilisées pour compresser des jeux de données ou extraire des échantillons rares. MOTS CLÉS Apprentissage automatique, apprentissage profond, méthodes à noyau, optimisation convexe ABSTRACT Learning with limited data is one of the biggest problems of deep learning. Current, popular approaches to this issue consist in training models on huge amounts of data, labelled or not, before re-training the model on a smaller dataset of interest from the same modality. Intuitively, this technique allows the model to learn a general representation for some kind of data first, such as images. Then, fewer data should be required to learn a specific task for this particular modality. While this approach coined as "transfer learning" is very effective in domains such as computer vision or natural langage processing, it does not solve common problems of deep learning such as model interpretability or the overall need for data. This thesis explores a different answer to the problem of learning expressive models in data constrained settings. Instead of relying on big datasets to learn the parameters of a neural network, we will replace some of them by known functions reflecting the structure of the data. Very often, these functions will be drawn from the rich litterature of kernel methods. Indeed, many kernels can be interpreted, and/or allow for learning with few data. Our approach falls under the hood of "inductive biases", which can be defined as hypothesis on the data at hand restricting the space of models to explore during learning. In the first two chapters of the thesis, we demonstrate the effectiveness of this approach in the context of sequences, such as sentences in natural language or protein sequences, and graphs, such as molecules. We also highlight the relationship between our work and recent advances in deep learning. The last chapter of this thesis focuses on convex machine learning models. Here, rather than proposing new models, we wonder which proportion of the samples in a dataset is really needed to learn a "good" model. More precisely, we study the problem of safe sample screening, i.e, executing simple tests to discard uninformative samples from a dataset even before fitting a machine learning model, without affecting the optimal model. Such techniques can be used to compress datasets or mine for rare samples. KEYWORDS Machine learning, deep learning, kernel methods, convex optimization
http://arxiv.org/abs/2302.10688v3
2023-10-29T12:14:29
2023-02-21T14:14:40
On Calibrating Diffusion Probabilistic Models
Recently, diffusion probabilistic models (DPMs) have achieved promising results in diverse generative tasks. A typical DPM framework includes a forward process that gradually diffuses the data distribution and a reverse process that recovers the data distribution from time-dependent data scores. In this work, we observe that the stochastic reverse process of data scores is a martingale, from which concentration bounds and the optional stopping theorem for data scores can be derived. Then, we discover a simple way for calibrating an arbitrary pretrained DPM, with which the score matching loss can be reduced and the lower bounds of model likelihood can consequently be increased. We provide general calibration guidelines under various model parametrizations. Our calibration method is performed only once and the resulting models can be used repeatedly for sampling. We conduct experiments on multiple datasets to empirically validate our proposal. Our code is at https://github.com/thudzj/Calibrated-DPMs.
[ "Tianyu Pang", "Cheng Lu", "Chao Du", "Min Lin", "Shuicheng Yan", "Zhijie Deng" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10688v3", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10688v3", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.CV", "stat.ML" ]
3 2 0 2 t c O 9 2 ] G L . s c [ 3 v 8 8 6 0 1 . 2 0 3 2 : v i X r a On Calibrating Diffusion Probabilistic Models Tianyu Pang†1, Cheng Lu2, Chao Du1, Min Lin1, Shuicheng Yan1, Zhijie Deng†3 1Sea AI Lab, Singapore 2Department of Computer Science, Tsinghua University 3Qing Yuan Research Institute, Shanghai Jiao Tong University {tianyupang, duchao, linmin, yansc}@sea.com; [email protected]; [email protected] Abstract Recently, diffusion probabilistic models (DPMs) have achieved promising results in diverse generative tasks. A typical DPM framework includes a forward process that gradually diffuses the data distribution and a reverse process that recovers the data distribution from time-dependent data scores. In this work, we observe that the stochastic reverse process of data scores is a martingale, from which concentration bounds and the optional stopping theorem for data scores can be derived. Then, we discover a simple way for calibrating an arbitrary pretrained DPM, with which the score matching loss can be reduced and the lower bounds of model likelihood can consequently be increased. We provide general calibration guidelines under various model parametrizations. Our calibration method is performed only once and the resulting models can be used repeatedly for sampling. We conduct experiments on multiple datasets to empirically validate our proposal. Our code is available at https://github.com/thudzj/Calibrated-DPMs. 1 Introduction In the past few years, denoising diffusion probabilistic modeling [17, 40] and score-based Langevin dynamics [42, 43] have demonstrated appealing results on generating images. Later, Song et al. [46] unify these two generative learning mechanisms through stochastic/ordinary differential equations (SDEs/ODEs). In the following we refer to this unified model family as diffusion probabilistic models (DPMs). The emerging success of DPMs has attracted broad interest in downstream applications, including image generation [10, 22, 48], shape generation [4], video generation [18, 19], super- resolution [35], speech synthesis [5], graph generation [51], textual inversion [13, 34], improving adversarial robustness [50], and text-to-image large models [32, 33], just to name a few. A typical framework of DPMs involves a forward process gradually diffusing the data distribution [0, T ] is a conditional q0(x0) towards a noise distribution qT (xT ). The transition probability for t R+. Song et al. [46] show Gaussian distribution q0t(xt that there exist reverse SDE/ODE processes starting from qT (xT ) and sharing the same marginal distributions qt(xt) as the forward process. The only unknown term in the reverse processes is the data score θ(xt) (or with other model parametrizations). st xt log qt(xt), which can be approximated by a time-dependent score model st θ(xt) is typically learned via score matching (SM) [20]. t I), where αt, σt x0) = | αtx0, σ2 (xt ∇ N ∈ ∈ | In this work, we observe that the stochastic process of the scaled data score αt xt log qt(xt) is a martingale w.r.t. the reverse-time process of xt from T to 0, where the timestep t can be either continuous or discrete. Along the reverse-time sampling path, this martingale property leads to concentration bounds for scaled data scores. Moreover, a martingale satisfies the optional stopping theorem that the expected value at a stopping time is equal to its initial expected value. ∇ †Corresponding authors. 37th Conference on Neural Information Processing Systems (NeurIPS 2023). ∈ − θ(xt) [0, T ] and any pretrained score Based on the martingale property of data scores, for any t model st θ(xt) (or with other model parametrizations), we can calibrate the model by subtracting its expectation over qt(xt), i.e., Eqt(xt) [st θ(xt)]. We formally demonstrate that the calibrated score model st Eqt(xt) [st θ(xt)] achieves lower values of SM objectives. By the connections between SM objectives and model likelihood of the SDE process [23, 45] or the ODE process [28], the calibrated score model has higher evidence lower bounds. Similar conclusions also hold for the conditional case, in which we calibrate a conditional score model st θ(xt, y) by subtracting its conditional expectation Eqt(xt|y) [st In practice, Eqt(xt) [st θ(xt, y)] can be approximated using noisy training data when the score model has been pretrained. We can also utilize an auxiliary shallow model to estimate these expectations dynamically during pretraining. When we do not have access to training data, we could calculate the expectations using data generated from st θ(xt, y). In experiments, we evaluate our calibration tricks on the CIFAR-10 [25] and CelebA 64 64 [27] datasets, reporting the FID scores [16]. We also provide insightful visualization results on the AFHQv2 [7], FFHQ [21] and ImageNet [9] at 64 θ(xt, y)]. θ(xt)] or Eqt(xt|y) [st θ(xt) or st 64 resolution. × × 2 Diffusion probabilistic models In this section, we briefly review the notations and training paradigms used in diffusion probabilistic models (DPMs). While recent works develop DPMs based on general corruptions [2, 8], we mainly focus on conventional Gaussian-based DPMs. 2.1 Forward and reverse processes Rk and define a forward diffusion process on x as We consider a k-dimensional random variable x }t∈[0,T ] with T > 0, which satisfies q0(x0), ∈ q0t(xt xt { t ∀ x0 ∈ [0, T ], x0) = (xt αtx0, σ2 | t I). (1) (2) ∼ | Here q0(x0) is the data distribution; αt and σt are two positive real-valued functions that are x0)q0(x0)dx0 be the marginal differentiable w.r.t. t with bounded derivatives. Let qt(xt) = | distribution of xt. The schedules of αt, σ2 σ2I) for some 0, σ. Kingma et al. [23] prove that there exists a stochastic differential equation (SDE) satisfying the forward transition distribution in Eq. (1), and this SDE can be written as t need to ensure that qT (xT ) q0t(xt ≈ N (xT N (cid:82) | (cid:101) (cid:101) dxt = f (t)xtdt + g(t)dωt, where ωt t . Song et al. [46] demonstrate that the forward SDE in Eq. (2) corresponds to a reverse SDE constructed as Rk is the standard Wiener process, f (t) = d log αt 2 d log αt dt σ2 dt − , and g(t)2 = dσ2 ∈ dt t dxt = f (t)xt (3) xt log qt(xt) Rk is the standard Wiener process in reverse time. Starting from qT (xT ), the marginal (cid:3) [0, T ]. There also exists a deterministic dt + g(t)dωt, ∇ − (cid:2) g(t)2 ∈ where ωt distribution of the reverse SDE process is also qt(xt) for t process described by an ordinary differential equation (ODE) as dxt dt = f (t)xt g(t)2 1 2 ∈ ∇ − xt log qt(xt), (4) which starts from qT (xT ) and shares the same marginal distribution qt(xt) as the reverse SDE in Eq. (3). Moreover, let q0t(x0 and by Tweedie's formula [12], we know that αtEq0t(x0|xt) [x0] = xt + σ2 xt) = q0t(xt|x0)q0(x0) xt log qt(xt). qt(xt) | t ∇ 2.2 Training paradigm of DPMs xt log qt(xt) at timestep t, a score-based model st To estimate the data score parameters θ is trained to minimize the score matching (SM) objective [20] as θ(xt) [46] with shared To eliminate the intractable computation of (cid:3) xt log qt(xt), denoising score matching (DSM) [49] transforms t SM(θ) into J J t DSM(θ) ≜ 1 2 Eq0(x0),q(ε) θ(xt) + ε st σt , where xt = αtx0 + σtε and (cid:21) xt log qt(xt) . 2 2 ∥ − ∇ (5) Eqt(xt) st θ(xt) ∥ (cid:2) ∇ (cid:20)(cid:13) (cid:13) (cid:13) 2 2 2 (cid:13) (cid:13) (cid:13) ∇ SM(θ) ≜ 1 2 t J J N (ε q(ε) = | t SM(θ) and t DSM(θ) is equivalent up to a constant, i.e., 0, I) is a standard Gaussian distribution. Under mild boundary conditions, we know DSM(θ) + C t and C t is a t J constant independent of the model parameters θ. Other SM variants [31, 44] are also applicable here. The total SM objective for training is a weighted sum of [0, T ], defined SM(θ; λ(t)) ≜ t SM(θ)dt, where λ(t) is a positive weighting function. Similarly, the as T t DSM(θ)dt. The training objectives under other total DSM objective is 0 λ(t) J model parametrizations such as noise prediction εt θ(xt) [23, 32], and velocity prediction vt J θ(xt) [17, 33], data prediction xt (cid:82) θ(xt) [18, 38] are recapped in Appendix B.1. DSM(θ; λ(t)) ≜ t SM(θ) across t t SM(θ) = T 0 λ(t) J J J J J ∈ (cid:82) 2.3 Likelihood of DPMs f (t)xt g(t)2st Suppose that the reverse processes start from a tractable prior pT (xT ) = approximate the reverse-time SDE process by substituting dxt = t by the total SM objective Lemma 1. (Proof in Song et al. [45]) Let qt(xt) be constructed from the forward process in Eq. (2). Then under regularity conditions, we have q0 σ2I). We can | θ(xt) in Eq. (3) as (xt; θ) for (x0; θ) can be bounded ∇ dt + g(t)dωt, which induces the marginal distribution pSDE [0, T ]. In particular, at t = 0, the KL divergence between q0(x0) and pSDE SM(θ; g(t)2) with the weighing function of g(t)2, as stated below: (xT xt log qt(xt) with st SM(θ; g(t)2) + θ(xt) KL (qT pT ). (θ) N − 0, J ∈ KL (cid:101) t (cid:2) (cid:3) 0 D pSDE 0 ∥ ≤ J D ∥ (cid:0) D ∇ KL (qT xt log qt(xt) with st (cid:1) θ(xt) in Eq. (4) as dxt pT ) is the prior loss independent of θ. Similarly, we approximate the reverse-time Here ∥ ODE process by substituting θ(xt), which induces the marginal distribution pODE [0, T ]. By the instantaneous change t of variables formula [6], we have log pODE (xt;θ) f (t)xt ) θ(xt) * denotes the trace of a matrix. Integrating change in log pODE (xt; θ) from t = 0 to T can give the (cid:0) log pODE value of log pT (xT ) (x0; θ), but requires tracking the path from x0 to xT . On the other 0 hand, at t = 0, the KL divergence between q0(x0) and pODE Lemma 2. (Proof in Lu et al. [28]) Let qt(xt) be constructed from the forward process in Eq. (2). Then under regularity conditions, we have pT ) + ∥ KL J Diff(θ) measures the difference between st θ(xt) and (xt; θ) for t tr = (x0; θ) can be decomposed: KL (qT D xt log pODE Diff(θ), where the term SM(θ; g(t)2) + dt = f (t)xt 2 g(t)2st 2 g(t)2st pODE 0 ∥ , where tr( (xt; θ). (θ) (cid:1)(cid:1) q0 ∇ − − − = − D ∈ xt dt (cid:0) 1 0 1 t t t Diff(θ) is intractable due to the term (xt; θ), nevertheless, we could Diff(θ) via bounding high-order SM objectives [28]. (cid:0) (cid:1) xt log pODE t ∇ ∇ J Directly computing bound J J J 3 Calibrating pretrained DPMs In this section we begin with deriving the relationship between data scores at different timesteps, which leads us to a straightforward method for calibrating any pretrained DPMs. We investigate further how the dataset bias of finite samples prevents empirical learning from achieving calibration. 3.1 The stochastic process of data score | According to Kingma et al. [23], the form of the forward process in Eq. (1) can be generalized to T . Then, the transition probability from xs to xt is written as any two timesteps 0 s < t ≤ ≤ , where αt|s = αt αt|sxs, σ2 t|sI s . Here the marginal qst(xt xt xs) = t − αs N xs)qs(xs)dxs. We can generally derive the connection distribution satisfies qt(xt) = qst(xt (cid:17) | between data scores xs log qs(xs) as stated below: xt log qt(xt) and ∇ Theorem 1. (Proof in Appendix A.1) Let qt(xt) be constructed from the forward process in Eq. (2). Then under some regularity conditions, we have 0 ∀ t|s = σ2 t|sσ2 α2 and σ2 (cid:12) (cid:12) (cid:12) ∇ s < t T , ≤ (cid:16) (cid:82) αt ∇ xt log qt(xt) = Eqst(xs|xt) [αs ∇ ≤ xs log qs(xs)] , (6) where qst(xs | xt) = qst(xt|xs)qs(xs) qt(xt) is the transition probability from xt to xs. xt log qt(xt) is a martingale w.r.t. the reverse- Theorem 1 indicates that the stochastic process of αt time process of xt from timestep T to 0. From the optional stopping theorem [14], the expected ∇ 3 x0 log q0(x0)]. value of a martingale at a stopping time is equal to its initial expected value Eq0(x0) [ It is known that, under a mild boundary condition on q0(x0), there is Eq0(x0) [ x0 log q0(x0)] = 0 (proof is recapped in Appendix A.2). Consequently, as to the stochastic process, the martingale property results in Eqt(xt) [ [0, T ]. Moreover, the martingale property of ∇ the (scaled) data score αt xt log qt(xt) leads to concentration bounds using Azuma's inequality and Doob's martingale inequality as derived in Appendix A.3. Although we do not use these concentration bounds further in this paper, there are other concurrent works that use roughly similar concentration bounds in diffusion models, such as proving consistency [47] or justifying trajectory retrieval [52]. xt log qt(xt)] = 0 for t ∀ ∇ ∇ ∇ ∈ 3.2 A simple calibration trick θ(xt) θ(xt) in practice, there is usually Eqt(xt) [st = 0, despite the fact θ(xt) ηt, where ηt is a time-dependent calibration term that is independent of any particular xt log qt(xt)] = 0. This motivates us to calibrate st Given a pretrained model st that the expect data score is zero as Eqt(xt) [ to st input xt. The calibrated SM objective is written as follows: SM(θ, ηt) ≜ 1 2 xt log qt(xt) 2 2 ∥ θ(xt)] Eqt(xt) ∇ ηt − J t st θ(xt) ∥ (cid:2) Eqt(xt) − − ∇ ⊤ − st θ(xt) ηt + t SM(θ) = J 1 2 ∥ ηt 2 2, ∥ (cid:3) (7) where the second equation holds after the results of Eqt(xt) [ xt log qt(xt)] = 0, and there is t SM(θ) specifically when ηt = 0. Note that the orange part in Eq. (7) is a quadratic t SM(θ, ηt) that minimizes the calibrated t SM(θ, 0) = ∇ (cid:2) (cid:3) st θ(xt) 2 2 . (8) (9) J J function w.r.t. ηt. We look for the optimal η∗ SM objective, from which we can derive η∗ t = Eqt(xt) t SM(θ, ηt), we have SM(θ, η∗ t After taking η∗ t SM(θ) t into t ) = J t = arg minηt J st . θ(xt) (cid:3) (cid:2) 1 2 (cid:13) DSM(θ, η∗ t (cid:13) Eqt(xt) J − DSM(θ) + C t, we have t J 1 2 J J J J − (cid:2) t ) = θ(xt)] (cid:3)(cid:13) t DSM(θ) (cid:13) t SM(θ) = Eqt(xt) [st 2 Since there is 2 for the DSM objective. Similar calibration tricks are also valid under other model parametrizations (cid:13) (cid:13) and SM variants, as formally described in Appendix B.2. (cid:13) (cid:13) Remark. For any pretrained score model st Eqt(xt) [st θ(xt), we can calibrate it into st θ(xt)], θ(xt) 2 which reduces the SM/DSM objectives at timestep t by 1 2. The expectation of the 2 st calibrated score model is always zero, i.e., Eqt(xt) = 0 holds for any θ, θ(xt)] θ(xt) (cid:13) (cid:13) (cid:13) (cid:13) xt log qt(xt)] = 0 satisfied by data scores. which is consistent with Eqt(xt) [ Calibration preserves conservativeness. A theoretical flaw of score-based modeling is that st θ(xt) may not correspond to a probability distribution. To solve this issue, Salimans and Ho [37] develop an energy-based model design, which utilizes the power of score-based modeling and simultaneously θ(xt) is conservative, i.e., there exists a probability distribution pt makes sure that st θ(xt) such that θ(xt) by subtracting xt x⊤ t ηt θ(xt). In this case, after we calibrate st Rk, we have st θ(xt) ∀ ηt, there is st θ(xt)] Eqt(xt) [st , where Zt(θ) = pt θ(xt) exp Eqt(xt) [st ∇ xt log xt log pt θ(xt) = ηt = dxt ∇ − − ∈ (cid:3) (cid:2) pt θ(xt) exp(x⊤ t ηt)Zt(θ) (cid:19) (cid:18) θ(xt) is conservative, its calibrated version st represents the normalization factor. Intuitively, subtracting by ηt corresponds to a shift in the vector space, so if st Conditional cases. As to the conditional DPMs, we usually employ a conditional model st where y ditional data score fined as Eqt(xt) [ the conditional term ηt(y) and the calibrated SM objective is formulated as θ(xt, y), is the conditional context (e.g., class label or text prompt). To learn the con- xt log qt(xt, y), we minimize the SM objective de- . Similar to the conclusion of θ(xt, y), we use ∈ Y xt log qt(xt ∇ SM(θ) ≜ 1 t 2 Eqt(xt,y) J xt log qt(xt)] = 0, there is Eqt(xt|y) [ ∇ y)] = 0. To calibrate st | xt log qt(xt, y) ∥ xt log qt(xt ηt is also conservative. θ(xt) − 2 2 (cid:82) (cid:1) (cid:0) (cid:3) y) = ∇ | st θ(xt, y) − ∇ ∥ (cid:2) ∇ SM(θ, ηt(y)) ≜ 1 2 J Eqt(xt,y) t ηt(y) xt log qt(xt, y) ∥ − ∇ − st θ(xt, y) − ∇ − 2 2 (cid:3) (10) = J t SM(θ) − Eqt(xt,y) θ(xt, y)⊤ηt(y) + st (cid:20) 1 2 ∥ ηt(y) ∥ 2 2 , (cid:21) ∥ (cid:2) 4 ̸ ∈ Y , the optimal η∗ θ(xt, y)]. We highlight and for any y the conditional context y in contrast to the unconditional form in Eq. (7). After taking η∗ t (y) into . This J conditional calibration form can naturally generalize to other model parametrizations and SM variants. t SM(θ, ηt(y)), we have Eqt(xt|y) [st t (y) = Eqt(xt|y) [st t (y) is given by η∗ SM(θ, η∗ t 1 2 Eqt(y) θ(xt, y)] t (y)) = t SM(θ) − 2 2 J J (cid:104)(cid:13) (cid:13) (cid:105) (cid:13) (cid:13) 3.3 Likelihood of calibrated DPMs Now we discuss the effects of calibration on model likelihood. Following the notations in Section 2.3, we use pSDE (θ, ηt) to denote the distributions induced by the reverse-time SDE and ODE processes, respectively, where (θ, ηt) and pODE 0 0 ηt. ∇ xt log qt(xt) is substituted with st T 0 g(t)2 (cid:82) J θ(xt) − pSDE 0 ∥ D (cid:0) ≤ (cid:1) Likelihood of pSDE after the score model is calibrated by ηt, then according to Lemma 1, we have t SM(θ, ηt)dt be the total SM objective q0 SM(θ, ηt; g(t)2) ≜ (θ, ηt). Let (θ, ηt) J 0 KL SM(θ, ηt; g(t)2) + KL (qT pT ). From the result in Eq. (9), there is J D t ; g(t)2) = SM(θ, η∗ ∥ T (cid:0) ∥ KL D − 0 (cid:90) (11) J q0 pSDE 0 g(t)2 Eqt(xt) 2 2 dt. st θ(xt) SM(θ; g(t)2) J Therefore, the likelihood t ; g(t)2) + q0 KL 1 2 (cid:3)(cid:13) (cid:2) after calibration has a lower upper bound of (cid:13) SM(θ; g(t)2) + pT ) for ∥ pSDE may not q0 0 ∥ (cid:0) Likelihood of pODE 0 practice since st θ(xt) and (cid:13) (θ, η∗ t ) (cid:13) KL D SM(θ, η∗ pT ), compared to the bound of KL (qT (cid:1) D ∥ J J pSDE the original . However, we need to clarify that (θ) 0 ∥ necessarily smaller than q0 (cid:1) (cid:0) xt log pODE pODE (θ, ηt) KL 0 ∥ D (θ, η∗ approximately achieves its lowest value. Lu et al. [28] show that t ) (cid:0) can be further bounded by high-order SM objectives (as detailed in Appendix A.4), xtst θ(xt)). Since the calibration term ηt is independent of xtηt = 0, it does not affect the values of high-order SM objectives, and achieves a lower pODE q0 0 ∥ pODE (θ) 0 (cid:0) D ∥ which depend on ∇ xt, i.e., upper bound due to the lower value of the first-order SM objective. (xt; θ) are close. Thus, we have SM(θ, ηt; g(t)2) + (θ, ηt). Note that in Lemma 2, there is a term (cid:1) , since we can only compare their upper bounds. Diff(θ), which is usually small in KL (qT D (θ, η∗ t ) (cid:1) θ(xt) and pSDE 0 ∥ pT ) , ∥ KL D q0 KL (qT xttr ( xtst ∇ q0 ≈ J and (θ) (cid:1) ∇ ∇ ∇ D D D J KL KL (cid:0) (cid:1) (cid:0) (cid:1) t 3.4 Empirical learning fails to achieve Eqt(xt) [st θ(xt)] = 0 A question that naturally arises is whether better architectures or learning algorithms for DPMs (e.g., EDMs [22]) could empirically achieve Eqt(xt) [st θ(xt)] = 0 without calibration? The answer may be negative, since in practice we only have access to a finite dataset sampled from q0(x0). More specifically, assuming that we have a training dataset D ≜ n=1 where xn N xn q0(x0), 0 } { 0, I and defining the kernel density distribution induced by D as qt(xt; D) . ∝ When the quantity of training data approaches infinity, we have limN→∞ qt(xt; D) = qt(xt) holds (cid:17) for (cid:80) [0, T ]. Then the empirical DSM objective trained on D is written as N 2 0 ∼ xt−αtxn 0 σt N n=1 N t ∀ ∈ (cid:16) (cid:12) (cid:12) t DSM(θ; D) ≜ 1 2N J Eq(ε) θ(αtxn st 0 + σtε) + , (12) and it is easy to show that the optimal solution for minimizing universal model capacity) st θ(xt) = Eqt(xt;D) [ ∇ t DSM(θ; D) satisfies (assuming st J xt log qt(xt; D). Given a finite dataset D, there is ∇ xt log qt(xt; D)] = 0, xt log qt(xt; D)] = 0, but typically Eqt(xt) [ indicating that even if the score model is learned to be optimal, there is still Eqt(xt) [st = 0. Thus, the mis-calibration of DPMs is partially due to the dataset bias, i.e., during training we can only access a finite dataset D sampled from q0(x0). Furthermore, when trained on a finite dataset in practice, the learned model will not converge to the optimal solution [15], so there is typically st = 0. θ(xt)] ∇ After calibration, we can at least guarantee that Eqt(xt;D) = 0 always holds on any finite dataset D. In Figure 3, we demonstrate that even state-of-the-art EDMs still have non-zero and semantic Eqt(xt) [st θ(xt)], which emphasises the significance of calibrating DPMs. xt log qt(xt; D) and Eqt(xt;D) [st Eqt(xt;D) [st st θ(xt) θ(xt)] θ(xt)] θ(xt) (13) ∇ = − (cid:2) (cid:3) θ has n=1 (cid:88) (cid:34)(cid:13) (cid:13) (cid:13) (cid:13) ε σt (cid:13) (cid:13) (cid:13) (cid:13) 2(cid:35) 5 ̸ ̸ ̸ ̸ Figure 1: Time-dependent values of 1 2 θ(xt)] 2 ∥ (the second row) calculated on different datasets. The models on CIFAR-10 and CelebA is trained on , 1000), while those on AFHQv2, FFHQ, and ImageNet are trained discrete timesteps (t = 0, 1, on continuous timesteps (t θ(xt) based on εt * * * [0, 1]). We convert data prediction xt ∈ αtxt θ(xt))/σt. The y-axis is clamped into [0, 500]. θ(xt) into noise prediction εt 2 (the first row) and g(t)2 t ∥ θ(xt) = (xt Eqt(xt) [εt Eqt(xt) [εt θ(xt)] 2 ∥ 2σ2 ∥ 2 − 3.5 Amortized computation of Eqt(xt) [st θ(xt)] By default, we are able to calculate and restore the value of Eqt(xt) [st θ(xt)] for a pretrained model st θ(xt), where the selection of timestep t is determined by the inference algorithm, and the expectation over qt(xt) can be approximated by Monte Carlo sampling from a noisy training set. When we do not have access to training data, we can approximate the expectation using data generated (xt; θ). Since we only need to calculate Eqt(xt) [st from pODE θ(xt)] once, the raised computational overhead is amortized as the number of generated samples increases. (xt; θ) or pSDE t t Dynamically recording. In the preceding context, we focus primarily on post-training computing of Eqt(xt) [st θ(xt)]. An alternative strategy would be to dynamically record Eqt(xt) [st θ(xt)] during the pretraining phase of st θ(xt). Specifically, we could construct an auxiliary shallow network hφ(t) parameterized by φ, whose input is the timestep t. We define the expected mean squared error as where the superscript t J Cal(φ) ≜ Eqt(xt) θ(xt)† st denotes the stopping gradient and φ∗ is the optimal solution of minimizing θ(xt)] (assuming sufficient model capacity). T t Cal(φ), where βt 0 βt hφ(t) ∥ (cid:2) t = Eqt(xt) [st SM(θ; λ(t)) + 2 2 ∥ (14) − (cid:3) , † Cal(φ) w.r.t. φ, satisfying hφ∗ (t) = η∗ t J The total training objective can therefore be expressed as is a time-dependent trade-off coefficient for t [0, T ]. * J J ∈ (cid:82) 4 Experiments In this section, we demonstrate that sample quality and model likelihood can be both improved by calibrating DPMs. Instead of establishing a new state-of-the-art, the purpose of our empirical studies is to testify the efficacy of our calibration technique as a simple way to repair DPMs. 4.1 Sample quality Setup. We apply post-training calibration to discrete-time models trained on CIFAR-10 [25] and CelebA [27], which apply parametrization of noise prediction εt θ(xt). In the sampling phase, we employ DPM-Solver [29], an ODE-based sampler that achieves a promising balance between sample efficiency and image quality. Because our calibration directly acts on model scores, it is also compatible with other ODE/SDE-based samplers [3, 26], while we only focus on DPM-Solver cases in this paper. In accordance with the recommendation, we set the end time of DPM-Solver to 10−3 when the number of sampling steps is less than 15, and to 10−4 otherwise. Additional details can be 6 0.00.20.40.60.81.0Timestep0100200300400500g(t)22ae2tkEqt(xt)[≤tμ(xt)]k220.00.20.40.60.81.0Timestep0100200300400500g(t)22ae2tkEqt(xt)[≤tμ(xt)]k2202004006008001000Timestep0.040.060.080.100.1212kEqt(xt)[≤tμ(xt)]k2202004006008001000Timestep051015g(t)22ae2tkEqt(xt)[≤tμ(xt)]k2202004006008001000Timestep123g(t)22ae2tkEqt(xt)[≤tμ(xt)]k2202004006008001000Timestep0.0250.0300.0350.04012kEqt(xt)[≤tμ(xt)]k220.00.20.40.60.81.0Timestep0.200.250.300.350.4012kEqt(xt)[≤tμ(xt)]k220.00.20.40.60.81.0Timestep0.0800.0850.09012kEqt(xt)[≤tμ(xt)]k220.00.20.40.60.81.0Timestep0510152012Eqt(y)£kEqt(xt|y)[≤tμ(xt,y)]k22§0.00.20.40.60.81.0Timestep0100200300400500g(t)22ae2tEqt(y)£kEqt(xt|y)[≤tμ(xt,y)]k22§ImageNet 64×64FFHQ 64×64AFHQv2 64×64CelebA 64×64CIFAR-10 with varying NFE on CIFAR-10. Table 1: Comparison on sample quality measured by FID Experiments are conducted using a linear noise schedule on the discrete-time model from [17]. We consider three variants of DPM-Solver with different orders. The results with mean the actual NFE is order which is smaller than the given NFE, following the setting in [29]. ↓ † NFE order ⌋ × ⌊ Noise prediction DPM-Solver εt θ(xt) εt θ(xt) − Eqt(xt) [εt θ(xt)] 1-order 2-order 3-order 1-order 2-order 3-order 10 20.49 7.35 †23.96 19.31 6.76 †53.50 Number of evaluations (NFE) 25 15 20 30 35 40 12.47 †4.52 4.61 9.72 7.89 4.14 †3.92 †3.89 †3.73 5.75 6.84 6.22 3.74 †3.71 3.68 3.65 †3.65 †3.60 8.86 7.35 11.77 †4.36 4.03 †3.66 4.22 †3.32 †3.33 5.36 6.28 5.76 3.54 †3.44 3.48 3.35 †3.32 †3.31 Table 2: Comparison on sample quality measured by FID 64. Experiments are conducted using a linear noise schedule on the discrete-time model from [41]. The settings of DPM-Solver are the same as on CIFAR-10. with varying NFE on CelebA 64 × ↓ Noise prediction DPM-Solver εt θ(xt) εt θ(xt) − Eqt(xt) [εt θ(xt)] 1-order 2-order 3-order 1-order 2-order 3-order 10 16.74 4.32 †11.92 16.13 4.42 †35.47 Number of evaluations (NFE) 25 15 20 30 35 40 11.85 †3.98 3.91 11.29 †3.94 3.62 7.93 6.67 2.94 †2.88 †2.84 †2.76 7.09 6.06 2.61 †2.66 †2.33 †2.43 5.90 2.88 2.82 5.28 2.54 2.40 5.01 5.38 †2.88 2.84 †2.81 †2.85 4.39 4.87 †2.52 2.49 †2.43 †2.49 found in Lu et al. [29]. By default, we employ the FID score [16] to quantify the sample quality using 50,000 samples. Typically, a lower FID indicates a higher sample quality. In addition, in Table 3, we evaluate using other metrics such as sFID [30], IS [39], and Precision/Recall [36]. Computing Eqt(xt) [εt θ(xt)]. To estimate the expectation over qt(xt), we construct xt = αtx0 + σtε, 0, I) is sampled from a standard where x0 (ε | Gaussian distribution. The selection of timestep t depends on the sampling schedule of DPM-Solver. The computed values of Eqt(xt) [εt θ(xt)] are restored in a dictionary and warped into the output layers of DPMs, allowing existing inference pipelines to be reused. q0(x0) is sampled from the training set and ε ∼ N ∼ We first calibrate the model trained by Ho et al. [17] on the CIFAR-10 dataset and compare it to the original one for sampling with DPM-Solvers. We conduct a systematical study with varying NFE (i.e., number of function evaluations) and solver order. The results are presented in Tables 1 and 3. After calibrating the model, the sample quality is consistently enhanced, which demonstrates the significance of doing so and the efficacy of our method. We highlight the significant improvement in sample quality (4.61 3.32 when using 20 NFE and 3-order DPM-Solver). After model calibration, the number of steps required to achieve convergence for a 3-order DPM-Solver is reduced from 30 to 20, making our method a new option for expediting the sampling of DPMs. In addition, as a point of comparison, the 3-order DPM-Solver with 1,000 NFE can only yield an FID score of 3.45 when using the original model, which, along with the results in Table 1, indicates that model calibration helps to improve the convergence of sampling. 4.22 when using 15 NFE and 3-order DPM-Solver; 3.89 → → ≥ Then, we conduct experiments with the discrete-time model trained on the CelebA 64x64 dataset by Song et al. [41]. The corresponding sample quality comparison is shown in Table 2. Clearly, model calibration brings significant gains (3.91 3.62 when using 15 NFE and 3-order DPM-Solver; 2.84 2.33 when using 20 NFE and 3-order DPM-Solver) that are consistent with those on the CIFAR-10 dataset. This demonstrates the prevalence of the mis-calibration issue in existing DPMs and the efficacy of our correction. We still observe that model calibration improves convergence of sampling, and as shown in Figure 2, our calibration could help to reduce ambiguous generations. More generated images are displayed in Appendix C. → → 7 , precision , Table 3: Comparison on sample quality measured by different metrics, including FID ↓ with varying NFE on CIFAR-10. We use Base inception score (IS) to denote the baseline εt θ(xt)]. The sampler is DPM-Solver with different orders. Note that FID is computed by the PyTorch checkpoint of Inception-v3, while sFID/IS/Precision/Recall are computed by the Tensorflow checkpoint of Inception-v3 following github.com/kynkaat/improved-precision-and-recall-metric. ↑ θ(xt) and Ours to denote calibrated score εt Eqt(xt) [εt , sFID ↓ and recall θ(xt) − ↑ ↑ Method Number of evaluations (NFE) 25 FID sFID IS Pre. Rec. FID sFID IS Pre. Rec. FID sFID IS Pre. Rec. 20 30 Base Ours 1-ord. 9.72 6.03 8.49 0.641 0.542 7.89 5.45 8.68 0.644 0.556 6.84 5.12 8.76 0.650 0.565 2-ord. 4.14 4.36 9.15 0.654 0.590 3.92 4.22 9.17 0.657 0.591 3.74 4.18 9.20 0.658 0.591 3-ord. 3.89 4.18 9.29 0.652 0.597 3.73 4.15 9.21 0.657 0.595 3.65 4.12 9.22 0.658 0.593 1-ord. 8.86 6.01 8.56 0.649 0.544 7.35 5.42 8.76 0.653 0.560 6.28 5.09 8.84 0.653 0.568 2-ord. 4.03 4.31 9.17 0.661 0.592 3.66 4.20 9.20 0.664 0.594 3.54 4.14 9.23 0.662 0.599 3-ord. 3.32 4.14 9.38 0.657 0.603 3.33 4.11 9.28 0.665 0.597 3.35 4.08 9.27 0.662 0.600 Figure 2: Selected images on CIFAR-10 (generated with NFE = 20 using 3-order DPM-Solver) demonstrating that our calibration could reduce ambiguous generations, such as generations that resemble both horse and dog. However, we must emphasize that not all generated images have a visually discernible difference before and after calibration. 4.2 Model likelihood 0 αtxt (θ, η∗ 64 [7], FFHQ 64 As described in Section 3.3, calibration contributes to reducing the SM objective, thereby decreasing (θ, η∗ the upper bound of the KL divergence between model distribution at timestep t = 0 (either pSDE t ) or pODE t )) and data distribution q0. Consequently, it aids in raising the lower bound of model 0 likelihood. In this subsection, we examine such effects by evaluating the aforementioned DPMs on the CIFAR-10 and CelebA datasets. We also conduct experiments with continuous-time models 64 [9] trained by Karras et al. [22] on AFHQv2 64 × datasets considering their top performance. These models apply parametrization of data prediction xt θ(xt) based on the relationship εt θ(xt), and for consistency, we convert it to align with εt θ(xt) = (xt Given that we employ noise prediction models in practice, we first estimate 1 2 2 at [0, T ], which reflects the decrement on the SM objective at t according to Eq. (9) (up timestep t to a scaling factor of 1/σ2 t ). We approximate the expectation using Monte Carlo (MC) estimation with training data points. The results are displayed in the first row of Figure 1. Notably, the value of 1 2 2 varies significantly along with timestep t: it decreases relative to t for CelebA 2 ∥ ∥ but increases in all other cases (except for t 64). Ideally, there should [0.4, 1.0] on ImageNet 64 be 1 2 2 = 0 at any t. Such inconsistency reveals that mis-calibration issues xt log qt(xt)] ∥ exist in general, although the phenomenon may vary across datasets and training mechanisms. θ(xt))/σt, as detailed in Kingma et al. [23] and Appendix B.2. 64 [21], and ImageNet 64 Eqt(xt) [εt Eqt(xt) [εt Eqt(xt) [ θ(xt)] θ(xt)] 2 ∥ 2 ∥ ∇ × × × − ∈ ∈ ∥ T 0 g(t)2 Then, we quantify the gain of model calibration on increasing the lower bound of model likelihood, 2 which is 1 2 dt according to Eq. (11). We first rewrite it with the model θ(xt)] 2 parametrization of noise prediction εt θ(xt), and it can be straightforwardly demonstrated that it equals (cid:13) (cid:13) 2 2 using MC 2. Therefore, we calculate the value of g(t)2 t ∥ (cid:82) Eqt(xt) [εt Eqt(xt) [st Eqt(xt) [εt (cid:13) (cid:13) θ(xt)] g(t)2 2σ2 θ(xt)] t ∥ T 0 2σ2 ∥ ∥ 2 (cid:82) 8 w/o calibration (baseline)w/ calibration (ours) Figure 3: Visualization of the expected predicted noises with increasing t. For each dataset, the first row displays Eqt(xt) [εt θ(xt)] (after normalization) and the second row highlights the top-10% pixels that Eqt(xt) [εt θ(xt)] has high values. The DPM on CelebA is a discrete-time model with 1000 timesteps [41] and that on FFHQ is a continuous-time one [22]. estimation and report the results in the second row of Figure 1. The integral is represented by the area under the curve (i.e., the gain of model calibration on the lower bound of model likelihood). Various datasets and model architectures exhibit non-trivial gains, as observed. In addition, we notice that the DPMs trained by Karras et al. [22] show patterns distinct from those of DDPM [17] and DDIM [41], indicating that different DPM training mechanisms may result in different mis-calibration effects. Visualizing Eqt(xt) [εt θ(xt)]. To better understand the inductive bias learned by DPMs, we visualize the expected predicted noises Eqt(xt) [εt θ(xt)] for timestep from 0 to T , as seen in Figure 3. For each dataset, the first row normalizes the values of Eqt(xt) [εt θ(xt)] into [0, 255]; the second row calculates pixel-wise norm (across RGB channels) and highlights the top-10% locations with the highest norm. As we can observe, on facial datasets like CelebA and FFHQ, there are obvious facial patterns inside Eqt(xt) [εt θ(xt)], while on other datasets like CIFAR-10, ImageNet, as well as the animal face dataset AFHQv2, the patterns inside Eqt(xt) [εt θ(xt)] are more like random noises. Besides, the facial patterns in Figure 3 are more significant when t is smaller, and become blurry when t is close to T . This phenomenon may be attributed to the bias of finite training data, which is detrimental to generalization during sampling and justifies the importance of calibration as described in Section 3.4. θ(xt)]. 4.3 Ablation studies We conduct ablation studies focusing on the estimation methods of Eqt(xt) [εt Estimating Eqt(xt) [εt θ(xt)] with partial training data. In the post-training calibration setting, our primary algorithmic change is to subtract the calibration term Eqt(xt) [εt θ(xt)] from the pretrained DPMs' output. In the aforementioned studies, the expectation in Eqt(xt) [εt θ(xt)] (or its variant of other model parametrizations) is approximated with MC estimation using all training images. However, there may be situations where training data are (partially) inaccessible. To evaluate the effectiveness of our method under these cases, we examine the number of training images used to estimate the calibration term on CIFAR-10. To determine the quality of the estimated calibration term, we sample from the calibrated models using a 3-order DPM-Solver running for 20 steps and evaluate the corresponding FID score. The results are listed in the left part of Table 4. As observed, we need to use the majority of training images (at least 20,000) to estimate the calibration term. We deduce that this is because the CIFAR-10 images are rich in diversity, necessitating a non-trivial number of training images to cover the various modes and produce a nearly unbiased calibration term. Estimating Eqt(xt) [εt θ(xt)] with generated data. In the most extreme case where we do not have access to any training data (e.g., due to privacy concerns), we could still estimate the expectation over qt(xt) with data generated from pODE (x0; θ). Specifically, under the hypothesis that pODE (x0; θ) 0 q0(x0) (DPM-Solver is an ODE-based sampler), we first generate (x0; θ) or pSDE (x0; θ) pODE 0 x0 ≥ 0 0 ≈ ∼ 9 (cid:101) CelebA64×64FFHQ64×64Timestep t0T Table 4: Sample quality varies w.r.t. the num- ber of training images (left part) and generated images (right part) used to estimate the cali- bration term on CIFAR-10. In the generated data case, the images used to estimate the cali- bration term Eqt(xt) [εt θ(xt)] is crafted with 50 sampling steps by a 3-order DPM-Solver. Figure 4: Dynamically recording Eqt(xt) [εt θ(xt)]. During training, the mean square error between the ground truth and the outputs of a shallow net- work for recording the calibration terms rapidly decreases, across different timesteps t. Training data # of samples FID Generated data # of samples FID 500 1,000 2,000 5,000 10,000 20,000 50,000 ↓ 55.38 18.72 8.05 4.31 3.47 3.25 3.32 2,000 5,000 10,000 20,000 50,000 100,000 200,000 ↓ 8.80 4.53 3.78 3.31 3.46 3.47 3.46 xt t (cid:101) and construct ∼ approximated by the expectation over pODE x0 + σtε, where xt = αt pODE t (xt; θ). (xt; θ). Then, the expectation over qt(xt) could be (cid:101) (cid:101) Empirically, on the CIFAR-10 dataset, we adopt a 3-order DPM-Solver to generate a set of samples from the pretrained model of Ho et al. [17], using a relatively large number of sampling steps (e.g., 50 steps). This set of generated data is used to calculate the calibration term Eqt(xt) [εt θ(xt)]. Then, we obtain the calibrated model εt θ(xt)] and craft new images based on a 3-order 20-step DPM-Solver. In the right part of Table 4, we present the results of an empirical investigation into how the number of generated images influences the quality of model calibration. Eqt(xt) [εt θ(xt) − Using the same sampling setting, we also provide two reference points: 1) the originally mis-calibrated model can reach the FID score of 3.89, and 2) the model calibrated with training data can reach the FID score of 3.32. Comparing these results reveals that the DPM calibrated with a large number of high-quality generations can achieve comparable FID scores to those calibrated with training samples (see the result of using 20,000 generated images). Additionally, it appears that using more generations is not advantageous. This may be because the generations from DPMs, despite being known to cover diverse modes, still exhibit semantic redundancy and deviate slightly from the data distribution. Dynamical recording. We simulate the proposed dynamical recording technique. Specifically, we use a 3-layer MLP of width 512 to parameterize the aforementioned network hφ(t) and train it with an Adam optimizer [24] to approximate the expected predicted noises Eqt(xt) [εt θ(xt) comes from the pretrained noise prediction model on CIFAR-10 [17]. The training of hφ(t) runs for 1,000 epochs. Meanwhile, using the training data, we compute the expected predicted noises with MC estimation and treat them as the ground truth. In Figure 4, we compare them to the outputs of hφ(t) and visualize the disparity measured by mean square error. As demonstrated, as the number of training epochs increases, the network hφ(t) quickly converges and can form a relatively reliable approximation to the ground truth. Dynamic recording has a distinct advantage of being able to be performed during the training of DPMs to enable immediate generation. We clarify that better timestep embedding techniques and NN architectures can improve approximation quality even further. θ(xt)], where εt 5 Discussion We propose a straightforward method for calibrating any pretrained DPM that can provably reduce the values of SM objectives and, as a result, induce higher values of lower bounds for model likelihood. We demonstrate that the mis-calibration of DPMs may be inherent due to the dataset bias and/or sub-optimally learned model scores. Our findings also provide a potentially new metric for assessing a diffusion model by its degree of "uncalibration", namely, how far the learned scores deviate from the essential properties (e.g., the expected data scores should be zero). Limitations. While our calibration method provably improves the model's likelihood, it does not necessarily yield a lower FID score, as previously discussed [45]. Besides, for text-to-image genera- tion, post-training computation of Eqt(xt|y) [st θ(xt, y)] becomes infeasible due to the exponentially large number of conditions y, necessitating dynamic recording with multimodal modules. 10 02004006008001000TrainingEpoch0.20.30.40.50.60.70.8MeanSquareErrort=0t=250t=500t=750t=999 Acknowledgements Zhijie Deng was supported by Natural Science Foundation of Shanghai (No. 23ZR1428700) and the Key Research and Development Program of Shandong Province, China (No. 2023CXGC010112). References [1] Kazuoki Azuma. Weighted sums of certain dependent random variables. Tohoku Mathematical Journal, Second Series, 19(3):357–367, 1967. [2] Arpit Bansal, Eitan Borgnia, Hong-Min Chu, Jie S Li, Hamid Kazemi, Furong Huang, Micah Goldblum, Jonas Geiping, and Tom Goldstein. Cold diffusion: Inverting arbitrary image transforms without noise. arXiv preprint arXiv:2208.09392, 2022. [3] Fan Bao, Chongxuan Li, Jun Zhu, and Bo Zhang. Analytic-dpm: an analytic estimate of the optimal reverse variance in diffusion probabilistic models. In International Conference on Learning Representations (ICLR), 2022. [4] Ruojin Cai, Guandao Yang, Hadar Averbuch-Elor, Zekun Hao, Serge Belongie, Noah Snavely, and Bharath Hariharan. Learning gradient fields for shape generation. In European Conference on Computer Vision (ECCV), 2020. [5] Nanxin Chen, Yu Zhang, Heiga Zen, Ron J Weiss, Mohammad Norouzi, and William Chan. Wavegrad: Estimating gradients for waveform generation. In International Conference on Learning Representations (ICLR), 2021. [6] Ricky TQ Chen, Yulia Rubanova, Jesse Bettencourt, and David K Duvenaud. Neural ordinary differential equations. In Advances in Neural Information Processing Systems (NeurIPS), 2018. [7] Yunjey Choi, Youngjung Uh, Jaejun Yoo, and Jung-Woo Ha. Stargan v2: Diverse image synthesis for multiple domains. In IEEE International Conference on Computer Vision (CVPR), 2020. [8] Giannis Daras, Mauricio Delbracio, Hossein Talebi, Alexandros G Dimakis, and Peyman Milan- far. Soft diffusion: Score matching for general corruptions. arXiv preprint arXiv:2209.05442, 2022. [9] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2009. [10] Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. In Advances in Neural Information Processing Systems (NeurIPS), 2021. [11] Joseph L Doob and Joseph L Doob. Stochastic processes, volume 7. Wiley New York, 1953. [12] Bradley Efron. Tweedie's formula and selection bias. Journal of the American Statistical Association, 106(496):1602–1614, 2011. [13] Rinon Gal, Yuval Alaluf, Yuval Atzmon, Or Patashnik, Amit H Bermano, Gal Chechik, and Daniel Cohen-Or. An image is worth one word: Personalizing text-to-image generation using textual inversion. arXiv preprint arXiv:2208.01618, 2022. [14] Geoffrey Grimmett and David Stirzaker. Probability and random processes. Oxford university press, 2001. [15] Xiangming Gu, Chao Du, Tianyu Pang, Chongxuan Li, Min Lin, and Ye Wang. On memorization in diffusion models. arXiv preprint arXiv:2310.02664, 2023. [16] Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. In Advances in Neural Information Processing Systems (NeurIPS), pages 6626–6637, 2017. 11 [17] Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. In Advances in Neural Information Processing Systems (NeurIPS), 2020. [18] Jonathan Ho, William Chan, Chitwan Saharia, Jay Whang, Ruiqi Gao, Alexey Gritsenko, Diederik P Kingma, Ben Poole, Mohammad Norouzi, David J Fleet, et al. Imagen video: High definition video generation with diffusion models. arXiv preprint arXiv:2210.02303, 2022. [19] Jonathan Ho, Tim Salimans, Alexey Gritsenko, William Chan, Mohammad Norouzi, and David J Fleet. Video diffusion models. arXiv preprint arXiv:2204.03458, 2022. [20] Aapo Hyv ̈arinen. Estimation of non-normalized statistical models by score matching. Journal of Machine Learning Research (JMLR), 6(Apr):695–709, 2005. [21] Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In IEEE International Conference on Computer Vision (CVPR), 2019. [22] Tero Karras, Miika Aittala, Timo Aila, and Samuli Laine. Elucidating the design space of diffusion-based generative models. In Advances in Neural Information Processing Systems (NeurIPS), 2022. [23] Diederik Kingma, Tim Salimans, Ben Poole, and Jonathan Ho. Variational diffusion models. In Advances in Neural Information Processing Systems (NeurIPS), 2021. [24] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. [25] Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009. [26] Luping Liu, Yi Ren, Zhijie Lin, and Zhou Zhao. Pseudo numerical methods for diffusion models on manifolds. In International Conference on Learning Representations (ICLR), 2022. [27] Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In International Conference on Computer Vision (ICCV), 2015. [28] Cheng Lu, Kaiwen Zheng, Fan Bao, Jianfei Chen, Chongxuan Li, and Jun Zhu. Maximum likelihood training for score-based diffusion odes by high order denoising score matching. In International Conference on Machine Learning (ICML), 2022. [29] Cheng Lu, Yuhao Zhou, Fan Bao, Jianfei Chen, Chongxuan Li, and Jun Zhu. Dpm-solver: A fast ode solver for diffusion probabilistic model sampling in around 10 steps. In Advances in Neural Information Processing Systems (NeurIPS), 2022. [30] Charlie Nash, Jacob Menick, Sander Dieleman, and Peter W Battaglia. Generating images with sparse representations. arXiv preprint arXiv:2103.03841, 2021. [31] Tianyu Pang, Kun Xu, Chongxuan Li, Yang Song, Stefano Ermon, and Jun Zhu. Efficient learning of generative models via finite-difference score matching. In Advances in Neural Information Processing Systems (NeurIPS), 2020. [32] Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical text-conditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022. [33] Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Bj ̈orn Ommer. High- resolution image synthesis with latent diffusion models. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2022. [34] Nataniel Ruiz, Yuanzhen Li, Varun Jampani, Yael Pritch, Michael Rubinstein, and Kfir Aberman. Dreambooth: Fine tuning text-to-image diffusion models for subject-driven generation. arXiv preprint arXiv:2208.12242, 2022. [35] Chitwan Saharia, Jonathan Ho, William Chan, Tim Salimans, David J Fleet, and Mohammad Norouzi. Image super-resolution via iterative refinement. IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI), 2022. 12 [36] Mehdi SM Sajjadi, Olivier Bachem, Mario Lucic, Olivier Bousquet, and Sylvain Gelly. Assess- ing generative models via precision and recall. In Advances in Neural Information Processing Systems (NeurIPS), 2018. [37] Tim Salimans and Jonathan Ho. Should ebms model the energy or the score? In Energy Based Models Workshop-ICLR, 2021. [38] Tim Salimans and Jonathan Ho. Progressive distillation for fast sampling of diffusion models. In International Conference on Learning Representations (ICLR), 2022. [39] Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. In Advances in Neural Information Processing Systems (NeurIPS), 2016. [40] Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsuper- vised learning using nonequilibrium thermodynamics. In International Conference on Machine Learning (ICML), pages 2256–2265. PMLR, 2015. [41] Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. In International Conference on Learning Representations (ICLR), 2021. [42] Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. In Advances in Neural Information Processing Systems (NeurIPS), pages 11895– 11907, 2019. [43] Yang Song and Stefano Ermon. Improved techniques for training score-based generative models. In Advances in Neural Information Processing Systems (NeurIPS), 2020. [44] Yang Song, Sahaj Garg, Jiaxin Shi, and Stefano Ermon. Sliced score matching: A scalable approach to density and score estimation. In Conference on Uncertainty in Artificial Intelligence (UAI), 2019. [45] Yang Song, Conor Durkan, Iain Murray, and Stefano Ermon. Maximum likelihood training of score-based diffusion models. In Advances in Neural Information Processing Systems (NeurIPS), 2021. [46] Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In International Conference on Learning Representations (ICLR), 2021. [47] Yang Song, Prafulla Dhariwal, Mark Chen, and Ilya Sutskever. Consistency models. arXiv preprint arXiv:2303.01469, 2023. [48] Arash Vahdat, Karsten Kreis, and Jan Kautz. Score-based generative modeling in latent space. In Advances in Neural Information Processing Systems (NeurIPS), 2021. [49] Pascal Vincent. A connection between score matching and denoising autoencoders. Neural computation, 23(7):1661–1674, 2011. [50] Zekai Wang, Tianyu Pang, Chao Du, Min Lin, Weiwei Liu, and Shuicheng Yan. Better diffusion models further improve adversarial training. In International Conference on Machine Learning (ICML), 2023. [51] Minkai Xu, Lantao Yu, Yang Song, Chence Shi, Stefano Ermon, and Jian Tang. Geodiff: A geometric diffusion model for molecular conformation generation. In International Conference on Learning Representations (ICLR), 2022. [52] Kexun Zhang, Xianjun Yang, William Yang Wang, and Lei Li. Redi: Efficient learning-free diffusion inference via trajectory retrieval. arXiv preprint arXiv:2302.02285, 2023. 13 A Detailed derivations In this section, we provide detailed derivations for the Theorem and equations shown in the main text. We follow the regularization assumptions listed in Song et al. [45]. A.1 Proof of Theorem 1 Proof. For any two timesteps 0 as qst(xt | distribution qt(xt) = (cid:16) xs) = xt N ≤ αt|sxs, σ2 qst(xt (cid:12) (cid:12) (cid:12) s < t t|sI (cid:17) , where αt|s = αt αs xs)qs(xs)dxs and we have | ≤ T , i.e., the transition probability from xs to xt is written s . The marginal and σ2 t|s = σ2 α2 t|sσ2 t − (cid:82) xt log qt(xt) = ∇ t|s xt 1 αt|s ∇α−1 1 αt|s ∇α−1 log 1 αk t|s (cid:32) EN (cid:16) xs α−1 t|s xt,α−2 t|s σ2 t|sI (cid:17) [qs(xs)] (cid:33) log t|s xt EN (cid:16) η (cid:12) (cid:12) 0,α−2 t|s σ2 t|sI (cid:17) qs(α−1 t|s xt + η) (cid:105)(cid:19) EN (cid:16) η 0,α−2 t|s σ2 t|sI (cid:12) αt|sEN (cid:12) (cid:16) η 0,α−2 (cid:18) (cid:17) (cid:12) ∇α−1 (cid:12) t|s xt (cid:104) t|s σ2 t|sI (cid:17) qs(α−1 (cid:104) t|s xt + η) (cid:105) qs(α−1 t|s xt + η) EN (cid:16) η (cid:12) (cid:12) EN (cid:16) (cid:12) (cid:12) 0,α−2 t|s σ2 (cid:17) t|sI (cid:104) qs(α−1 t|s xt + η) (cid:104) αt|sEN 0,α−2 (cid:16) (cid:17) η t|sI t|s σ2 (cid:17) [qs(xs) (cid:12) (cid:12) t|s σ2 t|sI t|s xt,α−2 α−1 xs αt|sEN (cid:12) (cid:12) xs (cid:16) t|s xt,α−2 α−1 t|s σ2 t|sI ∇ (cid:17) [qs(xs)] (cid:105) t|s xt+η log qs(α−1 ∇α−1 qs(α−1 t|s xt + η) (cid:105) t|s xt + η) (cid:105) (cid:104) xs log qs(xs)] (15) = = = = xt αt|sxs, σ2 t|sI (cid:12) (cid:12) qs(xs) N = (cid:82) = 1 αt|s (cid:16) (cid:12) αt|s (cid:12) N (cid:16) (cid:82) Eqst(xs|xt) [ ∇ (cid:17) xt αt|sxs, σ2 (cid:17) (cid:12) xs log qs(xs)] . (cid:12) xs log qs(xs)dxs qs(xs)dxs ∇ t|sI Note that when the transition probability qst(xt process, Eqst(xs|xt) [αs there is αt > 0 for xs log qs(xs)]. t ∀ ∈ ∇ [0, T ], and thus we achieve αt xs) corresponds to a well-defined forward xt log qt(xt) = | ∇ A.2 Proof of Eq0(x0) [ ∇ x0 log q0(x0)] = 0 2 denotes the family of functions with Proof. The input variable x ∈ C continuous second-order derivatives.1 We use xi denote the i-th element of x, then we can derive the expectation Rk and q0(x0) 2, where ∈ C Eq0(x0) ∂ ∂xi 0 (cid:20) log q0(x0) = (cid:21) = = = (cid:90) (cid:90) (cid:90) (cid:90) * * * (cid:90) (cid:90) * * * ∂ ∂xi d dxi 0 q0(x0) ∂ ∂xi 0 log q0(x0)dx1 0dx2 0 * * * dxk 0 ∂ ∂xi 0 q0(x0)dx1 0dx2 0 * * * dxk 0 (16) q0(xi 0, x\i 0 )dx\i 0 dxi 0 (cid:19) 0 (cid:18)(cid:90) q0(xi 0)dxi 0 = 0, 1This continuously differentiable assumption can be satisfied by adding a small Gaussian noise (e.g., with variance of 0.0001) on the original data distribution, as done in Song and Ermon [42]. 14 0 denotes all the k where x\i under the boundary condition that limxi conclusion that Eq0(x0) [ − x0 log q0(x0)] = 0. ∇ 1 elements in x0 except for the i-th one. The last equation holds [K]. Thus, we achieve the 0) = 0 hold for any i 0→∞ q0(xi ∈ A.3 Concentration bounds We describe concentration bounds [11, 1] of the martingale αt Azuma's inequality. For discrete reverse timestep t = T, T constants 0 < c1, c2, ∂ ∂xi almost surely. Then xt log qt(xt). 1, such that for the i-th element of x, ∂ ∂xi t ε > 0, the probability (note that α0 = 1) αt−1 log qt−1(xt−1) αt log qt(xt) Bt and Bt , < * * * * * * At ∞ t−1 ∇ − ≤ − ≤ , 0, Assuming that there exist At ct ≤ − (17) ∀ ∂ ∂xi 0 P log q0(x0) (cid:18)(cid:12) (cid:12) (cid:12) Specially, considering that qT (xT ) (cid:12) approximately obtain ∂ ∂xi T αT log qT (xT ) − ε ≥ 2 exp (cid:32)− (xT 0, | ≈ N σ2I), there is log qT (xT ) (cid:80) (cid:12) (cid:12) (cid:12) (cid:12) ≤ (cid:19) ∂ ∂xi T . (18) 2ε2 T t=1 c2 t (cid:33) xi (cid:101)σ2 . Thus, we can T ≈ − P log q0(x0) + ∂ ∂xi 0 (cid:101) αT xi T σ2 ε ≥ ≤ 2 exp (cid:32)− 2ε2 T t=1 c2 t (cid:33) (cid:12) (cid:12) (cid:12) Doob's inequality. For continuous reverse timestep t from T to 0, if the sample paths of the (cid:12) martingale are almost surely right-continuous, then for the i-th element of x we have (note that α0 = 1) (cid:18)(cid:12) (cid:12) (cid:12) (cid:12) (cid:80) (cid:19) (cid:101) . (19) P sup 0≤t≤T (cid:18) ∂ ∂xi t αt log qt(xt) C ≥ ≤ (cid:19) Eq0(x0) max (cid:104) ∂ ∂xi 0 C (cid:16) log q0(x0), 0 (cid:17)(cid:105) . (20) A.4 High-order SM objectives Lu et al. [28] show that the KL divergence KL q0 pODE 0 (θ) can be bounded as KL ∥ pT ) + (cid:0) ∥ Fisher(θ) is a weighted sum of Fisher divergence between qt(xt) and pODE T SM(θ; g(t)2) D KL (qT pODE 0 ∥ ≤ D (θ) (cid:112) (cid:112) q0 D J J (cid:0) (cid:1) (cid:1) * t J Fisher(θ), (θ) as where Fisher(θ) = J 1 2 g(t)2DF qt pODE t ∥ (θ) dt. Moreover, Lu et al. [28] prove that if the spectral norm of Hessian matrix such that 0 (cid:90) [0, T ] and t ∈ ∀ 2 xt log pODE ∥∇ t (cid:1) (cid:0) Rk, there exist a constant CF such that xt ∈ ∀ CF , and there exist δ1, δ2, δ3 > 0 (xt; θ) 2 ≤ ∥ ∥ st θ(xt) xtst xttr ∥∇ − ∇ θ(xt) xt log qt(xt) ∥ 2 ≤ 2 xt log qt(xt) ∥ xttr − ∇ xtst θ(xt) δ1, F δ2, ≤ 2 xt log qt(xt) ∥∇ ∇ F is the Frobenius norm of matrix. Then there exist a function U (t; δ1, δ2, δ3, q) that = 0) w.r.t. δ1, δ2, and δ3, respectively, such that the − ∇ ∇ ≤ (cid:0) (cid:0) (cid:1) ∥ * ∥ where independent of θ and strictly increasing (if g(t) Fisher divergence can be bounded as DF The case after calibration. When we impose the calibration term η∗ score model st have (cid:0) (cid:1) t = 0 and thus η∗ t , there is pODE t ∥ xt (st θ(xt) θ(xt) xtη∗ (θ) ∇ ∇ ≤ − qt (cid:1) − U (t; δ1, δ2, δ3, q). t = Eqt(xt) [st xtst η∗ t ) = θ(xt)] to get the θ(xt). Then we ∇ δ3, 2 ∥ (21) (22) (23) st η∗ θ(xt) t − ∇ − ∥ η∗ st θ(xt) t − st θ(xt) (cid:1) xt xttr (cid:0) δ′ xt log qt(xt) 2 1 ≤ ∥ 2 xt log qt(xt) F ∥ − ∇ η∗ xttr t ∥∇ ≤ xt − − ∇ ∇ ∥∇ ∇ δ1, δ2, ≤ 2 xt log qt(xt) (cid:0) (cid:0) (cid:1)(cid:1) 15 (cid:0) (24) δ3. 2 ∥ ≤ (cid:1) ̸ pODE t (θ, η∗ t ) qt qt pODE t pODE qt t ∥ pODE q0 0 ∥ From these, we know that the Fisher divergence DF U (t; δ1, δ2, δ3, q), namely, DF DF (θ, η∗ t ) . Consequently, we can get lower upper bounds for both (θ) (θ, η∗ t ) (cid:1) D B Model parametrization This section introduces different parametrizations used in diffusion models and provides their cali- brated instantiations. ≤ ≤ has a lower upper bound compared to t ) and (cid:0) , compared to J , respectively. Fisher(θ) and 1, δ2, δ3, q) Fisher(θ, η∗ pODE 0 ∥ KL (cid:0) (cid:0) (cid:1) D (θ) q0 J KL ∥ ∥ (cid:1) (cid:0) (cid:1) (cid:1) (cid:0) U (t; δ′ B.1 Preliminary Along the research routine of diffusion models, different model parametrizations have been used, including score prediction st θ(xt) [42, 46], noise prediction εt θ(xt) [17, 33], data prediction xt θ(xt) [23, 32], and velocity prediction vt θ(xt) [38, 18]. Taking the DSM objective as the training loss, its instantiation at timestep t [0, T ] is written as ∈ t DSM(θ) = J 1 2 Eq0(x0),q(ε) α2 t 2σ4 t (cid:104) Eq0(x0),q(ε) 1 2σ2 t α2 t 2σ2 t Eq0(x0),q(ε) Eq0(x0),q(ε) θ(xt) + ε st ∥ xt θ(xt) εt θ(xt) vt θ(xt) ∥ (cid:2) ∥ (cid:2) ∥ (cid:2) 2 2 σt ∥ x0 − (cid:105) 2 2 ∥ 2 2 ∥ (cid:3) (αtε ε − −    , score prediction; , data prediction; noise prediction; (25) , (cid:3) σtx0) 2 2 ∥ , velocity prediction. − B.2 Calibrated instantiation Under different model parametrizations, we can derive the optimal calibration terms η∗ ing (cid:3) t DSM(θ, ηt) as t that minimiz- J θ(xt)] , θ(xt)] , Eqt(xt) [st Eqt(xt) [xt Eqt(xt) [εt Eqt(xt) [vt η∗ t =    θ(xt)] Eq0(x0) [x0] , data prediction; − score prediction; noise prediction; velocity prediction. Taking η∗ t into J t DSM(θ, ηt) we can obtain the gap θ(xt)] + σtEq0(x0) [x0] , t DSM(θ) J − J DSM(θ, η∗ t t ) = Eqt(xt) [st θ(xt)] 2 2, ∥ θ(xt)] θ(xt)] − 2 2, ∥ Eqt(xt) [xt Eqt(xt) [εt Eq0(x0) [x0] 2 2, ∥ score prediction; data prediction; noise prediction; Eqt(xt) [vt θ(xt)] + σtEq0(x0) [x0] 2 2, ∥ velocity prediction. 1 2 ∥ α2 t 2σ4 t ∥ 1 2σ2 t ∥ α2 t 2σ2 t ∥    C Visualization of the generations We further show generated images in Figure 5 to double confirm the efficacy of our calibration method. Our calibration could help to reduce ambiguous generations on both CIFAR-10 and CelebA. (26) (27) (a) CIFAR-10, w/ calibration (b) CIFAR-10, w/o calibration (c) CelebA, w/ calibration (d) CelebA, w/o calibration Figure 5: Unconditional generation results on CIFAR-10 and CelebA using models from [17] and [41] respectively. The number of sampling steps is 20 based on the results in Tables 1 and 2. 16
http://arxiv.org/abs/2302.11343v1
2023-02-21T14:03:47
2023-02-21T14:03:47
Advancing Stuttering Detection via Data Augmentation, Class-Balanced Loss and Multi-Contextual Deep Learning
Stuttering is a neuro-developmental speech impairment characterized by uncontrolled utterances (interjections) and core behaviors (blocks, repetitions, and prolongations), and is caused by the failure of speech sensorimotors. Due to its complex nature, stuttering detection (SD) is a difficult task. If detected at an early stage, it could facilitate speech therapists to observe and rectify the speech patterns of persons who stutter (PWS). The stuttered speech of PWS is usually available in limited amounts and is highly imbalanced. To this end, we address the class imbalance problem in the SD domain via a multibranching (MB) scheme and by weighting the contribution of classes in the overall loss function, resulting in a huge improvement in stuttering classes on the SEP-28k dataset over the baseline (StutterNet). To tackle data scarcity, we investigate the effectiveness of data augmentation on top of a multi-branched training scheme. The augmented training outperforms the MB StutterNet (clean) by a relative margin of 4.18% in macro F1-score (F1). In addition, we propose a multi-contextual (MC) StutterNet, which exploits different contexts of the stuttered speech, resulting in an overall improvement of 4.48% in F 1 over the single context based MB StutterNet. Finally, we have shown that applying data augmentation in the cross-corpora scenario can improve the overall SD performance by a relative margin of 13.23% in F1 over the clean training.
[ "Shakeel A. Sheikh", "Md Sahidullah", "Fabrice Hirsch", "Slim Ouni" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.11343v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.11343v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.SD", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.SD", "cs.LG", "eess.AS" ]
IEEE JOURNAL OF BIOMEDICAL AND HEALTH INFORMATICS, VOL. XX, NO. XX, XXXX 2022 1 Advancing Stuttering Detection via Data Augmentation, Class-Balanced Loss and Multi-Contextual Deep Learning Shakeel A. Sheikh, Md Sahidullah, Fabrice Hirsch, Slim Ouni 3 2 0 2 b e F 1 2 ] D S . s c [ 1 v 3 4 3 1 1 . 2 0 3 2 : v i X r a Abstract- Stuttering is a neuro-developmental speech impairment characterized by uncontrolled utterances (in- terjections) and core behaviors (blocks, repetitions, and prolongations), and is caused by the failure of speech sen- sorimotors. Due to its complex nature, stuttering detection (SD) is a difficult task. If detected at an early stage, it could facilitate speech therapists to observe and rectify the speech patterns of persons who stutter (PWS). The stuttered speech of PWS is usually available in limited amounts and is highly imbalanced. To this end, we address the class imbalance problem in the SD domain via a multi- branching (MB) scheme and by weighting the contribution of classes in the overall loss function, resulting in a huge improvement in stuttering classes on the SEP-28k dataset over the baseline (StutterNet). To tackle data scarcity, we investigate the effectiveness of data augmentation on top of a multi-branched training scheme. The augmented training outperforms the MB StutterNet (clean) by a relative margin of 4.18% in macro F1-score (F1). In addition, we propose a multi-contextual (MC) StutterNet, which exploits different contexts of the stuttered speech, resulting in an overall improvement of 4.48% in F1 over the single context based MB StutterNet. Finally, we have shown that applying data augmentation in the cross-corpora scenario can improve the overall SD performance by a relative margin of 13.23% in F1 over the clean training. Index Terms- Stuttering detection, speech disorder, data augmentation, class balanced learning. I. INTRODUCTION S PEECH impairments, often known as speech disorders, are difficulty in producing speech sounds. These speech difficulties usually take the form of dysarthria, cluttering lisping, apraxia, and stutter- (poorly intelligible speech), ing [1]–[5]. Only a few percentage (5-10%) of the world population can produce accurate speech units, the rest en- counter some type of speech disorder in their life span [6]. Of these speech impairments, stuttering is the most predominant one [1]. Stuttering1, is a neuro-developmental speech disorder, in which the flow of speech is disturbed by abnormally persistent and involuntarily speech sounds, which usually take Shakeel A. Sheikh, Md Sahidullah, and Slim Ouni are from Universit ́e Inria, LORIA, F-54000, Nancy, France (e-mail: de Lorraine, CNRS, shakeel-ahmad.sheikh, md.sahidullah, [email protected]). Fabrice Hirsch is from Universit ́e Paul-Val ́ery Montpellier, CNRS, Praxiling, Montpellier, France (e-mail: [email protected]). 1Stuttering is also called stammering. In this paper, we will use the terms disfluency, stuttering, and stammering interchangeably. the shape of core behaviors: including blocks, prolongations and repetitions [1]. Stuttering is complex and the several factors that lead to it are delayed childhood development, stress, and speech motor abnormalities [1]. In [7], Smith and Weber put forward the multifactorial dynamic pathway theory, where they argued that stuttering occurs due to the failure of the nervous system. People with stuttering (PWS) exhibit impairment in sensorimotor processes which are responsible for the production of speech, and its direction is influenced by emotional and linguistic aspects. In conventional stuttering detection (SD) and therapy ses- sions, the speech therapists or speech-language pathologists manually analyze the PWS' speech [8]. The speech therapists observe and monitor the speech patterns of PWS to rectify them [1]. This convention of SD is very laborious and time- consuming and is also inclined toward the idiosyncratic belief of speech therapists. In addition, the automatic speech recogni- tion systems (ASR) are working fine for normal fluent speech, however, they are unsuccessful in recognizing the stuttered speech [9], which makes it impractical for PWS to easily access virtual assistants like Apple Siri, Alexa, etc. As a result, interactive automatic SD systems that provide an impartial objective, and consistent evaluation of stuttering speech are strongly encouraged. The SD can also be used to adapt and improve ASR virtual assistant tools for stuttered speech. Despite the fact that having numerous potential applications, very little research attention has been given to the domain of SD and measurement. The detection and identification of stuttering events can be quite a difficult and complex problem due to several variable factors including language, gender, age, accent, speech rate, etc. The main goal of this work is to build robust automatic stuttering detection systems capable of detecting multiple stuttering types based on speech modality, which later on can be deployed as a tool in real-world settings by providing a means to both PWS and speech therapists to keep track of the stutter speech. These systems can later on be further improved by providing a feedback mechanism to PWS and help them to rectify their stuttering. A significant amount of work is done in the detection of other speech disorders [10] like dysarthria [11] and Parkin- sons [12], but stuttering has not been addressed widely even though it is the most common one. In this paper, we propose a deep learning framework for robust SD. The automatic 2 IEEE JOURNAL OF BIOMEDICAL AND HEALTH INFORMATICS, VOL. XX, NO. XX, XXXX 2022 detection of stuttering can help in the treatment of stuttering if detected at an early age [1]. Most of the computer-based SD methods are based either on ASR systems [13], [14] or language models [15], [16]. These methods are two-stage approaches that first convert the acoustic speech signals into their corresponding spoken textual modality, and then detect stuttering by the application of language models. Even though this ASR-based two-stage ap- proach for identifying stuttering has shown promising results, the dependence on the ASR unit makes it computationally costly and prone to error. Moreover, the adaption towards the ASR task results in the possible loss of stuttering relevant information such as prosodic and emotional content. In recent decades, the applications of deep learning have grown tremendously in speech recognition [17], speaker recog- nition [18], speech synthesis [19], emotion detection [20], voice conversion [21], voice disorder detection [10] including Parkinson's disease detection [22] and dysarthric speech de- tection [11], [23]. Inspired by the human auditory temporal mechanism, Kodrasi et al. [23] recently proposed a con- volutional neural network based dysarthric speech detection method by factoring the speech signal into two discriminative representations including temporal envelope (stress, voicing, and phonetic information) and fine structure (breathiness, pitch, and vowel quality) and reported the state-of-the-art re- sults in dysarthria detection. However, the application of deep learning in SD is limited. The acoustic properties of speech disfluencies are different for different disfluencies which can help to discriminate from fluent voice. Due to the presence of these acoustic cues in the stuttered embedded speech, deep learning models can be used to exploit these acoustic cues in the detection and identification of stuttering events. Most of the SD existing methods employ spectral features including mel-frequency cepstral coefficients (MFCCs) and spectrograms or their variants that capture the stuttering-related information. The earlier studies in this domain applied shallow deep learning approaches in SD. In 1995, Howell et al. [24] employed two fully connected artificial neural networks for the identification of two types of disfluencies, namely, repeti- tion and prolongation. They extracted autocorrelation features, envelope parameters, and spectral information and used these features as an input to the artificial neural networks for SD. The network was trained on 12 speakers with 20 autocorrela- tion features and 19 vocoder coefficients. In 2009, Ravikumar et al [25] proposed multi-layered perceptron for the repetition type of stuttering. The network was trained by using MFCC input features on 12 different disfluent speakers. In 2019, B. Villegas et al. [26] trained multi-layer perceptron on 10- dimensional respiratory features for the block SD. They used a dataset of 68 Latin American Spanish speakers in their case study. In a recent study, Kourkounakis et al. [27] proposed residual network and bi-directional long short-term memory (ResNet+BiLSTM) based binary deep learning classifiers for the detection of six different types of disfluencies including prolongation, word repetition, sound repetition, phrase repeti- tion, and false starts. They used spectrograms as input features and reported promising results on a small subset (25 speakers) from the UCLASS dataset [27]. In another study Lee et al. [28] curated a large stuttering dataset (SEP-28k) and utilized the convolutional long short-term memory (ConvLSTM) model for the detection and identification of six types of stuttering, namely, blocks, prolongations, sound repetitions, word rep- etitions, and interjections. The model takes 40-dimensional input MFCCs, eight-dimensional articulatory features, 41- dimensional phoneme feature vector, and three-dimensional pitch features. Sheikh et al. [29] recently proposed a single multi-class time delay neural network (TDNN) based Stutter- Net classifier which is capable of detecting core behaviors and fluent speech segments and gives promising detection performance on a larg subset of UCLASS (100+) speakers compared to the state-of-the-art classifiers. The model solely takes 20-dimensional MFCC features as an input. In another recent study M. Jouaiti et al. [30] introduced phoneme-based bi-drectional long short-term memory (BiLSTM) model for SD by mixing the SEP-28k and UCLASS datasets. The model is trained on 20-dimensional MFCCs and 19-dimensional phoneme input features. The disfluencies considered in this work are prolongations, repetitions, and interjections. A de- tailed summary and comparison of various feature extraction methods and classifiers can be found in [31]. This work provides a complete deep learning framework for robust SD following our preliminary initial investigations [29] in which StutterNet yields state-of-the-art SD results. In this study, we identify the limitations of StutterNet and proposed further advancements to address those drawbacks. Our main contributions are summarized below: • Solution for class imbalance problem: The standard stut- tering datasets suffer from class imbalance problems. We introduced two strategies based on weighted loss and multi-branch architecture to tackle the class imbalance problem. • Introducing data augmentation: The stuttering datasets have a limited amount of training data and this makes it difficult to apply advanced deep learning models with a large number of parameters. To address this limitation, this work introduces audio data augmentation. To the best of our knowledge, this is the first work to apply audio data augmentation in the SD problem. • Introducing multi-contextual architecture: Stuttering de- tection is a special type of speech characterization prob- lem where each class (i.e., stuttering types) has a varying duration. For example, block lasts for a shorter duration than prolongations and repetitions. Therefore, a fixed length of context in the basic StutterNet framework might not be the optimized one for detecting all types of stuttering. We introduce a multi-contextual architecture that uses different context lengths in a parallel fashion. The remaining of the paper is organized as follows. Sec- tion II describes the StutterNet and analyzes its deficiencies. Section III discusses the proposed methodology for addressing the deficiencies. Section IV details the experimental design, metrics used and datasets. Section V discusses the experimen- tal results on class balanced, data augmentation, MC StutterNet and cross corpora scenario. Finally, in Section VI, we conclude with the possible future directions. SHEIKH et al.: ADVANCING STUTTERING DETECTION VIA DATA AUGMENTATION, CLASS-BALANCED LOSS AND MULTI-CONTEXTUAL DEEP LEARNING 3 II. STUTTERNET: OVERVIEW & LIMITATIONS A. StutterNet Most of the earlier work employed only a small set of disfluent speakers in their experimental studies, and has ap- proached the SD problem as a binary classification problem: disfluent vs fluent identification or one vs other type [31]. The StutterNet we propose in our earlier work, is a time delay neural network based architecture that has been used to tackle the SD as a multi-class classification problem. The StutterNet takes 20 MFCCs as input features with a frame length of 20 ms, mean-normalized with a hop length of 10 ms. Usually, the initial layers in a standard deep neural network learn wider contexts when processing a temporal input signal. However in StutterNet network as shown in Table I, the initial layers learn and capture only smaller contexts and the deeper ones compute the activations from a wider context, thus the deeper/higher layers are able to capture and learn the longer temporal contexts. The network consists of five time delay layers with the first three focusing on [t − 2, t + 2], {t − 2 , t, t + 2}, {t − 3 , t, t + 3} and the other two on {t} contextual frames, respectively. The TDNN layers are having a dilation of (1, 2, 3, 1, 1) respectively. This is followed by a two-layered BiLSTM unit, mean and standard deviation pooling layer, three fully connected (FC) layers, and a softmax layer on top of the network that reveals the classification scores of stuttering disfluencies. A ReLU nonlinearity activation function and a 1D batch normalization are applied after each layer except the statistical pooling layer. We apply dropout of 0.3. in FC layers. Consider an input speech sample with T frames. The first five layers of StutterNet focus on the small context of speech frames. For example, layer 2 takes as input the sliced output of layer 1 at time frames of {t − 2, t, t + 2}, which results in capturing a total temporal context of 9 with the help of the previous layer's context of [t−2, t+2]. Similarly, layer 3 sees a total context of 15 time frames. The statistical pooling layer computes and concatenates the mean and standard deviation by aggregating all T output frames at the end of BiLSTM output. The statistical pooling layer accumulates the informa- tion across the temporal dimension which makes it suitable for subsequent layers to operate on the entire temporal speech segment. The StutterNet is trained to classify 5 different types of stuttering including core behaviors and the fluent part of the PWS. For detailed StutterNet architecture, please refer to [29]. B. Limitations Although this network has shown promising results on a SEP-28K dataset in SD, it has several deficiencies. First, it does not generalize quite well on unseen data and leads to overfitting due to the limited amount of data available for training. In addition to data scarcity, the SEP-28k dataset was collected from podcasts in a clean environment, which makes the trained StutterNet difficult to generalize in other environmental conditions. Second, obtaining class-balanced datasets is extremely difficult and very expensive in the speech domain and the SEP-28k dataset is no exception. Deep neural network (DNN) classifiers trained on highly class-imbalanced datasets are usually biased towards the majority class, which TABLE I: STUTTERNET ARCHITECTURE, TC: TOTAL CON- TEXT, TDNN: TIME DELAY NEURAL NETWORK LAYER, FC: FULLY CONNECTED LAYER, BILSTM: BIDIRECTINAL LONG SHORT-TERM MEMORY (2 LAYERS), LAYER CON- TEXT OF [T-2, T+2] MEANS 5 FRAMES ARE TAKEN INTO CONSIDERATION TWO BEFORE THE CURRENT TIME STEP AND TWO AFTER THE CURRENT TIME STAMP. Layer TDNN 1 TDNN 2 TDNN 3 TDNN 4 TDNN 5 BiLSTM Statistical Pooling FC1 FC2 FC3 Output Layer Size 64 64 64 64 3*64 64 * 2 3 ∗ 64 ∗ 2×1 64 64 NumClasses Layer Context [t − 2, t + 2] {t-2, t, t+2} {t-3, t, t+3} {t} {t} {t} [0, T ) - - - TC 5 9 15 15 15 T T T T T results in poor modeling of minority classes [32]. In addition to the above deficiencies, we found in our previous work Stut- terNet [29] that the context is very important in SD. Stuttering detection is a special type of speech characterization problem where each class (i.e., stuttering types) has a varying duration. For example, block lasts for a shorter duration than prolonga- tions and repetitions. Therefore, a fixed length of context in the basic StutterNet framework might not be the optimized one for detecting all types of stuttering. A larger context increases the performance of prolongation and repetition types of disfluencies but decreases the recognition performance of fluent speech segments on the UCLASS dataset [29]. III. ADDRESSING DEFICIENCIES In this section, we address the three above-mentioned issues. A. Class Imbalance In class imbalance learning, the distribution of samples across each class is not uniform. The DNN classifiers, trained on highly imbalanced datasets generally perform poorly for the minority class and favor the majority class [33]. In the worst case, where there is an extreme imbalance in the training set, the majority class dominates the learning, and samples among the minority class may go undetected, thus affecting performance [34]. The class-imbalance is one of the major problems in real- world applications, including multi-lingual speech recogni- tion [35], and stuttering is no different as shown in Fig. 1. In fact, stuttering is extremely imbalanced across fluent and other speech disfluencies. The Fig. 1. shows that the interjections are the most common disfluency present in the SEP-28k dataset followed by repetitions, blocks, and prolongations and the overall distribution is approximately equivalent to the fluent distribution. Collecting a balanced dataset is difficult and expensive for the stuttering detection task. Other datasets such as Kassel State of Fluency (KSoF) (not publicly accessible) [36], Flu- encyBank [28] also suffer from this issue. 4 IEEE JOURNAL OF BIOMEDICAL AND HEALTH INFORMATICS, VOL. XX, NO. XX, XXXX 2022 where B is the number of batches, M is number of stuttered is the predicted (cid:16) (cid:17) speech samples in a batch bi, pi = probability of class ci of sample i. eci j=1 ecj (cid:80)C For architecture-level, we propose a multi-branched ap- proach similar to the work by C. Lea et al. [28] and M. Bader-El-Den et al. [38] to address the class imbalance issue in SD task. Inspired by the fact that the number of fluent class samples is almost equal to the total number of samples in disfluent classes, we simultaneously classify fluent vs difluent classes in one output branch and subcategories of disfluent classes in another output branch. The multi-branched architecture with two output branches is shown in Fig. 3 (The figure is overall architecture of mulit-contextual StutterNet with two contexts, For single contextual MB StutterNet, only context = 5 is taken into consideration). This has one common encoder E (θe) section followed by two parallel branches referred as FluentBranch F (θf ) and DisfluentBranch D (θd). The embeddings from the encoder are processed with both the branches parallelly, where the F is trained to distinguish between fluent and disfluent samples, and the D is trained to differentiate within the disfluent sub-categories. The objective is to optimize the sum of FluentBranch loss Lf and DisfluentBranch loss Ld. For simplicity, a simple sum of the two losses has been taken into consideration and it works well. Thus, the overall objective function is define as: L(θe, θf , θd) = Lf (θe, θf ) + Ld(θe, θd). (2) During the evaluation step, if the FluentBranch predicts the sample as fluent, then FluentBranch predictions are considered otherwise DisfluentBranch predictions are taken into consid- eration to reveal the stuttering category. B. Data Augmentation Deep learning has achieved rapid progress in the domain of speech processing tasks including speech recognition [17], speaker recognition [18], emotion recognition [20], speech disorder detection [29]. However, as a drawback, deep learning based models are hungry for the data and require a substantial amount of annotated data for training, and StutterNet is no exception. The model may require more stuttering data than other speech processing domains, as the presence of disfluen- cies in stuttering speech corpus is not frequent. Data augmentation is a popular technique that increases the quantity and diversity of the existing annotated training data, improves robustness, and avoids the overfitting of DNNs. For normal speech recognition, data augmentation demonstrates to be an effective approach for dealing with data scarcity and enhancing the performance of various DNN acoustic meth- ods [39]. Several data augmentation techniques have been in- vestigated including pitch adjust [40], spectral distortion [41], tempo perturbation [42], speed perturbation, cross-domain adaptation [43], adding noise to clean speech [42], spectro- gram deformation with frequency and time masking [39], mixspeech [40], etc. On the contrary, so far, very limited attention has been given to data augmentation targeting the speech disorder domain. Fig. 1: Stuttering data distribution in SEP-28k dataset showing five classes consisting of single stuttering class. Over the years, the class imbalance problem is one of the main concerns due to its prevalence, especially in the biomed- ical domain. Several methods have been proposed to tackle the class imbalance problem, which are mainly categorized into three groups: data-level, cost-level, and architecture-level [32]. Data-level approaches attempt to re-balance the class distribu- tion by means of some re-sampling methods which include: under-sampling, over-sampling, or combined over-sampling and under-sampling [32], [33]. The architecture-level ap- proaches attempt to modify the existing algorithm or develop a new one to tune and adapt it for imbalanced datasets [32], [33]. Cost-level approaches attempt to influence the loss/objective function by providing comparatively higher misclassification cost penalties to the minority class in order to force the model to learn about minority classes [32], [33]. In DNNs, addressing the class-imbalance problem by re-sampling may either get rid of sensitive speech samples that are extremely important in training when under-sampling. It can also add numerous quantities of duplicated speech samples under the over-sampling strategy, which eventually makes the training expensive and makes the DNN model likely to overfit [32]. Because of these limitations, we investigate cost-level and architecture-level approaches in this work. For the cost-based approach, we modify the standard cross entropy loss by assigning weights to different classes [37]. We set the class weights inversely proportional to the number of samples. We define the weight for class i as wi = N C∗Ni where N is the number of training samples, C is the number of classes, Ni is the number of training samples for class i. Therefore, the weighted cross-entropy (WCE) over the train set can be defined as, LWCE = M (cid:80) i 1 B B (cid:88) b=1 wi ∗ log(pi) M (cid:80) i, i∈B wi (1) SHEIKH et al.: ADVANCING STUTTERING DETECTION VIA DATA AUGMENTATION, CLASS-BALANCED LOSS AND MULTI-CONTEXTUAL DEEP LEARNING 5 In [44], speed and tempo perturbation based data augmen- tation were used to convert the normal speech to dysarthric speech impairment. In [45], a voice conversion adversarial training based framework was used to simulate dysarthric speech from healthy speech. In [46], normal speech samples (also called out-of-domain) were used as a data augmentation for dysarthric speech in the bottleneck feature extraction stage. In [47], the speaker-dependent parameter was computed, which was then used for augmentation of scarce dysarthric speech in tempo adjustment. In [48], several data augmentation techniques such as noise, time stretching, pitch shifting, time shift, masking, etc., were analysed in Dementia detection. There are some studies on data augmentation targeting text based stuttering detection [13], however, in the case of audio based stuttering/disfluency detection, this has not been studied and analysed deeply [49] . In the stuttering domain, the employment of data aug- mentation is not straightforward, because most of the data augmentations like time stretch, speed perturbation, etc, al- ter the underlying structure of the stuttering speech sample completely. Our approach employs reverberation and additive noises because it reflects the real-world scenario and does not change significantly the underlying stuttering in the speech sample as shown in Fig. 2. Reverberation consists of convolv- ing speech samples with room impulse responses. We utilize the simulated room impulse responses as described in [50]. For additive noises, we utilize the MUSAN dataset, comprised of 60 hours of speech from 12 languages, 42 hours of music from various genres, and 900 hours of noises [51]. To augment the original speech samples, we combine the training "clean" set with below mentioned augmented copies which results in 5 times increase in training samples. 1) music: A single music sample file randomly chosen from MUSAN is added to the original clean stuttering speech sample (SNR: 5-15dB) (The music sample file is trimmed or repeated as required to match the duration of the clean stuttered speech sample). 2) noise: Throughout the stuttered speech, samples from MUSAN noises are added at 1 sec intervals (SNR: 0- 15dB). 3) babble: Speech samples from randomly three to seven speakers are summed together, then added to the original clean stuttered speech sample (SNR: 13-20dB). 4) reverb: The "clean" train set is convolved with simulated room impulse responses. All the data augmentation types shown in Fig. 2 were per- formed using Kaldi [52] tool. C. Multi-contextual StutterNet The multi-contextual framework is based on the way hu- mans perceive speech. In the cochlea, the input acoustic speech signal is partitioned into several frequency bands so that the information in each band can be filtered independently and thus processed in parallel in the human brain [53]. Multi-contextual has been studied for action recognition in videos [54], robust ASR [55]–[59], speech separation [60], is processed in multiple where the input speech signal (a) Repetition (clean speech) (b) Repetition with reverberation (c) Repetition with babble noise (d) Repetition with white noise (e) Repetition with music Fig. 2: Repetition stuttering with utterance "said that, that" and the effect of various data augmentations (From 0 to 0.25 seconds, the speaker is saying "said", then followed by two repetitions "that" from 0.25 to 0.6 and 1.4 to 1.75). 00.511.522.53Time0512102420484096Hz00.511.522.53Time0512102420484096Hz00.511.522.53Time0512102420484096Hz00.511.522.53Time0512102420484096Hz00.511.522.53Time0512102420484096Hz 6 IEEE JOURNAL OF BIOMEDICAL AND HEALTH INFORMATICS, VOL. XX, NO. XX, XXXX 2022 streams/contexts (multiple time or frequency resolutions), etc. K.J Han et al. [55] recently proposed a multi-stream2 convo- lutional neural network for robust acoustic modeling. Chiba et al. [61] recently proposed multi-stream attention-based BiL- STM network for speech emotion recognition. Li et al. [62] extracted deep features by training multi-stream hierarchical DNN for acoustic event detection. Moreover Sheikh et al. [29] found that settings like context frame size optimized for one stuttering class are not good for other stuttering types. Exploiting this fact, we investigate how the multi-contextual neural networks will impact classification performance in the speech disorder domain, and in particular stuttering identifica- tion. In our preliminary study, we found that the context win- dow improves the identification performance of two types of disfluencies on the UCLASS dataset [29]. As the context frame size increases in the StutterNet, the performance detection of prolongation and repetition also increases, but decreases for fluent speech segments, and almost remains unaffected for a block type of stuttering. The prolongation and repetition last longer than other types of disfluencies. To address this issue, we exploit the variable contexts of MB StutterNet by training the model jointly on different contexts as shown in Fig. 3. The pseudo-code of multi-contextual (MC) StutterNet is provided in Algorithm 1. IV. EXPERIMENTAL SETUP We evaluate our proposed architecture thoroughly on the newly released SEP-28k stuttered dataset [28], and for cross copora, we use the FluencyBank and LibriStutter datasets. A. Datasets SEP-28k: The SEP-28k stuttering dataset was curated from a set of 385 podcasts. The original podcast recordings have varying lengths. From each podcast, 40 to 250 segments (each of length 3 seconds) are extracted which resulted in a total of 28,177 segments. The original SEP-28k dataset contains two types of labels: stuttering and non-stuttering. The stuttering labels include blocks, prolongations, repetitions, interjections, and fluent segments, whereas the nonstuttering labels include unintelligible, unsure, no speech, poor audio quality, and music which are not relevant to our study. In our case study, we use only the stuttering single labeled samples. Out of 28,177 clips, we use only 23573 segments, among which 3286 are repetitions, 1770 are prolongations, 2103 are blocks and 12419 are fluent segments, and 3995 are interjections. This resulted in a total of 19.65 hours of data which includes 2.74 hours of repetition, 1.48 hours of prolongation, 1.75 hours of block, 10.35 hours of fluent speech, and 3.34 hours of interjections. After labeling, each 3-sec sliced speech segment is downsampled to 16 kHz. We randomly select 80% of podcasts (without mixing podcasts) for training, 10% of podcasts for validation, and the remaining 10% of the podcast for evaluation in a 10-fold cross-validation scheme. The speaker information is missing from the SEP-28k dataset, so we divide the dataset based on podcast 2multi-stream, multi-scale, multi-resolution are the different names of multi- context. Algorithm 1 Pseudo-code for MC StutterNet Output: Predicted label set ˆy ∈ (R, P, B, In, F ) Input: Stutter dataset with D = (Xi, fi, di), where each sample Xi R20×T MFCC input sequence is d: Stutter label f : Pseudo label for FluentBranch K: Number of epochs CE: Cross entropy loss function pf : Prediction of FluentBranch pd: Prediction of DisfluentBranch Lf : Loss of FluentBranch Ld: Loss of DisfluentBranch L: Total loss b: Sample batch C: Context λ: Learning rate θ = [θe, θf , θd] : Network parameters θe : Encoder parameters θd : DisfluentBranch parameters θf : FluentBranch parameters for b in D do Forward Pass: b = ApplyKaldiAugmentation(b) out5 = StutterNetBase(b, C = 5) out9 = StutterNetBase(b, C = 9) stat5 = StatisticalPooling(out5) stat9 = StatisticalPooling(out9) statembed = Concat(stat5, stat9) pf = FluentBranch(statembed) pd = DisfluentBranch(statembed) Lf = CE(pf , fb) // fb: Pseudo label of a batch Ld = CE(pd, db) // db: Stutter label of a batch L(θe, θf , θd) = Lf (θf ) + Ld(θd) Backward Pass: ∇θb = backward propagation(L(θ), ˆy, d) Parameter Updates: θb ← θb − λ ∗ ∇θb Ensure: MC StutterNet weight initialization 1: for i in K do 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: end for end for Compute CE loss on validation set if CEval ≤ CEprev val Continue training → Go to step 2 if patience ≤ 7 then Stop training end if end if then else identities (assuming each podcast is having a unique speaker)3. FluencyBank: The actual FluencyBank AudioVisual dataset was created by Nan Bernstein Ratner (University of Maryland) and Brian MacWhinney (Carnegie Mellon University) for the study of fluency development. In our case study, we use the annotation done by the Apple similar to SEP-28k [1]. This stuttering dataset was curated from 33 podcasts with 23 males and 10 females, which resulted in a total of 4,144 segmented clips. Out of which, we only use 3355 samples (ignoring the non-stuttering and multiple samples), among which 542 are repetitions, 222 are prolongations, 254 are blocks and 1584 are fluent segments, and 753 are Interjections. This results in a total of 2.80 hours of data which includes 0.45 hours of repetition, 0.19 hours of prolongation, 0.21 hours of block, 0.63 hours of interjection samples, and 1.32 hours of fluent samples. We have considered those samples where at least two annotators agree with the same labeling of the segment. Simulated LibriStutter: The LibriStutter (English) consists of 50 speakers (23 males and 27 females), is approximately 3The details about the train, validation, and test set splits about the SEP-28k dataset is not publicly available. We create a protocol by ensuring no overlap of podcasts between train, validation, and test sets. The details are available in https://shakeel608.github.io/protocol.pdf SHEIKH et al.: ADVANCING STUTTERING DETECTION VIA DATA AUGMENTATION, CLASS-BALANCED LOSS AND MULTI-CONTEXTUAL DEEP LEARNING 7 Fig. 3: A schematic diagram of Multi-contextual StutterNet, which is a multi-class classifier that exploits different variable contexts of (5, 9) in SD. The FluentBranch and DisfluentBranch are composed of 3 fully connected layers followed by a softmax layer for prediction of different stuttering classes, CB: Context Block, SPL: Statistical Pooling Layer. The context C (5, 9) here does not mean the TDNN layers, but rather it means the kernel-size which is number of frames taken into account when processing speech frames (C=5 means a context of 5 frames are taken at a time and C =9 means a context of 9 frames are taken at a time). These two contexts are jointly exploited in MC StutterNet as shown in the left hand side of the figure. 20 hours and includes synthetic stutters for repetitions, pro- longations, and interjections [63]. Random stuttering was inserted within the four-second window of each speech signal. The original LibriStutter is having 6 classes including fluent, interjection4, prolongation, sound, word and phrase repetitions. To make our experiments consistent with the SEP-28k dataset, we treat all repetitions as one class. After extracting samples based on the class label, we did not find any interjection samples in the dataset, so we only train with three classes including fluent, prolongation, and repetitions. For splitting of the dataset, please refer Table 3 in the response sheets. B. Training Setup We implement models using the PyTorch library. The acous- tic input features used in this case study are 20-dimensional MFCC features, which are generated every 10 ms using a 20 ms window and extracted using the Librosa library [64]. For 3-dim pitch and phoneme features, we use Pykaldi [65] and Phonexia [66] tools respectively. For training, we use Adam optimizer and cross-entropy loss function with a learning rate of 10−2 and batch size of 128. All the results reported in this 4https://borealisdata.ca/dataset.xhtml? persistentId=doi:10.5683/SP3/NKVOGQ paper are the average of the 10-fold validation technique and all the training experiments were stopped by early stopping criteria with patience of 7 on validation loss. C. Evaluation metrics To evaluate the model performance, we use the following metrics: macro F1-score and accuracy which are the standard and are widely used in the stuttered speech domain [27], [28], [31], [36], [67]. The macro F1-score (F1) (which combines the advantages of both precision and recall in a single metric unlike unweighted average recall which only takes recall into account) from equation (3) is often used in class imbalance scenarios with the intention to give equal importance to fre- quent and infrequent classes, and also is more robust towards the error type distribution [68]. F1 = 1/C (cid:88) k F 1k = 1/C (cid:88) k 2.PkRk Pk + Rk (3) where C is the number of classes and Pk, Rk, and F 1k denotes the precision, recall, and F1-score with respect to class k. Context = 5Context = 9Speech UtteranceMFCC Input FramesTDNN Layer 1TDNN Layer 2TDNN Layer 3TDNN Layer 5TDNN Layer 4CB: Context BlockFluentBranch ΘfDisfluentBranch ΘdFluent/StutterRept, Prolong, Interj, BlockCB Θe CB ΘeDuring evaluation, FluentBranch predictions are considered only for fluent speech samples. If the prediction for speech sample in FluentBranch is "stutter", then predictions of DisfluentBranch are taken into consideration to reveal the type of stuttering class. Otherwise a speech utterance sample could be predicted as fluent in FluentBranch and stutter in DisfluentBranch. ConcatenationBiLSTMBiLSTMBiLSTMBiLSTMSPLSPL 8 IEEE JOURNAL OF BIOMEDICAL AND HEALTH INFORMATICS, VOL. XX, NO. XX, XXXX 2022 D. Experiments This sections describes briefly the experiments carried out in this paper. • We carry out experiments using StutterNet with the two state-of-the art SD baselines including ResNet+BiLSTM and ConvLSTM models in the same settings to have a fair comparison. • We perform experiments using weighted loss and multi- branched training schemes for addressing class-imbalance problem in stuttering domain, and also exploit the advan- tage of both the schemes in freezing parts of network. • We experiment with the data augmented training to evaluate its performance in stuttering detection. • We experiment with MC StutterNet on top of data aug- mentation, and also analyse its performance in cross- corpora settings. V. RESULTS In this section, we discuss the results with class balanced training, data augmentation, and multi-contextual learning. We propose two modifications to the vanilla StutterNet to address the class imbalance issue and one of them involves the loss function on the SEP-28k dataset. We further present the results of cross-corpora experiments on the FluencyBank and LibriStutter datasets. Table II shows the results of state- of-the-art baselines (1st part are baselines) and impact of class balanced training. Table III depicts the results using data augmentation on top of class balanced training. Table IV shows the results using MC StutterNet. Baselines: In addition to our single branch StutterNet baseline (BL5), we first implement the state-of-the-art Con- vLSTM and ResNet+BiLSTM as our baseline models for comparison purposes in the same settings. Our baseline model StutterNet is performing well in almost all the disfluent classes except blocks as compared to the baseline model used in SEP- 28k paper [28] ConvLSTM (MFCC features) (referred to as BL1), ConvLSTM (phoneme features) (referred to as BL2), and ConvLSTM (pitch+MFCC features) (referred to as BL3). In addition, we also use one more model i.e, ResNet+BiLSTM classifier (referred to as BL4) from Kourkounakis et al. [27]. Comparing our single branch baseline StutterNet to BL4, the model performs well only in interjection and prolongation classes as shown in Table II. For subsequent comparison, we select BL1 (best among BL1, BL2 and BL3) and BL4. A. Class Imbalance 1) Weighted cross entropy: This section discusses the im- pact of applying weighted cross entropy to StutterNet (which we call StutterNetWCE) in order to improve the detection performance of minority classes including repetitions, blocks, and prolongations. Figure 4. illustrates the class-wise training loss curves for normal and weighted cross-entropy loss func- tions. We can observe that for the standard cross entropy loss function, the majority class (i.e., fluents) exhibit higher loss values and it dominates the overall loss. Therefore, during training with backpropagation, the num- ber of updates for fluent class dominates the gradient values Fig. 4: Class-wise loss values for different probabilities of ground truth classes. Here block, fluent, repetition, prolonga- tion, and interjection classes are correspondingly denoted by B, F, R, P, and I. The standard cross entropy (CE) is shown by solid curves and its weighted version is shown by dashed ones (WX represents the weighted loss of class X). that in turn forces the model to focus mainly on correctly classifying/predicting the majority class. Thus, the minority classes including the blocks, prolongations, and repetitions are given less importance during training, which leads to their poor detection performance. Table II confirms that the detection per- formance of blocks, prolongations, and repetitions is very poor, as they are mostly predicted as fluent samples due to the class imbalance nature of the problem. The loss functions for the weighted cross entropy are shown by dashed curves in Fig. 4. The figure indicates that applying weights to standard cross entropy loss function by equation (1) forces the model to give balanced importance to each disfluency class while optimizing the parameters of the network during backpropagation. This, in turn, helps in boosting the gradient updates for minority classes during training, and thus increases their detection performance in baselines including BL4, and BL5 as shown in Table II. The StutterNetWCE gives a relative improvement of 33.49%, 83.50%, 1,185%, and 5.98% over BL5 and 58.69%, 462%, 500%, and 7.84% over BL1 for detecting repetitions, prolongations, blocks, and interjections, respectively. Table II also demonstrates the suitability of WCE with competitive ResNet+BiLSTM method and results in 54%, 57.35%, 517%, and 10.23% relative improvement in repetitions, prolongations, blocks, and prolongations over BL4. 2) Multi-branch training: Moreover, we address the class imbalance problem via a multi-branch network (referred to as StutterNetMB). This has two output branches: FluentBranch and DisfluentBranch as shown in Fig. 3. (For StutterNetMB, only a single context of five is taken into consideration) This method improves the detection performance of repetitions, prolongations, blocks by a relative margin of 29.92%, 0.65%, 144% respectively over BL5, and 54.45%, 208%, 13.72%, SHEIKH et al.: ADVANCING STUTTERING DETECTION VIA DATA AUGMENTATION, CLASS-BALANCED LOSS AND MULTI-CONTEXTUAL DEEP LEARNING 9 TABLE II: RESULTS WITH BASELINES (BL) AND USING CLASS IMBALANCE LEARNING (CLEAN TRAINING) (B: BLOCK, F: FLUENT, R: REPETITION, P: PROLONGATION, IN: INTERJECTION, TA: TOTAL ACCURACY, F1: MACRO F1- SCORE), FMFCC: MFCC INPUT FEATURES, FF0: 3-DIM (PITCH, PITCH-DELTA, VOICING) FEATURES, Fphone: PHONEME FEATURES, MB: MULTI BRANCH, WCE: WEIGHTED CROSS ENTROPY, Mfrz enc,disf : FREEZING ENCODER AND DISFLUENTBRANCH, Mfrz enc:FREEZING ENCODER, Mfrz enc,fluent: FREEZING ENCODER AND FLUENTBRANCH. Method R P Accuracy B In F Baselines TA F1(%) ConvLSTM + FMFCC (BL1) ConvLSTM + Fphone (BL2) ConvLSTM + FF0+MFCC (BL3) ResNet+BiLSTM (BL4) [27] StutterNet (BL5) [29] [28] [28] [28] ResNet+BiLSTM + WCE [27] MB ResNet+BiLSTM [27] StutterNet + WCE (StutterNetWCE) MB StutterNet (StutterNetMB) Mfrz enc Mfrz Mfrz enc,disf enc,fluent 22.83 10.18 19.28 18.76 27.14 28.90 34.79 36.23 35.26 39.82 29.25 31.15 10.61 01.06 09.55 41.24 32.55 64.89 30.19 59.73 32.76 37.91 45.85 27.62 06.34 00.35 08.51 5.47 2.96 33.79 5.92 38.05 7.21 10.45 18.11 05.01 72.35 74.48 66.60 88.19 87.60 56.74 43.88 51.78 57.18 57.74 Class Imbalance 63.03 49.26 61.19 56.04 60.57 56.88 57.64 46.90 75.47 41.59 77.27 73.49 74.49 73.64 52.68 48.43 48.47 62.36 62.57 47.42 55.62 45.26 58.56 58.58 58.18 55.83 34.00 24.00 30.80 43.12 42.84 41.00 39.20 41.02 42.26 44.42 44.80 38.60 TABLE III: RESULTS USING DATA AUGMENTATION (B: BLOCK, F: FLUENT, R: REPETITION, P: PROLONGATION, IN: INTERJECTION, TA: TOTAL ACCURACY, F1: MACRO F1- SCORE), A4: BABBLE + REVERBERATION + MUSIC + NOISE AUGMENTATION, MB: MULTI BRANCH, WCE: WEIGHTED CROSS ENTROPY, Mfrz enc,disf : FREEZING ENCODER AND DISFLUENTBRANCH, Mfrz enc:FREEZING ENCODER, Mfrz enc,fluent: FREEZING ENCODER AND FLUENTBRANCH. Method StutterNet + A4 StutterNet + WCE (StutterNetWCE) + A4 MB ResNet+BiLSTM + A4 MB StutterNet (StutterNetMB) + A4 Mfrz enc + A4 enc,disf + A4 enc,fluent + A4 Mfrz Mfrz Accuracy B 3.69 38.18 0.99 4.32 4.26 11.52 04.48 In 64.24 65.33 65.95 68.74 64.12 62.31 61.30 P 32.53 61.43 32.85 33.93 30.94 36.33 25.14 R 28.67 43.06 33.27 34.05 28.87 27.63 31.19 F 88.70 43.73 70.92 78.88 85.29 83.05 77.56 TA 64.69 48.30 55.75 61.35 62.85 62.14 58.32 F1(%) 45.30 44.34 39.44 44.03 44.06 45.76 39.80 (a) StutterNet (BL) (b) StutterNet (WCE) (StutterNetWCE) (c) MB StutterNet (StutterNetMB) Fig. 5: Accuracy confusion matrices showing the confusion of fluent speech with repetitions and blocks. F: Fluent, R: Repetition, B: Block, P: Prolongation, In: Interjection, BL: Baseline, WCE: Weighted cross-entropy, MB: Multi-branch. 6.80% in repetitions, prolongations, blocks, and fluents re- spectively over BL1, and 88%, 31.81% in repetitions, blocks respectively over BL4, however, the BL4 is performing better in prolongations and interjection classes. We also applied multi-branch training in ResNet+BiLSTM which results in a relative improvement of 85.45% in repetition class only as compared to the baseline BL4. In applying class balanced training, we found that there is drop in macro F1 score. Using StutterNetWCE and WCE the macro F1 score drops from based ResNet+BiLSTM, 42.84% and 43.12% to 41.02% in StutterNet and 41.02% in ResNet+BiLSTM respectively. By employing multi-branch training, the macro F1 score drops very slightly from 42.84% to 42.26% in StutterNet but it drops remarkably from 43.12% 10 IEEE JOURNAL OF BIOMEDICAL AND HEALTH INFORMATICS, VOL. XX, NO. XX, XXXX 2022 to 39.20% in ResNet+BiLSTM. 3) Analysis of confusion matrix: Using the WCE training scheme, the detection performance of minority classes im- proved remarkably at the cost of fluent accuracy. From the Fig. 5 (a), we analyze that most of the repetitions and blocks are being classified as fluent speech. Initially, we hypothesize that it is most likely because of the imbalanced nature of the problem. Despite addressing the class imbalance problem in the stuttering domain using WCE and multi-branched training, we found that the block and repetition type of stuttering disfluencies are the ones that are still getting confused with the fluent class as depicted in Fig. 5 (b) and Fig. 5 (c). This makes intuitive sense because the blocks are closely related with fluent segments having just different initial silence or gasp followed by fluent utterances like fluent speech. The repetitions, on the other hand, contain some word or phrasal repetitions, which are actually fluent utterances, if we carefully analyze their individual parts. Consider an utterance he he is a boy. The word he is being repeated twice but is a fluent part if two he's can be analyzed on an individual basis. 4) Exploiting advantage of WCE and MB StutterNet: Since StutterNetWCE and StutterNetMB address the class-imbalance issue differently, we combine them to exploit both of their advantages. We first pre-train the StutterNetWCE and use it as a DisfluentBranch in our multi-branched StutterNet. After the pre-training step, we freeze parameters in two ways. First, we freeze the parameters of the contextual encoder only and fine-tune only the two output branches. We label this training scheme as Mfrz enc. By exploiting this method, we achieve an overall detection improvement of 5.11% in F1 over StutterNetMB. Second, we freeze the base encoder and StutterNetWCE (DisfluentBranch) and append with one more FluentBranch (to distinguish between fluents and stutter samples). We refer this as Mfrz enc,disf and it results in an overall improvement of 6.01% in F1 over StutterNetMB. We also experiment by first training the model using weighted cross entropy in FluentBranch, and then by fine- tuning the DisfluentBranch by freezing the parameters of the encoder and FlunetBranch. We refer to it as Mfrz enc,fluent and the results for this configuration are shown in Table II and III. However, this training scheme degrades performance in almost all the disfluent classes in comparison to Mfrz enc (freezing encoder only) and Mfrz enc,disf (freezing encoder and DisfluentBranch). This is possibly due to the reason that the base encoder is trained only to distinguish between fluent and disfluent classes via FluentBranch. Then freezing its parameters in a fine-tuning step further inhibits it more in learning sub-classes (repetitions, prolongations, interjections, and blocks) of the disfluent category which makes their overall detection performance lower. B. Data augmentation The main experimental results obtained with various data augmentation techniques are shown in Table III, where we compare the detection performance obtained with data aug- mented training to the baseline clean dataset. We first sepa- rately train the StutterNetMB on different data augmentation MC SC:Clean 1 MC SC:A4 2 MC CC:Clean 3 MC CC:A4 4 80 60 40 20 0 RA PA BA InA FA F1 Fig. 6: Impact of data augmentation (A4) in cross corpora FluencyBank dataset with MC StutterNet (R: Repetition, P: Prolongation, B: Block, In: Interjection, F: Fluent, XA: X: Disfluency Class and A: Accuracy, MC: Multi contextual StutterNet, SC: Same corpora, CC: Cross corpora, A4: Aug- mentation). The bar plot clearly shows that the model MC StutterNet trained on clean SEP-28k dataset fails to generalize on FluencyBank cross corpora data. Applying data augmenta- tion improves the stuttering detection in cross domain corpora as shown orange bars (4th column in each disfluency). techniques which are described in Section III. We found that the training MB ResNet+BiLSTM and StutterNetMB with Kaldi augmentation increases the overall F1 performance. From Table III, it can be seen that the data augmentation does help in improving the F1 in almost all the cases. Applying data augmentation with a single branched and StutterNetWCE, there is a relative improvement of 5.74% and 3.50% in F1 respectively, over the clean versions of the training. When data augmentation is applied to MB training, there is a relative improvement of 4.17% and 0.61% in F1 using StutterNetMB and ResNet+BiLSTM over clean training, respectively. enc and Mfrz Moreover, applying Kaldi data augmentation on top of the Mfrz enc,disf training scheme, there is a relative improvement of 7.28%, and 6.81% in overall accuracy respec- tively. In addition to Kaldi augmentation, we also apply pitch scaling and bandpass filter as data augmentation, however, we did not achieve much improvement in SD. C. Multi-contextual StutterNet Different contexts show different optimized class accuracies. In order to exploit these different variable contexts and to improve the detection performance further, we propose a multi-contextual (MC) StutterNet for SD as shown in Fig. 3. We jointly train and optimize the MC StutterNet on the clean and augmented data using variable contexts of 5 and 9. The embeddings extracted from each context as depicted by CB block are passed to a two-layered BiLSTM unit, and then concatenated after applying statistical pooling layer (SPL), resulting in a 1×2×(2×N )-dimensional feature vector (where SHEIKH et al.: ADVANCING STUTTERING DETECTION VIA DATA AUGMENTATION, CLASS-BALANCED LOSS AND MULTI-CONTEXTUAL DEEP LEARNING 11 TABLE IV: RESULTS USING MC StutterNet WITH CLEAN AND DATA AUGMENTATION. THE MC StutterNet ALSO CONTAINS MB TRAINING. (B: BLOCK, F: FLUENT, R: REPETITION, P: PROLONGATION, IN: INTERJECTION, TA: TOTAL ACCURACY, BB: BABBLE, RV:REVERBERATION, MU:MUSIC, NO:NOISE, A4: BB + MU + NO + RV AUGMENTATION) Method MC StutterNet (Clean) MC StutterNet + Bb MC StutterNet + Mu MC StutterNet + No MC StutterNet + Rv MC StutterNet + A4 R 33.36 32.29 32.08 28.54 31.98 34.65 Accuracy B 08.34 09.85 07.98 04.75 05.83 10.12 In 59.63 66.50 65.68 64.20 67.63 67.91 P 37.15 37.11 36.57 32.39 37.02 39.75 F 78.34 74.54 77.67 80.42 77.41 77.89 TA 59.77 58.71 59.96 59.99 60.08 61.72 F1(%) 43.86 44.40 44.00 42.80 44.20 46.00 N is layer size), which is then fed parallelly to two different branches including FluentBranch and DisfluentBranch for class predictions. This results in a relative improvement of 13.40%, 15.67%, 6.41%, and 1.38% in prolongation, block, interjection, and fluent classes over StutterNetMB (clean), thus an improvement of 3.79% in macro F1 score, however, em- ploying multi-contextual training, we see a drop from 35.26% to 33.36% in repetition accuracy over the StutterNetMB. In comparison to baseline BL5 (vanilla single branch StutterNet), there is a relative improvement of 22.92%, 14.13%, 181.81%, 3.27% in repetition, prolongation, block, and interjection classes respectively. Thus a relative improvement of 2.38% in macro F1 score. The MC StutterNet also performs better in macro F1 score in comparison to state-of-the-art baselines BL1 and BL4. Applying data augmentation on top of the MC StutterNet, we found that except noise augmentation, all other data augmentation types help in improving the macro F1 score in comparison to MC StutterNet (clean) The noise augmented samples help in improving the detection accuracy of fluent class. For interjections, we found that all the data augmentation helps, and for blocks, only babble augmentation helps in improving their detection accuracy. We also found applying all four data augmentation techniques in MC StutterNet results in an accuracy improvement in prolongation and repetition classes, however, with individual data augmentation, a drop in their accuracies can be observed in Table IV. By applying all four data augmentation in MC StutterNet training, there is an overall improvement of 1.76%, 17.15%, and 134% in repetitions, prolongations, and blocks respectively as shown in the Table IV, which is a 4.48% relative gain in macro F1 score over the augmented StutterNetMB training. D. Summary of proposed methods This work advances the basic StutterNet by addressing its limitations with three modifications. In Table V, we present a summary of the results demonstrating systematic improve- ments. We observe that all the proposed modifications help to gradually improve the performance and we achieve 7.37% overall relative improvement in terms of macro F1 score. E. Cross corpora evaluation Table VI shows the results on cross corpora datasets includ- ing FluencyBank and simulated LibriStutter. By optimizing on SEP-28k dataset in terms of data augmentation and multi- contextual, we aim to evaluate our proposed methodology MC StutterNet on a cross corpora scenario. We train StutterNet TABLE V: SUMMARY OF RESULTS OF PROPOSED METHODS (A4: ALL FOUR AUGMENTATION (BB + MU + NO + RV) Method StutterNet (BL5) (Clean) [29] Class Imbalance F1 (%) 42.84 StutterNetWCE (Clean) StutterNetMB (Clean) Mfrz enc (Clean) enc,disf (Clean) Mfrz Data Augmentation StutterNet + A4 StutterNetWCE + A4 StutterNetMB + A4 Mfrz enc + A4 enc,disf + A4 Mfrz Multi-Contextual MC StutterNet (Clean) MC StutterNet + A4 41.02 42.26 44.42 44.80 45.30 44.34 44.03 44.06 45.76 43.86 46.00 on SEP-28k dataset and evaluate it on FluencyBank dataset which comprises samples from 33 podcasts. We found that the model trained on one corpus (SEP-28k) fails to generalize and performs poorly on cross-domain corpora. As can be seen from the Table VI and Fig. 6, the F1 detection performance decreases remarkably from 43.86% to 38.92% employing the performance drop clean training. We hypothesize that is due to the domain mismatch due to the difference in speaker accent and recording environment between the SEP- 28k and FluencyBank datasets. The repetitions and block classes show more degradation in their performance in cross corpora scenarios. Furthermore, we apply data augmentation in cross corpora evaluation, and we found that it boosts the detection performance of all the classes, which results in an improvement of 13.23% in F1. Experimental evaluation of MC StutterNet on simulated LibriStutter dataset [63] results in a macro F1 score of ≈ 91% (shown in Table VI). However, the performance considerably drops when evaluated in cross-corpora setting in comparison to real stuttering dataset FluencyBank. The MC StutterNet trained on SEP-28k dataset shows extremely poor performance when tested on simulated LibriStutter dataset. Applying data augmented training, we see there is minimal improvement of 1% and 2% in repetition and prolongation, respectively. The LibriStutter simulated dataset does not reflect the actual nature and characteristics of stuttered speech. The results also confirms that a model trained on simulated stuttered datasets should not be used in a real clinical condition. 12 IEEE JOURNAL OF BIOMEDICAL AND HEALTH INFORMATICS, VOL. XX, NO. XX, XXXX 2022 TABLE VI: RESULTS ON CROSS CORPORA FLUENCYBANK AND SIMULATED LIBRISTUTTER DATASETS. THE FIRST ROW IS FROM TABLE IV WHICH SHOWS THE RESULTS ON THE SAME CORPORA SEP-28K DATASET. THE LAST TWO ROWS IN THE FIRST HALF OF THE TABLE SHOW THE RESULTS, WHERE THE MODEL IS TRAINED ON SEP-28K AND TESTED ON FLUENCYBANK IN CROSS CORPORA SETTING. (B: BLOCK, F: FLUENT, R: REPETITION, P: PROLONGATION, IN: INTERJECTION), BB: BABBLE, RV: REVERBERATION, MU: MUSIC, NO: NOISE, A4: ALL FOUR BB + RV + MU + NO AUGMENTATION. THE MULTI-BRANCHED TRAINING IS ALSO CONSIDERED IN MC StutterNet. Method MC StutterNet MC StutterNet (Clean) MC StutterNet + A4 MC StutterNet MC StutterNet(clean) MC StutterNet + A4 MC StutterNet TrainSet SEP-28k SEP-28k SEP-28k LibriStutter SEP-28k SEP-28k LibriStutter TestSet SEP-28k FluencyBank FluencyBank LibriStutter LibriStutter LibriStutter SEP-28k R 33.36 19.48 22.54 93.36 00.65 01.11 24.24 Accuracy B 08.34 01.83 4.36 NA NA NA NA In 59.63 56.36 64.56 NA NA NA NA P 37.15 35.80 42.22 76.26 00.48 02.39 55.11 F 78.34 80.85 84.04 98.19 99.95 97.35 60.60 TA 59.77 56.48 60.92 96.11 77.25 75.43 53.21 F1(%) 43.86 38.92 44.07 91.00 30.00 31.00 41.00 46 44 42 40 38 36 34 1 L B 4 L B E C W t e N r e t t u t S B M t e N r e t t u t S 4 A + B M t e N r e t t u t S 4 A + E C W t e N r e t t u t S c n e z r f M 4 A + c n e z r f M f s i d , c n e z r f M t e N r e t t u t S C M 4 A + f s i d , c n e z r f M C C t e N r e t t u t S C M 4 A + t e N r e t t u t S C M 4 A + C C t e N r e t t u t S C M Fig. 7: Macro F1 score summary of proposed and baseline models (BL1 and BL4). The red, light blue and purple bars indicate the baseline, same-corpora setting, and cross-corpora settings. (CC: Cross Corpora with training on SEP-28k and evaluated on FluencyBank dataset, A4: All four data augmen- tation. The second last bar shows cross-corpora performance on FluencyBank when trained using a clean SEP-28k dataset and the last bar shows the same with data augmentation). VI. CONCLUSION This paper addresses the problem of class imbalance in the stuttering domain. We address the class imbalance problem via two strategies including weighted cross entropy and a multi-branch training scheme. The weighted cross entropy loss function forces the StutterNet classifier to give more attention to minority classes. We also investigate the effec- tiveness of data augmentation in the SD domain. For data augmentation, we employ reverberations and additive noises from the MUSAN dataset [51]. Additionally, we propose a MC StutterNet, time delay based neural network for SD. The proposed MC StutterNet is a multi-class classifier that exploits different variable contexts trained jointly on different contexts (5, 9) using CE. More importantly, the experiments using data augmentation over the FluencyBank dataset revealed that our methodology generalizes better in the cross corpora domain. For class imbalance, we have used only a simple weighting scheme in the cross-entropy loss function, which results in an accuracy trade-off between majority and minority classes. thus, In general, the data augmentation helps in stuttering domain, however, the use of data augmentation in the stuttering domain is not straightforward, is limited because most data augmentations, such as time stretch, speed perturbation, and so on, completely alter the underlying structure of the stuttering speech sample. In order for data augmentation to be more effective, a domain stuttering specific data augmentation is required to be developed. In addition, the stuttering detection domain has not matured enough, so a single metric like other speech domains which reflects the overall performance of a model is yet to be developed. In addition to accuracy metric, we have also used a macro F1-score (F1) which gives a good indication for the better evaluation of proposed methods. Moreover, we use joint training over multi contexts in this work, and it is possible that one context can dominate the training. A visualisation summary of macro F1 score of models in stuttering detection is shown in Fig. 7. The proposed methodology show promising results and it can detect if the stuttering is present in the speech sample or not, however, it cannot predict where exactly the stuttering occurs in the speech frames. For future study, we would like to explore combining the other different types of neural networks in SD to predict the frames where exactly the stuttering occurs. In addition to varying context, the investigation of varying depth and different number of convolutional kernels is also an interesting topic to study in SD. Moreover, the temporal information captured by recurrent neural networks can also be investigated in a multi-stream fashion for the identification of disfluent speech frames. The performance comparison of the proposed systems with two state-of-the-art systems demonstrate that even though we achieve a noticeable advancements, the automated stuttering detection requires further research for developing a clini- cally usable system. The stuttering detection is fundamen- SHEIKH et al.: ADVANCING STUTTERING DETECTION VIA DATA AUGMENTATION, CLASS-BALANCED LOSS AND MULTI-CONTEXTUAL DEEP LEARNING 13 tally a challenging task due to inter-person variations, lan- guage/accent/dialect variability and other speaking variations. The scopes of the current work are limited to addressing basic problems related to stuttering detection. This work can be extended with speaker-adaptive training, domain adaptation to further improve the stuttering detection problem. Regarding cognitive aspects of stuttering are well modeled or not as the explainability analysis of the used deep models along with auxiliary data (e.g., functional magnetic resonance imaging or fMRI data) is yet to be explored. However, we think the base architecture (i.e., MC StutterNet) developed in this work could still be useful for such explainability analysis. The stuttering detection can be improved with multimodality by integrating with visual cues related to head nodding, lip tremors, unusual lip shapes, quick eye blinks, facial expres- sions, etc. We think that the same base acoustic model can be used in a fusion framework. We have found that the blocks are the most difficult to detect. It would be interesting to analyze the disfluencies of the speakers which are hardest to identify by doing more ablation analysis. The future work includes exploring self-supervised models that exploit unlabelled audio data. ACKNOWLEDGMENT This work was made with the support of the French National Research Agency, in the framework of the project ANR BENEPHIDIRE (18-CE36- 0008-03). Experiments presented in this paper were carried out using the Grid'5000 testbed, supported by a scientific interest group hosted by Inria and including CNRS, RENATER and several universities as well as other organizations(see https://www.grid5000.fr) and using the EXPLOR centre, hosted by the University of Lorraine. REFERENCES [1] B. Guitar, Stuttering: An Integrated Approach to its Nature and Treat- ment. Lippincott Williams & Wilkins, 2013. [2] J. R. Duffy, Motor Speech Disorders-E-Book: Substrates, Differential Diagnosis, and Management. Elsevier Health Sciences, 2013. [3] N. B. Ratner and B. MacWhinney, "Fluency bank: A new resource for fluency research and practice," Journal of Fluency Disorders, vol. 56, p. 69, 2018. [4] D. Ward, Stuttering and Cluttering: Frameworks for Understanding and Treatment. Psychology Press, 2008. [5] T. D. Kehoe and W. Contributors, Speech Language Pathology- Stuttering. Kiambo Ridge, 2006. [6] I. Hurjui, S. Pete, and I. Bostan, "Spatial distribution and the prevalence of speech disorders in the provinces of Iran," Journal of Medicine and Life, vol. 9, no. 1, p. 56, 2016. [7] A. Smith and C. Weber, "How stuttering develops: The multifactorial dynamic pathways theory," Journal of Speech, Language, and Hearing Research, vol. 60, no. 9, pp. 2483–2505, 2017. [8] E. N ̈oth et al., "Automatic stuttering recognition using hidden Markov models," in Proc. ICSLP, 2000. [9] V. Mitra et al., "Analysis and tuning of a voice assistant system for dysfluent speech," in Proc. Interspeech 2021, 2021, pp. 4848–4852. [10] L. Verde, G. De Pietro, and G. Sannino, "Voice disorder identification by using machine learning techniques," IEEE Access, vol. 6, pp. 16 246– 16 255, 2018. [11] N. Narendra and P. Alku, "Dysarthric speech classification from coded telephone speech using glottal features," Speech Communication, vol. 110, pp. 47–55, 2019. [12] C. Quan, K. Ren, and Z. Luo, "A deep learning based method for parkinson's disease detection using dynamic features of speech," IEEE Access, vol. 9, pp. 10 239–10 252, 2021. [13] S. Alharbi et al., "A lightly supervised approach to detect stuttering in children's speech," in Proc. Interspeech 2018, 2018, pp. 3433–3437. [14] --, "Sequence labeling to detect stuttering events in read speech," Computer Speech & Language, vol. 62, p. 101052, 2020. [15] V. Zayats, M. Ostendorf, and H. Hajishirzi, "Disfluency detection using a bidirectional LSTM," in Proc. Interspeech 2016, 2016, pp. 2523–2527. [16] Q. Chen, M. Chen, B. Li, and W. Wang, "Controllable time-delay trans- former for real-time punctuation prediction and disfluency detection," in Proc. ICASSP 2020, 2020, pp. 8069–8073. [17] A. B. Nassif and et al., "Speech recognition using deep neural networks: A systematic review," IEEE Access, vol. 7, pp. 19 143–19 165, 2019. [18] S. Latif and at al., "Deep representation learning in speech process- ing: Challenges, recent advances, and future trends," arXiv preprint arXiv:2001.00378, 2020. [19] Y. Ning et al., "A review of deep learning based speech synthesis," Applied Sciences, vol. 9, no. 19, p. 4050, 2019. [20] M. B. Akc ̧ay and K. O ̆guz, "Speech emotion recognition: Emotional models, databases, features, preprocessing methods, supporting modali- ties, and classifiers," Speech Communication, vol. 116, pp. 56–76, 2020. [21] B. Sisman et al., "An overview of voice conversion and its challenges: From statistical modeling to deep learning," IEEE/ACM Transactions on Audio, Speech, and Language Processing, 2020. [22] J. S. Almeida et al., "Detecting Parkinson's disease with sustained phonation and speech signals using machine learning techniques," Pat- tern Recognition Letters, vol. 125, pp. 55–62, 2019. [23] I. Kodrasi, "Temporal envelope and fine structure cues for dysarthric speech detection using CNNs," IEEE Signal Processing Letters, vol. 28, pp. 1853–1857, 2021. [24] P. Howell and S. Sackin, "Automatic recognition of repetitions and prolongations in stuttered speech," in Proc. of the first World Congress on Fluency Disorders, vol. 2. University Press Nijmegen Nijmegen, The Netherlands, 1995, pp. 372–374. [25] K. Ravikumar, B. Reddy, R. Rajagopal, and H. Nagaraj, "Automatic detection of syllable repetition in read speech for objective assessment of stuttered disfluencies," in Proc. of World Academy of Science, Engineering and Technology, vol. 36. Citeseer, 2008, pp. 270–273. [26] B. Villegas et al., "A novel stuttering disfluency classification system IEEE, based on respiratory biosignals," in Proc. IEEE EMBC 2019. 2019, pp. 4660–4663. [27] T. Kourkounakis, A. Hajavi, and A. Etemad, "Detecting multiple speech disfluencies using a deep residual network with bidirectional long short- term memory," in Proc. ICASSP 2020, 2020, pp. 6089–6093. [28] C. Lea et al., "SEP-28k: A dataset for stuttering event detection from podcasts with people who stutter," in Proc. ICASSP 2021, 2021. [29] S. A. Sheikh, M. Sahidullah, F. Hirsch, and S. Ouni, "StutterNet: Stut- tering detection using time delay neural network," in Proc. EUSIPCO 2021, 2021, pp. 426–430. [30] M. Jouaiti and K. Dautenhahn, "Dysfluency classification in stuttered speech using deep learning for real-time applications," in Proc. ICASSP 2022, 2022, pp. 6482–6486. [31] S. A. Sheikh, M. Sahidullah, F. Hirsch, and S. Ouni, "Machine learning for stuttering identification: Review, challenges and future directions," Neurocomputing, vol. 514, pp. 385–402, 2022. [32] A. Fern ́andez, S. Garc ́ıa, M. Galar, R. C. Prati, B. Krawczyk, and Springer, 2018, F. Herrera, Learning from Imbalanced Data Sets. vol. 10. [33] B. Krawczyk, "Learning from imbalanced data: open challenges and future directions," Progress in Artificial Intelligence, vol. 5, no. 4, pp. 221–232, 2016. [34] G. M. Weiss, "Foundations of Imbalanced Learning," Imbalanced Learn- ing: Foundations, Algorithms, and Applications, pp. 13–41, 2013. [35] G. I. Winata, G. Wang, C. Xiong, and S. Hoi, "Adapt-and-adjust: Overcoming the long-tail problem of multilingual speech recognition," arXiv preprint arXiv:2012.01687, 2020. [36] B. W. Schuller et al., "The ACM multimedia 2022 computational par- alinguistics challenge: vocalisations, stuttering, activity, & mosquitos," in Proc. ACM Multimedia 2022, 2022. [37] Y. Cui et al., "Class-balanced loss based on effective number of samples," in Proc. IEEE CVPR, 2019, pp. 9268–9277. [38] M. Bader-El-Den, E. Teitei, and M. Adda, "Hierarchical classification for dealing with the class imbalance problem," in Proc. 2016 IJCNN, 2016, pp. 3584–3591. [39] D. S. Park et al., "SpecAugment: A simple data augmentation method for automatic speech recognition," in Proc. Interspeech 2019, 2019, pp. 2613–2617. [40] L. Meng, J. Xu, X. Tan, J. Wang, T. Qin, and B. Xu, "Mixspeech: Data augmentation for low-resource automatic speech recognition," in Proc. ICASSP 2021, 2021, pp. 7008–7012. [41] N. Kanda, R. Takeda, and Y. Obuchi, "Elastic spectral distortion for low resource speech recognition with deep neural networks," in Proc. IEEE ASRU 2013, 2013, pp. 309–314. [42] T. Ko et al., "Audio augmentation for speech recognition," in Proc. Interspeech 2015, 2015. 14 IEEE JOURNAL OF BIOMEDICAL AND HEALTH INFORMATICS, VOL. XX, NO. XX, XXXX 2022 [43] P. J. Bell et al., "Transcription of multi-genre media archives using out- [57] H. Bourlard et al., "Towards subband-based speech recognition," in Proc. of-domain data," in Proc. IEEE SLT 2012, 2012, pp. 324–329. EUSIPCO 1996. IEEE, 1996, pp. 1–4. [44] B. Vachhani, C. Bhat, and S. K. Kopparapu, "Data augmentation using healthy speech for dysarthric speech recognition," in Proc. Interspeech 2018, 2018, pp. 471–475. [45] Y. Jiao et al., "Simulating dysarthric speech for training data augmen- tation in clinical speech applications," in Proc. ICASSP 2018, 2018, pp. 6009–6013. [46] H. Christensen et al., "Combining in-domain and out-of-domain speech data for automatic recognition of disordered speech." in Proc. Inter- speech 2013, 2013, pp. 3642–3645. [47] F. Xiong, J. Barker, and H. Christensen, "Phonetic analysis of dysarthric speech tempo and applications to robust personalised dysarthric speech recognition," in Proc. ICASSP 2019, 2019, pp. 5836–5840. [48] D. Woszczyk et al., "Data augmentation for Dementia detection in spoken language." in Proc. Interspeech 2022, 2022, pp. 2858–2862. [49] T. Gr ́osz et al., "Wav2vec2-based paralinguistic systems to recognise vocalised emotions and stuttering," in Proc. ACM Multimedia, 2022, p. 7026–7029. [50] T. Ko et al., "A study on data augmentation of reverberant speech for robust speech recognition," in Proc. ICASSP 2017, 2017, pp. 5220–5224. [51] D. Snyder, G. Chen, and D. Povey, "Musan: A music, speech, and noise corpus," arXiv preprint arXiv:1510.08484, 2015. [58] H. Hennansky, S. Tibrewala, and M. Pavel, "Towards ASR on partially corrupted speech," in Proc. Fourth International Conference on Spoken Language Processing. ICSLP '96, vol. 1, 1996, pp. 462–465 vol.1. [59] N. Naderi and B. Nasersharif, "Multiresolution convolutional neural net- work for robust speech recognition," in Proc. 2017 Iranian Conference on Electrical Engineering (ICEE), 2017, pp. 1459–1464. [60] X.-L. Zhang and D. Wang, "A deep ensemble learning method for monaural speech separation," IEEE/ACM Transactions on Audio, Speech, and Language Processing, vol. 24, no. 5, pp. 967–977, 2016. [61] Y. Chiba, T. Nose, and A. Ito, "Multi-stream attention-based BLSTM with feature segmentation for speech emotion recognition," in Proc. Interspeech 2020, 2020. [62] Y. Li, X. Zhang, H. Jin, X. Li, Q. Wang, Q. He, and Q. Huang, "Using multi-stream hierarchical deep neural network to extract deep audio feature for acoustic event detection," Multimedia Tools and Applications, vol. 77, no. 1, pp. 897–916, 2018. [63] T. Kourkounakis, A. Hajavi, and A. Etemad, "FluentNet: End-to-end de- tection of stuttered speech disfluencies with deep learning," IEEE/ACM Transactions on Audio, Speech, and Language Processing, vol. 29, pp. 2986–2999, 2021. [64] B. McFee et al., "Librosa: Audio and music signal analysis in python," [52] D. Povey et al., "The Kaldi speech recognition toolkit," in Proc. IEEE in Proc. 14th Python in Science Conference, 2015. ASRU 2021, 2011. [65] D. Can, V. R. Martinez, P. Papadopoulos, and S. S. Narayanan, "PyKaldi: [53] J. B. Allen, "How do humans process and recognize speech?" in Modern A Python wrapper for Kaldi," in Proc. ICASSP. IEEE, 2018. methods of speech processing. Springer, 1995, pp. 251–275. [54] K. Simonyan and A. Zisserman, "Two-stream convolutional networks Cambridge, for action recognition in videos," in Proc. NIPS 2014. MA, USA: MIT Press, 2014. [55] K. J. Han et al., "Multistream CNN for robust acoustic modeling," in Proc. ICASSP 2021, 2021, pp. 6873–6877. [56] H. Bourlard and S. Dupont, "A new ASR approach based on independent processing and recombination of partial frequency bands," in Proc. ICSLP, 1996. [66] R. Fer et al., "Multilingually trained bottleneck features in spoken language recognition," Computer Speech & Language, vol. 46, no. Supplement C, pp. 252 – 267, 2017. [67] S. A. Sheikh, M. Sahidullah, F. Hirsch, and S. Ouni, "End-to-end and self-supervised learning for ComParE 2022 stuttering sub-challenge," in Proc. ACM Multimedia 2022, 2022. [68] J. Opitz and S. Burst, "Macro F1 and macro F1 a note," arXiv preprint arXiv:1911.03347, 2019.
http://arxiv.org/abs/2302.10681v3
2023-07-02T23:51:57
2023-02-21T14:03:22
FrankenSplit: Efficient Neural Feature Compression with Shallow Variational Bottleneck Injection for Mobile Edge Computing
The rise of mobile AI accelerators allows latency-sensitive applications to execute lightweight Deep Neural Networks (DNNs) on the client side. However, critical applications require powerful models that edge devices cannot host and must therefore offload requests, where the high-dimensional data will compete for limited bandwidth. This work proposes shifting away from focusing on executing shallow layers of partitioned DNNs. Instead, it advocates concentrating the local resources on variational compression optimized for machine interpretability. We introduce a novel framework for resource-conscious compression models and extensively evaluate our method in an environment reflecting the asymmetric resource distribution between edge devices and servers. Our method achieves 60% lower bitrate than a state-of-the-art SC method without decreasing accuracy and is up to 16x faster than offloading with existing codec standards.
[ "Alireza Furutanpey", "Philipp Raith", "Schahram Dustdar" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10681v3", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10681v3", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "eess.IV", "@scheme": "http://arxiv.org/schemas/atom" }
[ "eess.IV", "cs.AI", "cs.DC", "cs.LG" ]
1 FrankenSplit: Efficient Neural Feature Compression with Shallow Variational Bottleneck Injection for Mobile Edge Computing Alireza Furutanpey∗, Philipp Raith, Schahram Dustdar, Distributed Systems Group, TU Vienna [email protected] ∗Corresponding Author 3 v 1 8 6 0 1 . 2 0 3 2 : v i X r a 3 2 0 2 1 INTRODUCTION l u J ✦ ] 2 I . s s e e [ D EEP Learning (DL) has demonstrated that it can solve V real-world problems in challenging areas ranging from Computer Vision (CV) [1] to Natural language Process- ing (NLP) [2]. Complementary with the advancements in mobile edge computing (MEC) [3] and energy-efficient AI accelerators, visions of intelligent city-scale platforms for critical applications, such as mobile augmented real- ity (MAR) [4], disaster warning [5], or facilities manage- ment [6], seem progressively feasible. Nevertheless, the accelerating pervasiveness of mobile clients gave unprece- dented growth in Machine-to-Machine (M2M) communi- cation [7], leading to an insurmountable amount of net- work traffic. A root cause is the intrinsic limitation of mobile devices that allows them to realistically host a single lightweight Deep Neural Network (DNN) in memory at a time. Hence, clients must frequently offload inference requests since the local resources alone cannot meet the complex and demanding requirements of applications that rely on multiple highly accurate DNNs [8]. The downside to offloading approaches is that by con- stantly streaming high-dimensional visual data, the limited bandwidth will inevitably lead to network congestion re- sulting in erratic response delays, and it leaves valuable client-side resources idle. Split Computing (SC) emerged as an alternative to al- leviate inefficient resource utilization and to facilitate low- latency and performance-critical mobile inference. The basic idea is to partition a DNN to process the shallow layers with the client and send a processed representation to the remaining deeper layers deployed on a server. The SC paradigm can potentially draw resources from the en- tire edge-cloud compute continuum. However, current SC methods are only conditionally applicable (e.g., in highly bandwidth-constrained networks) or tailored toward spe- cific neural network architectures. Still, even methods that claim to generalize towards a broader range of architectures do not consider that mobile clients can typically only load a single model into memory. Consequently, SC methods are impractical for applications with complex requirements re- lying on inference from multiple models concurrently (e.g., MAR). Mobile clients reloading weights from its storage into memory, and sending multiple intermediate representations for each pruned model would incur more overhead than directly transmitting image data with fast lossless codecs to an unmodified model. Moreover, due to the conditional applicability of SC, practical methods rely on a decision mechanism that periodically probes external conditions (e.g., available bandwidth), resulting in further deployment and runtime complexity [9]. This work shows that we can address the increasing need to reduce bandwidth consumption while simultaneously generalizing the objective of SC methods to provide mobile clients access to low-latency inference from remote off-the- shelf discriminative models even in constrained networks. We draw from recent advancements in lossy learned image compression (LIC) and the Information Bottleneck (IB) principle [10]. Despite outperforming handcrafted codecs [11], such as PNG, or WebP [12], LIC is unsuitable for real-time inference in MEC since they consist of large models and other complex mechanisms that are demand- ing even for server-grade hardware. Moreover, research in compression primarily focuses on reconstruction for human perception containing information superfluous for M2M communication. In comparison, the deep variational infor- mation bottleneck (DVIB) provides an objective for learned feature compression with DNNs, prioritizing information valuable for machine interpretability over human percep- tion. With DVIB, we can conceive methods universally appli- cable to off-the-shelf architectures. However, current DVIB methods typically place the bottleneck at the penultimate layer. Thus, they are unsuitable for most common dis- tributed settings that assume an asymmetric resource allo- cation between the client and the server. In other words, the objective of DVIB contradicts objectives suitable for MEC, where we would ideally inverse the bottleneck's location to the shallow layers. To this end, we introduce Shallow Variational Information Bottleneck (SVIB) that accommodates the restrictions of mo- bile clients while retaining the generalizability of DVIB to arbitrary architectures. Although shifting the bottleneck to the shallow layers does not formally change the objective, we will demonstrate that existing methods for mutual infor- mation estimation lead to unsatisfactory results. Specifically, we introduce FrankenSplit: A novel training and design heuristic for variational feature compression models embeddable in arbitrary DNN architectures with pre-trained weights for high-level vision tasks. FrankenSplit is refreshingly simple to implement and deploy without additional decision mechanisms that rely on runtime components for probing external conditions. Moreover, by deploying a single lightweight encoder, the client can access state-of-the-art accuracy from multiple large server-grade models without reloading weights from memory for each task. Lastly, the approach does not re- quire modifying discriminative models (e.g., by finetuning weights). Therefore, we can directly utilize foundational off- the-shelf models and seamlessly integrate FrankenSplit into existing systems. We open-source our repository 1 as an addition to the community for researchers to reproduce and extend our experiments. In summary, our contributions are: • Thoroughly exploring how shallow and deep bottle- neck injection differ for feature compression. • Introducing a novel saliency-guided training method to overcome the challenges of SVBI to train a lightweight encoder with limited capacity and demonstrate how the compressed features are usable for several downstream tasks without predictive loss. • Introducing a generalizable architecture design heuris- tic for a variational feature compression model to ac- commodate arbitrary DNN architectures for discrimi- native models. Section 2 discusses relevant work on SC and LIC. Sec- tion 3 discusses the limitations of SC methods and moti- vates neural feature compression. Section 4 describes the problem domain. Section 5 progressively introduces the solution approach. Section 6 extensively justify relevant performance indicators and evaluates several implementa- tions of FrankenSplit against various baselines to assess our method's efficacy. Lastly, Section 7 summarizes this work and highlights limitations to motivate follow-up work. 2 RELATED WORK 2.1 Neural Data Compression 2.1.1 Learned Image Compression The goal of (lossy) image compression is minimizing bitrates while preserving information critical for human perception. Transform coding is a basic framework of lossy compres- sion, which divides the compression task into decorrelation and quantization [13]. Decorrelation reduces the statistical dependencies of the pixels, allowing for more effective entropy coding, while quantization represents the values as a finite set of integers. The core difference between handcrafted and learned methods is that the former relies on linear transformations based on expert knowledge. Contrar- ily, the latter is data-driven with non-linear transformations learned by neural networks [14]. Ball ́e et al. introduced the Factorized Prior (FP) entropy model and formulated the neural compression problem by 1. https://github.com/rezafuru/FrankenSplit 2 finding a representation with minimal entropy [15]. An encoder network transforms the original input to a latent variable, capturing the input's statistical dependencies. In follow-up work, Ball ́e et al. [16] and Minnen et al. [17] extend the FP entropy model by including a hyperprior as side information for the prior. Minnen et al. [17] introduce the Joint Autoregressive and Hierarchical Priors (JAHP) entropy model, which adds a context model to the existing scale hyperprior latent variable models. Typically, context models are lightweight, i.e., they add a negligible number of parameters, but their sequential processing increases the end-to-end latency by orders of magnitude. 2.1.2 Feature Compression Singh et al. demonstrate a practical method for the Infor- mation Bottleneck principle in a compression framework by introducing the bottleneck in the penultimate layer and replacing the distortion loss with the cross-entropy for im- age classification [18]. Dubois et al. generalized the VIB for multiple downstream tasks and were the first to describe the feature compression task formally [19]. However, their encoder-only CLIP compressor has over 87 million parame- ters. Both Dubois and Singh et al. consider feature compres- sion for mass storage, i.e., they assume the data is already present at the target server. In contrast, we consider how resource-constrained clients must first compress the high- dimensional visual data before sending it over a network. Closest to our work is the Entropic Student (ES) pro- posed by Matsubara et al. [20], [21], as we follow the same objective of real-time inference with feature compression. Nevertheless, they simply apply the learning objective, and a scaled-down version of autoencoder from [15], [16]. More- over, they do not analyze the intrinsic differences between feature and image compression nor explain their solution approach. Contrastingly, we carefully examine the problem domain of resource-conscious feature compression to iden- tify underlying issues with current methods, allowing us to conceive novel solutions with significantly better rate- distortion performance. 2.2 Split Computing We distinguish between two orthogonal approaches to SC. 2.2.1 Split Runtimes Split runtime systems are characterized by performing no or minimal modifications on off-the-shelf DNNs. The ob- jective is to dynamically determine split points according to the available resources, network conditions, and intrinsic model properties. Hence, split runtimes primarily focus on profilers and adaptive schedulers. Kang et al. performed extensive compute cost and feature size analysis on the layer-level characterizations of DNNs and introduced the first split runtime system [22]. Their study has shown that split runtimes are only sensible for DNNs with an early natural bottleneck, i.e., models performing aggressive di- mensionality reduction within the shallow layers. However, most modern DNNs increase feature dimensions until the last layers for better representation. Consequently, follow- up work focuses on feature tensor manipulation [23]–[25]. We argue against split runtimes since they introduce con- siderable complexity. Worse, the system must be tuned toward external conditions, with extensive profiling and careful calibration. Additionally, runtimes raise overhead and another point of failure by hosting a network-spanning system. Notably, even the most sophisticated methods still rely on a natural bottleneck, evidenced by how state-of-the- art split runtimes still report results on superseded DNNs with an early bottleneck [26], [27]. 2.2.2 Artificial Bottleneck Injection By shifting the effort towards modifying and re-training an existing base model (backbone) to replace the shallow layers with an artificial bottleneck, bottleneck Injection retains the simplicity of offloading. Eshratifar et al. replace the shallow layers of ResNet-50 with a deterministic autoencoder net- work [28]. A follow-up work by Jiawei Shao and Jun Zhang further considers noisy communication channels [29]. Mat- subara et al. [30], and Sbai et al. [31] propose a more general network agnostic knowledge distillation (KD) method for embedding autoencoders, where the output of the split point from the unmodified backbone serves as a teacher. Lastly, we consider the work in [20] as the state-of-the-art for bottleneck injection. Although bottleneck injection is promising, there are two problems with current methods. They rely on deterministic autoencoder for crude data compression or are intended for a specific class of neural network architecture. This work addresses both limitations of such bottleneck injection methods. 3 THE CASE FOR NEURAL DATA COMPRESSION Based on the following assumptions and observations, we consider local inference with mobile-friendly models or- thogonal to our work. First, we assume an asymmetric resource allocation be- tween the client and the server, i.e., the latter has con- siderably higher computational capacity. Additionally, we assume that server-grade hardware unsuitable for mobile clients must achieve state-of-the-art performance for non- trivial discriminative tasks with inference times suitable for latency-sensitive applications. Although progress in energy-efficient ASICs and em- bedded AI with model compression with quantization, channel pruning, etc., permit constrained clients to execute lightweight DNNs, they are bound to reduced predictive strength relative to their contemporary unconstrained coun- terparts [32]. This assumption is sensible considering the trend for DNNs towards pre-trained foundational models with rising computational requirements due to increasing model sizes [33] and demanding operations [34]. Lastly, mobile devices cannot realistically load model weights for multiple models simultaneously, and it is un- reasonable to expect that a single compressed model is sufficient for applications with complex requirements that rely on various models concurrently or in quick succession. Consistent with CICOs reporting an accelerating rise of M2M communication [7], we conclude that it is inevitable that the demand for inference models to solve intelligent tasks will lead to an increase in transmitting large volumes 3 of high-dimensional data, despite the wide availability of onboard AI accelerators. 3.1 Limitations of Split Computing Still, it would be useful to leverage advancements in energy- efficient mobile chips beyond applications where local in- ference is sufficient. In particular, SC can potentially draw resources from an entire edge-cloud commute continuum while binary on- or offloading decision mechanisms will leave valuable client or server-side resources idle. Figure 1 illustrates generic on/offloading and split runtimes. Fig. 1: Prediction with On/Offloading and Split Runtimes Nevertheless, both SC approaches discussed in sec- tion 2.2 are only conditionally applicable. In particular, split Runtimes reduce server-side computation for inference tasks with off-the-shelf models by onloading and executing shallow layers at the client. This approach introduces two major limitations. First, when the latency is crucial, this is only sensible if the time for client-slide execution, transferring the features, and remotely executing the remaining layers is less than the time of directly offloading the task. Consequently, more recent work [25]–[27] relies on carefully calibrated dynamic decision mechanisms that periodically measure external and internal conditions (e.g., client state, hardware specifica- tions, and network conditions) to measure ideal split points or whether direct offloading is preferable. Second, since the shallow layers must match the deeper layers, split runtimes cannot accommodate applications with complex require- ments which are a common justification for MEC (e.g., MAR). Constrained clients would need to swap weights from the storage in memory each time the prediction model changes to classify from a different set of labels. Worse, the layers must match even for models predicting the same classes with closely related architectures (e.g., ResNet50 and ResNet101). Hence, it is particularly challenging to integrate split runtimes into systems that can increase the resource efficiency of servers by adapting to shifting and fluctuating client conditions [35], [36]. For example, when a client specifies a target accuracy and a tolerable lower Local and Remote InferenceloadstoreCompressorPNGWEBPJPGHead Models (Shallow Layers)decision0.070.140.58Mobile Discriminative ModelsDiscriminative ModelsSplit Runtimes0.110.030.620.570.180.090.250.410.130.250.410.130.570.180.090.110.030.62Discriminative ModelsClientServerWeightsStorageRuntimeTransferRequestAlternative(Mobile)AI AcceleratorFeatureTensorDecompressorPNGWEBPJPGCompressorPNGWEBPJPGDecompressorPNGWEBPJPGloadstore bound, the system could select a ResNet101 that can hit the target accuracy but may temporarily fall back to a ResNet50 to ease the load when necessary. 3.2 Execution Times with Resource Asymmetry Table 1 summarizes the execution times of ResNet variants that classify a single tensor with dimensions 3 × 224 × 224 to demonstrate the limitation incurred by partitioning ex- ecution of a model when there is considerable resource asymmetry between a client and a server. Specifically, the client is an Nvidia Jetson NX2 equipped with an AI accel- erator, and the server hosts an RTX 3090. Section 6 details evaluation setup and hardware configuration. Like other TABLE 1: Execution Times of Split Models Model ResNet50 ResNet101 ResNet152 Split Index Stem Stage 1 Stem Stage 1 Stem Stage 1 Head [NX2] (ms) 1.5055 8.2628 1.5055 8.2628 1.5055 8.2628 Head [3090] (ms) 0.1024 0.9074 0.1024 0.9074 0.1024 0.9074 Tail [3090] (ms) 4.9687 4.0224 9.8735 8.9846 14.8862 13.8687 Rel. Exec. [NX2] (%) 23.25 67.26 13.23 47.91 9.18 37.34 Contribution [NX2] (%) 0.037 0.882 0.021 0.506 0.015 0.374 widespread architectural families, ResNets organize their layers into four top-level layers, while the top-grained ones recursively consist of finer-grained ones. The terminology differs for architectures, but for the remainder of this work, we will refer to top-level layers as stages and the coarse- grained layers as blocks. Split point stem assigns the first preliminary block as the head model. It consists of a convolutional layer with batch normalization [37] and ReLU activation, followed by a maxpool. Split point stage 1 additionally assigns the first stage to the head. Notice how the shallow layers barely constitute the overall computation even when the client takes more time to execute the head than the server for the entire model. Further, compare the percentage of total computation time and relate them to the number of parameters. At best, the client contributes to 0.02% of the model execution when taking 9% of the total computation time and may only contribute 0.9% when taking 67% off the computation time. Despite a reasonably powerful mobile-friendly AI accel- erator, it is evident that utilizing client-side resources to aid a server is inefficient. Hence, SC methods commonly include some form of quantization and data size reduction. 3.3 Feature Tensor Dimensionality and Quantization To further explain the intuition of our claims and present some preliminary empirical evidence, we conceive a hypo- thetical SC method that typically starts with some statistical analysis of the output layer as illustrated in Figure 2. Exclud- ing repeating blocks, the feature dimensionality is identical for ResNet50, 101, and 152. The red line marks the cutoff where the size of the intermediate feature tensor is less than the original input. ResNets (including more modern variants), among numerous modern architectures, do not have an early natural bottleneck and will only drop below the cutoff from the first block of the second stage (S3RB1- 2). Since executing until S3RB1-2 is only about 0.06% of the model parameters of ResNet152, it may seem like a negligible computational overhead. However, as shown in 4 Table 1, even when executing 0.04% of the model, the client will make up 37% of the total computation time. Nevertheless, more modern methods reduce the num- ber of layers a client must execute with feature tensor quantization and other clever (typically statistical) meth- ods that statically or dynamically prune channels [9]. For Fig. 2: Output Dimensionality Distribution for ResNet our hypothetical method, we use the execution times from Table 1, except we generously assume that it can apply feature tensor quantization and channel pruning to reduce the expected data size without a loss in accuracy for the ImageNet classification task [38] and with no computational costs. Moreover, we reward the client for executing deeper layers to reflect deterministic bottleneck injection methods, such that the output size of the stem and stage one are 802816 and 428168 bits, respectively. Note that, for stage one, this is roughly a 92% reduction relative to its original FP32 output size at no additional computational cost. Yet, the plots in Figure 3 show that offloading with PNG, let alone more modern lossless codecs (e.g., WebP), will beat SC in total request time, except when the data rate is severely constrained. Evidently, using reasonably powerful energy- Fig. 3: Inference Latency for SC and Offloading efficient AI accelerators to execute the shallow layers of a target model is not an efficient use of client-side resources. 3.4 The advantage of learned methods In a narrow sense, most SC more modern methods consider minimizing transmitting data with feature tensor quanti- zation and other clever (typically statistical) methods that statically or dynamically prune channels, which we reflected with our hypothetical SC method. Stem-cStem-mpS1RB1-1S1RB1-2S1RB1-3S1RB2-1S1RB2-2S1RB2-3S2RB1-1S2RB1-2S2RB1-3S2RB2-1S2RB2-2S3RB1-1S3RB1-2S3RB1-3S3RB2-1S3RB2-2S3RB3-3S4RB1-1S4RB1-2S4RB1-3S4RB2-1S4RB2-2S4RB3-3Layer Name0200000400000600000800000Output Dimension (CxHxW)Layer Parameters Distribution10203040506070Data rate (Mbps)255075Total Latency (ms)ResNet50 (Split: Stem)10203040506070Data rate (Mbps)255075Total Latency (ms)ResNet101 (Split: Stem)10203040506070Data rate (Mbps)255075Total Latency (ms)ResNet152 (Split: Stem)10203040506070Data rate (Mbps)255075Total Latency (ms)ResNet50 (Split: Stage 1)10203040506070Data rate (Mbps)255075Total Latency (ms)ResNet101 (Split: Stage1)10203040506070Data rate (Mbps)255075Total Latency (ms)ResNet152 (Split: Stage1)SC with Dimensionality ReductionOffloading with PNG While dimensionality reduction can be seen as a crude approximation to compression, it is not equivalent to it [17]. With compression, the aim is to reduce the entropy of the latent under a prior shared between the sender and the receiver [14]. Dimensionality reduction (especially chan- nel pruning) may seem effective when evaluating simple datasets (e.g., CIFAR-10 [39]). However, this is more due to the overparameterization of deep neural networks. Pre- cisely, for a simple task, we can prune most channels or in- ject a small autoencoder for dimensionality reduction at the shallow layers that may appear to achieve unprecedented compression rates relative to the unmodified head's feature tensor size. In Section 6.3.7, we will show that methods may seem to work reasonably well on a simple dataset while completely faltering on more challenging datasets. From an information-theoretic point of view [40], fea- ture tensor (especially non-spatial) dimensionality to assert whether it is a suitable bottleneck is not an ideal mea- sure. Instead, we should consider the information content of the feature tensor. Notably, due to the data processing inequality, as Section 4.1 will elaborate on, the information content of a feature tensor will always be at most as high as the unprocessed input respective to the task. Although dimensionality reduction across spatial dimensions is an effective inductive bias to force a network to discern signals from noise during optimization, When treating the model itself as a black box, the raw output size measured as C × H × W × Precision is not a suitable approximation of the data's entropy, i.e., it is not a meaningful way to assert whether a layer may be a split point. Conversely, with learned approaches, we can optimize a model to compress the input according to its information content and be selective toward the signals we require for tasks we are interested in. Moreover, in Section 6.3.6, we show that with learned transforms and a parametric entropy model, increasing the latent dimension- ality, reduces the compressed data size. To summarize, the potential of SC is inhibited by primar- ily focusing on shifting parts of the model execution from the server to the client. SC's viability is not determined by how well they can partially compute a split network but by how well they can reduce the input size. Therefore, we pose the following question: Is it more efficient to focus the local resources exclusively on compressing the data rather than executing shallow layers of a network that would constitute a negligible amount of the total computation cost on the server? In Figure 4, we sketch predictions with our proposed approach. There are two underlying distinctions to common Fig. 4: Prediction with Variational Bottleneck Injection SC methods. First, the model is not split between the client 5 and the server. Instead, it deploys a lightweight encoder, and the decoder replaces the shallow layers, i.e., the dis- criminative model is split within the server. The decoder's purpose is to restore and transform the compressed signals and may match multiple backbones and tasks. Second, compared to split runtimes, the decision to apply the compression model may only depend on internal conditions. It can decouple the client from any external com- ponent (e.g., server, router). Ideally, applying the encoder should always be preferable if a mobile device has the mini- mal required resources. Still, since our method does not alter the backbones, we do not need to serve additional models to accommodate clients that cannot apply the encoder. We can simply route the input to the original input layer, similar to split runtimes, without a runtime that influences client decisions based on external conditions. This work aims to demonstrate that advancements in energy-efficient AI accelerators for providing constrained clients with demanding requirements (low latency, high accuracy) access to state-of-the-art foundational models are best leveraged with neural compression methods. The following describes the limitations of existing work for constrained devices which we must address to conceive a method suitable for MEC. 4 PROBLEM FORMULATION The goal is for constrained clients to request real-time predictions from a large DNN while maximizing resource efficiency and minimizing bandwidth consumption with compression methods. Figure 5 illustrates the possible ap- proaches when dedicating client resources exclusively for compression. Strategy a) corresponds to offloading strate- Fig. 5: Utilizing Client Resources for (Learned) Codecs gies with CPU-bound handcrafted codecs. Although learned methods can achieve considerably lower bitrates with comparable distortion than commonly used handcrafted codecs [14], we must consider that the latency overhead incurred by the DNNs (even if executed on AI accelera- tors) may dominate the reduced transfer time. Strategy b) represents recent LIC models outperforming handcrafted baselines but relying on large DNNs and other complex mechanisms. Strategy c) is our advocated method with an embeddable variational feature compression method and draws from the same underlying Nonlinear Transform Cod- ing (NTC) framework as b). It may seem straightforward to Shallow Variational Bottleneck Injection(Pruned) Discriminative ModelsEntropy ModelEDRestoration & Transformation0.570.180.09Shallow BottleneckECEncoder0.250.410.130.110.030.62DecoderEntropy Model(Mobile)ClientServerTransferRequestAlternativeAcceleratorTransformed(De)coderEntropyFeature TensorFeatureTensorEDECEdge/Mobile DeviceRestoration & Transformation DecoderImage Decompressor (Learned)Edge/Cloud ServerCompressedBitstringb)Image Decompressor(Handcrafted)Image Compressor(Handcrafted)Feature Compressor (Learned)CompressedBitstringCompressedBitstring0.030.620.110.07....CompressorImage Compressor (Learned)ECECECECPNGJPGWEBP01100011 01100101 01100011 01100101 01100101 01100011 01100101 01100101 01100011 01100101 01100011 01100101 ED01100101 01100011 01100101 01100011 01100101 01100101 01100011 01100101 01100101 01100011 01100101 EDEDChannelPNGJPGWEBPa) b) c) 0.030.620.110.07....0.030.620.110.07.... reduce the size of LIC models by prioritizing information sufficient for a particular set of tasks rather than recon- input. Nevertheless, the challenge structing the original is to reduce enough overhead while achieving sufficiently low bitrates without sacrificing predictive strength to make variational compression models suitable for real-time pre- diction with limited client resources and varying network conditions. Specifically, to overcome the limitations of SC methods described in Section 3, in addition to offloading with strat- egy a) and b), (i) we require a resource-conscious encoder that is maximally compressive about a useful representation without increasing the predictive loss. Additionally, (ii) the decoder should exploit the available server-side resources but still incur minimal overhead on the backbone. Lastly, (iii) a compression model should fit for different down- stream tasks and architectural families (e.g., CNNs or Vision Transformers). Our solution approach in Section 5 must focus on two distinct but intertwined aspects. First is an appropriate training objective for feature compression with limited model capacity. The second concerns a practical implemen- tation by introducing an architectural design heuristic for edge-oriented variational autoencoders. Hence, the follow- ing formalizes the properties of a suitable objective function and describes why related existing methods are unsuitable for SVBI. 4.1 Rate-Distortion Theory for Model Prediction By Shannon's rate-distortion theory [41], we seek a mapping bound by a distortion constraint from a random variable (r.v.) X to an r.v. U , minimizing the bitrate of the outcomes of X. More formally, given a distortion measure D and a distortion constraint Dc, the minimal bitrate is min PU |X I(X; U ) s.t. D(X, U ) ≤ Dc (1) where I(X; U ) is the mutual information and is defined as I(X; U ) = (cid:90) (cid:90) p(x, u) log (cid:19) (cid:18) p(x, u) p(x)p(u) dxdz (2) In lossy image compression, U is typically the recon- struction of ̃X of the original input, and the distortion is some sum of squared errors d(x, ̃x). Since the r-d theory does not restrict us to reconstruction [42], we can apply dis- tortion measures relevant to M2M communication. Notably, when our objective is to minimize predictive loss rather than reconstructing the input, we keep information that may be important for human perception but excessive for model predictions. To intuitively understand the potential to discard signifi- cantly more information for discriminative models, consider the Data Processing Inequality (DPI). For any 3 r.v.s X, Y, Z that form a Markov chain X ↔ Y ↔ Z where the following holds: I(X; Y ) ≥ I(X; Z) (3) Then, describe the information flow in an n-layered se- quential DNN, layer with the information path by viewing 6 layered neural networks as a Markov chain of successive representations [43]: I(X; Y ) ≥ I(R1; Y ) ≥ I(R2; Y ) ≥ . . . I(Rn; Y ) ≥ I( ̃Y ; Y ) (4) In other words, due to the DPI, the final representation be- fore a prediction Rn cannot have more mutual information with the target than the input X and typically has less. In particular, for discriminative models for high-level vision tasks that map a high dimensional input vector with strong pixel correlations to a small set of labels, we can expect I(X; Y ) ≫ I( ̃Rn, Y ). 4.2 From Deep to Shallow Bottlenecks When the task is to predict the ground-truth labels Y from a joint distribution PX,Y , the rate-distortion objective is essen- tially given by the information bottleneck principle [10]. By relaxing the (1) with a lagrangian multiplier, the objective is to maximize: I(Z; Y ) − βI(Z; X) (5) Specifically, an encoding Z should be a minimal sufficient statistic of X respective Y , i.e., we want Z to contain rel- evant information regarding Y while discarding irrelevant information from X. Practical implementations differ by the target task and how they approximate (5). For example, an approximation of I(Z; Y ) for an arbitrary classification task the conditional cross entropy (CE) [11]: D = H(PY , P ̃Y |Z) (6) Unsurprisingly, using (6) for estimating the distortion mea- sure in (5) for end-to-end optimization of a neural compres- sion model is not a novel idea (Section 2.1.2). However, a common assumption in such work is that the latent variable is the final representation Rn before performing the predic- tion, i.e., the encoder must consist of an entire backbone model which we refer to as Deep Variational Information Bot- tleneck Injection (DVBI). Conversely, we work with resource- constrained clients, i.e., to conceive lightweight encoders, we must shift the bottleneck to the shallow layers, which we refer to as Shallow Variational Bottleneck Injection (SVBI). Intuitively, the existing methods for DVBI should generalize to SVBI should, e.g., approximating the distortion term with (6) as in [18]. Although by shifting the bottleneck to the shallow layers, the encoder has less capacity for finding a minimal sufficient representation, the objective is still an approximation of (1). Yet, as we will show in Section 6.3.7, applying the objective from [18] will result in incomparably worse results for shallow bottlenecks. In the following, elaborate on Head Distillation (HD) [30], [31] that poses an objective that is a suboptimal approximation of (1), but surprisingly yields significantly better results. Moreover, we bridge the gap between deep and shallow bottleneck injection by formulating the VIB objective for HD. 4.3 Head Distilled Deep Variational IB Ideally, the bottleneck is embeddable in an existing predictor PT without decreasing the performance. Therefore, it is not the hard labels Y that define the task but the soft labels YT . For simplicity, we handle the case for one task and defer how SVBI naturally generalizes to multiple downstream tasks and DNNs to Section 6.3.5. To perform SVBI, take a copy of PT . Then, mark the location of the bottleneck by separating the copy into a head Ph and a tail Pt. Importantly, both parts are deterministic, i.e., for every realization of r.v. X there is a representation Ph(x) = h such that PT (x) = Ph(Pt(x)). Lastly, replace the head with an autoencoder and a parametric entropy model. The encoder is deployed at the sender, the decoder at the receiver, and the entropy model is shared. We distinguish between two optimization strategies to train the bottleneck's compression model. First, is direct optimization corresponding to the DVIB objective in (5), except we replace the CE with the standard KD loss [44] to approximate I(Z; Y ). Second is indirect optimization and describes HD with the objective: I(Z; H) − β I(Z; X) (7) Unlike the former, the latter does not directly correspond to (1) for a representation Z that is a minimal sufficient statistic of X respective YT . Instead, it replaces Y with a proxy task for the compression model to replicate the output of the replaced head, i.e., training methods approximating (7) optimize for a Z that is a minimal sufficient statistic of X respective H. Figure 6 illustrates the difference be- tween estimating the objectives (5) and (7). Intuitively, with faithful replication of H, the partially modified DNN has an information path equivalent to its unmodified version. A sufficient statistic retains the information necessary to replicate the input for a deterministic tail, i.e., the final prediction does not change. The problem of (7) is that it is a suboptimal approximation of (1). Although sufficiency holds, it does not optimize Z respective YT . The marginal distribution of YT now arises from the r.v. X and the parameters of PT . Moreover, since maximizing I(Z; H) is only a proxy objective for I(Z; YT ), it corresponds to the Markov chain YT ↔ H ↔ X ↔ Z. Notice how X is now conditional independent of YT . Consequently, when training a compression model with (7), we skew the rate- distortion optimization towards a higher rate than necessary by setting the lower bound for the distortion estimation too high. Fig. 6: Bottom: direct optimization. Top: Head Distillation 5 SOLUTION APPROACH We embed a stochastic compression model that we jointly optimize with an entropy model. Categorically, we follow 7 NTC [14] to implement a neural compression algorithm. For an image vector x, we have a parametric analysis transform ga(x; φg) maps x to a latent vector z. Then, a quantizer Q discretizes z to ̄z, such that an entropy coder can use the entropy model to losslessly compress ̄z to a sequence of bits. It may seem redundant to have a synthesis transform. Instead, we could directly feed the encoder output to the tail of a backbone model. However, this locks the encoder to only a single backbone and disregards the server resources. Thus, we start diverging from NTC for image compression. As shown in Figure 7, rather than an approximate inverse of the analysis, the parametric synthesis transforms gs( ̄z; θg) maps ̄z to a representation ̃h that is suitable for various tail predictors and downstream tasks. Fig. 7: Diagram of Model Components 5.1 Loss Function for End-to-end Optimization Our objective resembles variational image compression op- timization, as introduced in [15], [16]. Further, we favor HD over direct optimization as a distortion measure, as the former yields considerably better results even with a suboptimal loss function (Section 6.3.7). Analogous to variational inference, we approximate the intractable posterior p( ̃z|x) with a parametric variational density q( ̃z|x) as follows (excluding constants): Ex∼pxDKL (cid:2)q∥p ̃z|x (cid:3) = Ex∼px weighted rate (cid:122) (cid:125)(cid:124) (cid:123) log p( ̃z) ] − E ̃z∼q[−log p(x| ̃z) (cid:125) (cid:124) (cid:123)(cid:122) distortion (8) By assuming a gaussian distribution such that the likelihood of the distortion term is given by Px| ̃z(x | ̃z, θg) = N (x | gs( ̃z; θg), 1) (9) we can use the square sum of differences between h and ̃h as our distortion loss. The rate term describes the cost of compressing ̃z. Anal- ogous to the LIC methods discussed in Section 2.1, we apply uniform quantization ̄z = ⌊ ̃z⌉. Since discretization leads to problems with the gradient flow, we apply a continuous relaxation by adding uniform noise η 2 ). Combining the rate and distortion term, we derive the loss function for approximating objective (7) as L = ∥Ph(x) - (gs(ga(x; φg) + η; θg)∥2 U(− 1 2 , 1 ∼ 2 + β log(ga(x; θg) + η) (10) Backbone(Tail)Embedded Model(Student)Teacher (Head)2.5915.430.058.36....8.321.150.463.84....0.030.620.110.07....0.190.430.010.26....FrozenTrainableOptional TrainableECEDChannel Note, in the relaxed lagrangian of (1), the weight is on the distortion while we weight the rate term to align closer to the variational information bottleneck objective. Moreover, omitting the second term (β = 0) and the entropy model would result in the head distillation objective for determin- istic bottleneck injection. We will show that the loss function (10) can yield strong results, despite corresponding to the objective in (7), i.e., it is only a suboptimal approximation of (1) using H as a proxy target. In the previous subsection, we established that as the remaining layers further process a representation h, its information content decreases monotonously. Intuitively, the shallow layers extract high-level features, while deeper layers are more focused. Hence, the suboptimality stems from treating every pixel of H equally crucial to the re- maining layer. The implication here is that the MSE in (10) overly strictly penalizes pixels at spatial locations which contain redundant information that later layers can safely discard. Contrarily, the loss may not penalize the salient pixels enough when ̃h is numerically close to h. 5.2 Saliency Guided Distortion We can improve the loss in (10) by introducing additional signals that regularize the distortion term. The challenge is finding a tractable method that emphasizes the salient pixels necessary for multiple instances of a high-level vision task (e.g., classification on various datasets and labels). Moreover, the methods' overhead should only impact train time, i.e., it should not introduce any additional model components or operations during inference. HD is an extreme form of Hint Training (HT) [45], [46] where the hint becomes the primary objective rather than an auxiliary regularization term. Sbai et al. perform deter- ministic bottleneck injection with HD using the suboptimal distortion term [31]. Nevertheless, their method only con- siders crude dimensionality reduction without a parametric entropy model as an approximation to compression, i.e., it is generalized by the loss in (1)(β = 0). Matsubara et al. add further hints from the deeper layers by extending the distortion term with the sum of squared between the deeper layers [21], [30]: This approach has several downsides besides prolonged train time. In particular, even if (10) could approximate the objective in (1), the distortion term may now dominate the rate term, i.e., without exhaustively tuning the hyperparam- eters for each distortion term, the optimization algorithm should favor converging towards local optima. We show in Section 6.3.2 that pure HD can significantly outperform this method using the loss in Equation (1) without the hints from the deeper layers. Ideally, we could improve the performance with signals from deeper layers near the bottleneck. The caveat is that the effectiveness of knowledge distillation decreases for teach- ers when the student has considerably less capacity than the teacher [45]. Hence, we should not directly introduce hints at the encoder. Instead, we regularize the distortion term with class activation mapping (CAM) [47]. Although CAMs are typically used to improve the ex- plainability of DNNs, we use a variant of Grad-CAM [48] for generating saliency maps to measure a spatial location's importance at any stage. Figure 8 illustrates some examples of saliency maps when averaged over the deeper backbone stages. Specifically, for each sample, we can derive a vector 8 Fig. 8: Extracted Saliency Maps using Grad-CAM S, where each si ∈ S is a weight term for a spatial location salient about the conditional probability distributions of the remaining tail layers. Then, we should be able to improve the rate-distortion performance by regularizing the distor- tion term in (10) with Ldistortion = γ1 * L1 + γ2 * si * 1 N (cid:88) (hi − ̃hi)2 (11) i Where L1 is the distortiont term from Equation (10), and γ1, γ2 are nonnegative real numbers summing to 1. We default to γ1 = γ2 = 1 2 in our experiments. Figure 9 describes our final training setup. Note that we only require computing the CAM maps once, and they are architecturally agnostic towards the encoder, i.e., we can re- use them to train various compression models. Fig. 9: Training Setup 5.3 Network Architecture The beginning of this section broke down our aim into three problems. We addressed the first with SVBI and proposed a novel training method for low-capacity models. To not inflate the significance of our contribution, we refrain from including efficient neural network components based on existing work in efficient neural network design. A gen- eralizable resource-asymmetry-aware autoencoder design remains; components should be reusable and attachable to at least directly related network architectures once trained. TeacherStageStageExtracted Saliency MapsLoad Saliency MapGuided DistortionRate EstimationCompressorHeadStage 5.3.1 Model Taxonomy We introduce a minimal taxonomy described in Figure 10 for our approach. The top-level, Archtype, describes the pri- mary inductive bias of the model. Architectural families de- scribe variants (e.g., ResNets such as ResNet, Wide ResNet, ResNeXt [49], etc.). Lastly, directly related refers to the same architecture of different sizes (e.g., Swin-T, Swin-S, Swin-B, etc.). The challenge is to conceive a design heuristic that can Fig. 10: Simple Taxonomy with Minimal Example exploit the available server resources to aid the lightweight encoder with minimal overhead on the prediction task. We assume that, after training an embedded compression model with one particular backbone as described in Section 5.1, it is possible to reuse the encoder or decoder for different backbones with little effort based on the following two observations. 5.3.2 Bottleneck Location by Stage Depth First is how most modern DNNs consist of an initial em- bedding followed by a few stages (Described in Section 3.1). Within directly related architectures, the individual com- ponents are identical. The difference between variants is primarily the embed dimensions or the block ratio of the deepest stages. For example, the block ratio of ResNet-50 is 3:4:6:3, while the block ratio of ResNet-101 is 3:4:23:3. Therefore, the stage-wise organization of models defines a natural interface for SVBi. For the remainder of this work, we define the shallow layers as all the layers before the stage with the most blocks. 5.3.3 Decoder Blueprint by Inductive Bias This second observation is how archetypes introduce dif- ferent inductive biases (e.g., convolutions versus atten- tion modules with sliding windows), leading to diverging representations among non-related architectures. Thus, we should not disregard architecture-induced bias by directly repurposing neural compression models for SC. For example, a scaled-down version of Ball ́e et al.'s [15] convolutional neural compression model can yield strong rate-distortion performance for bottlenecks reconstructing a convolutional layer [20] of a discriminative model. How- ever, we will show that this does not generalize to other architectural families, such as hierarchical vision transform- ers [50]. 9 the homogeneity of server hardware, it is inadequate for encoders due to the heterogeneity of edge devices. Ven- dors have varying support for the basic building blocks of a DNN, and particular operations may be prohibitively expensive for the client. Consequently, regardless of the decoder architecture, we account for the heterogeneity with a universal encoder composed of three downsampling residual blocks of two stacked 3×3 convolutions, totaling around 140k parameters. Since the mutual information between the original input and shallow layers is still high, it should be possible to add a decoder that maps the representation of the encoder to one suitable for different architectures based on invariance towards invertible transformations of mutual information. Specifically, for invertible functions φ, ψ, it holds that: I(X; Y ) = I(φ(X); ψ(Y )) (12) Specifically, we introduce decoder blueprints for directly re- lated architectures. Blueprints use the same components as target backbones, with some further considerations we describe in the following. 5.3.4 Resource-Asymmetry Aware Network Design The number of parameters for conventional autoencoders is typically comparable between the encoder and decoder. Increasing the decoder parameters does not change the inability to recover lost signals (Section 4.1), i.e., it does not offset the limited encoder capacity for accurately dis- tinguishing between valuable and redundant information. Nevertheless, when optimizing the entire compression pipeline simultaneously, the training algorithm should con- sider the decoder's restoration ability, which in turn should help the encoder parameters converge towards finding a minimal sufficient statistic respective to the task. Hence, Inspired by [51], we partially treat decoding as an image restoration problem and add restoration blocks with optional upsampling (e.g., deconvolutions or PixelShuffle [52]) be- tween backbone-specific transformation blocks. In other words, our decoder is a restoration model we jointly train with the encoder, such that the optimization process is informed on how faint the bottleneck's output signal can be to remain recoverable. The decoder size can be as large as the pruned layers, i.e., our method does not reduce computational time on the server. To summarize, our net- work architecture is a general design heuristic, i.e., the individual components are interchangeable with the current state-of-the-art building blocks for vision models. Figure 11 illustrates one of the reference implementations we will use for our evaluation in Section 6. The number in parenthe- ses represents stage depth. We include implementations of other reference blueprints in the accompanying repository with descriptive configurations. Multiple downstream tasks are supported by attaching different predictors on the pre- trained backbones from foundational models. 6 EVALUATION 6.1 Training & Implementation Details One potential solution is to use identical components for the compression model from a target network. While this approach may be inconsequential for decoders, given We optimize our compression models initially on the 1.28 million ImageNet [38] training samples for 15 epochs, as described in section 5.1 and section 5.2, with some slight CNNsVision TransformersVision ModelsArchtypeArchitecturalFamilyDirectlyRelatedResNetsHierarchical VisionTransformersResNet50/101/152Swin-T/S/B/LConvNeXtConvNeXtsConvNeXt-S/B/L 10 Namely, (i) ResNet [59] for classic residual CNNs. (ii) Swin Transformer [50] for hierarchical vision transformers, which are receiving increasing adaptation for a wide variety of vi- sion tasks. (iii) ConvNeXt [60] for modernized state-of-the- art CNNs. Table 2 summarizes the relevant characteristics of the unmodified backbones subject to our experiments. TABLE 2: Overview of Backbone Performance on Server Backbone Ratios Params Inference (ms) Top-1 Acc. (%) Swin-T Swin-S Swin-B ConvNeXt-T ConvNeXt-S ConvNeXt-B ResNet-50 ResNet-101 ResNet-152 2:2:6:2 2:2:18:2 2:2:30:2 3:3:9:3 3:3:27:3 3:3:27:3 3:4:6:3 3:4:23:3 3:8:36:3 28.33M 49.74M 71.13M 28.59M 50.22M 88.59M 25.56M 44.55M 60.19M 4.77 8.95 13.14 5.12 5.65 6.09 5.17 10.17 15.18 81.93 83.46 83.88 82.70 83.71 84.43 80.10 81.91 82.54 6.2.1 Baselines Since our work aligns closest to learned image compression, we extensively compare FrankenSplit with learned and handcrafted codecs applied to the input images, i.e., the input to the backbone is the distorted output. Comparing task-specific methods to general-purpose image compres- sion methods may seem unfair. However, FrankenSplit's universal encoder has up to 260x less trainable parameters and further reduces overhead by not including side infor- mation or a sequential context model. The naming convention for the learned baselines is the first author's name, followed by the entropy model. Specif- ically, we choose the work by Balle et al. [15], [16] and Minnen et al. [17] for LIC methods since they represent foundational milestones. Complementary, we include the work by Cheng et al. [61] to demonstrate improvements with architectural enhancement. As the representative for disregarding autoencoder size to achieve state-of-the-art r-d performance in LIC, we chose the work by Chen et al. [62] Their method differs from other LIC baselines by using a partially parallelizable context model, which trades off compression rate with execution time according to the configurable block size. However, due to the large autoencoder, we found evaluating the inference time on constrained devices impractical when the context model is purely sequential and set the block size to 64x64. Additionally, we include the work by Lu et al. [63] as a milestone of the recent effort on efficient LIC with reduced autoencoders but only for latency-related experiments since we do not have access to the trained weights. As a baseline for the state-of-the-art SC, we include the Entropic Student (ES) [20], [21]. Crucially, the ES demon- strates the performance of directly applying a minimally adjusted LIC method for feature compression without con- sidering the intrinsic properties of the problem domain we have derived in Section 4.1. One caveat is that we intend to show how FrankenSplit generalizes beyond CNN backbones, despite the encoder's simplistic CNN architec- ture. Although Matsubara et al. evaluate the ES on a wide Fig. 11: Reference Implementation with Swin backbones practical modifications for stable training. We use Adam optimization [53] with a batch size of 16 and start with an initial learning rate of 1 * 10−3, then gradually lower it to 1 × 10−6 with an exponential scheduler. We aim to minimize bitrate without sacrificing predictive strength. Hence, we first seek the lowest β resulting in lossless prediction. To implement our method, we use PyTorch [54], Com- pressAI [55] for entropy estimation and entropy coding, and pre-trained backbones from PyTorch Image Models [56]. All baseline implementations and weights were either taken from CompressAI or the official repository of a baseline. To compute the saliency maps, we use a modified XGradCAM method from the library in [57] and include necessary patches in our repository. Lastly, to ensure reproducibility, we use torchdistill [58]. 6.2 Experiment Setting The experiments reflect the deployment strategies illus- trated in Figure 5 and Figure 4. Ultimately, we must eval- uate whether FrankenSplit enables latency-sensitive and performance-critical applications. Regardless of the particu- lar task, a mobile edge client requires access to a DNN with high predictive strength on a server. Therefore, we must show whether FrankenSplit adequately solves two problems associated with offloading high-dimensional image data for real-time inference tasks. First, whether it considerably reduces the bandwidth consumption compared to existing methods without sacrificing predictive strength. Second, whether it improves inference times over various communi- cation channels, i.e., it must remain competitive even when stronger connections are available. Lastly, FrankenSplit should still be applicable as newer DNN architectures emerge, i.e., the evaluation should assess whether our method generalizes to arbitrary backbones. However, since it is infeasible to perform exhaustive experi- ments on all existing visual models, we focus on three well- known representatives and a subset of their variants instead. Task FCPredictionTask FCPredictionSwin Stage (2)Swin Stage (6)PredictorsEncoder BlockEncoder BlockEncoder BlockEncoderAutoencoderDecoderPre-trained BackbonesRestoration BlockSwin Stage (3)Restoration BlockSwin Stage (1)Swin Stage (18)Swin Stage (2)Swin Stage (2)Swin Stage (6)Swin Stage (30)Swin Stage (2)Task FCPredictionSwin Stage (6)Swin Stage (2)Split Swin-TSplit Swin-SSplit Swin-BEncoder BlockConv 3x3ReLUConv 3x3ReLUPS/ConvTL ReLURestoration Block range of backbones, most have no lossless configurations. However, comparing bottleneck injection methods using different backbones is fair, as we found that the choice does not significantly impact the rate-ddistortion performance. Therefore, for an intuitive comparison, we choose ES with ResNet-50 using the same factorized prior entropy model as FrankenSplit. We separate the experiments into two categories to as- sess whether our proposed method addresses the above- mentioned problems. 6.2.2 Criteria rate-distortion performance We primarily measure the bitrate in bits per pixel (bpp) which is sensible because it permits directly comparing models with different input sizes. Choosing a distortion measure to draw meaningful and honest comparisons is challenging for feature compression. Unlike evaluating re- construction fidelity for image compression, PSNR or MS- SSIM does not provide intuitive results regarding predictive strength. Similarly, adhering to the customs of SC by report- ing absolute values, such as top-1 accuracy, gives an unfair advantage to experiments conducted on higher capacity backbones and veils the efficacy of a proposed method. Consequently, we evaluate the distortion with the relative measure predictive loss. To ensure a fair comparison, we give the LIC and handcrafted baselines a grace threshold of 1.0% top-1 accuracy, considering it is possible to mitigate some predictive loss incurred by codec artifacts [64]. For example, if a model has a predictive loss of 1.5% top-1 accuracy, we report it as 0.5% below our definition of lossless prediction. However, for FrankenSplit, we set the grace threshold at 0.4%, reflecting the configuration with the lowest predictive loss of the ES. Note that the ES improves rate-distortion per- formance by finetuning the backbone weights by applying a secondary training stage. In contrast, we put our work at a disadvantage by training FrankenSplit exclusively with the methods introduced in this work. 6.2.3 Measuring latency and overhead The second category concerns with execution times of pre- diction pipelines with various wireless connections. To ac- count for the resource asymmetry in MEC, we use NVIDIA Jetson boards2 the capable but resource- constrained mobile client, and the server hosts a powerful GPU. Table 3 summarizes the hardware we use in our experiments. to represent TABLE 3: Clients and Server Hardware Configuration Device Server Client (TX2) Client (NX) Arch x86 arm64x8 arm64x8 CPU 16x Ryzen @ 3.4 GHz 4x Cortex @ 2 GHz 4x Cortex @ 2 GHz GPU RTX 3090 Vol. 48 TC Pas. 256 CC 6.3 Rate-Distortion Performance We measure the predictive loss by the drop in top-1 accuracy from Table 2 using the ImageNet validation set for the stan- dard classification task with 1000 categories. Analogously, 2. nvidia.com/en-gb/autonomous-machines/embedded-systems/ 11 we measure filesizes of the entropy-coded binaries to calcu- late the average bpp. Figure 12 shows rate-distortion curves with the Swin-B backbone. The architecture of FrankenSplit- FP (FS-FP) and FrankenSplit-SGFP (FS-SGFP) are identical. We train both models with the loss functions derived in Sec- tion 5.1. The difference is that FS-SGFP is saliency guided, i.e., FS-FP represents the suboptimal HD training method and is an ablation to our proposed solution. 6.3.1 Effect of Saliency Guidance Although FS-FP performs better than almost all other mod- els, it is trained with the suboptimal objective discussed in Section 4.3. Empirically, this is demonstrated by FS-SGFP outperforming FS-FP on the r-d curve. By simply guiding the distortion loss with saliency maps, we achieve a 25% lower bitrate at no additional cots. Fig. 12: Rate-distortion curve for ImageNet 6.3.2 Comparison to the ES Even without saliency guidance, FS-FP consistently outper- forms ES by a large margin. Specifically, FS-FP and FS- SGFP achieve 32% and 63% lower bitrates for the lossless configuration. We ensured that our bottleneck injection incurs compa- rable overhead for a direct comparison to the ES. Moreover, the ES has an advantage due to fine-tuning tail parameters in an auxiliary training stage. Therefore, we attribute the performance gain to the more sophisticated architectural design decisions described in Section 5.3. 6.3.3 Comparison to Image Codecs For almost all lossy codec baselines, Figure 12 illustrates that FS-(SG)FP has a significantly better r-d performance. Comparing FS-FP to Ball ́e-FP demonstrates the r-d gain of task-specific compression over general-purpose image compression. Although the encoder of FrankenSplit has 25x fewer parameters, both codecs use an FP entropy model with encoders consisting of convolutional layers. Yet, the average file size of FS-FP with a predictive loss of around 5% is 7x less than the average file size of Ball ́e-FP with comparable predictive loss. FrankenSplit also beats modern general-purpose LIC without including any of their complex or heavy-weight mechanisms. The only baseline, FrankenSplit does not convincingly outperform is Chen-BJHAP. Nevertheless, in- curred overhead is as vital for real-time inference, which we will evaluate Section 6.4. 6.3.4 Generalization to arbitrary backbones In the previous, we intentionally demonstrated the rate- distortion performance of FrankenSplit with a Swin back- bone since it backs up our claim from Section 5.3 that the synthesis transform can map the CNN encoder output to the input of a hierarchical vision transformer. Nevertheless, we found that the choice of backbone has a negligible impact on the rate-distortion performance. Additionally, due to the relative distortion measure, different backbones will not lead to significantly different rate-distortion curves for the baseline codecs, i.e., when we measure by predictive loss, we get nearly identical results. Arguably, allowing operators to reason in predictive loss is more valuable than by-model absolute values, as it permits measuring whether and how much performance drop clients can expect decoupled from the backbones they use. The insignificance of teacher choice for rate-distortion performance is consistent with all our claims and findings. With the objective in (7), we learn the representation of a shallow layer, which generalizes well since such representa- tions can retain high mutual information with the original input. What remains is to demonstrate the necessity of our heuristic regarding inductive bias with decoder blueprints. As Section 5.3 detailed, the decoder consists of interchange- TABLE 4: Effect of Blueprints on a Backbone Blueprint-Backbone Swin-Swin ConvNeXt-Swin ResNet-Swin File Size (kB) 8.70 5.08 3.19 19.05 15.07 10.05 22.54 18.19 8.27 Predictive Loss (%) 0.00 0.40 0.77 2.49 3.00 3.35 0.82 0.99 1.34 able restoration and transformation blocks. Irrespective of the backbone, restoration blocks are residual pixel shuffles or transpose convolutions. Contrarily, the transformation block depends on the target backbone, and we argued that the r-d performance improves when the transforma- tion block induces the same bias as the target backbone. Specifically, we create a synthesis transform blueprint for each of the three architectural families (Swin, ResNet, and ConvNeXt) that results in comparable rate-distortion per- formance from Figure 12 for their intended variations. For example, for any ConvNeXt backbone variation, we train the bottleneck with the ConvNeXt synthesis blueprint. However, as summarized in Table 4, once we attempt to use the ResNet or ConvNeXt restoration blocks, the rate- distortion performance for the Swin-B is significantly worse. Most notably, the lossless configuration for Swin-Swin has 12 less than half the average file size of ConvNeXt-Swin with 2.49% predictive loss. 6.3.5 Generalization to multiple Downstream Tasks We argue that SVBI naturally generalizes to multiple down- stream tasks for two reasons. First, the head distillation method optimizes our encoder to learn high-level represen- tations, i.e., the mutual information between the bottleneck output and the original input is still high. Additionally, hierarchical vision models are primarily feature extractors. Since the bottleneck learns to approximate the representa- tion from a challenging distribution, embedding the same compression module on backbones or predictors trained for other tasks should be possible. We provide empirical evidence by finetuning a predictor prepared on ImageNet for different datasets. For FrankenSplit, we applied none or only rudimentary augmentation to evaluate how our method handles a type of noise it did not encounter during training. Hence, we include the Food-101 [65] dataset since it contains noise in high pixel intensities. Additionally, we include CIFAR- 100 [39]. Lastly, we include Flower-102 [66] datasets to contrast more challenging tasks. We freeze the entire compression model trained on the ImageNet dataset and finetune the tails separately for five epochs with no augmentation, a learning rate of 5 * 10−5 using Adam optimization. The teacher backbones achieve an 87.73%, 88.01%, and 89.00% top-1 accuracy, respec- tively. Figure 13 summarizes the rate-distortion perfor- mance for each task. Our method still demonstrates clear rate-distortion performance gains over the baselines. More importantly, notice how FS-SGFP outperforms FS-FP on the r-d curve for the Food-101 dataset, with a comparable margin to the ImageNet dataset. Contrarily, on the Flower- 102 datasets, there is noticeably less performance difference between them. Presumably, on simple datasets, the subop- timality of HD is less significant. Considering how simpler tasks require less model capacity, the diminishing efficacy of our saliency-guided training method is consistent with our claims and derivations in Section 4. The information of the shallow layer may suffice, i.e., the less necessary the activations of the deeper layers are, the better a minimal sufficient statistic respective H approximates a minimal sufficient statistic respective Y . 6.3.6 Effect of Tensor Dimensionality on R-D Performance In Section 3.3, we argued that tensor dimensionality is not a suitable measure to assess whether it is worthwhile to perform some client-side execution. To provide further evidence, we implement and train additional instances of FrankenSplit and show results in Figure 14 FS-SGFP(S) is the model with a small encoder ( 140'000 parameters) we have used for our previous results. FS-SGFP(M) and FS-SGFP(L) are medium and large models where we increased the (output) channels C = 48 to 96 and 128, respectively. Besides the number of channels, we've trained the medium and large models using the same configurations. On the left, we plot the rate-distortion curves showing that increasing encode capacity naturally results in lower bitrates without additional predictive loss. For the plot on the right, we train further models with 13 Fig. 13: Rate-distortion curve for multiple downstream tasks Since the representation of the last hidden layer and the representation of the shallow layer are so far apart in the information path, there is insufficient information to minimize D(H; ̃H). When the joint distribution PX,Y arises from a simple dataset, I(Y ; ̃Y ) has just enough information to propagate down for the compression model to come close to a sufficient statistic of Z respective Y . However, when PX,Y arises from a challenging dataset, where the information content of I(Y ; ̃Y ) is not enough to approxi- mate a sufficient statistic, it performs significantly worse. A final observation is that we should not assume feature Fig. 14: Comparing Effects on Sizes C = {48, 64, 96, 108, 120, 128} using the configuration re- sulting in lossless prediction. Notice how increasing output channels will result in higher dimensional latent tensors C × 28 × 28 but inversely correlates to compressed file size. An obvious explanation is that increasing the encoder capacity will yield more powerful transforms for better entropy coding and uniform quantization. 6.3.7 The Limitations of Direct Optimization for SVBI In Section 5.1, we mentioned that direct optimization does not work for SVBI as it does for DVBI, where the bottle- neck is at the penultimate layer. Specifically, it performs incomparably worse than HD despite the latter's inherent suboptimality. Contrasting the rate-distortion performance on the simple CIFAR-10 [39] dataset summarized in the left with the rate-distortion performance on the ImageNet dataset on the right in Figure 15 provides empirical evi- dence. Other than training direct optimization methods for more epochs to account for slower convergence, all models are identical and optimized with the setup described in Section 6.1. On the simple task, SVBI-CE and SVBI-KD yield moderate performance gain over JPEG. Since sufficiency is a necessary precondition for a minimal sufficient statistic which may explain why the objective in (5) does not yield good results when the bottleneck is at a shallow layer, as the mutual information I(Y ; ̃Y ) is not adequately high. This becomes especially evident when the same method entirely falters on the more challenging ImageNet dataset. Despite skewing the rate-distortion objective heavily towards high bitrates, it does not result in ̃H to be a sufficient statistic of H. Fig. 15: Contrasting the r-d performance compression methods demonstrating excellent results on simple tasks will naturally generalize, especially when not supplemented with relative evaluation metrics. 6.4 Prediction Latency and Overhead We exclude entropy coding from our measurement, since not all baselines use the same entropy coder. For brevity, the results implicitly assume the Swin-B backbone for the remainder of this section. Inference times with other backbones for FrankenSplit can be derived from Table 5. Analogously, the inference times of applying LIC models for different unmodified backbones can be derived using Table 2. Notably, the relative overhead decreases the larger the tail is, which is favorable since we target inference from more accurate predictors. 6.4.1 Computational Overhead We first disregard network conditions to get an overview of the computational overhead of applying compression mod- els. Table 6 summarizes the execution times of the prediction 0.00.10.20.30.40.50.60.7bits per pixel (bpp)0246810Pred. Loss [%]CIFAR-100WebPJPEGBallé-FPBallé-SHPChen-BJHAPCheng-JHAPFrankenSplit-FPFrankenSplit-SGFPMinnen-JHAPMinnen-MSHP0.00.51.01.52.0bits per pixel (bpp)0510152025Pred. Loss [%]Flower-1020.00.51.01.52.0bits per pixel (bpp)0510152025303540Pred. Loss [%]Food-1010.40.60.81.0bit per pixel (bpp)0.00.51.01.5Predictive Loss [%]Effect of Model Size on R-DFG-SGFP (L)FG-SGFP (M)FG-SGFP (S)6.06.57.0File Size (kB)400005000060000700008000090000100000Enc. Latent DimensionLatent Dimensionality0.20.30.40.50.60.70246Predictive Loss [%]bit per pixel (bpp)CIFAR-10WebPJPEGSVBI-CESVBI-KD1234 024681012ImageNetWebPJPEGSVBI-CESVBI-KD TABLE 5: Execution Times of FS (S) with Various Backbones TABLE 7: Total Latency with Various Wireless Standards 14 Backbone Swin-T Swin-S Swin-B ConvNeXt-T ConvNeXt-S ConvNeXt-B ResNet-50 ResNet-101 ResNet-152 Overhead Prams (%) 2.51 1.41 1.00 3.46 1.97 0.90 3.50 2.01 1.48 Inf. Server+NX (m/s) 7.83 11.99 16.12 6.83 8.50 9.70 13.16 8.13 18.86 Inf. Server+TX2 (m/s) 9.75 13.91 18.04 8.75 10.41 11.62 10.05 15.08 20.78 pipeline's components. Enc. NX/TX2 refers to the encoding TABLE 6: Inference Pipeline Components Execution Times Model FrankenSplit Ball ́e-FP Ball ́e-SHP Minnen-MSHP Minnen-JHAP Cheng-JHAP Lu-JHAP Chen-BJHAP Prams Enc./Dec. 0.14M/ 2.06M 3.51M/ 3.51M 8.30M/ 5.90M 14.04M/ 11.65M 21.99M/ 19.59M 16.35M/ 22.27M 5.28M/ 4.37M 36.73M/ 28.08M Enc. [NX/TX2] (ms) 2.92/ 4.87 27.27/ 48.93 28.16/ 50.89 29.51/ 52.39 4128.17/ 4789.89 2167.34/ 4153.95 2090.88/ 5011.56 3111.01/ 5837.38 Dec. (ms) 2.00 1.30 1.51 1.52 275.18 277.26 352.85 43.16 Full [NX/TX2] (ms) 16.34/ 18.29 41.71/ 63.37 42.81/ 65.54 44.17/ 67.05 4416.7/ 5078.2 2457.7/ 4444.3 2456.8/ 5377.8 3167.3/ 5893.6 time on the respective client device. Analogously, dec. refers to the decoding time at the server. Lastly, Full NX/TX2 is the total execution time of encoding at the respective client plus decoding and the prediction task at the server. Lu-JHAP demonstrates how LIC models without a sequential context component are noticeably faster but are still 9.3x-9.6x slower than FrankenSplit despite a considerably worse r-d perfor- mance. Comparing Ball ́e-FP to Minnen-MSHP reveals that including side information only incurs minimal overhead, even on the constrained client. On the server, FrankenSplit's is slightly slower than some baselines due to the attention mechanism of the decoder blueprint for the swin backbone. However, unlike all other baselines, the computational load of FrankenSplit is near evenly distributed between the client and the server, i.e., FrankenSplit's design heuristic successfully considers resource asymmetry. The significance of considering resource asymmetry is emphasized by how the partially parallelized context model of Chen-BHJAP leads to faster decoding on the server. Nevertheless, it is slower than other JHAP baselines due to the overhead of the increased encoder size outweighing the performance gain of the blocked context model on constrained hardware. 6.4.2 Competing against Offloading Unlike SC methods, we do not reduce the latency on the server, i.e., performance gains of FrankenSplit solely stem from reduced transfer times. The average compressed file- size gives the transfer size from the ImageNet validation set. Using the transfer size, we evaluate transfer time on a broad range of standards. Since we did not include the execution time of entropy coding for learned methods, the encoding and decoding time for the handcrafted codecs is set to 0. The Standard/ Data Rate (Mbps) codec Transfer (ms) Total [TX2] (ms) Total [NX] (ms) BLE/ 0.27 4G/ 12.0 Wi-Fi/ 54.0 5G/ 66.9 FS-SGFP (0.23) FS-SGFP (LL) Minnen-MSHP Chen-BJHAP WebP PNG FS-SGFP (0.23) FS-SGFP (LL) Minnen-MSHP Chen-BJHAP WebP PNG FS-SGFP (0.23) FS-SGFP (LL) Minnen-MSHP Chen-BJHAP WebP PNG FS-SGFP (0.23) FS-SGFP (LL) Minnen-MSHP Chen-BJHAP WebP PNG 142.59 209.89 348.85 40.0 865.92 2532.58 3.21 4.72 7.85 0.9 19.48 56.98 0.71 1.05 1.74 0.2 4.33 12.66 0.58 0.85 1.41 0.16 3.49 10.22 160.48 227.78 415.89 6167.79 879.06 2545.72 21.09 22.61 74.89 6128.69 32.63 70.13 18.6 18.93 68.78 6127.99 17.47 25.81 18.46 18.73 68.44 6127.95 16.64 23.36 158.53 225.83 393.01 3441.41 879.06 2545.72 19.15 20.66 52.01 3402.31 32.63 70.13 16.65 16.99 45.9 3401.61 17.47 25.81 16.51 16.78 45.56 3401.57 16.64 23.36 setting favors the baselines because both rely on entropy coding and sequential CPU-bound transforms. Table 7 sum- marizes how our method performs in various standards. Due to space constraints, we only include LIC models with the lowest request latency (Minnen-MSHP) or the lowest compression rate (Chen-BJAHP). Still, with Table 6 and the rate-distortion results from the previous subsection, we can infer that the LIC baselines have considerably higher latency than FrankenSplit. Generally, the more constrained the network is the more we can benefit from reducing the transfer size. In particu- lar, FrankenSplit is up to 16x faster in highly constrained networks, such as BLE. Conversely, offloading with fast handcrafted codecs may be preferable in high-bandwidth environments. Yet, FrankenSplit is significantly better than offloading with PNG, even for 5G. Figure 16 plots the inference latencies against handcrafted codecs using the NX client. For stronger connections, such as 4G LTE, it is Fig. 16: Comparing Effects on Sizes 10203040506070Data rate (Mbps)255075Total Latency (ms)FS-SGFP (LL) vs. PNG10203040506070Data rate (Mbps)255075Total Latency (ms)FS-SGFP (-0.40) vs. PNG10203040506070Data rate (Mbps)2030Total Latency (ms)FS-SGFP (LL) vs. WebP10203040506070Data rate (Mbps)2030Total Latency (ms)FS-SGFP (-0.40) vs. WebPFrankenSplit (FS)Offloading with Codec still 3.3x faster than using PNG. Nevertheless, compared to WebP, offloading seems more favorable when bandwidth is high. Still, this assumes that the rates do not fluctuate and that the network can seamlessly scale for an arbitrary number of client connections. Moreover, kept the encoder as simple and minimal as possible without applying any further architectural optimizations. 7 CONCLUSION In this work, we introduced a novel lightweight compres- sion framework to facilitate critical MEC applications re- lying on large DNNs. We demonstrated that a minimal- istic implementation of our design heuristic is sufficient to outperform numerous baselines. However, our method still has several limitations. Notably, it assumes that the client has an onboard accelerator. Moreover, the simplis- tic Factorized Prior entropy model is not input adaptive, i.e., it does not adequately discriminate between varying inputs. Although adding side information with hypernet- works taken from LIC trivially improves rate-distortion per- formance, our results show that it may not be a productive approach to directly repurpose existing image compression methods. Hence, conceiving an efficient way to include task- dependent side information is a promising direction. REFERENCES [1] A. Voulodimos, N. Doulamis, A. Doulamis, E. Protopapadakis, et al., "Deep learning for computer vision: A brief review," Com- putational intelligence and neuroscience, vol. 2018, 2018. [2] D. W. Otter, J. R. Medina, and J. K. Kalita, "A survey of the usages of deep learning for natural language processing," IEEE transactions on neural networks and learning systems, vol. 32, no. 2, pp. 604–624, 2020. [3] C. Feng, P. Han, X. Zhang, B. Yang, Y. Liu, and L. Guo, "Compu- tation offloading in mobile edge computing networks: A survey," Journal of Network and Computer Applications, p. 103366, 2022. [4] T. Rausch, W. Hummer, C. Stippel, S. Vasiljevic, C. Elvezio, S. Dustdar, and K. Kr ̈osl, "Towards a platform for smart city- scale cognitive assistance applications," in 2021 IEEE Conference on Virtual Reality and 3D User Interfaces Abstracts and Workshops (VRW), pp. 330–335, 2021. [5] R. R. Arinta and E. Andi W.R., "Natural disaster application on big data and machine learning: A review," in 2019 4th International Conference on Information Technology, Information Systems and Elec- trical Engineering (ICITISEE), pp. 249–254, 2019. [6] Q. Xin, M. Alazab, V. G. D ́ıaz, C. E. Montenegro-Marin, and R. G. Crespo, "A deep learning architecture for power management in smart cities," Energy Reports, vol. 8, pp. 1568–1577, 2022. [7] U. Cisco, "Cisco annual internet report (2018–2023) white paper," Cisco: San Jose, CA, USA, vol. 10, no. 1, pp. 1–35, 2020. [8] F. Romero, Q. Li, N. J. Yadwadkar, and C. Kozyrakis, "INFaaS: Automated model-less inference serving," in 2021 USENIX An- nual Technical Conference (USENIX ATC 21), pp. 397–411, USENIX Association, July 2021. [9] Y. Matsubara, M. Levorato, and F. Restuccia, "Split computing and early exiting for deep learning applications: Survey and research challenges," ACM Computing Surveys, vol. 55, no. 5, pp. 1–30, 2022. [10] N. Tishby, F. C. Pereira, and W. Bialek, "The information bottleneck method," 2000. [11] Y. Yang, S. Mandt, and L. Theis, "An introduction to neural data compression," 2022. [12] G. LLC, "An image format for the web." [13] V. Goyal, "Theoretical foundations of transform coding," IEEE Signal Processing Magazine, vol. 18, no. 5, pp. 9–21, 2001. [14] J. Ball ́e, P. A. Chou, D. Minnen, S. Singh, N. Johnston, E. Agusts- son, S. J. Hwang, and G. Toderici, "Nonlinear transform coding," CoRR, vol. abs/2007.03034, 2020. 15 [15] J. Ball ́e, V. Laparra, and E. P. Simoncelli, "End-to-end optimized image compression," in 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Con- ference Track Proceedings, OpenReview.net, 2017. [16] J. Ball ́e, D. Minnen, S. Singh, S. J. Hwang, and N. Johnston, "Variational image compression with a scale hyperprior," 2018. [17] D. Minnen, J. Ball ́e, and G. Toderici, "Joint autoregressive and hierarchical priors for learned image compression," 2018. [18] S. Singh, S. Abu-El-Haija, N. Johnston, J. Ball ́e, A. Shrivastava, and G. Toderici, "End-to-end learning of compressible features," CoRR, vol. abs/2007.11797, 2020. [19] Y. Dubois, B. Bloem-Reddy, K. Ullrich, and C. J. Maddison, "Lossy compression for lossless prediction," Advances in Neural Informa- tion Processing Systems, vol. 34, pp. 14014–14028, 2021. [20] Y. Matsubara, R. Yang, M. Levorato, and S. Mandt, "Sc2: Super- vised compression for split computing," 2022. [21] Y. Matsubara, R. Yang, M. Levorato, and S. Mandt, "Supervised compression for resource-constrained edge computing systems," in Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pp. 2685–2695, 2022. [22] Y. Kang, J. Hauswald, C. Gao, A. Rovinski, T. Mudge, J. Mars, and L. Tang, "Neurosurgeon: Collaborative intelligence between the cloud and mobile edge," ACM SIGARCH Computer Architecture News, vol. 45, no. 1, pp. 615–629, 2017. [23] H. Li, C. Hu, J. Jiang, Z. Wang, Y. Wen, and W. Zhu, "Jalad: Joint accuracy-and latency-aware deep structure decoupling for edge-cloud execution," in 2018 IEEE 24th international conference on parallel and distributed systems (ICPADS), pp. 671–678, IEEE, 2018. [24] S. Laskaridis, S. I. Venieris, M. Almeida, I. Leontiadis, and N. D. Lane, "Spinn: synergistic progressive inference of neural networks over device and cloud," in Proceedings of the 26th annual interna- tional conference on mobile computing and networking, pp. 1–15, 2020. [25] M. Almeida, S. Laskaridis, S. I. Venieris, I. Leontiadis, and N. D. Lane, "Dyno: Dynamic onloading of deep neural networks from cloud to device," ACM Transactions on Embedded Computing Sys- tems, vol. 21, no. 6, pp. 1–24, 2022. [26] H. Liu, W. Zheng, L. Li, and M. Guo, "Loadpart: Load-aware dynamic partition of deep neural networks for edge offloading," in 2022 IEEE 42nd International Conference on Distributed Computing Systems (ICDCS), pp. 481–491, 2022. [27] A. Bakhtiarnia, N. Miloˇsevi ́c, Q. Zhang, D. Bajovi ́c, and A. Iosi- fidis, "Dynamic split computing for efficient deep edge intelli- gence," in ICASSP 2023 - 2023 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 1–5, 2023. [28] A. E. Eshratifar, A. Esmaili, and M. Pedram, "Bottlenet: A deep learning architecture for intelligent mobile cloud computing ser- vices," in 2019 IEEE/ACM International Symposium on Low Power Electronics and Design (ISLPED), pp. 1–6, 2019. [29] J. Shao and J. Zhang, "Bottlenet++: An end-to-end approach for feature compression in device-edge co-inference systems," in 2020 IEEE International Conference on Communications Workshops (ICC Workshops), pp. 1–6, 2020. [30] Y. Matsubara, S. Baidya, D. Callegaro, M. Levorato, and S. Singh, "Distilled split deep neural networks for edge-assisted real-time systems," in Proceedings of the 2019 Workshop on Hot Topics in Video Analytics and Intelligent Edges, HotEdgeVideo'19, (New York, NY, USA), p. 21–26, Association for Computing Machinery, 2019. [31] M. Sbai, M. R. U. Saputra, N. Trigoni, and A. Markham, "Cut, distil and encode (cde): Split cloud-edge deep inference," in 2021 18th Annual IEEE International Conference on Sensing, Communication, and Networking (SECON), pp. 1–9, 2021. [32] L. Deng, G. Li, S. Han, L. Shi, and Y. Xie, "Model compression and hardware acceleration for neural networks: A comprehensive survey," Proceedings of the IEEE, vol. 108, no. 4, pp. 485–532, 2020. [33] Z. Li, F. Liu, W. Yang, S. Peng, and J. Zhou, "A survey of convo- lutional neural networks: analysis, applications, and prospects," IEEE transactions on neural networks and learning systems, 2021. [34] K. Han, Y. Wang, H. Chen, X. Chen, J. Guo, Z. Liu, Y. Tang, A. Xiao, C. Xu, Y. Xu, et al., "A survey on vision transformer," IEEE transactions on pattern analysis and machine intelligence, vol. 45, no. 1, pp. 87–110, 2022. [35] F. Romero, Q. Li, N. J. Yadwadkar, and C. Kozyrakis, "Infaas: Automated model-less inference serving.," in USENIX Annual Technical Conference, pp. 397–411, 2021. [36] K. Zhao, Z. Zhou, X. Chen, R. Zhou, X. Zhang, S. Yu, and D. Wu, "Edgeadaptor: Online configuration adaption, model selection 16 [61] Z. Cheng, H. Sun, M. Takeuchi, and J. Katto, "Learned image compression with discretized gaussian mixture likelihoods and attention modules," 2020. [62] T. Chen, H. Liu, Z. Ma, Q. Shen, X. Cao, and Y. Wang, "End-to-end learnt image compression via non-local attention optimization and improved context modeling," IEEE Transactions on Image Process- ing, vol. 30, pp. 3179–3191, 2021. [63] M. Lu, P. Guo, H. Shi, C. Cao, and Z. Ma, "Transformer-based image compression," in 2022 Data Compression Conference (DCC), pp. 469–469, 2022. [64] X. Luo, H. Talebi, F. Yang, M. Elad, and P. Milanfar, "The rate-distortion-accuracy tradeoff: Jpeg case study," arXiv preprint arXiv:2008.00605, 2020. [65] L. Bossard, M. Guillaumin, and L. Van Gool, "Food-101–mining discriminative components with random forests," in Computer Vision–ECCV 2014: 13th European Conference, Zurich, Switzerland, September 6-12, 2014, Proceedings, Part VI 13, pp. 446–461, Springer, 2014. [66] M.-E. Nilsback and A. Zisserman, "Automated flower classifica- tion over a large number of classes," in 2008 Sixth Indian Conference on Computer Vision, Graphics & Image Processing, pp. 722–729, 2008. and resource provisioning for edge dnn inference serving at scale," IEEE Transactions on Mobile Computing, pp. 1–16, 2022. [37] S. Ioffe and C. Szegedy, "Batch normalization: Accelerating deep network training by reducing internal covariate shift," in Interna- tional conference on machine learning, pp. 448–456, pmlr, 2015. [38] O. Russakovsky, J. Deng, H. Su, J. Krause, S. Satheesh, S. Ma, Z. Huang, A. Karpathy, A. Khosla, M. Bernstein, et al., "Imagenet large scale visual recognition challenge," International journal of computer vision, vol. 115, no. 3, pp. 211–252, 2015. [39] A. Krizhevsky, G. Hinton, et al., "Learning multiple layers of features from tiny images," 2009. [40] R. Shwartz-Ziv and N. Tishby, "Opening the black box of deep neural networks via information," arXiv preprint arXiv:1703.00810, 2017. [41] C. E. Shannon, "Coding theorems for a discrete source with a fidelity criterion," in IRE National Convention Record, 1959, vol. 4, pp. 142–163, 1959. [42] T. Berger, "Rate distortion theory for sources with abstract alpha- bets and memory," Information and Control, vol. 13, no. 3, pp. 254– 273, 1968. [43] N. Tishby and N. Zaslavsky, "Deep learning and the information bottleneck principle," in 2015 ieee information theory workshop (itw), pp. 1–5, IEEE, 2015. [44] G. Hinton, O. Vinyals, and J. Dean, "Distilling the knowledge in a neural network," 2015. [45] L. Wang and K.-J. Yoon, "Knowledge distillation and student- teacher learning for visual intelligence: A review and new out- looks," IEEE Transactions on Pattern Analysis and Machine Intelli- gence, 2021. [46] A. Romero, N. Ballas, S. E. Kahou, A. Chassang, C. Gatta, and Y. Bengio, "Fitnets: Hints for thin deep nets," arXiv preprint arXiv:1412.6550, 2014. [47] B. Zhou, A. Khosla, A. Lapedriza, A. Oliva, and A. Torralba, "Learning deep features for discriminative localization," in Pro- ceedings of the IEEE conference on computer vision and pattern recogni- tion, pp. 2921–2929, 2016. [48] R. R. Selvaraju, M. Cogswell, A. Das, R. Vedantam, D. Parikh, and D. Batra, "Grad-CAM: Visual explanations from deep networks via gradient-based localization," International Journal of Computer Vision, vol. 128, pp. 336–359, oct 2019. [49] S. Xie, R. Girshick, P. Doll ́ar, Z. Tu, and K. He, "Aggregated residual transformations for deep neural networks," in Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1492–1500, 2017. [50] Z. Liu, Y. Lin, Y. Cao, H. Hu, Y. Wei, Z. Zhang, S. Lin, and B. Guo, "Swin transformer: Hierarchical vision transformer using shifted windows," in Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 10012–10022, 2021. [51] J. Liang, J. Cao, G. Sun, K. Zhang, L. Van Gool, and R. Timofte, "Swinir: Image restoration using swin transformer," in Proceed- ings of the IEEE/CVF International Conference on Computer Vision, pp. 1833–1844, 2021. [52] W. Shi, J. Caballero, F. Husz ́ar, J. Totz, A. P. Aitken, R. Bishop, D. Rueckert, and Z. Wang, "Real-time single image and video super-resolution using an efficient sub-pixel convolutional neural network," in Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1874–1883, 2016. [53] D. P. Kingma and J. Ba, "Adam: A method for stochastic optimiza- tion," arXiv preprint arXiv:1412.6980, 2014. [54] A. D. I. Pytorch, "Pytorch," 2018. [55] J. B ́egaint, F. Racap ́e, S. Feltman, and A. Pushparaja, "Compressai: a pytorch library and evaluation platform for end-to-end compres- sion research," arXiv preprint arXiv:2011.03029, 2020. [56] R. Wightman, "Pytorch https://github.com/rwightman/pytorch-image-models, 2019. [57] J. Gildenblat and contributors, "Pytorch library for cam methods." models." image https://github.com/jacobgil/pytorch-grad-cam, 2021. [58] Y. Matsubara, "torchdistill: A Modular, Configuration-Driven Framework for Knowledge Distillation," in International Workshop on Reproducible Research in Pattern Recognition, pp. 24–44, Springer, 2021. [59] K. He, X. Zhang, S. Ren, and J. Sun, "Deep residual learning for image recognition," CoRR, vol. abs/1512.03385, 2015. [60] Z. Liu, H. Mao, C.-Y. Wu, C. Feichtenhofer, T. Darrell, and S. Xie, "A convnet for the 2020s," in Proceedings of the IEEE/CVF Confer- ence on Computer Vision and Pattern Recognition, pp. 11976–11986, 2022.
http://arxiv.org/abs/2302.10679v1
2023-02-21T13:56:47
2023-02-21T13:56:47
Evaluating the effect of data augmentation and BALD heuristics on distillation of Semantic-KITTI dataset
Active Learning (AL) has remained relatively unexplored for LiDAR perception tasks in autonomous driving datasets. In this study we evaluate Bayesian active learning methods applied to the task of dataset distillation or core subset selection (subset with near equivalent performance as full dataset). We also study the effect of application of data augmentation (DA) within Bayesian AL based dataset distillation. We perform these experiments on the full Semantic-KITTI dataset. We extend our study over our existing work only on 1/4th of the same dataset. Addition of DA and BALD have a negative impact over the labeling efficiency and thus the capacity to distill datasets. We demonstrate key issues in designing a functional AL framework and finally conclude with a review of challenges in real world active learning.
[ "Anh Duong", "Alexandre Almin", "Léo Lemarié", "B Ravi Kiran" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10679v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10679v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.CV", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.CV", "cs.LG" ]
Evaluating the effect of data augmentation and BALD heuristics on distillation of Semantic-KITTI dataset Ngoc Phuong Anh Duong, Alexandre Almin, L ́eo Lemari ́e and B Ravi Kiran 1 (cid:70) 3 2 0 2 b e F 1 2 ] V C . s c [ 1 v 9 7 6 0 1 . 2 0 3 2 : v i X r a Abstract-Active Learning (AL) has remained relatively unexplored for LiDAR perception tasks in autonomous driving datasets. In this study we evaluate Bayesian active learning methods applied to the task of dataset distillation or core subset selection (subset with near equivalent performance as full dataset). We also study the effect of application of data augmentation (DA) within Bayesian AL based dataset distillation. We perform these experiments on the full Semantic-KITTI dataset. We extend our study over our existing work (Duong. et al., 2022) only on 1/4th of the same dataset. Addition of DA and BALD have a negative impact over the labeling efficiency and thus the capacity to distill datasets. We demonstrate key issues in designing a functional AL framework and finally conclude with a review of challenges in real world active learning. Index Terms-Active Learning Semantic Segmentation Dataset distillation Data augmentation 1 INTRODUCTION Autonomous driving perception datasets in the point cloud domain including Semantic-KITTI (Behley et al., 2019) and nuScenes (Caesar et al., 2020) provide a large variety of driving scenarios & lighting conditions, along with variation in the poses of on- road obstacles. Large scale datasets are created across different sensor sets, vehicles and sites. There are multiple challenges in creating a functional industrial grade autonomous driving dataset (Uric ́ar et al., 2019). During the phase of creating a dataset, these following key steps are generally followed: • Defining the operation design domain of operation of the perception models. This involves parameters (but are not limited to) such as minimum & maximum distance, speed & illumination, classes to be recognized in the scene, relative configurations of objects or classes w.r.t ego- vehicle, Fixing sensors (camera, LiDAR, RADAR, ...) suite, with their number & parameters, • • Choosing target vehicles and locations over which logs should be collected, • Collecting logs given the ODD parameters, vehicles and sites, Selecting key frames and samples to annotate, • • Creating a labeled dataset by using human experts, • Incrementally improving the dataset for a given model by using active learning strategies. • Machine Learning, Navya . E-mail: see [email protected] Preprint October 2022. These large-scale point clouds datasets have high redundancy due to temporal and spatial correlation. Redundancy makes train- ing Deep Neural Network (DNN) architectures costlier for very little gain in performance. This redundancy is mainly due to the temporal correlation between point clouds scans, the similar urban environments and the symmetries in the driving environment (driving in opposite directions at the same location). Hence, data redundancy can be seen as the similarity between any pair of point clouds resulting from geometric transformations as a consequence of ego-vehicle movement along with changes in the environment. Data augmentations (DA) are transformations on the input samples that enable DNNs to learn invariances and/or equivariances to said transformations (Anselmi et al., 2016). DA provides a natural way to model the geometric transformations to point clouds in large- scale datasets due to ego-motion of the vehicle. Active Learning (AL) is an established field that aims at inter- actively annotating unlabeled samples guided by a human expert in the loop. With existing large datasets, AL methods could be used to find a core-subset with equivalent performance w.r.t a full dataset. This involves iteratively selecting subsets of the dataset that greedily maximises model performance. As a consequence, AL helps reduce annotation costs, while preserving high accuracy. AL distills an existing dataset to a smaller subset, thus enabling faster training times in production. It uses uncertainty scores obtained from predictions of a model or an ensemble to select informative new samples to be annotated by a human oracle. Uncertainty-based sampling is a well-established component of AL frameworks today (Settles, 2009). This extended study following our paper (Duong. et al., 2022) demonstrates results on full dataset distillation on the Semantic- KITTI dataset. In the original study we evaluated the effect of data augmentation on the quality of heuristic function to select informative samples in the active learning loop. We demonstrated for a 6000 samples train subset and 2000 samples test subset of Semantic-KITTI, the increase in performance of label efficiency that data augmentation methods achieved. In the current study we have extended our previous work and performed the dataset distillation over the complete Semantic- KITTI dataset. Contributions include: 1) An evaluation of Bayesian AL methods on the complete Semantic-KITTI dataset using data augmentation as well as heuristics from BAAL libraries (Atighehchian et al., 2019)(Atighehchian et al., 2020). 2) We compare the AL study from (Duong. et al., 2022) that is performed on a smaller subset (1/4th) of same dataset with the full study, and demonstrate that the data augmentation schemes as well as BALD Bayesian heuristic have negligible gains over a random sampler. We point out the key issues underlying this poor performance. 3) A qualitative analysis of how labelling efficiency changes when increasing dataset size. 4) We also perform an ablation study comparing 2 different models: SqueezeSegV2 and SalsaNext within an AL framework. 5) A summary of key real-world challenges in active learn- ing over large point cloud datasets. Like many previous studies on AL, we do not explicitly quantify the amount of redundancy in the datasets and purely determine the trade-off of model performance with smaller subsets w.r.t the original dataset. 1.1 Related work The reader can find details on the major approaches to AL in the following articles: uncertainty-based approaches (Gal et al., 2017), diversity-based approaches (Sener and Savarese, 2018), and a combination of the two (Kirsch et al., 2019)(Ash et al., 2020). Most of these studies were aimed at classification tasks. Adapting diversity-based frameworks usually applied to a clas- sification, such as (Sener and Savarese, 2018), (Kirsch et al., 2019), (Ash et al., 2020), to the point cloud semantic segmentation task is computationally costly. This is due to the dense output tensor from DNNs with a class probability vector per pixel, while the output for the classification task is a single class probability vector per image. Various authors in (Kendall and Gal, 2017)(Golestaneh and Kitani, 2020), Camvid (Brostow et al., 2009) and Cityscapes(Cordts et al., 2016) propose uncertainty- based methods for image and video segmentation. However, very few AL studies are conducted for point cloud semantic segmenta- tion. Authors (Wu et al., 2021) evaluate uncertainty and diversity- based approaches for point cloud semantic segmentation. This study is the closest to our current work. Authors (Birodkar et al., 2019) demonstrate the existence of redundancy in CIFAR-10 and ImageNet datasets, using agglom- erative clustering in a semantic space to find redundant groups of samples. As shown by (Chitta et al., 2019), techniques like ensemble active learning can reduce data redundancy significantly on image classification tasks. Authors (Beck et al., 2021) show that diversity-based methods are more robust compared to stan- dalone uncertainty methods against highly redundant data. Though authors suggest that with the use of DA, there is no significant ad- vantage of diversity over uncertainty sampling. Nevertheless, the uncertainty was not quantified in the original studied datasets, but were artificially added through sample duplication. This does not represent real word correlation between sample images or point clouds. Authors (Hong et al., 2020) uses DA techniques while adding the consistency loss within a semi-supervised learning setup for image classification task. 2 ACTIVE LEARNING: METHOD 2.1 Dataset, point cloud representation & DNN-Model Although there are many datasets for image semantic segmen- tation, few are dedicated to point clouds. The Semantic-KITTI dataset & benchmark by authors (Behley et al., 2019) provides more than 43000 point clouds of 22 annotated sequences, acquired 2 with a Velodyne HDL-64 LiDAR. Semantic-KITTI is by far the most extensive dataset with sequential information. All available annotated point clouds, from sequences 00 to 10, for a total of 23201 point clouds, are later randomly sampled, and used for our experiments. Among different deep learning models available, we choose SqueezeSegV2 (Wu et al., 2018) and SalsaNext(Cortinhal et al., 2020), spherical-projection-based semantic segmentation models. While SqueezeSegV2 (Wu et al., 2018) performs well with a fast inference speed compared to other architectures, thus reduces training and uncertainty computation time, SalsaNext is more dense and computationally expensive but shown to have better performance. We apply spherical projection (Wu et al., 2018) on point clouds to obtain a 2D range image as an input for the network shown in figure 1. To simulate Monte Carlo (MC) sampling for uncertainty estimation (Gal and Ghahramani, 2016), a 2D Dropout layer is added right before the last convolutional layer of SqueezeSegV2. (Wu et al., 2018) with a probability of 0.2 and turned only at test time. Rangenet++ architectures by authors (Milioto et al., 2019) use range image based spherical coordinate representations of point clouds to enable the use of 2D-convolution kernels. The relationship between range image and LiDAR coordinates is the following: (cid:18)u v 2 [1 − arctan(y, x)π−1] × w [1 − (arcsin(z × r−1) + fup) × f −1] × h = (cid:19) (cid:18) (cid:19) , 1 f = fup + fdown, is the vertical where (u, v) are image coordinates, (h, w) the height and width f ov of the desired range image, of the sensor, and r = (cid:112)x2 + y2 + z2, range measurement of each point. The input to the DNNs used in our study are images of size W × H × 4, with spatial dimensions W, H determined by the FoV and angular resolution, and 4 channels containing the x, y coordinates of points, r range or depth to each point, i intensity or remission value for each point. 2.2 Bayesian AL: Background supervised learning setup, given a dataset D := In a {(x1, y1), (x2, y2), . . . , (xN, yN)} ⊂ X × Y , the DNN is seen as a high dimensional function fω : X → Y with model parameters ω. A simple classifier maps each input x to outcomes y. A good classifier minimizes the empirical risk l : Y × Y → R, which is defined with the expectation Remp( f ) := PX,Y [Y (cid:54)= f (X)]. The optimal classifier is one that minimizes the above risk. Thus, the classifier's loss does not explicitly refer to sample-wise uncertainty but rather to obtain a function which makes good predictions on average. We shall use the following terminologies to describe our AL training setup. 1) 2) Labeled dataset D = {(xi, yi)}N i=1 where xi ∈ W × H × 4 are range images with 4 input channels, W, H are spatial dimensions, and yi ∈ W × H × C are one-hot encoded ground truth with C classes. The output of the DNN model is distinguished from the ground truth as ˆyi with the same dimensions. The 4 channels in our case are x, y, z coordinates and LiDAR intensity channel values. Labeled pool L ⊂ D and an unlabeled pool U ⊂ D con- sidered as a data with/without any ground-truth, where at any AL-step L ∪ U = D, the subsets are disjoint and restore the full dataset. 3 Fig. 1: Global flow of active learning on range images from point clouds using uncertainty methods. 3) Query size B, also called a budget, to fix the number of 3 EXPERIMENTAL SETUP unlabeled samples selected for labeling 5) 4) Acquisition function, known as heuristic, providing a score for each pixel given the output ˆyi of the DNN model, f : RW ×H×C → RW ×H Including the usage of MC iterations where the output of the DNN model could provide several outputs given the same model and input, ˆyi ∈ W ×H ×C ×T where T refers to the number of MC iterations. Subset model fL is the model trained on labeled subset L 6) 7) Aggregation function a : RW ×H×C×T → R+ is a function that aggregates heuristic scores across all pixels in the input image into a positive scalar value, which is used to rank samples in the unlabeled pool. Heuristic functions are transformations over the model output probabilities p(y|x) that define uncertainty-based metrics to rank and select informative examples from the unlabeled pool at each AL-step. In our previous study (Duong. et al., 2022) we have identified BALD to be a robust heuristic function (Houlsby et al., 2011). It selects samples maximizing information gain between the predictions from model parameters, using MC Iterations. In this study we have evaluated the performance of AL based sampling of a large scale LiDAR dataset Semantic-KITTI. As in (Duong. et al., 2022) we follow a Bayesian AL loop using MC Dropout. The heuristic computes uncertainty scores for each pixel. To obtain the final score per range image, we use sum as an aggregation function to combine all pixel-wise scores of an image into a single score. At each AL step, the unlabeled pool is ranked w.r.t the aggregated score. A new query of samples limited to the budget size is selected from the ranked unlabeled pool. The total number of AL steps is indirectly defined by budget size, nAL = |D| /B In this study we evaluated BALD (Houlsby et al., 2011) heuristic, while applying it with and without DA applied during training time. As mentioned in Table 1, we only use 16000 randomly chosen samples from Semantic-KITTI over the 23201 samples available. At each training step, we reset model weights to avoid biases in the predictions, as proven by (Beck et al., 2021). We evaluate LE mIoU as our metric on the test set of 6960 samples. For quicker training, we use early stopping based on the stability of training mIoU over patience ∗ evaluation period iterations. 2.3 Data augmentations on range images 3.1 Analysis of results We apply DA directly on the range image projection. We apply the same transformations as in our previous study (Duong. et al., 2022), we repeat images of the data augmentation here to visually demonstrate them, in figure 2. 2.4 AL Evaluation metrics To evaluate the performance of our experiments we are using the following metrics: The figure 3, demonstrates all the trainings performed on the full Semantic-KITTI dataset. The models SalsaNext (SN) and SqueezeSegV2 (SSV2) were chosen to be evaluated. Both models use rangenet based representations as mentioned earlier. The SSV2 model was trained with and without data augmentation, using a baseline random sampler, the model was also evaluated with BALD heuristic function. SN model was mainly evaluated in the AL framework using data augmentation and with BALD. The goals here have been to compare the effect of: • The Mean Intersection over Union (mIoU) (Song et al., • Data augmentation on the label efficiency over a large • C ∑C c=1 IoUc 2016): 1 Labeling efficiency: Authors (Beck et al., 2021) use the labeling efficiency (LE) to compare the amount of data needed among different sampling techniques with respect to a baseline. In our experiments, instead of accuracy, we use mIoU as the performance metric. Given a specific value of mIoU, the labeling efficiency is the ratio between the number of labeled range images, acquired by the baseline sampling and the other sampling techniques. LE = nlabeled others(mIoU = a) nlabeled baseline(mIoU = a) (1) dataset. • Difference in model capacity (SN with 6.7M parameters vs SSV2 with 1M parameters) . • Difference in performance of random sampler vs the BALD heuristic. 3.2 Class based learning efficiency In this section we study the variation of ClassIoU for all classes in the Semantic-KITTI dataset. Along with this we also study the variation from mIoU of the fully supervised (FS) model, expressed by: The baseline method is usually the random heuristic. ∆cIOU[i] = cIoU[i] − mIoUFS (2) 4 (a) Random dropout mask (b) CoarseDropout of Albumentations library (c) Gaussian noise applied on depth channel (d) Gaussian noise applied on remission channel (e) Random cyclic shift range image Fig. 2: Before and after applying transformations on Semantic-KITTI. Each image corresponds to a sample such that inner images, from top to bottom, are before and after applying transformations, and the error between them. a, b, c, d are directly used or customized based on Albumentations library (Buslaev et al., 2020) (f) Instance Cut Paste Data related parameters Range image resolution 1024x64 Range image resolution 1024x64 Total pool size 6000 Total pool size 16241 Test pool size 2000 Test pool size 6960 Init set size 240 Init set size 1041 Hyper parameters for each AL step Budget 240 Budget 800 AL Hyper parameters MC Dropout 0.2 MC Dropout 0.2 AL steps 25 AL steps 20 Aggregation sum Aggregation sum Max train iterations Learning rate (LR) LR decay Weight decay Batch size 100000 0.01 0.99 0.0001 16 Evaluation period 500 Early stopping Metric train mIoU Patience 15 TABLE 1: Active learning (AL) parameter setup (first line for (Duong. et al., 2022) result). where i is the index of the active learning loop (or the perception of dataset). This score basically subtracts the mean performance away from the class IoU scores to demonstrate deviations from the mean. The objective of such a measure is to demonstrate the rate at which each class IoU reaches its maximum contribution. The ∆cIOU[i] score represents the deviation of the class IoU from the model's full supervised mean performance. When this deviation is positive and large, these represent classes that have been learnt efficiently at the AL-Step i, while negative scores represent classes that have been learnt poorly. This score enables us to determine visually when each class reaches its maximum performance and decide when any incremental addition of samples would have little impact on the final cIoU. Class-frequency and ClassIoU: In figure 5 we observe that several majority classes like ROAD, TERRAIN, BUILDING and VEGETATION do not demonstrate any large change in their IoUs after the 6th AL step, while classes such as BICYCLE, POLE, PERSON and OTHER VEHICLE are the slowest to learn their maximum performance. The majority classes produce a positive deviation from mIoU while the least frequent classes produce a negative deviation from mIoU. DA effect on ClassIoU: In figure 6 we plot the ∆cIoU[i] scores to demonstrate how fast different classes are learnt over the AL loop (different subset sizes of the full dataset). With this plot we would like to observe the change in sample complexity for each class with and without data augmentations using baseline random sampling. Model complexity on ClassIoU: We evaluate two models on the Semantic-KITTI dataset: SSV2 model vs SalsaNext model. We compare the performances of these models in terms of how fast they learn different classes, see figure 7. We observe that majority of classes have had a large jump within the first 3-4 AL steps points, leading wrong prediction and impractical sam- pling selection. 5 3.4 t-SNE problem analysis t-SNE (van der Maaten and Hinton, 2008) is a technique used to visualize high-dimensional data in low-dimensional spaces such as 2D or 3D by minimizing Kullback-Leibler divergence between the low-dimensional distribution and the high-dimensional distri- bution. To visualize whether DA is relevant for Semantic-KITTI, we use t-SNE to reduce score images of labeled and DA (labeled) at AL step 0 of Semantic-KITTI/4's to 2D vector and plot on 2D axes (fig 9). The samples located in regions with dense red color are out-of-training-set-distribution candidates at AL step 0. Visualization of the candidates is in fig 10. In the figure 11, deep red spots show that there are a lot of selected high-score samples concentrated in the same location. 4 CONCLUSION Core subset extraction/dataset distillation experiments were car- ried out on Semantic-KITTI dataset using SalsaNext and SSV2 models. The results of data augmentation and BALD heuristic were limited and did not perform any better than a random sampling method, the first baseline in active learning methods. These limited improvements are an important observation for ac- tive learning benchmarks, even though they constitute in marginal gains, and aids further studies to focus on other ways to improve labeling efficiency. Active learning strategies struggle with large- scale datasets such as point clouds in the real-world scenario. 1) Data augmentation's have a strong effect on the quality of the heuristic function. It is thus key to evaluate data aug- mentation schemes that are dataset dependant, especially when unlabeled pool is just a small subset of target do- main. Inappropriate or overwhelming augmentation can cause out-of-distribution, reducing model bias to target domain. (Fawzi et al., 2016) propose an adaptive data augmentation algorithm for image classification, which looks for a small transform maximizing the loss on that transformed sample. 2) The final aggregation score in an active learning frame- work is a crucial choice. Aggregation is required when working on detection or segmentation tasks, while most AL study has been focused on classification. Here are a few choices of aggregation functions and how they affect the final ranking of images from which to sample: • Sum of all scores: select a sample having a balance of high score and high number of elements. • Average of all scores: select a sample having a high score comparable to the others regardless of the number of elements within a sample. • Max of all scores: select a sample having the highest element scores of all samples, targeting noises. • Weighted average of all scores: similar to aver- age but focus on the given weights. The class weights can be inverse-frequency class weights or customized based on the use case to prioritize the selection for certain classes. Fig. 3: Mean IoU vs dataset size (in percentage) using random and BALD heuristic based samplers under the effect of data augmentation. Fig. 4: SalsaNext & SSV2 models evaluated w.r.t the Random sampling baseline. The plots demonstrate the label efficiency. for the SalsaNext model, demonstrating how model capacity plays an important role in the sample complexity of learning certain classes. 3.3 Dataset size growth: 1/4 Semantic-KITTI vs full Semantic- KITTI In our previous study on Semantic-KITTI (Duong. et al., 2022) we have evaluated the performance of AL methods while applying data augmentation on 1/4th subset of the Semantic-KITTI dataset. As expected, DA sampled harder samples by eliminating similar samples learnt by invariance. That is to say, models trained with DA are prone to select samples different from the trained samples and their transformations, thus reducing redundancy in the selection. On the other hand, although DA significantly reduce redun- dancy in 1/4 Semantic-KITTI experiments, there is almost no increment in the gain by DA in full Semantic-KITTI experiments. This can be seen in figure 8 and could be mainly attributed to the following reasons (we hypothesize): 1) Larger dataset includes larger amount of near similar or redundant samples, but all standalone uncertainty-based methods still encounter the problem of high-score similar samples. Semantic-KITTI is a sequential dataset and thus contain similar scans due to temporal correlation. Thus random sampling breaks this redundancy, while methods like BALD are unable to do so due to the above said rea- sons. Potential solutions for this problem are mentioned in future work and challenges section below. 2) The gain by DA is getting smaller as dataset size in- creases because some augmented samples can be found in larger dataset (when dataset is getting larger) or test domain. From the hypothesis, uncorrelated-to-real-world DA can increase uncertainty in predictions of unnecessary sample 3) 6 Fig. 5: Top Left: Class IoU for SSV2 model Top Right: Deviation from mean IoU from equation 2. Bottom, the same for the SalsaNext model. Fig. 6: Deviation of Class IoU from mIoU for the SSV2 model: with and without data augmentation applied. It is noted that for our proposed method, sum and average eventually yield the same rankings because the number of pixels for range images are constant. 3) Another key issue in industrial datasets is the filtering or exclusion of corrupted or outlier images/point clouds from the AL loop. (Chitta et al., 2019) show that remov- ing top highest uncertain samples as outliers improves model performances. 4) To avoid selection of similar high-score samples and to reduce the sensitivity and bias of the model when training on a small dataset, a potential strategy can be an integration of diversity. Some hybrid methods, such as (Sener and Savarese, 2018) (Kirsch et al., 2019) (Ash et al., 2020) (Yuan et al., 2022), are shown to have more competitive results comparing to standalone uncertainty- based methods for datasets containing high rate of redun- dancy, but their computations are often costly for large scale point clouds datasets. Another strategy is using temporal information to sample (Aghdam et al., 2019) before or after uncertainty computation. Although it has low computation cost, it cannot ensure the dissimilarity among different samples. 5) According to authors (Chitta et al., 2019) (Pop and 6) Fulop, 2018), MC Dropout is observed to lack of diver- sity for uncertainty estimation. To address this problem, (Chitta et al., 2019) (Bengar et al., 2019) use multiple checkpoints during training epochs from different random seeds. Pool-based AL might not be a proper AL strategy in real- world scenario for large scale datasets because of unlim- ited instances streamed sequentially, but limited at any given time. Due to memory limitation, it is impossible to store or re-process all past instances. In this case, stream- based methods are more pertinent by querying annotator for each sample coming from the stream. Although this type of query is often computationally inexpensive, the selected samples are not as informative as the ones selected by pool-based AL due to the lack of exploitation underlying distribution of datasets. 7 Fig. 7: Deviation of ClassIoU from mIoU comparison: Between SSV2 and SN models. Birodkar, V., Mobahi, H., and Bengio, S. (2019). Semantic redundancies in image-classification datasets: The 10don't need. Brostow, G. J., Fauqueur, J., and Cipolla, R. (2009). Semantic ob- ject classes in video: A high-definition ground truth database. Pattern Recognit. Lett., 30:88–97. Buslaev, A., Iglovikov, V. I., Khvedchenya, E., Parinov, A., Druzhinin, M., and Kalinin, A. A. (2020). Albumentations: Fast and flexible image augmentations. Information, 11(2). Caesar, H., Bankiti, V., Lang, A. H., Vora, S., Liong, V. E., Xu, Q., Krishnan, A., Pan, Y., Baldan, G., and Beijbom, O. (2020). nuscenes: A multimodal dataset for autonomous driving. Chitta, K., Alvarez, J. M., Haussmann, E., and Farabet, C. (2019). Training data subset search with ensemble active learning. arXiv preprint arXiv:1905.12737. Cordts, M., Omran, M., Ramos, S., Rehfeld, T., Enzweiler, M., Benenson, R., Franke, U., Roth, S., and Schiele, B. (2016). The cityscapes dataset for semantic urban scene understand- ing. Cortinhal, T., Tzelepis, G., and Aksoy, E. E. (2020). Salsanext: Fast, uncertainty-aware semantic segmentation of lidar point clouds for autonomous driving. Duong., A., Almin., A., Lemari ́e., L., and Kiran., B. (2022). Lidar dataset distillation within bayesian active learning framework understanding the effect of data augmentation. In Proceed- ings of the 17th International Joint Conference on Computer Vision, Imaging and Computer Graphics Theory and Ap- plications - Volume 4: VISAPP,, pages 159–167. INSTICC, SciTePress. Fawzi, A., Samulowitz, H., Turaga, D., and Frossard, P. (2016). Adaptive data augmentation for image classification. In 2016 IEEE International Conference on Image Processing (ICIP), pages 3688–3692. Gal, Y. and Ghahramani, Z. (2016). Dropout as a bayesian approx- imation: Representing model uncertainty in deep learning. Gal, Y., Islam, R., and Ghahramani, Z. (2017). Deep bayesian active learning with image data. Golestaneh, S. A. and Kitani, K. M. (2020). Importance of self- consistency in active learning for semantic segmentation. Hong, S., Ha, H., Kim, J., and Choi, M.-K. (2020). Deep active learning with augmentation-based consistency estimation. arXiv preprint arXiv:2011.02666. Houlsby, N., Husz ́ar, F., Ghahramani, Z., and Lengyel, M. (2011). Bayesian active learning for classification and preference learning. Kendall, A. and Gal, Y. (2017). What uncertainties do we need in bayesian deep learning for computer vision? Fig. 8: Comparison of the BALD performance. Left: AL training on Semantic-KITTI subset 1/4 from (Duong. et al., 2022), Right: AL training on Semantic-KITTI full dataset from this study. We observe that the two LE are poor in the initial steps, with subsequent increases in the future AL steps. Acknowledgements This work was granted access to HPC resources of [TGCC/CINES/IDRIS] under the allocation 2021- [AD011012836] made by GENCI (Grand Equipement National de Calcul Intensif). It is also part of the Deep Learning Segmentation (DLS) project financed by ADEME. REFERENCES Aghdam, H. H., Gonzalez-Garcia, A., van de Weijer, J., and L ́opez, A. M. (2019). Active learning for deep detection neural networks. Anselmi, F., Rosasco, L., and Poggio, T. (2016). On invariance Information and and selectivity in representation learning. Inference: A Journal of the IMA, 5(2):134–158. Ash, J. T., Zhang, C., Krishnamurthy, A., Langford, J., and Agarwal, A. (2020). Deep batch active learning by diverse, uncertain gradient lower bounds. Atighehchian, P., Branchaud-Charron, F., Freyberg, J., Pardinas, R., and Schell, L. (2019). Baal, a bayesian active learning library. https://github.com/ElementAI/baal/. Atighehchian, P., Branchaud-Charron, F., and Lacoste, A. (2020). Bayesian active learning for production, a systematic study and a reusable library. Beck, N., Sivasubramanian, D., Dani, A., Ramakrishnan, G., and Iyer, R. (2021). Effective evaluation of deep active learning on image classification tasks. Behley, J., Garbade, M., Milioto, A., Quenzel, J., Behnke, S., Stachniss, C., and Gall, J. (2019). Semantickitti: A dataset for semantic scene understanding of lidar sequences. Bengar, J. Z., Gonzalez-Garcia, A., Villalonga, G., Raducanu, B., Aghdam, H. H., Mozerov, M., Lopez, A. M., and van de Weijer, J. (2019). Temporal coherence for active learning in videos. 8 Fig. 9: Left image is a t-SNE visualization of labeled and DA(labeled) at step 0. Right image is t-SNE visualization of DA(labeled) clustering region by K-means Kirsch, A., van Amersfoort, J., and Gal, Y. (2019). Batchbald: Efficient and diverse batch acquisition for deep bayesian active learning. Milioto, A., Vizzo, I., Behley, J., and Stachniss, C. (2019). Rangenet++: Fast and accurate lidar semantic segmentation. In 2019 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pages 4213–4220. IEEE. Pop, R. and Fulop, P. (2018). Deep ensemble bayesian active learning : Addressing the mode collapse issue in monte carlo dropout via ensembles. Sener, O. and Savarese, S. (2018). Active learning for convolu- tional neural networks: A core-set approach. Settles, B. (2009). Active learning literature survey. Song, S., Yu, F., Zeng, A., Chang, A. X., Savva, M., and Funkhouser, T. (2016). Semantic scene completion from a single depth image. Uric ́ar, M., Hurych, D., Krizek, P., and Yogamani, S. (2019). Chal- lenges in designing datasets and validation for autonomous driving. arXiv preprint arXiv:1901.09270. van der Maaten, L. and Hinton, G. (2008). Viualizing data using t-sne. Journal of Machine Learning Research, 9:2579–2605. Wu, B., Zhou, X., Zhao, S., Yue, X., and Keutzer, K. (2018). Squeezesegv2: Improved model structure and unsupervised domain adaptation for road-object segmentation from a lidar point cloud. Wu, T.-H., Liu, Y.-C., Huang, Y.-K., Lee, H.-Y., Su, H.-T., Huang, P.-C., and Hsu, W. H. (2021). Redal: Region-based and diversity-aware active learning for point cloud semantic segmentation. Yuan, S., Sun, X., Kim, H., Yu, S., and Tomasi, C. (2022). Optical flow training under limited label budget via active learning. 9 Fig. 10: Visualization of samples deviating from dataset distribution. 10 Fig. 11: Left image is a t-SNE visualization of unlabeled pool at step 0, whose colors are corresponding to heuristic scores. Right image is the t-SNE visualization of selected samples and unlabeled pool.
http://arxiv.org/abs/2302.10672v1
2023-02-21T13:44:13
2023-02-21T13:44:13
Importance of methodological choices in data manipulation for validating epileptic seizure detection models
Epilepsy is a chronic neurological disorder that affects a significant portion of the human population and imposes serious risks in the daily life of patients. Despite advances in machine learning and IoT, small, nonstigmatizing wearable devices for continuous monitoring and detection in outpatient environments are not yet available. Part of the reason is the complexity of epilepsy itself, including highly imbalanced data, multimodal nature, and very subject-specific signatures. However, another problem is the heterogeneity of methodological approaches in research, leading to slower progress, difficulty comparing results, and low reproducibility. Therefore, this article identifies a wide range of methodological decisions that must be made and reported when training and evaluating the performance of epilepsy detection systems. We characterize the influence of individual choices using a typical ensemble random-forest model and the publicly available CHB-MIT database, providing a broader picture of each decision and giving good-practice recommendations, based on our experience, where possible.
[ "Una Pale", "Tomas Teijeiro", "David Atienza" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10672v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10672v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
Importance of methodological choices in data manipulation for validating epileptic seizure detection models Una Pale∗, Tomas Teijeiro∗†, David Atienza∗ ∗Embedded Systems Laboratory (ESL), Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland † BCAM - Basque Center for Applied Mathematics, Spain {una.pale, david.atienza}@epfl.ch, [email protected] 3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 2 7 6 0 1 . 2 0 3 2 : v i X r a Abstract-Epilepsy is a chronic neurological disorder that affects a significant portion of the human population and imposes serious risks in the daily life of patients. Despite advances in machine learning and IoT, small, nonstigmatizing wearable devices for continuous monitoring and detection in outpatient environments are not yet available. Part of the reason is the complexity of epilepsy itself, including highly imbalanced data, multimodal nature, and very subject-specific signatures. However, another problem is the heterogeneity of methodological approaches in research, leading to slower progress, difficulty comparing results, and low reproducibility. Therefore, this article identifies a wide range of methodological decisions that must be made and reported when training and evaluating the performance of epilepsy detection systems. We characterize the influence of individual choices using a typical ensemble random-forest model and the publicly available CHB- MIT database, providing a broader picture of each decision and giving good-practice recommendations, based on our ex- perience, where possible. Index Terms-Methodological learning, seizure detection, epilepsy, data selection, cross-validation ap- proaches, performance metrics, reproducibility, comparability choices, machine 1. Introduction In recent years, advances in signal processing, machine learning algorithms, the Internet of Things (IoT), and wear- able devices have enabled a variety of continuous monitoring applications in many domains, particularly health monitoring. One such example is epilepsy detection, with the ultimate goal of having small, non-stigmatizing, wearable devices for long-term epilepsy monitoring in patients' homes and everyday life, rather than limited to in-hospital monitoring. Epilepsy is a chronic neurological disorder characterized by the unexpected occurrence of seizures, imposing serious health risks and many restrictions on daily life. It affects a significant portion of the world's population (0.6 to 0.8%) [1], of which one third of patients still suffer from seizures despite pharmacological treatments [2]. Thus, there is a clear need for solutions that allow continuous unobstructed monitoring and reliable detection (and ideally prediction) of seizures [3], This work has been partially supported by the ML-Edge Swiss National Science Foundation (NSF) Research project (GA No. 200020182009/1), and the PEDESITE Swiss NSF Sinergia project (GA No. SCRSII5 193813/1). T. Teijeiro is supported by the grant RYC2021-032853-I funded by MCIN/AEI/ 10.13039/501100011033 and by the "European Union NextGen- erationEU/PRTR" [4]. Furthermore, these solutions will be instrumental in the design of new treatments, assisting patients in their daily lives, and preventing possible accidents. This need is also evident in the growing number of publications on seizure detection methods [5], [6] and wearable devices [7], [8]. However, although many studies report impressive lev- els of accuracy via machine learning (ML) methods, the widespread adoption of commercial technology has not yet occurred. The reasons for this are many and include the specificities of epilepsy itself. For example, to properly characterize epileptic seizures, recordings must be continuous, often lasting days and leading to extremely unbalanced datasets. This imbalance must be taken into account when preparing the data set, splitting it into training and testing, training epilepsy detection models, and reporting final perfor- mance values. Another challenge is the fact that epilepsy is a holistic phenomenon affecting many signal modalities, and thus, to get a full picture, multimodal data are needed from several different sensors. How to efficiently process all this data and fuse information and predictions remains an open research topic [9]. Finally, seizures show highly personalized patterns, which require new methods of personalizing general models (that were developed from many subjects) using the characteristics of individual patients. [10], [11]. The last reason for slower progress is that the way studies are designed, algorithms assessed, and results reported is very heterogeneous. It can be difficult to understand the level of evidence these studies provide [12] and it is also impossible to fairly compare the results. For example, it is very difficult to compare the performance of various systems when only two quantitative values are reported (e.g., sensitivity and specificity) and when the prior probabilities vary significantly (the a priori probability of a seizure is very low, which means that the assessment of background events dominates the error calculations) [13]. Thus, in this paper, we want to bring attention to a number of methodological choices which are usually underreported but ultimately can have a strong influence on system performance. These choices are necessarily made during data preparation, training, and also evaluation and reporting of the results. The contributions of this work are summarized as follows: • We identify a wide range of methodological decisions that must be made and reported when training and eval- uating the performance of epilepsy detection systems. • We characterize and assess the influence of individual choices using a typical ensemble random-forest model and the publicly available CHB-MIT database. TABLE 1. OVERVIEW OF ALL METHODOLOGICAL CHOICES TESTED Data used Training Perf. metric Subsets of data with different imbalance ratios (e.g. Factor1 and Factor10) All data, with different splits into training folds (SeizureToSeizure, 1h/4h windows) Cross-validation type: Leave-one-out (L1O) or Time-series-CV (TSCV) Window step: 0.5 to 4s, with 4s windows Personalized models or generalized models Episode and duration-level performance Micro or macro CV folds averaging • We provide a broader picture of each decision and give good-practice recommendations where possible. The remainder of the paper is organized as follows: Section 2 details the relevant methodological choices and their potential influence. Section 3 provides a description of the experimental setup used to evaluate the influence of these methodological choices and parameters. Section 4 presents the experimental results, while Section 5 comments on more broad and general observations on the presented results. It also presents certain methodological recommendations for the development of future epileptic seizure detection algorithms, as well as more general time series analysis applications. Section 6 concludes this work. 2. Methodological choices There are many methodological choices to make when evaluating machine learning algorithms and systems in terms of their performance and suitability for real-life applications. These choices, can significantly impact the performance and repeatability of such results in practice. In this section we go through the most important choices, discussing data prepa- ration, training and testing methodology, and performance measures, as listed in Table 1. We will later show how they influence the detection of epileptic seizures. 2.1. Data preparation An important part of evaluating machine learning al- gorithms is the data used to train and test the algorithm. A well-known practice is that training, validation, and test subsets must be chosen without overlap and be statistically independent to avoid the effect known as 'data leakage'. But the question that is less discussed is how representative are the data that we use. With the increasing amount of big data collected using the Internet of Things (IoT) and wearable devices, big data sets are no longer rare. Such large datasets are incredibly valuable and essential for having more ML/AI-powered devices in everyday life, but they also bring certain challenges. Training on such a huge amount of data, especially for computationally demanding or memory intensive algorithms or without lots of computational resources, can be complex, slow, and even potentially not feasible. For this reason, a common approach is to create smaller subsets of available datasets. Figure 1. Epilepsy model predictions example. Predictions without any post-processing and with two types of post-processing as well as true labels are shown. Of interest are the distributions of false positives. The distributions of false positives are of particular interest. In the case of epilepsy, it is characterized by recurrent but unpredictable electrical discharges in the brain. Epilepsy episodes can last from a few seconds to a few minutes. Overall, when looking at the recorded data, the percentage of seizure data is extremely small, commonly less than 0.5%. This huge imbalance in epilepsy recordings leads to the com- mon choice of creating a data subset that contains all seizure signals but only a reduced amount of non-seizure signals. This step of generating smaller or even balanced datasets makes training simpler, performance reporting clearer, and speeds up the research process. Most papers tackling the epilepsy detection problem do not use whole long-term epilepsy recordings, but rather data subsets and also very rarely discuss the influence of this decision on their results. In this paper, we address this question by testing several epilepsy subsets created from a main dataset. We evaluate the influence of using all or only some data samples, as well as the impact of the seizure to non-seizure imbalance ratio. We also test the influence of data splitting during the training and cross-validation folds and show that this choice can be very critical and make a big difference in whether the proposed algorithm will work in practice when all data are used, without the possibility of performing any selection. 2.2. Generalized vs. personalized models In many applications where underlying data patterns are highly specific, such as in many biomedical use cases, there are two approaches to training; personalized and generalized training and models. Epilepsy is a good example of this, where underlying electroencephalography (EEG) patterns are highly variable between EEG channels, recording sessions, and subjects. Personalized training means that data from the same subject are used to train the model. This leads to as many ML models as subjects we have. Generalized training, on the other hand, would lead to a single ML model for all subjects. To avoid data leakage (and enable comparison with personalized models), every subject has its own generalized model trained on all subject's data but that test subject, which is also known as the leave-one-subject-out approach. On one hand, personalized modes can capture subject- specific patterns better, but are also trained on less data in total, which can sometimes be limiting, as some subjects have very few seizures recorded. On the other hand, generalized models are more complex to train as they are trained on more data, and can also be less subject-specific but may be more interesting for building large-scale wearable outpatient systems. Figure 2. Illustration of duration and episode-based performance metrics. 2.3. Respecting temporal data dependencies Another aspect of data that is commonly forgotten is that all data are recorded in time and that sometimes this imposes some unavoidable statistical dependencies. Some underlying patterns that our ML algorithms can use can only exist in a certain order, and for this reason it might not be fair to use data that are in the future to train and then test using data that was before it. On one hand, it can miss some patterns useful for detection, and on the other hand, it can lead to potentially unfeasible results for in-practice applications. Two parts of the ML workflow must be considered in this case. Often, data samples are shuffled before training, whereas for temporal data, this might not be advisable. Furthermore, if some statistical knowledge on the distribution and length of certain classes is available, this knowledge can be used to post-process predicted labels and lower mis- classification chances. For example, in the case of epileptic seizures, it would not be realistic. that an individual suffers an epileptic seizure of 1-second duration every minute. Second, the temporal aspect of the data is relevant when choosing the cross-validation (CV) approach. A common CV approach for personalized training is leave-one-seizure- out, which means that data from one seizure is left out for testing, and seizures that come before but also after will be used for training. On the other hand, in the time series cross-validation (TSCV) approach [14], [15] only previously acquired data can be used for training. This means that if files are ordered in time, for the first CV fold only one file will be used for training and the one after it for testing. For the following CV folds, one more file is always added to the training set (the file previously used for testing), and testing is done on the next available file. This CV approach is rarely used in the literature but is the only feasible approach for online data training (and inference) on wearable devices. 2.4. Data segmentation Typically, features are extracted from fixed-size windows of data and calculated with the'moving window' repeatedly in shifts of a chosen step size. Here, two parameters have to be decided: window size (WS) and window step size (WSS) for which we move the feature extraction window. Choosing a larger window size might be necessary when extracting frequency information, but it also limits the possibility of detecting very short patterns. Similarly, a smaller step size can decrease detection latency, but increases the computa- tional costs of the algorithm due to more frequent feature extraction. These parameters can be optimized according to several aspects: features used and their properties and complexity, latency requirements, or available computational resources. If none of these is limiting, the parameters are generally optimized in terms of performance. It is interesting to note how much performance can change depending on these choices. More importantly, parameter choice and the reasoning behind it should be mentioned and documented in papers. 2.5. Evaluation metrics For temporal and sequential data, standard performance evaluation metrics, such as sensitivity and specificity, may not always be the most appropriate and can even be mislead- ing [16]. Evaluation metrics must ultimately reflect the needs of users and also be sufficiently sensitive to guide algorithm development [13]. As Shah et al. stated in [17] there is a lack of standardization in the evaluation of sequential decoding systems in the bioengineering community. The same authors compare five popular scoring met- rics for sequential data in [13]. Among them, the most interesting are 'Epoch-based sampling' (EPOCH), 'Any- overlap' (OVLP), and 'Time-aligned event scoring' (TAES). EPOCH treats the reference and hypothesis as temporal signals, samples them at a fixed epoch duration, and counts errors (TP, TN, FP, and FN) accordingly. For an epoch duration of one sample, this metric processes data sample- by-sample and results in typical performance measures (such as accuracy, sensitivity, specificity, F1 score etc). The OVLP measure [18], interprets signals as a series of same-label episodes and then assesses the overlap in time between reference and hypothesis. It counts a 'hit' in case there is any overlap between the reference and hypothesis. In Fig. 2 we illustrate several use cases, how errors are counted, and what is the final performance measure. The authors in [13] also propose the TAES metric which combines the EPOCH and OVLP information into one metric. The approach is very similar to OVLP, but rather than simply considering if there is any overlap between reference and hypothesis episodes, the percentage of overlap is measured and weighs the errors (TP, TN, FP, FN) accordingly. Here, we want to demonstrate the difference in performance in the use case of epilepsy detection, depending on the chosen performance measure, and also how these performance metrics can be used to interpret the quality of algorithm predictions. The code of those metrics is available online1. Another performance measure with a strong practical impact, and thus often used for epilepsy detection, is the false alarm rate (FAR), or the number of false positives per hour/day. Clinicians and patients see this measure as more meaningful than many more commonly used metrics, and are very demanding in terms of performance, requiring it to be as low as possible for potential wearable applications (e.g., less than 1 FP/day) [17]. This also necessitates exceptionally high constraints on the required precision (usually much higher than 99%). Finally, to quantify global performance, the accumulated performance of all cross-validation folds has to be calculated. 1. https://c4science.ch/source/PerformanceMetricsLib/ Figure 3. Epilepsy detection performance measured through seven measures; both on episode and duration level. For each, sensitivity (TPR), precision (PPV) and F1 score are measured. The results show average performance for all 24 subjects for 'Fact1' data subset. But here are also choices to be made. One can measure the average performance of all CV folds (micro-averaging) or can, for example, append predictions of all test files next to each other and only then measure performance on all appended data (macro-averaging). In Fig. 1, an example of predictions (also with moving average post-processing) is given for all files of one subject. What is important to notice is the distribution of false positives over time and over the different files/CV folds. Most often, false positives occur around seizures. However, there can potentially be a fold(s) with an unexpectedly large number of false positives. If the final performance is measured as an average of the performances of each fold, a fold with many false positives, as in Fig. 1, will have a lower influence on the total perfor- mance than if all predictions are appended and performance is measured only afterward. This potential overestimation of performance when averaging cross-validations should also be taken into account. 3. Experimental setup 3.1. Dataset In this work, we use the CHB-MIT epilepsy dataset, an open source widely used dataset for the detection of epilepsy [19], as it is a good representative of continuous, relatively long-term monitoring (over several days). CHB- MIT is an EEG database, with a total of 982.9 hours of data recorded at 256Hz. It consists of 183 seizures forming a total of 3.2 hours or 0.32% of labeled ictal data, from 24 subjects with medically resistant seizures ranging in age from 1.5 to 22 years. On average, it has 7.6 ± 5.8 seizures per subject, with an average seizure length of 58.6 ± 65.0 s. It was recorded using the bipolar montage (10-20 system) and thus contains between 23 and 26 channels, of which we use the 18 channels that are common to all patients. 3.2. Machine learning training We extract 19 features from each of the 18 channels, similar to [20], calculating them on 4-second windows with a moving step of 0.5 seconds (unless otherwise specified). We use two time-domain features, mean amplitude and line length, and 17 frequency domain features. Both relative and absolute values of power spectral density in the five common brain wave frequency bands are used: delta: [0.5-4] Hz, theta: [4-8] Hz, alpha: [8-12] Hz, beta: [12-30] Hz, gamma: [30-45] Figure 4. Epilepsy detection results depending on the data subset used. Hz, and low-frequency components: [0-0.5] Hz and [0.1-0.5] Hz. Before extracting the features, the data is filtered with a 4th-order, zero-phase Butterworth bandpass filter between [1, 20] Hz. As an algorithm to test the range of parameters mentioned, we choose a highly popular but also feasible algorithm for wearable and outpatient monitoring devices. We implemented a random forest classification algorithm, which is based on an ensemble of 100 decision trees to reduce model overfitting. It is fast and lightweight, both in model size and memory footprint [21], and has been used extensively for EEG-based seizure classification [22]–[24]. In the end we postprocess predicted labels with a moving average window of 5 seconds, and majority voting to smooth predictions and remove unrealistically small seizures. If seizures are closer than 30s, we merge them into one. 4. Experimental results 4.1. Evaluation metrics In this work, we use two metrics to measure performance. One is the EPOCH approach described in Sec. 2.5, with an epoch duration of one sample. TP, TN, FP, and FN are detected sample by sample, which are further used to calculate the sensitivity (TPR), precision (PPV), and F1 score. We call this duration-based performance, which characterizes how well seizures are detected with respect to their full length. The other performance metric is OVLP, which detects overlaps between predicted (hypothetic) and reference seizure or non-seizure episodes. We call this an episode-based metric, as it cares only about whether each of the seizure episodes has been detected, not caring exactly about the predicted seizure duration. These two metrics are very easily interpretable. For example, if the sensitivity at the episode level is 80% and there were 10 seizures, it means that 8 episodes were detected but 2 were missed. The TAES metric proposed in [13] is an interesting approach to combine both metrics but is harder to interpret, and thus it is not used here. Fig. 3 shows the average performance of personalized models for the 24 subjects from the balanced CHB-MIT dataset. For both episode- and duration-based performance, sensitivity, precision, and F1 scores are shown, as well as one accumulative measure, the mean of F1 score for episode and duration-level ('F1 DE'). The sensitivity of the episode is on average 100%, which means that except for a few cases, all episodes of seizures were detected. Looking at duration-level sensitivity, it is clear that even if seizure episodes were perfectly detected, their whole duration was Figure 5. Performance results when using leave-one-out vs. time- series cross-validation. Results are shown for three data subsets (F1, F10 and StoS). not always predicted. Looking at the precision, it is clear that there are also false positive predictions, and more of them when measuring on episode level than duration level, meaning that there were many short false positives. Observing the performance through these six values enables a more complete characterization of the prediction performance of a certain algorithm. It also enables a more nuanced comparison between different methodological steps or parameter values used, as will be shown next. 4.2. Generalized vs. personalized models Here we test the performance difference when training both personalized and generalized models for each subject. We used a balanced data subset ('Fact1'). In Fig. 6, the average for all subjects is shown, making clear the lower performance of generalized models. Inspecting the perfor- mance of the generalized model per subject reveals a clear distinction between patients on which generalized models perform very well and those for whom it performed poorly, either due to many false positives or almost no detected seizures. How to create generalized models and whether there should be subtypes of generalized models for different patient groups remains a question for future generations. For the remainder of this work, we will focus on personalized models. 4.3. Data preparation In Fig. 4, the performance of epilepsy detection is shown for five different data subsets used to train and test. The first two approaches, 'Fact1', and 'Fact10', contain a subset of the original CHB-MIT dataset in two different ratios of seizure and non-seizure data. 'Fact1' is a balanced data subset that has the same amount of seizure and non-seizure data, where all available seizure data are used, along with a randomly selected equal amount of non-seizure data. The 'Fact10' subset is constructed similarly, with the difference that the amount of randomly selected non-seizure data is 10x more than seizure data. Data are divided into files equal to the number of seizures with one seizure per file. Each file is arranged such that seizure data occur in the middle of the file, with nonseizure data split on both sides. Therefore, the total file length depends on the length of the seizure and the factor value. This organization enables easier training in the case of the leave-one-seizure-out approach, as each file is equally balanced. Figure 6. Comparison of average performance (for all subjects) of personalized and generalized models. gether), contain all data samples from the CHB-MIT database but are rearranged into files containing different amounts of data. The 'StoS' approach consists of files that start with the non-seizure data after the previous seizure and end when the next seizure ends. In this way, every file contains exactly one seizure, but the entire length of the file is not fixed. The last two approaches, 'Win1h' and 'Win4h', as the names imply, divide the dataset into files of 1-hour or 4-hour duration. In this way, some of the files may contain zero to possibly multiple seizures. In all three cases, we trained using time- series cross-validation. We specified that the first file must contain a certain amount of data (five hours) and at least one seizure, and as such it is slightly different from other consequent files. We analyze the impact of data preparation considering three metrics: false alarm rate (FAR), sensitivity (TPR), and precision (PPV). First, the false alarm rate, defined here as the number of FPs per day, as shown in Fig. 4, is significantly higher for data subsets (Fact1(0)) than for the whole dataset training (StoS or Win1h/4h). This can be traced to two reasons. The first is that Fact1(0) is trained on much less non- seizure data, potentially not enough to model properly the non-seizure patterns, resulting in more non-seizure samples being falsely classified. The second is that because testing is done only on a subset of data, FPs must be linearly scaled to estimate the false alarm rate per day, potentially leading to very high numbers. For these reasons, data subsets should not be used to estimate the false alarm rate of an epilepsy detection algorithm. Next, we consider the sensitivity and precision. For Fact1(0), seizure episode detection is easier, visible from episode-level sensitivity that is 100%. Detecting all seizure episodes perfectly is much harder when the entire dataset (StoS or WinXh) is used and visible by episode sensitivity values ranging between 80 and 95%. Precision presents a more complex picture, dropping sharply for StoS before recovering for WinXh. This is because StoS retraining and testing only occurs after every new seizure, where in the meanwhile could have been hours of non-seizure data. The WinXh strategies retrain much more often, thus making it easier to learn non-seizure patterns and lower false predictions. To conclude, using all data significantly reduces false positives, but also results in lower, but more realistic, sensitivity and precision values. 4.4. Respecting temporal data dependencies The last three approaches, Seizure To Seizure ('StoS'), and 1 or 4 hour windows ('Win1h'/'Win4h', 'WinXh' to- To show the influence of cross-validation choices on performance results, we trained and tested three data sub- Figure 7. Performance with respect to different window step sizes. Steps of 0.5, 1, 2 and 4s were used, with window size of 4s. sets with different data imbalance ratios ('Fact1', 'Fact10', 'StoS'), both using leave-one-seizure-out (L1O), and time- series cross-validation (TSCV) approaches. The results are shown in Fig. 5. The superior performance of the L1O ap- proach is evident in almost all aspects (sensitivity, precision, and numFP). This is reasonable as more data were used to train with L1O than with TSCV approach. The difference in performance ranged from 3 to 7% for the F1 score in episode detection. This is not a recommendation to use L1O; in contrast, it demonstrates that training on future data leads to overestimated performance and should be avoided. 4.5. Data segmentation In Fig. 7, the performance of epilepsy detection is shown when the window step ranged from 0.5 to 4 s, with a window size of 4 s. The most clear and expected pattern is that by increasing the step size, the number of false positives is reduced significantly, but what is interesting is that the proportion of FP increases, thus reducing the precision for episodes. More precisely, precision increases first (while sensitivity is still high) and then drops for episodes (because less seizures were also detected), leading to the conclusion that too big steps are risky. Increasing window step size also reduces sensitivity, more noticeably for duration level, which may be due to the fact that with large steps, shorter seizures can be potentially missed. These results demonstrate the complexity of the window step size parameter, that it is beneficial to experiment before choosing one value, and that it has to be necessarily reported to make the results comparable and reproducible. 5. Discussion 5.1. Data aspects As seen from results in Sec. 4.3, using all the data significantly reduces false positives and also results in lower and more realistic sensitivity values. Thus, if computational and memory resources are sufficient, models should be trained using all available data. If this is not possible, then the subset of data should contain significantly more non-seizure data. However, data subsets will result in an unrealistic false alarm rate. When using the whole dataset, the most appropriate seems to be to use fixed-size time frames in which models are retrained/updated regularly. The size of this time frame should also be tested and reported. General advice would be to use data subsets for initial experimentation and building an understanding of the algorithm and its parameters, but that all the available data should be used for reporting the final performance. It is also useful to take into account and characterize the class imbalance. When talking about the temporal aspect of data, several things should be taken into account. We advise not to shuffle data samples before training and testing but rather to use temporal information and knowledge on class distribution to postprocess predicted labels, which can increase performance, but must also be clearly reported. Finally, it is critical to decide whether to use only the data from the same subject to create personalized and, as shown, more precise models or to use all available data from other subjects to create generalized models. Generalized models can have lower individual performance, but can be used for new subjects. This topic represents a full research topic on its own. For example, future research should investigate whether it is possible to create models that can use generalized models as a starting point from which they can be personalized.Would these models lead to better overall performance in comparison to personalized models? Would less personal data be needed to personalize models if generalized modes are used as starting point? Similarly, the unavoidable question is, can we somehow profit from both generalized and personalized models? Can we combine them in some beneficial way? 5.2. Training aspects When talking about the choice of cross-validation as shown in Sect. 4.4, the leave-one-out approach leads to higher performance than if data are trained in temporal order using time series cross-validation. However, the L1O approach is not realistic for training data in real time, while TSCV is intended for such scenarios. Training models online as data are being acquired is one of the necessary next steps for ML models on IoT devices, and thus TSCV will have to become the standard method. Data partitioning has two parameters that can also play a significant role in performance, namely the window size used to extract features and the window step size. Their optimal choice can depend on each use case, the features extracted and their properties and complexity, latency requirements, and available computational resources. Here, we show how window step size can influence performance, with different patterns for false alarms, sensitivity, and precision, and how it has different impacts on duration- or episode-level classification. The results show the complexity of the window step size parameter, indicating that it is beneficial to test it before choosing one value and that it must be reported to make results comparable with the literature. One research avenue that we have not considered here as it is outside the scope of this work, but which can be potentially very beneficial, is optimizing the window size parameter for each feature individually. 5.3. Performance estimation aspects Here we proposed to use two performance metrics, one at the duration-level and one at the episode-level. Each of them has certain advantages, and thus their values should be interpreted carefully. Nevertheless, together they provide a full picture of the detection characteristics of the algorithm analyzed. For example, EPOCH, a duration-based metric, cares about the duration of the events and thus weighs long events more importantly. This means that if a signal contains one very long seizure event and some shorter ones, the accuracy with which the long event is detected will dominate the overall scoring. In epilepsy detection, as in many applications, the duration of the event can vary dramatically; therefore, this must be taken into account. For this reason, OVLP, an episode-level performance metric, is much easier to interpret. However, such an episode-level metric is more permissive and tends to produce much higher sensitivities. It can also be implemented so that if an event is detected in close proximity to the reference annotation, it is considered correctly detected, which can further increase the performance values. Nowadays, in the literature, duration-level-based perfor- mance is still the most popular, but there are trends of moving toward more event/episode-based performance measures [13]. Currently, there is no standardization. Until then, the perfor- mance metrics used, as well as post-processing that has been utilized to smooth the labels, must be clearly described. Similarly, the method to achieve the overall perfor- mance measure from the individual CV folds must be documented. We recommend that overall performance be calculated by temporally appending all fold predictions in time, rather than as the average of all fold performances. For example, if one CV fold (or small portion, as in Fig. ref- fig:dataPredictionExample) has extremely high number of false positives, but all other ones have good performance, it will affect overall estimation of e.g., precision much less (due to averaging over all folds), leading to potentially overestimated performance. 6. Conclusion In this work, we have characterized the influence of a wide range of important methodological choices for epilepsy detection systems. When choosing a subset of the dataset for training, performance can be highly overestimated compared to training in the entire long-term data set. Thus, for real-life performance estimation, using all long-term data is necessary. Similarly, using the leave-one-seizure-out cross-validation approach can improve detection performance, but it is not realistic for online data training, as it uses future data. Thus, we recommend using a time-series cross-validation approach instead, with macro-averaging rather than microaveraging. Training on a generalized level can be challenging due to its subject-specific nature, leaving personalized models outper- forming generalized ones. Furthermore, performance metrics must reflect users' needs and be sufficiently sensitive to guide algorithm development. Consequently, we encourage the usage of both episode-based and duration-based performance metrics, which together can give a more nuanced picture of algorithm performance. Finally, whatever choices are made, to further increase the comparability and reproducibility of results, it is essential that all choices and parameters are well reported. References [1] F. Mormann et al., "Seizure prediction: The long and winding road," Brain: A Journal of Neurology, 2007. [2] D. Schmidt and M. Sillanp ̈a ̈a, "Evidence-based review on the natural history of the epilepsies," Current Opinion in Neurology, 2012. [3] A. D. Patel et al., "Patient-centered design criteria for wearable seizure detection devices," Epilepsy & Behavior: E&B, 2016. [4] A. Van de Vel et al., "Automated non-EEG based seizure detection: Do users have a say?" Epilepsy & Behavior, 2016. [5] K. Rasheed et al., "Machine Learning for Predicting Epileptic Seizures Using EEG Signals: A Review," IEEE reviews in biomedical engineering, 2021. [6] C. Jory et al., "Safe and sound? A systematic literature review of seizure detection methods for personal use," Seizure, 2016. [7] B. H. Brinkmann et al., "Seizure Diaries and Forecasting With Wearables: Epilepsy Monitoring Outside the Clinic," Frontiers in Neurology, 2021. J. Verdru and W. Van Paesschen, "Wearable seizure detection devices in refractory epilepsy," Acta Neurologica Belgica, 2020. [8] [9] A. Schulze-Bonhage, "Seizure prediction: Time for new, multimodal and ultra-long-term approaches," Clinical Neu- rophysiology, 2022. [10] D. Cogan et al., "Personalization of NonEEG-based seizure detection systems," 2016. [11] T. De Cooman et al., "Personalizing Heart Rate-Based Seizure Detection Using Supervised SVM Transfer Learning," Frontiers in Neurology, 2020. S. Beniczky and P. Ryvlin, "Standards for testing and clinical validation of seizure detection devices," Epilepsia, 2018. S. Ziyabari et al., "Objective evaluation metrics for automatic classification of EEG events," arXiv:1712.10107, 2019. [13] [12] [14] A. Mohammed et al., "Time-series cross-validation parallel programming using mpi," ICDABI, 2021. [15] R. Zanetti et al., "Approximate zero-crossing: A new inter- pretable, highly discriminative and low-complexity feature for EEG and iEEG seizure detection," Journal of Neural Engineering, 2022. [16] N. Japkowicz and M. Shah, Evaluating Learning Algorithms: A Classification Perspective. Cambridge Uni Press, 2011. [17] V. Shah et al., "Validation of Temporal Scoring Metrics for [18] Automatic Seizure Detection," in SPMB, 2020. S. B. Wilson et al., "Seizure detection: Correlation of human experts," Clinical Neurophysiology, 2003. [19] A. H. Shoeb, "Application of machine learning to epileptic seizure onset detection and treatment," Thesis, MIT, 2009. [20] U. Pale et al., "Hyperdimensional computing encoding for feature selection on the use case of epileptic seizure detection," arXiv:2205.07654, 2022. [21] R. Zanetti et al., "Real-Time EEG-Based Cognitive Workload Monitoring on Wearable Devices," IEEE transactions on bio- medical engineering, 2022. [22] M. K. Siddiqui et al., "A review of epileptic seizure detection using machine learning classifiers," Brain Informatics, 2020. [23] D. Sopic et al., "E-glass: A wearable system for real-time detection of epileptic seizures," AISCAS, 2018. [24] R. Zanetti et al., "Robust epileptic seizure detection on wearable systems with reduced false-alarm rate," EMBC, 2020.
http://arxiv.org/abs/2302.10671v1
2023-02-21T13:40:16
2023-02-21T13:40:16
Directive Explanations for Monitoring the Risk of Diabetes Onset: Introducing Directive Data-Centric Explanations and Combinations to Support What-If Explorations
Explainable artificial intelligence is increasingly used in machine learning (ML) based decision-making systems in healthcare. However, little research has compared the utility of different explanation methods in guiding healthcare experts for patient care. Moreover, it is unclear how useful, understandable, actionable and trustworthy these methods are for healthcare experts, as they often require technical ML knowledge. This paper presents an explanation dashboard that predicts the risk of diabetes onset and explains those predictions with data-centric, feature-importance, and example-based explanations. We designed an interactive dashboard to assist healthcare experts, such as nurses and physicians, in monitoring the risk of diabetes onset and recommending measures to minimize risk. We conducted a qualitative study with 11 healthcare experts and a mixed-methods study with 45 healthcare experts and 51 diabetic patients to compare the different explanation methods in our dashboard in terms of understandability, usefulness, actionability, and trust. Results indicate that our participants preferred our representation of data-centric explanations that provide local explanations with a global overview over other methods. Therefore, this paper highlights the importance of visually directive data-centric explanation method for assisting healthcare experts to gain actionable insights from patient health records. Furthermore, we share our design implications for tailoring the visual representation of different explanation methods for healthcare experts.
[ "Aditya Bhattacharya", "Jeroen Ooge", "Gregor Stiglic", "Katrien Verbert" ]
10.1145/3581641.3584075
[ { "@title": "doi", "@href": "http://dx.doi.org/10.1145/3581641.3584075", "@rel": "related", "@type": null }, { "@title": null, "@href": "http://arxiv.org/abs/2302.10671v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10671v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.HC", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.HC", "cs.AI", "cs.LG", "cs.SE" ]
3 2 0 2 b e F 1 2 ] C H . s c [ 1 v 1 7 6 0 1 . 2 0 3 2 : v i X r a Directive Explanations for Monitoring the Risk of Diabetes Onset: Introducing Directive Data-Centric Explanations and Combinations to Support What-If Explorations Aditya Bhattacharya [email protected] KU Leuven Leuven, Belgium Gregor Stiglic [email protected] University of Maribor Maribor, Slovenia Jeroen Ooge [email protected] KU Leuven Leuven, Belgium Katrien Verbert [email protected] KU Leuven Leuven, Belgium ABSTRACT Explainable artificial intelligence is increasingly used in machine learning (ML) based decision-making systems in healthcare. How- ever, little research has compared the utility of different explanation methods in guiding healthcare experts for patient care. Moreover, it is unclear how useful, understandable, actionable and trustworthy these methods are for healthcare experts, as they often require technical ML knowledge. This paper presents an explanation dash- board that predicts the risk of diabetes onset and explains those predictions with data-centric, feature-importance, and example- based explanations. We designed an interactive dashboard to assist healthcare experts, such as nurses and physicians, in monitoring the risk of diabetes onset and recommending measures to minimize risk. We conducted a qualitative study with 11 healthcare experts and a mixed-methods study with 45 healthcare experts and 51 di- abetic patients to compare the different explanation methods in our dashboard in terms of understandability, usefulness, actionabil- ity, and trust. Results indicate that our participants preferred our representation of data-centric explanations that provide local expla- nations with a global overview over other methods. Therefore, this paper highlights the importance of visually directive data-centric explanation method for assisting healthcare experts to gain action- able insights from patient health records. Furthermore, we share our design implications for tailoring the visual representation of different explanation methods for healthcare experts. CCS CONCEPTS • Human-centered computing → Human computer interac- tion (HCI); Visualization; Interaction design; • Computing methodologies → Machine learning. Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]. IUI '23, March 27–31, 2023, Sydney, NSW, Australia © 2023 Copyright held by the owner/author(s). Publication rights licensed to ACM. ACM ISBN 979-8-4007-0106-1/23/03. . . $15.00 https://doi.org/10.1145/3581641.3584075 KEYWORDS Explainable AI, XAI, Interpretable AI, Human-centered AI, Respon- sible AI, Visual Analytics ACM Reference Format: Aditya Bhattacharya, Jeroen Ooge, Gregor Stiglic, and Katrien Verbert. 2023. Directive Explanations for Monitoring the Risk of Diabetes Onset: Intro- ducing Directive Data-Centric Explanations and Combinations to Support What-If Explorations. In 28th International Conference on Intelligent User Interfaces (IUI '23), March 27–31, 2023, Sydney, NSW, Australia. ACM, New York, NY, USA, 16 pages. https://doi.org/10.1145/3581641.3584075 1 INTRODUCTION Machine Learning (ML) based systems have been increasingly adopted in healthcare over the past few decades, in applications ranging from surgical robots to automated medical diagnostics [41]. Especially for screening and monitoring of diseases such as type-2 diabetes, ML models have proven to be significant [15, 53]. However, most of these algorithms are "black-boxes" because the reasoning behind their predictions is unclear [9]. Moreover, the growing concern of bias, lack of fairness, and inaccurate model prediction have limited the adoption of ML more recently [36]. Consequently, explainable artificial intelligence (XAI) has gained a lot of focus from ML practitioners as XAI methods facilitate the interpretation and understanding of complex algorithms, thereby increasing the transparency and trust of such black-box models [33, 37, 41]. In healthcare, XAI empowers medical experts to make data-driven decisions using ML, resulting in a higher quality of medical services [54] and can impact its trust and reliance [8, 56]. Existing XAI methods [5, 24, 34, 44] are predominantly designed for ML practitioners instead of non-expert users [6], who might be specialized in a particular application domain but lack ML knowl- edge [25]. Yet, the effectiveness of these explanation methods has not been fully analyzed due to the lack of user studies with non- expert users [48, 56]. This gap highlights the necessity for analyzing and comparing explanation methods with healthcare professionals (HCPs) such as nurses and physicians [17] as it is unclear how useful, understandable, actionable, and trustworthy these methods are for them. Moreover, non-expert users need help to understand how to obtain a favorable outcome [16, 49, 51]. This emphasizes the need IUI '23, March 27–31, 2023, Sydney, NSW, Australia Bhattacharya, et al. to make explanations directive, i.e. guiding the users to take action for achieving their desired outcome [49]. Additionally, instead of static explanations, non-expert users have considered interactive explanations essential to support understanding and interpretation [1, 26, 30]. Therefore, visually directive explanations should enable non-experts not only to understand why a certain outcome is pre- dicted but also to guide them in the process of finding how to obtain their desired outcome without any intervention from ML experts [29, 45, 52, 58]. We designed a prototypical dashboard that predicts patient's risk of diabetes onset using visually directive explanations based on dif- ferent explanation methods, including data-centric approaches [3], feature importance [2], and example-based methods [2]. We aimed to support nurses and physicians in screening patients with undiag- nosed type-2 diabetes, monitoring their conditions, and suggesting actions to control their risk of diabetes onset. We also obtained the perspective of diabetic patients during the evaluation process as they are well aware of the risk factors of type-2 diabetes. Furthermore, some of them were recently in the pre-diabetes phase and all of them are actively in contact with their HCP. Thus, we analyzed their motivation to use such a dashboard. This paper probes into the following research questions: RQ1. In what ways do patients and HCPs find our visually directive explanation dashboard useful for monitoring and evaluating the risk of diabetes onset? RQ2. In what ways do HCPs and patients perceive data-centric, model-centric, and example-based visually directive expla- nations in terms of usefulness, understandability, and trust- worthiness in the context of healthcare? RQ3. In what ways do visually directive explanations facili- tate patients and HCPs to take action for improving patient conditions? We explored these questions through a two-phased study: first, a qualitative study on a low-fidelity click-through prototype involv- ing 11 HCPs; and second, a mixed-methods online study for the evaluation of a high-fidelity web application prototype involving 51 patients and 45 HCPs. We analyzed the effectiveness of our dif- ferent visual explanation methods and compared them in terms of understandability, usefulness, actionability, and trust [21, 50]. Our results show that our dashboard provided actionable insights to HCPs about patient health by helping them to identify important risk factors and showcase how critical the patients' conditions are. Additionally, it helped patients to self-monitor and analyze their health conditions. This paper presents three primary research contributions. First, we present our visually directive data-centric explanation meth- ods that are aimed to provide local explanations of the predicted risk for individual patients with a global overview of risk factors for the entire patient population. Whereas it has been shown that non-expert users prefer local explanations that justify a single de- cision [6], it has also been argued that these explanations rarely provide sufficient insight into the reasoning of models and the ex- planatory depth that non-experts require to accept and trust the decision-making of the model [13]. To address this challenge, we present an approach that combines perspectives of both local and global explanation methods [32] to provide more insight into both the model predictions and the data for non-expert users. Second, we present the design of a dashboard that combines different ex- planation methods based on an iterative user-centered research process. Third, based on observations of our user-centered design process and an elaborate user study, we present design implications for tailoring explanations for healthcare experts. We observed that our participants had a higher preference for our representation of data-centric explanations over other methods as they found them more informative. We also observed that participants combined multiple explanation methods, particularly for recommending ac- tions to minimize the risk and interpreting the rationale behind the predicted risk. Based on these observations, we present de- sign implications for tailoring directive explanations for healthcare experts. 2 BACKGROUND AND RELATED WORK Designing visually explainable Decision Support System (DSS) in healthcare considering different types of explanations is an active area of research in XAI [4]. To contextualize our research, we first review recent research findings in the domain of visually interactive DSS in healthcare and then investigate XAI methods that provide visual explanations to end-users. 2.1 Visually Interactive DSS in Healthcare In healthcare, using DSSs built on the domain knowledge of medical experts has a long history [47]. Usually, such systems are rule-based logical systems developed on pre-defined rules supplied by medical experts [10]. Despite the explainability offered by such systems, there are many challenges such as poor user experience and scarcity of involvement of medical experts in forming the knowledge base [12, 20]. To overcome these challenges, modern DSSs in healthcare use ML and data-driven techniques to learn patterns from historical data and apply visualizations to facilitate prescriptive insights for medical practitioners [20, 23, 43]. ML-based DSSs are being increas- ingly used in healthcare for the early detection of health conditions such as undiagnosed type-2 diabetes mellitus [53]. Despite the suc- cess of such systems, the lack of transparency of advanced ML algorithms has increased the need for human-friendly explainable DSS in healthcare [27]. To mitigate these challenges, interactive interfaces have proven to improve the understanding of non-expert users [11]. Moreover, many researchers have found additional benefits in applying XAI for clinical DSSs such as the mitigation of cognitive bias [57]. Our research work focuses on providing an explainable DSS which is interactive and personalized to meet the needs of the medical experts involved in the progressive monitoring of the risk of diabetes onset for patients. 2.2 Exploration in Visual Explanations Harmonizing XAI techniques with visual explanations enable non- expert users to gain appropriate trust in the outcome of ML systems [40]. Recent works also suggest that exploration and contextual- ization of explanation methods can enhance the satisfaction and interpretability of non-expert users [6]. Directive Explanations for Monitoring the Risk of Diabetes Onset IUI '23, March 27–31, 2023, Sydney, NSW, Australia Model-agnostic post-hoc explanation techniques [31, 50, 54] ex- plain black-box ML models without having any intrinsic informa- tion about the inner working of the algorithm, i.e. knowledge about inner parameters or hyper-parameters of the model. Most com- mon model-agnostic local explanation methods like LIME [44], and SHAP [34] are feature-importance-based methods that identify the most impactful features contributing to the model's prediction [2]. However, more recently, due to the failure of ML models trained on biased, inconsistent and poor-quality data, the ML research com- munity is exploring data-centric approaches [3, 35]. Examples of data-centric approaches are summarizing individual data instances (using common statistical methods like mean, mode, and variance), visualizing the data distribution to compare feature values of an in- stance to those across the remaining dataset and observing changes in model predictions through what-if analysis [18, 19, 22, 57]. Addi- tionally, data-centric explanations include data-driven rule-based approaches that are adopted commonly in medical DSS for assisting health experts [4, 12, 19, 27, 47]. Additionally, researchers have used counterfactuals to provide recommendations for health-related changes [2, 40, 57]. Adadi and Berrada [2] have defined counterfactual explanations as example- based methods that provide minimum conditions required to ob- tain an alternate decision. Although counterfactuals provide useful model-agnostic post-hoc explanations, examples generated by coun- terfactual algorithms can be practically infeasible, contradictory, or uncontrolled, thereby indicating a need for actionable recourse [28, 51]. For instance, to obtain a lower risk of diabetes, counter- factual algorithms can indicate patients to reduce their age by 30 years or alter their gender, which is practically infeasible. Yet, vi- sually interactive counterfactuals hold great potential to produce actionable insights [18]. Thus, there is an opportunity to explore a better representation of such explanation methods for achieving actionable recourse. Moreover, as established by Bove et al. [6], exploring explainable interfaces is considered essential for the interpretation and satis- faction of end-users. The same notion is adopted in our work for considering different types of visual explanation methods. 3 MATERIAL AND METHODS This section presents our visually directive explanation dashboard and our user-centric methodology for the design and evaluation of our prototypical dashboard. The ethical approval for our research was granted by the ethical committee of KU Leuven with the num- ber G-2019-09-1742. 3.1 Visually Directive Explanation Dashboard Our explanation dashboard is designed to assist HCPs in moni- toring and screening the risk of diabetes onset for patients. We enabled users to explore different kinds of visual explanations for interpreting the model prediction. ML Model: We used a logistic regression algorithm from Python scikit-learn module to train a classifier on our diabetes healthcare dataset. We achieved a training accuracy of 93% and a test accuracy of 91% (no overfitting effect). The test accuracy is considered as overall model accuracy. The complete technical approach of data processing, model training, tuning and evaluation was conducted in Python Dataset: Our ML model was trained on patient's electronic health records of comprehensive medical examinations conducted from 5 Slovenian primary care institutions [53]. The health records include information about patients such as blood glucose, waist circumfer- ence measure, BMI, age, gender, etc., along with patient behaviors collected from the Finnish Diabetes Risk Score questionnaire (FIND- RISC) to predict the risk of diabetes. Our dashboard explained the predicted risk for an individual patient along with an overview of the health statistics of the en- tire patient population in the medical records. Thus, our approach provides local explanations with a global perspective to HCPs [32]. 3.1.1 User requirements. We conducted a preliminary one-hour focus group with four healthcare workers with active experience in patient-care from Community Healthcare Centre dr. Adolf Drolc Maribor, Slovenia to understand their needs and challenges while monitoring the risk of diabetes in patients. We first demonstrated a dashboard based on the work of Rojo et al. [46], AHMoSe, that explains the predicted risk of diabetes using SHAP values. Then, we did a co-design session with our participants to tailor the AHMose interface for meeting their requirements. The session was recorded and transcribed for analyzing their feedback and responses. From this exploratory study, we identified their struggles in monitoring patients for the onset of diabetes. We also learned that the visualizations for SHAP based explanations in AHMose were too complex and detailed. Our participants wanted an easy way to find only health factors which plays a vital role in elevating the risk of diabetes for patients, instead of looking into all the features considered by the model for making predictions. We also learned from the co-design activity that the healthcare workers preferred simpler line-chart, bar-chart and textual representations of the data that could also be used to communicate with patients. Additionally, we asked our about their specific needs in this study. We summarize their responses into the following user requirements that our explanation system should meet: 1. An interface for monitoring patients – HCPs wanted a visual interface to quickly observe the medical records of patients as it is inconvenient and time-consuming to examine multiple medical reports to assess patient health conditions. Additionally, HCPs wanted to analyze how a specific patient is doing compared to other patients. 2. Suggest actions to minimize the predicted risk - HCPs wanted to use an interactive interface to suggest actions to patients to minimize their risk of diabetes onset. 3. Increase patient awareness - HCPs wanted the interface to show patients how critical their conditions are for creating more conscious awareness and motivating them to follow the prescribed suggestions sincerely. Then we designed our tailored explanation dashboard which supported the following tasks for meeting the user requirements: T1: Monitor the risk of diabetes for patients – Understand the current risk of diabetes onset for patients and identify if the patient's condition is more critical or not for deciding the amount of attention needed for the patient. IUI '23, March 27–31, 2023, Sydney, NSW, Australia Bhattacharya, et al. Figure 1: Dashboard design of our click-through prototype. Visual explanations are provided using: Patient information with the risk prediction chart (VC1), Patient Summary (VC2), Factors Contributing to Risk (VC3), Recommendations to reduce risk (VC4), Risk recovery (VC5). T2: Propose actions to minimize the predicted risk – Sug- gest actions to patients to reduce the risk of diabetes or to keep it under control. T3: Interpret the rationale behind the predicted risk – Un- derstand and explain the system's logic for the estimated risk of diabetes by identifying the health variables and their range of values that can increase or decrease the risk of diabetes. T4: Compare the current patient with other patients – By comparing the health measures of the current patient with other patients, get an indication about a specific patient's situation as compared to other patients to decide the amount of attention needed. Task T1 aims to meet the first requirement, T2 aims to meet the second requirement and T3 and T4 aims to meet the third requirement. 3.1.2 XAI techniques and visual components. When we ana- lyzed our user requirements, we found that these requirements are aligned with the explanation goals presented by Wang et al. [57]. Therefore, the choice of our explanation methods should facilitate learning by enabling our users to filter a small set of factors to make their observations simpler and provide them with the ability to predict and control future phenomena by generalizing these obser- vations into a conceptual model. Wang et al. [57] also proposed XAI elements that can meet these explanation goals and recommended visualizations that can be used to present these XAI elements. More- over, we considered model-agnostic local explanation methods for explaining the predicted risk for individual patients irrespective of the ML algorithm used. We further designed visual components as illustrated in Figure 1 for the following three types of explanation methods that meet our explanation goals: Feature Importance explanation – As the dashboard aimed to direct HCPs towards suggesting actions to patients for mini- mizing the risk, feature-importance explanations enabled them to identify the most influential risk factors according to the prediction model. However, Szymanski et al. [55] have shown that the repre- sentation of feature-importance explanations can impact the under- standability and usefulness of this method. Additionally, from our preliminary focus group session, we observed that our participants did not understand simplified SHAP-based feature-importance ex- planations in the AHMoSe dashboard [46]. Our representation of directive feature-importance explanations presented in Factors Contributing to Risk (VC3) included only the actionable health variables with a percentage measure that indi- cated how specific features influenced the prediction. We define Directive Explanations for Monitoring the Risk of Diabetes Onset IUI '23, March 27–31, 2023, Sydney, NSW, Australia actionable health variables as variables that can be controlled by the patient such as BMI, waist circumference, physical activity level. We considered other factors that are infeasible for the patient to alter such as age, gender, and geographical region as non-actionable health variables. The feature-importance scores are calculated using the SHAP Python module. Factors that can increase risk are displayed in red, while those which can decrease risk are displayed in green. Subtle explanations are provided beside each health variable by comparing the feature value with the recommended range to indicate why it can increase or decrease risk. Data-Centric explanations – Data-centric explanations in- cluded in our dashboard aimed to explain why a certain health variable is increasing or decreasing the risk of diabetes without focusing on what the model considered important. Patient infor- mation with risk prediction chart (VC1), Patient Summary (VC2), and Risk Recovery (VC5) provided data-centric explanations in our dashboard. VC1 gave a textual overview of the health information of a particular patient with a doughnut chart showing the predicted risk of diabetes onset. To enable HCPs to observe the variance in the predicted risk between different patients we categorized the probability score (prob) generated by our ML classifier into three levels: High (prob > 0.75), Moderate (0.5 ≤ prob ≤ 0.75) and Low (prob < 0.5). The abstracted level is displayed in the center of the doughnut chart, and the risk percentage (prob * 100%) as a tool- tip. Moreover, we used consistent color coding across the different visual components (red for high, orange for moderate, and green for low risk). We also provided subtle indicators like colored arrows for numerical feature variables and colored text for categorical feature variables, along with necessary tool-tips to indicate if the specific health variable is within the recommended range or not. However, these visual indicators are only provided for actionable health variables. VC2 showed the value of each actionable health variable of a patient along with data-distribution charts, considering the en- tire patient population in the records. This component enabled HCPs to have a quick overview of a specific patient as compared to other patients and observe common patterns across all patients using the data-distribution charts. The health variables used in the data-distribution charts are further segregated as patient measures, which is visually represented with area charts as these are contin- uous variables, and behaviors which is visually represented with bar charts as these are categorical variables. VC2 also showed the recommended ranges for the patient measures as configured by the health experts. It can be used to observe the health status of a patient in comparison to other patients. The data-distribution zone where the current health measure lies in the distribution chart is also color-coded with our consistent color-coding convention. VC5 enabled progressive monitoring of the predicted risk of diabetes considering the historical patient records. It was designed to allow users to identify if the patient's condition is improving or not over a period of time. Counterfactual explanations – Recommendations to reduce risk (VC4) suggested actions using counterfactual explanations generated by the DiCE framework [38] that patients can take to reduce the predicted risk of diabetes. To mitigate the drawbacks of the counterfactual algorithm implemented in the DiCE framework [38], we considered generating counterfactuals for only actionable health variables instead of non-actionable variables. We also added data-driven boundary conditions so that coun- terfactuals with absurd alterations are avoided. Furthermore, the recommendations are presented as textual statements instead of discrete numbers for easier interpretation. We considered having these textual recommendations pre-configured for the patient be- haviors that are categorical features of the model. For example, instead of suggesting the patient to increase their physical activity level from low to moderate, the visual recommends they exercise daily for 30 minutes. VC4 also included an indication of feasibility (easy or difficult) and an estimated measure of risk reduction using sensitivity anal- ysis [2, 19, 58] to compare between different recommended tasks. For continuous numerical features of the model, feasibility is mea- sured by calculating the percentage change between recommended measure value and the current health measure. If the percentage change is within ±10%, feasibility is labeled as easy. Otherwise, it is considered as difficult. For categorical model features, ordinal inte- ger encoding is done based on how the specific value can increase or decrease the risk of diabetes, and feasibility is considered based on the encoded ordinal values. For instance, physical activity level is a categorical variable having three possible values: low, moderate, and high. Low physical activity can increase the risk, and hence the corresponding ordinal value of 1 is assigned to it. If the value is moderate, an ordinal value of 2 is assigned, and if it is high an ordi- nal value of 3 is assigned. Any change to immediate ordinal value is considered easy. For instance, a change from low to moderate is considered easy. But otherwise, it is considered as difficult. With this approach, we aimed to make counterfactual explanations more useful and actionable in a controlled way. 3.2 Evaluation Process We evaluated our prototype in a two-phased user study. First, a qualitative study for evaluating a low-fidelity click-through pro- totype was conducted through individual interviews involving 11 HCPs. The goal of this study was to get early feedback on how our primary users (HCPs like nurses and physicians) perceive the dashboard and whether the user requirements are being met or not. Second, we conducted a mixed-methods study involving 45 HCPs and 51 diabetic patients through online survey questionnaires. The goal of this study was to evaluate the effectiveness of the dashboard in meeting the needs of HCPs and patients. We also compared the different explanation methods represented by our five visual components in terms of understandability, usefulness, actionability, and trustworthiness. The patient's perspective was also collected from this study as our dashboard would directly or indirectly impact them. The main similarity between these two user studies is that our participants were given similar task-based questions about the four supported tasks (T1, T2, T3, T4) by our prototype in both stud- ies. Regarding the differences, our first study involved only HCPs, and we recorded the measures of our qualitative evaluation of the visual components through 1:1 interviews. In our second study, we involved a larger pool of participants (including patients) to IUI '23, March 27–31, 2023, Sydney, NSW, Australia Bhattacharya, et al. evaluate our high-fidelity prototype. We recorded our measures of the slightly modified visual components (Figure 3) using a combina- tion of participant-reported qualitative responses and self-reported Likert scale responses. 4 EVALUATION AND ANALYSIS OF LOW-FIDELITY PROTOTYPE For our first study, we designed a click-through prototype in Figma [14] in multiple iterations. Figure 1 illustrates the final design of our low-fidelity click-through prototype. Table 1: Participants' information for the qualitative evalu- ation of the low-fidelity prototype. We performed a thematic analysis considering the 6-phase-method from Braun and Clarke [7] on the qualitative data. We first reviewed the transcripts of the recorded interviews. Then, we created a list of initial codes from the data. In multiple iterations, we grouped the identified codes into potential themes. After reviewing the preliminary set of themes, we formed a definitive set of themes and accordingly grouped them to analyze how each participant succeeded or failed to answer the tasks-based questions. To preserve the anonymity of the participants while present- ing the results of this study, we refer to the participant as P(N), where N is a particular participant from 1 to 11. We only made nec- essary grammatical corrections to the participants' quotes when presenting the results. Gender Age group Participant distribution 3 : Male 8 : Female 8 : (21-30) years 1 : (31 - 40) years 1: (41 - 50) years 1: (51-60) years Highest education level 11 : Master's degree Experience in patient care 10 : > 1-year experience in direct patient interaction 1: Indirect patient interaction through training of nurses 4.1 Participants We conducted a qualitative study involving 11 HCPs (male: 3, fe- male: 8) from the University of Maribor to evaluate our low-fidelity prototype. We recruited participants who had backgrounds in nurs- ing and patient care. Participants recruited for this study belonged to the same country as the participants of our focus group dis- cussion. But they belonged to two different institutions. Table 1 presents the demographic information of our participants. Our par- ticipants reported having experience in diverse specialization areas of healthcare like surgical nursing, interventional radiology, plas- tic and reconstructive surgery, pediatrics, orthopedics, preventive care, and others. Only one participant had explicit experience in preventive care of diabetes patients. Ten participants had at least one year of experience in looking after patients and having fre- quent direct interactions with patients. One of the participants was only involved in the training of nurses and did not have any active interaction with patients. 4.2 Procedure The study was conducted through semi-structured individual in- terviews that lasted between 45-70 minutes, that were recorded and transcribed. During each interview, we introduced our click- through prototype to our participants with brief contextual infor- mation. Our participants were first asked to explore the prototype, and then asked questions based on the four tasks (T1, T2, T3, T4) sup- ported by the prototype. Each question was followed by necessary follow-up questions about each visual component to understand how effective each component was for performing the given tasks. 4.3 Observation and Results As shown in Table 2, 6 participants failed to answer T3(Q2) and 5 failed to answer T4(Q1), thereby indicating that performing tasks T3 and T4 was difficult for our participants using this prototype. Also, for T1(Q2), 3 participants failed to answer correctly, and 1 participant could not answer T2(Q1). However, all our participants could successfully answer T1(Q1) and T3(Q1). Figure 2 shows the preferred visuals for each task and compares all the visual components based on understandability, usefulness, actionability, and trust based on the participant's responses. Al- though each visual was designed to support a specific set of tasks, it was observed that for all the tasks, there is a high preference for the Patient Summary (VC2) as the majority found it more in- formative because of the graphical representation of the data with clear color-coding. More than half of the participants considered all the visual components useful. But the textual patient information with the risk chart presented in VC1 is considered the most useful, followed by the graphical representation of patient data in VC2 and recommendations in VC4. In terms of actionability, VC2 and VC4 were considered the most actionable. VC1 was also considered the most trustworthy, while only 5 participants considered the risk recovery information in VC5 as trustworthy as the others either found it difficult to interpret or did not consider it important. We relate our observations with the following themes generated using our thematic analysis process. Visualizations facilitate quick understanding: All the participants were positive about the entire dashboard but the visual represen- tation of the patient records enabled them to understand the pa- tient's condition quickly. Most of them connected the usefulness and understandability of the visual components with graphical and color-coded representations. For example, P10 stated, "It's clearly indicated that the risk is high. I think it's very colorfully indicated and that's good because it looks like it's marked in colors from green, orange, and red". This justifies why the Patient Summary (VC2) was highly preferred by our participants. Including textual annotations can improve understandability: Al- though the Patient Summary VC2 was highly preferred, some par- ticipants expressed difficulty in interpreting the data-distribution charts in VC2: "I'm not sure about the distribution [in patient sum- mary] and what does that tell . . . what does the peak mean?"(P9). This justifies why many participants failed to answer T4(Q1) cor- rectly. They preferred more textual representation provided in VC1 Directive Explanations for Monitoring the Risk of Diabetes Onset IUI '23, March 27–31, 2023, Sydney, NSW, Australia Table 2: Observation from our first user study. The task-based questions are: T1(Q1): What is the overall risk for the patients? T1(Q2): Is the condition improving? T2(Q1): What actions can you suggest to the patient to reduce the risk? T3(Q1): Can you explain why the system is showing a high risk of diabetes? T3(Q2): Does the system allow you to see what happens if the blood sugar is less than six instead the current value (7.5)? T4(Q1): What can you tell about the health variables of the patient as compared to other patients? ✓denotes that the participant was successful in answering the questions, and × denotes they failed to answer. Visual component(s) used by them to successfully respond to the task-based questions are mentioned in brackets. T1 Q1 ✓{VC1} ✓{VC2, VC1} ✓{VC2} Q2 ✓{VC1, VC2, VC3, VC5} × ✓{VC2} P1 P2 P3 P4 ✓{VC1, VC2, VC3, VC4, VC5} ✓{VC1, VC2, VC3, VC4, VC5} P5 P6 P7 P8 P9 P10 P11 ✓{VC1, VC2} ✓{VC1, VC2} ✓{VC1} ✓{VC1, VC2, VC3} ✓{VC1, VC2} ✓{VC1, VC2, VC3, VC5} ✓{VC1} ✓{VC5} × ✓{VC5} ✓{VC5} ✓{VC2, VC3, VC5} ✓{VC1, VC2, VC3, VC5} × T2 Q1 ✓{VC4} × ✓{VC1, VC2} ✓{VC1, VC2, VC3} ✓{VC2, VC3, VC4} ✓{VC1, VC2, VC3, VC4} ✓{VC4} ✓{VC1, VC2, VC3, VC4} ✓{VC4} ✓{VC1, VC2, VC4} ✓{VC4} T3 Q1 ✓{VC2} ✓{VC2} ✓{VC1, VC2, VC4} ✓{VC2, VC3} ✓{VC3} ✓{VC3} ✓{VC1, VC2, VC3, VC4, VC5} ✓{VC1, VC2, VC3} ✓{VC1, VC2, VC3} ✓{VC1, VC2, VC3, VC5} ✓{VC1, VC2} Q2 ✓{VC1, VC2} × × × × ✓{VC2} ✓{VC2} ✓{VC2} × ✓{VC2} × T4 Q1 × ✓{VC2} ✓{VC2} × × ✓{VC1, VC2} × ✓{VC2} × ✓{VC2} ✓{VC2} Figure 2: Results from our qualitative evaluation of our low-fidelity prototype. (left) Chart showing the count of participants using the visual components for the task-based questions. (right) Comparison of each visual component in terms of under- standability, usefulness, actionability and trustworthiness by reported by the participants. and VC3. However, it is important to keep the balance between the amount of textual and graphical representations, as too much textual information can affect the usefulness of the visual: "I think it is very important [to have graphical representations] . . . not just numbers, as it should tell you what will happen with the numbers. It makes it likable and useful and easy to understand" (P6). While a lack of concise textual description can also impact the interpretation of the visual, like in the case of Risk Recovery (VC5), almost half of our participants, found it difficult to interpret "I don't know what it [risk recovery] means. I need more text and information on this" (P2). Interactive visuals increase the interpretability of explanation meth- ods: Most of our participants liked how they could interact with the dashboard to observe changes in the predicted risk: "Using it [interactions] you can show them [patients] if they have lower blood sugar, then what will happen. So, you are not just telling them, they can see how it improves their health" (P6), "I think that when you see that way if you reduce the blood sugar, how the graph is changing, it would be a motivation from them [patients]" (P5). Interactions allow them to explore and easily understand visual explanations. This indicates that exploration through interactive visuals can increase the interpretability of the method. On the contrary, less interactive visual like the Risk Recovery (VC5) was difficult to understand for our participants "I don't understand the risk recovery too well. That can be improved" (P3). As the interpretation of VC5 was not very clear to many, they failed to answer T1(Q2) correctly. However, we observed that the discoverability of interactions was very dif- ficult using the click-through prototype. This justifies why many participants failed to answer T3(Q2). Combination of visual components: It was observed that most participants combined two or more visuals to perform the given tasks. Particularly, we observed them combining multiple visuals when suggesting actions (T2). For interpreting the logic behind the predictions and drawing comparisons with other patients they mostly used the patient summary (VC2). Some of the participants mentioned all the visuals were useful, and it was hard for them to comment if a visual was more useful than others. Thus, they consid- ered the entire dashboard very useful, actionable, and trustworthy. P10 stated: "It's hard to say [which one is better] because I think all of them are very good. This [VC1] provides the basic information you need to know first. This [VC2] is like a really good summary because it shows you in detail what's going on with the patient . . . Well, here's the risk recovery, and you can see in the graph that risk is elevating. IUI '23, March 27–31, 2023, Sydney, NSW, Australia Bhattacharya, et al. From risk factors, I can figure out what increased risk. This [VC4] recommends how to reduce risks. So, I would say all of them combined have their own role". Association of trust with visualization and underlying data: None of the participants mentioned a lack of trust due to "complex algo- rithms". They could trust the system as they could see the reference patient data: "Yeah, I trust this not because it's generated by the computer, but the overall score is evidence-based [based on patient data]" (P9). When asked about why the system is predicting the risk of diabetes as high, all of them mentioned values of the health variables which were higher than the recommended ranges and mentioned the color-coding of red used to denote health factors that are not good for the patient: "[Risk is high] because you see the high-risk circle and a lot of things are in color red, and we also see that the blood sugar is 7.5, much higher than the recommended range. This is the biggest indicator of diabetes" (P11). So, their sense of trust is linked with the visual representation of the patient data. Moreover, lack of interpretation of the visuals (like for VC5) affects the overall trust and hence the usefulness of the visual. Like P2 and P3, even P11 did not consider the risk recovery visual trustworthy as they did not understand it: "I really don't know. It's something to do with months, so with time and the risk. What I don't know is what it should mean" (P11). Action recommendation based on data, risk predictions, and a pri- ori knowledge: For suggesting actions to reduce the risk of diabetes, most participants relied on the reference data and their interpre- tation of how the underlying patient data is related to the overall risk. Their ability to perform interactions with the patient data to observe changes in the predicted risk helped them to suggest ac- tions: "if the blood sugar is lower say 5.8, the overall risk is in orange and I see that risk is lower and so moderate" (P6). However, most of them used their a priori knowledge of the domain to suggest actions to minimize risk: "The highest risk is [due to] the blood sugar as we can see in the chart because the red level [from VC2] is the biggest and I would recommend a diet for the blood sugar" (P5). Even feature-importance-based VC3 and counterfactual-based recom- mendations provided in VC4 were less preferred for suggesting actions as they expressed the need to have additional information about the patient's diet, current medications, blood pressure, and other information not used by the ML model: "Something about the patient's diet is missing in this dashboard . . . nutrition is not included and whether the patient is taking a specific medication for diabetes or other reasons" (P4). However, we observed a higher preference for data-centric explanations provided through VC2 for action rec- ommendation compared to counterfactual explanations provided through VC4 as they considered the recommendations to be very generic and not personalized: "It [VC4] is useful. But it's like a general suggestion for everyone. I think they [patients] trust much more when we don't generalize them with another. This kind of recommendation would be too general for one patient" (P5). Patients as potential users: All our participants mentioned that our dashboard can be a useful tool for monitoring patient health conditions: "I think it will be great tool for the healthcare providers, because you can't remember everything. And if you have all the data combined in one platform, it will be very good and you can see the progress, the risk factors all at once. So, you don't have to put them together from the different lab results" (P8). Additionally, most of them considered the dashboard to be a good source of motivation for patients to create a better awareness of their health conditions: "Patients also need to see some graphs to realize that their health is not so good"(P3). However, they expressed some concern for older patients to directly use this dashboard: "The younger patients would use this but for the older patients I don't know" (P8). Even though our prototype was designed around the needs of HCPs, an interesting point of analyzing the patient's perspective was raised from their feedback. Thus, we included patients as participants along with HCPs during the evaluation of our high-fidelity prototype. 5 EVALUATION AND ANALYSIS OF HIGH-FIDELITY PROTOTYPE After analyzing the qualitative data collected from the previous study, we implemented a high-fidelity web application prototype de- veloped using Meteor, React.js, HTML, and CSS. The various charts used in our interactive dashboard are developed using Chart.js and the application is deployed using Docker. Fig. 3 presents a snap- shot of our high-fidelity prototype. The prototype was evaluated through an online user study in Prolific [42] as our recruitment platform and Qualtrics [59] as our survey platform. 5.1 Design Rationale From our first study, we observed that some of our participants found it difficult to discover the interactive components from our click-through prototype. Thus, we added icons as explicit indica- tors for the visuals which supported what-if interactions in our high-fidelity prototype. Additionally, we added tooltips with short descriptions for each visual component. Furthermore, the mouse cursor style was modified when the user hovered over the inter- active components for encouraging them to click and observe the changes in the interactive plots. As many participants found the Risk Recovery (VC5) difficult to interpret, we added interactive effects on hover that highlights the risk zones of the patient. We aimed to increase user exploration through interactions to increase understandability of this visual. We also observed that our participants in our first study found the Factors contributing to risk (VC3) to be less actionable than the patient summary (VC2) and Recommendations to reduce risk visual (VC4). Some of our participants suggested adding what- if interactions to VC3 for making it more actionable. Thus, we have considered this feedback and modified VC3 for supporting what-if interactions. Another feedback was received for simplifying the title of VC3 and so we renamed it Important Risk Factors. We also swapped the position of VC3 and VC4 in the high-fidelity prototype to improve the discoverability of the recommendations as suggested by our participants. Hence, we considered the feedback received through our ob- servation and participant responses during the evaluation of our click-through prototype to improve the design of our high-fidelity prototype to effectively meet our user requirements. 5.2 Participants This prototype was evaluated using 45 HCPs like nurses, physicians, and medical workers and 51 diabetic patients. We recruited patients who had been diagnosed with diabetes at least 6 months prior to Directive Explanations for Monitoring the Risk of Diabetes Onset IUI '23, March 27–31, 2023, Sydney, NSW, Australia Figure 3: Dashboard design of the high-fidelity web application prototype. Visual explanations are provided using: Patient information with the risk prediction chart (VC1), Patient Summary (VC2), Important Risk Factors (VC3), Recommendations to reduce risk (VC4), Risk Recovery (VC5). This is the modified version of the dashboard used for final evaluation. our experiment and HCPs' who were actively involved in patient care. Using Prolific, the recruited participants were compensated with an hourly rate of $10 for their time. Table 3a presents the demographic information of our HCP par- ticipants. Collectively, they had experience in dealing with all types of patients in any age group with both acute and chronic disor- ders (not just diabetes) from non-critical to critical nature. The demographic information of our patient participants is presented in Table 3b. All of our patient participants were actively in contact with their HCPs and they had awareness of the risk factors of type-2 diabetes. 5.3 Procedure We first gave an overview of the prototype to our participants and suggested them to explore it on their own. Then, they were given similar task-based questions as the previous study based on the four supported tasks (T1, T2, T3, T4) through an online questionnaire. Based on the information shown in our prototypical dashboard, our participants were asked to identify patients with the most critical condition, their current risk level, and whether their condition is improving or not for task T1. For T2, they were asked to suggest actions to reduce the high risk for a specific patient shown on our dashboard. For T3, they were asked to justify why the system indicated that a specific patient had a high risk while another had a low risk. Finally, for T4, they were asked to compare a specific patient's health factors with the recommended range of values for the health factor and with those of the other patients. Additionally, our participants had to justify their responses to the task-based questions. We also asked them to report their perception of the visual components in terms of understandability, usefulness and trustworthiness through 4-point Likert Scale questions. We in- cluded additional open-ended questions to gather more qualitative data about actionability of our dashboard and their motivation for using it. During the evaluation process, we categorized all the responses to the task-based questions into four categories: correct with suffi- cient justification, correct with insufficient justification, guess / unin- telligible and incorrect, similar to Lim et al. [33] as shown in Table 4. We recorded their overall response time and mouse-movements to track their interactions with our dashboard while answering the given questions. Furthermore, we analyzed the qualitative re- sponses about the actionability of our dashboard to understand why the participants found it actionable and which component is considered most actionable. Additionally, we categorized the quali- tative responses about motivation to use our dashboard as positive, negative or neutral to analyze their sentiments and understand the rationale behind their responses. IUI '23, March 27–31, 2023, Sydney, NSW, Australia Bhattacharya, et al. Table 3: Information of participants recruited for the evaluation of the high-fidelity prototype (a) HCPs Participant distribution United Kingdom (12/45) South Africa (8/45) Mexico (5/45) Poland (4/45) United States, Portugal (3/45) Chile (2/45) Finland, Sweden, Hungary, Israel, Canada, Spain, Italy, Germany (1/45) 17 : male 27 : female 1 : non-binary 26 : (21 - 30) years 11 : (31 - 40) years 2 : (41 - 50) years 6 : (51 - 60) years 1: Ph.D. 9 : Master's degree 35 : Bachelor's degree 12 : < 1-year 16 : (1 - 3) years 3 : (3 - 5) years 1 : (5 - 10) years 13 : > 10-years Country Gender Age group Highest education level Experience in patient care (b) Patients Country Gender Age group Highest education level Diabetes duration Participant distribution United States (17/51) South Africa (13/51) United Kingdom (8/51) Portugal (4/51) Spain (3/51) Poland (2/51) Czech Republic, Estonia, Norway, Italy (1/51) 27 : male 24 : female 1 : < 20-years 10 : (21 - 30) years 8 : (31 - 40) years 9 : (41 - 50) years 13 : (51 - 60) years 10 : > 60-years 5 : Master's degree 24 : Bachelor's degree 21 : High School degree 1 : Preferred not to disclose 2 : < 1-year 7 : (1 - 3) years 11 : (3 - 5) years 7 : (5 - 10) years 24 : > 10-years Table 4: Grading rubric considered during evaluation of the high-fidelity prototype. Correct with sufficient justification Correct with insufficient justification Correct response but with only some rules or extra, unnecessary rules Correct response with all correct rules and no extra, unnecessary rules Guess/unintelligible Incorrect Correct response but with no reason, or with wrong interpretation of the visual(s) Failed to give correct responses We performed hypothesis testing with one-proportion z-test at 5% significance level [39] to measure the statistical significance of the correct responses to the task-based questions. We aimed to achieve to a success rate of 80% for the tasks supported by our dashboard. Thus, our null hypothesis (H0) was that 80% of the par- ticipants giving correct responses, while our alternate hypothesis (HA) is more than 80% giving correct responses. We further noted the proportion of participants giving correct responses with suffi- cient and insufficient justifications. We used descriptive statistics for the evaluation of the remaining questions considering their format instead of hypothesis testing. 5.4 Observation and Results HCP participants: We observed that 41 HCPs (91.1%) gave correct responses for T1 questions (z =2.619, p= 0.0044). It was observed that 84.4% of them provided sufficient justifications, while only 6.67% HCPs failed to provide sufficient justifications to their correct responses. They mostly used the risk recovery visual to perform this task. For questions asked for task T2, all 45 HCPs gave correct responses (z=∞, p=0.00). However, 31.1% of them failed to provide sufficient justifications. For task T3, 43 HCPs (95.56%) gave correct responses (z=5.064, p=0.00). But only 4.4% of the correct responses did not include sufficient justifications. Although most of them reported using the patient summary (VC2) to perform tasks T3 and T4, we observed them combining multiple visuals like VC2, VC3 and VC4. This indicates that the participants preferred combining different explanation methods, i.e. data-centric, feature-importance, and counterfactual explanations when suggesting actions and un- derstanding the rationale behind the predicted risk. For T4, 33 HCPs (73.3%) gave correct responses (z=-1.011, p=0.8441), out of which 11.1% did not include sufficient justifications. They mostly used VC2 to perform this task. We only failed to reject H0 for task T4, even though we observed a high proportion (73.3%) of the HCP participants giving correct re- sponses. For other tasks, we rejected H0, suggesting that more than 80% of HCPs can perform these tasks correctly. On investigating the reason why 9 HCPs (20%) gave incorrect answers to T4 questions, we observed that unlike the majority of the HCPs who used the patient summary (VC2), they used the patient information provided in VC1 to manually compare different patient records by using the patient id filter. This involved many interactions and it was not convenient to perform the comparisons manually. Therefore, many of them failed to give the correct responses. Fig. 4 illustrates visual Directive Explanations for Monitoring the Risk of Diabetes Onset IUI '23, March 27–31, 2023, Sydney, NSW, Australia Figure 4: Results obtained from the responses of the HCP participants. (left) Responses are categorized according to the grading rubric in Table 4 for the tasks supported. (right) Chart showing the count of the participants using the visual components to answer the task-based questions. Figure 5: Diverging bar-charts summarizing the self-reported Likert-scale responses of the HCP group components used by HCPs for all the task-based questions and gives an overview of their responses to all the tasks. Fig. 5 illustrates the self-reported responses to the Likert-scale questions about understandability, usefulness, and trustworthiness of the visual components of the HCP group. This group found the Patient Summary (VC2) the easiest to understand and the most useful. For trustworthiness, the HCPs found VC1 to be most trust- worthy. Table 5 presents the proportion of participants for each self-reported Likert scale question for both groups. The majority (64.4%) of the HCPs considered VC2 as the most actionable. They mentioned that the color-coded and graphical rep- resentation of the health variables helped them to easily identify risk factors that need immediate attention for suggesting actions. However, most of them mentioned using two or more visuals to- gether for suggesting actions and understanding the logic behind the predicted risk. For instance, one of the participants mentioned: "Given the patient summary it would make it easier to address the most pressing risk factors for a patient and what they need to work on at most". For the motivation of using our dashboard, 44 HCPs (97.7%) responded positively for using it as a screening tool during their consultation with patients. They mentioned about using our dash- board to show the risk levels and create more awareness for the patients. Patient participants : We observed that 39 patients (76.5%) gave correct responses to T1 questions (z=-0.594, p=0.724). Despite 62.7% of them giving sufficient justification for their correct responses, we failed to reject H0. But as 45 of them (88.2%) could answer T2 questions correctly (z=1.825, p=0.034), we could reject H0. However, we observed 43.14% of them failed to give sufficient justification for their correct responses. On investigating further, we observed that 58% of the older patients (>50 years) failed to give sufficient explanations for T2 questions, indicating their understanding of the visual components used to recommend actions was not fully correct. Like T2 questions, 45 of them (88.2%) could answer T3 questions correctly (z=1.825, p=0.034). So, we could reject H0 for T3 questions. But we observed 66.67% of them giving sufficient justifications, while 21.57% gave insufficient justification for their correct responses. For T4, we observed only 33 (64.7%) could give correct responses (z=-2.286, p=0.98). Despite 54.9% of them giving sufficient justification for their correct responses, we failed to re- ject H0. Additionally, we observed that most older patients (>50 years) struggled with T4 as 50% of the older patients failed to give IUI '23, March 27–31, 2023, Sydney, NSW, Australia Bhattacharya, et al. Figure 6: Results obtained from the responses of the patient participants. (left) Responses are categorized according to the grad- ing rubric in Table 4 for the tasks supported. (right) Chart showing the count of the participants using the visual components to answer the task-based questions. Figure 7: Diverging bar-charts summarizing the self-reported Likert-scale responses of the patient group Table 5: Results showing the proportion of participants for the self reported responses to 4-point Likert Scale questions about Understandability, Usefulness, Trustworthiness Understandability Very Easy to Understand Somewhat Easy to Understand Somewhat Difficult to Understand Very Difficult to Understand Usefulness Trustworthiness Always Useful Sometimes Useful Rarely Useful Never Useful Always Trust Sometimes Trust Rarely Trust Never Trust VC1 VC2 VC3 VC4 VC5 HCPs Patients HCPs Patients HCPS Patients HCPS Patients HCPs Patients 55.5% 62.7% 42.2% 31.3% 1.9% 0% 3.9% 2.2% 78.4% 60% 33.3% 15.6% 1.9% 6.6% 3.9% 0% 66.6% 74.5% 31.1% 19.6% 1.9% 2.2% 3.9% 0% 64.4% 64.7% 33.3% 29.4% 1.9% 2.2% 3.9% 0% 77.7% 74.5% 19.6% 20% 1.9% 2.2% 3.9% 0% 68.8% 78.4% 24.4% 17.6% 6.6% 0% 0% 3.9% 60% 58.8% 33.3% 31.3% 5.8% 6.6% 3.9% 0% 66.6% 70.5% 24.4% 19.6% 5.8% 8.8% 3.9% 0% 64.4% 68.6% 33.3% 23.5% 3.9% 2.2% 3.9% 0% 62.2% 64.7% 33.3% 29.4% 1.9% 2.2% 3.9% 2.2% 60% 40% 0% 0% 66.6% 25.4% 1.9% 5.8% 57.7% 66.6% 33.3% 23.5% 5.8% 8.8% 3.9% 0% 46.7% 50.9% 33.3% 40% 9.8% 8.8% 5.8% 4.4% 48.8% 58.8% 40% 19.6% 11.1% 11.7% 9.8% 0% 51.1% 58.8% 42.2% 25.4% 9.8% 6.6% 5.8% 0% sufficient explanations for T4 questions. Fig. 6 illustrates visual components used by the patients for all the task-based questions and gives an overview of their responses to all the tasks. Figure 7 illustrates the responses of the patient group to the Likert-scale questions about understandability, usefulness and trust- worthiness of the visual components. This group found both VC2 and VC3 as the easiest to understand as compared to other visuals. However, they found VC1 to be the most useful and VC2 to be most trustworthy. We observed the majority (68.6%) of the patients also considered VC2 as the most actionable as they could easily identify the high- risk factors similar to the HCP group. Like the HCPs, even this group had mentioned combining multiple visuals together for all the given tasks. For instance, one of the patient participants mentioned: "The 'Recommendations to reduce risk gives precise ways to reduce my risk Directive Explanations for Monitoring the Risk of Diabetes Onset IUI '23, March 27–31, 2023, Sydney, NSW, Australia of diabetes. The 'Patient Summary' section showed me areas where my behavior, such as physical exercise, was too low in certain areas". We observed that 48 patients (94.11%) responded positively when asked about their motivation to use this dashboard. Most of them mentioned interactive explanations increased their motivation as they could see how the risk changes on changing the values of the health variables. 6 DISCUSSION 6.1 Key Takeaways From Our User Studies From our first user study, we collected feedback on the design of our visually directive explanation methods from HCPs. We used their feedback to make design changes discussed in Section 5.1 for our web application prototype. We also collected an early indication of the usefulness, understandability, actionability and trustworthiness of the visual components from our participants. In our second study, we collected data from a larger pool of participants to validate our observations from the previous study. The web application used in our second study was interactive and enabled our participants to give better feedback. Also, the feedback collected from patients along with HCPs helped us to justify the effectiveness of our explanation methods included in our dashboard. Results from our second study indicate that a significant propor- tion of HCPs could successfully perform all the given tasks. Most of them could provide sufficient justifications for their correct re- sponses irrespective of their age group, domain expertise, or years of experience in patient care. However, we observed older patients (> 50 years) struggled with tasks for suggesting actions to reduce risk (T2) and comparing their health measures with that of other patients (T4). Further simplifications may be needed for this user group. Overall, our participants used data-centric explanation based patient summary (VC2) and patient information (VC1) more than other visuals for all the tasks. While explaining their responses, most of them compared the current health measures with the rec- ommended values of health variables. Color-coded representations were considered more useful than graphical representations of the data. This indicates that color-coded and interactive data-centric explanations form a vital part of our explanation dashboard for both HCPs and patients. Unlike the HCPs, we observed a high proportion of patients (68.6%) using the counterfactual-based recommendations (VC4) for suggesting actions to minimize risk (T2). Some of them mentioned that for getting quick suggestions, they preferred the recommenda- tion list. But to get more detail on how these recommendations are helpful, they relied on data-centric explanations. Moreover, both HCPs and patients have mentioned combining multiple visual components, especially for suggesting actions to minimize high risk and understanding the rationale behind the predicted risk. This suggests that the limitations of any explanation method included in our dashboard can be complemented by the other methods. 6.2 Addressing the Research Questions RQ1. In what ways do patients and HCPs find our visually directive explanation dashboard useful for monitoring and evaluating the risk of diabetes onset? – Our results indicate that both HCPs and patients found our explanation dashboard very useful for monitoring and evaluating the risk of diabetes onset. As inferred from our user studies, the interactive visual components enabled our participants to explore and unravel the rationale behind the predicted risk. They mentioned that interactive and directive visuals, that show how the predicted risk changes when changing the health variables, are useful to create more awareness for the patients and drive change in their behavior. RQ2. In what ways do HCP and patients perceive data- centric, model-centric, and example-based visually directive explanations in terms of usefulness, understandability, and trustworthiness in the context of healthcare? – It was observed that most of our participants justified the rationale behind the pre- dicted risk by referring to the underlying patient data used for training the ML model and its color-coded visual representations. They mentioned about trusting the predictions as they could easily relate the prediction with the underlying data. Thus, we get an indication that data-centric explanations are more trustworthy and useful than commonly adopted model-centric feature-importance explanations, especially in healthcare. However, as they mentioned using a combination of visual com- ponents together, the significance of feature-importance explana- tions cannot be neglected. Additionally, our participants have men- tioned that the what-if interactions enabled them to explore our dashboard and develop a better understanding of the visual ex- planations. Also, our participants found the example-based coun- terfactual explanations important and useful when they wanted explanations in the form of recommendations. Furthermore, our participants have shown a higher usage of our representation of data-centric explanations through the pa- tient summary (VC2) for performing given tasks and actions over other explanation methods as they found them more informative. However, in general, it was observed that more visual, interactive explanations with reference to the recommended range of data having concise textual descriptions are more useful to both HCPs and patients. RQ3. In what ways do visually directive explanations fa- cilitate patients and HCPs to take action for improving pa- tient conditions? – Patients reported that interactive explana- tions increased their motivation of using our dashboard as a self- screening tool as they could see how the risk changes on changing the health variables. While HCPs wanted to use this dashboard for better communication with patients during their consultations. They found our dashboard to be actionable and useful as they can utilize it for guiding patients in improving their health by showing the high-risk factors. From the qualitative data collected through our user studies, we inferred that the interactive visual explana- tions enabled both HCPs and patients to explore how to alter the predicted outcome along with explaining the factors that could affect the predictions. 6.3 Tailoring Directive Explanations for Healthcare Experts We share our design implications for tailoring the visual represen- tation of directive explanations for healthcare experts from our IUI '23, March 27–31, 2023, Sydney, NSW, Australia Bhattacharya, et al. observations and results. Our design implications are aligned with the recommendations from Wang et al.'s framework [57]. Increasing actionability through interactive what-if analysis: Dur- ing the evaluation of our low-fidelity prototype, our participants highlighted that the conventional representation of feature-importance explanations (as illustrated by factors contributing to risk visual in Figure 1) was less actionable than data-centric explanations pre- sented through the patient summary (VC2) as it was difficult for them to understand how the risk factors affected the predicted risk. Our modified design of this visual component (VC3) used in our high-fidelity prototype enabled them to perform interactive what-if analysis, i.e. allowed them to change the feature values and observe the change in the overall prediction. Hence, we recommend the usage of interactive design elements that allows what-if analysis for representing directive explanations for HCPs. This recommen- dation also supports hypothesis generation as proposed by Wang et al. [57] Explanations through actionable features instead of non-actionable features: In our approach, we included only actionable variables for visual components which supports what-if interactions and better identification of coherent factors [57]. We anticipated that allowing the ability to alter values of non-actionable variables can create confusion for HCPs, especially for representing counterfactual ex- planations. Thus, we propose providing explanations through ac- tionable variables for suggesting actions that the user can perform to obtain their desired outcomes. Color-coded visual indicators: HCPs indicated that the color- coded representations of risk factors were very useful for getting quick insights. Hence, we recommend the usage of color-coded representations and visual indicators to highlight factors that can increase or decrease the predictor variable. This suggestion further facilitates Wang et al.'s recommendation [57] of identifying coherent factors. Data-centric directive explanations: HCPs indicated that our rep- resentation of data-centric explainability through the patient sum- mary was very informative. They could easily identify how good or bad the risk factors are for a specific patient. Additionally, they could get an overview of how other patients are doing as compared to a specific patient through the data-distribution charts. Thus, our representation of data-centric explainability provided a local expla- nation but with a global perspective. This suggestion is also aligned with the recommendations from Wang et al. [57] as data-centric di- rective explanations support forward reasoning by providing access to source and situational data and yet can be easily integrated with multiple explanation methods. 6.4 Limitations and Future Work In this section, we articulated some limitations of this work: (1) Our prototype used offline predictions about the overall risk generated by our model instead of real-time predictions. The use of other ML algorithms with real-time inference processes might impact the perceived utility of the tool. (2) The prototype was evaluated with HCPs with backgrounds in diverse specializations. Even though we were able to reach a wider population, it would be more helpful to evaluate this prototype with HCPs who are dedicated to taking care of patients with type-2 diabetes. (3) The importance of different explanation methods was examined jointly as part of the dashboard and not analyzed independently. Consequently, the limitations of some of the explanation methods could be concealed by the benefits of other methods. (4) Since the prototype was personalized for monitoring the risk of diabetes onset, the findings from this research may not be applicable for monitoring other diseases as the user needs for other diseases can be very distinct. In our future studies, we aim to focus on personalizing directive counterfactual explanations, as our participants had expressed a need for a better representation of such explanations. Additionally, we plan to analyze the utility of different explanation methods used in the dashboard in isolation. 7 CONCLUSION In this research work, we present a directive explanation dash- board that combines visually represented data-centric, feature- importance, and counterfactual explanations for monitoring the risk of diabetes onset. Our research compared the different visual expla- nations in terms of understandability, usefulness, actionability, and trustworthiness with healthcare experts and patients. Our partici- pants have shown a higher preference for the visually represented data-centric explanations that provided local explanations with a global overview, over other methods. Especially, we observed that the color-coded risk factors and data-distribution charts in our visu- ally directive data-centric explanations assisted healthcare experts in suggesting actions to reduce risk by easily identifying high-risk factors. Based on our results, we suggest using such data-centric explanations combined with other explanations. We hope our re- sults will inspire other researchers to utilize such visually directive explanations to other specialization areas in healthcare as well. ACKNOWLEDGMENTS We would like to thank Oscar Alvarado, Robin De Croon, Maxwell Szymanski, Houda Lamqaddam and Diego Rojo for providing help- ful comments that improved this text. We also thank Lucija Gosak for helping us with participant recruitment for our first user study. This work was supported by Research Foundation–Flanders (FWO, grant G0A3319N) and KU Leuven Internal Funds (grant C14/21/072). REFERENCES [1] Ashraf Abdul, Jo Vermeulen, Danding Wang, Brian Y. Lim, and Mohan Kankan- halli. 2018. Trends and Trajectories for Explainable, Accountable and Intel- ligible Systems: An HCI Research Agenda. In Proceedings of the 2018 CHI Conference on Human Factors in Computing Systems (Montreal QC, Canada) (CHI '18). Association for Computing Machinery, New York, NY, USA, 1–18. https://doi.org/10.1145/3173574.3174156 [2] Amina Adadi and Mohammed Berrada. 2018. Peeking Inside the Black-Box: A Survey on Explainable Artificial Intelligence (XAI). IEEE Access 6 (2018), 52138– 52160. https://doi.org/10.1109/ACCESS.2018.2870052 [3] Ariful Islam Anik and Andrea Bunt. 2021. Data-Centric Explanations: Explain- ing Training Data of Machine Learning Systems to Promote Transparency. In Proceedings of the 2021 CHI Conference on Human Factors in Computing Systems (Yokohama, Japan) (CHI '21). Association for Computing Machinery, New York, NY, USA, Article 75, 13 pages. https://doi.org/10.1145/3411764.3445736 [4] Anna Markella Antoniadi, Yuhan Du, Yasmine Guendouz, Lan Wei, Claudia Mazo, Brett A. Becker, and Catherine Mooney. 2021. Current Challenges and Future Opportunities for XAI in Machine Learning-Based Clinical Decision Support Systems: A Systematic Review. Applied Sciences 11, 11 (2021). https://doi.org/10. 3390/app11115088 [5] Aditya Bhattacharya. 2022. Applied Machine Learning Explainability Techniques. In Applied Machine Learning Explainability Techniques. Packt Publishing, Birm- ingham, UK. https://www.packtpub.com/product/applied-machine-learning- Directive Explanations for Monitoring the Risk of Diabetes Onset IUI '23, March 27–31, 2023, Sydney, NSW, Australia explainability-techniques/9781803246154 https://doi.org/10.1007/s11257-019-09247-2 [6] Clara Bove, Jonathan Aigrain, Marie-Jeanne Lesot, Charles Tijus, and Marcin Detyniecki. 2022. Contextualization and Exploration of Local Feature Importance Explanations to Improve Understanding and Satisfaction of Non-Expert Users (IUI '22). Association for Computing Machinery, New York, NY, USA, 807–819. https://doi.org/10.1145/3490099.3511139 [7] Virginia Braun and Victoria Clarke. 2012. Thematic Analysis. In APA Handbook of Research Methods in Psychology, Vol 2: Research Designs: Quantitative, Quali- tative, Neuropsychological, and Biological. American Psychological Association, Washington, DC, US, 57–71. https://doi.org/10.1037/13620-004 [8] Adrian Bussone, Simone Stumpf, and Dympna O'Sullivan. 2015. The Role of Explanations on Trust and Reliance in Clinical Decision Support Systems. https: //doi.org/10.1109/ICHI.2015.26 [9] Carrie J. Cai, Emily Reif, Narayan Hegde, Jason Hipp, Been Kim, Daniel Smilkov, Martin Wattenberg, Fernanda Viegas, Greg S. Corrado, Martin C. Stumpe, and Michael Terry. 2019. Human-Centered Tools for Coping with Imperfect Algo- rithms during Medical Decision-Making. https://doi.org/10.48550/ARXIV.1902. 02960 [10] Gabriella Casalino, Giovanna Castellano, Vincenzo Pasquadibisceglie, and Gi- anluca Zaza. 2018. Contact-Less Real-Time Monitoring of Cardiovascular Risk Using Video Imaging and Fuzzy Inference Rules. Information 10 (12 2018), 9. https://doi.org/10.3390/info10010009 [11] Hao Fei Cheng, Ruotong Wang, Zheng Zhang, Fiona O'Connell, Terrance Gray, F. Maxwell Harper, and Haiyi Zhu. 2019. Explaining Decision-Making Algorithms through UI: Strategies to Help Non-Expert Stakeholders. Proceedings of the 2019 CHI Conference on Human Factors in Computing Systems (2019). [12] Hwayoung Cho, Gail Keenan, Olatunde O Madandola, Fabiana Cristina Dos San- tos, Tamara G R Macieira, Ragnhildur I Bjarnadottir, Karen J B Priola, and Karen Dunn Lopez. 2022. Assessing the Usability of a Clinical Decision Support System: Heuristic Evaluation. JMIR Hum Factors 9, 2 (10 May 2022), e31758. https://doi.org/10.2196/31758 [13] Richard Dazeley, Peter Vamplew, Cameron Foale, Charlotte Young, Sunil Aryal, and Francisco Cruz. 2021. Levels of explainable artificial intelligence for human- aligned conversational explanations. Artificial Intelligence 299 (2021), 103525. [14] Figma. 2022. . Figma. https://www.figma.com/ Accessed: 2022-08-25. [15] Luis Fregoso-Aparicio, Julieta Noguez, Luis Montesinos, and José García-García. 2021. Machine learning and deep learning predictive models for type 2 diabetes: a systematic review. Diabetology and Metabolic Syndrome 13 (12 2021). https: //doi.org/10.1186/s13098-021-00767-9 [16] Stephanie Galaitsi, Benjamin D. Trump, Jeffrey M. Keisler, Igor Linkov, and Alexander Kott. 2022. Cybertrust: From Explainable to Actionable and Inter- pretable AI (AI2). (2022). https://doi.org/10.48550/ARXIV.2201.11117 [17] Fatih Gedikli, Dietmar Jannach, and Mouzhi Ge. 2013. How should I explain? A comparison of different explanation types for recommender systems. Interna- tional Journal of Human-Computer Studies 72 (01 2013). https://doi.org/10.1016/j. ijhcs.2013.12.007 [18] Oscar Gomez, Steffen Holter, Jun Yuan, and Enrico Bertini. 2020. ViCE: Visual Counterfactual Explanations for Machine Learning Models. https://doi.org/10. 48550/ARXIV.2003.02428 [19] Stefan Grafberger, Paul Groth, and Sebastian Schelter. 2022. Towards Data- Centric What-If Analysis for Native Machine Learning Pipelines. In Proceedings of the Sixth Workshop on Data Management for End-To-End Machine Learning (Philadelphia, Pennsylvania) (DEEM '22). Association for Computing Machinery, New York, NY, USA, Article 3, 5 pages. https://doi.org/10.1145/3533028.3533303 [20] Francisco Gutiérrez, Nyi Nyi Htun, Vero Vanden Abeele, Robin De Croon, and Katrien Verbert. 2022. Explaining Call Recommendations in Nursing Homes: A User-Centered Design Approach for Interacting with Knowledge-Based Health Decision Support Systems. In 27th International Conference on Intelligent User Interfaces (Helsinki, Finland) (IUI '22). Association for Computing Machinery, New York, NY, USA, 162–172. https://doi.org/10.1145/3490099.3511158 [21] Robert R. Hoffman, Shane T. Mueller, Gary Klein, and Jordan Litman. 2018. Metrics for Explainable AI: Challenges and Prospects. https://doi.org/10.48550/ ARXIV.1812.04608 [22] Frederick Hohman, Andrew Head, Rich Caruana, Robert Deline, and Steven Drucker. 2019. Gamut: A Design Probe to Understand How Data Scientists Understand Machine Learning Models. , 13 pages. https://doi.org/10.1145/ 3290605.3300809 [23] Andreas Holzinger, Chris Biemann, Constantinos S. Pattichis, and Douglas B. Kell. 2017. What do we need to build explainable AI systems for the medical domain? https://doi.org/10.48550/ARXIV.1712.09923 [24] Sheikh Rabiul Islam, William Eberle, Sheikh Khaled Ghafoor, and Mohiuddin Ahmed. 2021. Explainable Artificial Intelligence Approaches: A Survey. (2021). https://doi.org/10.48550/ARXIV.2101.09429 [25] Liu Jiang, Shixia Liu, and Changjian Chen. 2018. Recent Research Advances on Interactive Machine Learning. (2018). https://doi.org/10.48550/ARXIV.1811.04548 [26] Yucheng Jin, Nava Tintarev, Nyi Nyi Htun, and Katrien Verbert. 2020. Effects of personal characteristics in control-oriented user interfaces for music rec- ommender systems. User Modeling and User-Adapted Interaction 30 (04 2020). [27] Alessandro Blasimme Julia Amann, Dietmar Frey Effy Vayena, and Vince I. Madai on behalf of the Precise4Q consortium. 2022. Explainability for artificial intelli- gence in healthcare: a multidisciplinary perspective. BMC Medical Informatics and Decision Making (2022). https://doi.org/10.1186/s12911-020-01332-6 [28] Amir-Hossein Karimi, Bernhard Schölkopf, and Isabel Valera. 2020. Algorithmic Recourse: from Counterfactual Explanations to Interventions. https://doi.org/ 10.48550/ARXIV.2002.06278 [29] Josua Krause, Adam Perer, and Kenney Ng. 2016. Interacting with Predictions: , 5686-5697 pages. Visual Inspection of Black-box Machine Learning Models. https://doi.org/10.1145/2858036.2858529 [30] Todd Kulesza, Margaret Burnett, Weng-Keen Wong, and Simone Stumpf. 2015. Principles of Explanatory Debugging to Personalize Interactive Machine Learning. In Proceedings of the 20th International Conference on Intelligent User Interfaces (Atlanta, Georgia, USA) (IUI '15). Association for Computing Machinery, New York, NY, USA, 126–137. https://doi.org/10.1145/2678025.2701399 [31] Markus Langer, Daniel Oster, Timo Speith, Holger Hermanns, Lena Kästner, Eva Schmidt, Andreas Sesing, and Kevin Baum. 2021. What do we want from Explainable Artificial Intelligence (XAI)? – A stakeholder perspective on XAI and a conceptual model guiding interdisciplinary XAI research. Artificial Intelligence 296 (jul 2021), 103473. https://doi.org/10.1016/j.artint.2021.103473 [32] Q. Vera Liao, Daniel Gruen, and Sarah Miller. 2020. Questioning the AI: Informing (2020), 1–15. https: Design Practices for Explainable AI User Experiences. //doi.org/10.1145/3313831.3376590 [33] Brian Y. Lim, Anind K. Dey, and Daniel Avrahami. 2009. Why and Why Not Explanations Improve the Intelligibility of Context-Aware Intelligent Systems (CHI '09). Association for Computing Machinery, New York, NY, USA, 2119–2128. https://doi.org/10.1145/1518701.1519023 [34] Scott Lundberg and Su-In Lee. 2017. A Unified Approach to Interpreting Model Predictions. (2017). https://doi.org/10.48550/ARXIV.1705.07874 [35] Mark Mazumder, Colby Banbury, Xiaozhe Yao, Bojan Karlaš, William Gaviria Rojas, Sudnya Diamos, Greg Diamos, Lynn He, Douwe Kiela, David Jurado, David Kanter, Rafael Mosquera, Juan Ciro, Lora Aroyo, Bilge Acun, Sabri Eyuboglu, Amirata Ghorbani, Emmett Goodman, Tariq Kane, Christine R. Kirkpatrick, Tzu- Sheng Kuo, Jonas Mueller, Tristan Thrush, Joaquin Vanschoren, Margaret Warren, Adina Williams, Serena Yeung, Newsha Ardalani, Praveen Paritosh, Ce Zhang, James Zou, Carole-Jean Wu, Cody Coleman, Andrew Ng, Peter Mattson, and Vi- jay Janapa Reddi. 2022. DataPerf: Benchmarks for Data-Centric AI Development. https://doi.org/10.48550/ARXIV.2207.10062 [36] Ninareh Mehrabi, Fred Morstatter, Nripsuta Saxena, Kristina Lerman, and Aram Galstyan. 2019. A Survey on Bias and Fairness in Machine Learning. (2019). https://doi.org/10.48550/ARXIV.1908.09635 [37] Tim Miller. 2017. Explanation in Artificial Intelligence: Insights from the Social Sciences. https://doi.org/10.48550/ARXIV.1706.07269 [38] Ramaravind K Mothilal, Amit Sharma, and Chenhao Tan. 2020. Explaining machine learning classifiers through diverse counterfactual explanations. In Proceedings of the 2020 Conference on Fairness, Accountability, and Transparency. 607–617. [39] Department of Statistics. 2022. Statistics Online S.6 Test of Proportion. PennState https://online.stat.psu.edu/statprogram/reviews/ Eberly College of Science. statistical-concepts/proportions Accessed: 2022-08-30. [40] Jeroen Ooge and Katrien Verbert. 2022. Explaining Artificial Intelligence with , 120-123 pages. https://doi.org/10.1145/ Tailored Interactive Visualisations. 3490100.3516481 [41] Urja Pawar, Donna O'Shea, Susan Rea, and Ruairi O'Reilly. 2020. Incorporating Explainable Artificial Intelligence (XAI) to aid the Understanding of Machine Learning in the Healthcare Domain. [42] Prolific Platform. 2022. . Prolific. https://www.prolific.co/ Accessed: 2022-08-15. [43] Sreekanth Rallapalli. 2016. Improving Healthcare-Big Data Analytics for Elec- tronic Health Records on Cloud. Journal of Advances in Information Technology 7, 1 (2016), 65–68. https://doi.org/10.12720/jait.7.1.65-68 [44] Marco Tulio Ribeiro, Sameer Singh, and Carlos Guestrin. 2016. "Why Should https: I Trust You?": Explaining the Predictions of Any Classifier. //doi.org/10.48550/ARXIV.1602.04938 (2016). [45] Abdallah Abbas Ritvij Singh, Edward Korot Sara Beqiri, Peter Woodward-Court Robbert Struyven, and Pearse Keane. 2021. Exploring the What-If-Tool as a solu- tion for machine learning explainability in clinical practice. Invest. Ophthalmol. Vis. Sci. 2021;62(8):79. (2021). [46] Diego Rojo, Nyi Nyi Htun, Denis Parra, Robin De Croon, and Katrien Verbert. 2021. AHMoSe: A knowledge-based visual support system for selecting regression machine learning models. Computers and Electronics in Agriculture 187 (aug 2021), 106183. https://doi.org/10.1016/j.compag.2021.106183 [47] Sheila A Ryan. 1985. An expert system for nursing practice. Journal of medical systems 9, 1 (1985), 29–41. [48] Waddah Saeed and Christian Omlin. 2021. Explainable AI (XAI): A Systematic Meta-Survey of Current Challenges and Future Opportunities. (2021). https: //doi.org/10.48550/ARXIV.2111.06420 IUI '23, March 27–31, 2023, Sydney, NSW, Australia Bhattacharya, et al. [49] Ronal Singh, Paul Dourish, Piers Howe, Tim Miller, Liz Sonenberg, Eduardo Vel- loso, and Frank Vetere. 2021. Directive Explanations for Actionable Explainability in Machine Learning Applications. (2021). https://doi.org/10.48550/ARXIV.2102. 02671 [50] Kacper Sokol and Peter Flach. 2020. Explainability fact sheets. In Proceedings of the 2020 Conference on Fairness, Accountability, and Transparency. ACM. https: //doi.org/10.1145/3351095.3372870 [51] Alexander Spangher and Berk Ustun. 2018. Actionable Recourse in Linear Classi- fication. https://doi.org/10.1145/3287560.3287566 [52] Thilo Spinner, Udo Schlegel, Hanna Hauptmann, and Mennatallah El-Assady. 2019. explAIner: A Visual Analytics Framework for Interactive and Explainable Machine Learning. (07 2019). [53] Gregor Stiglic, P Kocbek, Leona Cilar Budler, Nino Fijacko, Andraz Stozer, Jelka Zaletel, Aziz Sheikh, and Petra Povalej. 2018. Development of a screening tool using electronic health records for undiagnosed Type 2 diabetes mellitus and impaired fasting glucose detection in the Slovenian population. Diabetic medicine : a journal of the British Diabetic Association 35 (02 2018). https://doi.org/10.1111/ dme.13605 [54] Gregor Stiglic, Primoz Kocbek, Nino Fijacko, Marinka Zitnik, Katrien Verbert, and Leona Cilar. 2020. Interpretability of machine learning-based prediction models in healthcare. Wiley Interdisciplinary Reviews: Data Mining and Knowledge Discovery 10, 5 (2020), e1379. [55] Maxwell Szymanski, Martijn Millecamp, and Katrien Verbert. 2021. Visual, textual or hybrid: the effect of user expertise on different explanations. 26th International Conference on Intelligent User Interfaces (2021). [56] Erico Tjoa and Cuntai Guan. 2021. A Survey on Explainable Artificial Intelligence (XAI): Toward Medical XAI. IEEE Transactions on Neural Networks and Learning Systems 32, 11 (nov 2021), 4793–4813. https://doi.org/10.1109/tnnls.2020.3027314 [57] Danding Wang, Qian Yang, Ashraf Abdul, and Brian Y. Lim. 2019. Designing Theory-Driven User-Centric Explainable AI (CHI '19). Association for Computing Machinery, New York, NY, USA, 1–15. https://doi.org/10.1145/3290605.3300831 [58] James Wexler, Mahima Pushkarna, Tolga Bolukbasi, Martin Wattenberg, Fernanda Viegas, and Jimbo Wilson. 2019. The What-If Tool: Interactive Probing of Machine Learning Models. IEEE Transactions on Visualization and Computer Graphics PP (08 2019), 1–1. https://doi.org/10.1109/TVCG.2019.2934619 [59] Qualtrics XM. 2022. . Qualtrics. https://www.qualtrics.com/ Accessed: 2022-08- 15.
http://arxiv.org/abs/2302.10669v2
2023-03-07T13:06:51
2023-02-21T13:39:40
UAV Path Planning Employing MPC- Reinforcement Learning Method Considering Collision Avoidance
In this paper, we tackle the problem of Unmanned Aerial (UA V) path planning in complex and uncertain environments by designing a Model Predictive Control (MPC), based on a Long-Short-Term Memory (LSTM) network integrated into the Deep Deterministic Policy Gradient algorithm. In the proposed solution, LSTM-MPC operates as a deterministic policy within the DDPG network, and it leverages a predicting pool to store predicted future states and actions for improved robustness and efficiency. The use of the predicting pool also enables the initialization of the critic network, leading to improved convergence speed and reduced failure rate compared to traditional reinforcement learning and deep reinforcement learning methods. The effectiveness of the proposed solution is evaluated by numerical simulations.
[ "Mahya Ramezani", "Hamed Habibi", "Jose luis Sanchez Lopez", "Holger Voos" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10669v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10669v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI", "cs.RO" ]
UAV Path Planning Employing MPC- Reinforcement Learning Method Considering Collision Avoidance Hamed Habibi Centre for Security, Reliability, and Trust University of Luxembourg Luxembourg, Luxembourg [email protected] Jose Luis Sanchez-Lopez Centre for Security, Reliability, and Trust University of Luxembourg Luxembourg, Luxembourg [email protected] Mahya Ramezani Centre for Security, Reliability, and Trust University of Luxembourg Luxembourg, Luxembourg [email protected] Holger Voos Centre for Security, Reliability, and Trust University of Luxembourg Luxembourg, Luxembourg [email protected] Abstract-In this paper, we tackle the problem of Unmanned Aerial (UAV) path planning in complex and uncertain environments by designing a Model Predictive Control (MPC), based on a Long-Short-Term Memory (LSTM) network integrated into the Deep Deterministic Policy Gradient algorithm. In the proposed solution, LSTM-MPC operates as a deterministic policy within the DDPG network, and it leverages a predicting pool to store predicted future states and actions for improved robustness and efficiency. The use of the predicting pool also enables the initialization of the critic network, leading to improved convergence speed and reduced failure rate compared to traditional reinforcement learning and deep reinforcement learning methods. The effectiveness of the proposed solution is evaluated by numerical simulations. Keywords-path planning, reinforcement learning, model predictive control, LSTM network modeling, improved DDPG algorithm I. INTRODUCTION Nowadays, Unmanned Aerial Vehicles (UAVs) are being increasingly used in various industries, e.g., agriculture, mining, and construction, with different applications, such as monitoring, reconnaissance, and mapping [1-3]. For this, UAV path planning plays a vital role in determining and tracking efficient and safe flight paths considering terrain, weather conditions, and dynamic obstacles. inspection, detection, Path planning, in the context of UAV navigation, refers to determining the best route for the UAV to follow while avoiding obstacles and reaching its destination [4, 5]. Early path planning methods were mainly graph-based, which could not handle dynamic obstacles [6, 7]. Subsequently, Artificial Potential Field (APF), Rapid exploration Random Tree (RRT), and D* algorithms were proposed as solutions for dynamic environments[8, 9]. However, APF can be stuck in local minima, RRT is unsuitable for continuous, highly dynamic environments, and the planned path is usually suboptimal and nonsmooth. Even though the D* algorithm in a dynamic environment, effectively finds a path convergence is still challenging in complex environments with many obstacles and dynamic obstacles. To resolve these issues, Reinforcement Learning (RL) has emerged as a promising approach for UAV path planning. Salient features of RL, such as learning from experience and improving decision-making over time, make it a well-suited approach for UAV path planning in dynamic and uncertain environments[10]. RL can overcome traditional methods' limitations by allowing the UAV to adapt to time-varying conditions and obstacles. Additionally, the uncertainty and randomness of complex environments can be tackled by RL- based algorithms [11]. However, the poor performance of RL methods for handling high-dimensional systems is the main drawback that might make it impractical. Deep Reinforcement Learning (DRL) is a recent Artificial intelligence (AI) technique that combines the strengths of Deep Learning and RL to solve decision-making problems for high-dimension systems. Therefore, DRL has been applied to UAV path planning in complex scenarios [12], resulting in more efficient and accurate solutions. For instance, in [13], the path robustness were demonstrated. Furthermore, similar studies highlight the practical benefits of DRL for improving UAV path planning, addressing the challenges of dynamic obstacle avoidance and real-time decision-making in complex environments while handling the high-dimension issue [13-15]. smoothness, efficiency, and Moreover, DRL methods require an approximation of the action-value function, often using deep neural networks (DNNs) [16]. However, it can be challenging to analyze the performance of a system controlled by an RL algorithm with an approximate policy represented by a DNN or another function approximation, which is especially important for systems with critical safety requirements. Furthermore, DNN- based RL has limitations regarding stability analysis, state/input constraints satisfaction, and meaningful weight initialization [17]. equipped with a LIDAR for obstacle avoidance and a GPS for positioning. Recently, Model Predictive Control (MPC)-based RL approaches have been proposed to overcome these limitations, which suggests using MPC as the function approximation for the optimal policy in RL. MPC involves solving an optimal control problem at each time step to determine the best control policy [18]. As a result, MPC not only generates an optimal input and state sequence for the entire prediction horizon but also has the ability to anticipate future actions based on the predicted state [19]. MPC can handle complex and uncertain environments by providing a structured approach to control. On the other hand, the DRL component provides the ability to learn from experience and optimize control performance over time., It also can adapt to new situations and improve performance over time. The main drawback of MPC is the high computational complexity, which can be tackled by using semi-accurate models of the controlled process to provide predictions [20]. It should be mentioned that the predictive model's accuracy directly impacts the MPC framework's performance. Utilizing a DNN to predict the model provides a more accurate and reliable representation of the system dynamics, thereby enhancing the effectiveness of the MPC framework [21]. The Long-Short-Term-Memory (LSTM) network, as a DNN, can extract sequential features and handle complex dependencies, making it ideal for predicting sequential processes [22]. Motivated by the considerations mentioned above, in this paper, we propose an LSTM-based-MPC system that operates as a deterministic policy within the Deep Deterministic Policy Gradient (DDPG) network, providing a robust and efficient solution for UAV path planning problem in unknown environments. Integrating the LSTM-MPC solution into the DDPG framework addresses the challenges posed by real- time path planning and results in improved convergence speed and reduced failure, offering a promising solution for path planning problems in complex and uncertain environments. The main contributions of this paper are as follows. • Combining LSTM -MPC and DDPG algorithms to handle the high dimensionality of the state space, the uncertainty and variability of the obstacles' trajectories, and the real-time constraints of the system. • Implementation of the LSTM-MPC-based model as an actor network in the DDPG framework • Defining a predicting pool for predicting future state and corresponding actions The rest of the paper is structured as follows. Section 2 outlines the path planning problem. Section 3 describes the proposed LSTM-MPC DDPD method. Section 4 presents the experiments carried out to assess the algorithm's performance. Concluding remarks are given in Section 5. II. PROBLEM FORMULATION AND PRELIMINARIES This paper proposes a novel method for path planning for UAVs in unknown environments with static and dynamic obstacles. The problem is safe path planning in case of limited knowledge of the environment. Path planning aims to find the optimal path in considering obstacle avoidance. The UAV is A. Problem definition The environment is modeled as a Markov Decision Process. The UAV is equipped with a LIDAR for obstacle avoidance and a GPS for positioning. The GPS sensor provides precise navigation and localization capabilities, enabling the UAV to maintain its position and navigate to the target point with high accuracy. The LiDAR sensor, on the other hand, offers real-time 3D mapping and obstacle detection capabilities, enabling the UAV to perceive and avoid dynamic obstacles present in the field. The UAV dynamics are presented in [23], which is not repeated here for brevity. Here, the safe UAV path planning problem in an unknown environment with static and dynamic obstacles is tackled with limited knowledge of the environment. B. The Markov Decision Process The Markov Decision Process (MDP) is a well-established mathematical framework for modeling decision-making problems in the presence of uncertainty. MDP is defined by a tuple ⟨S, A, P, R, γ ⟩, where S denotes a finite set of states, A denotes a finite set of actions, P represents the state transition probabilities as " = P[S#$% = s | S# = s, A# = a] p!! R denotes the reward function as " = E[R#| S# = s, A# = a ] R! and γ is the discount factor, which lies in the interval [0, 1] and with a stage cost l(s, a). (1) (2) Consider deterministic policy delivery of the control input a = π(s), resulting in state distribution τ& . RL's goal is to find the optimal policy π∗ by solving the minimization * problem π∗ ≔ arg min J(π) = E(![∑ )+, l(s), π(s)))]. γ) In RL, important quantities are the action-value function Q∗(s, a) and value function V∗(s) associated with the optimal policy π∗(s), which are defined by the Bellman equations Q∗(s, a) = l(s, a) + γE [V∗(s#$%) | s, a] V∗(s) = Q∗Ds, π∗(s)E = min Q∗(s, a) (3) (4) " C. MDP formulation 1) State The proper action is chosen based on the current state of the UAV. The obstacle is cylindrical shape and unknown in the environment. Moreover, the shape of the environment is a rectangle. The state of the UAV is represented by a state vector consisting of the position of the UAV in the world frame, represented by (x, y, z), and the velocity of the UAV along the X, Y, and Z axes, represented by (v-, v., v/). For ease of navigation towards the target, the absolute position of the UAV is transformed into its relative position with respect to the target. The environment information is gathered using Lidar distance sensors, with a scan angle range of π and an angle of π/6 between each pair of rays. The environment observations are divided into 7 sensors in the horizontal plane and 7 in the vertical plane. The state represented: S = [x, y, z, v-, v., v/, φ, θ, ψ, x#, y#, z#, d0, ... , d0] (5) three-degree-of-freedom kinematic model To simplify the description of the UAV's position and is motion, a adopted in this study. The assumption is that the UAV maintains a constant horizontal altitude, thus confining its movement to the x-y plane. By disregarding the momentum effects during flight and assuming a constant velocity v, the position, and motion of the UAV are represented by the vector ζ = [x, y, ψ]. Five variables represent the state of the UAV in 2D (x, y) for its position in the world frame Dv-, v.E for its velocity along the X and Y axes, and ψ for the angle between its first- perspective direction and the line connecting the UAV to the target. The relative position between the UAV and the target can be transformed to make it easier to reach the target. The environment information is obtained using laser distance sensors, which have a scan angle range of π and an angle between each two laser rays of π/6. The observations are 7 sensors in the horizontal plane. And the state represented for UAV in a simplified environment is as follows S = [x# − x, y# − y, v-, v., v, ψ, d0, ... , d0] (6) 2) Action the control of the UAV is simplified to only two commands - speed and yaw angle. The control vector of the UAV is represented as a = [a1, a2] where a1 is the current speed ratio to the maximum speed, with a range of values between -1 and 1. a2 is a steering signal that determines the desired yaw angle, with a range of values between -1 and 1. 3) Reward function The reward function for the UAV in the given scenario is a combination of four parts. It aims to guide the UAV to reach the target area while ensuring its safety, defined as follows. Distance Reward: The negative value of the distance between the UAV and the target point is used as a penalty to encourage the UAV to reach the target area. The UAV will receive a positive reward if it reaches the target area. The relative distances represent the difference between the present location and the destination. We assume the difference between the UAV and its target in the previous and current stages, respectively. d34! = d56789# − d:781;6! −0.1 d34! > 0 1 d34! < 0 r% = V Step Penalty: To make the UAV reach the target area as soon as possible, a penalty of r< = −0.01 is given to the UAV at each step. Orientation Penalty: the negative value of the angle between the UAV's first-perspective direction and the connection line of the UAV and the target is taken as a penalty to help the UAV approach the target in the direction towards the target. It is considered r= = −0.01. Obstacles Penalty: To keep the UAV away from obstacles, first should define a safe distance to prevent collision with the obstacles. When the distance between the UAV and the nearest obstacle is less than the safe distance, the UAV receives a penalty for the distance. If the UAV collides with (7) obstacles, it receives another penalty. Otherwise, it does not receive any punishments if the distance exceeds the safe distance. r> = Z −0.1 d!"?8 > 0 −1 collision 0 else (8) Therefore, the reward received by the UAV at the current moment can be expressed as follows: R = w%r% + w<r< + w=r= + w>r> To mention more attention on collision avoidance to reduce risk and have safe path planning and the optimal path, we chose the weight of the w% and w> more than w< and w= (9) III. METHODOLOGY A. Deep Deterministic Policy Gradients Deep Deterministic Policy Gradients (DDPG) is a popular DRL algorithm that combines elements of both value-based and policy-based RL methods. It operates within the framework of an actor-critic architecture where the actor network is responsible for selecting actions based on the current state of the environment. The critic network is used to judge the value of the actions taken by the actor. The two networks are trained simultaneously using the same set of experiences collected by the agent during its interactions with the environment. In order to overcome the problems of correlation between samples in reinforcement learning, the DDPG algorithm employs a replay buffer that stores experience and random samples from this buffer when the updating deterministic policy gradient theorem for Markov Decision Processes (MDPs) with continuous action spaces, trains the networks using stochastic gradient descent with mini-batches, and updates the target networks using a soft update algorithm. It is a visual illustration of the actor-critic architecture, including the Q network and μ network, and their interactions with the environment. The use of a target network and the replay buffer are also depicted in Figure 1, highlighting their role in improving the stability and sample efficiency of the algorithm. the networks. DDPG is derived from B. The Long Short-Term Memory Model Predictive Control 1) LSTM LSTM is a Recurrent Neural Network (RNN) type that features external recurrences from the outputs to the hidden layer's inputs and internal recurrence between LSTM cells. In each LSTM cell, a set of gating units regulates the information flow, enabling the network to remember or forget information based on a sequence of inputs [24]. The LSTM network consists of an input layer, multiple hidden layers, and an output layer. Its uniqueness lies in its memory cells in the hidden layers, which allow data to be learned by maintaining or adjusting the memory cell's state. The proposed LSTM model was built using the deep learning toolbox in MATLAB. To optimize the LSTM structure, learning parameters are specified and summarized in Table 1. The set values for these parameters were chosen based on recommendations from MATLAB and previous research. Table 1. The LSTM hyperparameters. C. LSTM-MPC-DDPG Parameter Optimization algorithm Initial learn rate Hidden layer Hidden unit Max epochs Value Adam 0.01 3 200(3) 100 2) The Long Short-Term Memory Model Predictive Control The Long Short-Term Memory Model Predictive Control (LSTM-MPC) is a novel control algorithm that combines the strengths of Model Predictive Control (MPC) and LSTM networks. The LSTM network models the state dynamics of a system, while MPC is used to generate control actions based on state predictions. LSTM-MPC aims to find an optimal control sequence, u∗, that minimizes a cost function, J, over a set of predicted states and control actions in real-time environments. The LSTM network predicts state dynamics based on the current state and control actions. Given the initial states, s,, and control actions, u, the LSTM network predicts the next state, s{#$%}. MPC generates control actions, u, based on predicted states, s. The control actions are computed by minimizing the cost function, J, over predicted states and control actions using a quadratic program (QP). The predicted states and control actions are inputs to the optimization problem, and the optimal control actions are the outputs. The algorithm offers several advantages, including improved state prediction accuracy, handling unknown state dynamics, and incorporating constraints on control actions and states. On the other hand, it can face Several challenges that can arise when using LSTM-MPC for path planning with collision avoidance and considering unknown dynamic obstacles. Some of these challenges include LSTM-MPC has limitations, including sensor noise and measurement errors, model uncertainty, computational complexity, nonlinearity and non-convexity, and data efficiency. The optimized control action may also be insufficient due to model mismatch, nonlinear dynamics, unmodeled disturbances, limited prediction horizon, constraint violations, and real-time requirements. In this paper, The LSTM network and MPC algorithm are trained together in an iterative process, with the LSTM network improving its model dynamics based on the feedback from the MPC algorithm and the MPC algorithm using the improved LSTM model to make better control decisions. After each iteration of the MPC algorithm, the predicted following states and the following actual states can be compared, and the difference between them can be used to update the parameters of the LSTM network using an optimization algorithm such as gradient descent. The training goal is to minimize the prediction error between the actual and predicted following states, thus improving the accuracy of the LSTM model dynamics. The proposed algorithm for RL in UAV path planning is based on integrating DDPG and LSTM-MPC algorithms. The integration of these two algorithms leverages their respective strengths to provide a robust solution for real-time constraints and unknown environments. The integration of MPC and LSTM allows the algorithm to make informed decisions in unknown environments by combining the strengths of both algorithms. The MPC component generates training data for the LSTM network by repeatedly applying the policy to the system and collecting the resulting states and actions. The LSTM network is trained using this data to predict future states and actions. The MPC component can then use the predictions made by the LSTM network to make more informed decisions about which actions to take in the future. The LSTM-MPC component is utilized as a deterministic policy, where the LSTM network is pre-trained using limited knowledge of the environment map. The future state action predictions generated by the LSTM-MPC are stored in a "predicting pool." The predicted data in predicting pool will be used to improve the training of the critic network. One approach is to use the predicted data as a warm start for the critic network by initializing the network parameters using the estimated Q-values for each future state-action pair. This can help to speed up the convergence of the network. Additionally, the estimated Q-values can be used as target values during the backpropagation step, allowing the network to learn to predict better the quality of the actions taken by the policy and make more informed decisions about which actions to take the future. This approach can lead to improved accuracy in the Q-value estimates and more efficient network convergence. These estimated Q-values can be used as the target values for the critic network during the backpropagation step, where the loss is calculated as the mean-squared error between the estimated Q-values and the actual Q-values. Using the "predicting pool" for initialization combined with warm starting further enhances the algorithm's efficiency. Using a "predicting pool" in the DDPG algorithm provides several benefits that improve the performance and efficiency of the algorithm. • Speed up the learning process: By providing an initial estimate of the expected return, the learning process can be initiated from a better starting point. This reduces the number of iterations required for convergence to an optimal solution, thus speeding up the learning process. • Improved accuracy of predictions: The data collected from the "predicting pool" can be utilized to refine the accuracy of predictions made by the LSTM-MPC (Long Short-Term Memory Model Predictive Control), which leads to improved performance of the DDPG algorithm. • Better utilization of data: The "predicting pool" serves as a repository for the data generated by the LSTM-MPC predictions. This facilitates the better utilization of the data and enables easy incorporation into the learning process. • Increased stability: By utilizing the data from the "predicting pool" as supplementary information and to combining it with the observations from the environment to estimate the TD (Temporal difference) error, the algorithm's stability can be improved. The weight assigned the predicted data can be adjusted dynamically based on its reliability, and the observed data can serve as a backup to ensure stability and accuracy. In this work, the LSTM-MPC algorithm is utilized as a function approximator in the actor network of the DDPG framework for UAV path planning in the x-y plane with a constant altitude. The cost function for UAV path planning is formulated as a combination of several terms: the deviation of the UAV's position from the target point, a collision avoidance term based on the lidar data, and the magnitude of the control inputs required to execute the path. The optimization problem, defined as the minimization of this cost function, is solved at each time step by the MPC algorithm to determine the control inputs, which are treated as the deterministic policy for the actor-network in the DDPG framework. The LSTM network and MPC parameters are updated over time as the system learns from its interactions with the environment. The cost function in the MPC algorithm for a quadrotor in an x-y plane at a constant altitude can be formulated as a trade- off between following the optimal path and avoiding collisions. One possible formulation of the cost function could be JBCD(x, u) = w% bcx3(t + j) − x:(t + j)cb < + w<c|Δu(t + < (10) + w=C5;EE4!4;9 (x) j)|c where x:(t + j) is the current state of the system (position and velocity) based on the LSTM network at the (t + j)th period based on the available measurements at the t th sampling period, u is the control input, x3 is the desired state, w% , w< , and w= are weighting factors that balance the importance of following the desired state, minimizing control effort, and avoiding collisions, respectively. More details regarding the LSTM_MPC formulation can be found in [25]. The collision cost in the context of a quadrotor in the x-y plane can be formulated as a measure of the distance between the quadrotor and any potential obstacles in the environment. the cost can be defined as the negative exponential of the Euclidean distance between the quadrotor's current position and the closest obstacle. Formally, the collision cost can be defined as: C5;EE4!4;9 = −eFG3(I,;K!)M Where d(q, obs) is the Euclidean distance between the quadrotor's position q and the closest obstacle, the negative exponential ensures that the cost increases as the quadrotor approaches an obstacle and approaches infinity as the distance decreases to zero, encouraging the quadrotor to avoid collisions. (11) This cost function can be added to the overall cost function used in the MPC optimization problem, which may also include other objectives such as reaching a target position, tracking a desired trajectory, or minimizing control inputs. The optimization problem is then solved at each time step to determine the control inputs for the quadrotor, which can be treated as the deterministic policy for the actor network in a DDPG framework. In order to evaluate the reward for each set of states, action, and future state in the MPC-based deterministic policy, it is necessary to incorporate the reward function into the MPC optimization process. The reward function assigns a numerical value to the quality of a given state-action-future state combination. It serves as a means of reinforcing desirable actions and discouraging undesirable ones. To this end, the MPC optimization problem can be formulated as follows: (12) min J# = JBCD(x#, u#) + ∑ w4 R(s4, a4) where J# is the objective function, w4 is the weight that controls the relative importance of each term, R(s4, a4) is the reward function, and the constraints represent operational limitations and requirements for the UAV. Including the reward function in the MPC optimization makes it possible to evaluate the reward for each set of states, actions, and future states. These rewards can then be stored in the predicting pool, providing valuable information that can be used to improve the accuracy of the LSTM network and the performance of the MPC algorithm and the Actor-Critic Network. Overall, incorporating the reward signal into the MPC optimization process guides the UAV toward making better decisions in unknown environments. D. LSTM-MPC as function approximation The LSTM-MPC actor network is trained to maximize the expected cumulative reward through gradient descent. The gradient of the expected cumulative reward with respect to the network parameters (denoted as θ) is computed using the chain rule of differentiation as ∇θJ(θ) = ∇θE[R|θ] where J(θ) is the expected cumulative reward, E[R|θ] is the expected cumulative reward given the current policy (parameterized by θ ), and ∇θ denotes the gradient with respect to the parameters θ. The gradient is estimated using the experience gathered from the environment. The LSTM- MPC actor network is updated after each episode or after a batch of episodes to maximize the expected cumulative reward. (13) The parameters of the LSTM network, theta, are trained using gradient descent to minimize the expected cost over a sequence of states and control inputs. In each iteration of the MPC algorithm, the LSTM network uses the current state, x#, and the past control inputs, u#G%, ... , u#G) , to predict the control input for the next time step, u#. The predicted control input, u# , is then used in the optimization problem to determine the optimal control input, u∗. The parameters of the LSTM network are updated using gradient descent as follows θ = θ − α∇ (J(x, u∗ ), θ) (14) where α is the learning rate. By iterating this process, the parameters of the LSTM network converge to the optimal policy, π∗, that maps states to control inputs to minimize the expected cost. The policy can be used to control the system in real time. A further detailed formulation can be found in [26]. 1) Steps of the proposed algorithm Step 1: Training of LSTM Network: • Initialize the LSTM network using limited knowledge of the environment. • The LSTM network is initialized with parameters θ,. The network's hidden state, h,, is initialized based on the initial conditions of the system. Step 2: Improvement of LSTM with Real-time Sensor Data: • Use real-time data from sensors to update the network's predictions continually. • This allows the network to adapt to environmental changes and continuously improve its predictions. • Use backpropagation and gradient descent to update the network parameters, w, to minimize the prediction error. Step 3: Use of LSTM to Predict the Environment and Control Action: • The LSTM network is used to predict the environment, while the Model Predictive Control (MPC) is used to determine the optimal control action. The LSTM considers the MPC data and past data to predict the next state. • The control actions are generated by minimizing the cost function, J, over a set of predicted states and control actions, as described in the previous sections. • LSTM uses MPC data to train and improve the MPC network Step 4: LSTM-MPC as Deterministic Policy Actor-Network: • Use the LSTM-MPC network to determine the optimal control actions for a given state. • Use the data from the "predicting experience pool" to warm-start the LSTM-MPC, improving the accuracy of its predictions based on their reliability. • To improve the real-time performance of the MPC, efficient optimization algorithms and approximations can be employed to reduce computational complexity. • These algorithms can significantly improve the speed and efficiency of the MPC, allowing it to make predictions and choose actions in real time. Step 9: Repeating Steps 2-8: • Continuously repeat Steps 2 through 8 to improve the MPC's performance. The algorithm structure block diagram is shown in Figure 1. IV. SIMULATION RESULTS AND SETTING A. Experiment enviorment In this scenario, the environment is a simplified 3D space with dimensions of 200m x 200m x 50m. The target and initial points of the UAV are randomly initialized in one of the corners of the environment. Cylindrical Obstacles of different sizes are randomly generated within the rest area. In order to navigate this environment, the UAV uses its sensor data to avoid obstacles and reach its target point. The environment was chosen to be simplified to make the task of path planning and obstacle avoidance more manageable. The safe distance to the obstacle is 1.5m, and the max sensor length is 20m. • Parametrized LSTM based on the θ to use gradient B. Training descent for updating the policy Step 5: Predicting Pool: • Use the LSTM-MPC network to predict future states and corresponding control actions in a set MPC horizon. • Evaluate the rewards for each control action • Store information in a new experience pool called the "predicting pool." Step 6: Collection of Experiences from the Environment: • Interact with the environment by choosing actions and collecting information about the current state, action, reward, and next state. • Store this information in a separate experience pool. Step 7: Training of Critic Network: • Use a critic network to estimate the value function for each experience in the batch from the "experience pool." • Using the predicting states from the LSTM network for more sample • Calculate the target value for each experience, which is the reward plus the estimated value of the next state. • Train the critic network to predict the target value by minimizing the mean squared error between the prediction and the target. • The "predicting pool" is used to initialize the value function approximator, which can speed up the training process and reduce the number of iterations required to converge. (Warm start) Step 8: Improvement of LSTM-MPC: The proposed algorithm in this paper operates within the MATLAB environment and utilizes a learning rate of 0.001 for its optimizer. The maximum number of iterations is set to 5000 to ensure network convergence, and the maximum number of steps per iteration is set to 500. the experience pool has a maximum capacity of 10N. The episode ends if the UAV reaches the target area, collides with the obstacles, and the number of training steps reaches the maximum. The soft update factor τ is 0.001, and the exploration noise is set to 0.2. the MPC horizon is set as 5 with time step 0.5 and minimum batch size N = 256. Figure 1. The diagram of the proposed algorithm. In the training environment, there are five cylindrical obstacles with a size of 5 x 50 and five cylindrical obstacles with a size of 10 x 50. Figure 2 and Figure 3 show the training data's success ratio and cumulative reward function. In the initial training stage, the UAV operates randomly due to the lack of accurate prediction, resulting in a low average reward. However, the MPC-based deterministic policy shows a higher average reward than the other two methods at the beginning and the end of episodes, the proposed algorithm also converges faster. The success rate represents the percentage of successful target acquisitions. C. Results in the training first evaluated After 5000 episodes of training environment for DDPG, TD3, and the proposed algorithm, they were tested in dynamic and static environments. The proposed algorithm was in a static eenvironment, where obstacles were randomly placed in each episode to assess the algorithm's ability to generalize. The environment uses two different settings; E1 and E2. E1 consists of five cylindrical obstacles with dimensions of 20x50 and five with dimensions of 15x50. E2 consists of ten obstacles with dimensions of 20x50 and ten with dimensions of 5x50. Figure 2. The success ratio of reaching the destination in the training phase. Figure 3. The comparison of the average reward of the algorithms in the training phase. The results of the proposed algorithm were compared to those of the DDPG and TD3 algorithms after 3000 episodes. As shown in Table 2, the proposed algorithm demonstrated the highest success rate in all three settings. The advantage of the proposed algorithm became increasingly apparent in more complex environments with a higher number of obstacles. In the more complex environment, E2, the success rate of the proposed algorithm decreased less than two others. Furthermore, The performance of the proposed algorithm, DDPG, and TD3 algorithms was evaluated in terms of cumulative step convergence. Results indicated that the proposed algorithm demonstrated faster convergence speed when compared to the TD3 and DDPG. Upon testing the algorithms for 3000 episodes in the same environment, These findings suggest that the proposed LSTM_MPC_DDPG algorithm exhibits superior convergence and performance compared to the TD3 and DDPG algorithms. Figure 4 and Figure 5 show the paths generated in environments E1 and E2 based on the proposed algorithm, respectively, where the black dashed line shows the safe zones around obstacles. As seen, the UAV reaches the target area without collision with obstacles using a short path. Next, algorithms were tested in a dynamic environment. In this scenario, obstacles move along the X -axis at different speeds, which can test whether the UAV can make real-time decisions in dynamic environments. Obstacles move at the speed of v in the negative direction of the X-axis. DDPG, TD3, and the proposed algorithm are tested for 3000 episodes in 2 different speeds of obstacle. The results in different dynamic environments are illustrated in Table 2. The success rates of the three algorithms decrease as the speed of obstacles increases. The success rate of the proposed algorithm is the lowest. Moreover, the success rate of our algorithm is much higher than that of TD3. It is because the design of the predicting pool network and MPC_LSTM as an actor-network structure works. UAVs can perceive the changes in the surrounding environment on the horizon by adding environmental information changes to predicting pool inputs so that obstacles can be avoided in time. The results show that the proposed algorithm has strong adaptability to dynamic environments. Table 2. Tests results under static environments and the impact of different speeds of a dynamic obstacle in a dynamic environment TD3 DDPG E1 E2 V=15 V=10 m/s m/s 78.15 85.2 21.75 14.3 0.1 0.5 1.2 3.1 90.25 85.25 14.15 8.5 0.6 1.5 1.7 4.01 93.35 86.26 13.74 6.65 0 0 2.56 4.25 80.5 10.1 9.4 2.3 85.7 8.2 6.1 2.71 93.4 6.3 0 3.02 SR (%) CR (%) LR (%) AR SR (%) CR (%) LR (%) AR SR (%) CR (%) LR (%) AR 92.25 7.05 0.7 3.42 94.1 4.8 1.1 4.23 95.1 4.9 0 5.08 Success rate (SR): The percentage of successful target acquisitions. Collision rate (CR): The percentage of collisions with obstacles. Loss rate (LR): The percentage of getting lost in the map (without collision). Average reward (AR): The overall performance quality. Proposed Algorithm ACKNOWLEDGMENTS This research was partially supported by the European Union's Horizon 2020 project Secure and Safe Multi-Robot Systems (SESAME) under grant agreement no. 101017258. For the purpose of open access, the author has applied a Creative Commons Attribution 4.0 International (CC BY 4.0) license to any Author Accepted Manuscript version arising from this submission. REFERENCES [1] R. Raj, S. Kar, R. Nandan, and A. Jagarlapudi, "Precision agriculture and unmanned aerial Vehicles (UAVs)," Unmanned Aerial Vehicle: Applications in Agriculture and Environment, pp. 7-23, 2020. [2] S. A. H. Mohsan, M. A. Khan, F. Noor, I. Ullah, and M. H. Alsharif, "Towards the unmanned aerial vehicles (UAVs): A comprehensive review," Drones, vol. 6, no. 6, p. 147, 2022. [3] S. Park and Y. Choi, "Applications of unmanned aerial vehicles in mining from exploration to reclamation: A review," Minerals, vol. 10, no. 8, p. 663, 2020. [4] D. Wang, "Indoor mobile-robot path planning based on an improved A* algorithm," Journal of Tsinghua University Science and Technology, vol. 52, no. 8, pp. 1085-1089, 2012. [5] L. Li, T. Ye, M. Tan, and X.-j. Chen, "Present state and future development of mobile robot technology research," Robot, vol. 24, no. 5, pp. 475-480, 2002. [6] G. Hoffmann, S. Waslander, and C. Tomlin, "Quadrotor helicopter trajectory tracking control," in AIAA guidance, navigation and control conference and exhibit, 2008, p. 7410. [7] R. Bohlin and L. E. Kavraki, "Path planning using lazy PRM," in Proceedings 2000 ICRA. Millennium conference. IEEE international conference on robotics and automation. Symposia proceedings (Cat. No. 00CH37065), 2000, vol. 1: IEEE, pp. 521-528. [8] Y. K. Hwang and N. Ahuja, "A potential field approach to path planning," IEEE transactions on robotics and automation, vol. 8, no. 1, pp. 23-32, 1992. [9] J. Bruce and M. Veloso, "Real-time randomized path planning for robot navigation," in IEEE/RSJ international conference on intelligent robots and systems, 2002, vol. 3: IEEE, pp. 2383-2388. [10] G.-T. Tu and J.-G. Juang, "UAV Path Planning and Obstacle Avoidance Based on Reinforcement Learning in 3D Environments," in Actuators, 2023, vol. 12, no. 2: MDPI, p. 57. [11] B. G. Maciel-Pearson, L. Marchegiani, S. Akcay, A. Atapour- Abarghouei, J. Garforth, and T. P. Breckon, "Online deep reinforcement learning for autonomous UAV navigation and exploration of outdoor environments," arXiv preprint arXiv:1912.05684, 2019. [12] S. Faryadi and J. Mohammadpour Velni, "A reinforcement learning‐ based approach for modeling and coverage of an unknown field using a team of autonomous ground vehicles, " International Journal of Intelligent Systems, vol. 36, no. 2, pp. 1069-1084, 2021. [13] S. Zhang, Y. Li, and Q. Dong, "Autonomous navigation of UAV in multi-obstacle environments based on a Deep Reinforcement Learning approach," Applied Soft Computing, vol. 115, p. 108194, 2022. [14] B. Xin and C. He, "DRL-Based Improvement for Autonomous UAV Motion Path Planning in Unknown Environments," in 2022 7th International Conference on Control and Robotics Engineering (ICCRE), 2022: IEEE, pp. 102-105. [15] Y. Li and A. H. Aghvami, "Intelligent UAV Navigation: A DRL-QiER International Conference on ICC 2022-IEEE Solution," Communications, 2022: IEEE, pp. 419-424. in [16] S. Gros and M. Zanon, "Reinforcement learning based on mpc and the stochastic policy gradient method," in 2021 American Control Conference (ACC), 2021: IEEE, pp. 1947-1952. [17] S. Gros and M. Zanon, "Data-driven economic NMPC using reinforcement learning," IEEE Transactions on Automatic Control, vol. 65, no. 2, pp. 636-648, 2019. [18] M. L. Darby and M. Nikolaou, "MPC: Current practice and challenges," Control Engineering Practice, vol. 20, no. 4, pp. 328-342, 2012. [19] A. B. Kordabad, W. Cai, and S. Gros, "MPC-based reinforcement learning for economic problems with application to battery storage," in 2021 European Control Conference (ECC), 2021: IEEE, pp. 2573-2578. Figure 4. The generated path by the proposed algorithm in the E1 environment. Figure 5. The generated path by the proposed algorithm in the E2 environment. V. CONCLUSION can algorithm. The LSTM-MPC for unmanned aerial vehicles This paper presents a novel method that leverages Deep to facilitate autonomous path Reinforcement Learning planning in complex environments with multiple static and dynamic obstacles. The proposed solution employs a deterministic policy based on the LSTM-MPC architecture to enhance the performance of the DDPG predict environmental features from observations, thereby addressing the unpredictability and variability in these scenarios. The method incorporates a "predicting pool" that stores the set of state-action-reward data, which accelerates the performance of the DDPG algorithm. The efficacy of the proposed in simplified 3D-simulation algorithm was evaluated environments and compared with the DDPG and TD3 algorithms. The results demonstrated that the proposed solution could effectively train UAVs for path planning in complex environments with real-time dynamic obstacle avoidance while reaching the target area promptly and safely with higher performance indices than DDPG and TD3 algorithms. [20] Z. Zhang, D. Zhang, and R. C. Qiu, "Deep reinforcement learning for power system applications: An overview," CSEE Journal of Power and Energy Systems, vol. 6, no. 1, pp. 213-225, 2019. [21] H. Moumouh, N. Langlois, and M. Haddad, "A Novel Tuning approach for MPC parameters based on Artificial Neural Network," in 2019 IEEE 15th International Conference on Control and Automation (ICCA), 2019: IEEE, pp. 1638-1643. [22] Y. Jiao, Z. Wang, and Y. Zhang, "Prediction of air quality index based on LSTM," in 2019 IEEE 8th Joint International Information Technology and Artificial Intelligence Conference (ITAIC), 2019: IEEE, pp. 17-20. [23] B. Jiang, B. Li, W. Zhou, L.-Y. Lo, C.-K. Chen, and C.-Y. Wen, "Neural network based model predictive control for a quadrotor UAV," Aerospace, vol. 9, no. 8, p. 460, 2022. [24] A. Sherstinsky, "Fundamentals of recurrent neural network (RNN) and long short-term memory (LSTM) network," Physica D: Nonlinear Phenomena, vol. 404, p. 132306, 2020. [25] J. Yan, P. DiMeo, L. Sun, and X. Du, "LSTM-Based Model Predictive Control of Piezoelectric Motion Stages for High-speed Autofocus," IEEE Transactions on Industrial Electronics, 2022. [26] W. Cai, A. B. Kordabad, H. N. Esfahani, A. M. Lekkas, and S. Gros, "MPC-based reinforcement learning for a simplified freight mission of autonomous surface vehicles," in 2021 60th IEEE Conference on Decision and Control (CDC), 2021: IEEE, pp. 2990-2995.
http://arxiv.org/abs/2302.10668v2
2023-02-23T16:03:05
2023-02-21T13:37:07
$PC^2$: Projection-Conditioned Point Cloud Diffusion for Single-Image 3D Reconstruction
Reconstructing the 3D shape of an object from a single RGB image is a long-standing and highly challenging problem in computer vision. In this paper, we propose a novel method for single-image 3D reconstruction which generates a sparse point cloud via a conditional denoising diffusion process. Our method takes as input a single RGB image along with its camera pose and gradually denoises a set of 3D points, whose positions are initially sampled randomly from a three-dimensional Gaussian distribution, into the shape of an object. The key to our method is a geometrically-consistent conditioning process which we call projection conditioning: at each step in the diffusion process, we project local image features onto the partially-denoised point cloud from the given camera pose. This projection conditioning process enables us to generate high-resolution sparse geometries that are well-aligned with the input image, and can additionally be used to predict point colors after shape reconstruction. Moreover, due to the probabilistic nature of the diffusion process, our method is naturally capable of generating multiple different shapes consistent with a single input image. In contrast to prior work, our approach not only performs well on synthetic benchmarks, but also gives large qualitative improvements on complex real-world data.
[ "Luke Melas-Kyriazi", "Christian Rupprecht", "Andrea Vedaldi" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10668v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10668v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.CV", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.CV", "cs.AI", "cs.LG" ]
3 2 0 2 b e F 3 2 ] V C . s c [ 2 v 8 6 6 0 1 . 2 0 3 2 : v i X r a PC2: Projection-Conditioned Point Cloud Diffusion for Single-Image 3D Reconstruction Luke Melas-Kyriazi Christian Rupprecht Andrea Vedaldi Visual Geometry Group, Department of Engineering Science, University of Oxford {lukemk,chrisr,vedaldi}@robots.ox.ac.uk https://lukemelas.github.io/projection-conditioned-point-cloud-diffusion Figure 1. Projection-Conditioned Point Cloud Diffusion: Our model performs single-image 3D point cloud reconstruction by gradually diffusing an initially random point cloud to align the with input image. Our model has been trained through simple, sparse COLMAP supervision from videos. Abstract Reconstructing the 3D shape of an object from a single RGB image is a long-standing and highly challenging prob- lem in computer vision. In this paper, we propose a novel method for single-image 3D reconstruction which generates a sparse point cloud via a conditional denoising diffusion process. Our method takes as input a single RGB image along with its camera pose and gradually denoises a set of 3D points, whose positions are initially sampled randomly from a three-dimensional Gaussian distribution, into the shape of an object. The key to our method is a geometrically- consistent conditioning process which we call projection con- ditioning: at each step in the diffusion process, we project local image features onto the partially-denoised point cloud from the given camera pose. This projection conditioning process enables us to generate high-resolution sparse ge- ometries that are well-aligned with the input image, and can additionally be used to predict point colors after shape reconstruction. Moreover, due to the probabilistic nature of the diffusion process, our method is naturally capable of generating multiple different shapes consistent with a single input image. In contrast to prior work, our approach not only performs well on synthetic benchmarks, but also gives large qualitative improvements on complex real-world data. 1. Introduction Reconstructing the 3D structure of an object from a sin- gle 2D view is a long-standing computer vision problem. Given more than one view, it is possible to reconstruct an object's shape using the tools of multiple-view geometry, but 1 Diffused Point CloudSingle Image InputProjection-Conditioned Point Cloud Diffusion Diffused & Colored Point CloudGaussianPoint Cloud in the case of a single view the problem is highly ill-posed and requires prior understanding of the possible shapes and appearances of the objects. Despite the difficulty of this task, humans are adept at us- ing a range of monocular cues and prior knowledge to infer the 3D structure of common objects from single views. For example, when a person looks at a photograph of an object, they can easily imagine what the shape of the backside of the object may plausibly be. The ease with which humans perform this task, and its relative difficulty for computer vision systems, has attracted the attention of the research community for nearly half a century [4, 5, 16, 24]. Moreover, given the prevalence of single-view RGB image data in the real world, the single-view reconstruction problem has prac- tical applications in numerous areas, such as augmented and virtual reality. Over the past five years, a substantial body of research has emerged around reconstruction via end-to-end deep learning methods [11,14,18,20,26,36,46,47,49,50,53–57,59]. These works are capable of predicting volumes from single images, yet many remain limited to low-resolution geometries (e.g. dense voxel grids), and thus have limited ability to recon- struct the precise geometry of the input image. Some recent works [9, 12, 37, 58] also utilize implicit representations and radiance fields, which are capable of rendering novel views with photographic quality but often suffer from other draw- backs, such as an inability to reconstruct a distribution of possible 3D shapes from a single input image. In this work, we take inspiration from recent progress in the generative modeling of 2D images using denoising diffu- sion probabilistic models. In the domain of 2D images, we have seen that diffusion models (e.g. Latent-Diffusion [38], SDEdit [25], GLIDE [28], and DALL-E 2 [32]) can produce remarkably high-fidelity image samples either from scratch or when conditioned on textual inputs. They do so by learn- ing complex priors over the appearances of common objects. For example, GLIDE [28] is designed to conditionally in- paint unseen regions in an image. We seek to bring these advances to the domain of 3D reconstruction to conditionally generate the shape of unseen regions of a 3D object. In order to do so, we propose to use diffusion models for single-image 3D reconstruction. Our approach represents shapes as unstructured point clouds: we gradually denoise a randomly-sampled set of points into a target shape condi- tional on an input image and its corresponding viewpoint. The key to our approach is a novel way of conditioning the diffusion process to produce 3D shapes which are geometri- cally consistent with the input images. Specifically, at each iteration of the diffusion process, we project image features directly onto the points of the partially-denoised point cloud. When shape reconstruction is complete, we are also able to use the same projection conditioning to predict point colors. Our method differs from prior work in three major as- pects: (1) our point cloud-based shape representation, (2) our projection-conditioned diffusion model, and (3) our use of projection conditioning to predict point colors in addition to point shapes. Although these may seem separate from one another, they are in fact directly linked: the order-agnostic and unstructured nature of point clouds naturally lends itself to the highly flexible nature of diffusion models. Without the point cloud-based representation, our projection-conditioned diffusion approach would be limited to coarse voxel-based shape approximation. Finally, due to its probabilistic nature, given a single input image, our model is able to generate multiple plausible 3D point clouds which are all consistent with the input. We leverage this property by introducing a novel filtering step in the sampling process, which helps to address the ill-posed nature of the single-view 3D reconstruction problem. Specif- ically, we generate multiple point clouds for a given input image, and filter these point clouds according to how well they match the input mask. Filtering enables us to bene- fit from the diversity of our model's reconstructions in an entirely automated fashion. Experimentally, we not only perform competitively on the synthetic ShapeNet benchmark, but we also move be- yond synthetic data: we demonstrate high-quality qualitative single-view reconstruction results on multiple categories in the challenging, real-world Co3D [34] dataset. We present this work as a first step toward using denoising diffusion models for large-scale 3D reconstruction. Given the success of scaling 2D diffusion models over the past two years, our work demonstrates that 3D diffusion models could represent a path toward large-scale 3D reconstruction of complex objects from single-view images. To encourage further research into diffusion models for 3D reconstruction, we will release code and pretrained models on acceptance. 2. Related work Single-View 3D reconstruction Originally, research on 3D reconstruction focused primarily on reconstruction from multiple views using classical geometric techniques [6]. Most commonly, these methods map the input image into a feature representation using a 2D convolutional network, and then decode the features into a 3D representation using a 3D convolutional network or a sequence model. This decoding process generally requires the output 3D representation to have a fixed and regular structure, such as a voxel grid. One of the pioneering methods in this line of work was 3D-R2N2 [1], which encodes an input 2D image into a low dimensional embedding using a standard 2D convolutional network, process this embedding with a 3D-LSTM, and then decode an output voxel grid with a 3D convolutional network. [1] also introduced a standard set of views and renders for evaluating single-view reconstruction methods based on the ShapeNet dataset, which we use for evaluation 2 Figure 2. PC2 reconstructs a colored point cloud from a single input image along with its camera pose. The method contains two sub-parts, both of which utilize our model projection conditioning method. First, we gradually denoise a set of points into the shape of an object. At each step in the diffusion process, we project image features onto the partially-denoised point cloud from the given camera pose, augmenting each point with a set of neural features. This step makes the diffusion process conditional on the image in a geometrically-consistent manner, enabling high-quality shape reconstruction. Second, we predict the color of each point using a model based on the same projection procedure. in this work (Sec. 4). LSM [13] processes images into feature maps with a 2D network, unprojects these features into a 3D voxel grid, and processes the grid with a 3D convolutional network. Pix2Vox [54] and its successor Pix2Vox++ [55] use a simple encoder-decoder architecture consisting of a 2D convolutional encoder and a 3D convolutional decoder augmented with a multi-scale fusion module. Most recently, LegoFormer [56] adopts a transformer-based approach. They encode an image into a feature vector and decode a 323 dense voxel grid as a sequence of 512 4 × 4 blocks. For this decoding they employ a non-autoregressive transformer- based decoder with learned queries. Additionally, over the past two years a new body of re- search has emerged around differentiable rendering. Popu- larized by NeRF [27], these methods learn implicit repre- sentations of either radiance [27] or signed distance [51]. Although the vast majority of this work operates on the level of single scenes with abundant multi-view data, a few recent works have tackled the single-view setting [9, 12, 17, 37, 57]. Most relevant for this paper are Nerf-WCE [9] and Pix- elNeRF [57], which concurrently developed methods for single/few-view reconstruction, conditioning a NeRF on im- age features from reference views. Both work well in the few-view settings on datasets such as Co3D [35], but strong results in the single-view setting remain elusive. We compare qualitatively against NeRF-WCE in Sec. 4. In this paper, we take an entirely different approach from those above. We utilize the flexible machinery of denoising diffusion probabilistic models for point cloud-based recon- struction. Due to their probabilistic nature, diffusion models enable us to capture the ambiguity of unseen regions while also generating high-resolution point cloud-based shapes. Below, we give an overview of the related literature on diffu- sion models. Diffusion Models Denoising diffusion probabilistic mod- els are a class of generative models based on iteratively reversing a Markovian noising process. Early work on Category Global Cond. airplane table 0.197 0.156 PC2 0.473 0.290 Table 1. Motivating Experiment. Here, we show a small quan- titative comparison on two categories from ShapeNet [1] which motivates our projection conditioning method. The table shows F-scores (higher is better). For the global conditioning approach, the input image is first processed into a global feature vector using a convolutional network [41], and this vector is used to condition a denoising diffusion model. Relative to the global conditioning, our projection conditioning is much more effectively able to reconstruct object geometries. diffusion models for image generation, inspired by ther- modynamics, framed the problem as one of optimizing a variational lower bound of a latent variable model [10]. Later work showed that this modeling paradigm is equiva- lent to score-based generative modeling [43, 44], and can also be seen as a discretization of a continuous process based on stochastic differential equations [45]. Recent work has explored faster/deterministic sampling for diffusion models [19, 42, 52], class-conditional models [2, 44], text- conditional models [28], and modeling in latent space [38]. Diffusion Models for Point Clouds Over this past year, three applications of diffusion models for unconditional point cloud generation have emerged. [22] and [60] pro- posed similar generation setups, differing in their use of a PointNet [30] and a Point-Voxel-CNN [60], respectively. Most recently [23] uses a diffusion model followed by a refinement model for the purpose of completing partial point clouds. However, these three works only tackle the problem of unconditional shape generation or completion and do not address the question of how to reconstruct real-world images. Additionally, they train only on synthetic datasets, whereas we show results for complex real-world data. 3 Point CloudDiffusion ModelImage features are projected onto the point cloud at each iteration of the denoising diffusion process and for point color predictionDiffusedPoint CloudGaussianPoint CloudSingle-View RGB ImageInputPoint CloudDiffusion ModelPoint Cloud withProjection Conditioning Point Cloud withProjection Conditioning Partially-Denoised Point Cloud 1000DiffusionStepsDiffused & ColoredPoint Cloud Point CloudColoring Model Figure 3. Examples of PC2 on real-world images from Co3D [34], along with intermediate steps in the diffusion process. The first column shows input images, while the subsequent five columns show the evolution of the point cloud from a randomly sampled Gaussian to a final shape over the course of the diffusion process. The following column shows the result of our coloring model applied to our reconstructed shape. The final two columns show renders of our colored point cloud from two randomly sampled novel views, demonstrating that it is a complete 3D shape. Our method is capable of reconstructing objects from real-world images with challenging viewpoints. 3. Method In the following sections we describe our method. We begin with an overview of denoising diffusion models, which forms the foundation of our method. Next, we introduce our novel conditioning scheme PC2. Finally, we describe our filtering method PC2-FM, which utilizes the probabilistic nature of diffusion to address the ill-posed nature of the single-view 3D reconstruction problem. 3.1. Diffusion Models Diffusion denoising probabilistic models are general- purpose generative models inspired by stochastic differential equations and non-equilibrium thermodynamics. Diffusion denoising models are based on an iterative noising process, which adds noise to a sample X0 ∼ q(X0) from a target data distribution q(X0) over a series of steps. The stepsize 4 of each step of this process is given by a variance schedule {βt}T t=0: q(Xt|Xt−1) = N (Xt; (cid:112)1 − βtXt−1, βtI) Each q(Xt|Xt−1) is a Gaussian distribution, implemented by using the the well-known reparameterization trick: √ √ q(Xt|X0) = ̄αtX0 + (cid:15) 1 − ̄αt where αt = 1 − βt, ̄αt = (cid:81)t s=0 αs, and (cid:15) ∼ N (0, I). In order to form a generative model, we consider the re- verse diffusion process, which begins with a sample from the noise distribution q(XT ) and then denoises over a se- ries of steps to obtain a sample from the target distribution q(X0). Confusingly, this reverse process is sometimes also referred to as the "diffusion process." In order to reverse the diffusion process, we learn the distribution q(Xt−1|Xt) us- ing a neural network sθ(Xt−1|Xt) ≈ q(Xt−1|Xt). We can With Color(Reference View)Single Image InputProjection-Conditioned Point Cloud Diffusion T = 1000 (Gaussian)T = 667 T = 334 T = 166 T = 0 (Final Model)Novel View 1 Novel View 2 then (approximately) sample from q(X0) by starting with a sample XT ∼ q(XT ) and then iteratively sampling from q(Xt−1|Xt). When the sampling step size is sufficiently small, q(Xt−1|Xt) is well approximated by an isotropic Gaussian with a fixed small covariance. Thus, one only has to predict the mean of q(Xt−1|Xt), which in practice is pa- rameterized as predicting the noise (cid:15) with a neural network sθ(Xt−1|Xt). 3.2. Point Cloud Diffusion Models We consider 3D point cloud with N points as a 3N dimen- sional object and learn a diffusion model sθ : R3N → R3N . This network denoises the positions of a set of points from a spherical Gaussian ball into a recognizable object. At a very high level, at each step, we predict the offset of each point from its current location, and we iterate this process to arrive at a sample from our target distribution q(X0). Concretely, the network is trained to predict the noise (cid:15) ∈ R3N added in the most recent time step using an L2 loss between the true and predicted noise values: L = E(cid:15)∼N (0,I) (cid:2)(cid:107)(cid:15) − sθ(Xt, t)(cid:107)2 2 (cid:3) At inference time, a random point cloud XT ∼ N (0, I3N ) is sampled from a 3N -dimensional Gaussian and the reverse diffusion process is run to produce a sample X0. At each step, we recover the mean μθ,t of our approximation of q(Xt−1|Xt) from the prediction sθ(Xt, t), and we use this mean to sample from q(Xt−1|Xt). 3.3. Conditional Point Cloud Diffusion Models We formulate 3D reconstruction as conditional genera- tion: the target distribution is the conditional distribution q(X0|I, V ) where I is an input image and V is the corre- sponding camera view. The key question of this paper is how exactly one should condition the model on the reference image and camera view. The most immediate way of con- ditioning would be to provide a global learned embedding of the input image as an auxilliary input to the denoising function sθ. This setup resembles prior work which used encoder-decoder architectures conditioned on image embed- dings to generate 3D shapes [1, 54, 55]. However, this approach is lacking in that it only promotes a weak form of geometric consistency between the input image and the reconstructed shape. Empirically, preliminary experiments showed that it often generated plausible shapes, but that these shapes did not always match the input image from the given view (see Tab. 1). This finding matches up precisely with the findings of [48], who analyzed voxel-based methods which decode from a global feature vector in a similar manner: they found that these networks primarily performed a sort of coarse clas- sification of the input image into a small number of shape categories and then generated a generic object from that cat- egory. Although coarse classification may produce adequate results in a highly curated synthetic setting such as ShapeNet, it will inevitably fail to capture the complexity of objects in real-world scenes. These insights led us to develop PC2, a geometrically consistent method for locally-conditional point cloud diffusion. 3.4. PC2: Projection-Conditional Diffusion Models To address the geometric consistency issues observed above, our method PC2 instead projects the image onto the partially-denoised point at each step in the diffusion process. We first process the image into a dense feature volume using a standard 2D image model(e.g. a CNN or ViT [3]). Next, before each diffusion step, we project these features onto the point cloud, attaching a neural feature to each point. Crucially, each point is augmented with a different neural feature, as determined by its location in space relative to the input camera and the input image. Formally, let I ∈ RH×W ×C be the feature volume pro- duced by our 2D image model applied to our input image, where C is the number of feature channels. sθ is now a func- tion R(3+C)N → R3N which predicts the noise (cid:15) from the augmented point cloud X + ]. The projected t features X proj = PVI (I, Xt) where PVI is the projection function from camera view VI , I is the input image, and Xt is the partially-noised point cloud. are given by X proj t = [Xt, X proj t t One straight-forward approach to design PVI (I, Xt) would be to simply project the 3D points on the image and take the corresponding image features. However, this is akin to assuming that the point cloud is transparent. Instead, we found it beneficial to choose a projection function that properly accounts for self-occlusion. We implement it by rasterizing the points, assuming that they have some small, non-zero radius ρ. That is, PVI is a rasterization proce- dure [33]. Due to highly optimized rasterization routines in modern software, this process is very efficient; it accounts for a negligible fraction of training time and computation. Full details about the rasterization process and the projected information are provided in the supplementary material. Finally, we find that we can apply exactly the same projection-based conditioning to reconstruct object color in addition to object shape.1 Specifically, we learn a separate coloring network cθ : R(3+C)N → RCN , which takes as input a point cloud augmented with projection condition- ing, and outputs the colors of each point. Empirically, we found that a single-step coloring model produced results comparable to a diffusion model. To reduce computational complexity, we hence utilize the single step model. : 1Learning a coloring network is beneficial compared to a simple projec- tion of colors from the image to points because a coloring network could learn to color an object backside differently from its front size (for example, in the case of a teddy bear). 5 Category [1] [56] [55] PC2 PC2-FM Samples 1 2 3 4 5 airplane bench cabinet car chair display lamp loudspeaker rifle sofa table telephone watercraft 0.225 0.198 0.256 0.211 0.194 0.196 0.186 0.229 0.356 0.208 0.263 0.407 0.240 0.215 0.241 0.308 0.220 0.217 0.261 0.220 0.286 0.364 0.260 0.305 0.575 0.283 0.266 0.266 0.317 0.268 0.246 0.279 0.242 0.297 0.410 0.277 0.327 0.582 0.316 0.473 0.305 0.203 0.359 0.290 0.232 0.300 0.204 0.522 0.205 0.270 0.331 0.324 Average 0.244 0.289 0.315 0.309 0.589 0.334 0.211 0.372 0.309 0.268 0.326 0.210 0.585 0.224 0.297 0.389 0.341 0.343 Table 2. Comparison of single-view 3D reconstruction performance with prior work on ShapeNet-R2N2. F-Score is calculated using a distance threshold of 0.01 [54]. Our method performs similarly to prior work without filtering and outperforms prior work using filtering (both PC2-FA and PC2-FM); this filtering step leverages the method's ability to produce multiple reconstructions for a given input image. Category PC2 PC2-FA PC2-FM Oracle airplane bench cabinet car chair display lamp loudspeaker rifle sofa table telephone watercraft Average 0.473 0.305 0.203 0.359 0.290 0.232 0.300 0.204 0.522 0.205 0.270 0.331 0.324 0.309 0.517 0.316 0.246 0.369 0.312 0.277 0.320 0.235 0.538 0.242 0.293 0.400 0.322 0.337 0.589 0.334 0.211 0.372 0.309 0.268 0.326 0.210 0.585 0.224 0.297 0.389 0.341 0.343 0.681 0.444 0.303 0.420 0.377 0.357 0.399 0.288 0.686 0.298 0.420 0.523 0.424 0.432 Table 3. Single-view 3D reconstruction performance on ShapeNet- R2N2 for different levels of filtering. PC2 produces a single sample for each input image. PC2-FM (see Sec. 3) uses 5 samples for automated IoU -based filtering. The "Oracle" method evaluates the upper bound of filtering: it computes the F -score of 5 samples using the ground truth point cloud and chooses the best sample for each input image. Filtering, both without object masks (PC2-FA) and with masks (PC2-FM) improves results substantially, but does not fully close the gap to the oracle. Avg. F-Score 0.310 0.330 0.335 0.340 0.343 Table 4. Performance of PC2-FM on ShapeNet-R2N2 when filter- ing different numbers of samples. There is a large improvement (0.02 F -score) from a single sample (i.e., no filtering) to two sam- ples. Performance continues to increase with diminishing returns. 3.5. PC2-FM and PC2-FA: Filtering for 3D Recon- struction Due to the ill-posed nature of the single-view 3D recon- struction problem, there are many possible ground truth shapes corresponding to each input image. Differently from most prior works [54–56, 58], our model is inherently prob- abilist, and thus admits sampling multiple different recon- structions from a single input. We take advantage of this property by proposing to gener- ate multiple independent samples for each input image and then filter these according to an automated criterion. Thus, we are able to generate a diverse set of outputs and choose the one which is "most plausible" for a given input image. 0 }N In practice, we propose two simple criteria for filter- ing, both of which involve the object silhouette. One of these uses additional mask supervision, while the other does not. In both cases, we begin by rendering each point cloud {X (i) i=1 from the input camera view V . We render the points as balls with a small fixed radius, such that we obtain the silhouette ˆM (i) of our point cloud sample. With mask supervision (PC2-FM). We compare each sil- houette ˆM with the object mask M , which is extracted au- tomatically using Mask-RCNN [8]. We then calculate their intersection-over-union IoU ( ˆM (i), M ) and select the sam- ple with the highest IoU score. Without mask supervision (PC2-FA). Rather than using an object mask, we filter based on the mutual agreement between our predictions. Specifically, we compute the IoU of each prediction with all of the other predictions and select the mask with the highest average IoU . In this way, we are able to select high-quality masks without any additional supervision. Finally, we emphasize that our filtering approach is a general one; the two methods explored here are by no means comprehensive. 4. Experiments We will first describe our datasets, model, and the imple- mentation details. We then discuss and analyze our results. ShapeNet. The ShapeNet Dataset is a collection of 3D CAD models corresponding to categories in the WordNet lexical database. Due to its synthetic nature, ShapeNet is the standard dataset for quantitative evaluation of single-view 6 Figure 4. Comparison with NeRF-WCE [9] on the hydrants cate- gory of Co3D [34]. The first column shows the reference image, while the following three images show renders from a novel view (sampled randomly from a circle). The second column shows a render of the ground truth point cloud (obtained from COLMAP on the entire video). The third and fourth columns show renders from NeRF-WCE and our model. NeRF-WCE produces highly blurry outputs due to its deterministic nature. By contrast, our model produces realistic shapes from any viewpoint. Figure 5. Diversity. The leftmost column shows a reference image from the chair category of ShapeNet, chosen specifically for its high shape ambiguity. The following images show generations produced by our model for eight random seeds. We see that our model is capable of producing significant variations in shape while still matching the input image from the reference viewpoint. 7 Figure 6. Examples of reconstructions produced by our method along with prior work on seven classes from the ShapeNet-R2N2 dataset [1]. The leftmost image in each row is the conditioning image. Given the simplicity and synthetic nature of ShapeNet, all models produce adequate results; however, our model produces reconstructions with the highest level of detail. We perform partic- ularly well on challenging categories such as airplane and rifle. reconstruction methods. We use the subset of 13 ShapeNet categories from 3D-R2N2 [1] along with their standard set of camera viewpoints, renderings, and train-test splits, which we collectively refer to as the ShapeNet-R2N2 benchmark. For evaluation, we use the widely-adopted F-score metric proposed by Tatarchenko [48]. See the supplementary mate- rial for further details on the ShapeNet and evaluation. Co3D. The Co3D dataset is a challenging dataset consist- ing of multi-view images of real-world objects from com- mon object categories. For training data, we use point clouds generated from running COLMAP [39, 40] on each image sequence. Through these experiment, we demonstrate that our method is able to reconstruct real-world objects using training data that is derived only from multi-view images processed with COLMAP. We show results for three categories: hydrants, teddy bears, and toy trucks. Since there is no prior work on single- view reconstruction of Co3D, we train a NeRF-WCE [9] as Input(Reference View)Ground Truth Point Cloud (Novel View)NeRF-WCE(Novel View)Ours(Novel View)InputInput ViewNovelViewInput ViewNovelViewInput ViewNovelViewInput ViewNovelViewInputLegoFormerPix2Vox++OursInputLegoFormerPix2Vox++Ours a baseline and present qualitative results (Fig. 4). Implementation Details. For our diffusion model sθ, we adopt a Point-Voxel CNN (PVCNN) [21] based on its suc- cess as described in [60]. This model processes a point cloud Xt using two branches simultaneously: a point-based branch which processes points individually and a voxel- based branch which aggregates nearby points in a hierar- chical manner. In this way, the network is able to understand both the global and local structure of a point cloud. We implement our model in PyTorch [29] and use the PyTorch3D library [33] for rasterization during the projec- tion conditioning phase. Our point-voxel diffusion model is trained with batch size 16 for a total of 100,000 steps. For feature extraction, we use MAE [7]. For optimization, we use AdamW [15] with a β = (0.9, 0.999) and a learning rate which is decayed linearly from 0.0002 to 0 over the course of training. We use images of size 137 × 137px and point clouds with 8192 points, because prior work computes the F-Score metric using 8192 points. For our diffusion noise schedule, we use a linear schedule with warmup in which beta increases from 1 * 10−5 to 8 * 10−3. All experiments are performed on a single GPU. Quantitative Results. In Tab. 2, we show results for the 13 classes in the widely-used ShapeNet-R2N2 benchmark. Without filtering, PC2 performs on-par with prior work. Ex- amining the performance across categories, we see that our method performs better on categories with objects that have fine details, such as rifle and airplane. With filtering, which is only possible due to the proba- bilistic nature of our conditional diffusion process, PC2-FM consistently outperforms prior work; it improves upon the state-of-the-art on the majority of the object categories and on average. Qualitative Results. Figure 3 and Fig. 4 show qualitative results of our method on the real-world Co3D dataset. Fig- ure 3 visually demonstrates the intermediate steps of the diffusion process as well as the final coloring step. Figure 4 compares our generations to those from NeRF-WCE [9]. Since NeRF-WCE is deterministic, it struggles to model highly uncertain regions, and produces blurry images for novel views which are far from the reference view. By con- trast, our method produces realistic object shapes that can be viewed from any viewpoint. Relative to prior methods, our method is able to generate shapes with a significantly finer level of detail. Many additional qualitative results are shown in the sup- plementary material. Diversity of Generations. One key benefit of our proba- bilistic approach to 3D reconstruction is that we are able to generate multiple plausible shapes for a given reference view, as shown in Fig. 5 on the ShapeNet benchmark. This figure contains eight generations with different random seeds for three highly-ambiguous images in the chair category. Our method produces meaningful variations in shape, while al- ways remaining consistent with the input image from the given view. This ability to sample makes it possible for us to develop our filtering method, which we analyze below. Filtering Analysis. In Tab. 3, we compare the perfor- mance of our two filtering methods against our single-sample performance and an oracle. The oracle chooses the best sam- ple for each input image according to its F -score; it provides an upper-bound to the improvements attainable via filtering. Our mask-free filtering method (PC2-FA) improves results substantially and using masks (PC2-FM) improves them further. However, gap between our method and the oracle suggests that there remains room for further improvement; this represents an interesting potential avenue for future work. In Tab. 4, we compare our performance when filtering with different numbers of images. We find that using just two images significantly improves results, and adding additional images leads to further performance gains. Naturally, more and more samples further increase the performance but with diminishing returns. Limitations. The primary limitation of our model is the need for point cloud ground truth for training. As men- tioned in the introduction, this data is more accessible than commonly imagined, as it can be extracted from multi-view images or videos. However, point clouds obtained from these methods can be noisy; in Co3D, for example, many of the ground-truth point clouds for the hydrant category con- tain holes in locations that were not observed in the original video sequence. We find that our method is relatively robust to this type of noisy data, but we feel it is still important to discuss this limitation. 5. Conclusions In this paper, we have proposed PC2, a novel diffusion- based method for single-view 3D shape reconstruction. Our method iteratively reconstructs a shape by projecting image features onto a partially-denoised point cloud during the dif- fusion process. Empirically, our experiments demonstrate the effectiveness of PC2 at both reconstructing geometry and point color. Quantitatively, we outperform prior methods on synthetic benchmarks. Qualitatively, we are able to re- construct objects with high levels of detail from challenging real-world images. With regard to future work, it would be interesting to scale our method to larger datasets and models. Given the success of scaling diffusion models of 2D images (e.g., DALLE-2 [32]), we hope this work is a step along the path to developing similar models for 3D reconstruction. Ethics. We use the ShapeNet and CO3D datasets in a man- ner compatible with their terms. The images do not con- tain personal data. ShapeNet models are used in a man- 8 ner compatible with the Data Analysis Permission. Please see https://www.robots.ox.ac.uk/ ̃vedaldi/ research/union/ethics.html for further informa- tion on ethics. Acknowledgments. L. M. K. is supported by the Rhodes Trust. A. V. and C. R. are supported by ERC-UNION- CoG-101001212. C. R. is also supported by VisualAI EP/T028572/1. References [1] Christopher B Choy, Danfei Xu, JunYoung Gwak, Kevin Chen, and Silvio Savarese. 3D-R2N2: A unified approach for single and multi-view 3D object reconstruction. In Proc. ECCV, pages 628–644, 2016. 2, 3, 5, 6, 7 [2] Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. In Advances in Neural Informa- tion Processing Systems, volume 34, pages 8780–8794, 2021. 3 [3] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Syl- vain Gelly, et al. An image is worth 16x16 words: Trans- arXiv preprint formers for image recognition at scale. arXiv:2010.11929, 2020. 5 [4] Richard Hartley and Andrew Zisserman. Multiple View Geom- etry in Computer Vision. Cambridge University Press, 2000. 2 [5] Richard I. Hartley and Frederik Schaffalitzky. Reconstruction from projections using grassmann tensors. In Proc. ECCV, LNCS. Springer-Verlag, 2004. 2 [6] R. I. Hartley and A. Zisserman. Multiple View Geometry in Computer Vision. Cambridge University Press, ISBN: 0521540518, second edition, 2004. 2 [7] Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Doll ́ar, and Ross B. Girshick. Masked autoencoders are scal- able vision learners. In Proc. CVPR, volume abs/2111.06377, 2021. 8 [8] Kaiming He, Georgia Gkioxari, Piotr Doll ́ar, and Ross B. Girshick. Mask R-CNN. In Proc. ICCV, 2017. 6 [9] Philipp Henzler, Jeremy Reizenstein, Patrick Labatut, Ro- man Shapovalov, Tobias Ritschel, Andrea Vedaldi, and David Novotny. Unsupervised learning of 3d object categories from videos in the wild. In Proceedings of the IEEE/CVF Confer- ence on Computer Vision and Pattern Recognition (CVPR), pages 4700–4709, June 2021. 2, 3, 7, 8 [10] Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffu- sion probabilistic models. arXiv:2006.11239, 2020. 3 [11] Wonbong Jang and Lourdes Agapito. Codenerf: Disentangled neural radiance fields for object categories. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 12949–12958, 2021. 2 [12] Wonbong Jang and Lourdes Agapito. CodeNeRF: Disentan- In Proc. gled neural radiance fields for object categories. ICCV, 2021. 2, 3 [13] Abhishek Kar, Christian H ̈ane, and Jitendra Malik. Learning a multi-view stereo machine. In Nips, pages 364–375, 2017. 3 [14] Hiroharu Kato and Tatsuya Harada. Learning view priors for single-view 3d reconstruction. Proc. CVPR, 2019. 2 [15] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015. 8 [16] Erwin Kruppa. To determine an object from two perspectives with inner orientation. H ̈older, 1913. 2 [17] Jon ́aˇs Kulh ́anek, Erik Derner, Torsten Sattler, and Robert Babuˇska. ViewFormer: NeRF-free neural rendering from few images using transformers. In Proc. ECCV, 2022. 3 [18] Chen-Hsuan Lin, Oliver Wang, Bryan C. Russell, Eli Shecht- man, Vladimir G. Kim, Matthew Fisher, and Simon Lucey. Photometric mesh optimization for video-aligned 3d object reconstruction. In Proc. CVPR, June 2019. 2 [19] Luping Liu, Yi Ren, Zhijie Lin, and Zhou Zhao. Pseudo numerical methods for diffusion models on manifolds. In International Conference on Learning Representations, 2021. 3 [20] Shichen Liu, Tianye Li, Weikai Chen, and Hao Li. Soft raster- izer: A differentiable renderer for image-based 3d reasoning. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 7708–7717, 2019. 2 [21] Zhijian Liu, Haotian Tang, Yujun Lin, and Song Han. Point- voxel cnn for efficient 3d deep learning. In Conference on Neural Information Processing Systems (NeurIPS), 2019. 8, 12 [22] Shitong Luo and Wei Hu. Diffusion probabilistic models for 3d point cloud generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2021. 3 [23] Zhaoyang Lyu, Zhifeng Kong, Xudong XU, Liang Pan, and Dahua Lin. A conditional point diffusion-refinement paradigm for 3d point cloud completion. In International Conference on Learning Representations, 2022. 3 [24] S. J. Maybank. The angular velocity associated with the opti- cal flow field arising from motion through a rigid environment. Proc. R. Soc. Lond., 401, 1985. 2 [25] Chenlin Meng, Yutong He, Yang Song, Jiaming Song, Jiajun Wu, Jun-Yan Zhu, and Stefano Ermon. SDEdit: Guided image synthesis and editing with stochastic differential equations. In International Conference on Learning Representations, 2022. 2 [26] Lars Mescheder, Michael Oechsle, Michael Niemeyer, Se- bastian Nowozin, and Andreas Geiger. Occupancy networks: Learning 3d reconstruction in function space. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 4460–4470, 2019. 2 [27] B Mildenhall, PP Srinivasan, M Tancik, JT Barron, R Ra- mamoorthi, and R Ng. Nerf: Representing scenes as neural radiance fields for view synthesis. In European conference on computer vision, 2020. 3 [28] Alex Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin, Bob McGrew, Ilya Sutskever, and Mark Chen. Glide: Towards photorealistic image generation and editing with text-guided diffusion models. arXiv preprint arXiv:2112.10741, 2021. 2, 3 9 [29] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. Ad- vances in neural information processing systems, 32, 2019. 8 [30] Charles R Qi, Hao Su, Kaichun Mo, and Leonidas J Guibas. PointNet: Deep learning on point sets for 3d classification and segmentation. In Proc. CVPR, pages 652–660, 2017. 3, 12 [31] Charles Ruizhongtai Qi, Li Yi, Hao Su, and Leonidas J Guibas. PointNet++: Deep hierarchical feature learning on point sets in a metric space. In Nips, pages 5099–5108, 2017. 12 [32] Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical text-conditional image genera- tion with clip latents. arXiv preprint arXiv:2204.06125, 2022. 2, 8 [33] Nikhila Ravi, Jeremy Reizenstein, David Novotny, Taylor Gordon, Wan-Yen Lo, Justin Johnson, and Georgia Gkioxari. Accelerating 3d deep learning with pytorch3d. arXiv preprint arXiv:2007.08501, 2020. 5, 8 [34] Jeremy Reizenstein, Roman Shapovalov, Philipp Henzler, Luca Sbordone, Patrick Labatut, and David Novotny. Com- mon objects in 3d: Large-scale learning and evaluation of real-life 3d category reconstruction. In International Confer- ence on Computer Vision, 2021. 2, 4, 7 [35] Jeremy Reizenstein, Roman Shapovalov, Philipp Henzler, Luca Sbordone, Patrick Labatut, and David Novotny. Com- mon Objects in 3D: Large-scale learning and evaluation of real-life 3D category reconstruction. In Proc. CVPR, 2021. 3 [36] Konstantinos Rematas, Ricardo Martin-Brualla, and Vittorio Ferrari. Sharf: Shape-conditioned radiance fields from a sin- gle view. In International Conference on Machine Learning, pages 8948–8958. PMLR, 2021. 2 [37] Konstantinos Rematas, Ricardo Martin-Brualla, and Vittorio Ferrari. ShaRF: Shape-conditioned radiance fields from a single view. In Proc. ICML, 2021. 2, 3 [38] Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Bj ̈orn Ommer. High-resolution image synthesis with latent diffusion models, 2021. 2, 3 [39] Johannes Lutz Sch ̈onberger and Jan-Michael Frahm. Structure-from-motion revisited. In Conference on Computer Vision and Pattern Recognition (CVPR), 2016. 7 [40] Johannes Lutz Sch ̈onberger, Enliang Zheng, Marc Pollefeys, and Jan-Michael Frahm. Pixelwise view selection for un- structured multi-view stereo. In European Conference on Computer Vision (ECCV), 2016. 7 [41] Karen Simonyan and Andrew Zisserman. Very deep convo- lutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014. 3 [42] Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. arXiv:2010.02502, 2020. 3 [43] Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. volume 32, 2019. 3 [44] Yang Song and Stefano Ermon. Improved techniques for training score-based generative models. volume 33, pages 12438–12448, 2020. 3 [45] Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Ab- hishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In International Conference on Learning Representations, 2021. 3 [46] Xingyuan Sun, Jiajun Wu, Xiuming Zhang, Zhoutong Zhang, Chengkai Zhang, Tianfan Xue, Joshua B Tenenbaum, and William T Freeman. Pix3d: Dataset and methods for single- image 3d shape modeling. In Proceedings of the IEEE Con- ference on Computer Vision and Pattern Recognition, pages 2974–2983, 2018. 2 [47] Maxim Tatarchenko, Stephan R Richter, Ren ́e Ranftl, Zhuwen Li, Vladlen Koltun, and Thomas Brox. What do single- view 3d reconstruction networks learn? In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 3405–3414, 2019. 2 [48] Maxim Tatarchenko, Stephan R. Richter, Rene Ranftl, Zhuwen Li, Vladlen Koltun, and Thomas Brox. What do single-view 3d reconstruction networks learn? In Proc. CVPR, June 2019. 5, 7 [49] Bram Wallace and Bharath Hariharan. Few-shot generaliza- tion for single-image 3d reconstruction via priors. In Proceed- ings of the IEEE/CVF International Conference on Computer Vision, pages 3818–3827, 2019. 2 [50] Nanyang Wang, Yinda Zhang, Zhuwen Li, Yanwei Fu, Wei Liu, and Yu-Gang Jiang. Pixel2mesh: Generating 3d mesh models from single rgb images. In Proceedings of the Euro- pean Conference on Computer Vision (ECCV), pages 52–67, 2018. 2 [51] Peng Wang, Lingjie Liu, Yuan Liu, Christian Theobalt, Taku Komura, and Wenping Wang. NeuS: Learning neural implicit surfaces by volume rendering for multi-view reconstruction. arXiv.cs, abs/2106.10689, 2021. 3 [52] Daniel Watson, William Chan, Jonathan Ho, and Moham- mad Norouzi. Learning fast samplers for diffusion models by differentiating through sample quality. In International Conference on Learning Representations, 2021. 3 [53] Yan Xia, Cheng Wang, Yusheng Xu, Yu Zang, Weiquan Liu, Jonathan Li, and Uwe Stilla. Realpoint3d: Generating 3d point clouds from a single image of complex scenarios. Re- mote Sensing, 11(22), 2019. 2 [54] Haozhe Xie, Hongxun Yao, Xiaoshuai Sun, Shangchen Zhou, and Shengping Zhang. Pix2vox: Context-aware 3d reconstruc- tion from single and multi-view images. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 2690–2698, 2019. 2, 3, 5, 6 [55] Haozhe Xie, Hongxun Yao, Shengping Zhang, Shangchen Zhou, and Wenxiu Sun. Pix2vox++: multi-scale context- aware 3d object reconstruction from single and multi- International Journal of Computer Vision, ple images. 128(12):2919–2935, 2020. 2, 3, 5, 6 [56] Farid Yagubbayli, Alessio Tonioni, and Federico Tombari. Legoformer: Transformers for block-by-block multi-view 3d reconstruction, 2021. 2, 3, 6 10 [57] Alex Yu, Vickie Ye, Matthew Tancik, and Angjoo Kanazawa. pixelnerf: Neural radiance fields from one or few images. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 4578–4587, 2021. 2, 3 [58] Alex Yu, Vickie Ye, Matthew Tancik, and Angjoo Kanazawa. PixelNeRF: Neural radiance fields from one or few images. In Proc. CVPR, 2021. 2, 6 [59] Zehao Yu, Jia Zheng, Dongze Lian, Zihan Zhou, and Shenghua Gao. Single-image piece-wise planar 3d recon- struction via associative embedding. In Proc. CVPR, June 2019. 2 [60] Linqi Zhou, Yilun Du, and Jiajun Wu. 3d shape generation and completion through point-voxel diffusion. In Proceed- ings of the IEEE/CVF International Conference on Computer Vision (ICCV), pages 5826–5835, October 2021. 3, 8 11 6. Implementation Details 8. Additional Ablations We include additional ablations omitted from the main paper due to space constraints. These ablations were per- formed on a subset of ShapeNet dataset consisting of only the sofa category. Mask Distance Function. We removed the 2D mask dis- tance function described in Section 6. This change had a small effect, reducing the F -score by 0.019 points, a relative decrease of 9%. Qualitatively, the generated point clouds were similar to those produced using the mask distance func- tion. Projection Method. We replaced the rasterization-based projection described in Section 3.4 with a naive projection that projects all points (including occluded points) onto the image. This change was detrimental, reducing the F -score by 0.081 points, a relative decrease of 40%. Qualitatively, these point clouds were significantly worse than those with the rasterization-based projection. These results suggest that the rasterization-based projection is a key component of the method. 9. Analysis of Failure Cases Failure cases of our model are shown in Fig. 11. Note that these are from the ShapeNet-R2N2 dataset, which combines 13 ShapeNet classes but does not permit the use of category labels. In other words, the model is image-conditional, but not class-conditional. Examining these failure cases, we observe that our model sometimes performs poorly on images with ambiguous cate- gories. For example, in the 8th column of the 2nd row of the figure, it appears that the model generates a chair rather than a box. Similarly, in the 12th row of the 5th row of the figure, the object seems to have generated a box rather than a couch. These errors are most likely due to the fact that these cate- gories all have instances which resemble rectangular prisms from certain views. It is also notable that on many of the challenging examples on which our model struggles (e.g., the examples for the watercraft category located in the last row of the figure), other models also struggle to a similar degree. Here, we provide additional details about the model and projection procedure. First, we discuss the Point-Voxel [21] model which is used to process the partially-denoised point cloud at each step of the diffusion process. As its name suggests, this model processes a point cloud using two branches simul- taneously: a point-based branch and voxel-based branch. The point-based branch is a simple multi-layer perceptron which is applied to each point independently, as in Point- Net [30, 31] (without the global pooling in the final layer of PointNet). The voxel-based branch first discretizes the points into a coarse voxel grid of size 1283, which is fed into a 3D U-Net. As in [21], the 3D U-Net consists of four downsampling ("Set Abstraction") layers followed by four upsampling ("Feature Propogation") layers. Due to this fine- to-coarse-to-fine structure, the network is able to capture both global and local shape information. Additionally, to make the model aware of the current timestep of the diffu- sion process, we concatenate an embedding of the current timestep to the point features at the input to each layer. Second, we discuss the implementation of the projec- tion feature. We perform the projection by rasterizing the point cloud from the given camera view. We utilize the PointRasterizer class of PyTorch3D using a point ra- dius of 0.0075 and 1 point per pixel. For each point in the point cloud, if the point is rasterized onto a pixel in the input image, we concatenate the image features corresponding to the pixel onto that point's existing feature vector (which is simply a sinusoidal positional embedding of its current posi- tion) for input to the model. Additionally, we concatenate the value of the (binary) object mask at the given pixel and a two-dimensional vector pointing from the pixel to the closest pixel in the mask (i.e. a two-dimensional distance function corresponding to the mask region; this is the zero vector inside the mask and a nonzero vector outside the mask). If a pixel is not rasterized to a point (for example, because it is occluded by another point), we concatenate a vector of zeros in place of all the quantities above. 7. Additional Qualitative Examples We provide additional qualitative examples of our method in Figs. 7, 8 and 10 to 12. Figures 7 to 9 show examples of reconstructions on additional categories of Co3D, includ- ing hydrants, teddybears, glasses, remotes, motorcycles, hairdryers, plants, and donuts. Fig. 10 contains a selec- tion of the best reconstructions produced by our model for each category of ShapeNet, as ranked by F-score. Fig. 12 contains random examples of reconstructions produced by our model on ShapeNet. Finally, Fig. 11 shows a selection of the worst examples produced by our model for each category on ShapeNet, as ranked by F-score. 12 Figure 7. Additional qualitative examples. Examples from the hydrants category of Co3D. The first column in each row shows the input image. The second and third columns show intermediate steps in the diffusion process. The fourth column shows the final reconstructed point cloud with color. The remaining five rows show the final predicted point cloud from novel views. 13 Figure 8. Additional qualitative examples. Examples from the teddy bear category of Co3D. The first column in each row shows the input image. The second and third columns show intermediate steps in the diffusion process. The fourth column shows the final reconstructed point cloud with color. The remaining five rows show the final predicted point cloud from novel views. 14 Figure 9. Additional qualitative examples. Examples from six additional categories: glasses, remotes, motorcycles, hairdryers, plants, and donuts. 15 InputMasked InputInput ViewNovel ViewInputMasked InputInput ViewNovel View Figure 10. Successful examples produced by our method along with prior work. The leftmost image in each set of images is the input image. Note that there are no images in the last row of the right half of the figure because we show examples for all 13 ShapeNet-R2N2 classes (seven on the left and six on the right). 16 Figure 11. Failure cases of our method along with prior work. The leftmost image in each set of images is the input image. Note that there are no images in the last row of the right half of the figure because we show examples for all 13 ShapeNet-R2N2 classes (seven on the left and six on the right). 17 Figure 12. Random examples of our method along with prior work. The leftmost image in each set of images is the input image. Note that there are no images in the last row of the right half of the figure because we show examples for all 13 ShapeNet-R2N2 classes (seven on the left and six on the right). 18
http://arxiv.org/abs/2302.10667v1
2023-02-21T13:28:37
2023-02-21T13:28:37
Reinforcement Learning in a Birth and Death Process: Breaking the Dependence on the State Space
In this paper, we revisit the regret of undiscounted reinforcement learning in MDPs with a birth and death structure. Specifically, we consider a controlled queue with impatient jobs and the main objective is to optimize a trade-off between energy consumption and user-perceived performance. Within this setting, the \emph{diameter} $D$ of the MDP is $\Omega(S^S)$, where $S$ is the number of states. Therefore, the existing lower and upper bounds on the regret at time$T$, of order $O(\sqrt{DSAT})$ for MDPs with $S$ states and $A$ actions, may suggest that reinforcement learning is inefficient here. In our main result however, we exploit the structure of our MDPs to show that the regret of a slightly-tweaked version of the classical learning algorithm {\sc Ucrl2} is in fact upper bounded by $\tilde{\mathcal{O}}(\sqrt{E_2AT})$ where $E_2$ is related to the weighted second moment of the stationary measure of a reference policy. Importantly, $E_2$ is bounded independently of $S$. Thus, our bound is asymptotically independent of the number of states and of the diameter. This result is based on a careful study of the number of visits performed by the learning algorithm to the states of the MDP, which is highly non-uniform.
[ "Jonatha Anselmi", "Bruno Gaujal", "Louis-Sébastien Rebuffi" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10667v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10667v1", "@rel": "related", "@type": "application/pdf" } ]
[ "NeurIPS 2022 - 36th Conference on Neural Information Processing\n Systems, Nov 2022, New Orleans, United States" ]
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "stat.ML" ]
3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 7 6 6 0 1 . 2 0 3 2 : v i X r a Reinforcement Learning in a Birth and Death Process: Breaking the Dependence on the State Space Jonatha Anselmi [email protected] Univ. Grenoble Alpes, Inria, CNRS, Grenoble INP, LIG, 38000 Grenoble, France. Bruno Gaujal [email protected] Univ. Grenoble Alpes, Inria, CNRS, Grenoble INP, LIG, 38000 Grenoble, France. Louis-Sébastien Rebuffi [email protected] Univ. Grenoble Alpes, Inria, CNRS, Grenoble INP, LIG, 38000 Grenoble, France. Abstract In this paper, we revisit the regret of undiscounted reinforcement learning in MDPs with a birth and death structure. Specifically, we consider a controlled queue with impatient jobs and the main objective is to optimize a trade-off be- tween energy consumption and user-perceived performance. Within this setting, the diameter D of the MDP is Ω(SS), where S is the number of states. Therefore, the existing lower and upper bounds on the regret at time T , of order O(√DSAT ) for MDPs with S states and A actions, may suggest that reinforcement learning is inefficient here. In our main result however, we exploit the structure of our MDPs to show that the regret of a slightly-tweaked version of the classical learning al- gorithm UCRL2 is in fact upper bounded by ̃ (√E2AT ) where E2 is related to O the weighted second moment of the stationary measure of a reference policy. Im- portantly, E2 is bounded independently of S. Thus, our bound is asymptotically independent of the number of states and of the diameter. This result is based on a careful study of the number of visits performed by the learning algorithm to the states of the MDP, which is highly non-uniform. 1 Introduction In the context of undiscounted reinforcement learning in Markov decision processes (MDPs), it has been shown in the seminal work [11] that the total regret of any learning algorithm with respect to an optimal policy is lower bounded by Ω(√DSAT ), where S is the number of states, A the number of actions, T the time horizon and D the diameter of the MDP. Roughly speaking, the diameter is the mean time to move from any state s to any other state s′ within an appropriate policy. In the literature, several efforts have been dedicated to approach this lower bound. As a result, learning algorithms have been developed with a total regret of ̃ (D√SAT ) in [3] and O even ̃ (√DSAT ) according to [22, 26]. These results may give a sense of optimality since the O lower bound is attained up to some universal constant. However, lower bounds are based on the minimax approach, which relies on the worst possible MDP with given D, A and S. This means that when a reinforcement learning algorithm is used on a given MDP, one can expect a much better performance. (DS√AT ) in [11], ̃ O This is a corrected version of the NeurIPS 2022 publication (several typos in the proofs). One way to alleviate the minimax lower bound is to consider structured reinforcement learning, or equivalently MDPs with some specific structure. The exploitation of such structure may yield more efficient learning algorithms or tighter regret analyses of existing learning algorithms. In this context, a first example is to consider factored MDPs [6, 9], i.e., MDPs where the state space can be factored into a number of components; in this case, roughly speaking, S = K n where n is the number of "factors" and K is the number of states in each factor. The regret of learning algorithms in factored MDPs has been analyzed in [21, 18, 25, 15] and it is found that the S term of existing upper bounds can be replaced by nK. A similar approach is used in [8] to learn the optimal policy in stochastic bandits with a regret that is logarithmic in the number of states. There is also a line of research works that exploit the parametric nature of MDPs. Inspired by parametric bandits, a d-linear additive model was introduced in [12], where it is shown that an optimistic modification of Least-Squares Value Iteration, see [16], achieves a regret over a finite horizon H of ̃ (√d3H 3T ) O where d is the ambient dimension of the feature space (the number of unknown parameters). In this case, the regret does not depend on the number of states and actions and the diameter is replaced by the horizon. A discussion about the inapplicability of this approach to our case is postponed to Section 4.2. Learning in Queueing Systems. The control of queueing systems is undoubtedly one of the main application areas of MDPs; see, e.g., [17, Chapters 1–3] and [14]. Within the rich literature of structured reinforcement learning however, few papers are dedicated to reinforcement learning in queueing systems, see [23, Section 5], and this motivates us to examine the total regret in this context. Typical control problems on queues have the following distinguishing characteristics: 1. No discount. Discounting costs or rewards is common practice in the reinforcement learning literature, especially in Q-learning algorithms [20]. However, in queues one is typically interested in optimizing with respect to the average cost. 2. Large diameter. Queueing systems are usually investigated under a drift condition that makes the system stable, i.e., positive recurrent. This condition implies that some states are hard to reach. In fact, for many queueing control problems, the diameter D is exponential in the size of the state space. Even in the simple case of an M/M/1 queue with a finite buffer, or equivalently a birth–death process with a finite state space and constant birth and death rates, the diameter is exponential in the size of the state space. 3. Structured transition matrices. Queueing models describe how jobs join and leave queues, and this yields bounded state transitions. As a result, MDPs on queues have sparse and structured transition matrices. The regret bounds discussed above and item 2 may suggest that the total regret of existing learning algorithm, when applied to queueing systems, is large. However, they often work well in practice and this bring us to consider the following question: When the underlying MDP has the structure of a queueing system, do the diameter D or the number of states S actually play a role in the regret? − Our Contribution. In this paper, we examine the previous question with respect to the class of control problems presented in [1]. Specifically, an infinite sequence of jobs joins a service system over time to receive some processing according to the first-come first-served scheduling rule; the system can buffer at most S 1 jobs and in fact it corresponds to an M/M/1/S-1 queue. In addition, each job comes with a deadline constraint, and if a job is not completed before its deadline, then it becomes obsolete and is removed from the system. The controller chooses the server processing speed and the objective is to design a speed policy for the server that minimizes its average energy consumption plus an obsolescence cost per deadline miss. Although this may look quite specific, this problem captures the typical characteristics of a controlled queue: i) the transition matrix has the structure of a birth and death process with jump probabilities that are affine functions of the state and ii) the reward is linear in the state and convex in the action. For any MDP in this class, defined 2); see Appendix B.3. Thus, in full details in Section 3, we show that the diameter is D = Ω(SS without exploiting the particular structure of this MDP, the existing lower and upper bounds do not justify the reason why standard learning algorithms work efficiently here. − We provide a slight variation of the learning algorithm UCRL2, introduced in [11], and show in our main result that the resulting regret is upper bounded by ̃ (√E2AT ) where E2 is a term that O depends on the stationary measure of a reference policy defined in Section 3.1. Importantly, E2 2 does not depend on S. Thus, efficient reinforcement learning can be achieved independently of the number of states by exploiting the stationary structure of the MDP. Let us provide some intuition about our result. First, one may think that any learning algorithm should visit each state a sufficient number of times, which justifies why the diameter of an MDP appears in existing regret analyses. However, this point of view does not take into account the fact that the value of an MDP is the scalar product of the reward and the stationary measure of the optimal policy. If this stationary measure is "highly non-uniform", then some states are rarely visited under the optimal policy and barely contribute to the value. In this case, we claim that the learner may not need to visit the rare states that often to get a good estimation of the value, and thus it may not need to pay for the diameter. 2 Reinforcement Learning Framework A We consider a unichain Markov Decision Process (MDP) M = ( S S the finite action space, P the transition probabilities and r the expected is the finite state space, reward function [17]. Let also S := is the set cardinality operator. The model-based reinforcement learning problem consists in finding a learning algorithm, or learner, that chooses actions to maximize a cumulative reward over a finite time horizon T . At each time N, the system is in state st ∈ S step t . When executing at, the learner receives a random reward rt(st, at) with mean r(st, at) and the system moves, at time step t + 1, to state s′ with probability P (s′ st, at). The learning algorithm does not know the MDP M except for the sets and the learner chooses an action at ∈ A , P, r) in discrete time where and A := where and |A| | * | |S| A ∈ , | S . A For simplicity, in the following we consider weakly communicating MDPs. Since we will be inter- ested in the long-run average cost, this will let us remove the dependence on the initial state for several quantities of interest. 2.1 Undiscounted Regret Given an MDP M , let Π := and let π : { S → A} denote the set of stationary and deterministic policies ρ(M, π) := lim →∞ T 1 T t=1 X T E[r(st, π(st))] (1) denote the average reward induced by policy π. Since M has finite state and action spaces, we notice that i) The limit in (1) always exists, ii) It does not depend on the initial state s0 when M is unichain [17] and iii) The restriction to stationary and deterministic policies is not a loss of optimal- ity [17, Theorem 8.4.5]. Let also ρ∗ := ρ∗(M ) := maxπ Π ρ(M, π) be the optimal average reward. Definition 2.1 (Regret). The regret at time T of the learning algorithm L is ∈ Reg(M, L, T ) := T ρ∗(M ) T − t=1 X rt. (2) The regret 2 is a natural benchmark for evaluating the performance of a learning algorithm. In [11], a universal lower bound on Reg(M, L, T ) has been developed in terms of the diameter of the under- lying MDP. Definition 2.2 (Diameter of an MDP). Let π : s. Let T (s′ 0 : st = s′ in which s′ is reached from s under π. Then, we say that the diameter of M is be a stationary policy of M with initial state be the random variable for the first time step S → A s0 = s } M, π, s) := min ≥ { t | | D(M ) := max =s′ min π: s S→A E [T (s′ | M, π, s)] . It should be clear that the diameter of an MDP can be large if there exist states that are hard to reach. Within the set of structured MDPs considered in this paper, this will be the case and we will 2). The following result shows that all learning algorithms have a regret that show that D = Ω(SS eventually increase with √D. − 3 6 Theorem 2.3 (Universal lower bound [11]). For any learning algorithm L, any natural numbers DSA, there is an MDP M with S states, A actions, and S, A diameter D such that for any initial state s 20 logA S, and T 10, D ≥ ≥ ≥ ≥ In view of this result, the diameter of an MDP and its state space appear to be critical parameters for evaluating the performance of a learning algorithm. 0.015√DSAT . (3) , ∈ S E[Reg(M, L, T )] 2.2 The UCRL2 Algorithm We now focus on UCRL2, a classical reinforcement learning algorithm introduced in [11] that is a variant of UCRL [2]. While more efficient algorithms have been proposed for the general case (see for example [3, 22]), we will show that UCRL2 already achieves a very low regret, namely ̃ (√AT ), O independent of S so using more refined algorithms can only bring marginal gains. UCRL2 is based on episodes. For each episode k, let tk denote its start time. For each state s and action a, let νk(s, a) denote the number of visits of (s, a) during episode k and let Nt(s, a) := Mk be the # { confidence set of MDPs with transition probabilities ̃p and rewards ̃r that are "close" to the empirical MDP at episode k, ˆpk and ˆrk, i.e., ̃p and ̃r satisfy denote the number of visits of (s, a) until timestep t. Let τ < t : sτ = s, aτ = a } (s, a), ∀ ̃r(s, a) | − ˆrk(s, a) | ≤ rmax s 7 log (2SAtk/δ) 1, Ntk(s, a) } { 2 max (s, a), ∀ s, a) ̃p( *| k ˆpk( *| − s, a) k1 ≤ s 14S log (2Atk/δ) 1, Ntk(s, a) max } { . (4) (5) With these quantities, a pseudocode for UCRL2 is given in Algorithm 1. We notice that UCRL2 relies on Extended Value Iteration (EVI), that is a variant of the celebrated Value Iteration (VI) algo- rithm [17]; for further details about EVI, we point the reader to [11, Section 3.1]. Let us comment on how UCRL2 works. There are three main steps. First, at the start of each episode, UCRL2 computes Algorithm 1: The UCRL2 algorithm. Input: A confidence parameter δ Output: . ∈ (0, 1), and . A S 1 Set t := 1 and observe s1 2 for episodes k = 1, 2, . . . do 3 Compute the estimates ˆr(s, a) and ˆpk(s′ s, a) as in (7). Use "Extended Value Iteration" to find a policy ̃πk and an optimistic MDP ̃Mk ∈ Mk such that (6) max ∈Mk,π ρ( ̃Mk, ̃πk) 1 √tk ρ(M ′, π) M ′ − | ≥ 1, Ntk(st, ̃πk(st)) } do while νk(st, ̃πk(st)) < max { Choose action at = ̃πk(st), obtain reward rt and observe st+1; νk(st, at) := νk(st, at) + 1; t := t + 1; 4 5 6 7 8 end 9 10 end the empirical estimates ˆrk(s, a) := 1 tk− t=1 rt1 max { P 1, Ntk (s, a) } { st=s,at=a } , ˆpk(s′ | s, a) := 1 tk− t=1 1 max P { st=s,at=a,st+1=s′ 1, Ntk(s, a) } { } (7) of the reward and probability transitions, respectively, where 1E is the indicator function of E. Then, it applies Extended Value Iteration (EVI) to find a policy ̃πk and an optimistic MDP ̃Mk ∈ Mk such that (6) holds true. Finally, it executes policy ̃πk until it finds a state-action pair (s, a) whose count within episode k is greater than the corresponding state-action count prior to episode k. 4 3 Controlled Birth and Death Processes for Energy Minimization ∈ M M [0, λmax] in a buffer of size S Now, we focus on a specific class of MDPs that has been introduced in [1], which provides a rather general example of a controlled birth and death process with convex costs on the actions and linear rates. We will denote by the set of MDPs with the structure described below. The MDPs have been proposed to represent a Dynamic Voltage and Frequency Scaling (DVFS) processor in executing jobs with soft obsolescence deadlines. Here, jobs arrive according to a Poisson process with rate λ 1. If the buffer is full and a job arrives, then the job is rejected. Each job has a deadline and a size, i.e., amount of work, which are exponentially [0, μmax] and one, respectively. Job deadlines and sizes distributed random variables with rates μ are all independent random variables. If a job misses its deadline, which is a real time constraint activated at the moment of its arrival, it is removed from the queue without being served and a cost C is paid. The processor serves jobs under any work-conserving scheduling discipline, e.g., first-come first-served, with a processing speed that belongs to the finite set . The objective is to design a speed policy that minimizes the sum of the long term power dissipation and the cost induced by jobs missing their deadlines. When the processor works at speed a , it processes a units of work per second while its power dissipation is w(a). 0, . . . , Amax} 0, . . . , Amax} ∈ { − ∈ { After uniformization, it is shown in [1] that this control problem can be modeled as an MDP in discrete time with a "birth-and-death" transition matrix of size S. Specifically, we have an MDP representing the number of jobs in the , with s 0, . . . , S M = ( } A system, and representing the processor speed. Then, the transition , with a probabilities under policy π are given by S { 0, . . . , Amax} , P, r) where − ∈ A ∈ S A = = S { 1 , Pi,j(π) =   1 U λi 1 U (π(i) + iμ) Pii 0 1 and j = i + 1 if i < S − if i > 0 and j = i if j = i otherwise, 1 −  1 − 1)μmax + Amax is a uniformization constant, Pii = 1 where U := λmax + (S is the decaying arrival rate. We have replaced the constant arrival rate λ by and λi := λ a decaying arrival rate λi because we want to learn an optimal policy that does not exploit the buffer size S 1; see [1] for further details. For conciseness, Figure 1 displays the transition diagram of the Markov chain induced by policy π. λi − U (U π(i)) μi − − − − (cid:16) (cid:17) − S 1 i Pii i λi U i + 1 • • • S 1 − 0 • • • 1 i − 1 U (iμ + π(i)) Figure 1: Transition diagram of the Markov chain induced by policy π of an MDP in . M Finally, the reward is a combination of C, the constant cost due to a departing job missing its deadline and w(a), an arbitrary convex function of a, giving the energy cost for using speed a. The immediate cost c(s, a) in state s under action a is a random variable whose value is w(a)/U + C with probability sμ/U (missed deadline) and w(a)/U otherwise. To keep in line with the use of rewards instead of costs, we introduce a bound on the cost, rmax := C + w(Amax)/μ so that the reward in state s under action a is a positive and bounded random variable given by r(s, a) := rmax − c(s, a). (8) As in Section 2.1, ρ∗(M ) is the optimal average cost and ρ(M, π) is the average cost induced by policy π, where π belongs to the set of deterministic and stationary policies Π. Since the underlying 5 Markov chain induced by any policy is ergodic, we observe that S 1 − ρ(M, π) = E[r(s, π(s))]mπ s , (9) where mπ is the stationary measure under policy π. In [1], it has been shown that the optimal policy is unique and will be denoted by π∗. s=0 X 3.1 Properties of M In the following, we will use the "reference" (or bounding) policy π0(s) = 0 for all s , which thus assigns speed 0 to all states. This policy provides a stochastic bound on all policies in the following sense. Let sπ ≤st denote the stochastic order [19]; t be the state under policy π and let given two random variables X and Y on R+, we recall that X ≤st Y if P(X s) for s) ≥ ≤ all s. t ≤st sπ0 Π, sπ Lemma 3.1. Consider an MDP in 0 ≤st sπ0 sπ 0 . Proof. (sketch) The proof follows by a simple coupling argument between the two policies. Roughly speaking, each time the Markov chain under π decreases from s to s 1 because of the speed π(s), it stays in state s under policy π0. . For all t and policy π , provided that P(Y ∈ S M − ≥ ∈ t P(sπ0 Therefore, P(sπ measures are comparable, i.e., t ≥ s) ≤ s) for all s and t, which also implies that the respective stationary t ≥ 1 S i=s mπ − i=s mπ0 − S 1 . i Let us now consider H(s), the bias at state s of a policy π, defined by P i ≤ P H(s) := Eπ ∞ (r (sπ t , π(sπ t )) ρπ(M )) − sπ 0 = s | , # 0 ∀ ≤ s ≤ S − 1. (10) " t=1 X − − Let also ∂H(s) := H(s) H(s 1) be the local variation of the bias. The following result on the variations of the bias holds (see Appendix C.1): Lemma 3.2. The local variation of the bias ∂H(s) is bounded: ∂H(s) 2rmaxeλ/μ(1 + log s) for all 1 1. S s | | ≤ ≤ ≤ − ∆(s) with ∆(s) := Both mπ0 and ∆ will play a major role in our analysis of the regret. 3.2 Applying UCRL2 in M We assume that the bounds λmax and μmax are fixed so that rmax is known to the learner. This is a classical assumption, often replaced by assuming that rewards live in [0, 1]. rmax 2 log(2Atk) In the remainder, we will apply UCRL2 over an MDP in with a change in the confidence bounds to take into account the support of P . The confidence bounds in (4) (resp. (5)) are replaced by Mk only contains matrices with the same support as P . Removing S in the confidence bounds does help to reduce the regret. However, by using existing analysis, this only removes a factor √S in the regret bound (for example, see [4]). ). We also impose that the confidence set 1,Ntk (s,a) { 1,Ntk (s,a) 8 log(2Atk) (resp. M max max r q } { } Finally, note that UCRL2 does not benefit from the parametric nature of the MDPs in ). essentially defined by three parameters (λ, μ and C) and the real convex function w( * M , which is 4 Regret of UCRL2 on M Our objective is to develop an upper bound on the regret of the learning algorithm UCRL2 when applied to MDPs in our class . The driving idea is to construct a bound that exploits the structure M of the stationary measure of all policies, as they all make some states hard to reach, and to control the number of visits to these states to get a new type of bound. 6 4.1 Main Result The following theorem gives an upper bound on the regret that does not depend on the classical parameters such as the size of the state space nor on global quantities such as the diameter of the MDP nor the span of the bias of some policy. Instead, the regret bound below mainly depends on the weighted second moment of the stationary measure of the reference policy π0, which is bounded independently of the size of the state space. We consider the policy πmax such that πmax(s) = Amax for all s and mmax its stationary measure. Let us also recall that mπ0 for all s and that ∆ : E2 := F E − * is closely related to the second moment of the measure mπ0 (cid:2) maximal reward. is the stationary measure of the Markov chain under policy π0(s) = 0 R+ is a function bounding the local variations of the optimal bias. Let max 1) 1. Here, E2 (∆(s+1)+rmax)2 and F := } ∈S weighted by the bias variations and the S → (∆ + rmax)2 with f : s f (s)− mπ0 1,s(s P 7→ f (cid:3) { s Theorem 4.1. Let M . Define Qmax := ∈ M 10D mmax(S 1) − (cid:16) 2 log (cid:17) (cid:18)(cid:16) 10D mmax(S 1) − 4 . (cid:19) (cid:17) E [Reg(M, UCRL2, T )] ≤ 19 E2AT log (2AT ) p + 97rmaxD2SA max { Qmax, T 1/4 } log2(2AT ). (11) Here, E2 ≤ 60e2λ/μ r2 max 1 + λ2 μ2 , so that the regret satisfies (cid:16) E [Reg(M, UCRL2, T )] = (cid:17) rmaxeλ/μ O AT s 1 + (cid:18) λ2 μ2 (cid:19) log (AT ) ! . Before giving a sketch of the proof, let us comment on the bound (11). Although the first term is of order √T with a multiplicative constant independent of S - as desired - the second term, of order T 1/4, contains very large terms. However, its interest lies in the novel approach used in the proof that uses the stationary behavior of the algorithm. 4.2 Comparison with Other Bounds Let us compare our upper bound with the ones existing in the literature, as we claim that ours is of a different nature. First, let us compare with the bound given in [11], which states that with probability 1 δ, T δ ≤ q 34DS AT log for any T > 1. For any M , the diameter grows as Reg(M, T ) SS (see Appendix B.3), thus this bound is very loose here. More recent works have improved this bound by replacing the term D by the local diameter of the MDP [5]. In Appendix B.3, we show that the local diameter grows again as SS for any M , and thus these results do not yield significant improvements. Other papers show that the diameter can be replaced by the span of the bias, see [7, 26]. This has a big impact because the span of the bias, for any M , is linear in S (instead of SS for the diameter); see Appendix B.3. However, this is still not as good as the bound given in Theorem 4.1, which is independent of S. ∈ M ∈ M ∈ M (cid:0) (cid:1) − *| Now, let us compare with existing bounds for parametric MDPs, as mentioned in the introduction. The d-linear additive model, d < S, introduced in [12] assumes that P ( , ) i where φ(s, a) is a known feature mapping and θ is an unknown measure on Rd. This form s, a) implies that the transition kernel is of rank d. Unfortunately, this property does of P ( not hold true in birth and death processes. has almost full rank under all policies. The linear mixture model introduced in [27] assumes instead that Rd. This is more adapted to our case, which can be (almost) P (s′ seen as a linear mixture model of dimension d = 3. The bound on the discounted regret of the algo- γ)2 where γ is a discount factor. In contrast to rithm proposed in [27] is Reg(M, T ) − our work, this regret analysis holds for discounted problems, where we remark that both the diame- 2, ter and the span are irrelevant. On the other hand, both are replaced by a term of the form (1 In fact, the kernel of any M φ(s, a), θ( * h d√T /(1 φ(s′ h s, a) = s, a) = s, a), θ , θ i ∈ M ≤ ∈ *| | | γ)− − 7 1. More recently, a regret bound of which implies that the previous bound grows to infinity as γ O(d√DT ) has been proven in [24] in the undiscounted case, that is the case considered in our work. However, the algorithm presented in that reference highly depends on the diameter and is unsuitable for MDPs with a birth and death structure. ↑ Finally, our bound depends on the second moment of the stationary measure of a reference policy, i.e., E2, which can be bounded independently of the state space size. This is structurally different from the ones existing in the literature. We believe that this structure holds as well in a class of . In particular, if m is the stationary measure of some bounding/reference MDPs much larger than policy, and if the critical quantity Em [∆ f ] is small for a well chosen function f , then the regret of a learning algorithm navigating the MDP should also be small. A deeper analysis is left as future work. M * 4.3 Sketch of the Proof P E [Rin] + E [Rout] , ∈Mk . M / Our proof for Theorem 4.1 is technical and is provided in the supplementary material. In this section, we present the main ideas and its general structure. It initially relies on the regret analysis of UCRL2 developed in [11], and the differences are highlighted below. First, we consider the mean rewards and split the regret into episodes to separately treat the cases where the true MDP is in the confidence set of optimistic MDPs r(s, a)) denote the regret in episode k. This split can be written: s,a νk(s, a)(ρ∗ − Mk or not. Thus, let Rk := E [Reg(M, T )] k Rk1M ∈Mk and Rout := ≤ k Rk1 where Rin := To control Rout, we use, as in [11], the stopping criterion and the confidence bounds. This gives E [Rout] rmaxS, so that the regret due to episodes where the confidence regions fail will be negligible next to the main terms. Then, when the true MDP belongs to the confidence region, we use the properties of Extended Value Iteration (EVI) to decompose Rin into P P ≤ νk(s, a)( ̃rk − r(s, a)) + Xk,s,a Rrewards vk ̃Pk − (cid:16) Rbias Xk I ̃hk + vk (cid:17) Xk (cid:16) ̃Pk − I dk + 2rmax (cid:17) REVI νk(s, a) √tk , Xk,s,a where vk is the vector of the state-action counts νk's, ̃Pk and ̃hk are respectively the transition } } | matrix and the bias in ̃Mk under policy ̃πk, and dk is the profile difference between the last step of EVI and the bias (see Appendix A.3). {z {z {z } | | We now show how to handle Rrewards, REVI, Rbias. First, we deal with the terms that do not involve the bias. Using the confidence bound on the rewards (see Appendix A.3.1: νk(s, a) Rrewards ≤ rmax2 2 log(2AT ) p s,a Xk X max 1, Ntk(s, a) } { . (12) Now, let us consider REVI. Since dk becomes arbitrarily small after enough iterations of EVI (see Appendix A.1), for T p e8 2AT , we get rmax2 2 log(2AT ) p s,a Xk X νk(s, a) max 1, Ntk (s, a) } { . (13) The analysis of Rbias is different from the one in [11]: While in [11] the bias is directly bounded by the diameter, we can use the variations of the bias to control the regret more precisely. Using Pk and hk, i.e., the transitions and the bias in the true MDP under ̃πk, Rbias is further decomposed into: Pk I) ̃hk Pk hk hk vk vk p + + . ̃Pk − (cid:16) ̃hk − (cid:17) (cid:16) vk (Pk − (cid:17) Xk Xk (cid:16) (cid:17) Xk ̃Pk − Rtrans Rdiff The term Rep can be treated in a similar manner as in [11] by bounding the bias terms with the {z } diameter to apply an Azuma-Hoeffding inequality (see Appendix A.3.5). Here, we obtain Rep {z {z | | } } | E [Rep] ≤ SAD rmax log2 8T SA . (cid:19) (cid:18) 8 ≥ REVI ≤ || + ̃Pk − Pk||∞ Next, we show in A.3.2 that Rdiff does not contribute to the main term of the regret. This is one of the hard point in our proof. First, linear algebra techniques are used to bound by rk||∞ ). Each norm is then bounded using Hoeffding inequality. D(2rmaxD This introduces the special quantity Ntk (xk, πk(xk)) that yields to the worst confidence bound in episode k. Then, an adaptation of McDiarmid's inequality to Markov chains is used to show that tk)mmax(S 1)/2 with high probability, where mmax(S 1) is the Ntk (xk, πk(xk)) (tk+1 − 1 under the uniform policy πmax(s) = Amax. This eventually implies stationary measure of state S − that E [Rdiff ] 96rmaxD2SA max Qmax, T 1/4 log2(2AT ), ̃rk − || hk||∞ ̃hk − − − ≥ || ≤ 2 } { 4 . (cid:19) where Qmax := 10D mmax(S 1) − log 10D mmax(S 1) − (cid:18)(cid:16) (cid:16) (cid:17) (cid:17) Then, to deal with the main term Rtrans, we exploit the optimal bias. The unit vector being in the kernel of ̃Pk − Rtrans = Pk, we can rewrite: νk (s, ̃πk(s)) s, ̃πk(s))) s, ̃πk(s)) (h∗(s′) ( ̃pk (s′ h∗(s)) p (s′ * | − | * − s Xk X Xs′ and, thus, using the confidence bound and the bounded variations of the bias, Rtrans ≤ 4 2 log (2AT ) p s,a Xk X ∆(s + 1)νk(s, a) 1, Ntk(s, a) max } { . p We can now aggregate Rtrans, Rrewards and REVI to compute the main term of the regret (see Appendix A.3.4). Here, the key ingredient is to bound (∆(s + 1) + rmax)νk(s, a) max { independently of S. This is the second main difference with [11]. Instead of exploring the MDP uniformly, we know that the algorithm will mostly visit the first states of the MDP, regardless of the chosen policy. As shown in [11], for a fixed state s: 1, Ntk (s, a) } Xk,s,a p E " a X Xk νk(s, a) max { 1, Ntk(s, a) } # ≤ p 3 E [NT (s)] A. p Now, instead of summing over the states, we can use properties of stochastic ordering to compare the mean number of visits of a state with the probability measure mπ0 ; here, we strongly rely on the birth and death structure of the MDPs in . For any non-negative non-decreasing function f : R+, we obtain M S → Let us choose f : s E2 := F E 7→ (∆ + rmax)2 mπ0 E f (s)Nt(s)  ≤  0 Xs ≥  1,s(s { 0 Xs ≥ max (∆(s+1)+rmax)2 and let F := }  1) − f . Then, * P t f (s)mπ0 (s). (14) s f (s)− 1 ≤ 60e2λ/μr2 max. Define also (cid:2) E (cid:3) (∆(s) + rmax)νk(s, a) " s,a Xk X max 1, Ntk(s, a) } { # ≤ In Appendix A.3.4, we further show that E2 ≤ main terms, we obtain 60e2λ/μr2 max p 3 E2AT . p 1 + λ2 μ2 (cid:16) . Therefore, for the three (cid:17) E [Rtrans + Rrewards + REVI] 19 E2AT log (2AT ) ≤ (15) p and we conclude our proof by combining all of these terms. 9 5 Conclusions For learning in a class of birth and death processes, we have shown that exploiting the stationary measure in the analysis of classical learning algorithms yields a K√T regret, where K only depends on the stationary measure of the system under a well chosen policy. Thus, the dependence on the size of the state space as well as on the diameter of the MDP or its span disappears. We believe that this type of results can be generalized to other cases such as optimal routing, admission control and allocation problems in queuing systems, as the stationary distribution under all policies is uneven between the states. References [1] Jonatha Anselmi, Bruno Gaujal, and Louis Sébastien Rebuffi. Optimal Speed Profile of a DVFS Processor under Soft Deadlines. Performance Evaluation, 152, December 2021. [2] Peter Auer and Ronald Ortner. Logarithmic online regret bounds for undiscounted reinforce- ment learning. In B. Schölkopf, J. Platt, and T. Hoffman, editors, Advances in Neural Informa- tion Processing Systems, volume 19. MIT Press, 2006. [3] Mohammad Gheshlaghi Azar, Ian Osband, and Rémi Munos. Minimax regret bounds for reinforcement learning. In International Conference on Machine Learning, pages 263–272. PMLR, 2017. [4] Mohammad Gheshlaghi Azar, Ian Osband, and Rémi Munos. Minimax regret bounds for reinforcement learning. In International Conference on Machine Learning, pages 263–272, 2017. [5] Hippolyte Bourel, Odalric-Ambrym Maillard, and Mohammad Sadegh Talebi. Tightening ex- ploration in upper confidence reinforcement learning. In Proceedings of the 37th International Conference on Machine Learning, ICML'20. JMLR.org, 2020. [6] Craig Boutilier, Richard Dearden, and Moisés Goldszmidt. Stochastic dynamic programming with factored representations. Artif. Intell., 121(1–2):49–107, aug 2000. [7] Ronan Fruit, Matteo Pirotta, Alessandro Lazaric, and Ronald Ortner. Efficient bias-span- constrained exploration-exploitation in reinforcement learning. 02 2018. [8] Nicolas Gast, Bruno Gaujal, and Kimang Khun. Reinforcement learning for Markovian ban- dits: Is posterior sampling more scalable than optimism? Technical Report hal-03262006, HAL-Inria, June 2021. [9] Carlos Guestrin, Daphne Koller, Ronald Parr, and Shobha Venkataraman. Efficient solution algorithms for factored MDPs. Journal of Artificial Intelligence Research, 19(1):399–468, October 2003. [10] Ilse C. F. Ipsen and Carl Dean Meyer. Uniform stability of markov chains. SIAM Journal on Matrix Analysis and Applications, 15:1061–1074, 1994. [11] T. Jaksch, R. Ortner, and P. Auer. Near-optimal regret bounds for reinforcement learning. Journal of Machine Learning Research, 11(4):1563–1600, 2010. [12] Chi Jin, Zhuoran Yang, Zhaoran Wang, and Michael I Jordan. Provably efficient reinforcement learning with linear function approximation. In Jacob Abernethy and Shivani Agarwal, editors, Proceedings of Thirty Third Conference on Learning Theory, volume 125 of Proceedings of Machine Learning Research, pages 2137–2143. PMLR, 09–12 Jul 2020. [13] David A. Levin, Yuval Peres, and Elizabeth L. Wilmer. Markov chains and mixing times. American Mathematical Society, 2008. [14] Quan-Lin Li, Jing-Yu Ma, Rui-Na Fan, and Li Xia. An Overview for Markov Decision Pro- cesses in Queues and Networks, pages 44–71. Springer Singapore, Singapore, 2019. 10 [15] Ian Osband and Benjamin Van Roy. Near-optimal reinforcement learning in factored MDPs. In Proc. of the 27th Int. Conf. on Neural Information Processing Systems - Volume 1, NIPS'14, pages 604–612, Montreal, Canada, December 2014. MIT Press. [16] Ian Osband, Benjamin Van Roy, and Zheng Wen. Generalization and exploration via random- ized value functions. In Proceedings of the 33rd International Conference on International Conference on Machine Learning - Volume 48, ICML'16, page 2377–2386. JMLR.org, 2016. [17] Martin L. Puterman. Markov Decision Processes: Discrete Stochastic Dynamic Programming. Wiley Series in Probability and Statistics. Wiley, 1 edition, April 1994. [18] Aviv Rosenberg and Yishay Mansour. Oracle-Efficient Reinforcement Learning in Factored MDPs with Unknown Structure. arXiv:2009.05986 [cs, stat], September 2020. [19] Moshe Shaked and J George Shanthikumar. Stochastic orders and their applications. Aca- demic Pr, 1994. [20] R. S. Sutton and A. G. Barto. Reinforcement Learning: An Introduction. MIT Press, Cam- bridge, MA, 1998. [21] Yi Tian, Jian Qian, and Suvrit Sra. Towards minimax optimal reinforcement learning in fac- tored markov decision processes. In Proceedings of the 34th International Conference on Neu- ral Information Processing Systems, NIPS'20, Red Hook, NY, USA, 2020. Curran Associates Inc. [22] Aristide Tossou, Debabrota Basu, and Christos Dimitrakakis. Near-optimal optimistic rein- forcement learning using empirical bernstein inequalities, 2019. [23] Neil Walton and Kuang Xu. Learning and information in stochastic networks and queues, 2021. [24] Yue Wu, Dongruo Zhou, and Quanquan Gu. Nearly minimax optimal regret for learning infinite-horizon average-reward mdps with linear function approximation. In Gustau Camps- Valls, Francisco J. R. Ruiz, and Isabel Valera, editors, Proceedings of The 25th International Conference on Artificial Intelligence and Statistics, volume 151 of Proceedings of Machine Learning Research, pages 3883–3913. PMLR, 28–30 Mar 2022. [25] Ziping Xu and Ambuj Tewari. Reinforcement learning in factored mdps: Oracle-efficient algorithms and tighter regret bounds for the non-episodic setting. In Hugo Larochelle, Marc'Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and Hsuan-Tien Lin, editors, Ad- vances in Neural Information Processing Systems 33: Annual Conference on Neural Informa- tion Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020. [26] Zihan Zhang and Xiangyang Ji. Regret minimization for reinforcement learning by evaluating the optimal bias function, 2019. [27] Dongruo Zhou, Jiafan He, and Quanquan Gu. Provably efficient reinforcement learning for discounted mdps with feature mapping. In Marina Meila and Tong Zhang, editors, Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pages 12793–12802. PMLR, 18–24 Jul 2021. 11 The appendix is organized as follows: We first provide some insights on extended value iterations useful in our construction of the regret.Then, the detailed proof of theorem 4.1 is given with bounds on the five terms in our decomposition of the regret. A final appendix provides technical lemmas about MDPs in . M A Proof of Theorem 4.1 A.1 Extended value iteration For each episode k, we use the extended value iteration algorithm described in [11] to compute ̃πk and ̃M ∈ Mk, an optimistic policy and MDP. The values we iteratively get are defined in the following way: u(k) 0 (s) = 0 u(k) i+1(s) = max a ∈A ( ̃r(s, a) + max p( ) * ∈P (s,a) ( p(s′)u(k) i (s′) )) , S Xs ∈ (16) where ̃r is the maximal reward from (4) and (s, a) is the set of probabilities from (5). Now, from [11, Theorem 7], we obtain the following lemma on the iterations of extended value iteration. Lemma A.1. For episode k, denote by i the last step of extended value iteration, stopped when: max s { u(k) i+1(s) u(k) i (s) } − min s { u(k) i+1(s) u(k) i < (s) } − − rmax √tk . (17) The optimistic MDP ̃Mk and the optimistic policy ̃πk that we choose are so that the gain is rmax close to the optimal gain: √tk − P ̃ρk := min s ρ( ̃Mk, ̃πk, s) ≥ M ′ max ∈Mk,π,s′ ρ(M ′, π, s′) − rmax √tk . Moreover from [17, Theorem 8.5.6]: and when the optimal policy yields an irreducible and aperiodic Markov chain, we have that ̃ρk = ρ( ̃Mk, ̃πk, s) for any s, so that we can define the bias: u(k) i+1(s) u(k) i (s) ̃ρk − − rmax √tk , ≤ (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) ̃hk(s0) = Es0 ∞ ( ̃r(st, at) . ̃ρk) # − " t=0 X By choosing iteration i large enough, from [17, Equation 8.2.5], we can also ensure that: u(k) i (s) (i 1) ̃ρk − − − < rmax 2√tk , ̃hk(s) (cid:12) (cid:12) (cid:12) so that we can define the following difference dk(s) := (s) min s − u(k) i (s) ̃hk(s) min s − − (cid:16) rmax √tk . ̃hk(s) < (cid:17)(cid:12) (cid:12) (cid:12) A.2 Regret when M is out of the confidence bound (cid:12) (cid:12) (cid:12) u(k) i (cid:12) (cid:12) (cid:12) Let us compute E[Reg], the expected regret. We will mainly follow the approach in [11, Section 4], with a few tweaks. We start by splitting the regret into a sum over episodes and states. We remind that r(s, a) is the overall mean reward and NT (s, a) the total count of visits. We also define Rk(s) := r(s, a)) the regret at episode k induced by state s, with νk(s, a) the number of visit of (s, a) during episode k. a νk(s, a)(ρ∗ − P 12 (18) (19) (20) (21) (22) Let Rin := the split: m k=1 Rk(s)1M s P P ∈Mk and Rout := E [Reg] E [Rin] + E [Rout] . P P m k=1 Rk(s)1 s M / Now, let νk(s) = M For the terms out of the confidence sets, we have: ≤ a νk(s, a) and denote by (t) the set of MDPs ∈Mk . We therefore have (23) t < tk+1. Mk such that tk ≤ P Rout ≤ rmax rmax ≤ = rmax = rmax m s X Xk=1 m νk(s)1 M / ∈Mk Ntk (s)1 M / ∈Mk using the stopping criterion s X T Xk=1 m t=1 X T s X Xk=1 1tk=tNt(s)1 M / ∈M (t) ≤ rmax T t=1 X s X Nt(s)1 M / ∈M (t) 1 M / ∈M (t) s X Nt(s) rmax ≤ T t=1 X t1 (t). M / ∈M Taking the expectations: t=1 X E [Rout] rmax T t=1 X T rmax t=1 X rmaxS. ≤ ≤ ≤ tP M / { ∈ M (t) } tS 2t3 ≤ rmax S 2t2 T t=1 X by Lemma B.1 (24) Thus, we have dealt with the cases where the MDP M did not belong to any confidence set, for some episodes. We now need to deal with the rest. A.3 Regret terms when M is in the confidence bound ∈ Mk and deal with the terms in the confidence bound, so that we can omit We now assume that M the repetitions of the indicator functions. For each episode k, let Rin,k := We defined ̃πk the optimistic policy computed at episode k, now define ̃Pk := ( ̃pk(s′ s, ̃πk(s))) the transition matrix of that policy on the optimistic MDP ̃Mk. Define also vk := (νk(s, ̃πk) the row vector of visit counts during episode k. Following the same steps as in [11], we get the inequality on the regret of episode k, assuming M s Rk. P | ∈ Mk, using Lemma A.1: Rin,k = νk(s, a)(ρ∗ r(s, a)) − s,a X s,a X s,a X ≤ = νk(s, a)( ̃ρk − r(s, a)) + rmax νk(s, a)( ̃ρk − ̃rk(s, a)) + s,a X νk(s, a) √tk s,a X νk(s, a)( ̃rk − r(s, a)) + rmax νk(s, a) √tk . s,a X Then with (19) and using the definition of the iterated values from EVI, we have for a given state s and as := ̃πk(s): so that: ( ̃ρk − (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) Rin,k ≤ ̃rk(s, as)) − Xs′ ̃pk(s′ | s, as)u(k) i (s′) u(k) i − (s) !(cid:12) (cid:12) (cid:12) (cid:12) (cid:12) vk ̃Pk − (cid:16) I ui + (cid:17) s,a X νk(s, a)( ̃rk − r(s, a)) + 2rmax 13 rmax √tk , ≤ νk(s, a) √tk . s,a X Remember that for any state s: for the optimist MDP, and: | dk(s) | ≤ rmax √tk , where ̃hk is the bias of the average optimal policy dk(s) := u(k) i (s) min x − (cid:16) u(k) i (x) ̃hk(s) min x − . ̃hk(x) (cid:17) − (cid:16) . Therefore, in the first term, we can replace (cid:17) I Notice that the unit vector is in the kernel of ui by any translation of it. We get: I ui = vk vk ̃Pk − (cid:16) (cid:17) so that: Rin ≤ s,a Xk X | Rrewards {z νk(s, a)( ̃rk − r(s, a)) + ̃Pk − (cid:16) ̃Pk − (cid:16) (cid:17) (cid:17) ̃hk + vk I vk ̃Pk − (cid:16) Rbias I ̃hk (cid:17) Xk ̃Pk − (cid:16) I dk. (cid:17) } | + {z vk Xk } ̃Pk − (cid:16) I dk + 2rmax (cid:17) REVI s,a Xk X νk(s, a) √tk . Then, using the assumption on empirical rewards (4), as M | ∈ Mk, and noticing that Ntk ≤ {z tk: } Rrewards ≤ rmax2 2 log(2AT ) p s,a Xk X νk(s, a) max 1, Ntk(s, a) } { . (25) For the term vk vk ̃Pk − (cid:16) ̃Pk − I I dk, which does not appear in the analysis of [11], we obtain (cid:17) dk ≤ νk (s, ̃πk(s)) s, ̃πk(s)) dk(s′) | ̃pk ( sup s′ * k − *| | p (cid:16) (cid:17) 1sk1 * νk (s, a) √tk s X 2rmax ≤ ≤ 2rmax s X s,a X νk (s, ̃πk(s)) √tk ≤ 2rmax νk(s, a) max 1, Ntk(s, a) } { , s,a X p tk ≤ νk(s, a) where in the last inequality we used that max regret term coming from the consequences and approximations of EVI satisfies 1, Ntk(s, a) } ≤ { T . Thus, for T e2 2AT the ≥ REVI ≤ rmax2 2 log(2AT ) p s,a Xk X max 1, Ntk (s, a) } { . (26) Now, by defining Pk and hk the transition matrix and the bias of the optimistic policy ̃πk in the true MDP M , we have the following decomposition of the middle term: p vk Xk (cid:16) Overall: | ̃Pk − Rtrans {z Pk hk + (cid:17) Xk Pk vk ̃Pk − (cid:16) (cid:17) (cid:16) ̃hk − hk + (cid:17) Xk vk (Pk − I) ̃hk . } | Rdiff {z } | Rep {z } Rin ≤ vk Xk (cid:16) | ̃Pk − Rtrans {z Pk hk + (cid:17) Xk Pk vk ̃Pk − (cid:16) Rdiff ̃hk − (cid:17) (cid:16) hk + (cid:17) Xk vk (Pk − I) ̃hk Rep } | + rmax4 {z 2 log(2AT ) } | {z max νk(s, a) } 1, Ntk(s, a) } { . s,a Xk X p REVI+Rrewards {z } p | 14 A.3.1 Bound on Rtrans Let us deal with the first term Rtrans. To bound this term, we will use our knowledge of the bias in the true MDP hk and on the control of the difference of the transition matrices, and for the second term we will control the difference of the biases. Notice that for a fixed state 0 s S − ≤ s, ̃πk(s)) hk(s′) = ≤ p (s′ | Xs′ 1: Xs′ p (s′ | s, ̃πk(s)) (hk(s′) − hk(s)) + hk(s). The same is true for ̃pk, and knowing the MDP is a birth and death process: Rtrans = νk (s, ̃πk(s)) s Xk X Xs′ νk (s, ̃πk(s)) s Xk X Xs′ νk (s, ̃πk(s)) s Xk X 4 2 log (2AT ) p s,a Xk X = ≤ ≤ ( ̃pk (s′ ( ̃pk (s′ | | * * s, ̃πk(s)) s, ̃πk(s)) p (s′ p (s′ | | − − s, ̃πk(s))) s, ̃πk(s))) * * hk(s′) (hk(s′) hk(s)) − ̃pk ( *| * k s, ̃πk(s)) p ( *| − s, ̃πk(s)) k1 sup s′ ∂hk(s) ∆(s + 1)νk(s, a) 1, Ntk (s, a) max } { , where in the last inequality, we used the knowledge on the bounded variations of the bias from Lemma 3.2, and that the optimistic MDP has transitions close to the true transitions. p A.3.2 Bound on Rdiff We now deal with the term involving the difference of bias, Rdiff. For each episode k with policy πk, denote by xk the state such that the confidence bounds are at their worst and denote by ak := πk(xk) the corresponding action used at this state, so that Ntk (xk, ak) is minimal. We therefore have that is maximal for episode k. The true MDP being within the confidence bounds, max log(2Atk) 1,Ntk (xk,ak) with a triangle inequality: q } { ̃Pk − k Pkk∞ ≤ 4 s and 2 log (2Atk) 1, Ntk(xk, ak) } { max , ̃rk − k rkk∞ ≤ 2rmax 2 log (2Atk) 1, Ntk(xk, ak) } max { . s Then using Lemma C.6, and noticing that the bias ̃hk and the quantity the same diameter D, using the same argument as in [11] (Equation (11)): P k T t=1 ̃P t k ̃rkk is bounded by ̃hk − k hkk∞ ≤ 12ThitrmaxD s 2 log (2Atk) 1, Ntk(xk, ak) } { max . (27) Hence, Rdiff ≤ s X νk (s, ̃πk(s)) ( ̃pk (s′ | * s, ̃πk(s)) p (s′ | − s, ̃πk(s))) * ( ̃hk(s′) hk(s′)) − ̃pk ( s, ̃πk(s)) p ( *| − s, ̃πk(s)) ̃hk − hkk∞ k1 k Xs′ νk (s, ̃πk(s)) *| s X 48D2rmax log (2AT ) Σ, * k ≤ ≤ where in the last inequality we have used (27) and that by definition of D, for S large enough Thit := inf ∈S s′ sup s ∈S Es τ πk s′ ES 1 τ π0 0 ≤ − ≤ D, 15 and we called Σ := tk+1− 1 1 { 1, Ntk(s, a) } st,at=s,a } max { . 1, Ntk(xk, ak) } max { s,a X Xk t=tk X p Ntk (s, a) for any state-action pair (s, a), so that we can rewrite, p By the choice of xk, Ntk (xk, ak) with Ik := tk+1 − ≤ tk the length of episode k: tk+1− 1 1 Σ ≤ s,a X Xk t=tk X max { st,at=s,a } { 1, Ntk(xk, ak) } ≤ 4 Ik max 1, Ntk(xk, ak) } { Xk . , and I(T ) := max Qmax, T 1/4 . We Now define Qmax := 10D mmax(S 2 log 1) 10D mmax(S − (cid:17) (cid:18)(cid:16) 1) − (cid:19) (cid:17) split the sum depending on whether the episodes are shorter than I(T ) or not, and call K number of such episodes. This yields: (cid:8) (cid:16) Σ K ≤ ≤ II(T ) + Ik Xk,Ik >I(T ) max 1, Ntk(xk, ak) } { . Using the stopping criterion for episodes: Σ K ≤ ≤ II(T ) + Ik Xk,Ik>I(T ) max 1, νk(xk, ak) } { . the event: = k s.t Ik > I(T ), ∀ (cid:26) 1 max 1, ν(xk, ak) } { ≤ 2 mmax(S . 1)Ik (cid:27) − Now denote by E E By splitting the sum, using the above event, we get: Σ K ≤ ≤ I I(T ) + 1 I I(T ) + 1 K ≤ ≤ E E Xk,Ik>I(T ) K (KT − 2 mmax(S − 2 mmax(S I ) ≤ + 1 ̄ E 1) Ik Xk,Ik>I(T ) + 1 ̄ T. E 1) − E [Σ] ≤ ̄ E (cid:0) E [K 1 4T , so that when taking the expectation: ≤ (cid:1) I ] I(T ) + E [(KT − ≤ 4, I(T ) 2 mmax(S ≥ K ≤ I)] 2 mmax(S + 1) 1 4 . 1) and that − log 2 + 1 1 2: 4 ≤ E [Σ] ≤ E [KT ] I(T ) + 2SA log(2AT )I(T ). − 1 4 ≤ We use Corollary C.8 to get P Now using Lemma B.3, SA ≥ We therefore have that: E [Rdiff] ≤ 96rmaxSAD2I(T ) log2 (2AT ) . A.3.3 Bound on the main terms: Exploiting the stochastic ordering In Section 4.3 we have shown that: Rtrans ≤ 4 2 log (2AT ) p s,a X ∆(s + 1)νk(s, a) 1, Ntk(s, a) max } { . To control this term as well as REVI (26) and Rrewards (25), we need to control the terms in the sum in a way that does not make the parameters D or S appear, as this will be one of the main p 16 I the (cid:9) ≤ (28) (29) contributing terms. To do so, we need to sum over the episodes and take the expectation, so that with Lemma B.4, we get: E " s,a X Xk νk(s, a) max { 1, Ntk(s, a) } # ≤ 3E p 3 ≤ " s,a X s X p NT (s, a) # p E [NT (s)] A by Jensen's inequality. We will use the following lemma to carry on the computations: Lemma A.2. Let mπ0 be the stationary measure of the Markov chain under policy π0, such that for R+ be a non-negative non-decreasing function on the state every state s: π0(s) = 0. Let f : , space. Then for any state s S → ∈ S E  s Xs′ ≥ f (s′)Nt(s′)  t ≤ f (s′)mπ0 (s′). (30) s Xs′ ≥   . For any state s′, define N mπ0 ,π0 Proof. Let s follows the initial distribution mπ0 instead of the policy determined by the algorithm UCRL2. Notice already that for any state s′: (s′) the number of visits when the starting state , and the MDP always executes the policy π0 at every timestep ∈ S t On the other hand, for x ∈ S E N mπ0 t ,π0 (s′) = tmπ0 (s′) (cid:20) (cid:21) , we have the stochastic ordering: Nt(s′) ≤st x Xs′ ≥ N mπ0 t ,π0 (s′), x Xs′ ≥ so that for any non-negative non-decreasing function f , with the convention f ( − x N mπ0 ,π0 (f (x) f (x 1)) 1)) s′ t ≤st (f (x) 1) s′ − ≥ and then summing the equation above for s x Nt(s′) ≤st f (s s′ s Nt(s′) P f (x − s N mπ0 S − 1)   f (s − − s′ ≥ ≥ t x P P (s′), P − ,π0 ≥ 1 and switching the sums yields: 1) = 0:  (s′) (31) ′ s Nt(s′) [f (x) x=s X s Xs′ ≥ which simplifies to: ≤ ≤ − N mπ0 t f (x 1)] − ≤st − s Xs′ ≥ ′ s ,π0 (s′) [f (x) x=s X f (x 1)], − − Nt(s′)[f (s′) f (s 1)] − ≤st − s Xs′ ≥ N mπ0 t ,π0 (s′)[f (s′) f (s 1)]. − − s Xs′ ≥ Now summing with the second equation in (31), we get the following equation: Nt(s′)f (s′) ≤st s Xs′ ≥ N mπ0 t ,π0 (s′)f (s′). s Xs′ ≥ Taking the expectation in this last inequality finishes the proof. Now, we can conclude our bound on Rtrans. Since E " s,a X Xk (∆(s + 1) + rmax) νk(s, a) max 1, Ntk(s, a) } { # ≤ p 3√A (∆(s + 1) + rmax) E [NT (s)], 0 Xs ≥ p (32) 17 let f be a non-negative non-decreasing function over the state space, such that F := exists. Then by concavity: 0 f (s)− 1 s ≥ P (∆(s + 1) + rmax) E [NT (s)] = F 0 Xs ≥ p 1 F f (s) 0 Xs ≥ f (s)2(∆(s + 1) + rmax)2E [NT (s)] p f (s)2(∆(s + 1) + rmax)2E [NT (s)] F f (s) by concavity f (s)(∆(s + 1) + rmax)2E [NT (s)] F 0 Xs ≥ v u u t F s 0 Xs ≥ T F f (s)(∆(s + 1) + rmax)2mπ0(s) using Lemma A.2, s 0 Xs ≥ ≤ = ≤ so that overall, (32) becomes: E " s,a X Xk (∆(s + 1) + rmax)νk(s, a) max 1, Ntk(s, a) } { # ≤ p 3√AT F f (s)(∆(s + 1) + rmax)2mπ0(s). sXs ≥ 0 (33) This is the term mainly contributing to the regret. A.3.4 Bound on the main terms: Introducing E2 Now, using Lemma B.5 which gives the stationary distribution of m0, we can compute the expecta- tion under mπ0 of a well-chosen function f : Lemma A.3. Choose the increasing function f : s 0(∆(s + 1) + rmax)2f (s)mπ0 (s) = E and mπ0 s ≥ P E2 := F E mπ0 (∆ + rmax)2 Proof. For F , we obtain: (cid:2) (cid:2) ≤ f * (cid:3) { − 1,s(s 7→ (∆ + rmax)2 max 1) (∆(s+1)+rmax)2 . Then F } 1 + λ2 f μ2 (cid:16) λ2 μ2 (cid:3) 1 + 60e2λ/μ r2 max ≤ * . (cid:18) (cid:19) (cid:17) ≤ 60e2λ/μ r2 max , so that: (2eλ/μrmax)23 F ≤ S 1 − s=0 X S 12e2λ/μ r2 max 4 + ≤ 2 − s=2 X 1 + log(s + 1) 1) 1, s(s max { − } ! ≤ 12e2λ/μ r2 max 3 + S 1 − s=2 X 1 + log(s + 1) s(s − 1) ! log(1 + 1/s) s ! ≤ 60e2λ/μ r2 max. Using the following computations: S 1 − s=2 X s(s − S 1) (cid:18) 1 − s (S (cid:19) (cid:18) λ − s 1)μ (cid:19) = (S 2)(S 1) − − = (S 2)(S 1) − − = (S 2)(S 1) − − λ μ ≤ (cid:18) 2 1 + (cid:19) (cid:18) 18 S s 3 2 − − s 1)μ (cid:19) λ − 3 − S (S (cid:19) (cid:18) 2 S 1)μ (cid:19) 2 s=0 (cid:18) X 1 + (cid:18) (S 1)μ S − (cid:19) 3 , S s=2 (cid:18) X λ − λ − (S (cid:18) (S (cid:18) λ (S 1)μ (cid:19) − λ s 1)μ (cid:19) 3 − s (cid:19) (cid:18) S 1)μ (cid:19) λ − (S − 3 − S 1 − , we get: and using that 1 + λ μ ≤ 1 + λ (S − 1)μ 1 + (S (cid:18) so that finally λ − 1)μ (cid:19) (cid:16) S 1 − E mπ0 (cid:17) (∆ + rmax)2 (cid:2) E mπ0 (∆ + rmax)2 which concludes the proof. (cid:2) Finally (33) becomes: λ2 μ2 λ2 μ2 f f * * (cid:3) (cid:3) ≤ ≤ 1 + (cid:18) 1 + (cid:18) 1 + (cid:19) (cid:18) λ − (S S 1 − 1)μ (cid:19) , , (cid:19) E " s,a X Xk (∆(s + 1) + rmax)νk(s, a) max 1, Ntk(s, a) } { # ≤ p 3 E2AT , p E [Rtrans + Rrewards + REVI] 12 2E2AT log (2AT ). ≤ p and thus: In particular: (34) (35) E [Rtrans + Rrewards + REVI] 132eλ/μrmax ≤ 1 + s(cid:18) λ2 μ2 (cid:19) AT log (2AT ). (36) A.3.5 Bound on Rep It remains to deal with the following regret term: vk (Pk − I) ̃hk. Rep = Xk ∈Mk(t) , We will follow the core of the proof from [11]. Define Xt := (p( where k(t) is the episode containing step t and ei the vector with i-th coordinate 1 and 0 for the other coordinates. st, at) − *| est ) ̃hk(t) 1M vk (Pk − I) ̃hk = tk+1− 1 t=tk X tk+1− 1 ≤ t=tk X Xt + ̃hk(stk+1) ̃hk(stk ) − Xt + Drmax. By summing over the episodes we get: Rep ≤ T t=1 X Xt + KT Drmax. Notice that E [Xt| number of episodes remains. s1, a1, . . . , st, at] = 0, so that when taking the expectations, only the term in the On the other side, using Lemma B.3, we get when taking the expectation: E [Rep] SA log2 ≤ 8T SA (cid:18) * (cid:19) Drmax. Assuming SA ≥ 4, and using log(2) 1 2 : ≥ E [Rep] ≤ 2rmaxSAD log(2AT ). (37) 19 We can now gather the expected regret terms when the true MDP is within the confidence bounds. Using (28), (35) and (37): E [Rin] ≤ 96rmaxSAD2I(T ) log2 (2AT ) + 12 2E2AT log (2AT ) + 2rmaxSAD log(2AT ), which gives with (23) and (24), assuming that T S2: p ≥ E [Reg] ≤ 97rmaxSAD2I(T ) log2 (2AT ) + 12 2E2AT log (2AT ). which finally gives: p E [Reg] ≤ 97rmaxSAD2I(T ) log2 (2AT ) + 19 E2AT log (2AT ). B Technical Lemmas B.1 Probability of the confidence bounds p This first lemma is from [11, Lemma 17] and adapted to our confidence bounds. Lemma B.1. For t > 1, the probability that the MDP M is not within the set of plausible MDPs Mt is bounded by: P M / { ∈ M (t) } < S 2t3 . Proof. Fix a state action pair (s, a), and n the number of visits of this pair before time t. Recall that ˆp and ˆr are the empirical transition probabilities and rewards from the n observations. Knowing that from each pair, there are at most 3 transitions, a Weissman's inequality gives for any εp > 0: P ˆp( *| {k s, a) p( *| − s, a) k1 ≥ εp} ≤ 6 exp nε2 p 2 ! . − So that for the choice of εp = 2 n log (16At4) 8 n log (2At), we get: q P (k s, a) ˆp( *| p( *| − s, a) ≤ q k1 ≥ r 8 n log (2At) ) ≤ 3 8At4 . We can do similar computations for the confidence on rewards, with a Hoeffding inequality: P {| ˆr(s, a) − r(s, a) | ≥ εr} ≤ 2 exp 2nε2 r r2 max (cid:19) (cid:18) 2 n log (2At), so that: − , and choosing εr = rmax 1 2n log (16At4) rmax ≤ q q P (| ˆr(s, a) − r(s, a) | ≥ rmax r 2 n log (2At) ) ≤ 1 8At4 . Now with a union bound for all values of n 0, 1, ∈ { and P (k s, a) ˆp( *| p( *| − s, a) k1 ≥ s P (| ˆr(s, a) − r(s, a) | ≥ rmax s and finally, when summing over all state-action pairs, P , t 1 , we get: * * * } − 8 log (2At) max { 1, Nt(s, a) } ) ≤ 2 log (2At) max { 1, Nt(s, a) M / { ∈ M } ) ≤ < S (t) } 2t3 . 3 8At3 , 1 8At3 , 20 B.2 Number of visits for an MDP in M This lemma is needed in the proof of Lemma C.7. Lemma B.2 (Azuma-Hoeffding inequality). Let X1, X2, . . . be a martingale difference sequence with RD for all i and some R > 0. Then for all ε > 0 and n N: Xi| ≤ | ∈ n P ( i=1 X Xi ≥ ε ) ≤ exp ε2 2nDR . (cid:19) − (cid:18) The two following lemmas are proved in [11, Appendix C.2 and Appendix C.3] respectively. Bound- ing the number of episodes is notably useful to obtain equation (28). Lemma B.3. Denote by Kt the number of episodes up to time t, and let t > SA. It is bounded by: Kt ≤ SA log2 8t SA . (cid:19) (cid:18) The following lemma is used to simplify regret terms, notably (29). Lemma B.4. For any fixed state action pair (s, a) and time T , we have: νk(s, a) max { 1, Ntk(s, a) } ≤ p Xk=1 3 NT +1(s, a), p B.3 Diameter and Span of MDPs in M For completeness, and to support the discussion in Section 4.2, the section details the behavior of the diameter and the span of MDPs in , as functions of S. Under policy π0, it is possible to get en explicit expression for the stationary distribution of the states. Lemma B.5. Under the stationary policy π0, the stationary measure mπ0 by: (s) of the MDP is given M mπ0 (s) = s − 1)μ (S (cid:17) − 1) . S 1 − s (S λ (cid:1) (cid:16) (cid:0) 1 + λ (S − 1)μ (cid:16) (cid:17) This lemma is shown in the proof of [1, Lemma 3.3]. First, it should be clear that under any policy π, the diameter of the MDP under π is extremely large because the probability to move from state s to state s+1 is smaller and smaller as s grows. Actually, this is also true for the local diameter, more precisely the expected time to go from s to s + 1 grows extremely fast with s. This discussion is formalized in the following result. Lemma B.6. For any M 1, s) grow as SS Dπ(s − ∈ M 2. − and any policy π, the diameter Dπ as well as the local diameter Proof. Under policy π, the following sequence of inequalities follows from the stochastic compari- son with π0 and monotonicity under π0. Dπ τ π(0, S 1) τ π0 (0, S 1) τ π0 (S − − where τ π(x, y) is the expected time to go from x to y under policy π. − ≥ ≥ ≥ 2, S 1), − Now, starting from S the time to reach S 2, the Markov chain moves to S − 1 is equal to 1 or moves to S 1 with probability p := λ/(U (S 3 with probability 1 1)) and p. Therefore, − − 2 or S − − − − 21 (S 2, S τ π0 − bounded in turn by the inverse of the stationary measure of state S B.5, p times the return time to S 1) is bounded by 1 − − − − 2 in the chain truncated at S 2, 2 in this chain . Using Lemma − τ π0 (S 2, S 1) (1 − ≥ − − (S p) − λ 2)μ (S 2) − 1 + λ (S 2) − (cid:18) λ μ − 2 (cid:19) S − 2 SS (cid:17) μ λ (cid:19) (cid:16) = exp (cid:18) (S 2)μ − (cid:18) (cid:19) 2(1 + o(1/S)). − (38) (39) As for the maximal local diameter, maxs Dπ(s and the same argument as before applies. − 1, s) ≥ maxs τ π0 (s 1, s) − ≥ τ π0 (S 2, S 1) − − − (h∗(0) Let us now consider the bias of the optimal policy in M . From [1], the bias h∗(s) is decreasing and concave in s, with increments bounded by C. Therefore, its span, defined as span (h∗) := maxs h∗(s) mins h∗(s), satisfies h∗(1))S − ≤ span (h∗) (h∗(S 2) − − h∗(S − 1))S C(S 1). − ≤ ≤ This implies that the span of the bias behaves as a linear function of S for all M . C Generic Lemmas on Ergodic MDPs C.1 Bound on the bias variations In this subsection, we aim to prove Lemma 3.2, which plays a main role in the regret computations. We consider here we are always in the true MDP M . We first show a bound on hitting times that will be used to control the variations of the bias: Lemma C.1. Let π be any policy. Consider the Markov chain with policy π and transitions P starting from any state s. Denote by τs the random time to hit 0 from state s. Then: Eτs ≤ mπ(0)− 1 U π(i) + μi . s i=1 X Proof. We write the expected hitting time equations. Let e be the unit vector. We have the system: with the extra equation τ0 = 0. We will show the result by induction. Call μi := π(i) + μi. The system gives for s = S Eτ = e + P Eτ , (40) 1: − so that: Eτs = 1 + Eτs μs 1 − U + Eτs − 1 μs U , Eτs = U μs + Eτs − 1. Then with an induction, we want to prove the equation for s < S 1: − Eτs = Eτs − 1 + U μs S 1 − ′ s Xs′=s i=s+1 Y λi − μi 1 , (41) where we recall that λs = λ(1 s − S 1 ). − 22 For s < S − 1, assume (41) is true for Eτs+1: Eτs = 1 + Eτs+1 + Eτs λs U μs − U − 1 − μs − U λs + Eτs − 1 μs U λs + Eτs − 1 μs U + Eτs λs U + = 1 + Eτs 1 S 1 − ′ s Xs′=s+1 i=s+1 Y 1 λi − μi 1 λi − μi by gathering the τs terms = U μs + Eτs − 1 + U μs = Eτs − 1 + U μs S 1 − S 1 − ′ s i=s+1 Y ′ s Xs′=s+1 λi − μi 1 , Xs′=s the induction is therefore true, and by definition of mπ(0) we have: Eτs ≤ Lemma C.2. For any policy π, define for s 1, . . . , S i=s+1 Y 1 the variation of the bias Eτs − 1+ U μs mπ(0)− 1. ∂H π(s) := H π(s) − H π(s − ∈ { − } ∞ 1) = P t(s, t=1 X (cid:0) λ ∆(s) := 2rmaxe μ (1 + log s). ∂H π(s) ≤ P t(s ) * − 1, ) * − r. (cid:1) ) Proof. We will use an optimal coupling, that is, a coupling such that the following infimum is reached, as defined in [13]. P t(s P t(s, 1, ) } * (42) (cid:13) Let X and Y be Markov chains with the same transition matrix P and starting states X1 = s, (cid:13) ([0, 1]) be a sequence 1. We couple X and Y in the following way: For t Y1 = s of independent random variables sampled uniformly on [0, 1]. We have: = Y ) : (Xt, Yt) is a coupling of P t(s, TV = inf (cid:13) (cid:13) 2, let Ut ∼ U ) and P t(s P(X 1, − − ≥ − − { ) * * * . Xt+1 =   Xt − Xt Xt + 1 if 1 1 if Ut ≤ if μXt ≤ − μXt Ut ≤ λXt ≤ 1 Ut, λXt − (43) and define Yt+1 the same way from Yt. This coupling is optimal, but in particular we have from (42), with δr := maxs,a,a′ r(s, a) r(s  : : | (P t(s, − ) − P t(s 1, a′) | 1, = Cμ+w(Amax) U ))r 2P(Xt 6 ≤ = Yt)δr. − As τs is the time needed for Xt to hit 0 starting from s, the coupling time is lower than τs: − * * so that summing over t gives: and now using Lemma C.1: P(Xt 6 = Yt) ≤ P (τs 0 > t) , → ∂H π(s) 2δrEτs, ≤ ∂H π(s) ≤ 2δrmπ(0)− 1 Finally, using mπ(0)− 1 mπ0 (0)− 1 λ μ : e ≤ ≤ U π(i) + μi . s i=1 X so that: ∂H π(s) ≤ 2rmaxe λ μ 1 i , s i=1 X ∂H π(s) ≤ 2rmaxe λ μ (1 + log s) = ∆(s), 23 6 C.2 From bias variations to probability transition variations The three first lemmas of this subsection are used in the proof of Lemma C.6. This lemma is needed to obtain equation (27). Lemma C.3. For a MDP with rewards r E [0, rmax] and transition matrix P , denote by Js(π, T ) := the expected cumulative rewards until time T starting from state s, under ∈ policy π. Let Dπ be the diameter under policy π. The following inequality holds: span (J(π, T )) hP rmaxDπ. ≤ T t=0 r(st, π(st)) i Proof. Let s, s′ π. Then: ∈ S . Call τs s′ the random time needed to reach state s′ from state s under policy → T Js(π, T ) = E " r(st) # t=0 X τs→s ′ 1 − = E " r(st) + E # t=0 X rmaxE [τs → rmaxDπ + Js′(π, T ), s′ ] + Js′ (π, T )   T t=τs→s X r(st)  ′  which proves the lemma. ≤ ≤ Lemma C.4. Consider two ergodic MDPs M and M ′. For i [0, rmax] and Pi be the rewards and transition matrix of MDP Mi under policy πi, where both MDPs have the same state and action spaces. Denote by gi the average reward obtained under policy πi in the MDP Mi. Then the difference of the gains is upper bounded. 1, 2, let ri ∈ ∈ g′ g | − r′ r − k∞ + rmaxDπk P − P ′ k∞ . | ≤ k Proof. Define for any state s the following correction term b(s) := rmaxDπk us show by induction that for T 0, s) p( *| − p′( *| s) k . Let ≥ T 1 − P ′ t(r + b). T 1 − t=0 X P tr ≤ t=0 X This is true for T = 0. Assume that the inequality is true for some T 0, then ≥ T T P tr t=0 X − t=0 X P ′ t(r + b) = b + P − T 1 − t=0 X T b + P ′ = − P tr P ′ − 1 − t=0 X P tr − T 1 − t=0 X 1 T − t=0 X P ′ t(r + b) P ′ t(r + b) ! + (P P ′) − P tr T t=0 X b + (P P ′) − ≤ − P tr by induction hypothesis. T t=0 X Notice that, for any state s: (P − P ′) T t=0 X P tr (s) ! In the same manner we show that: ≤ k p( s) *| − rmaxDπk p′( *| s) k * span (J(T )) s) p( *| − p′( *| s) k by Lemma C.3 ≤ = b(s). P ′ t(r b). − T T P tr ≥ t=0 X t=0 X 24 Hence, as P ′ has non-negative coefficients, denoting by e the unit vector: We can also show that: T T P ′ tr P tr − t=0 X t=0 X b ≤ k T t=0 X k∞ (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) ∞ (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) t P ′ e * ∞ (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) = b k k∞ (T + 1). T T P ′ tr′ = P ′ tr − P ′ t(r r′) − r′ r − k∞ ≤ k (T + 1). t=0 X And therefore with a multiplication by t=0 X t=0 X ∞ (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) , and with a triangle inequality: 1 T +1 (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) ∞ T t=0 P tr T t=0 P ′ tr′ P (cid:13) (cid:13) (cid:13) where ∞ (cid:13) (cid:13) (cid:13) P g′ r′ r − k∞ + b k k∞ , | ≤ k g | P ′ k∞ − . b k k∞ = rmaxDπk − (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) T (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) − P and by taking the Cesáro limit in Lemma C.5. Let P be the stochastic matrix of an ergodic Markov chain with state space 1, . . . , S. The matrix A := I P has a block decomposition − then AS, of size (S − expected time to reach state S from state i. (S 1) − × 1) is invertible and k 1 S k∞ = supi ∈S Ei τS, where Ei τS is the A = AS c (cid:18) b d ; (cid:19) A− Remark that this lemma is true for any state in . S Proof. (Ei τS)i is the unique vector solution to the system: v(S) = 0 ( i ∀ = S, v(i) = 1 + j P (i, j)v(j) ∈S eS, where ̃A is the matrix P We can rewrite this system of equations as: ̃Av = e − ̃A := AS 0 (cid:18) b 1 , (cid:19) e the unit vector and eS the vector with value 1 for the last state and 0 otherwise. Then are invertible and we write: A and AS e ̃A− 1 = 1 A− S 0 1 S b A− 1 − . Thus, by computing ̃A− and using that AS is an M-matrix and that its inverse has non-negative components, supi (cid:19) = S, (Ei τS)i = A− 1 S e. By definition of the infinite norm = 1 S k∞ eS), for i Ei τS. 1(e A− − (cid:18) k ∈S In the following lemma, we use the same notations as in Lemma C.4 with a common state space . } 1, . . . S { Lemma C.6. Let the biases h, h′ be the biases of the two MDPs verify their respective Bellman equations with the renormalization choice h(S) = h′(S) = 0. Let sups s′ be the worst Es τs′ . We ∈S expected hitting time to reach the state s′ with policy π, and call Thit := inf s′ have the following control of the difference: Es τ π sups ∈S ∈S h k − h′ k∞ ≤ 2Thit(D′rmaxk P − P ′ k∞ + r k − r′ k∞ ) Notice that although the biases are unique up to a constant additive term, the renormalization choice does not matter as the unit vector is in the kernel of (P P ′). − 25 6 6 Proof. The computations in this proof follow the same idea as in the proof of [10, Theorem 4.2]. The biases verify the following Bellman equations r P )h, and also the arbitrary − renormalization equations, thanks to the previous remark: h(S) = 0. Using the same notations as in the proof of Lemma C.5, we can write the system of equations ̃Ah = ̃r ̃g, with ̃r and ̃g respectively equal to r and g everywhere but on the last state, where their value is replaced by 0. ge = (I − − We therefore have that h = ̃A− denoting dX := X 1( ̃r − X ′ for any vector or matrix X, we get: ̃g), and with identical computations, h′ = ̃A′ 1 − ( ̃r′ − ̃g′). By − 1(d ̃r The previously defined block decompositions are: dh = − ̃A− d ̃g + d ̃Ah′). − ̃A− 1 = For s < S, dh(s) = using C.3: − 1 A− S 0 (cid:18) eT s A− 1 − 1 A− S b 1 (cid:19) and d ̃A = AS − 0 (cid:18) A′S b b′ − 0 . (cid:19) S (dASh′ + d ̃r d ̃g) and dh(S) = 0. Now by taking the norm and − (rmaxD′ k Notice that . Using Lemma C.4 and Lemma C.5, and dr and taking the infimum for the choice of the state of renormalization implies the claimed inequality for the biases. dh k dASk∞ ≤ k dASk∞ k = d ̃g | k k k∞ ≤ k dP k k∞ A− d ̃r + dg d ̃r k d ̃g | + ). k k | | , 1 S k∞ k ≤ k C.3 A McDiarmid's inequality Lemma C.7. Recall that mmax is the stationary measure of the Markov chain under policy πmax, such that for every state s: πmax(s) = Amax. Let k be an episode, and assume that the length of this episode Ik is at least I(T ) = 1 + max Qmax, T 1/4 , with Qmax := 10D mmax(S at least 1 (cid:8) 1 4T : (cid:9) − νk(xk, ak) (cid:16) ≥ We will now prove Lemma C.7: 1) − (cid:17) 2 log (cid:18)(cid:16) 1)Ik − mmax(S − 5D Ik log Ik. p 10D mmax(S 1) − 4 . Then, with probability (cid:19) (cid:17) Proof. Let k be an episode such that Ik ≥ I(T ), and first consider it is of fixed length I. Denote by ̊r the vector of reward equal to 1 if the current state is xk and 0 otherwise. Denote by ̊gπk the gain associated to the policy πk for the transitions p and rewards ̊r, and similarly define ̊hπk the bias, translated so that ̊hπk (S 1) = 0. Notice in that case, that if we denote by mk the stationary λ distribution under policy πk, that mmax(S μ + 1. Then: mk(s) for any state s, assuming that S 1) − ≤ − ≥ νk(xk, ak) = = = tk+1− 1 u=tk X tk+1− 1 u=tk X tk+1− 1 u=tk X ̊r(su) ̊gπk + ̊hπk (su) p ( *| − D su, πk(su)) , ̊hπk using a Bellman's equation E ̊gπk + ̊hπk (su) − ̊hπk (su+1) + ̊hπk (su+1) p ( *| − D su, πk(su)) , ̊hπk . E By Azuma-Hoeffding inequality B.2, following the same proof as in section 4.3.2 of [11], notice that Xu = ̊hπk (su+1) D: form a martingale difference sequence with su, πk(su)) , ̊hπk p ( Xu| ≤ | *| − D E Xu ≥ tk+1− 1 P ( u=tk X 1 I 5 . ) ≤ D 10I log I p 26 Using that ̊hπk (stk ) (cid:12) (cid:12) (cid:12) − On the other hand: ≤ ̊hπk (stk+1) (cid:12) (cid:12) (cid:12) νk(xk, ak) D, with probability at least 1 1 I 2 : − tk+1− 1 ≥ u=tk X ̊gπk − 5D I log I. p tk+1− 1 ̊gπk = νk(sk, ak)mk(xk), so that, using that mk(xk) 1), with probability at least 1 u=tk X mmax(S ≥ νk(xk, ak) − mmax(S ≥ 1)I − − 5D 1 I 5 : − I log I. We now use a union bound over the possible values of the episode lengths Ik, between I(T ) + 1 and T : p P νk(xk, ak) < mmax(S n 1)Ik − − 5D Ik log Ik p 1 I 5 ≤ T XI=T 1/4+1 1 I 5 T o ≤ ≤ XI=I(T )+1 1 , 4T so that we now have that with probability at least 1 νk(xk, ak) mmax(S ≥ − 1 4T : − 1)Ik − 5D Ik log Ik. p We can show a corollary of Lemma C.7 that we will use for the regret computations: Corollary C.8. For an episode k such that its length Ik is greater than I(T ),with probability at least 1 1 4T : − νk(xk, ak) mmax(S 2 ≥ 1) − Ik. Proof. With Lemma C.7, it is enough to show that 5D√Ik log Ik ≤ 1) =: B. By monotonicity, as Ik ≥ . log Ik ≥ that B2 log B4 q B2 log B4 − B2 log 10D mmax(S that Qmax = B2 log B4 we can show instead Ik, i.e. Ik − 2 mmax(S 1) ≥ This last inequality is true, using that log x (cid:1) (cid:0) log(2 log x) for x > 1. This proves the corollary. ≥ 27
http://arxiv.org/abs/2302.10663v2
2023-02-23T15:18:23
2023-02-21T13:25:35
RealFusion: 360° Reconstruction of Any Object from a Single Image
We consider the problem of reconstructing a full 360{\deg} photographic model of an object from a single image of it. We do so by fitting a neural radiance field to the image, but find this problem to be severely ill-posed. We thus take an off-the-self conditional image generator based on diffusion and engineer a prompt that encourages it to "dream up" novel views of the object. Using an approach inspired by DreamFields and DreamFusion, we fuse the given input view, the conditional prior, and other regularizers in a final, consistent reconstruction. We demonstrate state-of-the-art reconstruction results on benchmark images when compared to prior methods for monocular 3D reconstruction of objects. Qualitatively, our reconstructions provide a faithful match of the input view and a plausible extrapolation of its appearance and 3D shape, including to the side of the object not visible in the image.
[ "Luke Melas-Kyriazi", "Christian Rupprecht", "Iro Laina", "Andrea Vedaldi" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10663v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10663v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.CV", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.CV", "cs.AI", "cs.LG" ]
3 2 0 2 b e F 3 2 ] V C . s c [ 2 v 3 6 6 0 1 . 2 0 3 2 : v i X r a RealFusion 360◦ Reconstruction of Any Object from a Single Image Luke Melas-Kyriazi Iro Laina Christian Rupprecht Andrea Vedaldi Visual Geometry Group, Department of Engineering Science, University of Oxford {lukemk,iro,chrisr,vedaldi}@robots.ox.ac.uk https://lukemelas.github.io/realfusion Figure 1. RealFusion generates a full 360◦ reconstruction of any object given a single image of it (left column). It does so by leveraging an existing diffusion-based 2D image generator. From the given image, it synthesizes a prompt that causes the diffusion model to "dream up" other views of the object. It then extracts a neural radiance field from the original image and the diffusion model-based prior, thereby reconstructing the object in full. Both appearance and geometry are reconstructed faithfully and extrapolated in a plausible manner (see the textured and shaded reconstructions from different viewpoints). Abstract in the image. We consider the problem of reconstructing a full 360◦ photographic model of an object from a single image of it. We do so by fitting a neural radiance field to the image, but find this problem to be severely ill-posed. We thus take an off-the-self conditional image generator based on diffu- sion and engineer a prompt that encourages it to "dream up" novel views of the object. Using the recent DreamFu- sion method, we fuse the given input view, the conditional prior, and other regularizers in a final, consistent recon- struction. We demonstrate state-of-the-art reconstruction results on benchmark images when compared to prior meth- ods for monocular 3D reconstruction of objects. Qualita- tively, our reconstructions provide a faithful match of the input view and a plausible extrapolation of its appearance and 3D shape, including to the side of the object not visible 1. Introduction We consider the problem of obtaining a 360◦ photo- graphic reconstruction of any object given a single image of it. The challenge is that a single image does not con- tain sufficient information for 3D reconstruction. Without access to multiple views, an image only provides weak ev- idence about the 3D shape of the object, and only for one side of it. Even so, there is proof that this task can be solved: any skilled 3D artist can take a picture of almost any object and, given sufficient time and effort, create a plausible 3D model of it. The artist can do so by tapping into her vast knowledge of the natural world and of the objects it con- tains, making up for the information missing in the image. 1 To solve this problem algorithmically, one must then marry visual geometry with a powerful statistical model of the 3D world. The recent explosion of 2D image generators like DALL-E [36], Imagen [42], and Stable Diffusion [40] suggests that such models might not be far behind. By using diffusion, these methods can solve highly-ambiguous gen- eration tasks, obtaining plausible 2D images from textual descriptions, semantic maps, partially-complete images, or simply unconditionally from random noise. Clearly, these models possess high-quality priors-if not of the 3D world, then at least of the way it is represented in 2D images. Hence, in theory, a 3D diffusion model trained on vast quan- tities of 3D data should be capable of producing 3D recon- structions, either unconditionally or conditioned on a 2D image. However, training such a model is infeasible be- cause, while one can access billions of 2D images [43], the same cannot be said about 3D data. The alternative to training a 3D diffusion model is to ex- tract 3D information from an existing 2D model. A 2D im- age generator can in fact be used to sample or validate mul- tiple views of a given object; these multiple views can then be used to perform 3D reconstruction. With early GAN- based generators, authors showed some success for simple data like faces and synthetic objects [3, 9, 12, 30, 31, 54]. With the availability of large-scale models like CLIP [34] and, more recently, diffusion models, increasingly complex results have been obtained. The most recent example is DreamFusion [33], which generates high-quality 3D mod- els from textual descriptions alone. Despite these advances, the problem of single-image 3D reconstruction remains largely unsolved. In fact, these re- cent methods do not solve this problem. They either sample random objects, or, like in the case of DreamFusion, start from a textual description. A problem in extending generators to reconstruction is coverage (sometimes known as mode collapse). For exam- ple, high-quality face generators based on GANs are usually difficult to invert: they may be able to generate many differ- ent high-quality images, and yet are usually unable to gen- erate most images [1]. Conditioning on an image provides a much more detailed and nuanced specification of the object than, say, a textual description. It is not obvious if the gen- erator model would be able to satisfy all such constraints. In this paper, we study this problem in the context of diffusion models. We express the object's 3D geometry and appearance by means of a neural radiance field. Then, we train the radiance field to reconstruct the given input image by minimizing the usual rendering loss. At the same time, we sample random other views of the object, and constrain them with the diffusion prior, using a technique similar to DreamFusion. We find that, out of the box, this idea does not work well. Instead, we need to make a number of improvements and modifications. The most important change is to adequately condition the diffusion model. The idea is to configure the prior to "dream up" or sample images that may plausibly constitute other views of the given object. We do so by en- gineering the diffusion prompt from random augmentations of the given image. Only in this manner does the diffu- sion model provide sufficiently strong constraints to allow meaningful 3D reconstruction. In addition to setting the prompt correctly, we also add some regularizers: shading the underlying geometry and randomly dropping out texture (also similar to DreamFu- sion), smoothing the normals of the surface, and fitting the model in a coarse-to-fine fashion, capturing first the overall structure of the object and only then the fine-grained details. We also focus on efficiency and base our model on Instant- NGP [29]. In this manner, we achieve reconstructions in the span of hours instead of days if we were to adopt traditional MLP-based NeRF models. We assess our approach by using random images cap- tured in the wild as well as existing benchmark datasets. Note that we do not train a fully-fledged 2D-to-3D model and we are not limited to specific object categories; rather, we perform reconstruction on an image-by-image basis us- ing a pretrained 2D generator as a prior. Nonetheless, we can surpass quantitatively and qualitatively previous single- including Shelf-Supervised Mesh image reconstructors, Prediction [58], which uses supervision tailored specifically for 3D reconstruction. More impressively, and more importantly, we obtain plausible 3D reconstructions that are a good match for the provided input image (Fig. 1). Our reconstructions are not perfect, as the diffusion prior clearly does its best to explain the available image evidence but cannot always match all the details. Even so, we believe that our results convinc- ingly demonstrate the viability of this approach and trace a path for future improvements. To summarize, we make the following contributions: (1) We propose RealFusion, a method that can extract from a single image of an object a 360◦ photographic 3D recon- struction without assumptions on the type of object imaged or 3D supervision of any kind; (2) We do so by leveraging an existing 2D diffusion image generator via a new single- image variant of textual inversion; (3) We also introduce new regularizers and provide an efficient implementation using InstantNGP; (4) We demonstrate state-of-the-art re- construction results on a number of in-the-wild images and images from existing datasets when compared to alternative approaches. 2. Related work Image-based reconstruction of appearnce and geometry. Much of the early work on 3D reconstruction is based on principles of multi-view geometry [11]. These classic meth- 2 ods use photometry only to match image features and then discard it and only estimate 3D shape. The problem of reconstructing photometry and geome- try together has been dramatically revitalized by the intro- duction of neural radiance fields (RFs). NeRF [26] in par- ticular noticed that a coordinate MLP provides a compact and yet expressive representation of 3D fields, and can be used to model RFs with great effectiveness. Many variants of NeRF-like models have since appeared. For instance, some [24, 48, 50] use sign distance functions (SDFs) to recover cleaner geometry. These approaches assume that dozens if not hundreds of views of each scene are avail- able for reconstruction. Here, we use them for single-image reconstruction, using a diffusion model to "dream up" the missing views. Few-view reconstruction. Many authors have attempted to improve the statistical efficiency of NeRF-like models, by learning or incorporating various kinds of priors. Quite re- lated to our work, NeRF-on-a-Diet [17] reduces the number of images required to learn a NeRF by generating random views and measuring their "semantic compatibility" with the available views via CLIP embeddings [35], but they still require several input views. While CLIP is a general-purpose model learned on 2D data, other authors have learned deep networks specifically for the goal of inferring NeRFs from a small number of views. Examples include IBRNet [51], NeRF-WCE [13], PixelNeRF [60], NeRFormer [38], and ViewFormer [22]. These models still generally require more than one input view at test time, require multi-view data for training, and are often optimized for specific object categories. Single-view reconstruction. Some authors have at- tempted to recover full radiance fields from single im- ages, but this generally requires multi-view data for train- ing, as well as learning models that are specific to a spe- cific object category. 3D-R2N2 [5], Pix2Vox [55, 55], and LegoFormer [57] learn to reconstruct volumetric represen- tation of simple objects, mainly from synthetic data like ShapeNet [4]. More recently, CodeNeRF [19] predicts a full radiance field, including reconstructing the photometry of the objects. AutoRF [28] learns a similar autoencoder specifically for cars. Extracting 3D models from 2D generators. Several au- thors have proposed to extract 3D models from 2D image generators, originally using GANs [3, 9, 12, 30, 31, 54]. More related to our work, CLIP-Mesh [20] and Dream Fields [16] do so by using the CLIP embedding and can condition 3D generation on text. Our model is built on the recent Dream Fusion approach [33], which builds on a sim- ilar idea using a diffusion model as prior. However, these models have been used as either pure generators or generators conditioned on vague cues such as Figure 2. Method diagram. Our method optimizes a neural ra- diance field using two objectives simultaneously: a reconstruction objective and a prior objective. The reconstruction objective en- sures that the radiance field resembles the input image from a spe- cific, fixed view. The prior objective uses a large pre-trained dif- fusion model to ensure that the radiance field looks like the given object from randomly sampled novel viewpoints. The key to mak- ing this process work well is to condition the diffusion model on a prompt with a custom token (cid:104)e(cid:105), which is generated prior to recon- struction using single-image textual inversion. This diagram does not display our coarse-to-fine training strategy or regularization terms, both of which improve qualitative results. class identity or text. Here, we build on similar ideas, but we apply them to the case of single-view reconstruction. Recently, the authors of [53] have proposed to directly generate multiple 2D views of an object, which can then be reconstructed in 3D using a NeRF-like model. This is also reminiscent of our approach, but their model requires multi- view data for training, is only tested on synthetic data, and requires to explicitly sample multiple views for reconstruc- tion (in our case they remain implicit). Diffusion Models. Diffusion denoising probabilistic models are a class of generative models based on iteratively In vision, early reversing a Markovian noising process. works formulated the problem as learning a variational lower bound [14], or framed it as optimizing a score- based generative model [45, 46] or as the discretization im- of a continuous stochastic process [47]. provements includes the use of faster and deterministic sampling [14, 25, 52], class-conditional models [7, 46], text-conditional models [32], and modeling in latent space [41]. Recent 3. Method We provide an overview and notation for the background material first (Sec. 3.1), and then discuss our RealFusion method (Sec. 3.2). 3 Input ImageRenderReconstruction ViewNovel ViewPrompt with optimized embedding token <e>Reconstruction ObjectiveDiffusionModelPrior ObjectiveNovel ViewNovel ViewNovel ViewSingle-ImageTextual InversionDiffusionModelPrior ObjectiveDiffusionModelPrior ObjectiveDiffusionModelPrior Objective standard optimizer. Specifically, the RF is fitted to a dataset D = {(I, π)} of images I with known camera parameters by minimizing the L2 image reconstruction error Lrec(σ, c; D) = 1 |D| (cid:88) (I,π)∈D (cid:107)I − R(*; σ, c, π)(cid:107)2. (2) In order to obtain good quality results, one typically re- quires a dataset of dozens or hundreds of views. Here, we consider the case in which we are given ex- actly one input image I0 corresponding to some (unknown) camera π0. In this case, we can also assume any standard viewpoint π0 for that single camera. Optimizing Eq. (2) with a single training image leads to severe over-fitting: it is straightforward to find a pair (σ, c) that has zero loss and yet does not capture any sensible 3D model of the object. Below we will leverage a pre-trained 2D image prior to (im- plicitly) dream up novel views of the object and provide the missing information for 3D reconstruction. Diffusion models. A diffusion model draws a sample from a probability distribution p(I) by inverting a pro- cess that gradually adds noise to the image I. The diffu- sion process is associated with a variance schedule {βt ∈ (0, 1)}T t=1, which defines how much noise is added at each time step. The noisy version of sample I at time t can then 1 − ̄αt(cid:15) where (cid:15) ∼ N (0, I), is a be written It = sample from a Gaussian distribution (with the same dimen- sionality as I), αt = 1 − βt, and ̄αt = (cid:81)t i=1 αi. One then learns a denoising neural network ˆ(cid:15) = Φ(It; t) that takes as input the noisy image It and the noise level t and tries to predict the noise component (cid:15). ̄αtI + √ √ In order to draw a sample from the distribution p(I), one starts by drawing a sample IT ∼ N (0, I). Then, one progressively denoises the image by iterated application of Φ according to a specified sampling schedule [15, 25, 44], which terminates with I0 sampled from p(I). Modern diffusion models are trained on large collections D(cid:48) = {I} of images by minimizing the loss Ldiff(Φ; D(cid:48)) = 1 |D(cid:48)| (cid:88) √ ||Φ( ̄αtI + √ 1 − ̄αt(cid:15), t) − (cid:15)||2. I∈D(cid:48) (3) This model can be easily extended to draw samples from a distribution p(x|e) conditioned on a prompt e. Condition- ing on the prompt is obtained by adding e as an additional input of the network Φ, and the strength of conditioning can be controlled via classifier-free guidance [7]. DreamFusion and Score Distillation Sampling (SDS). Given a 2D diffusion model p(I|e) and a prompt e, Dream- Fusion extracts from it a 3D rendition of the corresponding concept, represented by a RF (σ, c). It does so by randomly sampling a camera parameter π, rendering a corresponding view Iπ, assessing the likelihood of the view based on the 4 Figure 3. Examples demonstrating the level of detail of infor- mation captured by the optimized embedding (cid:104)e(cid:105). Rows 1- 2 show input images and masks. The images are used to opti- mize (cid:104)e(cid:105) via our single-image textual inversion process. Rows 3-5 show examples of 2D images generated using (cid:104)e(cid:105) in new prompts, which we hope demonstrate the type of information encoded in (cid:104)e(cid:105). Rows 6-7 show RealFusion's output, optimized using the prompt "An image of a (cid:104)e(cid:105)". 3.1. Radiance fields and DreamFusion Radiance fields. A radiance field (RF) is a pair of func- tions (σ(x), c(x)) mapping a 3D point x ∈ R3 to an opac- ity value σ(x) ∈ R+ and a color value c(x) ∈ R3. The RF is called neural when these two functions are implemented by a neural network. The RF represents the shape and appearance of an object. In order to generate an image of it, one renders the RF using the emission-absorption model. Let I ∈ R3×H×W be an image, so that I(u) ∈ R3 is the color of pixel u. In order to compute I(u), one casts a ray ru from the camera center through the pixel, interpreted as a point on the 3D image plane (this implicitly accounts for the camera viewpoint π ∈ SE(3)). Then, one takes a certain number of samples (xi ∈ ru)i∈N , for indices N = {1, . . . , N } taken with constant spacing ∆. The color is obtained as: I(u) = R(u; σ, c) = (cid:88) i∈N (Ti+1 − Ti)c(xi), (1) where Ti = exp(−∆ (cid:80)i−1 j=0 σ(xj)) is the probability that a photon is transmitted from point xi back to the camera sensor without being absorbed by the material. Importantly, the rendering function R(u; σ, c) is differ- entiable, which allows training the model by means of a Illustration of the information contained in <e>:"A sketch of a <e>"Automatic MaskInput ImageRealFusionauto-prompt:"An image of a <e>""A davinci painting of a <e>"RealFusion:Novel View 1RealFusion:Novel View 2RealFusion:Novel View 3ewfLSDSLrec model p(Iπ|e), and updating the RF to increase the likeli- hood of the generated view based on the model. In practice, DreamFusion uses the denoiser network as a frozen critic and takes a gradient step ∇(σ,c)LSDS(σ, c; π, e, t) = (cid:104) Et,(cid:15) w(t)(Φ(αtI + σt(cid:15); t, e) − (cid:15)) * ∇(σ,c)I (cid:105) , (4) where I = R(*; σ, c, π). is the image rendered from a given viewpoint π and prompt e. This process is called Score Distillation Sampling (SDS). Note that Eq. (4) differs from simply optimizing the standard diffusion model objective because it does not in- clude the Jacobian term for Φ. In practice, removing this term both improves generation quality and reduces compu- tational and memory requirements. One final aspect of DreamFusion is essential for under- standing our contribution in the following section: Dream- Fusion finds that it is necessary to use classifier-free guid- ance [7] with a very high guidance weight of 100, much larger than one would use for image sampling, in order to obtain good 3D shapes. As a result, the generations tend to have limited diversity; they produce only the most likely objects for a given prompt, which is incompatible with our goal of reconstructing any given object. 3.2. RealFusion Our goal is to reconstruct a 3D model of the object con- tained in a single image I0, utilizing the prior captured in the diffusion model Φ to make up for the missing informa- tion. We will achieve this by optimizing a radiance field using two simultaneous objectives: (1) a reconstruction ob- jective Eq. (2) from a fixed viewpoint, and (2) a SDS-based prior objective Eq. (4) on novel views randomly sampled at each iteration. Figure 2 provides a diagram of the entire system. Single-image textual inversion as a substitute for al- ternative views. The most important component of our method is the use of single-image textual inversion as a sub- stitute for alternative views. Ideally, we would like to condi- tion our reconstruction process on multi-view images of the object in I0, i.e. on samples from p(I|I0). Since these im- ages are not available, we instead synthesize a text prompt e(I0) specifically for our image I0 as a proxy for this multi- view information. Our idea, then, is to engineer a prompt e(I0) to provide a useful approximation of p(I|I0). We do so by generating random augmentations g(I0), g ∈ G of the input image, which serve as pseudo-alternative-views. We use these aug- mentations as a mini-dataset D(cid:48) = {g(I0)}g∈G and opti- mize the diffusion loss Eq. (3) Ldiff(Φ(*; e(I0))) with respect to the prompt e(I0), while freezing all other text embeddings and model parameters. In practice, our prompt is derived automatically from templates like "an image of a (cid:104)e(cid:105)", where "(cid:104)e(cid:105)" (= e(I0)) is a new token introduced to the vocabulary of the text encoder of our diffusion model (see Appendix A for de- tails). Our optimization procedure mirrors and general- izes the recently-proposed textual-inversion method of [10]. Differently from [10], we work in the single-image set- ting and utilize image augmentations for training rather than multiple views. To help convey the intuition behind (cid:104)e(cid:105), consider an at- tempt at reconstructing an image of a fish using the generic text prompt "An image of a fish" with losses Eqs. (3) and (4). In our experience, this often produces a reconstruc- tion which looks like the input fish from the input view- point, but looks like some different, more-generic fish from the backside. By contrast, using the prompt "An image of a (cid:104)e(cid:105)", the reconstruction resembles the input fish from all an- gles. An example of exactly this case is shown in Figure 7. Finally, Figure 3 demonstrates the amount of detail cap- tured in the embedding (cid:104)e(cid:105). Coarse-to-fine training. In order to describe our coarse- to-fine training methodology, it is necessary to first briefly introduce our underlying RF model, a InstantNGP [29]. In- stantNGP is a grid-based model which stores features at the vertices of a set of feature grids {Gi}L i=1 at multiple res- olutions. The resolution of these grids is chosen to be a geometric progression between the coarsest and finest reso- lutions, and feature grids are trained simultaneously. We choose a InstantNGP over a conventional MLP- based NeRF due to its computational efficiency and training speed. However, the optimization procedure occasionally produces small irregularities on the surface of the object. We find that training in a coarse-to-fine manner helps to al- leviate these issues: for the first half of training we only op- timize the lower-resolution feature grids {Gi}L/2 i=1 , and then in the second half of training we optimize all feature grids {Gi}L i=1. Using this strategy, we obtain the benefits of both efficient training and high-quality results. Normal vector regularization. Next, we introduce a new regularization term to encourage our geometry to have smooth normals. The introduction of this term is motivated by the observation that our RF model occasionally gener- ated noisy-looking surfaces with low-level artifacts. To ad- dress these artifacts, we encourage our RF to have smoothly varying normal vectors. Notably, we perform this regular- ization in 2D rather than in 3D. At each iteration, in addition to computing RGB and opacity values, we also compute normals for each point along the ray and aggregate these via the raymarching equa- 5 Figure 4. Qualitative results. RealFusion reconstructions from a single input view. Each pair of columns shows the textured object and the underlying 3D shape, as a shaded surface. Different pairs of columns show different viewpoints. tion to obtain normals N ∈ RH×W ×3.1 Our loss is: Our final objective then consists of four terms: Lnormals = (cid:107)N − stopgrad(blur(N, k))(cid:107)2 (5) ∇σ,cL = ∇LSDS + λnormals * ∇Lnormals where stopgrad is a stop-gradient operation and blur(*, k) is a Gaussian blur with kernel size k (we use k = 9). Although it may be more common to regularize normals in 3D, we found that operating in 2D reduced the variance of the regularization term and led to superior results. Mask loss. In addition to the input image, our model also utilizes a mask of the object that one wishes to reconstruct. In practice, we use an off-the-shelf image matting model to obtain this mask for all images. We incorporate this mask in a simple manner by adding a simple L2 loss term on the difference between the rendered opacities from the fixed reference viewpoint R(σ, π0) ∈ RH×W and the object mask M : Lrec,mask = ||O − M ||2 + λimage * ∇Limage + λmask * ∇Lmask (6) where the top line in the equation above corresponds to our prior objective and the bottom line corresponds to our re- construction objective. 4. Experiments 4.1. Implementation details Regarding hyperparameters, we use essentially the same set of hyper-parameters for all experiments-there is no per-scene hyper-parameter optimization.2. For our diffusion model prior, we employ the open-source Stable Diffusion model [41] trained on the LAION [43] dataset of text-image pairs. For our InstantNGP [29] model, we use a model with 1Normals may be computed either by taking the gradient of the density field or by using finite differences. We found that using finite differences worked well in practice. 2There is one small exception to this rule, which is that for a few num- ber of images where the camera angle was clearly at an angle higher than 15◦, we took a camera angle of 30 or 40deg. 6 Table 1. Quantitative comparison. We compare our method with Shelf-Supervised [59] on seven object categories. The F-score and CLIP-similarity metrics are designed to measure the quality of re- construction shape and appearance, respectively. For both metrics, higher is better. Metrics are averaged over three images per cate- gory. Our method outperforms [59] in aggregate, despite the fact that [59] uses a different category-specific model for each category. F-score CLIP-similarity [59] Ours Backpack Chair Motorcycle Orange Skateboard Teddybear Vase 7.58 8.26 8.66 6.27 7.74 12.89 6.30 12.22 10.23 8.72 10.16 5.89 10.08 9.72 Mean 8.24 9.58 [59] 0.72 0.65 0.69 0.71 0.74 0.73 0.69 0.70 Ours 0.74 0.76 0.70 0.74 0.74 0.82 0.71 0.74 cludes the use of diffuse and textureless shading stochas- tic throughout the course of optimization, after an initial warmup period of albedo-only shading. Complete details regarding this and other aspects of our training setup are provided in the supplementary material. 4.2. Quantitative results There are only few methods that attempt to recon- struct arbitrary objects in 3D. The most recent and best- performing of these is Shelf-Supervised Mesh Predic- tion [58], which we compare here. They provide 50 pre- trained category-level models for 50 different categories in OpenImages [23]. Since we aim to compute metrics using 3D or multi-view ground truth, we evaluate on seven cate- gories in the CO3D dataset [39] with corresponding Open- Images categories. For each of these seven categories, we select three images at random and run both RealFusion and Shelf-Supervised to obtain reconstructions. We first test the quality of the recovered 3D shape in Fig. 5. Shelf-Supervised directly predicts a mesh. We ex- tract one from our predicted radiance fields using march- ing cubes. CO3D comes with sparse point-cloud recon- struction of the objects obtained using multi-view geome- try. For evaluation, we sample points from the reconstructed meshes and align them optimally with the ground truth point cloud by first estimating a scaling factor and then using Iter- ated Closest Point (ICP). Finally, we compute F-score with threshold 0.05 to measure the distance between the pre- dicted and ground truth point clouds. Results are shown in Tab. 1. In order to evaluate the quality of the reproduced appear- ance, we also compare novel-view renderings from our and their method (Tab. 1). Ideally, these renderings should pro- Figure 5. Qualitative comparison with prior work. We show the results of our method and the category-level method of [59] on real-world images from the CO3D dataset [38]. Each pair of rows show two novel views produced by [59] and our method. For [59], we use category-specific models for each CO3D category (in this case, motorcycles, cups, and backpacks). Despite not re- quiring any category-specific information, our method is able to reconstruct objects at a higher level of detail than [59]. Figure 6. A demonstration of multi-modal image reconstruc- tion. Above, we see our method's ability to generate a diverse set of object reconstructions given the same input image. In partic- ular, the method produces different textures on the backsides of the generated objects, despite all objects matching the input image from the reference view. 16 resolution levels, a feature dimension of 2, and a maxi- mum resolution of 2048, trained in a coarse-to-fine manner as explained above. The camera for reconstruction is placed looking at the origin on a sphere of radius 1.8, at an angle of 15deg above the plane. At each optimization step, we first render from the reconstruction camera and compute our reconstruction losses Lrec and Lrec,mask. We then render from a randomly sampled camera to obtain a novel view, and use this view for Lsds and Lnormals. We use λimage = 5.0, λmask = 0.5, and λnormal = 0.5. Regarding camera sampling, lighting, and shading, we keep nearly all parameters the same as [33]. This in- 7 Figure 7. A visualization of the effect of single-image textual inversion on reconstruction quality. In each pair of rows, the top row shows the result of utilizing a standard text prompt for our diffusion-model-based loss (e.g. "An image of a statue of a cat"). The bottom row shows the result of utilizing a text prompt optimized for the input image in a fully-automatic manner; this textual inversion process dramatically improves object reconstruction. Figure 8. Effect of coarse-to-fine training. The top row of each pair is generated by optimizing all levels of a multi-resolution 3D feature grid from the first optimization step, whereas he bottom row is optimized in a coarse-to-fine manner. duce views that are visually close to the real views. In or- der to test this hypothesis, we check whether the generated views are close or not to the other views given in CO3D. We then report the CLIP embedding similarity of the generated images with respect to the closest CO3D view available (i.e. the view with maximum similarity). 4.3. Qualitative results Figure 9. Effect of normal smoothness on reconstruction qual- ity. Each pair of rows show the reconstruction without and with the normal smoothness regularization term equation 5. The regu- larizer improves the visual appearance of surfaces and reduces the number of irregularities on the surface of reconstructed objects. In most cases, we also find that it helps to improve the overall realism of the reconstructed shape. sible solutions by repeating the reconstruction several times, starting from the same input image. There is little variance in the reconstructions of the front of the object, but quite a large variance for its back, as expected. Figure 4 shows additional qualitative results from multi- ple viewpoints. Having a single image of an object means that several 3D reconstructions are possible. Figure 6 ex- plores the ability of RealFusion to sample the space of pos- Figure 11 shows two typical failure modes of RealFu- sion: in some cases the model fails to converge, and in oth- ers it copies the front view to the back of the object, even if this is not semantically correct. 8 to-fine optimization reduces the presence of low-level ar- tifacts and results in smoother, visually pleasing surfaces. Fig. 10 shows that using Stable Diffusion works signifi- cantly better than relying on an alternative such as CLIP. 5. Conclusions We have introduced RealFusion, a new approach to ob- tain full 360◦ photographic reconstructions of any object given a single image of it. Given an off-the-shelf diffusion model trained using only 2D images and no special super- vision for 3D reconstruction, as well as a single view of the target object, we have shown how to select the model prompt to imagine other views of the object. We have used this conditional prior to learn an efficient, multi-scale radi- ance field representation of the reconstructed object, incor- porating an additional regularizer to smooth out the recon- structed surface. The resulting method can generate plausi- ble 3D reconstructions of objects captured in the wild which are faithful to the input image. Future works include spe- cializing the diffusion model for the task of new-view syn- thesis and incorporating dynamics to reconstruct animated 3D scenes. Ethics. We use the CO3D dataset in a manner compatible with their terms. CO3D does not contain personal infor- mation. Please see https://www.robots.ox.ac. uk/ ̃vedaldi/research/union/ethics.html for further information on ethics. Acknowledgments. L. M. K. is supported by the Rhodes Trust. A. V., I. L. and C.R. are supported by ERC-UNION- CoG-101001212. C. R. is also supported by VisualAI EP/T028572/1. References [1] David Bau, Jun-Yan Zhu, Jonas Wulff, William S. Peebles, Bolei Zhou, Hendrik Strobelt, and Antonio Torralba. Seeing what a GAN cannot generate. In Proc. ICCV, 2019. 2 [2] Mathilde Caron, Hugo Touvron, Ishan Misra, Herv ́e J ́egou, Julien Mairal, Piotr Bojanowski, and Armand Joulin. Emerg- ing properties in self-supervised vision transformers. In Proc. ICCV, 2021. 15 [3] Eric R. Chan, Connor Z. Lin, Matthew A. Chan, Koki Nagano, Boxiao Pan, Shalini De Mello, Orazio Gallo, Leonidas J. Guibas, Jonathan Tremblay, Sameh Khamis, Tero Karras, and Gordon Wetzstein. Efficient geometry- aware 3D generative adversarial networks. In Proc. CVPR, 2022. 2, 3 [4] Angel X. Chang, Thomas A. Funkhouser, Leonidas J. Guibas, Pat Hanrahan, Qi-Xing Huang, Zimo Li, Silvio Savarese, Manolis Savva, Shuran Song, Hao Su, Jianxiong Xiao, Li Yi, and Fisher Yu. ShapeNet an information-rich 3d model repository. arXiv.cs, abs/1512.03012, 2015. 3 [5] Christopher B. Choy, Danfei Xu, JunYoung Gwak, Kevin Chen, and Silvio Savarese. 3d-r2n2: A unified approach Figure 10. Comparing Stable Diffusion and CLIP priors. Results from two different priors: Stable Diffusion [41] and CLIP [34]. Stable Diffusion yields much higher-quality recon- structions, capturing more plausible object shapes. Figure 11. Failure cases. In the first two examples, the model simply fails to properly reconstruct the object geometry, and pro- duces a semi-transparent scene which lacks a well-defined geom- etry. The third case is different in that the geometry is highly re- alistic, but the texture paints two Pikachu faces, one on each side of the object; this problem is sometimes called the Janus problem, after the two-faced Roman god. 4.4. Analysis and Ablations One of the key components of RealFusion is our use of single-image textual inversion, which allows the model to correctly imagine novel views of a specific object. Figure 7 shows that this component plays indeed a critical role in the quality of the reconstructions. Without texual inversion, the model often reconstructs the backside of the object in the form of a generic instance from the object category. For ex- ample, the backside of the cat statue in the top row of Fig. 7 is essentially a different statue of a more generic-looking cat, whereas the model trained with textual inversion resem- bles the true object from all angles. Other components of the model are also significant. Figure 9 shows that the normal smoothness regularizer of Eq. (5) results in smoother, more realistic meshes and reduces the number of artifacts. Figure 8 shows that coarse- 9 for single and multi-view 3d object reconstruction. In Proc. ECCV, 2016. 3 [6] Kangle Deng, Andrew Liu, Jun-Yan Zhu, and Deva Ra- manan. Depth-supervised NeRF: Fewer views and faster training for free. In Proceedings of the IEEE/CVF Confer- ence on Computer Vision and Pattern Recognition (CVPR), June 2022. 13 [7] Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. In Advances in Neural Infor- mation Processing Systems, volume 34, pages 8780–8794, 2021. 3, 4, 5 [8] Christiane Fellbaum. WordNet: An Electronic Lexical Database. Bradford Books, 1998. 13 [9] Matheus Gadelha, Subhransu Maji, and Rui Wang. 3D shape induction from 2D views of multiple objects. In arXiv, 2016. 2, 3 [10] Rinon Gal, Yuval Alaluf, Yuval Atzmon, Or Patash- nik, Amit H Bermano, Gal Chechik, and Daniel Cohen- Or. An image is worth one word: Personalizing text-to- image generation using textual inversion. arXiv preprint arXiv:2208.01618, 2022. 5, 13 [11] R. I. Hartley and A. Zisserman. Multiple View Geometry in Computer Vision. Cambridge University Press, ISBN: 0521540518, second edition, 2004. 2 [12] Philipp Henzler, Niloy J. Mitra, and Tobias Ritschel. Escap- ing plato's cave using adversarial training: 3D shape from unstructured 2D image collections. In Proc. ICCV, 2019. 2, 3 [13] Philipp Henzler, Jeremy Reizenstein, Patrick Labatut, Ro- man Shapovalov, Tobias Ritschel, Andrea Vedaldi, and David Novotny. Unsupervised learning of 3d object cate- gories from videos in the wild. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021. 3 [14] Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffu- sion probabilistic models. In Proc. NeurIPS, 2020. 3 [15] Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising dif- In Advances in Neural Infor- fusion probabilistic models. mation Processing Systems, volume 33, pages 6840–6851, 2020. 4 [16] Ajay Jain, Ben Mildenhall, Jonathan T. Barron, Pieter Abbeel, and Ben Poole. Zero-shot text-guided object gen- eration with dream fields. In Proc. CVPR, 2022. 3 [17] Ajay Jain, Matthew Tancik, and Pieter Abbeel. Putting nerf on a diet: Semantically consistent few-shot view synthesis. In Proc. ICCV, 2021. 3 [18] Ajay Jain, Matthew Tancik, and Pieter Abbeel. Putting nerf on a diet: Semantically consistent few-shot view synthe- sis. In Proceedings of the IEEE/CVF International Confer- ence on Computer Vision (ICCV), pages 5885–5894, October 2021. 13 [19] Wonbong Jang and Lourdes Agapito. CodeNeRF: Disentan- In Proc. gled neural radiance fields for object categories. ICCV, 2021. 3 [20] Nasir Mohammad Khalid, Tianhao Xie, Eugene Belilovsky, and Pop Tiberiu. CLIP-Mesh: Generating textured meshes from text using pretrained image-text models. SIGGRAPH Asia, 2022. 3 [21] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. 2014. 12, 13 arXiv preprint arXiv:1412.6980, [22] Jon ́aˇs Kulh ́anek, Erik Derner, Torsten Sattler, and Robert Babuˇska. ViewFormer: NeRF-free neural rendering from few images using transformers. In Proc. ECCV, 2022. 3 [23] Alina Kuznetsova, Hassan Rom, Neil Alldrin, Jasper Ui- jlings, Ivan Krasin, Jordi Pont-Tuset, Shahab Kamali, Stefan Popov, Matteo Malloci, Alexander Kolesnikov, Tom Duerig, and Vittorio Ferrari. The open images dataset v4: Unified image classification, object detection, and visual relationship detection at scale. IJCV, 2020. 7 [24] Chen-Hsuan Lin, Chaoyang Wang, and Simon Lucey. SDF- SRN: learning signed distance 3d object reconstruction from static images. In Hugo Larochelle, Marc'Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and Hsuan-Tien Lin, editors, Proc. NeurIPS, 2020. 3 [25] Luping Liu, Yi Ren, Zhijie Lin, and Zhou Zhao. Pseudo numerical methods for diffusion models on manifolds. In In- ternational Conference on Learning Representations, 2021. 3, 4 [26] Ben Mildenhall, Pratul P. Srinivasan, Matthew Tancik, Jonathan T. Barron, Ravi Ramamoorthi, and Ren Ng. NeRF: Representing scenes as neural radiance fields for view syn- thesis. In Proc. ECCV, 2020. 3 [27] Ben Mildenhall, Pratul P. Srinivasan, Matthew Tancik, Jonathan T. Barron, Ravi Ramamoorthi, and Ren Ng. Nerf: Representing scenes as neural radiance fields for view syn- thesis. In ECCV, 2020. 13 [28] Norman M ̈uller, Andrea Simonelli, Lorenzo Porzi, Samuel Rota Bul`o, Matthias Niessner, and Peter Kontschieder. Autorf: Learning 3d object radiance fields from single view observations. CoRR, abs/2204.03593, arXiv.cs. 3 [29] Thomas Muller, Alex Evans, Christoph Schied, and Alexan- der Keller. Instant neural graphics primitives with a multires- olution hash encoding. ACM Trans. Graph., 41(4):102:1– 102:15, July 2022. 2, 5, 6 [30] Thu Nguyen-Phuoc, Chuan Li, Lucas Theis, Christian Richardt, and Yong-Liang Yang. HoloGAN: Unsupervised learning of 3D representations from natural images. arXiv.cs, abs/1904.01326, 2019. 2, 3 [31] Thu Nguyen-Phuoc, Christian Richardt, Long Mai, Yong- Liang Yang, and Niloy J. Mitra. Blockgan: Learning 3d object-aware scene representations from unlabelled images. In Proc. NeurIPS, 2020. 2, 3 [32] Alex Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin, Bob McGrew, Ilya Sutskever, and Mark Chen. Glide: Towards photorealistic image generation and editing with text-guided diffusion models. arXiv preprint arXiv:2112.10741, 2021. 3 [33] Ben Poole, Ajay Jain, Jonathan T. Barron, and Ben Milden- hall. Dreamfusion: Text-to-3d using 2d diffusion. arXiv.cs, abs/2209.14988, 2022. 2, 3, 7, 12, 13, 14 [34] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning transferable visual models from natural language supervision, 2021. 2, 9 [35] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya 10 Density-Distance fields. In Proc. ECCV, 2022. 3 [49] Dor Verbin, Peter Hedman, Ben Mildenhall, Todd Zickler, Jonathan T Barron, and Pratul P Srinivasan. Ref-nerf: Struc- tured view-dependent appearance for neural radiance fields. In 2022 IEEE/CVF Conference on Computer Vision and Pat- tern Recognition (CVPR), pages 5481–5490. IEEE, 2022. 12 [50] Peng Wang, Lingjie Liu, Yuan Liu, Christian Theobalt, Taku Komura, and Wenping Wang. NeuS: Learning neural im- plicit surfaces by volume rendering for multi-view recon- struction. arXiv.cs, abs/2106.10689, 2021. 3 [51] Qianqian Wang, Zhicheng Wang, Kyle Genova, Pratul P. Srinivasan, Howard Zhou, Jonathan T. Barron, Ricardo Martin-Brualla, Noah Snavely, and Thomas A. Funkhouser. Ibrnet: Learning multi-view image-based rendering. In Proc. CVPR, 2021. 3 [52] Daniel Watson, William Chan, Jonathan Ho, and Moham- mad Norouzi. Learning fast samplers for diffusion models In International by differentiating through sample quality. Conference on Learning Representations, 2021. 3 [53] Daniel Watson, William Chan, Ricardo Martin-Brualla, Jonathan Ho, Andrea Tagliasacchi, and Mohammad Norouzi. Novel view synthesis with diffusion models. arXiv.cs, abs/2210.04628, 2022. 3 [54] Jiajun Wu, Chengkai Zhang, Tianfan Xue, Bill Freeman, and Josh Tenenbaum. Learning a probabilistic latent space of ob- ject shapes via 3D generative-adversarial modeling. In Proc. NeurIPS, 2016. 2, 3 [55] Haozhe Xie, Hongxun Yao, Shengping Zhang, Shangchen Zhou, and Wenxiu Sun. Pix2vox++: Multi-scale context- aware 3d object reconstruction from single and multiple im- ages. Int. J. Comput. Vis., 128(12), 2020. 3 [56] Dejia Xu, Yifan Jiang, Peihao Wang, Zhiwen Fan, Humphrey Shi, and Zhangyang Wang. Sinnerf: Training neural radiance fields on complex scenes from a single image. 2022. 13 [57] Farid Yagubbayli, Alessio Tonioni, and Federico Tombari. Legoformer: Transformers for block-by-block multi-view 3d reconstruction. arXiv.cs, abs/2106.12102, 2021. 3 [58] Yufei Ye, Shubham Tulsiani, and Abhinav Gupta. CoRR, Shelf-supervised mesh prediction in the wild. abs/2102.06195, 2021. 2, 7 [59] Yufei Ye, Shubham Tulsiani, and Abhinav Gupta. Shelf- supervised mesh prediction in the wild. In Computer Vision and Pattern Recognition (CVPR), 2021. 7 [60] Alex Yu, Vickie Ye, Matthew Tancik, and Angjoo Kanazawa. pixelnerf: Neural radiance fields from one or few images. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 4578–4587, 2021. 3, 13 [61] Richard Zhang, Phillip Isola, Alexei A Efros, Eli Shechtman, and Oliver Wang. The unreasonable effectiveness of deep features as a perceptual metric. In CVPR, 2018. 14 Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning transferable visual models from natural language supervision. In Proc. ICML, volume 139, pages 8748–8763, 2021. 3 [36] Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya arXiv Sutskever. Zero-shot preprint arXiv:2102.12092, 2021. 2 text-to-image generation. [37] Ren ́e Ranftl, Katrin Lasinger, David Hafner, Konrad Schindler, and Vladlen Koltun. Towards robust monocular depth estimation: Mixing datasets for zero-shot cross-dataset transfer. arXiv:1907.01341, 2019. 14 [38] Jeremy Reizenstein, Roman Shapovalov, Philipp Henzler, Luca Sbordone, Patrick Labatut, and David Novotny. Com- mon objects in 3d: Large-scale learning and evaluation of In International Con- real-life 3d category reconstruction. ference on Computer Vision, 2021. 3, 7 [39] Jeremy Reizenstein, Roman Shapovalov, Philipp Henzler, Luca Sbordone, Patrick Labatut, and David Novotny. Com- mon Objects in 3D: Large-scale learning and evaluation of real-life 3D category reconstruction. In Proc. CVPR, 2021. 7 [40] Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Bj ̈orn Ommer. High-resolution image synthesis with latent diffusion models. In IEEE Conference on Computer Vision and Pattern Recognition, pages 10684– 10695, 2022. 2 [41] Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Bj ̈orn Ommer. High-resolution image syn- thesis with latent diffusion models. In Proc. CVPR, 2022. 3, 6, 9, 12, 17 [42] Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily Denton, Seyed Kamyar Seyed Ghasemipour, Burcu Karagol Ayan, S Sara Mahdavi, Rapha Gontijo Lopes, et al. Photorealistic text-to-image diffusion models with deep language understanding. arXiv preprint arXiv:2205.11487, 2022. 2 [43] Christoph Schuhmann, Romain Beaumont, Richard Vencu, Cade Gordon, Ross Wightman, Mehdi Cherti, Theo Coombes, Aarush Katta, Clayton Mullis, Mitchell Worts- man, et al. Laion-5b: An open large-scale dataset for training next generation image-text models. arXiv preprint arXiv:2210.08402, 2022. 2, 6 [44] Jiaming Song, Chenlin Meng, and Stefano Ermon. Denois- ing diffusion implicit models. In International Conference on Learning Representations, 2020. 4 [45] Yang Song and Stefano Ermon. Generative modeling by es- timating gradients of the data distribution. In Proc. NeurIPS, 2019. 3 [46] Yang Song and Stefano Ermon. Improved techniques for training score-based generative models. Advances in neural information processing systems, 33:12438–12448, 2020. 3 [47] Yang Song, Jascha Sohl-Dickstein, Diederik P. Kingma, Ab- hishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equa- tions. In Proc. ICLR, 2021. 3 [48] Itsuki Ueda, Yoshihiro Fukuhara, Hirokatsu Kataoka, Hi- roaki Aizawa, Hidehiko Shishido, and Itaru Kitahara. Neural 11 A. Implementation Details In this section, we provide full implementation details which were omitted from the main text due to space con- straints. Most of these details follow [33], but a few are slightly modified. Shading. We consider three different types of shading: albedo, diffuse, and textureless. For albedo, we simply ren- der the RGB color of each ray as given by our model: I(u) = Iρ(u) = R(u; σ, c) For diffuse, we also compute the surface normal n as the normalized negative gradient of the density with respect to u. Then, given a point light l with color lρ and an ambient light with color la, we render I(u) = Iρ(u) ◦ (lρ ◦ max(0, n * l−u ||l−u|| + la)) For textureless, we use the same equation with Iρ(u) re- placed by white (1, 1, 1). For the reconstruction view, we only use albedo shad- ing. For the random view (i.e. the view used for the prior objectives), we use albedo shading for the first 1000 steps of training by setting la = 1.0 and lρ = 0.0. Afterwards we use la = 0.1 and lρ = 0.9, and we select stochastically between albedo, diffuse, and textureless with probabilities 0.2, 0.4, and 0.4, respectively. We obtain the surface normal using finite differences: n = 1 2 * (cid:15)   I(u + (cid:15)x) − I(u − (cid:15)x) I(u + (cid:15)y) − I(u − (cid:15)y) I(u + (cid:15)z) − I(u − (cid:15)z)   where (cid:15)x = ((cid:15), 0, 0), (cid:15)y = (0, (cid:15), 0), and (cid:15)z = (0, 0, (cid:15)) Density bias. As in [33], we add a small Gaussian blob of density to the origin of the scene in order to assist with the early stages of optimization. This density takes the form σinit(μ) = λ * e−||μ||2/(2ν2) with λ = 5 and ν = 0.2. Camera. The fixed camera for reconstruction is placed at a distance of 1.8 from the origin, oriented toward the ori- gin, at an elevation of 15◦ above the horizontal plane. For a small number of scenes in which the object of interest is clearly seen from overhead, the reconstruction camera is placed at an elevation of 40◦. The camera for the prior objectives is sampled randomly at each iteration. Its distance from the origin is sampled uniformly from [1.0, 1.5]. Its azimuthal angle is sampled uniformly at random from the 360◦ around the object. Its el- evation is sampled uniformly in degree space from −10◦ to 90◦ with probability 0.5 and uniformly on the upper hemi- sphere with probability 0.5. The field of view is uniformly 12 sampled between 40 and 70. The camera is oriented toward the origin. Additionally, every tenth iteration, we place the prior camera near the reconstruction camera: its location is sampled from the prior camera's location perturbed by Gaussian noise with mean 0 and variance 1. Lighting. We sample the position of the point light by adding a noise vector η ∼ N (0, 1) to the position of the prior camera. View-Dependent Prompt. We add a view-dependent suf- fix to our text prompt based on the location of the prior cam- era relative to the reconstruction camera. If the prior camera is placed at an elevation of above 60◦, the text prompt re- ceives the suffix "overhead view." If it is at an elevation below 0◦, the text receives "bottom view." Otherwise, for azimuthal angles of ±30◦, ±30 − 90◦, or ±90 − 180◦ in either direction of the reconstruction camera, it receives the suffices "front view," "side view," or "bottom view," respec- tively. InstantNGP. Our InstantNGP parameterizes the density and albedo inside a bounding box around the origin with side length 0.75. It is a multi-resolution feature grid with 16 levels. With coarse-to-fine training, only the first 8 (lowest- resolution) levels are used during the first half of training, while the others are masked with zeros. Each feature grid has dimensionality 2. The features from these grids are stacked and fed to a 3-layer MLP with 64 hidden units. Rendering and diffusion prior. We render at resolution 96px. Since Stable Diffusion [41] is designed for images with resolution 512px, we upsample renders to 512px be- fore passing them to the Stable Diffusion latent space en- coder (i.e. the VAE). We add noise in latent space, sam- pling t ∼ U(0.02, 0.98). We use classifier-free guidance strength 100. We found that results with classifier-free guid- ance strength above 30 produced good results; below 30 led to many more geometric deformities. Although we do not backpropagate through the Stable Diffusion UNet for LSDS, we do backpropagate through the latent space encoder. Optimization. We optimize using the Adam [21] opti- mizer with learning rate 1e − 3 for 5000 iterations. The optimization process takes approximately 45 minutes on a single V100 GPU. Background model. For our background model, we use a two-layer MLP which takes the viewing direction as in- put. This model is purposefully weak, such that the model cannot trivially optimize its objectives by using the back- ground. Additional regularizers. We additionally employ two regularizers on our density field. The first is the orientation loss from Ref-NeRF [49], also used in DreamFusion [33], for which we use λorient = 0.01. The second is an entropy loss which encourages points to be either fully transparent or fully opaque: Lentropy = (w * log2(w) − (1 − w) * log2(1 − t r a n s f o r m = T . Compose ( [ T . RandomApply ( [ T . R a n d o m R o t a t i o n ( d e g r e e s =10 , T . RandomResizedCrop ( i m a g e s i z e , T . RandomApply ( [ T . C o l o r J i t t e r ( 0 . 0 4 , 0 . 0 4 , 0 . 0 4 , 0 . 0 4 ) ] , p = 0 . 7 5 ) , T . R a n d om G r a ys c a l e ( p = 0 . 1 0 ) , T . RandomApply ( [ T . G a u s s i a n B l u r ( 5 , T . R a n d o m H o r i z o n t a l F l i p ( ) , ( 0 . 1 , 2 ) ) ] , p = 0 . 1 0 ) , s c a l e = ( 0 . 7 0 , 1 . 3 ) ) , f i l l = 2 5 5 ) ] , p = 0 . 7 5 ) , ] ) Figure 12. PyTorch code for the image augmentations used for single-image textual inversion. w) where w is the cumulative sum of density weights com- puted as part of the NeRF rendering equation (Equation 1). Single-image textual inversion. Our single-image tex- tual inversion step, which is a variant of textual inver- sion [10], entails optimizing a token e introduced into the diffusion model text encode to match an input image. The key to making this optimization successful given only a sin- gle image is the use of heavy image augmentations, shown in Fig. 12. We optimize using these augmentations for a to- tal of 3000 steps using the Adam optimizer [21] with image size 512px, batch size 16, learning rate 5 * 10−4, and weight decay 1 * 10−2. The embedding e can be initialized either randomly, manually (by selecting a token from the vocabulary that matches the object), or using an automated method. One automated method that we found to be successful was to use CLIP (which is also the text encoder of the Sta- ble Diffusion model) to infer a starting token to initialize the inversion procedure. For this automated procedure, we begin by considering the set of all tokens in the CLIP text tokenizer which are nouns, according to the WordNet [8] database. We use only nouns because we aim to reconstruct objects, not reproduce styles or visual properties. We then compute text embeddings for captions of the form "An im- age of a (cid:104)token(cid:105)" using each of these tokens. Separately, we compute the image embedding for the input image. Fi- nally, we take the token whose caption is most similar to the image embedding as initialization for our textual inversion procedure. We use the manual initialization method for the exam- ples in the main paper and we use the automated initializa- tion method for the examples in the supplemental material (i.e. those included below). B. Method diagram We provide a diagram illustrating our method in Fig. 2. C. Additional Qualitative Examples In Fig. 13, we show additional examples of reconstruc- tions from our model. We see that our method is often able to reconstruct plausible geometries and object backsides. D. Additional Comparisons We provide additional comparisons to recent single-view reconstruction methods on the lego scene from the synthetic NeRF [27] dataset. We compare on the special test set cre- ated by SinNeRF [56], which consists of 60 views very close to the reference view. We emphasize that our method is not tailored to this setting, whereas the other methods are designed specifically for it. For example, some other meth- ods work by warping the input image, which only performs well for novel views close to the reference view. Table 2. Novel view synthesis comparison. A comparison of RealFusion against recent single-view reconstruction methods on the task of novel view synthesis on the synthetic lego scene from NeRF [27]. These numbers are computed on the test set rendered by SinNeRF [56], which contains 60 views very close to the ref- erence view. This is a setting highly favorable to methods that use depth supervision, such as DS-NeRF and SinNeRF . Depth? PSNR SSIM LPIPS PixelNeRF [60] DietNeRF [18] DS-NeRF [6] SinNeRF [56] RealFusion (cid:51) (cid:51) 14.3 15.0 16.6 21.0 16.5 0.72 0.72 0.77 0.82 0.76 0.22 0.20 0.16 0.09 0.25 E. Text-to-Image-to-3D In this section, we explore the idea of reconstructing a 3D object from a text prompt alone by first using the text prompt to generate an image, and then reconstructing this image using RealFusion. We show examples of text-to-image-to-3D generation in Fig. 14. Compared to the one-step procedure of [33] (i.e. text- to-3D), this two-step procedure (i.e. text-to-image-to-3D) has the advantage that it may be easier for users to control. Under our setup, users can first sample a large number of images from a 2D diffusion model such as Stable Diffusion, 13 select their desired image, and then lift it to 3D using Real- Fusion. It is possible that this setup could help help address the issue of diversity of generation discussed in [33]. Addi- tionally, tn this setting, we find that it is usually not neces- sary to use single-image textual inversion, since the images sampled in the first stage are already extremely well-aligned with their respective prompts. F. Analysis of Failure Cases In Fig. 15, we show additional examples of failure cases from our model. Below, we analyzed what we find to be our three most common failure cases. The techniques we ap- ply in RealFusion (single-image textual inversion, normals smoothing, and coarse-to-fine training) make these failure cases less frequent and less severe, but they still occur on various images. Neural fields lacking well-defined geometry. One fail- ure case of our method consists of the generation of a semi- transparent neural field which does not have a well-defined geometry. These fields tend to look like the input image when seen from the reference viewpoint, but do not resem- ble plausible objects when seen from other viewpoints. We note that this behavior is extremely common when using CLIP as a prior model, but it occurs occasionally even when using Stable Diffusion and LSDS. Floaters. Another failure case involves "floaters," or dis- connected parts of the scene which appear close to the cam- era. These floaters sometimes appear in front of the refer- ence view as to make the corresponding render look like the input image. Without image-specific prompts, these floaters are a very big issue, appearing in the majority of recon- structions. When using image-specific prompts, the issue of floaters is greatly (but not entirely) alleviated. The Janus Problem. Named after the two-faced Roman god Janus, the "Janus problem" refers to reconstructions which have two or more faces. This problem arises because the loss function tries to make the render of every view look like the input image, at least to a certain extent. Our use of view-specific prompting partially alleviates this issue. For example, when we render an image of a panda from the back, we optimize using the text prompt "An image of a (cid:104)object(cid:105), back view", where "(cid:104)object(cid:105)" is our image-specific token corresponding to the image of a panda. However, even with view-specific prompting, this problem still occurs. This problem is visible with the panda in Fig. 14 (row 2). We note that this problem is not unique to our method; it can also be seen with [33] (see Figure 9, last row). G. Unsuccessful Experiments and Regulariza- tion Losses In the process of developing our method, we exper- imented with numerous ideas, losses, and regularization terms which were not included in our final method because they either did not improve reconstruction quality or did not improve it enough to justify their complexity. Here, we describe some of these ideas for the benefit of future re- searchers working on this problem. Using DM for reconstruction loss. One idea we tried in- volved using the diffusion model within our reconstruction objective as well as our prior objective. This involved a modified version of LSDS in which we compared the noise predicted by the diffusion model for our noisy rendered im- age to the noise predicted by the diffusion model for a noisy version of our input image. We found that with this loss we were able to reconstruct the input image to a certain degree, but that we did not match the exact input image colors or textures. Normals smoothing in 3D. Our normals smoothing term operates in 2D, using normals rendered via the NeRF equa- tion. We also tried different ways of smoothing normals in 3D. However, possibly due to our grid-based radiance field and/or our finite difference-based normals computation, we found that these regularization terms were all very noisy and harmful to reconstruction quality. Using monocular depth. We tried incorporating monoc- ular depth predictions into the pipeline, using pre-trained monocular depth networks such as MiDaS [37]. Specifi- cally, we enforced that the depth rendered from the refer- ence view matched the depth predicted by MiDaS for the in- put image. We found that this additional depth loss in most instances did not noticeably improve reconstruction quality and in some cases was harmful. Nonetheless, these results are not conclusive and future work could pursue other ways of integrating these components. Using LPIPS and SSIM reconstruction losses. We tried using LPIPS [61] and SSIM losses in place of our L2 recon- struction loss. We found that LPIPS performed similarly to L2, but incurred additional computation and memory usage. We found that SSIM without either L2 and LPIPS resulted in worse reconstruction quality, but that it yielded fine re- sults when combined with them. We did not include it in our final objective for the sake of simplicity. Rendering at higher resolutions. Since Stable Diffusion operates on images of resolution 512px, it is conceivable that rendering at higher resolution would be benefitial with regard to the prior loss. However, we found no noticeable difference in quality when rendering at higher resolutions than 96px or 128px. For computational purposes, we used resolution 96px for all experiments in the main paper. 14 Using DINO-based prior losses. Similarly to the CLIP prior loss, one could imagine using other networks to en- courage renders from novel views to be semantically sim- ilar to the input image. Due to the widespread success of the DINO [2] models in unsupervised learning, we tried using DINO feature losses in addition to the Stable Diffu- sion prior loss. Specifically, for each image rendered from a novel view, we computed a DINO image embedding and maximized its cosine similarity with the DINO image em- bedding of the reference image. We found that this did not noticeably improve or degrade performance. For purposes of simplicity, we did not include it. H. Links to Images for Qualitative Results For our qualitative results, we primarily use images from datasets such as Co3D. We also use a small number of im- ages sourced directly from the web to show that our method works on uncurated web data. We provide links to all of these images on our project website. 15 Figure 13. Additional qualitative examples. This figure presents additional qualitative examples from our model. The first column shows the input image. The second column shows the reconstruction from the reference viewpoint. The following columns show renders from novel viewpoints, demonstrating that our model is able to reconstruct plausible object shapes. 16 Figure 14. Text-to-Image-to-3D. This figure presents examples from our model using images generated directly from text prompts using Stable Diffusion [41]. The images were generated with the prompt "An image of a " where the blank space is replaced by "deer", "flamingo", "hen", "pencil drawing of a horse", "squirrel", "dolphin", and "unicorn", respectively. The results demonstrate that our method is able to reconstruct plausible object shapes even from synthetic images. 17 Figure 15. Additional failure cases. This figure presents additional failure cases from our model. The first column shows the input image. The second column shows the reconstruction from the reference viewpoint. The following columns show renders from novel viewpoints, which make clear why these examples are failure cases. Note that some examples (for example, the panda bear in the second row and the hamster in the last row) suffer from the Janus problem. 18 Figure 16. A visualization of the effect of single-image textual inversion on reconstruction quality. An expanded version of Figure 7 in the main paper showing the effect of single-image textual inversion on reconstruction quality. The top row in each pair of rows shows reconstruction results using a standard text prompt, whereas the bottom row shows reconstruction results using single-image textual inversion. The novel views are chosen to show the back side of the object; note how the examples without textual inversion look like highly-generic versions of the objects in the input image. 19 Figure 17. An example of variation across random seeds for a challenging input image. As described in the main paper, our model is able to generate multiple reconstructions for a given input image. For this figure, we apply our method (in a text-to-image-to-3D manner) to a highly challenging image produced by Stable Diffusion from the text prompt "An image of an astronaut riding a horse." We run reconstruction using two different seeds: one of these (top) yields a reasonable shape, whereas the other is a failure case that does not yield a reasonable shape. This example both highlights the ability of our method to reconstruct highly challenging shapes and also demonstrates how future work could aim to improve reconstruction consistency and quality. 20
http://arxiv.org/abs/2302.10655v1
2023-02-21T13:12:57
2023-02-21T13:12:57
Density Ratio Estimation and Neyman Pearson Classification with Missing Data
Density Ratio Estimation (DRE) is an important machine learning technique with many downstream applications. We consider the challenge of DRE with missing not at random (MNAR) data. In this setting, we show that using standard DRE methods leads to biased results while our proposal (M-KLIEP), an adaptation of the popular DRE procedure KLIEP, restores consistency. Moreover, we provide finite sample estimation error bounds for M-KLIEP, which demonstrate minimax optimality with respect to both sample size and worst-case missingness. We then adapt an important downstream application of DRE, Neyman-Pearson (NP) classification, to this MNAR setting. Our procedure both controls Type I error and achieves high power, with high probability. Finally, we demonstrate promising empirical performance both synthetic data and real-world data with simulated missingness.
[ "Josh Givens", "Song Liu", "Henry W J Reeve" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10655v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10655v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "stat.ML", "@scheme": "http://arxiv.org/schemas/atom" }
[ "stat.ML", "cs.LG", "stat.ME" ]
3 2 0 2 b e F 1 2 ] L M . t a t s [ 1 v 5 5 6 0 1 . 2 0 3 2 : v i X r a Density Ratio Estimation and Neyman Pearson Classification with Missing Data Josh Givens Song Liu University of Bristol Henry W J Reeve Abstract Density Ratio Estimation (DRE) is an important machine learning technique with many downstream applications. We consider the challenge of DRE with missing not at random (MNAR) data. In this setting, we show that using standard DRE methods leads to biased results while our proposal (M-KLIEP), an adaptation of the popular DRE procedure KLIEP, restores consistency. Moreover, we provide finite sample estimation error bounds for M-KLIEP, which demonstrate minimax optimality with respect to both sample size and worst-case missingness. We then adapt an important downstream application of DRE, Neyman-Pearson (NP) classification, to this MNAR setting. Our procedure both controls Type I error and achieves high power, with high probability. Finally, we demonstrate promising empirical performance both synthetic data and real-world data with simulated missingness. 1 INTRODUCTION Density Ratio estimation (DRE) is the problem of estimating the ratio between two probability density functions (PDFs). DRE's ability to characterise the relationship between two PDFs naturally lends itself to many appli- cations such as outlier detection (Azmandian et al., 2012), Generative Adversarial Networks (GANs) (Nowozin et al., 2016), and general binary classification. One issue with DRE is that it is especially sensitive to missing data due to the large impact a "few key points" can have on the procedure (Liu et al., 2017). While there are a vast number of DRE approaches (Sugiyama et al., 2008, 2010; Kanamori et al., 2009; Choi et al., 2021), none of them explicitly account for the case of missing data. Some work has been done regarding the impact of missing data on DRE (Josse et al., 2019), and while this work does explore a wide variety of missing data methods it does so while assuming the data to be missing at random (MAR). There are many applications in which such an assumption is unrealistic and the probability of an observation being missing depends in some way on the value of the observation itself leading to missing not at random data (MNAR). For example, many measuring instruments are more likely to err when attempting to measure more extreme values, while in questionnaires, participants are less likely to answer a question if they deem their answer to be embarrassing or unfavourable. In such a case, naively applying any classic DRE procedure leads to inconsistent estimations. Classification is an area of statistic with strong ties to density ratio estimation and is also an area where missing covariates are a common issue. In this paper, we focus on the links of DRE to a particular type of classification problem called Neyman Pearson (NP) classification. NP classification allows the user to construct a classifier with a fixed Type I error rate with high probability (Tong, 2013; Tong et al., 2018). This type of classification has many natural applications as there are often cases where missclassification in one direction is far more damaging than in the other (for example, disease diagnosis or fault detection). We would like to choose our classifier to control the error in said direction. Taking missing data into consideration during NP classification is vital. Without it, our classifier may no longer satisfy our Type I error constraint with high probability. Classic NP classification works in two steps. First, we estimate the class density ratio between the two classes (hence motivating the use of DRE), then we define the classification boundary of our classifier to be a level set of our density ratio estimate, which leads to the satisfaction of our Type I error constraint with high probability (Tong, 2013). To our knowledge, no previous work has been done to make this second stage of NP classification robust to MNAR data. There is a large body of research into the phenomenon of MNAR data in more general cases (Sportisse et al., 2020; Liu and De, 2015; Li et al., 2013; Seaman and White, 2011), however none of this work has explored its use 1 within DRE specifically. Work exists on MNAR data in the covariates of logistic regression (Ward et al., 2020), a classification method with close ties to DRE. However, Ward et al.'s approach requires more direct knowledge of the missing data distribution rather than just the probability of an observation being missing conditional on its value. Our main contributions are: • We adapt KLIEP (Sugiyama et al., 2008), a classic DRE procedure, to the MNAR setting using an inverse probability weighting approach before expanding this technique to any DRE whose objectives comprise expectations of two different data sets. We give finite sample convergence results for our method and show minimax rate optimality of this convergence when the conditional probability of being missing is known. • We provide an adaptation to the NP classification procedure, allowing it to control Type I error even with MNAR data and show finite sample power convergence results for our adaptation when the conditional probability of being missing is known. We also provide extensions to our DRE approaches, which allow us to deal with both partial missingness across multiple dimensions and learning the missing pattern by querying a subset of the missing samples. Finally, we assess and compare the efficacy of our proposed methods by testing them on various simulated and real-world data with synthetic missingness. 2 MISSING DATA & DENSITY RATIO ESTIMATION 2.1 Motivation Density Ratio Estimation (DRE) is a versatile tool with many downstream applications such as binary classifica- tion (including NP classification, which we will discuss in Section 3.4), GANs (Nowozin et al., 2016; Ding et al., 2020), and covariate shift (Sugiyama et al., 2008; Tsuboi et al., 2009). In DRE problems, we want to estimate r∗ := p1/p0, with p1, p0 the PDFs for two distributions. DRE approaches estimate r∗ using IID samples from these two distributions. Existing DRE approaches are designed to handle fully observed data sets. However, when observations are missing, these approaches do not apply straightforwardly. DRE requires two sets of observations. When two samples are collected at different times under different contexts, they are especially susceptible to different missing patterns. An example is binary classification for diagnosing an illness. In this setting, it is natural to expect that samples collected from healthy individuals and patients will have different MNAR patterns due to privacy concerns. Within this setting, using both data sets by simply discarding all missing values will lead to a biased classification and degraded performance. We aim to make DRE robust to Missing Not at Random (MNAR) datasets. In this setting, an observation's probability of being missing depends upon that observation's true value and the MNAR pattern is different between two samples. We formally introduce our problem set-up below. 2.2 Missing Data Framework Let Z 1, Z 0 be two RVs taking values in measurable space (Z, BZ ) with densities (Radon Nikodym derivatives) p1 and p0 respectively w.r.t. (with respect to) a measure μ on (Z, BZ ) and assume that p0 is strictly positive. For ω ∈ {0, 1}, let X ω be a RV taking values in the measurable space (X , BX ) with X := Z ∪ {∅}, BX := σ(BZ ∪ {{∅}}) whose distribution is uniquely defined as follows: P(X ω = ∅|Z ω) := φω(Z) P(X ω = x|Z ω) := 1{Z ω = x}(1 − φω(Z ω)), where φω : Z → [0, 1) is a measurable function. Here we take X = ∅ to represent the observation being missing and thus φ(z) represents the probability of an observation being missing given its "true" value is z. Additionally, ω be the density of X ω|X ω (cid:54)= ∅ w.r.t μ. Throughout, unless stated otherwise, we assume φ to be known. let p(cid:48) For ω ∈ {0, 1} and nω ∈ N we define {Z ω i=1 to be IID copies of Z ω, X ω respectively and abbreviate them by Dω := {Z ω i=1. Finally we define, D := (D1, D0), D(cid:48) := (D(cid:48) i=1 and {X ω i }nω i }nω ω := {X ω i=1, D(cid:48) i }nω i }nω 1, D(cid:48) 0). 2 2.3 Notations Throughout we shall adopt the following two conventions for the purpose of brevity. Firstly, if X, Z, or any other class-specific element is given without a sub/superscript specifying the class, the associated statement is assumed to hold for both classes where all the elements within the statement have the same class. Secondly, given a function h : Z → R we implicitly extend h to a function h : X → R by taking h(∅) := 0, unless stated otherwise. We now introduce some additional notation. For n ∈ N we let [n] := {1, . . . , n}. For a function h : Z → R we take (cid:107)h(cid:107)∞:= supz∈Z |h(z)|. Finally, for a RV W in a product space W d and any j ∈ [d] define W (j) to be the jth coordinate of W and W (−j) = {W (j(cid:48))}j(cid:48)(cid:54)=j. The Kullback-Leibler (KL) between two density functions with p1 absolutely continuous w.r.t. p0 is defined as KL(p1|p0) := (cid:90) Z p1(z) log p1(z) p0(z) μ(dz). 2.4 DRE The aim of DRE is to estimate r∗ : Z → [0, ∞) defined by r∗ := p1/p0. We will let H be the set of non-negative measurable functions from Z to [0, ∞) and let G be some subset of H which we intend to use in our approximation of r∗. Note that while r∗ ∈ H, G may or may not contain the "true" density ratio r∗. We say that G is correctly specified if r∗ ∈ G and incorrectly specified otherwise. We now introduce a classic approach for estimating r∗ using D. 2.4.1 Kullback-Leibler Importance Estimation Procedure First proposed in (Sugiyama et al., 2008), Kullback-Leibler Importance Estimation Procedure (KLIEP) is a popular DRE procedure that minimises the KL divergence between p1 and r * p0. Specifically, it aims to solve the following optimisation problem: ̃r := arg min r∈G subject to : KL(p1|r * p0) (cid:90) r(z)p0(z)μ(dz) = 1. Z (1) As KL-divergence is strictly for use with probability densities, we need to include the additional constraint that r * p0 integrates out to 1 over Z. Provided G is closed under positive scalar multiplication, we can re-write ̃r in terms of an unconstrained opti- misation problem. Specifically, we have ̃r := N −1 * r0 where r0 := argmax r∈ ̄G E[log r(Z 1)] − log E[r(Z 0)] N := E[r0(Z 0)]. (2) for some select ̄G ⊆ G = {a * g : a ∈ (0, ∞), g ∈ ̄G}. More details on this alongside the lemma that makes this possible can be found in the Appendix A.1. Throughout we will be mostly interested in estimating r0 and as such will refer to 2 as the population KLIEP objective. As we do not know the true distributions of Z 1, Z 0, we must approximate these expectations with samples from corresponding distributions giving us the sample KLIEP objective. In the case of multi-dimensional real-valued data, Z = Rp, we can take ̄G = {rθ : Rp → [0, ∞)|θ ∈ Rd} where rθ(z) := exp(θ(cid:62)f (z)) for some f : Rp → Rd (Tsuboi et al., 2009; Kanamori et al., 2010; Liu et al., 2017). We refer to this form as the log-linear form. Under this form, our solution becomes ˆr = ˆN −1rˆθ where (3) 1 n1 n1(cid:88) i=1 θ(cid:62)f (Z 1 i ) − log 1 n0 n0(cid:88) i=1 exp(θ(cid:62)f (Z 0 i )) (4) ˆθ :=argmax θ∈Rd n0(cid:88) i=1 1 n0 ˆN := exp(θ(cid:62)f (Z 0 i )) 3 which gives us a convex optimisation problem. We now define ̃θ as the minimiser of the population KLIEP objective under our log-linear model (i.e. the population analogue of (4)) allowing us to view ˆθ as an estimator for ̃θ. Indeed, with some mild restrictions on f and for nmin := min{n0, n1} ≥ C0 log(1/δ), we have that w.p. 1 − δ (cid:107)ˆθ − ̃θ(cid:107)≤ (cid:115) C0 log(1/δ) nmin (5) where C0 is a constant depending on f (Z0), f (Z1), ̃θ, d. Details of this result are found in Appendix A.2. An additional bound for the accuracy of ˆN is given in the Appendix section A.2.1. However, as we will see in applications such as NP classification, we only require the knowledge of r∗ up to strictly increasing transform and so it is often unnecessary to estimate N . Within this paper, we mostly focus on KLIEP however for completeness we also present the general class of f -Divergence based density ratio estimators and describe some notable cases in Appendix B.1. We now go on to adapt this procedure for use with MNAR data. 3 PROPOSED METHODS In our setting we do not observe samples from Z and so cannot use (4) to approximate the population KLIEP objective. Instead, we only have samples from X. The following result relates expectations of Z with expectations of X. Lemma 1. We have that p(cid:48) = C * (1 − φ) * p, for some C ∈ R. Hence, for any measurable function g : Z → R E[g(Z)] = E (cid:20) 1{X (cid:54)= ∅} 1 − φ(X) (cid:21) g(X) . (6) For proof of this Lemma see Appendix A.3). This importance weighting technique is an approach that is already used to tackle MNAR data contexts outside of DRE (Li et al., 2013; Seaman and White, 2011). From this Lemma, we get that for some C (cid:48) ∈ R, r(cid:48) := p(cid:48) 1 p(cid:48) 0 = C (cid:48) * 1 − φ1 1 − φ0 * r∗ Consequently, r(cid:48) is not proportional to r∗ when φ1 (cid:54)= φ0 with either non-constant. As a result, using KLIEP with only the observed values of our MNAR data will be biased due to the fact it estimates r(cid:48) rather than r∗. We now use this Lemma to inform our adapted estimation procedures. 3.1 KLIEP with Missing Data We can now approximate the population KLIEP objective by replacing expectations in (2) with the important weighted expectations in Lemma 1. This replacement modifies the sample KLIEP objective to work with D(cid:48) as follows: n1(cid:88) 1 n1 i (cid:54)= ∅} 1{X 1 1 − φ1(X 1 i ) log r(X 1 i ) − log 1 n0 n0(cid:88) i=1 i (cid:54)= ∅} 1{X 0 1 − φ0(X 0 i ) r(X 0 i ) (7) ˆr0 :=argmax r∈ ̄G ˆN := 1 n0 n (cid:88) i=1 i=1 i (cid:54)= ∅} 1{X 0 1 − φ0(X 0 i ) ˆr0(X 0 i ) . We refer to this approach as M-KLIEP and to (7) as the sample M-KLIEP objective. We now take, ˆθ(cid:48) to be the estimated parameter when r takes the log-linear form (3). To show the efficacy of M-KLIEP, we prove that ˆθ(cid:48), converges to ̃θ under mild conditions. Let meff ≡ meff (n0, n1, φ0, φ1) denote the effective sample size defined by meff := min{n0 * (1 − (cid:107)φ0(cid:107)∞), n1 * (1 − (cid:107)φ1(cid:107)∞)}. 4 Theorem 2. Let ˆθ(cid:48) be defined as above. Assume that (cid:107)f (cid:107)∞≤ ∞ and σmin := Var(f (Z 0)) > 0. Then, there 0 ≥ 1, depending only on (cid:107)f (cid:107)∞, σmin, (cid:107) ̃θ(cid:107), and d, such that for any δ ∈ (0, 1/2] and exists some constant C (cid:48) meff (n0, n1, φ0, φ1) > C (cid:48) 0 * log(1/δ) we have (cid:32) (cid:115) P (cid:107)ˆθ − ̃θ(cid:107)> C (cid:48) 0 log(1/δ) meff (n0, n1, φ0, φ1) (cid:33) ≤ δ. Proof is given in Appendix A.4. This result shows that M-KLIEP, unlike applying KLIEP on only observed values, does not suffer from the inconsistent ratio estimation problem we mentioned earlier. The following result shows that this bound is minimax optimal w.r.t meff . Theorem 3. Given any estimator ˆθ ≡ ˆθ(D(cid:48)) of ̃θ, and any (w0, w1) ∈ [0, 1]2, (n0, n1) ∈ N2 and δ ∈ (0, 1/4] there exists distributions P0, P1 on X which satisfies the conditions of Theorem 2, with (cid:107)φω(cid:107)∞≤ wω such that if D(cid:48) for ω ∈ {0, 1} then ω ∼ P nω ω (cid:32) P (cid:107)ˆθ − θ(cid:107)> (cid:115) 1 2 ∧ 10 log(1/(4δ)) meff (n0, n1, φ0, φ1) (cid:33) ≥ δ. 3.2 General Extension While we have described the adaptation for KLIEP, this approach can be applied to any expectation-based DRE procedure with the following form: argmin r∈G h(E[g1(Z 1)], E[g0(Z 0)]) where h : Rd0 × Rd1 → R, gω : Z → Rdω . We can then approximate these expectations using Lemma 1 as we did for KLIEP. An example of this with f -Divergence based DRE is given in the Appendix section B.1.1. 3.3 Extensions to Partial Missingness across Multiple Dimensions We now extend our approaches to the case of partial missingness in multi-dimensional settings. Throughout this section let d ∈ N and replace our original space Z for Z d (and similarly X with X d). We start off with the assumption on our data missingness structure that for all j ∈ [d], P(X (j) = ∅|Z, X (−j)) = φj(Z (j)) P(X (j) = x(j)|Z, X (−j)) = 1{Z (j) = x(j)}(1 − φj(Z (j))) As such, the components are missing independently from one another with probabilities only depending on their own true value. To further simplify proceedings, we assume a naive Bayes style condition. Namely we include the restriction that for all j(cid:48) (cid:54)= j, Z (j(cid:48)) ⊥⊥ Z (j) so that (Z (j), X (j)) ⊥ (Z (j(cid:48)), X (j(cid:48))). This implies that r∗ := d (cid:89) j=1 r∗ j where r∗ j := p(j) 1 p(j) 0 with p(j) be the p.d.f. of Z (j). This allows us to separately estimate the density ratio over each dimension and then take the product to get the joint density ratio (DR). Within each dimension, only data from that dimension is relevant (due to the aforementioned independence) and so we can estimate the density ratio on each dimension using exclusively the data from that dimension with our current methods. 3.4 NP Classification with Missing data We now apply our adapted procedures to the problem of NP classification. First, we introduce NP classification. 5 NP classification constructs a classifier that strictly controls the miss-classification of one class while minimising miss-classification in the other (Cannon et al., 2002; Scott and Nowak, 2005; Tong, 2013; Tong et al., 2018). Specifically, in NP classification we aim to learn a classifier φ : Z → {0, 1} which solves the following constrained optimisation problem P(φ(Z 1) = 0) min φ subject to: P(φ(Z 0) = 1) ≤ α. (8) We refer to the classifier which solves the above problem as the NP oracle classifier at level α and refer to class 0 as the error controlled class. From the Neyman-Pearson lemma, it can be shown that the classification boundary of the oracle classifier is a level set of r∗ (Tong, 2013). This motivates the use of DRE to approximate r∗ and in turn the oracle classifier. In contrast to hypothesis testing, we do not know the distribution of Z 0. As such, there is no means of constructing a classifier that is guaranteed to satisfy (8). Instead, we create a classifier ˆφD from our data D. This classifier has a small pre-specified probability of violating our Type I error constraint. In other words for a given small δ > 0, and classification procedure ˆφD, (cid:18) P (cid:12) (cid:16) ˆφD(Z 0) = 1 P (cid:12) (cid:12)D (cid:17) (cid:19) ≤ α ≥ 1 − δ. (9) A procedure satisfying (9) is described in Tong et al. (2018). This procedure uses any density ratio estimate alongside additional data from the error-controlled class to choose a classification threshold. The estimated density ratio alongside the threshold is used for classification. As a result, different DRE approaches lead to different NP classification procedures. More information on the details of this classification procedure can be found in Appendix B.2. As we know the optimal classifier comes from the true density ratio, we can assess the accuracy of various DRE procedures by the efficacy of the associated NP classification procedure. We asses the efficacy of an NP classification procedure ˆφD by the expected power which is defined as (cid:20) E (cid:12) (cid:16) ˆφD(Z 1) = 1 P (cid:12) (cid:12)D (cid:17)(cid:21) = P( ˆφD(Z 1) = 1). We can also assess the efficacy of a classifier by it's Type II error which we define to be R1(φ) := P(φ(Z 0) = 1). 3.4.1 Adapting NP Classification to Missing Data Current NP classification approaches require direct samples from Z 0 in order to select the appropriate classifi- cation threshold. Therefore, we will need to adapt it for the MNAR setting. We can again use Lemma 1 to approximate P(ˆr(Z 0) > C) using D(cid:48) Specifically, if for any h : Z → R we define 0 and choose a threshold based on this. W (C,h) i := i (cid:54)= ∅} 1{X 0 1 − φ0(X 0 i ) 1{h(X 0 i ) > C} ] = P(h(Z 0) > C). We also introduce the effective sample size for class 0 defined by m0 then E[W (C,h) eff := n0(1 − (cid:107)φ0(cid:107)∞). We now use this result to prove the key lemma that informs our adaptation to the threshold selection within our NP classification algorithm. i Lemma 4. For a given measurable h : Z → R let's choose 1 n (cid:88) i∈[n] W (C,h) i ≤ α − ∆m0 eff ,δ    ˆCα,δ,h ≡ ˆCα,δ,h(D(cid:48) 0)   := inf C ∈ R :  (cid:115) where ∆m0 eff ,δ := 16 log(1/δ) m0 eff . 6 Then, for any δ ∈ (0, 1/2], (cid:20) P(h(Z 0) > ˆCα,δ,h | D(cid:48)) > α P (cid:21) ≤ δ. Proof. Fix C ∗ of C we have that P(h(Z 0) > C ∗ α,h) ≤ α. Hence, α,h := inf (cid:8)C ∈ R : P(h(Z 0) > C) ≤ α(cid:9). As P(h(Z 0) > C) is a decreasing right continuous function (cid:104) P P(h(Z 0) > ˆCα,δ,h | D(cid:48) 0) > α (cid:105) = P( ˆCα,δ,h < C ∗ α,h)   1 n ≤ P (cid:88) α,h) (C∗ i W i∈[n]  ≤ α − ∆m0 eff ,δ  ≤ δ, where we used Lemma 11 from Appendix A.4 in the final step. Therefore this gives rise to the following NP classification Algorithm 1. We will assume that we have access to an additional n0 IID copies of X0 which we will label as X 0 however this is just for notational convenience and the algorithm and associated theory adapts to any number of samples from X0. We now let g : R → R be any strictly increasing function. n0+1, . . . , X 0 2n0 Algorithm 1 Missing NP Classification Procedure i }n0 1: Use {X 1 2: For i ∈ {1, . . . , n0} compute ˆri := g ◦ ˆr(X 0 i=1, {X 0 i }n1 i=1 to estimate g ◦ r∗ with g ◦ ˆr by any DRE procedure. ) and wi := 1{X 0 i+n0 i+n0 ∈ Z}(1 − φ0(X 0 ))−1 with g ◦ ˆr(∅) := i+n0 −∞. 3: Sort ˆr1, . . . , ˆrn0 in increasing order to get ˆr(1), . . . , ˆr(n0) with ˆr(i) ≤ ˆr(i+1) and associated w(1), . . . , w(n0). 4: Set i∗ = min{i ∈ {1, . . . , n0}| 1 n0 j=i w(j) ≤ α − ∆m0 eff ,δ}. (cid:80)n0 5: Let ˆCα,δ,g◦ˆr(D(cid:48)) := ˆr(i∗) and define ˆφD(cid:48) by ˆφD(cid:48)(z) := 1{g ◦ ˆr(z) > ˆCα,δ,g◦ˆr} for all z ∈ Z. We can freely introduce g within Algorithm 1 as the classifier produced is invariant to strictly increasing trans- formations. Crucially we can do this without knowing g specifically and are only required to know g ◦ ˆr. This added flexibility has many advantages, for example, we are now only required to learn r∗ up to a multiplicative constant. We now analyse the performance of Algorithm 1 in conjunction with M-KLIEP. To this end, define ˆφD(cid:48) as in Algorithm 1 with ˆr = rˆθ(cid:48) as defined in Theorem 2. We now compare this with its population analogue ̃φ defined by for all z ∈ Z, where C ∗ ̃φ(z) := 1{g ◦ r ̃θ(z) > C ∗ α,h is defined as in the proof of Lemma 4. } α,g◦r ̃θ Theorem 5. Assume the conditions of Theorem 2 hold and let ˆφD(cid:48), ̃φ be defined as above. Further assume that for all θ ∈ Rd, z ∈ Z, (cid:107)∇θg ◦ rθ(z)(cid:107)≤ L. Finally, suppose there exists positive constants B0, B1, γ0, γ1, a s.t. h satisfies the following conditions (cid:18) P h(Z 0) ∈ [C ∗ α,h, C ∗ α,h + ζ] (cid:19) (cid:18) P h(Z 0) ∈ [C ∗ α,h − ζ, C ∗ α,h + ζ] (cid:19) ≥ B−1 0 ζ γ0 ≤ B1ζ γ1 , 7 for all ζ ∈ (0, B0a1/γ0]. Then there exists a constant C2 > 0 depending only on C (cid:48) that for all δ ∈ (0, 1 2 ], with meff ≥ C2 log(1/δ), we have 0, B0, B1, γ0, γ1, a, and L such where P(|R1( ˆφD(cid:48)) − R1( ̃φ)|> ε(cid:48)) ≤ 2δ. ε(cid:48) := C2 (cid:34)(cid:18) log(1/δ) m0 eff (cid:19) γ1+1 2γ0 ∧ 1 2 + (cid:18) log(1/δ) meff (cid:19) γ1+1 2 (cid:35) . Remark 1. If G is correctly specified and Z 1, Z 0 are continuous then the NP lemma gives us that ̃φ is the oracle classifier (Tong, 2013). Hence we have shown convergence in Type II error to the oracle classifier in this case. Remark 2. Taking g = log gives L = b under the constraints imposed in Theorem 2. We have now fully adapted NP classification to the MNAR setting. Namely, we have proposed an algorithm to construct an NP classifier using MNAR data and shown this classifier simultaneously control Type I error with high probability while also converging to the oracle classifier when G is correctly specified. We test our adaptations on some synthetic examples. 4 SYNTHETIC DATA EXAMPLES Here we empirically evaluate our proposed methods alongside CC-KLIEP (naive Complete Case KLIEP) which simply discards any missing value in the dataset and estimating the ratio using only observed data. Both M- KLIEP and CC-KLIEP are tested on simulated datasets. Details on the data generating processes can be found in Appendix C. 4.1 5-dimensional Correctly Specified Example In this example we take both classes to have multivariate Gaussian distributions with the same variance. We then induced MNAR missingness in class 0 and no missingness in class 1. We use the log-linear form for rθ with f (z) = z so that G is correctly specified. 100 simulations of the above data generation procedure were run for n0 = n1 with n0 ranging from 100 to 1, 500 and ̃θ estimated by M-KLIEP and CC-KLIEP. These simulations were then used to estimate the mean square (Euclidean) distance (MSD) between our estimate, ˆθ(cid:48), and ̃θ for both procedures. These estimates alongside 99% C.I.s (confidence intervals) were calculated which are presented in Figure 1. In the plot we can see clear evidence of the complete case approach being asymptotically biased as Figure 1: MSD between ˆθ(cid:48) and ̃θ for varying n with 99% C.I.s. the error plateaus around 0.08 while the error under M-KLIEP converges to 0 as n0, n1 increase. We now go on to illustrate the affect of our DRE procedure on NP classification. 8 200400600800100012001400Sample Size0.000.050.100.150.200.250.300.35Mean Square Distance (MSD)DRE ProcedureM-KLIEPCC-KLIEP 4.2 Neyman Pearson Classification For this example we take both classes to be 2-dimensional Gaussian mixtures. We then induce MNAR missingness in class 0 and no missingness in class 1. M-KLIEP and CC-KLIEP are then used to estimate r∗ using the log- linear form with f (x) = x again. NP classifiers were then fit using these estimators alongside the true r∗. Figure 2: Scatter plot of D alongside classification boundaries produced from corresponding D(cid:48) via various procedures. If Xi = ∅ then Zi is faded out. Figure 2 shows one run of this experiment with n0 = n1 = 500. We see that M-KLIEP provides a good approximation to the classifier that uses r∗ despite the model being incorrectly specified while CC-KLIEP is biased due to the way it discards corrupted points. Repeated Simulations We now run 100 simulations of the above experiment for various n1 = n0 ranging from 100 to 1500. We then use these to estimate the expected power of the procedures alongside 99% C.I.s . Figure 3 shows the results of this experiment. We see similar results to our correctly specified DRE experiment with the complete case approach performing poorly. As we can see, despite our model not being able to encompass the true density ratio, our estimate density ratio via M-KLIEP still gives a reasonable approximation to r∗ and therefore gives a good NP classification procedure. Due to G being incorrectly specified, M-KLIEP never converges to the expected power using the true DR. Additional synthetic experiments are given in Appendix D Figure 3: Expected Power for varying n with 99% C.I.s 9 −4−20246x(1)−4−202468x(2)Class 1Class 0: 1 - nClass 0: n+1 - 2nDRE ProcedureTrue DRM-KLIEPCC-KLIEP200400600800100012001400Sample Size0.2000.2250.2500.2750.3000.3250.3500.375Expected powerDRE ProcedureTrue DRM-KLIEPCC-KLIEP 5 REAL-WORLD DATASETS WITH SIMULATED MISSING- NESS We now go on to perform NP classification experiments with real-world data. To make this scenario more realistic we will assume the φ to be unknown and aim to estimate them. We briefly tackle how to do this in the section below. 5.1 Learning the Missingness Function Thus far we have assumed φ is known. We now consider the challenge of learning φ by querying the latent values Zi for a subset of our missing data. Here we are motivated by settings in which we can send a small sub-sample of observations which erred (i.e. a subset of {i ∈ [n] : Xi = ∅}) off for further investigation to obtain their respective true values Zi. Now we can learn the missingness function φ by fitting a logistic regression with samples of (Zi, 1{Xi = ∅}) and treating 1{Xi = ∅} as the response variable. As we have not observed Zi for every i ∈ [n], we cannot use a standard logistic regression to learn φ. However, we can use an adaption of logistic regression designed to deal with miss-representative class proportions presented in King and Zeng (2001). More details on this can be found in the Appendix in section B.3. We now try our methods on real-world data to assess their efficacy. 5.2 Set-Up We choose datasets and classification problems where the NP classification is properly motivated: One would want to strictly control miss-classification for one class in these datasets. We have chosen 3 datasets which we refer to as "Fire", "CTG", and "weather"; • CTG dataset: This data set contains 11 different summaries of Cardiotocography (CTG) data for 2126 foetuses where we take each foetus to be an observation. Alongside this is a classification of each foetus as "Healthy", "Suspect", or "Pathologic". We aim to predict whether the foetus is classified as "Healthy" or not. We take the error controlled class to be "Suspect" or "Pathologic". • Fire dataset: This data set contains 62,630 readings of 12 atmospheric measures such as temperature, humidity, and CO2 content. We aim to predict whether a fire is present. We take the presence of fire as the error controlled class. • Weather data: This data set contains 142,193 observations of 62 dimensions giving various weather readings for a given day in a given location in Australia and whether it rained the following day. We aim to predict whether it rains the following day. We take the occurrence of rain as the error controlled class. In all cases, we artificially induce missing observations separately across each dimension and only in the non error-controlled class. We construct each dimension-wise missing function φj, j ∈ [d] as φj(z) = (1+exp{τj(aj,0+ aj,1z)}) where aj,0, aj,1 ∈ [0, ∞) and τj ∈ {−1, 1}. We constructed NP classifiers using M-KLIEP and CC-KLIEP under our naive Bayes framework introduced in Section 3.3. For M-KLIEP we test both cases where φj is known and φj is learned. Estimating φj is done using the method described in Section 5.1 and each φj is estimated separately using only data from that dimension. We also estimate the density ratio using the fully observed data via standard KLIEP as a benchmark. The power of the NP classifiers produced with these DRE procedures was then calculated on fully observed testing data. We repeat this process multiple times with new random test/train splits and τj at each iteration to estimate the pseudo expected power and corresponding 95% C.I.s. We apply this technique at different target Type I errors and varying aj,0 to construct datasets with different missing proportions. Additional detail is given in Appendix E.2. 5.3 Results In Figure 4 we see that in both the Fire and Weather data, M-KLIEP significantly outperforms CC-KLIEP for all values of α. For the CTG data we see significant out-performance for α ∈ [0.1, 0.25] and comparable 10 (a) CTG Dataset. (b) Fire Dataset. (c) Weather Dataset. Figure 4: Out of sample power with pseudo 95% C.I.s for various different target Type I errors. (a) CTG Dataset. (b) Fire Dataset. (c) Weather Dataset Figure 5: Out of sample power with pseudo 95% C.I.s for various φ with varying missing proportions. performance in the extremes. Surprisingly, we see that M-KLIEP performs equally well when φ is either learned or known. Further, M-KLIEP perform comparably with KLIEP run on fully observed datasets. In Figure 5 we see that M-KLIEP outperforms CC-KLIEP for larger missingness proportions. As we would expect, the more missing points, the worse CC-KLIEP performs. For the Fire and CTG data we see no loss in performance when learning φ. For the Weather data, an increase in the missing proportion leads to a decrease in performance of M-KLIEP using a learned φ. Remarkably, there is no performance loss when running M-KLIEP using the true φ in all datasets. Results from additional experiments comparing with an iterative imputation approach are given in Appendix section E.3.1. 6 DISCUSSION & CONCLUSIONS DRE is a widely used machine learning technique with a diverse range of applications. In this paper we have shown that, when data is MNAR, naively performing DRE by discarding all missing observations can lead to inaccurate estimates of the density ratio functions. We have proposed a novel procedure M-KLIEP as well as adaptations to a broad family of DRE procedures to account for the MNAR phenomenon when the missingness structure is known. For M-KLIEP we have presented finite sample bounds under a commonly used parametric form showing convergence at rate meff where meff is the effective sample size. We have then extended these approaches in multiple ways to partial missingness across multiple dimensions under the naive Bayes framework. Finally, we have presented a technique to estimate missing patterns from data by querying the true values of a few missing observations. √ We then studied a downstream application of DRE in NP classification. We have adapted NP classification to MNAR data settings and shown that our adaptation ensures satisfaction of our Type I error constraints with high probability. We have also provided finite sample convergence results for the expected power of our NP classification procedure and hence shown that it converges to the optimal power under certain conditions. 11 0.050.100.150.200.250.30Fixed Type 1 Error0.550.600.650.700.750.800.85Out of Sample PowerKLIEP (full dataset)M-KLIEP (known φj)M-KLIEP (estimated φj)CC-KLIEP0.050.100.150.200.250.30Fixed Type 1 Error0.30.40.50.60.70.80.9Out of Sample PowerKLIEP (full dataset)M-KLIEP (known φj)M-KLIEP (estimated φj)CC-KLIEP0.050.100.150.200.250.30Fixed Type 1 Error0.00.10.20.30.40.50.60.7Out of Sample PowerKLIEP (full dataset)M-KLIEP (known φj)M-KLIEP (estimated φj)CC-KLIEP0.00.20.40.60.8Proportion of Values Missing0.640.660.680.700.72Out of Sample PowerM-KLIEP (known φj)M-KLIEP (estimated φj) CC-KLIEP0.00.20.40.60.8Proportion of Values Missing0.30.40.50.60.7Out of Sample PowerM-KLIEP (known φj)M-KLIEP (estimated φj) CC-KLIEP0.00.20.40.60.8Proportion of Values Missing0.100.150.200.250.300.350.40Out of Sample PowerM-KLIEP (known φj)M-KLIEP (estimated φj) CC-KLIEP We have shown all these adaptations to work well in practice on simulated data and applied them to real world data with known and unknown synthetic missing patterns. In particular, our adapted NP classifier using M- KLIEP has been shown to negate losses in accuracy/power incurred by MNAR phenomenon in most cases. We briefly explore the societal impact of our work in Appendix F. A natural extension of this work would be relaxing the naive Bayes assumption required for the handling partial missingness (Section 3.3) to a more realistic set-up where dependencies are properly modelled and accounted for. This extension would enable applications in areas where the naive Bayes framework is unrealistic such as image classification. Another possible direction would be exploring the set-up where the missing pattern is known to only belong to some class as discussed in Sportisse et al. (2020). This approach could be further expanded using a Bayesian framework by assigning of some prior belief on the missing pattern. Finally, our adaptation to NP classification could be extended further by adapting it to the case of partial missingness in both classes. Acknowledgements Josh Givens was supported by a PhD studentship from the EPSRC Centre for Doctoral Training in Computa- tional Statistics and Data Science (COMPASS). References Azmandian, F., Dy, J. G., Aslam, J. A., and Kaeli, D. R. (2012). Local kernel density ratio-based feature selection for outlier detection. Journal of Machine Learning Research, 25:49–64. Cannon, A., Howse, J., Hush, D., and Scovel, C. (2002). Learning with the neyman-pearson and min-max criteria. Los Alamos National Laboratory, Tech. Rep. LA-UR, pages 02–2951. Choi, K., Liao, M., and Ermon, S. (2021). Featurized density ratio estimation. In de Campos, C. and Maathuis, M. H., editors, Proceedings of the Thirty-Seventh Conference on Uncertainty in Artificial Intelligence, volume 161 of Proceedings of Machine Learning Research, pages 172–182. PMLR. de Campos, D. A., Bernardes, J., Garrido, A., de s ́a, J. M., and Pereira-leite, L. (2000). Sisporto 2.0: a program for automated analysis of cardiotocograms. The Journal of maternal-fetal medicine, 9 5:311–8. Ding, X., Wang, Z. J., and Welch, W. J. (2020). Subsampling generative adversarial networks: Density ratio estimation in feature space with softplus loss. IEEE Transactions on Signal Processing, 68:1910–1922. Goldberg, S. B., Bolt, D. M., and Davidson, R. J. (2021). Data missing not at random in mobile health research: Assessment of the problem and a case for sensitivity analyses. J Med Internet Res, 23(6):e26749. Josse, J., Prost, N., Scornet, E., and Varoquaux, G. (2019). On the consistency of supervised learning with missing values. arXiv preprint arXiv:1902.06931, pages 1–43. Kanamori, T., Hido, S., and Sugiyama, M. (2009). A least-squares approach to direct importance estimation. Journal of Machine Learning Research, 10(48):1391–1445. Kanamori, T., Suzuki, T., and Sugiyama, M. (2010). Theoretical analysis of density ratio estimation. IEICE Transactions, 93-A:787–798. King, G. and Zeng, L. (2001). Logistic regression in rare events data. Political Analysis, 9(2):137–163. Kl ́en, R., Visuri, M., and Vuorinen, M. (2010). On jordan type inequalities for hyperbolic functions. Journal of Inequalities and Applications, 2010:1–14. Kohler, J. M. and Lucchi, A. (2017). Sub-sampled cubic regularization for non-convex optimization. In ICML. Li, L., Shen, C., Li, X., and Robins, J. M. (2013). On weighting approaches for missing data. Statistical Methods in Medical Research, 22(1):14–30. PMID: 21705435. Liu, S., Takeda, A., Suzuki, T., and Fukumizu, K. (2017). Trimmed density ratio estimation. In Guyon, I., Luxburg, U. V., Bengio, S., Wallach, H., Fergus, R., Vishwanathan, S., and Garnett, R., editors, Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc. 12 Liu, Y. and De, A. (2015). Multiple imputation by fully conditional specification for dealing with missing data in a large epidemiologic study. International Journal of Statistics in Medical Research, 4:287–295. Nowozin, S., Cseke, B., and Tomioka, R. (2016). f-GAN: Training generative neural samplers using variational divergence minimization. Advances in Neural Information Processing Systems, pages 271–279. Padgett, C. R., Skilbeck, C. E., and Summers, M. J. (2014). Missing data: The importance and impact of missing data from clinical research. Brain Impairment, 15(1):1–9. Rutkowski, L. (2011). The impact of missing background data on subpopulation estimation. Journal of Educa- tional Measurement, 48(3):293–312. Scott, C. and Nowak, R. (2005). A neyman-pearson approach to statistical learning. IEEE Transactions on Information Theory, 51(11):3806–3819. Seaman, S. R. and White, I. R. (2011). Review of inverse probability weighting for dealing with missing data. Statistical methods in medical research, 22(3):278–295. Sportisse, A., Boyer, C., and Josse, J. (2020). Imputation and low-rank estimation with missing not at random data. Statistics and Computing, 30(6):1629–1643. Sugiyama, M., Suzuki, T., and Kanamori, T. (2010). Density ratio estimation: A comprehensive review. RIMS Kokyuroku, pages 10–31. Sugiyama, M., Suzuki, T., Nakajima, S., Kashima, H., Von B ̈unau, P., and Kawanabe, M. (2008). Direct importance estimation for covariate shift adaptation. Annals of the Institute of Statistical Mathematics, 60(4):699–746. Tong, X. (2013). A plug-in approach to neyman-pearson classification. Journal of Machine Learning Research, 14(92):3011–3040. Tong, X., Feng, Y., and Li, J. J. (2018). Neyman-pearson classification algorithms and np receiver operating characteristics. Science Advances, 4(2):eaao1659. Tropp, J. (2015). An introduction to matrix concentration inequalities. Foundations and Trends® in Machine Learning, 8. Tsuboi, Y., Kashima, H., Hido, S., Bickel, S., and Sugiyama, M. (2009). Direct density ratio estimation for large-scale covariate shift adaptation. Journal of Information Processing, 17:138–155. Tsybakov, A. B. (2009). Introduction to Nonparametric Estimation. Springer: Paris. Ward, R. C., Axon, R. N., and Gebregziabher, M. (2020). Approaches for missing covariate data in logistic regression with MNAR sensitivity analyses. Biometrical Journal, 62(4):1025–1037. A ADDITIONAL PROOFS Here we prove key results from the paper however before we do we need to first introduce some additional ω to refer to the density of X ω with w.r.t. the measure ν where ν is the unique measure on notation. We let p(cid:48)(cid:48) Z ∪ {∅} s.t. (such that) ν(A) = μ(A) for any A ∈ BZ and ν({∅}) = 1. For square matrices A, B ∈ Rd×d we take A (cid:23) B to mean that A − B is positive semi-definite and define λmin(A) to be the smallest eigenvalue of A. A.1 KLIEP Objective Simplification Lemma 6. Let G be closed under positive scalar scalar multiplication so that for all r ∈ G, a > 0, ar ∈ G. Define ̃r to be the solution of the constrained optimisation problem min r∈G subject to : KL(p1|rp0) (cid:90) r(z)p0(z)μ(dz) = 1. Z 13 Then we can re-write the solution to the above optimisation problem as ̃r := N −1 * r0 where r0 := argmax r∈ ̄G E[log r(Z 1)] − log E[r(Z 0)] N := E[r0(Z 0)] where ̄G is ̄G ⊆ G s.t. for any r ∈ ̄G, there exists r0 ∈ ̄G, a > 0 s.t. a * r0 = r. Proof. We have that argmin r∈G KL(p1|rp0) = (cid:90) Z p1(z) log p1 rp0(z) = argmin E[log p1(Z 1) r(Z 1)p0(Z 1) ] r∈G = argmin r∈G = argmax r∈G E[log p1(Z 1)] − E[log p0(Z 1)] − E[log r(Z 1)] E[log r(Z 1)]. As such we can re-write the optimisation problem as E[log r(Z 1)] min r∈G subject to : E[r(Z 0)] = 1. To simplify this further we now show that {r ∈ G|E[r(Z 0)] = 1} = {E[r(Z 0)]−1r|r ∈ G}. To this end let r ∈ G, then as G is closed under positive scalar multiplication, E[r(Z 0)]−1r ∈ G. Hence, as E (cid:2)E[r(Z 0)]−1r(Z 0)(cid:3) = 1, we have that E[r(Z 0)]−1r ∈ {r ∈ G|E[r(Z 0)] = 1}. As the other inclusion is trivial, we have shown equality between the two sets of functions. From this we can now re-write the optimisation as argmax E[r(Z0)]−1r∈{E[r(Z0)]−1r|r∈G} = argmax E[r(Z0)]−1r∈{E[r(Z0)]−1r|r∈G} E[log(E[r(Z 0)]−1r(Z 1))] E[log r(Z 1)] − log E[r(Z 0)] which gives the desired result. Remark 3. We can take ̄G s.t. for any r ∈ ̄G, a(cid:48) > 0, if r, a(cid:48)r ∈ G then a(cid:48) = 1. Hence for certain choices of G we can choose ̄G so that r0 is unique A.2 KLIEP Finite Sample Proofs Before we can prove Theorem 9 there are a few simple results we need first. The first is a generalisation of Bernstein bounds to random vectors presented in Kohler and Lucchi (2017). Lemma 7 (Kohler and Lucchi (2017)). Let W1, . . . , Wn be IID copies of a non-negative random vector W over Rd with E[W ] = μ. Now let b, σ > 0 be s.t. (cid:107)W (cid:107)≤ b a.s. and E[(cid:107)W (cid:107)2] ≤ σ2. Then for any ε < σ2 b P (cid:32)(cid:13) (cid:13) (cid:13) (cid:13) (cid:13) 1 n n (cid:88) i=1 Wi − μ (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:33) ≤ ε ≥ 1 − e1/4 exp (cid:27) (cid:26) − nε2 8σ2 We also need a Lemma bounding true and sample covariance in terms of the eigen-space 14 Lemma 8. Let W be a RV over Rd with (cid:107)W (cid:107)≤ b a.s. and let W1 . . . , Wn to be IID copies of W . Define the sample covariance of {Wi}i∈[n] by (cid:100)Var(W ; {Wi}i∈[n]) := 1 n n (cid:88) i=1 WiW (cid:62) i − (cid:33) (cid:32) (cid:32) 1 n n (cid:88) i=1 Wi 1 n n (cid:88) i=1 Wi (cid:33)(cid:62) then provided σmin ≤ 4b2 (cid:18) λmin((cid:100)Var(W ; {Wi}i∈[n]) ≥ P (cid:19) λmin(Var(W )) 1 2 ≥ 1 − (d + e1/4) exp (cid:111) (cid:110) σminn 32b2 where σmin := λmin(Var(W )). Proof. Define the centred RVs Y1, . . . , Yn by Yi := Wi − E[Wi] and the random matrices Rn, Sn by 1 n (cid:32) Sn := Rn := n (cid:88) i=1 YiY (cid:62) i 1 n n (cid:88) i=1 Yi (cid:33) (cid:32) (cid:33)(cid:62) 1 n n (cid:88) i=1 Yi so that Rn − Sn = (cid:100)Var(Y1, . . . , Yn) = (cid:100)Var(W1, . . . , Wn). Firstly we use the matrix Chernoff inequalities (Tropp, 2015) to get that (cid:18) P λmin(Sn) ≥ 3 4 (cid:19) (cid:26) σmin ≥ 1 − d exp − (cid:27) a(cid:48)σminn b2 where a(cid:48) := 3/4 log(3/4) + 1/4. Now note that for any x ∈ Rd λmax(xx(cid:62)) = (cid:107)x(cid:107)2 so that λmax(Rn) = (cid:107) 1 n provided σmin ≤ 4b2, (cid:80)n i=1 Yi(cid:107)2. Additionally, by Lemma 7, (cid:18) λmax(Rn) ≤ P (cid:19) (cid:32) (cid:107) = P 1 4 σmin 1 n n (cid:88) i=1 Yi(cid:107)< √ 1 2 (cid:33) σmin ≥ 1 − e1/4 exp (cid:110) − (cid:111) σminn 32b2 Taking the intersection of these two events we get that w.p. at least 1 − (d + e1/4) exp{ −σminn 32b2 } λmin((cid:100)Var(Y1, . . . , Yn)) = λmin(Sn − Rn) ≥ λmin(Sn) − λmax(Rn) 1 4 σmin − σmin ≥ = λmin(Var(W )) 3 4 1 2 We can now use this to state and prove our theorem giving finite sample bounds for the estimation error of KLIEP. Theorem 9. Define rθ as in (3) and the population and empirical losses L, ˆL by L(θ) := −E[log(rθ(Z 1)] + log E[rθ(Z 0)] ˆL(θ, D) := − 1 n1 n1(cid:88) i=1 log(rθ(Z 1 i )) + log 1 n0 n0(cid:88) i=1 rθ(Z 0 i ). 15 Let ̃θ, ˆθ be the minimisers of these respective losses. Now assume that (cid:107)f (cid:107)∞< ∞ and λmin(Var(f (Z 0))) := σmin > 0. Then we have that for any δ < 1 2 and nmin ≥ C0 log(1/δ),   (cid:107)ˆθ(cid:48) − ̃θ(cid:107)≤ P (cid:115) C0 log(1/δ) nmin  ≥ 1 − δ with C0 a constant depending upon (cid:107)f (cid:107)∞, σmin, d, ̃θ. Proof. We firstly show that ˆL is a convex function for θ for any sample D ∈ Z n0,n1. The first term is linear in θ so clearly convex. For the second term, note that it can be written as g ◦ hD0(θ) with g : Rn0 → R, h : Rd → Rn0 given by hD0 (θ) =       ) θ(cid:62)f (x0 1) ... θ(cid:62)f (x0 n0 n0(cid:88) g(w) = log exp{wi} Now again for any D0, h is linear in θ and therefore convex additionally g is convex and non-decreasing therefore g ◦ h is convex. Now we state some important bounds which we will use in our proof. If we let b := (cid:107)f (cid:107)∞ M := exp{(cid:107) ̃θ(cid:107)b} then for any z ∈ Z, i=1 • 1/M ≤ r ̃θ(z) ≤ M • (cid:107)∇r ̃θ(z)(cid:107)≤ bM • (cid:13) (cid:13) (cid:13) ≤ b ∇r ̃θ(z) r ̃θ(x) (cid:13) (cid:13) (cid:13) Finally we need to bound the minimum eigenvalue of the Hessian of the empirical loss function. To this end note that for any ̄θ ∈ Bη( ̃θ) := {θ ∈ Rd|(cid:107) ̃θ − θ(cid:107)≤ η}, ∇2 θ ˆL( ̄θ; D) := (cid:23) (cid:23) 1 n2 0 1 n2 0 (cid:80) (cid:80) i,j r ̄θ(Z 0 i )[f (Z 0 i )r ̄θ(Z 0 (cid:80) 1 n2 0 i,j r ̄θ(Z 0 i ) − f (Z 0 (cid:80) i,j M −22e−2ηb[f (Z 0 1 n2 0 i,j[f (Z 0 1 n2 0 i,j e2ηbr ̃θ(Z 0 i ) − f (Z 0 (cid:80) i,j r ̃θ(Z 0 1 n2 0 (cid:80) 1 M 2e4ηb i ) − f (Z 0 j )](cid:62) i ) − f (Z 0 i )r ̄θ(Z 0 j )][f (Z 0 i )} j )][f (Z 0 i )r ̃θ(Z 0 j ) i ) − f (Z 0 j )][f (Z 0 i )r ̃θ(Z 0 j ) j )](cid:62) i ) − f (Z 0 j )](cid:62) =: 2 M 2e4ηb (cid:100)Var(f (Z 0); D0) (cid:98)E[r ̃θ(Z 0); D0]2 where, for square matrices A, B we take A (cid:23) B, to mean A − B is positives semi-definite. Thus if we define 0 < σmin := λmin(Var[f (Z 0)]) then Lemma 8 tells us that, provided 1 4 σmin < 1, (cid:18) P λmin((cid:100)Var(f (Z 0); D0)) ≥ (cid:19) 1 2 σmin ≥ 1 − (d + e1/4) exp (cid:26) − 1 8 (cid:16) σmin (cid:17) 4b2 ∧ 1 (cid:27) n Additionally if we let μ2 := E[r ̃θ(Z 0)] we can use Lemma 7 to get that, (cid:18) (cid:98)E[r ̃θ(Z 0); D0] ≤ P (cid:19) 3 2 μ2 ≥ 1 − e1/4 exp (cid:26) − (cid:18) μ2 2 (cid:19) 4M 2 ∧ 1 1 8 (cid:27) n0 16 Thus for any given ̄θ ∈ Bη( ̃θ) w.p.  P λmin(∇2 θ    (cid:124) ˆL( ̄θ; D)) ≥ (cid:123)(cid:122) :=A 4σmin 9M 2e4ηbμ2 2 (cid:125)     ≥ 1 − (d + 2e1/4) exp (cid:26) − 1 8 (cid:18) μ2 2 4b2 ∧ (cid:19) σmin 4b2 ∧ 1 (cid:27) n0 (10) Now we have these bounds we can continue with the main body of the proof. For some η > 0, define ˆθ(cid:48) to be the solution to the following constrained optimisation problem min θ∈Bη( ̃θ) ˆL(θ; D) While, ˆθ(cid:48) is a purely theoretical quantity, we know that when (cid:107)ˆθ(cid:48) − ̃θ(cid:107)≤ 1, ˆθ = ˆθ(cid:48) and so we can use it to get finite sample bounds for ˆθ. By the necessary KKT conditions, we know that there exists μ∗ > 0 s.t. in turn giving us that ∇θ ˆL(ˆθ(cid:48)) + μ∗(ˆθ(cid:48) − ̃θ) = 0 0 = (cid:104)ˆθ(cid:48) − ̃θ, ∇θ ˆL(ˆθ(cid:48)) + μ∗(ˆθ(cid:48) − ̃θ)(cid:105) = (cid:104)ˆθ(cid:48) − ̃θ, ∇θ ˆL(ˆθ(cid:48))(cid:105) + μ∗(cid:107)(ˆθ(cid:48) − ̃θ)(cid:107)2 = (cid:104)ˆθ(cid:48) − ̃θ, ∇θ ˆL( ̃θ) + ∇2 θ ˆL( ̄θ)(ˆθ(cid:48) − ̃θ)(cid:105) + μ∗(cid:107)(ˆθ(cid:48) − ̃θ)(cid:107)2. Using multidimensional MVT over each coordinate with ̄θ some point in the hypercube with opposite corners given by ̃θ, ˆθ(cid:48) (which is a subset of Bη( ̃θ). We then get that (cid:107)ˆθ(cid:48) − ̃θ(cid:107)2λmin(∇2 θ ˆL( ̄θ)) ≤ (ˆθ(cid:48) − ̃θ)(cid:62)∇2 θ ˆL( ̄θ)(ˆθ(cid:48) − ̃θ) + μ∗(cid:107)(ˆθ(cid:48) − ̃θ)(cid:107)2 Therefore we have that = (cid:104) ̃θ − ˆθ(cid:48), ∇θ ˆL( ̃θ)(cid:105) ≤ (cid:107)ˆθ(cid:48) − ̃θ(cid:107)(cid:107)∇θ ˆL( ̃θ)(cid:107) . (cid:107)ˆθ(cid:48) − ̃θ(cid:107) ≤ 1 λmin(∇2 θ ˆL( ̄θ)) (cid:107)∇θ ˆL( ̃θ)(cid:107). Hence if A from (10) holds with our given ̄θ ∈ Bη( ̃θ) we have that (cid:107)ˆθ(cid:48) − ̃θ(cid:107) ≤ 9M 2e4ηbμ2 2 4σmin (cid:107)∇θ ˆL( ̃θ)(cid:107) a.s. . From now on we will work on the event A so that bounding (cid:107)ˆθ − ̃θ(cid:107) simply requires us to bound (cid:107)∇θ ˆL( ̃θ)(cid:107). 17 As ∇θL( ̃θ) = 0 we have (cid:107)∇θ ˆL( ̃θ)(cid:107) = (cid:107)∇θ ˆL( ̃θ) − ∇θL( ̃θ)(cid:107) − 1 n1 n1(cid:88) i=1 ∇θr ̃θ(Z 1 i ) r ̃θ(Z 1 i ) + (cid:20) ∇θr ̃θ(Z 1) r ̃θ(Z 1) (cid:80)n0 1 n0 (cid:21) − E[∇θr ̃θ(Z 0)] μ2 (cid:13) i=1 ∇θr ̃θ(Z 0 i ) (cid:13) (cid:13) (cid:80)n0 i=1 r ̃θ(Z 0 i ) (cid:13) n1(cid:88) (cid:21) (cid:20) ∇θr ̃θ(Z 1) r ̃θ(Z 1) − 1 n1 1 n0 i=1 ∇θr ̃θ(Z 1 i ) r ̃θ(Z 1 i ) = (cid:13) (cid:13) (cid:13) (cid:13) E ≤ E (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:124) + (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:125) (cid:123)(cid:122) :=I1 E[∇θr ̃θ(Z 0)] ̃θ(Z E[r0 )] (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:124) − (cid:80)n0 i=1 ∇θr ̃θ(Z 0 i ) (cid:80)n0 i=1 r ̃θ(Z 0 i ) 1 n0 1 n0 (cid:123)(cid:122) :=I2 (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:125) We now go on to bound I1, I2, using using generalised Hoeffding bounds. We first introduce some additional notation to allow us to proceed. Define RVs W1, W2 and constants μ1, μ2 as follows μ1 := E[∇θrθ(Z 0)] μ2 := E[r ̃θ(Z 0)] W1 := W2 := 1 n0 1 n0 n0(cid:88) i=1 n0(cid:88) i=1 ∇θr ̃θ(Z 0 i ) r ̃θ(Z 0 i ) Then we have I2 := = ≤ − (cid:13) (cid:13) (cid:13) (cid:13) μ1 μ2 (cid:13) W1 (cid:13) (cid:13) W2 (cid:13) (cid:107)μ1W2 − μ2W1(cid:107) μ2W2 (cid:107)μ1 − W1(cid:107) μ2 + |μ2 − W2|(cid:107)μ1(cid:107) μ2W2 Thus to have it is sufficient to have I1 + I2 < 4εσmin 9M 2e4ηbμ2 2 , I1 < (cid:107)μ1 − W1(cid:107) < |μ2 − W2| < , 2εσmin 9M 2e4ηbμ2 2 εσmin 9M 2e4ηbμ2 εσmin 18M 2e4ηb(cid:107)μ1(cid:107) , provided ε < 9M 2e4ηbμ2(cid:107)mu1(cid:107) again. σmin . Furthermore we can get probabilities on each of these events using Lemma 7 once 18 These probabilities are (cid:18) P I1 < 2εσmin 9M 2e4ηbμ2 2 εσmin 9M 2e4ηbμ2 εσmin 18M 2e4ηb(cid:107)μ1(cid:107) (cid:19) (cid:19) (cid:19) ≥ 1 − e1/4 exp ≥ 1 − e1/4 exp ≥ 1 − e1/4 exp (cid:18) (cid:18) (cid:18) (cid:26) (cid:26) (cid:26) − − − 1 8 1 8 1 8 min 4ε2σ2 81b2M 4e8ηbμ4 2 ε2σ2 81b2M 6e8ηbμ2 2 ε2σ2 min (cid:19) 324M 6e8ηb(cid:107)μ1(cid:107)2 ∧ 1 min (cid:27) n0 (cid:19) (cid:27) ∧ 1 n1 (cid:19) (cid:27) ∧ 1 n0 (cid:107)μ1 − W1(cid:107)≤ (cid:18) P (cid:18) P |μ2 − W2|≤ Therefore using unions bounds and taking η = (cid:107) ̃θ(cid:107) we have that P((cid:107)ˆθ(cid:48) − ̃θ(cid:107)≤ ε) ≥ P (cid:18) (cid:107)∇θ ˆL( ̃θ)(cid:107)≤ εσmin M 4e4(cid:107) ̃θ(cid:107)b (cid:19) , A ≥ 1 − α exp (cid:8)−C(ε2 ∧ γ)nmin (cid:9) where α := d + 5e1/4 (cid:40) C := min 1 8 γ := 1 8C min , 4σ2 min 81b2M 4e8(cid:107) ̃θ(cid:107)bμ4 2 (cid:27) (cid:26) μ2 σmin 2 4b2 , 1 4b2 , ε2σ2 81b2M 6e8(cid:107) ̃θ(cid:107)bμ2 2 min , ε2σ2 324M 6e8(cid:107) ̃θ(cid:107)b(cid:107)μ1(cid:107)2 min (cid:41) As ˆL is convex for any sample we know that if ˆθ(cid:48) is in the interior of B1( ̃θ) then ˆθ(cid:48) = ˆθ. Therefore, for any 0 < ε < η the same result holds replacing ˆθ(cid:48) with ˆθ. hence now gives us that for log(α/δ) Cnmin ≤ γ ∧ (cid:107) ̃θ(cid:107) w.p. 1 − δ (cid:107)ˆθ − ̃θ(cid:107)≤ (cid:115) log(α/δ) Cnmin If we assume δ ≤ 1 (log(α)+1) log(1/δ) (cid:107) ̃θ(cid:107)∧γ w.p. 1 − δ, 2 then log(α/δ) ≤ (log(α) + 1) log(1/δ). Therefore we have that provided nmin ≥ (cid:115) (cid:107)ˆθ − ̃θ(cid:107)≤ (log(α) + 1) log(1/δ) Cnmin . Finally, taking C0 := log(α)+1 min{C,(cid:107) ̃θ(cid:107),γ} gives our desired result. A.2.1 Bound on KLIEP Normalising Constant We now give a finite sample bound for the normalising constant calculated in KLIEP Corollary 10. Define N ∗, ˆN to be N ∗ := E[r ̃θ(Z 0)] 1 m0 ˆN := m0(cid:88) i=1 rˆθ(Z 0 i ) with ˆθ, ̃θ, r ̃θ defined as before. Then we have that for δ ∈ (0, 1/2], provided nmin > CN log(1/δ),  (cid:107)N ∗ − ˆN (cid:107)≤ P (cid:115) CN log(1/δ) nmin   ≥ 1 − δ with CN a constant depending upon C0, b, (cid:107) ̃θ(cid:107). 19 Proof. We condition upon the same events we condition upon in Theorem 9. Specifically for δ ∈ (0, 1/2], provided nmin > 2C0 log(1/δ), w.p. at least 1 − δ the following two conditions hold: (cid:107)ˆθ − ̃θ(cid:107) ≤ (cid:115) C0 log(1/δ) nmin |μ2 − W2| < εσmin 18M 2e4ηb(cid:107)μ1(cid:107) with ε = (cid:112)C0 log(α/δ). The first conditions implies |r ̃θ(z) − rˆθ(z)| ≤ e(cid:107) ̃θ(cid:107)b (cid:115) 2C0 log(1/δ) nmin Therefore we have that |N ∗ − ˆN | ≤ ≤ (cid:12) (cid:12) E[r ̃θ(Z 0)] − (cid:12) (cid:12) (cid:12) (cid:115) C1 log(1/δ) nmin 1 n0 n (cid:88) i=1 r ̃θ(Z 0 i ) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) + (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) 1 n0 n0(cid:88) i=1 rˆθ(Z 0 i ) − 1 n0 n0(cid:88) i=1 (cid:12) (cid:12) r ̃θ(Z 0 (cid:12) i ) (cid:12) (cid:12) (cid:115) + e(cid:107) ̃θ(cid:107)b C0 log(1/δ) nmin with C1 := σmin (cid:112)C (cid:48) 0(log(α) + 1) 18M 2e4(cid:107) ̃θ(cid:107)b(cid:107)μ1(cid:107) Taking CN = ( √ C0 + e(cid:107) ̃θ(cid:107)b √ C1)2 gives our desired result. A.3 Proof of Lemma 1 Proof. Throughout, unless stated otherwise, all integrals are taken w.r.t. μ (note that for any integral over some subset A of Z this is equivalent to taking the integral w.r.t ν.) First we prove that p(cid:48)(cid:48)(z) = (1 − φ(x))p(z) for μ almost every z ∈ Z. by showing that for all A ∈ BZ P(X ∈ A) = (cid:90) A (1 − φ(x))p(x)ν(dx) Indeed (cid:90) A (1 − φ(x))p(x)dx = E[1{Z ∈ A}(1 − φ(Z))] = E[1{Z ∈ A}] − E[1{Z ∈ A}1{X = ∅}] by definition of φ(Z) = E[1{Z ∈ A}1{X (cid:54)= ∅}] by linearity of expectation = P(Z ∈ A, X (cid:54)= ∅) = P(Z ∈ A, X = Z) = P(X ∈ A) We now have that for any A ∈ BZ , P(X ∈ A|X (cid:54)= ∅) = P(X (cid:54)= ∅)−1P(X ∈ A) = P(X (cid:54)= ∅)−1 = P(X (cid:54)= ∅)−1 (cid:90) A (cid:90) A p(cid:48)(cid:48)(x)ν(dx) (1 − φ(x)p(x)μ(dx) 20 and so p(cid:48) = P(X (cid:54)= ∅)−1 * (1 − φ) * p. We also have that p can be extended to a density over X by taking p(∅) = 0. This combined with the above result gives us that p(x) p(cid:48)(cid:48)(x) := 1{x (cid:54)= ∅} 1 − φ(x) for ν almost every x ∈ X . Hence we can use importance weighting to get our desired result. A.4 Proof M-KLIEP Finite Sample Bounds Lemma 11. Let W, V be two RVs over Rd with p.d.f.s pW pV w.r.t. some measure ν. Assume that g := pW is pV well defined and g(w) ≤ α for all w ∈ Rd. Finally suppose that (cid:107)W (cid:107), (cid:107)V (cid:107)≤ b a.s. Then we have that for any 0 < ε < b P (cid:18)(cid:12) (cid:12) (cid:12) (cid:12) E[W ] − 1 n g(V )V (cid:19) ≤ ε (cid:12) (cid:12) (cid:12) (cid:12) ≥ 1 − e1/4 exp (cid:27) (cid:26) − ε2n 8αb2 Proof. This proof is a direct corollary of Lemma 7 First we clearly have that (cid:107)g(V )V (cid:107)≤ αb a.s.. Second we have that E((cid:107)g(V )V (cid:107)2) = E[g(V )2(cid:107)V (cid:107)2] = E[g(W )(cid:107)W 2(cid:107)] ≤ αE[(cid:107)W (cid:107)2] ≤ ab2. Hence as E[g(V )V − E[W ]] = 0, we can use the Bernstein inequality to get P (cid:18)(cid:12) (cid:12) (cid:12) (cid:12) E[W ] − (cid:12) (cid:12) g(V )V ) (cid:12) (cid:12) 1 n (cid:19) ≤ ε ≥ 1 − e1/4 exp (cid:27) (cid:26) − ε2n 8αb Remark 4. If we want to remove the requirement that ε < b we can re-write this as P (cid:18)(cid:12) (cid:12) (cid:12) (cid:12) E[W ] − 1 n g(V )V (cid:19) ≤ ε (cid:12) (cid:12) (cid:12) (cid:12) ≥ 1 − e1/4 exp (cid:26) − (cid:18) ε2 (cid:27) (cid:19) n 8α b2 ∧ 1 Lemma 12. Let W, V be two RVs over Rd, with densities pW , pV respectively s.t. (cid:107)W (cid:107), (cid:107)V (cid:107)< b a.s.. Assume that g := pW : Rd → Rp is well defined with g(w) < α for all w ∈ Rd. . Let V1, . . . , Vn be IID copies of V . Now pV define the importance weighted sample covariance by of W estimated by {Vi}i∈[n] (cid:100)Var(W ; {Vi}i∈[n]) := (cid:32) 1 n n (cid:88) i=1 g(Vi)ViV (cid:62) i (cid:33)   1 n (cid:88) i∈[n]  (cid:32) g(Vi)  − 1 n n (cid:88) i=1 g(Vi)Vi (cid:33) (cid:32) 1 n n (cid:88) i=1 (cid:33)(cid:62) g(Vi)Vi then provided σmin ≤ 4b2 (cid:18) λmin((cid:100)Var(W ; {Vi}i∈[n]) ≥ P (cid:19) 1 2 σmin ≥ 1 − (d + 2e1/4) exp{ a(cid:48)σminn αb2 } where a(cid:48) := (2− 32 √ 3)2 and σmin := λmin(Var(W )). 21 Proof. Define the centred RVs Y1, . . . , Yn by Yi := Vi − E[Wi] and the random matrices Rn, Sn by Sn := Rn := an := 1 n (cid:32) n (cid:88) i=1 g(Vi)YiY (cid:62) i 1 n n (cid:88) i=1 g(Vi)Yi (cid:33) (cid:32) 1 n n (cid:88) i=1 (cid:33)(cid:62) g(Vi)Yi 1 n (cid:88) i∈[n] g(Vi) so that anRn − Sn = (cid:100)Var(W ; {Yi}i∈[n]). (cid:100)Var(W ; {Vi}i∈[n]). Firstly we can use the matrix Chernoff inequalities (Tropp, 2015), alongside the fact that E[Sn] = Var(W ) and λmax( 1 Simple algebraic manipulation gives us that anRn − Sn = i ) ≤ αb2 n g(Vi)YiY (cid:62) n to get (cid:32) P λmin(Sn) ≥ √ 3 2 (cid:33) σmin ≥ 1 − d exp (cid:110) − (cid:111) aσminn αb2 Now note that for any x ∈ Rd λmax(xx(cid:62)) = (cid:107)x(cid:107)2 so that λmax(Rn) = (cid:107) 1 use vector Bernstein bounds to get that provided σmin ≤ 4b2 n Yi(cid:107)2. Hence, as E[g(Vi)Yi] = 0, we can (cid:18) λmax(Rn) ≤ P (cid:19) = P σmin 1 4 (cid:32)(cid:13) (cid:13) (cid:13) (cid:13) (cid:13) 1 n n (cid:88) i=1 g(Vi)Yi ≥ 1 − e1/4 exp (cid:110) − < (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) σminn 32αb2 (cid:33) √ σmin 1 2 (cid:111) . Finally by Lemma 11, (cid:32) P an ≥ (cid:33) √ 3 2 ≥ 1 − e1/4 exp (cid:40) (2 − √ (cid:41) 3)2n 32α Taking the intersection of these three events we get that w.p. at least 1 − (d + 2e1/4) exp (cid:110) − λmin((cid:100)Var(W ; {(Vi, g(Vi))}i∈[n]) = λmin(anSn − Rn) (cid:16) a(cid:48)σmin b2 ∧ 1 (cid:111) (cid:17) n 8α where a(cid:48) := (2− 3)2 √ 4 ≥ = ≥ λmin(anSn) − λmax(Rn) = anλmin(Sn) − λmax(Rn) √ √ 3 2 1 2 3 2 σmin − 1 4 σmin λmin(Var(W )) We can now state the Lemma which gives rise to Theorem 9. Lemma 13. Let rθ take the log-linear form and for for θ ∈ Rd define and L, ˆL(cid:48) by i (cid:54)= ∅} 1{X 1 1 − φ1(X 1 i ) n0(cid:88) i (cid:54)= ∅} 1{X 0 1 − φ0(X 0 i ) L(θ) := −E[rθ(Z 1)] + log E[rθ(Z 0)] ˆL(cid:48)(θ; D(cid:48)) := − 1 n1 1 n0 + log n1(cid:88) i=1 i=1 log rθ(X 1 i ) rθ(X 0 i ). 22 Finally, define the constant ̃θ and the RV ˆθ, by ̃θ := argmax L(θ) θ∈Rd ˆθ := argmax ˆL(cid:48)(θ, D(cid:48)). θ∈Rd Now suppose that (cid:107)φ0(cid:107)∞< 1, (cid:107)φ1(cid:107)∞< 1, (cid:107)f (cid:107)∞< ∞ and additionally let σmin := λmin(Var(f (Z 0))) > 0 Then we have that for any δ < 1 2 and meff min ≥ C (cid:48) 0 log(1/δ),  (cid:107)ˆθ(cid:48) − ̃θ(cid:107)≤ P (cid:115) C (cid:48) 0 log(1/δ) meff   ≥ 1 − δ where C (cid:48) 0 a constant depending upon (cid:107)f (cid:107)∞, σmin, d, (cid:107) ̃θ(cid:107). Proof. Firstly we define the population version of ˆL(cid:48) by L(cid:48) as follows L(cid:48)(θ) = E (cid:20) 1{X 1 (cid:54)= ∅} 1 − φ1(X 1) (cid:21) log r(X 1) − log E (cid:20) 1{x0 (cid:54)= ∅} 1 − φ0(X 0) (cid:21) . Then from Lemma 1 we have that L(θ) = L(cid:48)(θ). As a result we can re-define ̃θ to be ̃θ := argmin L(cid:48)(θ) θ∈Rd i=1) is linear in θ For proof of convexity we note that again the term involving D and the second term is convex for the same reason as ˆL is with the caveat that we replace g : Rn0 → R by D0 : Rn0 → R defined by g(cid:48) (cid:48)+ (our sample from {X 1 i }n1 g(x) = log n (cid:88) i=1 wi exp{xi} where w0 i := i (cid:54)= ∅} 1{x0 1 − φ0(x0 i ) . As each wi > 0, this modified log-sum-exp is also convex by the same argument which makes the unmodified log-sum-exp function convex. That is, ∇2 xg(cid:48) D0 (z) = diag(u)(1(cid:62)u) − uu(cid:62) (1(cid:62)u)2 where ui = w0 i exp(zi). If we then let v ∈ Rn0, we get v(cid:62)∇2 xg(cid:48) D0 (z) = = v(cid:62)diag(u)v(1(cid:62)u) − v(cid:62)uu(cid:62)v (1(cid:62)u)2 i ui)((cid:80)n1 ((cid:80)n0 i=1 v2 i=1 ui) − ((cid:80)n0 (1(cid:62)u) i=1 viui) > 0 where the final inequality is given by the Cauchy-Schwartz inequality. For ease of notation we define b := (cid:107)f (cid:107)∞ and M := exp (cid:107) ̃θ(cid:107)b. We now aim to bound λmin(∇2 θ ˆL(cid:48)( ̄θ)) from below. 23 To this end we have ∇2 θ ˆL(θ; D) := (cid:23) (cid:23) (cid:80) (cid:80) i w0 i,j w0 i )r ̄θ(X 0 j r ̄θ(X 0 (cid:80) 1 n2 i,j M −2e−2ηbw0 1 n2 0 1 n2 0 (cid:80) 1 n2 i,j w0 (cid:80) 1 n2 0 1 M 2e4ηb i ) − f (X 0 j )](cid:62) j )[f (X 0 j r ̄θ(X 0 i w0 i,j w0 i ) − f (X 0 j [f (X 0 i w0 j r ̄θ(X 0 i w0 i,j e2ηbw0 i ) − f (X 0 j [f (X 0 i w0 (cid:80) 1 j r ̃θ(X 0 i w0 n0 (cid:21) i ) − f (X 0 j )][f (X 0 i )r ̄θ(X 0 j ) j )][f (X 0 i )r ̄θ(X 0 j ) i ) − f (X 0 j )][f (X 0 i )r ̃θ(X 0 j ) i,j w0 j )](cid:62) i ) − f (X 0 j )](cid:62) =: 2 M 4e4ηb (cid:20) f (Z 0); D(cid:48) (cid:100)Var0 1, {w0 i=1 i }n0 (cid:21)(cid:19)2 (cid:18) (cid:98)E(cid:48) (cid:20) r ̃θ(Z 0); D(cid:48) 1 where, for square matrices A, B we take A (cid:23) B, to mean A − B is positives semi-definite. We can then bound (cid:100)Var0 and (cid:98)E(cid:48) similarly to before to get that (cid:18) P P λmin((cid:100)Var(f (Z), D(cid:48) E(cid:48)(cid:20) (cid:18) r ̃θ(Z 0); D(cid:48) ≤ (cid:21) 1 1)) ≥ (cid:19) 1 2 σmin ≥ 1 − (d + 2e1/4) exp{− (cid:19) E[r ̃θ(X 0)] 3 2 ≥ 1 − e1/4 exp (cid:26) − (cid:16) μ2 4M 2 ∧ 1 (cid:18) a(cid:48)σmin (cid:19) n0(1 − φ0 max) } b2 ∧ 1 (cid:17) n0(1 − φ0 max) 8 (cid:27) 8 where again σmin := λmin(Var(f (Z 0)), μ2 := E[r ̃θ(Z 0)]. Therefore we have that  P λmin(∇2 θ    (cid:124) ˆL(cid:48); (θ; D(cid:48))) ≥ (cid:123)(cid:122) :=A(cid:48)  4σmin   9M 2e4ηbμ2  2 (cid:125) ≥ 1 − (d + 3e1/4) exp (cid:26) − (cid:18) μ2 4M 2 ∧ a(cid:48)σmin b2 ∧ 1 (cid:19) n0(1 − φ0 max) (cid:27) 8 (11) We now have all the bounds required to continue with the main body of the proof. Let ˆθ(cid:48) be defined as the solution to the following constrained optimisation problem. ˆL(θ, D(cid:48)) min θ∈Bη( ̃θ) By and identical argument to Theorem 9 we then get that (cid:107)ˆθ(cid:48) − ̃θ(cid:107)≤ 1 λmin(∇2 θ ˆL(cid:48)( ̄θ)) (cid:107)∇θ ˆL(cid:48)( ̃θ)(cid:107). for some ̄θ ∈ Bη( ̃θ). Hence if A(cid:48) from (11) holds with our given ̄θ ∈ Bη( ̃θ) we have that a.s. . (cid:107)∇θ ˆL( ̃θ)(cid:107) (cid:107)ˆθ(cid:48) − ̃θ(cid:107) ≤ 9M 2e4ηbμ2 2 4σmin From now on we will work on the event A so that bounding (cid:107)ˆθ − ̃θ(cid:107) simply requires us to bound (cid:107)∇θ ˆL( ̃θ)(cid:107). We further get that (cid:107)∇θ ˆL(cid:48)( ̃θ)(cid:107)≤ I (cid:48) 1 + I (cid:48) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) i (cid:54)= ∅} 1{X 1 ∇θr ̃θ(X 1 i ) 1 − φ1(X 1 r ̃θ(X 1 i ) i ) (cid:13) 1{X 0 i (cid:54)=∅} i ) ∇θr ̃θ(X 0 (cid:13) i ) 1−φ0(X 0 (cid:13) (cid:13) 1{X 0 i (cid:54)=∅} (cid:13) i ) r ̃θ(X 0 i ) (cid:13) 1−φ0(X 0 2 where (cid:20) ∇θr ̃θ(Z 1) r ̃θ(Z 1) E[∇θr ̃θ(X 0)] E[r ̃θ(X 0)] i=1 (cid:80)n0 i=1 (cid:80)n0 i=1 I (cid:48) 2 = I (cid:48) 1 = 1 n1 n1(cid:88) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) 1 n0 1 n0 − − E (cid:21) . 24 Define RVs W (cid:48) 1, W (cid:48) 2 W (cid:48) 1 := W (cid:48) 2 := 1 n0 1 n0 (cid:88) i∈[n0] (cid:88) i∈[n0] i (cid:54)= ∅} 1{X 0 1 − φ0(X 0 i ) i (cid:54)= ∅} 1{X 0 1 − φ0(X 0 i ) ∇θr ̃θ(X 0 i ) r ̃θ(X 0 i ) and μ1 := E[∇θr ̃θ(Z 0)]. We can then bound I (cid:48) 2 to get I (cid:48) 2 :=≤ (cid:107)μ1 − W (cid:48) 1(cid:107) μ2 + 2|(cid:107)μ1(cid:107) |μ2 − W (cid:48) μ2W (cid:48) 2 Thus to have it is sufficient to have 1 + I (cid:48) I (cid:48) 2 < 4σmin ε9M 2e4ηbμ2 2 , I (cid:48) 1 < (cid:107)μ1 − W (cid:48) 1(cid:107) < |μ2 − W (cid:48) 2| < provided ε < 9M 2e4ηbμ2(cid:107)mu1(cid:107) σmin . The probabilities for these events are , 2εσmin 9M 2e4ηbμ2 2 εσmin 9M 2e4ηbμ2 εσmin 18M 2e4ηb(cid:107)μ1(cid:107) , . (cid:18) P I (cid:48) 1 < 2εσmin 9M 2e4ηbμ2 2 εσmin 9M 2e4ηbμ2 εσmin 18M 2e4ηb(cid:107)μ1(cid:107) (cid:19) (cid:19) (cid:19) ≥ 1 − e1/4 exp ≥ 1 − e1/4 exp ≥ 1 − e1/4 exp (cid:18) (cid:18) (cid:18) (cid:26) (cid:26) (cid:26) − − − 1 8 1 8 1 8 min 4ε2σ2 81b2M 4e8ηbμ4 2 ε2σ2 81b2M 6e8ηbμ2 2 ε2σ2 min (cid:18) P (cid:107)μ1 − W (cid:48) 1(cid:107)≤ (cid:18) P |μ2 − W (cid:48) 2|≤ (cid:19) (cid:19) ∧ 1 ∧ 1 (cid:27) n1(1 − φ1 max) (cid:27) n0(1 − φ0 max) (cid:19) 324M 6e8ηb(cid:107)μ1(cid:107)2 ∧ 1 min (cid:27) n0(1 − φ0 max) Therefore by the same argument as Theorem 9 we get P((cid:107)ˆθ − ̃θ(cid:107)≤ ε) ≥ P (cid:16) (cid:107)∇θ ˆL( ̃θ)(cid:107)≤ M 4e4ηb , A(cid:48)(cid:17) ≥ 1 − α(cid:48) exp (cid:8)−C (cid:48) (cid:0)ε2 ∧ γ(cid:1) meff εσmin (cid:9) . where α(cid:48) := d + 6e1/4 (cid:40) C (cid:48) := min 1 8 γ(cid:48) := 1 8C min 4σ2 min 81b2M 4e8(cid:107) ̃θ(cid:107)bμ4 2 (cid:26) a(cid:48)μ2 2 M 2 , σmin 4b2 , 1 , ε2σ2 81b2M 6e8(cid:107) ̃θ(cid:107)bμ2 2 min , ε2σ2 324M 6e8(cid:107) ̃θ(cid:107)b(cid:107)μ1(cid:107)2 min (cid:41) (cid:27) 25 By an identical argument to the proof of Theorem 9 in Section A.2 this gives us that for us that for δ ≤ 1 2 , provided meff ≥ log(α(cid:48)) log(1/δ) then γ(cid:48)∧(cid:107) ̃θ(cid:107)  (cid:107) ̃θ − ˆθ(cid:107)≤ P (cid:115) log(α(cid:48)) log(1/δ) C (cid:48)meff   ≥ 1 − δ. Now taking C (cid:48) 0 := log(α(cid:48)) min{C(cid:48),(cid:107) ̃θ(cid:107),γ(cid:48)} gives our desired result. A.4.1 Bound on Normalisation term in M-KLIEP Corollary 14. Define N ∗, ˆN (cid:48) to be N ∗ := E[r ̃θ(Z 0)] 1 m0 ˆN := m0(cid:88) i=1 i (cid:54)= ∅} 1{X 0 1 − φ0(x0 i ) rˆθ(cid:48)(X 0 i ) with ˆθ(cid:48), ̃θ, r ̃θ defined as before. Then we have that for δ ∈ (0, 1/2], provided nmin > C (cid:48) N log(1/δ),  (cid:107)N ∗ − ˆN (cid:107)≤ P 1 1 − (cid:107)φ0(cid:107)∞ (cid:115) C (cid:48) N log(1/δ) meff   ≥ 1 − δ Proof. We work assuming the same events hold as in Theorem 2. Crucially we have that for δ ∈ (0, 1/2], provided meff ≥ C (cid:48) 0 log(1/δ), w.p. at least 1 − δ the following two events hold (cid:107)ˆθ − ̃θ(cid:107) ≤ (cid:115) 2C (cid:48) 0 log(1/δ) nmin |μ2 − W (cid:48) 2| < εσmin 18M 2e4ηb(cid:107)μ1(cid:107) We will refer to these inequalities as A and B respectively. A then implies, (cid:12) (cid:12) (cid:12) (cid:12) 1{x (cid:54)= ∅} 1 − φ0(x) r ̃θ(x) − 1{x (cid:54)= ∅} 1 − φ0(x) rˆθ(z) (cid:12) (cid:12) (cid:12) (cid:12) ≤ 1 1 − (cid:107)φ0(cid:107)∞ e(cid:107) ̃θ(cid:107)b (cid:115) C (cid:48) 0 log(1/δ) nmin Therefore A and B together give (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:115) |N ∗ − ˆN (cid:48)| ≤ ≤ C (cid:48) 1 with E[r ̃θ(Z 0)] − 1 n0 n (cid:88) i=1 r ̃θ(Z 0 i ) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) + (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) 1 n0 n0(cid:88) i=1 rˆθ(cid:48)(Z 0 i ) − 1 n0 n0(cid:88) i=1 (cid:12) (cid:12) r ̃θ(Z 0 (cid:12) i ) (cid:12) (cid:12) log(1/δ) meff + 1 1 − (cid:107)φ0(cid:107)∞ e(cid:107) ̃θ(cid:107)b (cid:115) C (cid:48) 0 log(1/δ) meff C1 := σmin (cid:112)C (cid:48) 0(log(α) + 1) 18M 2e4(cid:107) ̃θ(cid:107)b(cid:107)μ1(cid:107) . Therefore, taking C (cid:48) N = ((cid:112)C (cid:48) 0 + exp{(cid:107) ̃θ(cid:107)b}(cid:112)C (cid:48) 1)2 gives our desired result. A.5 M-KLIEP Lower Bound For each ζ ∈ (0, ∞) let's define a density fζ of a measure supported on [0, 1] by fζ(y) = ζeζy eζ − 1 , for y ∈ [0, 1], and fζ(y) = 0 for y /∈ [0, 1]. In addition, let f0 denote the uniform density on [0, 1]. 26 Lemma 15. For all ζ ∈ [0, 2] we have Proof. Given any ζ ∈ (0, 2] we have KL(f0, fζ) ≤ ζ 2 20 . KL(f0, fζ) = (cid:90) 1 0 log (cid:19) (cid:18) eζ − 1 ζeζy dy = log (cid:27) (cid:26) sinh(ζ/2) (ζ/2) (cid:18) ≤ log 1 + (cid:19) ζ 2 20 ≤ ζ 2 20 , where the penultimate inequality uses the bound (Kl ́en et al., 2010, Lemma 3.3 (i)). The case where ζ = 0 is immediate. √ 2] × [0, 1/(cid:112)2(d − 1)]d−1, take X 0 = Z 0 ∼ P0 and Cd := Let P0 be the uniform distribution on Ad := [0, 1/ (cid:112)2d * (d − 1)d−1. Moreover, given ζ ∈ [0, 2], w1 ∈ [0, 1] and τ ∈ {0, 1} we write P1(ζ, w1, τ ) for the distribution on X 1 = (X 1 2z1) on Ad, and choosing φ1 so that φ1(z) = w1 for all z ∈ [0, 1]d. We write P n0,n1(ζ, w1, τ ) for the joint distribution on D(cid:48) := (D(cid:48) 0, D(cid:48) 1) where D(cid:48) Lemma 16. Given ζ ∈ [0, 2], n1 ∈ N and w1 ∈ [0, 1] we have j )j∈[d] constructed by choosing Z 1 with density (zj)j∈[d] (cid:55)→ Cd * fτ *ζ( 1 ∼ P1(ζ, w1, τ )n1. 0 ∼ P n0 0 and D(cid:48) √ KL (cid:8)P n0,n1(ζ, w1, 0), P n0,n1 (ζ, w1, 0)(cid:9) ≤ n1(1 − w1)ζ 2 20 . Proof. We have KL {P1(ζ, w1, 0), P1(ζ, w1, 1)} = (cid:90) log (cid:19) (cid:18) dP1(ζ, w1, 0) dP1(ζ, w1, 1) (cid:33) √ (cid:16) Cd * f0( dP1(ζ, w1, 0) 2 * z1) (cid:17) dz1 (cid:90) Ad (cid:90) = (1 − w1) * = (1 − w1) * log log [0,1] (cid:32) Cd * f0( Cd * fζ( (cid:19) (cid:18) f0(y) fζ(y) X √ √ 2 * z1) 2 * z1) f0(y)dy = (1 − w1) * KL(f0, fζ) ≤ (1 − w1) * ζ 2 20 , where we used Lemma 15 in the final step. Hence, by the product rule for Kullback-Leibler divergence (Tsybakov, 2009, Chapter 2) we have KL (cid:8)P n0,n1 (ζ, w1, 0), P n0,n1(ζ, w1, 0)(cid:9) = n0 * KL (P0, P0) + n1 * KL {P1(ζ, w1, 0), P1(ζ, w1, 1)} ≤ n1(1 − w1)ζ 2 20 . We are now ready to complete the proof of Theorem 3. √ (cid:55)→ Proof of Theorem 3. We assume, without loss of generality, that n1w1 ≤ n0w0. Suppose Z 0 ∼ P0 and Z 1 has 2], τ ∈ {0, 1} then the density ratio between the density (zj)j∈[d] densities of Z 1 and Z 0 is proportional to eθ(ζ,τ )(cid:62)z on [0, 1]d where θ(ζ, τ ) = ( 2 * τ * ζ, 0, . . . , 0)(cid:62) ∈ Rd, and hence (cid:107)θ(ζ, τ )(cid:107)≤ 1. Next, we convert ˆθ = (ˆθj)j∈[d] into an estimator ˆτ by ˆτ = 1{ˆθj > ζ/ 2}. Consequently, for τ ∈ {0, 1} we have 2 * z1) for some ζ ∈ [0, 1/ 2 * fτ *ζ( √ √ √ √ (cid:107)ˆθ − θ(ζ, τ )(cid:107)2 ≥ |ˆθ1 − ζτ |≥ ζ √ 2 * 1{ˆτ (cid:54)= τ }. 27 Hence, by (Tsybakov, 2009, Theorem 2.2(iii)) for at least one τ ∈ {0, 1} we have min τ ∈{0,1} P D(cid:48)∼P n0 ,n1 (ζ,w1,τ ) (cid:26) (cid:107)ˆθ − θ(ζ, τ )(cid:107)2≥ (cid:27) ζ √ 2 1 4 P D(cid:48)∼P n0,n1 (ζ,w1,τ ) (ˆτ (cid:54)= τ ) ≥ (cid:18) * exp − n1(1 − w1)ζ 2 20 (cid:19) . ≥ min τ ∈{0,1} To complete the proof we take (cid:40)(cid:115) ζ := min 20 log(1/(4δ)) min{n0(1 − w0), n1(1 − w1)} , 1 √ 2 (cid:41) . A.6 Proof of Missing NP Classifier Finite Sample Bounds Before we can proof this result we need to state a (relatively trivial) result on conditional probabilities. Lemma 17. Let X, Y be RVs on measurable space (Z, BZ ) and define events F ∈ σ(X), and E0, E1 ∈ BZ . Suppose that F ∩ E0 ⊆ E1 then P(F ∩ {E[1E0Y |X] > E[1E1 Y |X]}) = 0. Proof. Define the event C := {E[1E0Y |X] > E[1E1 Y |X]} then by construction, as F ∩ C ∈ σ(X), this gives E[1E0∩F ∩CY ] = E[E[1E0Y |X]1F ∩C] ≥ E[E[1E1Y |X]1F ∩C] = E[1E1∩F ∩CY ] where equality holds throughout if and only if P(F ∩ C) = 0. Alternatively, as F ∩ E0 ⊆ E1 we have that F ∩ E0 ∩ C ⊆ F ∩ E1 ∩ C so that E[1F ∩C∩E0Y ] ≤ E[1F ∩C∩E1Y ]. Therefore equality holds and P(F ∩ C) = 0. We can now go on to prove Theorem 5 Proof of Theorem 5. This proof is adapted from Tong (2013). For notational simplicity we define functions ˆh, ̃h : Z → R by so that R1( ˆφ), R1( ̃φ) can be re-written as Define events G0, G1 by ˆh(z) := g ◦ rˆθ ̃h(z) := g ◦ r ̃θ ˆφ = P(ˆh(Z 1) ≤ ˆCα,δ,ˆh) ̃φ = P( ̃h(Z 1) ≤ C ∗ α, ̃h) G0 := { ̃h(Z 0) > C ∗ G1 := { ̃h(Z 0) ≤ C ∗ α, ̃h, ˆh(Z 0) ≤ ˆCα,δ,ˆh} α, ̃h, ˆh(Z 0) > ˆCα,δ,ˆh} 28 We now have that R1( ˆφ) − R1( ̃φ) = E (cid:104) 1G0 ∪ G1 (cid:12) (cid:12) (cid:12) ̃h(Z 0) − C ∗ α, ̃h (cid:105) (cid:12) (cid:12) (cid:12) + 2C ∗ α, ̃h(P( ̃h(Z 0) ≥ C ∗ α, ̃h) − P(ˆh(Z 0) ≥ ˆCα,δ,ˆh)) For ease of notation we will define ∆m0 eff ,δ as in Lemma 4, that is, ∆m0 eff ,δ := (cid:115) 16 log(1/δ) m0 eff Now define 2 events E0, E1 as follows E0 := {(cid:107)ˆθ − ̃θ(cid:107)≤ ε(cid:48)(cid:48)} E1 := {P(ˆh(X 0)) ≥ ˆCα,δ,ˆh|D(cid:48)) ≥ α − 2∆m0 eff ,δ} where (cid:115) ε(cid:48)(cid:48) := C (cid:48) 0 log(1/δ) meff . Theorem 2 and Lemma 4 give us that both these events occur w.p. 1 − δ so that P(E0 ∩ E1) ≥ 1 − 2δ. We now aim to show that, E0 ∩ E1 ⊆ {R1( ˆφ) − R1( ̃φ) < ε(cid:48)}. We immediately have that E1 ⊆ {P( ̃h(Z 0) ≥ C ∗ α, ̃h) − P(ˆh(Z 0) ≥ ˆCα,δ,ˆh|D(cid:48)) ≤ 2∆δ,meff } Additionally, we note that as (cid:107)∇θg ◦ rθ(z)(cid:107)≤ L for all z, θ, so that E0 ⊆ {sup z∈Z (cid:107) ̃h(z) − ˆh(z)(cid:107)2≤ ε(cid:48)(cid:48)L}. We now aim to bound ˆCα,δ,g above. Taking the intersection of these two events we get that E0 ∩ E1 ⊆ {P( ̃h(Z 0) ≥ ˆCα,δ,ˆh − ε(cid:48)(cid:48)L| ˆCα,δ,ˆh) ≥ α − 2∆m0 eff ,δ} On the other hand, the lower bound on our condition gives that 2∆m0 eff ,δ > a, 2∆m0 eff ,δ ≤ P[C ∗ α, ̃h < ̃h(Z 0) ≤ C ∗ α, ̃h + (2B0∆m0 = P[ ̃h(X 0) ≤ C ∗ = P[ ̃h(X 0) ≤ C ∗ α, ̃h + (2B0∆m0 α, ̃h + (2B0∆m0 eff ,δ)1/γ0] eff ,δ)1/γ0 ] − P[ ̃h(X 0) ≤ C ∗ eff ,δ)1/γ0 ] − (1 − α). α, ̃h] Combining these two results we get that E0 ∩ E1 ⊆ {P[ ̃h(X 0) ≥ C ∗ α, ̃h + (2B0∆m0 eff ,δ)1/γ0] ≤ α − 2∆m0 eff ,δ ≤ P[ ̃h(X 0) ≥ ˆCα,δ, ̃h − ε(cid:48)L| ˆCα,δ,ˆh]}, and hence, E0 ∩ E1 ⊆ { ˆCα,δ,g < C ∗ α, ̃h + ε(cid:48)(cid:48)L + (2B0∆m0 eff ,δ)1/γ0} which implies that E0 ∩ E1 ⊆ {C ∗ α, ̃h ≤ ̃h(X 0) ≤ C ∗ α, ̃h + 2ε(cid:48)(cid:48)L + (2B0∆m0 eff ,δ)1/γ0} =: G(cid:48) 0. We can now use this to bound the expectation. Indeed using Lemma 17 we have that E0 ∩ E1 ⊆ {E[1{G0}| ̃h(Z 0) − C ∗ α, ̃h| |D(cid:48)] ≤ E[1{G(cid:48) 0}| ̃h(Z 0) − C ∗ α, ̃h||D(cid:48)]} 29 We we also have with E[1{G(cid:48) 0}| ̃h(Z 0) − C ∗ α, ̃h||D(cid:48)] ≤ (cid:16) 2ε(cid:48)(cid:48)L + (2B0∆m0 ≤ B2(2ε(cid:48)(cid:48)L + (2B0∆m0 eff ,δ)1/γ0 P(G(cid:48) 0) eff ,δ)1/γ0)γ1+1 (cid:17) B2 := min (cid:26) 1 B0aγ1/γ0 (cid:27) , B1 where the final step uses our probability lower bound. By an identical argument again E0 ∩ E1 ⊆ {E[1G1| ̃h(Z 0) − C ∗ α, ̃h| |D(cid:48)] ≤ B2(2ε(cid:48)(cid:48)L + (2B0∆m0 eff ,δ)1/γ0)γ1+1} and so we get E0 ∩ E1 ⊆ {R1( ˆφ) − R1( ̃φ) ≤ 2B2(2ε(cid:48)(cid:48)L + (2B0∆m0 eff ,δ)1/γ0)γ1+1 + 2C ∗ α, ̃h∆δ,m0 eff }. Taking C2 := 4B2(L ∨ B0)(γ1 + 1) + 2C ∗ α, ̃h therefore gives E0 ∩ E1 ⊆ {R1( ˆφ) − R1( ̃φ) ≤ ε(cid:48)} and hence, P(R1( ˆφ) − R1( ̃φ) ≤ ε) ≤ P(R1( ˆφ) − R1( ̃φ) ≤ ε, E0 ∩ E1) = P(E0 ∩ E1) = 1 − 2δ. B SUPPLEMENTARY METHODS B.1 f -Divergence based DRE We now present another example DRE which relates to the f -Divergence. First we state the following theorem on which these approaches are built Theorem 18. Let f : (0, ∞) → R be convex and lower-semicontinuous function and define f (cid:48) : R+ → R to be the derivative of f . Firstly, there exists unique f ∗ : A → R with A ⊆ R by Secondly, f ∗(t) := sup ut − f (u) u∈(0,∞) argmin T ∈T E[T (Z 1)] − E[f ∗(T (Z 0))] = T ∗ where, T ∗ := f (cid:48) ◦ r∗ and T is some set of non-negative functions containing T ∗. As a direct result of this, for any set of positive real values functions G containing r∗ we have that r∗ := argmax r∈G E[f (cid:48)(r(Z 1))] − E[f ∗(f (cid:48)(r(Z 0))] We can then approximate this using D to get 1 n1 n1(cid:88) i=1 f (cid:48)(r(Z 1 i )) − 1 n0 n0(cid:88) i=1 f ∗(f (cid:48)(r(Z 0 i ))) 30 Note that while we have theoretical guarantees of consistency in the case of correctly specified G, we have much less justification for this approach in the case of incorrectly specified G. This is simply because from a heuristic perspective, we have no idea if ̃r := argmax E[f (cid:48)(r(Z 1))] − E[f ∗(f (cid:48)(r(Z 0)))] r∈G is sensible approximation of r∗ when G is miss-specified. As a result, one could argue that KLIEP is a more principled approach as in the objective we are approximating we choose some notion of the "closest" r ∈ G to r∗. We now go on to expand this process in the case of 2 popular choice of f JS-Divergence If we take f (u) := u log(u) − (u + 1) log (cid:0) 1+u corresponding f (cid:48) : (0, ∞) → R, f ∗ : (log(2), ∞) → R are then given by 2 (cid:1) then the associated f -divergence is the JS-Divergence. The f (cid:48)(t) := log (cid:19) (cid:18) 2t 1 + t f ∗(t) := − log(2 − exp(t)) giving us that r∗ := argmax E[f (cid:48)(r(Z 1))] − E[f ∗(f (cid:48)(r(Z 0)))] r∈G = argmax r∈G = argmax r∈G E E (cid:20) log (cid:18) 2r(Z 1) 1 + r(Z 1) (cid:19)(cid:21) (cid:20) log (cid:18) r(Z 1) (cid:19)(cid:21) 1 + r(Z 1) (cid:18) (cid:18) (cid:20) (cid:20) log log + E + E (cid:19)(cid:21) (cid:19)(cid:21) 2 1 + r(Z 0) 1 1 + r(Z 0) for correctly specified G. The form that our approximation for this take is highly similar to the form of the logistic regression approach and is in fact identical when n1 = n0. The only difference being that this approach adjusts for the class imbalance directly in the estimator while the logistic regression approach adjusts for it after the fact. KL-Divergence If we take f (t) := t log(t) then the corresponding f -divergence is the KL-divergence. This choice of f has corresponding f ∗ : R → R, f (cid:48) : (0, ∞) → R defined by f ∗(t) := exp{t − 1} f (cid:48)(t) := 1 + log(t). Thus we get that r∗ := argmax E[f (cid:48)(r(X 1))] − E[f ∗(f (cid:48)(r(X 0)))] r∈G = argmax E[log(r(X 1))] − E[r(X 0)]. r∈G Note the objective of this estimator differs from KLIEP as E[r(X 0)] is not logged. B.1.1 Adaptations to MNAR Data Adapting this to work with D(cid:48) simply equates to modifying the objective to be 1 n1 n0(cid:88) i=1 1{X 1 i (cid:54)= ∅} 1 − φ1(X 1 i ) f (cid:48)(X 1 i ) − 1 n0 n0(cid:88) i=1 1{X 0 i (cid:54)= ∅} 1 − φ0(X 0 i ) f ∗(f (cid:48)(X 0 i )). 31 B.2 Original Neyman-Pearson Classification We now describe the Neyman-Pearson classification procedure laid out in (Tong et al., 2018). This procedure is describe in Algorithm 2 and constructs a classifier from our data. We assume we have n0 additional copies of Z 0 which we label Z 0 however the algorithm adapts to any number of samples from either distribution. We also let g : R → R be any strictly increasing function. Note that the classifier produced by the algorithm n0+1, . . . , Z 0 2n0 Algorithm 2 Neyman-Pearson Classification Procedure i }n0 i }n1 i=1, {Z 0 i=1 to estimate r∗ with ˆr by any DRE procedure. 1: Use {Z 1 2: Set i∗ = min{i ∈ {1, . . . , n0}|P(W ≥ i) ≤ δ} where W ∼ Binomial(n0, 1 − α) 3: For i ∈ {1, . . . , n0} compute ˆri := g ◦ ˆr(Z 0 n0+i) 4: Sort ˆr1, . . . , ˆrn0 in increasing order to get ˆr(1), . . . , ˆr(n0) with ˆr(i) ≤ ˆr(i+1) 5: Define ˆCα,δ,g◦ˆr := ˆr(i∗) 6: Define the classifier ˆφD by ˆφD(z) = 1{g ◦ ˆr(z) > Cα,δ,g◦ˆr} for all z ∈ Z. does not depend on g. Proposition 19. Algorithm 2 constructs a Neyman-Pearson classifier satisfying Equation (9). Proof. As the algorithm does not depend on g we take g as the identity in the proof. We adapt the proof given in (Tong et al., 2018). Let ˆr ∈ H and define A to be the event A := {P( ˆφD(Z 0) = +|D) > α}. We then aim to show that P(A|ˆr) ≤ δ. To this end let C ∗ α,ˆr := inf{C ∈ R|P(ˆr(Z 0) > C|ˆr) ≤ α}. Now as P(ˆr(Z 0) > C|ˆr) is a right continuous decreasing function we have that P(ˆr(Z 0) > Cα,ˆr|ˆr) ≤ α. Thus we can re-write A A = { ˆC < C ∗} = {ˆr(i∗) < C ∗} = {i∗ or more ofˆˆr1, . . . , ˆrn0 are less than C ∗} n0(cid:88) = { i=1 Bi ≥ i∗} where Bi := 1{ˆri < C ∗}. Hence we have P(A|ˆr) = P( n0(cid:88) Bi ≥ i∗|ˆr). i=1 n0+1, . . . , Z 0 As Z 0 that q := P(Bi = 1) ≤ 1 − α. If we now define W (cid:48) ∼ Binomial(n0, q), W ∼ Binomial(n0, 1 − α) we get that. are independent, we have that B1, . . . , Bn0 are independent given ˆr. Furthermore, we have 2n0 P(A|ˆr) = P(W (cid:48) ≥ i∗) ≤ P(W ≥ i∗) ≤ δ by definition of i∗. as q ≤ 1 − α Finally, as P(A|ˆr) ≤ δ for all non-negative measurable ˆr we have that P(A) ≤ δ. 32 B.3 Logistic Regression Re-adjustment Here we describe how to use the adjusted logistic regression described in King and Zeng (2001) to learn the φ under the scenario presented in Section 5.1. First define I = {i ∈ [n]|zi is observed} so that for i ∈ I either Xi (cid:54)= ∅ or we have queried Zi. We then refer to {(Wi, Zi)}i∈I as our set of fully observed samples. These fully observed samples will have disproportionally few Wi = 1 however {Zi|Wi = 1, i ∈ I}, {Zi|Wi = 0, i ∈ I} still give exact samples from Z|W = 1, Z|W = 0 respectively. King and Zeng (2001) propose a re-adjustment to logistic regression specifically for this case in which the true proportion each response are different to the proportion in your given data. Let ˆβ0, ˆβ1 be the logistic regression estimators for the coefficients of the intercept and slope respectively from our fully observed samples. Now let ˆτ be some consistent estimate of P(W = 1) and ˆτI = . Now define 1{Wi=1} |I| (cid:80) i∈I 0 = ˆβ0 − log ˆβ(cid:48) (cid:27) (cid:26) (1 − ˆτ )ˆτI ˆτ (1 − ˆτI Then ˆβ(cid:48) ˆτ = 0 and ˆβ1 are consistent estimates of the logistic regression parameters. In our case we will simply take i∈[n] wi=1 n . This allows us to simplify and get (cid:80) where n1 = (cid:80) i∈[n] 1{wi = 1} and m = (cid:80) i∈I ˆβ(cid:48) 0 = ˆβ0 − log {m/n1} 1{wi = 1} that is, the number of observations we have queried. C SYNTHETIC EXPERIMENT DETAILS C.1 5-dimensional Correctly Specified Case For setting we take Z1, Z0 to have PDFs defined by p1(z) = N (z; μ1, I) p0(z) = N (z; μ0, I) with μ0 = 0, μ1 = (0.1, 0.1, 0.1, 0.1, 0.1)(cid:62) and where N (z; μ, Σ) is the PDF of a multivariate normal distribution 1{x(cid:62)a > 0}, φ0 = 0 where a = (1, 1, 1, 1, 1)(cid:62). with mean μ and variance Σ evaluated at z. We take φ1(x) = 1 2 To estimate the density ratio, we use rθ(x) := exp{θ(cid:62)x} making the model correctly specified with "true" parameter ̃θ := −μ1. for given n ∈ N, n IID samples are drawn from both X 0 and X 1. M-KLIEP and CC-KLIEP are then fit using gradient simple gradient descent to obtain parameter estimates. This process is repeated 100 times for each n and with n ∈ {100, 200, 300, . . . , 1500}. C.2 Mixed Gaussian Neyman-Pearson Case For this experiment we take Z 1 and Z 0 to be 2-dimensional Gaussian mixtures with the following densities (cid:19) (cid:19) (cid:18) (cid:18) (cid:19) (cid:19) p1(z) = p0(z) = 1 2 1 2 N z; (cid:18) N z; (cid:18)0 0 (cid:19) (cid:18)1 0 , I + (cid:19) , I + N z; (cid:18) N z; 1 2 1 2 (cid:18)−1 4 (cid:19) (cid:18)0 4 , I (cid:19) , I Now let φ1 = 0.91Z(cid:62)a>2(Z) where a = (0, 1)(cid:62), φ0 = 0 and define X 1, X 0 on R2 ∪ {∅} as before. For given n ∈ N we generate n samples from X 0, X 1 and use these to estimate ̃r by both M-KLIEP and CC-KLIEP. An additional Z 0 = X 0 and these used to produce a classifier via Algorithm 2 with α = δ = 0.1. These samples are also used to produce a classifier via Algorithm 2 with ˆr replaced by r∗, the true density ratio. One instance of this procedure with n = 500 is presented in Figure 2 To estimate the power of the produced classifiers, 1,000,000 samples from Z 1 are produced and the proportion classified as 1 recorded. This process is then repeated for 100 times for each n ∈ {100, 200, 300, . . . , 1500}. The estimated powers of the classifiers produced from these iterations is then used to estimate the expected power of the procedures alongside 99% confidence intervals 33 Figure 6: The expected power of the Naive Bayes NP classifier for various levels of correlation between features. D ADDITIONAL SYNTHETIC EXPERIMENTS D.1 Naive Bayes Assumption Test We wanted to test the effect of our Naive Bayes assumption on our ability to estimate the density ratio. For this experiment we take Z0, Z1 to be distributed as follows: (cid:18)(cid:18)0 0 (cid:18)(cid:18)1 2 (cid:18)1 ρ ρ 1 (cid:18)1 ρ ρ 1 Z1 ∼ N Z0 ∼ N (cid:19)(cid:19) (cid:19)(cid:19) (cid:19) (cid:19) , , for varying ρ ∈ [0, 1]. To test our Naive Bayes assumption alongside our M-KLIEP approach we also induced non-uniform missingness separately in the features of the class 0 data. The missingness functions used were 1(x) = 0.8 * 1 {x > 0}, φ1 φ1 100 samples from X0, X1 were then generated, a density ratio fit through the Naive Bayes assumption, and then 100 more samples from X0 (equivalent to Z0) were used to produce an NP classifier. Figure 6 shows you the average power of the classifier alongside 95% C.I.s from 100 montecarlo simulations. 2(x) = 0.8 * 1 {x < 0} and then no missingness for class 0 i.e. φ0 1 ≡ φ0 2 ≡ 0. As we can see the Naive Bayes approaches only start seriously deviating from the performance of the true density at around ρ = 0.5 We also reassuringly see that M-KLIEP consistently outperforms CC-KLIEP. 34 0.00.20.40.60.8Correlation0.50.60.70.8Out of Sample PowerM-KLIEPCC-KLIEPTrue DR Figure 7: Expected power of NP classifier when used in conjunction with multiple DRE approaches for varying sample size. In this case our model is misspecified. D.2 Differing Variance Misspecified Test We have tried an additional misspecified case set up as follows Z1 ∼ N Z0 ∼ N (cid:19) (cid:18)(cid:18)0 0 (cid:19) (cid:18)(cid:18)1 1 , , (cid:18)1 0 (cid:18)1 0 (cid:19)(cid:19) 0 1 (cid:19)(cid:19) 0 2 We then introduced complete missingness in class 1 with φ1(x) = 0.8 * 1 {x1 > 0} and no missingness in class 0 (φ0 ≡.) We then used the log-linear form for our density ratio estimate with f (x) = x which leads to an incorrectly specified model (f (x) = (x(cid:62), x2(cid:62) )(cid:62) would lead to a correctly specified model.) For various values of n, we then generate n samples from X0, X1 and a density ratio was then fit using M-KLIEP and CC-KLIEP. An additional n samples from X0 (equivalent to Z0) were used to produce an NP classifier. Figure 7 shows one simulation in this case alongside the classification boundaries produced. We can see that with this misspecified parametric boundary our model will always approximate the true boundary relatively crudely however we can clearly see that the M-KLIEP boundary is a more sensible approximation than the CC-KLIEP boundary Figure 8 shows you the estimated expected power of the classifiers produced alongside 95% C.I.s from 100 montecarlo simulations (where 1,000,000 additional samples from Z1 were used to estimate the power of the classifier in each simulation.) This definitively shows M-KLIEP has better performance than CC-KLIEP. While M-KLIEP does perform worse than the true classification boundary this decrease is not drastic. 35 250500750100012501500Sample Size0.300.350.400.45Out of Sample PowerKLIEP MissKLIEP NaiveTrue R Figure 8: Scatter plot of D alongside classification boundaries produced from corresponding D(cid:48) via various procedures. If Xi = ∅ then Zi is faded out. 36 −4−20246x(1)−4−202468x(2)Class 1Class 0: 1 - nClass 0: n+1 - 2nDRE ProcedureTrue DRM-KLIEPCC-KLIEP Figure 9: Expected power of NP classifier produced via various DRE techniques for varying levels of misspecifi- cation. We take misspecification to be 2 ∗ ρ. D.3 Varying Misspecificaiton Level In this experiment we wanted to examine the effect of the level of misspecification on our model. To do this we let Z1, Z0 have pdfs defined as follows (cid:18) p1(z) = (1 − ρ)N z; p0(z) = (cid:18) N z; (cid:19) (cid:18)1 0 1 2 (cid:19) (cid:18)0 0 (cid:19) , I (cid:19) (cid:18) , I + ρN z; (cid:19) (cid:18)2 0 (cid:19) , I for various ρ ∈ [0, 0.5]. We then introduced complete missingness in class 1 with φ1(x) = 0.8 * 1 {x1 > 0} and no missingness in class 0 (φ0 ≡.) We then used the log-linear form for our density ratio estimate with f (x) = x which leads to an incorrectly specified model for ρ > 0 with larger values of ρ leading to greater levels of misspecification. We then generate 100 samples from X0, X1 and a density ratio was fit using M-KLIEP and CC-KLIEP. An additional 100 samples from X0 (equivalent to Z0) were used to produce an NP classifier. Figure 9 shows you the average power of the classifier alongside 95% C.I.s from 100 montecarlo simulations (where 1,000,000 additional samples from Z1 were used to estimate the power of the classifier in each simulation.) E REAL WORLD EXPERIMENT DETAILS Here we give additional information on the experiments performed on the real world data. We start off by describing each of the three datasets. 37 0.00.20.40.60.81.0Misspecification level0.350.400.450.50Out of Sample PowerKLIEP MissKLIEP NaiveTrue R E.1 Datasets E.1.1 CTG Foetal Cardiotocograms (CTGs) measure the babies heart function during labour. These are then used by doctors and nurses and then used as a diagnostic tool to assess the foetus' health. In our data-set we have numerical summaries of foetal CTGs which alongside the diagnoses of one of "normal", "suspect", or "pathologic" that doctors ascribed to associated foetuses. We aim to create an automated diagnosis procedure which will determine from the summaries whether the foetus is "normal" (class 1) and therefore needs no additional attention/ intervention, or one of "suspect" or "pathologic" (Class 0) to and hence needing further follow up. It is clear that NP classification as a well suited classification procedure to this paradigm as we would like to strictly control the probability of miss-classifying a "suspect" or "pathologic" baby as "normal". The data is taken from: https://archive.ics.uci.edu/ml/datasets/cardiotocography and was first presented in de Campos et al. (2000). This data contains observations of 2129 foetuses, 1655 from class 1 and 474 from class 0. From the data we select 10 features which we describe below We split the data as follows, 237 & 1555 samples from Class 0 & 1 to fit ˆr, 237 samples from Class 0 are used to fit the threshold of the classifier, and 100 samples from Class 1 are used to estimate the power of the classifier. When φ are learned we query 10 missing samples from each feature. E.1.2 Fire For multiple different fires and non-fires, various different environmental readings were taken such as Tempera- ture, Humidity and CO2 concentration. The aim of this is to be able to classify whether or not a fire is present to create a sort of IOT (internet of things) smoke detector to detect the presence of fire. Again NP classification is clearly a good fit as falsely detecting a fire is far less damaging than missing a fire. As such, we take the presence of fire as our error controlled class (Class 0) as we want to strictly control the probability of not detecting a fire which is present. This data is taken from: https://www.kaggle.com/datasets/deepcontractor/smoke-detection- dataset. This dataset consists of 62,630 observations of 12 features. The observations consist of 17,873 observations from Class 1 and 44,757 from Class 0. Before carrying out any of our procedures we perform minimal feature manipulation by trimming extreme values for some of the features as described below: • TVOC(ppb), eCO2(ppm): Values are trimmed to not exceed 1000. • PM1.0, PM2.5: Values are trimmed to not exceed 1. • NC0.5, NC2.5: Values are trimmed to not exceed 5. E.1.3 Weather A dataset containing various weather reading for different days in Australia collected with the aim of using the previous days weather to predict whether there is a chance on the following day. We want to be able to choose what we mean by a "chance" in terms of the probability of our classifier correctly predicting rain when it is present therefore motivating the use of NP classification. As such we take the event of rain the following day to be our error controlled class (Class 0.) This data is taken from: https://www.kaggle.com/datasets/jsphyg/weather- dataset-rattle-package. This dataset consists of 142,193 observations of 20 features. The observations consist of 110,316 observations from Class 1 and 31,877 from Class 0. Before carrying out any of our procedures we perform minimally feature manipulation by trimming extreme values for some of the features. Factor variables are split into indicator variables for each of the possible outcomes, with one outcome having no indicator to avoid redundancy. Continuous features are trimmed to be within 5 IQR (inter-quartile range) of the median. This data manipulation lead to a total of 62 dimensions in our final data. 38 E.2 Experimental Designs For each of the datasets, the same overall experimental design is used. Firstly data is randomly split into train (Class 0 & 1)/calibrate (Class 0)/test (Class 1) datasets of sizes given below. Any missing values originally in the data set are then imputed using simple mean imputation. Next the data is normalised to reduce the risk of numerical precision issues within our algorithms. The Class 0 training data is then corrupted along each dimension using φj of the form φj(z) := (1 + exp{τj(a0,j + a1,jz)})−1. This φj is then estimated by querying points as described in Section 5.1. The density ratio is then fit by M-KLIEP, CC-KLIEP on the training data. Alongside this, we also fit the density ratio using M-KLIEP with the true φj and KLIEP with the original non-corrupted training data as benchmarks. A classifier is then constructed from these estimated density ratios using the calibration data by the procedure described in Algorithm 2 with given α, δ. The testing data is then used to estimate the power of these classifiers. Multiple iterations of this process are performed with random train/calibrate/test splits (of fixed size) and random τj ∈ {−1, 1} for each iteration. The estimated powers from these iterations are then used to calculate the pseudo expected power and 95% C.I.s For experiment 1, we vary α ∈ {0.05, 0.1, 0.15, 0.2, 0.25, 0.3} with δ = 0.05, aj,0 = −μj/σj, aj,1 = 1/σj where μj, and σj are the sample mean and variance of feature j. For experiment 2 this process is repeated with varying aj,1 with α = 0.1, δ = 0.05, aj,1 = σj. The aj,0 are chosen to produce the following proportions of missing values for each feature: {0.1, 0.2, 0.3, . . . , 0.9}. Dataset specific experimental design information can be found below E.2.1 Dataset specific experimental design CTG The size of the data splits are as follows, Class 0 train = 237, Class 1 train = 1555, Class 0 calibrate = 237, and Class 1 test 100.We query 10 missing samples from each feature when learning φj. For both experiments 1,000 iterations are run. Fire The sample sizes of the data splits are as follows, Class 0 train = 20, 000, Class 1 train = 12, 873, Class 0 calibrate = 24, 757, and Class 1 test = 5, 000. We query 50 missing samples from each feature when learning φj. For both experiments, 100 iterations are run. Weather The size of the data splits are as follows, Class 0 train = 15, 000, Class 1 train = 100, 316, Class 0 calibrate = 16, 877, and Class 1 test = 10, 000. We query 50 missing samples from each feature when learning φj. For experiment 1, 100 iterations are run; for experiment 2, 30 iterations are run. E.3 Additional Missing Data Approaches imputation approach implemented using the We also compared our approached to an iterative sklearn.impute.IterativeImputer module in Python using the default estimator BayesianRidge(). For fair comparison, this imputed data was then used to perform Naive Bayes DRE to make it comparable to our approach. Results of these additional experiments are given in figures 10 & 11 and described below. E.3.1 Additional Results Here we present the same results as the paper but with the iterative imputation method included. Figure 10 shows the out of sample power of various NP classifiers for varying Type I error we can see that the additional iterative imputation method seems to perform comparably or worse than our method for each data set Figure 11 shows the out of sample power of various NP classifiers for varying levels of missingness. Here we see that as the level of missingness increases, the iterative imputation method degrades significantly leading it to perform significantly worse than our approach. It does however consistently perform better than the complete case approach 39 (a) CTG Dataset. (b) Fire Dataset. (c) Weather Dataset. Figure 10: Out of sample power with pseudo 95% C.I.s for various different target Type I errors with iterative imputation approach included. (a) CTG Dataset. (b) Fire Dataset. (c) Weather Dataset Figure 11: Out of sample power with pseudo 95% C.I.s for various φ and varying missing proportions with iterative imputation approach included. F SOCIETAL IMPACT We now briefly discuss the societal impact of our work. As we have shown, ignoring MNAR data can lead to degradation in performance. Perhaps worse than this however is that, without taking account of our MNAR structure, use of the original NP classification procedure won't guarantee our desired Type I error with high probability. This could lead to classifiers which perform far worse on our error controlled class than estimated. The impact of this could be serious in the case of say disease detection where we believe our classifier to be detecting a far higher proportion of diseased individuals than it truly is. The impact of MNAR data on analysis has been explored before in more general settings (Rutkowski, 2011; Padgett et al., 2014; Goldberg et al., 2021) with the key takeaway always being that ignoring the structure of the missingness can negatively impact your results and lead to false inference. 40 0.050.100.150.200.250.30Fixed Type 1 Error0.550.600.650.700.750.800.85Out of Sample PowerKLIEP (full dataset)M-KLIEP (known φj)M-KLIEP (estimated φj)CC-KLIEPMICE0.050.100.150.200.250.30Fixed Type 1 Error0.30.40.50.60.70.80.9Out of Sample PowerKLIEP (full dataset)M-KLIEP (known φj)M-KLIEP (estimated φj)CC-KLIEPMICE0.050.100.150.200.250.30Fixed Type 1 Error0.00.10.20.30.40.50.60.7Out of Sample PowerKLIEP (full dataset)M-KLIEP (known φj)M-KLIEP (estimated φj)CC-KLIEPMICE0.00.20.40.60.8Proportion of Values Missing0.640.660.680.700.72Out of Sample PowerM-KLIEP (known φj)M-KLIEP (estimated φj) CC-KLIEPMICE0.00.20.40.60.8Proportion of Values Missing0.30.40.50.60.7Out of Sample PowerM-KLIEP (known φj)M-KLIEP (estimated φj) CC-KLIEPMICE0.00.20.40.60.8Proportion of Values Missing0.100.150.200.250.300.350.40Out of Sample PowerM-KLIEP (known φj)M-KLIEP (estimated φj) CC-KLIEPMICE
http://arxiv.org/abs/2302.10639v1
2023-02-21T12:57:12
2023-02-21T12:57:12
Conditioning Hierarchical Reinforcement Learning on Flexible Constraints
Safety in goal directed Reinforcement Learning (RL) settings has typically been handled through constraints over trajectories and have demonstrated good performance in primarily short horizon tasks (goal is not too far away). In this paper, we are specifically interested in the problem of solving temporally extended decision making problems such as (1) robots that have to clean different areas in a house while avoiding slippery and unsafe areas (e.g., stairs) and retaining enough charge to move to a charging dock; (2) autonomous electric vehicles that have to reach a far away destination while having to optimize charging locations along the way; in the presence of complex safety constraints. Our key contribution is a (safety) Constrained Planning with Reinforcement Learning (CoP-RL) mechanism that combines a high-level constrained planning agent (which computes a reward maximizing path from a given start to a far away goal state while satisfying cost constraints) with a low-level goal conditioned RL agent (which estimates cost and reward values to move between nearby states). A major advantage of CoP-RL is that it can handle constraints on the cost value distribution (e.g., on Conditional Value at Risk, CVaR, and also on expected value). We perform extensive experiments with different types of safety constraints to demonstrate the utility of our approach over leading best approaches in constrained and hierarchical RL.
[ "Yuxiao Lu", "Pradeep Varakantham", "Arunesh Sinha" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10639v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10639v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.AI", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.AI", "cs.LG" ]
Conditioning Hierarchical Reinforcement Learning on Flexible Constraints Yuxiao LU1 , Pradeep VARAKANTHAM1 , Arunesh SINHA2 1Singapore Management University 2Rutgers University [email protected], [email protected], [email protected] 3 2 0 2 b e F 1 2 ] I A . s c [ 1 v 9 3 6 0 1 . 2 0 3 2 : v i X r a Abstract Safety in goal directed Reinforcement Learning (RL) settings has typically been handled through constraints over trajectories and have demonstrated good performance in primarily short horizon tasks In this paper, we (goal is not too far away). are specifically interested in the problem of solv- ing temporally extended decision making problems such as (1) robots that have to clean different areas in a house while avoiding slippery and unsafe areas (e.g., stairs) and retaining enough charge to move to a charging dock; (2) autonomous electric vehicles that have to reach a far away destination while hav- ing to optimize charging locations along the way; in the presence of complex safety constraints. Our key contribution is a (safety) Constrained Planning with Reinforcement Learning (CoP-RL) mechanism that combines a high-level constrained planning agent (which computes a reward maximizing path from a given start to a far away goal state while satisfying cost constraints) with a low-level goal conditioned RL agent (which estimates cost and reward values to move between nearby states). A major advantage of CoP-RL is that it can handle constraints on the cost value distribution (e.g., on Conditional Value at Risk, CVaR, and also on expected value). We perform extensive experiments with different types of safety constraints to demonstrate the utility of our approach over leading best approaches in con- strained and hierarchical RL. 1 Introduction Reinforcement Learning (RL) is a framework to represent de- cision learning problems in environments that have an un- derlying (Partially Observable) Markov Decision Problem, (PO-)MDP. Deep Reinforcement Learning [Franc ̧ois-Lavet et al., 2018; Hernandez-Leal et al., 2019] approaches have been shown to solve large and complex decision making problems. For RL agents to be relevant in the day-to-day activities of humans, they would need to handle a wide variety of tempo- rally extended tasks while being safe. A few examples of such multi-level tasks are: (a) planning and searching for valuable targets by robots in challenging terrains (e.g., disaster prone areas) while navigating safely and preserving battery to reach a safe spot; (b) for autonomous electric vehicles to travel long distances in minimum time, they would need to optimize the position of recharge locations along the way to ensure the ve- hicle is not left stranded; (c) cleaning robots to clean a house, while avoiding slippery and unsafe areas (e.g., stairs) and re- taining enough charge to move to a charging dock. The fol- lowing key challenges need to be addressed together in the above mentioned problems of interest: • Solving temporally extended decision making problems in the presence of uncertainty. • Considering safety constraints over cost value distribu- tion, that is associated with the execution policy. Existing research in solving temporally extended decision making problem has focused on hierarchical RL methods to handle long horizon multi-level tasks [Nachum et al., 2018; Zhang et al., 2020; Kim et al., 2021; Levy et al., 2017]. While all these approaches are able to solve long horizon decision making tasks, they are unable to deal with safety constraints. On the other hand, most existing research in handling tra- jectory based safety constraints has focused on constrained RL [Satija et al., 2020; Chow et al., 2017; Sim ̃ao et al., 2021; Gattami et al., 2021] approaches, where constraints are en- forced on expected value of the cost value distribution. A re- cent method that has considered percentile based constraints is WCSAC [Yang et al., 2021]. Unfortunately, all these con- strained RL approaches are typically only able to solve short horizon problems where the goal is not too far away. We address the need to bring together these two threads of research on hierarchical RL and constrained RL, which have mostly progressed independently of each other. Contributions: To that end, we propose a new Constrained Planning with Reinforcement Learning (CoP-RL) approach, where there is a hierarchy of decision models: (a) The lower level employs goal conditioned RL to learn reward and cost estimates to move between two given states (origin and a local (b) The upper level is a goal) that are near to each other. constrained planner that builds on Informed RRT* [Gammell et al., 2014] to identify the best policy to get from a given start state to a goal state that is typically "far" away from the start state. This is achieved while ensuring overall cost constraints (representative of safety and other measures) are enforced. There are multiple key contributions with regards to CoP- RL. First, we provide a constrained planning approach that is extremely scalable for long horizon tasks. Second, we are able to handle both percentile and expected constraints on cost distribution. Third, the design of enforcing the con- straints at the upper-level planner allows fast re-computation of polices in case the constraint threshold changes. Finally, as shown in our extensive comparisons on benchmark prob- lems, CoP-RL outperforms leading approaches across path planning, constrained MDPs and hierarchical RL. Related Work: Constrained Reinforcement Learning uses the Constrained Markov Decision Process (CMDP) to max- imize a reward function and satisfy constraints rather than designing policy through the reward function only [Satija et al., 2020; Achiam et al., 2017; Gattami et al., 2021; Chow et al., 2017; Tessler et al., 2018; Liang et al., 2018; Chow et al., 2018]. WCSAC [Yang et al., 2021] extends Soft Actor-Critic and considers a certain level of CVaR from the distribution as a safety measure to judge the constraint sat- isfaction. Using an abstract model [Sim ̃ao et al., 2021] to learn policies can autonomously find tradeoffs between per- formance and safety. As far as we know and from bench- marking work [Ray et al., 2019], there is no constrained RL designed for long-horizon tasks, and even for short-horizon task all current approaches need to be retrained if the con- straint thresholds changes. Hierarchical Reinforcement Learning (HRL) address the long standing problem of learning, planning, and represent- ing knowledge at multiple levels of abstraction [Kulkarni et al., 2016]. The problem could be formulated with the frame- work of MDP and semi-MDP (SMDP) [Sutton et al., 1999]. The MAXQ decomposition is the prototype of HRL and it decomposes the value function of a target MDP into a addi- tive mixture of value functions of smaller MDPs [Dietterich, 2000]. Benefiting from off-policy RL algorithms, a num- ber of recent methods such as HIRO [Nachum et al., 2018], HRAC [Zhang et al., 2020], and HIGL [Kim et al., 2021] propose a hierarchy where both lower and upper level are RL learners and the higher level specifies sub-goals [Kael- bling, 1993] for the lower level RL. However, it's hard to add safety or resource constraints to such HRL with both levels as RL agents because to enforce constraints the higher level policy must also generate constraint thresholds for the lower- level agent, while also ensuring the budget used by invoking the lower-level agent multiple times does not exceed the total cost budget. Also, the lower-level policy should be able to maximize reward for any given cost threshold in the different invocations by the upper level. However, both these tasks are not practicable with the existing results in constrained RL. Closer to our method, SORB [Eysenbach et al., 2019] em- ploys a planner at the higher level that uses a graph-based path-planning algorithm (Dijkstra's algorithm), where the whole continuous state is discretized to yield a massive graph. SORB achieves better success rate in complex maze environ- ments compared to other HRL techniques but cannot enforce constraint and has high computational cost due to a large graph. We present a thorough comparison of our Constrained Informed RRT* to SORB's planner in Section 3.2. Options or skills learning coupled with a higher level policy of choos- ing options is another approach [Eysenbach et al., 2018; Kim et al., 2019] in HRL. CoP-RL can be viewed as learning primitive skills of reaching local goals, and the simplicity of this lower task as well as of the planner makes our approach scalable and flexible. Additional related work on constrained planning and model based RL are in the appendix. 2 Problem Formulation In problems of interest, we have an agent that is interact- ing with an environment. The agent observes its current s ∈ S, where S ⊂ Rn is a continuous state space. The initial state so for each episode is sampled according to a specified distribution and the agent seeks to reach goal state sG. The agent's action a ⊂ Rn is continuous. The episode terminates as soon as the agent reaches the goal, or after T steps, whichever occurs first. The agent earns immediate rewards, rt(st, sG, at) and separately also incurs immediate costs, ct(st, sG, at) when acting in each time step t. V π(so, sG) and V π c (so, sG) refer to the cumulative undis- counted reward and cost respectively for reaching goal state, sG from origin state, so following policy π. The typical opti- mization in constrained RL [Achiam et al., 2017] is: V π(so, sG) max π s.t. V π (1) where expectation over random policy and environment spec- ifies the value functions: c (s0, sG) ≤ K V π(so, sG) = E(cid:2) c (so, sG) = E(cid:2) V π T (cid:88) t=0 T (cid:88) rt(st, sG, at)|so ct(st, sG, at)|so (cid:3) (cid:3) (2) t=0 However, in the above, the constraint is only on the ex- pected cost value and is not always suitable to represent con- straints on safety. For instance, to ensure an autonomous electric vehicle is not stranded on a highway, we need a constraint that ensures the chance of that happening is low and we cannot ensure that with an expected cost constraint. Therefore, we consider another type of the cost constraint in which we require that the CVaR [Rockafellar et al., 2000] of the cost distribution (given by the bold font random vari- able Vπ c (so, sG)) is less than a threshold. We skip writing so, sG when implied. Intuitively, Value at Risk, V aRα rep- resents the minimum value for which the chance of violating the constraint (i.e., Vπ c > k) is less than α. V aRα(Vπ c ) = inf{k | P r(Vπ Conditional VaR, CV aRα intuitively refers to the expecta- tion of values that are more than the V aRα, i.e., c ) = E[Vπ c ≥ V aRα(Vπ CV aRα(Vπ c > k) ≤ α} c | Vπ c )] When using this variant of the cost constraint (referred to also as percentile based constraint), we replace the threshold con- straint in optimization (1) with CV aRα(Vπ (3) for a given α. Note that α = 1 is completely risk-neutral, i.e., CV aR1(Vπ c , and α close to 0 is completely risk-averse. c ) = E[Vπ c ] = V π c ) ≤ K 3 Approach Overall, our approach maximizes the long-term reward satis- fying the percentile cost constraint in Eq. (3); we can also eas- ily consider expected cost by setting α = 1. As stated earlier, our approach referred to as Constrained Planning with Rein- forcement Learning (CoP-RL) employs a lower-level learn- ing agent and an upper-level planning agent. The upper-level agent is constructed using a constrained planning algorithm, whereas the lower-level agent is constructed using a goal- conditioned [Kaelbling, 1993] off-policy RL agent which di- rectly interacts with the environment. Through its interac- tions with the environment, the lower-level agent learns re- ward and cost estimates between states that are "near" to each other. Then, the upper-level agent uses reward and cost esti- mates provided by the lower-level agent to compute a policy to get to the main goal while satisfying the cost constraints. 3.1 Lower Level Agent As we care about cost distribution (due to cost constraint in Eq. (3)) , we need to estimate the distribution of Vπ c for the π that maximizes expected V π(s, s(cid:48)) for nearby s, s(cid:48). While it would suffice to use a standard RL method to maximize ex- pected V π(s, s(cid:48)), it is known from literature that learning the distribution of Vπ and then calculating expected value leads to better estimates [Eysenbach et al., 2019]. Thus, we use distributional RL for both reward and cost distribution esti- mation. Distributional RL learns a policy ˆπ and in the pro- cess maintains a network that represents the distribution of Q which we describe next; after that we show how to derive V, Vc from the learned policy ˆπ. Distributional value functions: We use distributional RL [Bellemare et al., 2017] to estimate the distribution of the reward random variable Q [Eysenbach et al., 2019]. In distributional RL, the possible Q value estimates are assumed to be one of N discrete values. The distribution of Q is rep- resented by Qθ (neural network parameterized by θ), which takes as input s, a and outputs a vector [p1, . . . , pN ] where pi is the probability of Q value taking the ith discrete value. We write r(s, sg, a) = i to mean that the immediate reward takes the ith discrete value, with rounding used for reward values returned in between the equispaced discrete values. We also abuse notation in the distributional RL setting to use Q(*, *, *) to represent a vector of probabilities instead of a scalar num- ber. Let the function f denotes as accumulated right shift as f ([p1, . . . , pN ], 1) = [0, p1, . . . , pN −1, pN −1 + pN ] and recursively f ([p1, . . . , pN ], i) = f (f ([p1, . . . , pN ], i − 1), 1). Given action a in state s that leads to a state s(cid:48) and the current Qθ(s, sg, a) = [p1, . . . , pN ], a target Qt is defined as Qt(s, sg, a) = (cid:26) [1, 0, 0, ..., 0] [f ([p1, . . . , pN ], i) s(cid:48) = sg s(cid:48) (cid:54)= sg ∧ r(s, sg, a) = i (4) Note that adding a positive number to a distribution is same as shifting the distribution by that number, but due to fi- nite representation, we accumulate the probability in the this accumulation and the rounding last bin (see Fig. 1); of r to discrete values form the two sources of represen- tation error in distributional RL [Bellemare et al., 2017; Figure 1: An illustration of updating the distributional Q value with N = 7 and r(s, sg, a) = 2. Eysenbach et al., 2019]. Then we update Qθ by minimizing the KL-divergence: DKL(Qt||Qθ) min θ (5) The above approach yields a trained policy ˆπ. For training, we choose nearby start and goal states at random throughout the state space, ensuring that the local estimates generalize to any nearby start and goal in the whole state space. We then use the technique in [Schaul et al., 2015] to get the distributional value function estimate of the policy ˆπ, as described next. Again we represent the distribution of reward Vˆπ as a neural network V w that outputs a vector of proba- bility. The fixed learned policy ˆπ allows us to estimate V w directly by minimizing the KL divergence between a target V t(s, s(cid:48)) = Qθ(s, s(cid:48), a), a ∼ ˆπ(*|s, s(cid:48)) and the current V w: DKL(V t||V w) min θ (6) We optimize the above by storing experiences sampled ac- cording to ˆπ is a replay buffer and sampling mini-batches to minimize the loss above, analogous to supervised learning. Once the vector of probabilities V w is obtained, we can ob- tain expected V by calculating the expectation. For our spe- cific problems in path planning, reward r is set to be −1 for V such that the learned reward value function −V reflects the estimated length of the shortest path (considering impen- etrable obstacles) from so to sg as done in [Kaelbling, 1993; Eysenbach et al., 2019]. In particular, we assume that −V is learned accurately and prove the following result, which is needed for the analysis of the higher level agent. Lemma 1. Considering obstacles, the shortest path length between two points, as learned by −V , is a distance metric. Next, for costs, we note that we performed the reward es- timation without considering the costs. This is because in our approach the lower-level agent does not enforce the con- straints. However, the lower level agent does estimate the local costs. Again, similar to above learning of V w, the fixed learned policy ˆπ allows us to estimate the vector of proba- bility V w function directly by minimizing the KL divergence c between the target V t c (same as in Equation 4 but with c in- stead of r and action a ∼ ˆπ) and the current V w c : min θ DKL(V t c ||V w c ) (7) Algorithm 1: ConstrainedRRT* (so, sG, V, Vc, K) 1 V ← {so}, E ← ∅ , Ssoln ← ∅, T = (V, E) 2 for iteration = 1 ... N do 3 rbest ← minσ∈Ssoln{−Rσ} ∪ {∞} srand ← Sample(so, sG, rbest) snearest ← Nearest(T , srand) snew ← Steer(snearest, srand, min(rRRT ∗, η)) Snear ← Near(T , snew, min(rRRT ∗, η)) smin ← snearest rmin ← −R(smin) − V (snearest, snew) for ∀snear ∈ Snear do if Valid edge(T , snear, snew, Vc, K) then rnew ← −R(snear) − V (snear, snew) if rnew < rmin then smin ← snear, rmin ← rnew if Valid edge(T , smin, snew, Vc, K) then V ← V ∪ {snew} , E ← E ∪ {(smin, snew)} for ∀snear ∈ Snear do if Valid edge(T , snew, snear, Vc, K) then rnear ← −R(snear) rnew ← −R(snew) − V (snew, snear) if rnew < rnear then sparent ←Parent(snear) E ← E\{(sparent, snear)} V ← V ∪ {snew} E ← E ∪ {(snew, snear)} if InGoalRegion(snew) then Form σ by tracking parents of snew Ssoln ← Ssoln ∪ {σ} 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 return T 3.2 Upper Level Agent Once the lower-level RL training is complete, we obtain a local goal-conditioned value function for any origin and local goal state that are near to each other. In this section, we use the learned expected value V and cost random variable Vc (removing superscripts for notation ease). First, we formulate the upper-level optimal constrained planning problem. • S ⊂ Rn is the state space of the environment. so ∈ S is the start/origin state and sg is the goal state, where sg might not be near so. • Sf ree is the set of states that are not in any obstacle. • σ : [0, 1] → Sf ree is a sequence of states (a path) with σ(0) = so and σ(1) = sg. Σ is the set of all paths. In practice, every path is represented by a discrete number of states {σ(xi)}i∈[n] for 0 = x0 < x1 < ... < xn−1 < xn = 1 and some positive integer n (n can be different for different paths). Given the discrete representation, the path traversed between σ(xi) and σ(xi+1) is determined by the lower-level agent's policy. • Every path σ ∈ Σ provides a reward Rσ and incurs a cost Cσ. We define the reward for each segment (σ(xi), σ(xi+1)) of a path as V (σ(xi), σ(xi+1)) where V is the local goal-conditioned value function learned by the lower-level agent. Similarly, the cost incurred for seg- ment (σ(xi), σ(xi+1)) is Vc(σ(xi), σ(xi+1)). Thus, for a path σ represented using n + 1 states Rσ = Cσ = n−1 (cid:88) i=0 n−1 (cid:88) i=0 V (σ(xi), σ(xi+1)) Vc(σ(xi), σ(xi+1)) (8) (9) The optimal constrained planning problem is to search for the optimal path, σ∗ (∈ argmaxσ∈Σ Rσ) connecting so to sg subject to a cost threshold K, i.e., CV aRα(Cσ∗ ) ≤ K. As −V is the shortest distance considering obstacles (see text before Lemma 1), the above optimization is essentially find- ing the shortest path measured in distance −V from so to sG avoiding all obstacles and within the cost constraint K. With regards to planning, our approach has immediate ad- vantages over the state-of-the-art SORB, which also employs a planner at the upper level and RL at lower level. SORB [Ey- senbach et al., 2019]) distributes nodes in the entire state space, constructs a complete graph and then computes short- est path using Dijkstra's algorithm. However, such an ap- proach has multiple fundamental limitations: • No prior knowledge of the state space (obstacles etc.), start state and goal state, which can result in bad distri- bution of nodes in the state space. • In addition, due to the coarse discretization such an ap- proach can result in a non-optimal path between start and goal state [Karaman and Frazzoli, 2011]. • Construction of complete graph yields a complexity of O(N 2) for Dijkstra's algorithm for N nodes. Hence, a classical path finding approach with the large con- structed graph does not scale and as a result SORB is subop- timal in many cases (as shown in our experiments). Thus, an online planning method that samples and grows a tree from the given start to the goal state is more suited as the upper-level planner, and hence we provide Constrained- RRT*, which builds on the Informed-RRT* [Gammell et al., 2014] planning algorithm to handle constraints. Informed- RRT* builds upon RRT* [Karaman and Frazzoli, 2011], which works by constructing a tree whose root is the start state and iteratively growing the tree by randomly sampling new points as nodes till the tree reaches the goal. In informed RRT*, as an informed heuristic, the sampling is restricted to a specially constructed ellipsoid and further refinement of the best solution so far continues till a fixed number of iterations. However, both Informed-RRT* and RRT* do not take con- straints into account. Algorithm Description: We propose Constrained RRT* (Al- gorithm 1), which builds on Informed RRT* to handle the cost constraint. The pseudocode is provided in Algorithm 1. We search for the optimal path σ∗ to a planning problem by incrementally building a tree T in the state space S. The tree, T consists of a set of nodes, V (⊂ S), and edges E (⊂ S × S. A candidate state snew is chosen (line 6) to be added to the treeT by sampling srand (line 4) within an ellipse with focal points as so and sG and axis lengths as rbest and Figure 2: Constrained RRT* example. The red square is a high cost region. The center of the dashed circle (of radius min(rRRT ∗, η)) is the new sampled state that is a candidate to add to the tree with root O. The states in the dashed circle are "near" based on the low-level agent's value estimates. (a) When the planner tries to extend the tree to include state C, the edge (O, C) is not valid because C is not within the dashed circle. Although both A and B are within the circle, the path from O to C via B is better as V (O,B) +V (B,C) < V (O,A) +V (A,C) using low-level agent's V function. Hence, edge (B, C) is added to the tree. (b) When trying to extend to a new state E, E is "near" from C and D, but the edge (C, E) is not valid because of Vc(O, B) +Vc(B, C) +Vc(C, E) > K. (c) A path (O, B, C, D, E, G, goal) that does not violate the cost constraints is found. (d) As the number of sampled states increases, a better path (O, B, I, D, E, G, goal) is found. During execution, the lower-level agent is guided by this sequence of the waypoints in the best path found. best − r2 (cid:112)r2 min, where rbest (line 3) is the length of the cur- rent best solution in Ssoln or infinite if Ssoln is empty1 .In case srand is far from the nearest node snearest in T (line 5), then the Steer function in line 6 chooses a point snew within the min(rRRT ∗, η) distance ball centered at snearest that is also the closest to srand. This hyper-parameter η accounts for the fact that our distance estimates are precise only lo- cally. The rewiring radius, rRRT ∗ = γRRT ∗(log n/n)1/d, where n is the current number of nodes sampled, is described in [Karaman and Frazzoli, 2011]. Then, if the candidate edge (snearest, snew) is valid then other nodes (set Snear in line 7) that are within distance min(rRRT ∗, η) of snew are con- sidered as possible connections to snew. The node smin (line 10-14) that results in shortest path (highest reward) is con- nected to snew in line 16, if the edge is valid. Here, we take a detour to explain how we determine the validity of edges. An edge is valid if and only if adding it does not result in a (partial) path that violates the cost con- straint. The key insight is that this validity can be determined by computing the convolution of the distributions associated with the (partial) path and the current Vc. By providing the definition of Valid edge (T , s, s(cid:48), Vc, K) in Algorithm 2 and doing the Valid edge checks in lines 11, 15 and 18 of the Con- strained RRT* algorithm, we ensure that any path output by the overall algorithm will satisfy the cost constraints. In the pseudocode of Valid edge (T , s, s(cid:48), Vc, K), Vc represents a random variable (and so does result). Then, the addition in line 3 of Valid edge is a convolution operation (recall that the distribution of a sum X + Y of two random variables X, Y is found by a convolution [Ross, 2014]). An example planner run is shown in Fig. 6. Coming back to the main Constrained RRT* algorithm, we explore further the possible edges to be added to the tree. In particular, in the loop in lines 17-25 (1) the edge is created only if it is valid, (2) an edge is created from a vertex in Snear that can be connected to snew along a path with min- imum distance (highest reward), and (3) new edges are cre- 1It suffices to sample srand ∈ Sf ree as done in RRT*, the heuris- tic ellipse restriction in Informed RRT* speeds up convergence. Algorithm 2: Valid edge (T , s, s(cid:48), Vc, K) 1 result ← Vc(s, s(cid:48)) 2 while s.parent do 3 result ← result + Vc(s.parent, s) s ← s.parent 4 5 if CV aRα(result) ≤ K then 6 return True 7 return False ated from snew to vertices in Snear, if the path through snew has lower distance (higher reward) than the path through the current parent; in this case, the edge linking the vertex to its current parent is deleted, to maintain the tree structure. In comparison to the O(N 2) complexity of the planning algorithm in SORB, the Complexity of Constrained RRT* is O(N log N ). This allows for scaling to larger graphs. Theoretical Results: The RRT* algorithm in literature sat- isfies two properties: probabilistic completeness and asymp- totic optimality. Intuitively, probabilistic completeness says that as number of samples n → ∞ RRT* finds a feasible path if it exists and asymptotic optimality says that as num- ber of samples n → ∞ RRT* finds the optimal path with the highest reward. The technical definition is long and we re- fer the reader to [Karaman and Frazzoli, 2011] for the same. Unsurprisingly, asymptotic optimality implies probabilistic completeness [Karaman and Frazzoli, 2011]. In this paper, due to the presence of constraints, we redefine asymptotic op- timality as the optimal path that also satisfies the given cost constraints (details in appendix). We show that our changes (Valid Edge) still preserves the redefined asymptotic optimal- ity for Constrained RRT*. Lemma 2. Let d be the dimension of the space S , μ(Sf ree) denotes the Lebesgue measure (i.e., volume) of the obstacle- free space, and τd be the volume of the unit Euclidean norm ball in the d-dimensional space. The Constrained Informed RRT* in Algorithm 1 preserves the redefined asymptotic opti- (cid:1)1/d mality of RRT* with γRRT ∗ ≥ (2(1 + 1/d))1/d(cid:0) μ(Sf ree) . τd Figure 3: The complex point maze environment. The wall obstacles are in black. The environment on right has hazardous red circles. Figure 4: Success rate vs Dif- ficulty Figure 5: Negated reward vs Difficulty The proof of above involves constructing a sequence of paths σn converging to the optimal path σ∗ and then a cov- ering of σn with norm balls. It is shown that with enough samples the algorithm will have a path through these balls in the cover and hence will be close to σn. The final result is based on convergence of σn to σ∗ and existence of such algorithm generated path through the balls for every n. 4 Experiments In this part, we show that our method outperforms baselines in complex long-horizon environments. More specifically, we evaluate our method on a number of complex point maze environments which have been used as a benchmark in RL navigation tasks [Eysenbach et al., 2019; Zhang et al., 2020; Nachum et al., 2018]. These maps include obstacles (im- penetrable) and hazards (high cost but penetrable). We com- pare against SAC-Lagrangian (SAC-lag) [Yang et al., 2021; Stooke et al., 2020], WCSAC [Yang et al., 2021], SORB [Ey- senbach et al., 2019], and Goal-conditioned RL (GRL) [Kael- bling, 1993]. SORB and GRL are not designed to enforce constraints, so they can get higher reward but suffer from con- straint violations. We show our results in the main paper for two maze environments, and hyperparameter settings and ad- ditional results on other environments are in Appendix ??. 2D Navigation with Obstacles 4.1 The first environment is complex point maze environment of Figure 3(a), which has obstacles (walls), but no hazards (thus, no cost constraints). The start point is randomly set in the en- vironment while the goal is set 69ν away from the start where ν is the difficulty level. As the reward r(s, s(cid:48), a) = −1 for each step, the agent needs to reach the goal using the short- est path that avoids the wall obstacles. Because the distance between the start and goal increases as ν increase, the length of each trajectory is limited to 40, 60, 80, 100 for difficulty levels 0.3, 0.5, 0.7, 0.9 respectively. We compare our method with goal-conditioned RL and SORB at different difficulty levels. For a fair comparison, both the number of nodes for SORB and number of iterations for our method are set as 1000. For each experiment, we run 100 trials with different seeds. We compare (a) the percentage of times agent reaches the goal; and (b) the negated reward (i.e., the path length). In Figure 4, we observe that the success rate of our method CoP-RL is 100% and outperforms SORB with larger margin as the difficulty level increases. In Figure 5, we show all tri- als' negated reward (lower is better) for goal-conditioned RL, Figure 6: Trajectory examples for static cost in the complex environ- ment. (a)-(c) show the trajectories generated by GRL, SORB, and CoP-RL with cost limit K = 4. (d)-(f) show the trajectories with K = 7 and (g)-(i) show the trajectories with K = 10. GRL gets stuck in a corner and SORB goes directly through hazards without considering cost. CoP-RL goes deeper into the hazard to obtain a better solution for higher cost limits K. SORB, and our method. We observe that not only the aver- age negated reward (path length) but also the upper bound and lower bound outperform SORB at different difficulty levels. 2D Navigation with Obstacles and Hazards 4.2 In this section, we evaluate our method in the point maze en- vironment of Figure 3(b), where there are two hazards set in the top left room and bottom left room. The agent starts ran- domly in the bottom left room and the goal is randomly set in the top right room. The trajectory length will be longer if the agent tries to avoid the hazardous area. We show results for static costs as well as for stochastic costs at different risk levels. It is worth noting that we don't need to retrain our lower-level RL policy for different cost threshold, K. Static Cost: In this environment, the agent incurs a cost c = 1 for each step in the hazardous area, otherwise c = 0. We eval- uate our method with different cost limits K shown with CoP- RL-4, CoP-RL-7, and CoP-RL-10 in Figure 7 and Figure 8. In Figure 7, the bars provide the path length (negated re- ward) to reach the goal (plotted on primary Y-axis) and the Table 1: Different metrics for evaluating performance in the envi- ronment with stochastic cost: expected cost (EC), cost-CVaR-0.9 (C0.9), cost-CVaR-0.5 (C0.5), cost-CVaR-0.1 (C0.1), and expected negated reward (ENR) EC C0.9 C0.5 C0.1 ENR % CoP-RL-0.9 CoP-RL-0.5 CoP-RL-0.1 SORB 7.90 6.68 6.47 8.06 8.47 7.31 7.06 8.97 10.20 9.20 8.86 11.54 14.67 13.22 12.11 15.14 47.83 48.58 48.60 52.98 16% 11% 7% 30.5% Figure 7: Success rate and average negated reward of our method, SORB, and GRL. Only successful trials are counted for reward. Figure 8: Boxplot of cost in evaluation for static risk after training. purple dots indicate the success rate (plotted on secondary Y-axis). For average negated reward (path length), we only consider the successful trials for all algorithms. We have the following key observations from Figure 7 : • Our method reaches the goal with a high success rate un- der different cost limits with nearly 100% success. • Even though our method considers cost constraints, it is able to outperform SORB (which does not consider the cost constraint) not only in success rate but also in the length of the trajectory (average negated reward). • The success rate of GRL (goal-conditioned RL) is less than 20% but for average negated reward we only count the successful trials, hence the negated reward for goal- conditioned RL is better (lower) than our method. • WCSAC and SAC-Lagrangian, both non-hierarchical RL techniques that consider cost constraints, have nearly 0% success rate in this long-horizon task and we don't con- sider them as baselines in further experiments. The minimum, maximum and mean cost for the different algorithms are shown in Figure 8. With increasing cost limit, the upper bound, lower bound, and median of the total cost increase for our algorithm. This is to be expected as the path in the hazardous area increases and therefore potentially the error in computation of Vc can increase. The proportion of trajectories that exceed the cost limit K = 4, 7, 10 is 4%, 6%, 6% respectively. Examples of paths produced by differ- ent approaches are shown in Figure 6. Stochastic Cost: In this environment, the agent incurs a cost c which is uniformly sampled from {0, 1, 2} for each step in the hazardous area, otherwise c = 0. Therefore, the total cost of n steps inside the hazard follows a multinomial dis- tribution. In safety-critical domains, a worst-case cost guar- Figure 9: Boxplot of cost evaluation for stochastic risk after training antee is preferred over the average cost bound [Yang et al., 2021]. To achieve this, we use Conditioned Value-at-Risk (CVaR [Rockafellar et al., 2000]) instead of the expected value of cost to threshold the safety of a policy. We set cost limit K = 10 for all α, that is, the expectation of the cost of the worst α ∗ 100% cases should be lower than K. We eval- uate our method with different α shown with CoP-RL-0.9, CoP-RL-0.5, and CoP-RL-0.1. All of the experiments are run 100 times with different seeds. In Table 1, the results show that our method CoP-RL with α = 0.9 and 0.5 satisfy the corresponding CVaR bound (columns Cα shows the estimated average costs of the worst α∗100% trajectories) while CoP-RL violates the CVaR bound (K = 10) slightly with the tight level α = 0.1 because of our use of vectors to represent and discretize a long-tailed multi- nomial distribution which introduces approximation error. As α decreases, our method will be more risk-averse so that the expected cost decreases, the percentage of trajectories that exceed the cost limit K decreases (last column), and the ex- pected negated reward increases. The statistical properties of the total cost incurred by our method under different risk level α is shown in Figure 9. 5 Conclusion In this paper, we introduced a hierarchical constrained plan- ning with reinforcement learning approach. The RL agent is utilized to find paths between any two "nearby" states. The constrained planning on the other hand utilizes the RL agent to reach far away goal states from starting states, while satis- fying various types of constraints. We were able to demon- strate the better scalability, theoretical soundness and em- pirically utility of our approach, Cop-RL, over existing ap- proaches for Constrained RL and Hierarchical RL. References [Achiam et al., 2017] Joshua Achiam, David Held, Aviv Tamar, and Pieter Abbeel. Constrained policy optimiza- In International conference on machine learning, tion. pages 22–31. PMLR, 2017. [Bellemare et al., 2017] Marc G Bellemare, Will Dabney, and R ́emi Munos. A distributional perspective on rein- forcement learning. In International Conference on Ma- chine Learning, pages 449–458. PMLR, 2017. [Chow et al., 2017] Yinlam Mohammad and Marco Pavone. Janson, Ghavamzadeh, Lucas Risk-constrained reinforcement learning with percentile risk criteria. The Journal of Machine Learning Research, 18(1):6070–6120, 2017. Chow, [Chow et al., 2018] Yinlam Chow, Ofir Nachum, Edgar Duenez-Guzman, and Mohammad Ghavamzadeh. A lyapunov-based approach to safe reinforcement learning. Advances in neural information processing systems, 31, 2018. [Dietterich, 2000] Thomas G Dietterich. Hierarchical re- inforcement learning with the maxq value function de- composition. Journal of artificial intelligence research, 13:227–303, 2000. [Eysenbach et al., 2018] Benjamin Eysenbach, Abhishek Gupta, Julian Ibarz, and Sergey Levine. Diversity is all you need: Learning skills without a reward function. arXiv preprint arXiv:1802.06070, 2018. [Eysenbach et al., 2019] Ben Eysenbach, Russ R Salakhut- dinov, and Sergey Levine. Search on the replay buffer: Bridging planning and reinforcement learning. Advances in Neural Information Processing Systems, 32, 2019. [Franc ̧ois-Lavet et al., 2018] Vincent Franc ̧ois-Lavet, Peter Henderson, Riashat Islam, Marc G Bellemare, Joelle Pineau, et al. An introduction to deep reinforcement learn- ing. Foundations and Trends® in Machine Learning, 11(3- 4):219–354, 2018. [Gammell et al., 2014] Jonathan D Gammell, Siddhartha S Srinivasa, and Timothy D Barfoot. Informed rrt*: Optimal sampling-based path planning focused via direct sampling of an admissible ellipsoidal heuristic. In 2014 IEEE/RSJ International Conference on Intelligent Robots and Sys- tems, pages 2997–3004. IEEE, 2014. [Gattami et al., 2021] Ather Gattami, Qinbo Bai, and Vaneet Aggarwal. Reinforcement learning for constrained markov decision processes. In International Conference on Artifi- cial Intelligence and Statistics, pages 2656–2664. PMLR, 2021. [Hernandez-Leal et al., 2019] Pablo Hernandez-Leal, Bilal Kartal, and Matthew E Taylor. A survey and critique of multiagent deep reinforcement learning. Autonomous Agents and Multi-Agent Systems, 33(6):750–797, 2019. [Kaelbling, 1993] Leslie Pack Kaelbling. Learning to In IJCAI, volume 2, pages 1094–8. Cite- achieve goals. seer, 1993. [Karaman and Frazzoli, 2011] Sertac Karaman and Emilio Frazzoli. Sampling-based algorithms for optimal motion planning. The international journal of robotics research, 30(7):846–894, 2011. [Kim et al., 2019] Taesup Kim, Sungjin Ahn, and Yoshua Bengio. Variational temporal abstraction. Advances in Neural Information Processing Systems, 32, 2019. [Kim et al., 2021] Junsu Kim, Younggyo Seo, and Jinwoo Shin. Landmark-guided subgoal generation in hierarchi- cal reinforcement learning. Advances in Neural Informa- tion Processing Systems, 34:28336–28349, 2021. [Kulkarni et al., 2016] Tejas Karthik Narasimhan, Ardavan Saeedi, and Josh Tenenbaum. Hierarchical deep reinforcement Integrating temporal abstraction and intrinsic motivation. Advances in neural information processing systems, 29, 2016. Kulkarni, learning: D [Levy et al., 2017] Andrew Levy, George Konidaris, Robert Platt, and Kate Saenko. Learning multi-level hierarchies with hindsight. arXiv preprint arXiv:1712.00948, 2017. [Liang et al., 2018] Qingkai Liang, Fanyu Que, and Ey- tan Modiano. Accelerated primal-dual policy optimiza- arXiv preprint tion for safe reinforcement arXiv:1802.06480, 2018. learning. [Nachum et al., 2018] Ofir Nachum, Shixiang Shane Gu, Honglak Lee, and Sergey Levine. Data-efficient hierar- chical reinforcement learning. Advances in neural infor- mation processing systems, 31, 2018. [Ray et al., 2019] Alex Ray, Joshua Achiam, and Dario Amodei. Benchmarking safe exploration in deep rein- forcement learning. arXiv preprint arXiv:1910.01708, 7:1, 2019. [Rockafellar et al., 2000] R Tyrrell Rockafellar, Stanislav Uryasev, et al. Optimization of conditional value-at-risk. Journal of risk, 2:21–42, 2000. [Ross, 2014] Sheldon M Ross. Introduction to probability models. Academic press, 2014. [Satija et al., 2020] Harsh Satija, Philip Amortila, and Joelle Pineau. Constrained markov decision processes via back- ward value functions. In International Conference on Ma- chine Learning, pages 8502–8511. PMLR, 2020. [Schaul et al., 2015] Tom Schaul, Daniel Horgan, Karol Gregor, and David Silver. Universal value function ap- In International conference on machine proximators. learning, pages 1312–1320. PMLR, 2015. [Sim ̃ao et al., 2021] Thiago D Sim ̃ao, Nils Jansen, and Matthijs TJ Spaan. Alwayssafe: Reinforcement learning without safety constraint violations during training. In Proceedings of the 20th International Conference on Au- tonomous Agents and MultiAgent Systems. International Foundation for Autonomous Agents and Multiagent Sys- tems, 2021. [Stooke et al., 2020] Adam Stooke, Joshua Achiam, and Pieter Abbeel. Responsive safety in reinforcement learn- In International Con- ing by pid lagrangian methods. ference on Machine Learning, pages 9133–9143. PMLR, 2020. [Sutton et al., 1999] Richard S Sutton, Doina Precup, and Satinder Singh. Between mdps and semi-mdps: A frame- work for temporal abstraction in reinforcement learning. Artificial intelligence, 112(1-2):181–211, 1999. [Tessler et al., 2018] Chen Tessler, Daniel J Mankowitz, and Shie Mannor. Reward constrained policy optimization. arXiv preprint arXiv:1805.11074, 2018. [Yang et al., 2021] Qisong Yang, Thiago D Sim ̃ao, Simon H Tindemans, and Matthijs TJ Spaan. Wcsac: Worst-case soft actor critic for safety-constrained reinforcement learn- ing. In AAAI, pages 10639–10646, 2021. [Zhang et al., 2020] Tianren Zhang, Shangqi Guo, Tian Tan, Xiaolin Hu, and Feng Chen. Generating adjacency- constrained subgoals in hierarchical reinforcement learn- ing. Advances in Neural Information Processing Systems, 33:21579–21590, 2020.
http://arxiv.org/abs/2302.10637v1
2023-02-21T12:52:12
2023-02-21T12:52:12
A Survey of Trustworthy Federated Learning with Perspectives on Security, Robustness, and Privacy
Trustworthy artificial intelligence (AI) technology has revolutionized daily life and greatly benefited human society. Among various AI technologies, Federated Learning (FL) stands out as a promising solution for diverse real-world scenarios, ranging from risk evaluation systems in finance to cutting-edge technologies like drug discovery in life sciences. However, challenges around data isolation and privacy threaten the trustworthiness of FL systems. Adversarial attacks against data privacy, learning algorithm stability, and system confidentiality are particularly concerning in the context of distributed training in federated learning. Therefore, it is crucial to develop FL in a trustworthy manner, with a focus on security, robustness, and privacy. In this survey, we propose a comprehensive roadmap for developing trustworthy FL systems and summarize existing efforts from three key aspects: security, robustness, and privacy. We outline the threats that pose vulnerabilities to trustworthy federated learning across different stages of development, including data processing, model training, and deployment. To guide the selection of the most appropriate defense methods, we discuss specific technical solutions for realizing each aspect of Trustworthy FL (TFL). Our approach differs from previous work that primarily discusses TFL from a legal perspective or presents FL from a high-level, non-technical viewpoint.
[ "Yifei Zhang", "Dun Zeng", "Jinglong Luo", "Zenglin Xu", "Irwin King" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10637v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10637v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.CR" ]
3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 7 3 6 0 1 . 2 0 3 2 : v i X r a A Survey of Trustworthy Federated Learning with Perspectives on Security, Robustness, and Privacy 1 Yifei Zhang∗, Dun Zeng∗, Jinglong Luo∗, Zenglin Xu† Irwin King† Abstract-Trustworthy artificial intelligence (AI) technology has revolutionized daily life and greatly benefited human society. Among various AI technologies, Federated Learning (FL) stands out as a promising solution for diverse real-world scenarios, ranging from risk evaluation systems in finance to cutting-edge technologies like drug discovery in life sciences. However, challenges around data isolation and privacy threaten the trustworthiness of FL systems. Adversarial attacks against data privacy, learning algorithm stability, and system confidentiality are particularly concerning in the context of distributed training in federated learning. Therefore, it is crucial to develop FL in a trustworthy manner, with a focus on security, robustness, and privacy. In this survey, we propose a comprehensive roadmap for developing trustworthy FL systems and summarize existing efforts from three key aspects: security, robustness, and privacy. We outline the threats that pose vulnerabilities to trustworthy federated learning across different stages of development, including data processing, model training, and deployment. To guide the selection of the most appropriate defense methods, we discuss specific technical solutions for realizing each aspect of Trustworthy FL (TFL). Our approach differs from previous work that primarily discusses TFL from a legal perspective or presents FL from a high-level, non-technical viewpoint. Index Terms-Trustworthy Federated Learning, Privacy, Robustness, Security (cid:70) 1 INTRODUCTION 1.1 From Trustworthy AI Learning to Trustworthy Federated Trustworthy AI has recently received increased attention due to the need to avoid the adverse effects that AI could have on people [248, 202, 124, 190, 171]. There have been ongoing efforts to promote trustworthy AI, so that people can fully trust and live in harmony with AI technologies. Among various AI technologies [258, 189, 253, 256, 259, 257, 44, 43, 42, 45], Federated Learning (FL) stands out due to the demand for data privacy and data availability in distributed environments. The core idea of FL is to generate a col- laboratively trained global learning model without sharing the data owned by the distributed clients [238, 172, 255]. Since its introduction in 2016 [138], FL has been widely used in various areas, including finance [93], health [165], business, and entertainment. However, FL is vulnerable to adversarial attacks that are mainly focused on impairing the learning model or violating data privacy, posing signifi- cant threats to FL in safety-critical environments. Therefore, people increasingly expect FL to be private, reliable, and socially beneficial enough to be trusted. In this survey, we • Yifei Zhang and Irwin King was with the Department of Computer Science and Engineering, The Chinese University of Hong Kong, ShaTin, N.T., Hong Kong SAR, China. Email: {yfzhang,king}@cse.cuhk.hk • Zeng Dun was with the University of Electronic Science and Technology • of China and Peng Cheng Lab. Email: [email protected] Jinglong Luo and Zenglin Xu was Harbin Institute of Technol- ogy, Shenzhen and Peng Cheng Lab Email: [email protected] and [email protected] Yifei Zhang Dun Zeng and Jinglong Luo contribute equally. Corresponding Authors are Zengling Xu and Irwin King provide a summary of these efforts from the perspective of Trustworthy Federated Learning (TFL). The trustworthiness of the system is based on the con- cept of "trust," which makes the system "worthy" of being relied on. Trust can be defined as "the relationship between a trustor and a trustee: the trustor trusts the trustee." In the context of TFL, we define the trustee as the FL models or systems, and the trustor as the participants in FL, users, and regulators. From the perspective of software develop- ment, an FL model is trustworthy if it is free of threats in different development stages of an FL model (i.e., data processing, model training, and deployment), with three key aspects of trustworthiness, as we will discuss later. We define TFL as being safe and private for processing personal data (Privacy), stable and robust for training the model (Robustness), and confidential and correct for deploying systems (Security), as shown in Fig. 1(a). 1.2 Framework of Trustworthy Federated Learning Federated learning offers a more versatile approach to dealing with distributed data. It differs from traditional centralized machine learning in several ways, such as data isolation, communication, non-IID distribution, and others. These characteristics make FL unique and require different trustworthiness practices compared to general AI and other learning types [124, 248]. To provide a better understanding of our TFL framework, we will begin by briefly describing potential threats in the different stages of FL • Data Processing. In the data processing stage, threats arise from potential information leakage and malicious attacks on the data. For instance, malicious actors can 2 (a) The development stage of TFL. (b) Aspects in TFL Figure 1: The overall framework of Trustworthy Federated Learning (TFL). Figure 2: Threats in different stages of Trustworthy Federated Learning. Table 1: The proposed taxonomy of Trustworthy Federated Learning Data Processing Model Traing Deployment Treats Defense Treats Defense Treats Defense Security Privacy Information Leakage • Data & Label Leakage [177, 261, 270] • Membership Leakage [59, 130, 139, 150, 149, 160, 186] • Properties Leakage [9, 67, 139] • Cryptography- based Methods [146, 5, 154, 105, 145, 205, 206, 175, 153, 119, 35, 53, 25, 107, 108] • Anonymization Methods 70, 188, 222, 52, 262] [130, 202, Gradient Inversion Attack [74, 261, 242, 237, 270] • Cryptography-based Methods [19, 134, 55, 11, 228, 83, 8, 245, 251, 47, 264] Deployment Security • Data security • Model security • Cryptography- based Methods [91, 79, 66, 37, 174, 125, 168, 100, 142, 169, 34, 163, 97, 271, 164] Training Phase Privacy Leakage • Data & Label Leakage [177, 261, 270] • Membership Leakage [59, 130, 139, 150, 149, 160, 186] • Properties Leakage [9, 67, 139] • DP-based methods [4, 86, 95, 132, 131, 266] • Perturbation-based Method [85, 128, 214] Inference attack • Query-based [9, 67, 139] attack • Model-based attack [186, 140] • DP-based methods [139, 270] • Perturbation-based Method [215, 32, 64] Robustness Non-IID Data [265, 94] Data Poisoning[81, 10, 200, 62, 15, 207] • Label Flipping At- tack [15] • Poisoning Sample At- tack [81, 10] • Optimization-based Methods [117, 104, 208, 166, 3, 167] • Knowledge-based Meth- ods [98, 181, 272, 112] Model Poisoning • Backdoor Attack [10, 39, 207, 81, 221, 71] • Byzantine Attack [63, 13, 173] • Robust Aggregation [18, 82, 220, 40, 236, 114, 218, 157, 158] • Byzantine Detection [147, 116, 223, 63, 260] • Hybrid Mechanism [159, 28, 84, 263, 270] N/A N/A conduct data poisoning attacks [39, 111, 6] in FL. They may modify the labels of training samples with a spe- cific class, resulting in poor performance of the model on this class. • Model Training. During the model training process, a malicious participant in FL can perform model poison- ing attacks [219, 221, 18] by uploading designed model parameters. The global model may have low accuracy due to the poisoned local updates. In addition to model poisoning attacks, Byzantine faults [18] are also com- mon issues in distributed learning, where the parties may behave arbitrarily and upload random updates. • Deployment and Inference. After the model is learned, inference attacks [186, 140, 150] can be conducted on it if it is published. The server may infer sensitive information about the training data from the exchanged model parameters. For example, membership inference attacks [186, 150] can infer whether a specific data record was used in the training. It is worth noting that inference attacks may also occur in the learning process by the FL manager, who has access to the local updates of the parties. Then we briefly explain the three key core aspects of trustworthiness and its associated defense methods (Ta- ble 1). • Privacy. Privacy refers to how private data within FL can be protected to prevent it from being leaked. It is crucial to guarantee the privacy of FL data and model parameters, which are considered confidential information belonging to their owners, and to prevent any unauthorized use of the data that can directly or indirectly identify a person or household. This data cov- ers a wide range of information, including names, ages, genders, face images, fingerprints, etc. Commitment to privacy protection is an essential factor in determining Threats in Trustworthy FL Data Preprocessing Data Poisoning Label Flipping Attack Poisoning Samples Attack Out of Distribution None-IID Data Data Secuity Deployment Inference Attack Query Invasion Attack Model Invasion Attack Deployment Security Data Security Model Security Model Training Model Poisoning Backdoor Attack Byzantine Attack Training Privacy Leakage Data & Label Leakge Membership Leakage Properties Leakage Communication Eavesdropping Parameter Eavesdropping Gradient Eavesdropping the trustworthiness of an FL system. This is not only because of the data value but also because of regulatory and legal requirements. • Robustness. Robustness refers to the ability of FL to remain stable under extreme conditions, particularly those created by attackers. This is essential because real environments where FL systems are deployed are usu- ally complex and volatile. Robustness is a vital factor that affects the performance of FL systems in empirical environments. The lack of robustness may also cause unintended or harmful behavior by the system, thereby diminishing its trustworthiness. • Security. Security refers to the protective measures taken to prevent unauthorized users from gaining ac- cess to data. The core of security is to ensure that unau- thorized users cannot access sensitive data. Therefore, the security of FL aims to ensure the confidentiality and correctness of computational data. Specifically, this data includes training and prediction data, intermediate parameters, and the results of the trained model. Un- like privacy, which targets individuals, security focuses more on systems, institutions, and the public interest. It is worth noting that previous works on FL [238, 232] often use the terms privacy and security indiscriminately and re- fer to them as privacy-preserving federated learning (PPFL). However, these two concepts have different guarantees for TFL, and we aim to clarify the distinction between them. In TFL, security guarantees the confidentiality and correctness of the system. Protection is necessary to ensure that attackers cannot access the internal TFL, such as weight, gradients, and other sensitive information. On the other hand, privacy in TFL indicates how private information within FL can be protected to prevent it from being leaked. Some studies have found that private information, such as data records, proprieties, and membership, can be retrieved from the weight and gradient. Thus, privacy guarantees that even if attackers can access the internal TFL, such as weight, model, gradients, etc., private information can still be preserved. Our survey focuses on providing technical solutions for each aspect of TFL in different development stages. This perspective sets it apart from recent related works, such as government guidelines [187] that suggest building TFL systems through laws and regulations or reviews [24, 187] that discuss TFL realization from a high-level, non-technical perspective. Our main contributions are: • We present a synopsis of threats and defense ap- proaches for the core aspects of TFL (i.e., privacy, ro- bustness, and security) in different development stages of FL (i.e., data processing, model training, and de- ployment) to provide a general picture of the field of Trustworthy Federated Learning. • We discuss the challenges of trustworthiness in FL, clarify existing gaps, identify open research problems, and indicate future research directions. In the remaining sections, we organize the survey as follows: In Section 2, we provide an overview of existing threats in the TFL system to help readers understand the risks involved in building a TFL system from a software development perspective. In Section 3, we detail the aspect of security, which ensures the confidentiality and correct- 3 ness of computational data in TFL. In Section 4, we de- tail the aspect of robustness, which makes a TFL system robust to the noisy perturbations of inputs and enables it to make trustworthy decisions. In Section 5, we present the dimension of privacy, which guarantees a TFL system avoids leaking any private information. IN FEDERATED TRUSTWORTHY 2 THREATS LEARNING Potential threats exist in all phases of federal learning, harming the trustworthiness of the system. The distribute nature of FL makes it vulnerable to information leakage and adversarial attack. In this section, we summarize and compare the existing studies on FL threats according to the aspects considered in Section 1. 2.1 Threats in Data Processing of Federated Learning One main vulnerable stage of FL is the data processing. At this stage, raw data is cleaned, processed, and transformed into features that can be accepted by machine learning model. Due to the distributed nature of federated learning, Non-iid data and information leakage are common treats in unprotected FL environment. Meanwhile, malicious can to harm the model by sending poisoned data during data processing. In what follows, we summarize the potential threats in the data processing phase. Information Leakage. Information leakage exists in the data processing stages even if there is no direct data exchange in FL. In federal learning, although data is not directly involved in communication, the exchanged model param- eters and gradients still contain private information. In the absence of data protection (e.g., encryption, perturbation, or anonymization), a direct exchange of model and gradient derived from the local data causes privacy leaks. A number of studies show that the raw record, membership, and prop- erties can be inferred from weight and gradients [270, 261]. Non-IID Data. Due to distributed setting of FL, the data are preserved on isolated devices/institutions and cannot be centralized. Hence, the data samples are generated in vari- ous devices/institutions where the source distributions can be None Independent and Identically Distributed (None- IID) in many ways [94]. A number of studies [265, 268] have indicated that the performance drop of FL in Non-IID settings is inevitable. The divergence of local updates [265] continues to accumulate, slowing down the model conver- gence and weakening model performance. Data Poisoning Attack. Data poisoning occurs during the data pre-processing step. The adversary adds a number of data samples to the training set with goal of miss classify the target label. The label-flipping attack [15] is a common example. It does not change the data properties, but make the the target labels to another class. For instance, hostile users can poison their data by replacing all labels of "apple" with labels of "banana". As a result, the trained classifier cannot correctly categorize "apple" and it will incorrectly expect "apple" to be "banana". Gu et al. [81] design another practical poisoning attack called backdoor attacks. In this scenario, an attacker can alter specific features or subsec- tions of the original training dataset to implant backdoors into the model, so that the model responds according to the adversary's intent if the input contains the backdoor features. This kind of attack is difficult to identify as the per- formance of the poisoned model with clean inputs remains mostly unchanged. Note that any FL clients are capable of launching a data poisoning attack. The impact on the FL model is dependent on the frequency of the engagement of clients in attacks and the quantity of tainted training data. 2.2 Threats in Model Training of Federated Learning Model Poisoning Attack. Model poisoning attacks are in- tended to poison local updates before they are communi- cated to the server or to implant hidden backdoors inside the global model [10]. Because models are continuously updated, it is believed that model poisoning attacks more effective compared to data poisoning attacks. Depending on the objectives of the attack, there are two types of poisoning- based attacks (i.e., untargeted and targeted attacks). In tar- geted model poisoning, the adversary seeks to induce the FL model to misclassify a collection of specified inputs with high probability. The poisoned updates can be injected via manipulating the training process or generated by incorpo- rating hidden backdoors [18]. Bagdasaryan et al. [10] shows the simple single-shot attack could be sufficient to harm the FL model. In untargeted attack poisoning, the adver- sary seeks to undermine the performance of the FL model. In a byzantine attack [63, 13, 173], the adversary players change their outputs to have the same distribution as the right model updates in order to evade detection. It behaves completely arbitrarily to diminish model performance. Privacy Leakage and Communication Eavesdropping. In- formation leakage and communication eavesdropping are common issue during the training process, especially during weight and gradient updates. It is important to note that in- formation leakage is a privacy threat, whereas communica- tion eavesdropping is a security threat. In FL, three types of data must be transferred between clinets and server: weight, gradients, and final model. Each of these data formats contains sensitive information about the training datasets that can be intercepted and utilized to reveal sensitive infor- mation [68, 240]. Clients communicate gradients/weights to the server, which collects them and returns them to clients for model updating in gradient/weight-update-based FL systems [131]. Gradients are commonly calculated in deep neural network models by back-propagating throughout the whole network. Specifically, the gradient is compute via the current layer activation and the error propagate fromt the loss. in the same way, the local model weight is update using the gradients compute form the local dataset. As a result, weight updating, gradient updating, and final model) may contain sensitive details about local data [192, 161]. 2.3 Threats in Development of Federated Learning Inference Phase Data Security. In the phase of deployment or inference, the task initiator usually deploys the carefully- trained model to the cloud server to provide prediction ser- vices and get the related payment. The model parameters, as the intellectual property of the model owner, need to be ef- fectively protected in order to continuously generate value. 4 However, the curious cloud server may steal the model parameters during the deployment process. Furthermore, to accomplish the prediction task, users need to upload their data, which may contain sensitive information such as gender, age, health status, etc. being exposed to the cloud server. A lot of work [91, 79, 66, 37, 174, 125, 168, 100, 142, 169, 34, 163, 97, 271, 164] emerged in order to address data leakage in the inference phase, and we will describe these studies in detail afterwards. Inference Phase Attack. The inference phase focuses on determining how to provide the query service to consumers, and it is also vulnerable to inference attack [185, 140]. This kind of attack is launched in the inference phase after the model has been trained, which is usually referred to as an evasive or exploratory attack. In general, the purpose of an inference attack is to produce inaccurate predictions or collect information about the model's attributes rather than to alert the trained model. The threat during the inference phase is mostly associated with the final model, which is either published to clients or provided as an API for external users. There are two key threats associated with inference attacks: (1) Model-based attacks and (2) Query- based attacks. Attackers have access to the model parame- ters and thus the query results as well as any intermediate computations, they can extract sensitive information about the participants' training datasets [68, 249]. 3 SECURITY In this section, TFL is introduced from a security perspec- tive, and we refer to these studies as Secure Federation Learning (SFL). Specifically, SFL guarantee the confidential- ity and integrity of data and model during FL training and inference by employing secure computing include Secure Multi-Party Computation (SMPC) [234, 235] and Homomor- phic Encryption (HE) [152, 60, 2]. In Section 3.1, We first analyze the threats that exist in SFL and give a formal definition of SFL based on this. Subsequently the secure computing techniques used to address the threats present in SFL are presented in Section 3.2. Finally, we provide an overview of SFL research works in terms of data security, model security, and system security in Section 3.3. 3.1 The Definition of Secure Federated Learning In this section, we describe the threat models present in the FL training and prediction process and give the definition of SFL based on these threat models. Specifically, there are different threats to FL in different scenarios. These threats can be abstracted into different threat models. An SFL algorithm is secure under a certain threat model means that it can resist all attacks under that threat model. The threat model of SFL can be divided into a semi- honest (passive) model and a malicious (active) model ac- cording to the system's tolerance to the adversary's capa- bilities. Specifically, under the assumption of a semi-honest model, the adversary will perform operations according to the protocol but tries to mine the private data of other participants through the information obtained in the process of executing the SFL protocol. And the security of SFL under the semi-honest model requires that the user's private information is not available to the adversary. Unlike the semi-honest model, in the malicious model the adversary will violate the protocol in order to obtain private data. The security of SFL under the malicious model also requires that the user's private data is not available to the adversary. In addition, the security strengths of the SFL algorithms, sorted from weak to strong, are: abort, fair, and guaranteed output delivery (GOD). In detail, abort means that the security detects malicious behavior and terminates the protocol. Fair- ness means that the dishonest participant can get the output when and only when the honest participant gets the output result in the secure computing protocol. The GOD means that the dishonest participant cannot prevent the honest participant from obtaining the output during protocol exe- cution. Furthermore, the threat model of SFL can be divided into honest-majority and dishonest-majority according to the percentage of participants controlled by the adversary in the system. Specifically, the number of adversary-controlled participants in the honest majority model is less than half of the total number of participants. In contrast, in the dishonest majority model, the number of participants controlled by the adversary is greater than or equal to half of the total number of participants. Based on the threat model of SFL, we give the following definition of SFL. Definition 3.1. The training process of FL can be seen as a function of m-ary functionality, denoted by f : ({0, 1}∗)m → ({0, 1}∗)m. (1) Specifically, f is a random process mapping string se- quences of the form x = (x1, . . . , xm) into sequences of random variables, f1(x), . . . , fm(x) such that, for every i, the i-th party Pi who initially holds an input xi, wishes to obtain the i-th element in f (x1, . . . , xm) which is denoted by fi(x1, . . . , xm). The inference process of FL can be seen as a function of one-ary functionality, denoted by g : {0, 1}∗ → {0, 1}∗. (2) Specifically, g is a random process mapping string se- quences of the form y into sequences of random vari- ables, g(y), such that the client C who initially holds an input y wishes to obtain the g(y). We call an FL algorithm as an SFL algorithm if it can complete the calculation of the training or inference process under a given threat model. 3.2 Defense Methods in Secure Federate Learning In this section, we introduce the defense techniques com- monly used in the SFL algorithms, such as SMPC, HE, and Trusted Execution Environment (TEE). Accordingly, SFL algorithms using different secure computing techniques will have different characteristics. For example, the SMPC- based secure computing algorithm can theoretically realize any computation, but it needs to spend a lot of commu- nication costs. Conversely, the HE-based secure computing algorithm can implement addition and multiplication op- erations without any communication costs, but it requires huge computational overhead. 5 3.2.1 Secure Multi-Party Computation Secure Multi-Party Computation (SMPC) originated from the millionaire problem proposed in [234]. The goal of SMPC is to allow a group of mutually untrusted data owners to work together on the computation of a func- tion under the condition that the confidentiality of their independent data is not compromised. The main techniques currently implementing the SMPC protocol include Garbled Circuit (GC) [235], Oblivious Transfer (OT) [162], and Secret Sharing (SS) [183]. All these techniques have limitations and usually require a combination with other techniques to construct efficient SFL algorithms. For example, in spite of, GC can theoretically enable secure computation of arbitrary functions in constant rounds, but transmitting the complete encrypted circuit will result in high communication costs. In contrast, while SS can achieve secure computation at a lower communication cost, it requires a larger number of communication rounds for complex operations. Oblivious Transfer. Oblivious transfer (OT) is proposed in [162]. As a very important primitive in cryptography, OT not only can implement the SMPC protocol independently but also can integrate with other technologies to complete the construction of the SMPC protocol. There are generally two parties in the OT protocol namely, the sender and the receiver. The goal of the OT protocol is to enable the receiver to obtain certain information from the sender obliviously on the premise that the sender and receiver's respective private information is not leaked. Garbled Circuit. Garbled circuit (GC) is a two-party SMPC protocol proposed in [234]. The two parties in the GC are called garbler and evaluator. Suppose the input information of the garbler is x, and the input information of the evalu- ator is y. The main idea of GC is to convert computational functions into boolean circuits. In the obfuscation stage, the garbler converts the Boolean circuit corresponding to the calculation function into a garbled circuit and sends the gar- bled circuit and the random input label corresponding to x to the evaluator. The evaluator executes the OT protocol by interacting with the garbler and obtains the corresponding random input label of y. The evaluator decrypts the garbled circuit using the random input tag to get the calculation result. Finally, the evaluator sends the decrypted calculation result to the garbler. Since the garbled circuit and the ran- dom input label of x are random values for the calculator, they do not contain any information of x, and the security of the OT protocol used ensures that the information of y will not be leaked to the obfuscator. Therefore, the obfuscation circuit ensures that both parties involved in the calculation can obtain the calculation result without revealing their respective input data. Secret Sharing. Secret sharing (SS) is a technique inde- pendently proposed by Shamir [183] and Blackly [17] with its full name called (t, n)-threshold secret sharing schemes, where n is the number of parties and t is a threshold value. The security of SS requires that any less than t parties cannot obtain any secret information jointly. As a special case of secret sharing, (2, 2)-additive secret sharing contains two algorithms: Shr(*) and Rec(*, *). Let ([u]0, [u]1) be the additive share of any u on ZL. Shr(u) → ([u]0, [u]1) is used to generate the share by randomly selecting a number r from f ([x1], [x2], * * * , [xn]) → [f (x1, x2, * * * , xn)], where ∀x ∈ X , x1, x2, * * * , xn → [x1], [x2], * * * , [xn]. ZL, letting [u]0 = r, and computing [u]1 = (u − r) mod L. Note that due to the randomness of r, neither a single [u]0 nor [u]1 can be used to infer the original value of u. The algorithm Rec([u]0, [u]1) → u is used to reconstruct the original value from the additive shares, which can be done by simply calculating ([u]0 + [u]1) mod L. The additive secret-sharing technique has been widely used to construct SMPC protocols for ML operations [146, 205, 206, 175]. GMW [80] represents a function as a Boolean circuit and uses the value of XOR-based SS. Compared with addition secret sharing, "XOR" is used instead of addition and "AND" is used instead of multiplication in GMW. 3.2.2 Homomorphic Encryption Homomorphic encryption (HE) makes the operation of plaintext and ciphertext satisfy the homomorphic property, i.e., it supports the operation of ciphertext on multiple data, and the result of decryption is the same as the result of the operation of the plaintext of data. Formally, we have (3) Homomorphic encryption originated in 1978 when Rivest et al. [170] proposed the concept of privacy homomorphism. However, as an open problem, it was not until 2009, when Gentry proposed the first fully homomorphic encryption scheme [75] that the feasibility of computing any function on encrypted data was demonstrated. According to the type and number of ciphertext operations that can be supported, homomorphic encryption can be classified as partial ho- momorphic encryption (PHE), somewhat homomorphic en- cryption (SHE), and fully homomorphic encryption (FHE). Specifically, PHE supports only a single type of ciphertext homomorphic operation, mainly including additive homo- morphic encryption (AHE) and multiplicative homomor- phic encryption (MHE), represented by Paillier [152], and ElGamal [60], respectively. SHE supports infinite addition and at least one multiplication operation in the ciphertext space and can be converted into a fully homomorphic encryption scheme using bootstrapping [2] technique. The construction of FHE follows Gentry's blueprint, i.e., it can perform any number of addition and multiplication opera- tions in the ciphertext space. Most of the current mainstream FHE schemes are constructed based on the lattice difficulty problem, and the representative schemes include BGV [22], BFV [21, 61], GSW [76], CGGI [50], CKKS [48], etc. 3.2.3 Trusted Execution Environment A Trusted Execution Environment (TEE) [193] enables a certain part of the federated learning process into a trusted environment in the cloud, whose code can be attested and verified. It provides several properties which guarantee that codes could be executed faithfully and privately. In detail, the confidentiality of TEEs guarantees the program process execution is secret, and the state of code is private; while the integrity of TEE ensures that the code's execution cannot be affected. In addition, the measurement of TEE provides the remote party with proof of the code being executed and its starting state. The main function of TEE in SFL is to reduce the at- tack surface of adversaries. For external adversaries, TEE 6 prevents them from stealing training data and intermediate results of the model training process. For internal adver- saries, such as servers and participants, TEE can prevent collusion attacks, model reversal attacks, backdoor attacks, etc., between them. Furthermore, TEE can be used to protect the model parameter information. 3.3 Secure Federated Learning Works In this section, we categorize the SFL-related works in terms of data security, model security, and system security. The specific roadmap is as follows. First, in data security, we give an overview of SFL algorithms that only protect data security. This type of algorithm is generally applied in the training phase. To balance security and efficiency, they protect only part of the training process and we refer to it as partially secure federated training (PSFT). Next, in model security, we review SFL algorithms that protect both model and data security. These algorithms enable fully secure federated training (FSFT) while supporting secure federated inference (SFI). Finally, we review representative security systems in SFL. 3.3.1 Data Security Here, we present an overview of the SFL algorithms that only protects data security, i.e., PSFT. Specifically, We catego- rize the PSFT algorithms according to the different defense techniques used in them. As a class of SFL algorithms, PSFT protects part of the federal training process. In detail, the PSFT algorithm completes the training process by protecting the user's local model gradients. The pipeline of PSFT is shown in Fig. 3. SMPC-based PSFT. The SMPC-based PSFT algorithms low computational cost and have the advantage of communication volume. However, they usually requires more communication rounds and leaks the aggregation parameters to the server. As a well-known work, Bonawitz et al. [19] proposes the first SMPC-based PSFT algorithm by using the Diffie-Hellman key exchange protocol [54] it can protect the local and secret sharing. Specifically, parameters under (malicious) model the semi-honest by three(four) rounds of communication, when there are participants dropped in each round. On top of that, Mandal et al. [134] reducing the communication cost by using non-interactive key generation and L-regular graphs. Subsequently, Bell et al. [12] demonstrated that each client only needs to share the public key and encrypted share with some of the clients to accomplish secure aggregation. Based on this finding, they further reduce the communication there are and computation costs. In addition to this, that use some SMPC-based PSFT algorithms [55, 11] multiple non-colluding aggregation servers to protect local parameters. Specifically, participants send the shares of local parameters to the corresponding aggregation servers to achieve secure aggregation. Unlike [19] which considers user dropouts, this type of work focuses on how to reduce the amount of communication transmitted by participants. As the first work, Dong et al. [55] proposes to reduce the communication volume by using a quantization approach. Inspired by this, Beguier and Tramel [11] further reduces the communication and computational cost of the PSFT 7 Figure 3: The pipeline of partially secure federated training. algorithm by fusing techniques such as model sparsification, model quantization, and error compensation, making the communication of the PSFT algorithm comparable to or lower than FedAvg. HE-based PSFT. Compared with the SMPC-based PSFL algorithms, the HE-based PSFT algorithms have the ad- vantage of additionally ensuring that the global model parameters are not leaked to the curious server. This ad- vantage further reduces the risk of data leakage during the model training phase. Although, the HE-based PSFT algorithms provides strong security guarantees but adds significant computational and communication overheads. Specifically, directly using HE algorithms, such as Paillier cryptosystem to implement security parameter aggregation, causes its computational cost to account for 80% and in- creases communication by more than 150 times [245]. To reduce the computation and communication overhead of the HE-based PSFT algorithms, Aono et al. [8] proposes a packetized computation, which effectively improves the computation and communication efficiency by encrypting multiple plaintexts after encoding them into one large in- teger while guaranteeing the correctness of ciphertext com- putation. Subsequently, Zhang et al. [245] further reduces the computation and communication overhead of HE-based PSFT algorithms by encrypting the quantized gradients after packing them by deflating, cutting, and quantizing them in advance. In addition, [228, 83, 251] designs HE-based PSFT algorithms with verifiable features by introducing bilinear aggregation signatures, homomorphic hashing, etc., which effectively prevents malicious servers from corrupting or forging aggregation results. TEE-based PSFT. Unlike SMPC and HE, which achieve security assurance for FL at the algorithm level, TEE uses hardware isolation to reduce the risk of data leakage [247, 47, 41, 143]. Specially, the TEE effectively reducing the attack surface of adversaries in the FL system as well as preventing collusive attacks by participants in the FL system. The main problems faced by TEE in the construction of SFL systems include the lack of storage space and vulnerability to side- channel attacks. To address these problems, Cheng et al. [47] adopts the "Separation of power" approach to alleviate the problem of insufficient TEE memory by using multiple TEEs as aggregation servers to complete the aggregation of model parameters. At the same time, participants shuffle the parameters by random permutation before uploading them, effectively preventing TEE from side-channel attacks. In addition, Chen et al. [41] uses TEE to protect the integrity of the FL training process and prevent malicious participants from tampering with or delaying the local training process. Furthermore, TEE can also provide additional model protec- tion for FL algorithms, making the trained model accessible only to the task initiator after the FL task ends [247]. Figure 4: The pipeline of fully secure federated training. In addition to this, some PSFT algorithms consider sce- narios in which participants' data are divided according to features. In this setting, [73, 225] design PSFT algorithms about linear regression and xgboost based on SMPC. [87, 46, 38, 65, 102, 233, 49, 254] consider the design of the PSFT algorithms by using HE. Specifically, [87, 233] propose PSFT algorithms on logistic regression. [46, 38, 65] propose the PSFT algorithm about tree-based model. [102, 49, 254] design PSFT algorithms about neural network. Further- more, Chamani and Papadopoulos [29] uses TEE to design PSFT algorithm. [90, 69, 217, 36] further improve the security of PSFT algorithms by fusing SMPC and HE. Recently, Liu et al. [129] provides an overview of federal learning algo- rithms by features. In general, PSFT algorithms based on different technolo- gies have their own characteristics. Specifically, the SMPC- based PSFT algorithms have good computational efficiency and can solve the user dropout problem using SS, making them more suitable for scenarios where the participants are mobile devices. In contrast, the HE-based PSFT algorithm is more suitable for scenarios where participants have stable communication and strong computational power. Furter- more, TEE can provide stronger hardware protection on top of the algorithm protection. Although, the good efficiency of PSFT makes it possible to train complex models, how- ever, PSFT leaks global parameters to users or aggregation servers. This may compromise the confidentiality of the data to some extent. 3.3.2 Model Security In the following, we present an overview of SFL algorithms that can protect both model and data security. Fully Secure Federated Learning. Compared to the PSFT algorithms, which can only provide partial protection, FSFT algorithms achieve complete protection of the federation training process. Specifically, they convert the basic opera- tions in machine learning such as matrix multiplication, and activation functions into corresponding secure operations using secure computing techniques. The FSFT algorithms usually adopts an architecture of outsourced computing, whose security relies on the assumption of non-collusion among the outsourced computing servers. In detail, the data and model owner first encrypts the data and model and sends it to the cloud servers. Then, the cloud servers the use the encrypted data and model interactions to complete the FL training process to obtain the encrypted model param- eters. The pipeline of FSFT is shown in Fig. 4. We classify the work of FSFT according to the number of servers. A summary of the FSFT algorithms is shown in Table 2. Under the two server architecture, SecureML [146] first introduces SS technology into model training for machine learning, and designed a secure SGD algorithm for semi- honest models by fusing GC. The effectiveness of SecureML is demonstrated by secure training of linear regression, logistic regression, and fully connected neural network on MNIST. Subsequently, Quotient [5] is designed by convert- ing the original neural network into a three-valued neu- ral network, i.e., the parameters contain only {−1, 0, 1}. The efficiency of SecureML is improved by a factor of 13 while maintaining the model performance. In addi- tion, ABY2.0 [154] reduces the communication overhead of the online phase of the secure multiplication operator by proposing new SS semantics. On top of this, the overall efficiency of SecureML has been improved by up to 6.1 times. Furthermore, Kelkar et al. [105] achieves security computation of the exponential operator by transforming SS between different semantics and completes the training of Poisson regression. Under a three-server architecture, ABY3 [145] designs the FSFT algorithm under both semi-honest and malicious settings by fusing SS and GC. By optimizing the secure multiplication operator and the conversion protocol be- tween SS and GC, the efficiency of SecureML is greatly improved. Experimental results show that [145] is 55,000 times faster than [146] in secure neural network train- ing. Subsequently, Blaze [153] optimized ABY3 by propos- ing new SS semantics in a three-server architecture and achieved an efficiency improvement of up to 2,610 times. Unlike with ABY3 which uses three computational servers, SecureNN [205] designs secure FSFT under a semi-honest model by introducing an auxiliary service server. With the assistance of the auxiliary server, SecureNN greatly reduces the communication and computation overhead caused by HE or OT in the preprocessing phase of FSFT under the two-service architecture. Experimental results show that secure neural networks trained using SecureNN over LAN and WAN are 79 and 553 times faster than SecureML, respectively. Subsequently, Falcon [206] is designed by fus- [205] and [145]. By implementing ing the techniques of secure computation of batch normalization functions, [206] can accomplish secure training of complex neural network models including VGG16. In addition, ARIANN [175] also designs the FSFT algorithm by using the auxiliary server model. However, by resorting to the function secret sharing technique, ARIANN greatly optimizes the online efficiency of SecureNN nonlinear operations, i.e., achieves secure com- parison operations with only one round of communica- tion in the online phase. Under a four-server architecture, Privpy [119] improves the efficiency of multiplicative online computation greatly by introducing replicated 2-out-of-4- SS. Furthermore, [25, 35, 53, 107] improve the efficiency or security of the FSFT, respectively. In summary, the FSFT algorithms achieve complete 8 protection of the training process compared to the PSFT Algorithm. Specifically, all sensitive data in the training process including intermediate parameters are effectively protected by the FSFT algorithms. Meanwhile, by using outsourced computing, they are making full use of the computing resources of the cloud server and reduce the local computing of the participants. Although the efficiency of FSFT algorithms have been greatly improved in recent years, however, they are still very slow and cannot complete most deep learning training tasks in a reasonable time. Therefore, they are suitable for simple training tasks with high security. Secure Federated Inference (SFI). The SFI algorithms allow prediction tasks to be completed while protecting the secu- rity of the model provider's model and the user's prediction data. Specifically, they convert the operations in the predic- tion process, such as matrix multiplication and activation functions, into secure operations through secure computing techniques. They often adopt a client-server architecture. In detail, the model provider first deploys the model encrypted or publicly to a cloud server to provide inference services. Users with inference needs send the encrypted inference samples to the cloud servers. Then, the cloud server com- pletes the inference task on the encrypted model and data, and returns the inference results to the user. The pipeline of SFI is shown in Fig. 5. We also classify the SFI algorithm by the number of servers. A summary of the SFI algorithms is shown in Table 3. Under one server architecture, CryptoDL [79] and Cryp- toNets [91] implemented deep convolutional neural net- works for secure prediction on MNIST using HE. By using polynomials to approximate nonlinear activation functions, such as ReLU, Sigmoid, etc., they achieve the expected prediction performance of 99% on MNIST. Subsequently, to address the problem that HE is difficult to achieve secure computation of nonlinear operations, Fenner and Pyzer-Knapp [66] proposes a way of server-user interaction. Specifically, the server first completes the linear computa- tion of SFI in the ciphertext state and sends the computation result to the user. The user decrypts and then completes the nonlinear computation in the plaintext state and sends the computed result encrypted to the server. THE-X [37], also adopts the same server-user interactive computation and uses linear neural networks to achieve the approximation of nonlinear operations, such as softmax and layer-norm. After optimization, THE-X achieves the first secure inference of BERT-tiny. Under two server architecture, DeepSecure [174] uses GC to achieve secure prediction and avoids polynomial approximation computation. Although [174] uses a bina- rized neural network to optimize communication efficiency, the communication overhead is still huge. As one of the most famous working SFI, MiniONN [125] is designed by integrating HE and GC. By exploiting the advantages of different techniques, i.e., HE for linear computation and GC for nonlinear computation, MiniONN greatly improves the overall efficiency of the SFI algorithm. Received inspi- ration from MiniONN Gazelle [100], also designes the SFI algorithm by combing HE and GC and additionally im- proved the computational efficiency of HE by using single instruction, multiple data (SIMD). In addition, Delphi [142] Table 2: Fully Secure Federated Train Algorithms 9 No. of Servers Security Model Semi-honest Malicious Secure Defense Methods Model Dataset References 2 2 2 2 3 3/4 3 3 3 4 4 4 4 3/4 4 D D D D H H H H H H H H H H H (cid:56) (cid:56) (cid:56) (cid:56) Abort (cid:56) Abort (cid:56) Fairness Fairness (cid:56) GOD GOD GOD GOD GC/OT/SS/HE GC/OT/SS GC/OT/SS/HE GC/OT/SS/HE GC/OT/SS SS SS SS SS GC/SS SS SS SS SS GC/SS FC [146] FC [5] FC [154] PR [105] FC [145] LeNet[205] VGG16 [206] VGG16 [175] FC [153] FC [119] FC [35] FC [53] FC [25] LR [107] LeNet [108] MNIST MNIST MNIST Smoking and Cancer MNIST MNIST Tiny ImageNet Tiny ImageNet Parkinson MNIST MNIST MNIST MNIST MNIST MNIST SecureML [146] QUOTINENT [5] ABY2.0 [154] Kelkar et al. [105] ABY3 [145] SecureNN [205] FALCON [206] ARIANN [175] BLAZE [153] PrivPy [119] Trident [35] Fantastic Four [53] FLASH [25] SWIFT [107] Tetrad [108] 1 "(cid:56)" denotes not support; "H" denotes honest majority; "D" denotes dishonest majority; "LR" denotes logistic regression; "PR" denotes Poisson regression; "FC" denotes a fully connected neural network. 2 For the accuracy of the network structure, it is recommended to refer to the original paper. When work is performed on multiple models and datasets, we list only the most complex models and datasets in their experiments. Different works may tailor the network structure or dataset according to the characteristics of the designed FSFT algorithm, such as replacing the loss function, reducing the number of samples, etc. For the accuracy of the experiments, it is recommended to refer to the original paper. Figure 5: The pipeline of secure federated inference. improves the efficiency of the SFI algorithm by transferring the computation on HE in Gazelle to be done offline and introducing neural architecture search (NAS) to optimize the preprocessing. It is worth mentioning that Delphi is one of the earlier works that tried to accelerate SFI computation using GPUs. Furthermore, XONN [169] reduces the com- munication overhead by introducing model pruning and se- cret sharing techniques based on DeepSecure. Subsequently, Cryptflow2 [163] optimizes the communication efficiency of the nonlinear activation function of the SFI algorithm using OT and the first ResNet50 and DenseNet121 security predictions were implemented by using Cryptflow2. Unlike existing SFI algorithms, which all use the same bit-width integers for computation, SIRNN [164] uses shorter bit- widths for part of the computation, further reducing the SFI algorithm communication cost, and designing a non- uniform bit-width SFI algorithm in a two-server architec- ture. Experimental results show that SIRNN can effectively support secure inference for Heads [176]. As the state-of-the- art work in a two-server architecture, Cheetah [97] avoids the expensive rotation operation under the SIMD packing technique by cleverly constructing the mapping between plaintext and ciphertext, and improves the computation and communication efficiency of the linear layer of SFI algorithm. Besides, Cheetah also optimizes the nonlinear computation of SFI algorithm by using slient-OT [231]. Under three server architecture, Chameleon [168] optimizes the communication in the offline phase of the SFI algorithm and the conversion efficiency of GC and SS in the online phase by introducing an assistance server. Furthermore, through consistency detection and fair reconstruction protocols, Astra [34] implements a secure SFI algorithm under the malicious model. Through different forms of secret-sharing techniques Astra optimizes the communication efficiency of the online phase of the secure multiplication operator. Overall, SFI algorithms are well suited for Machine Learning as a Service (MLaaS) scenarios as they protect sensitive data during model deployment and inference. Currently, they have been able to implement inference tasks for complex deep models in a reasonable time. In the design of algorithms, the technical route of simultaneously using multiple secure computing techniques to enhance the effi- ciency of SFI algorithms is gradually becoming mainstream. In addition, SFI algorithms are further enhanced effectively through the incorporation of methods such as model quan- tization and the interaction computation between client and server. 3.3.3 Secure System With the rapid development of SFL, corresponding SFL systems have emerged one after another. They efficiently support secure training or prediction tasks by integrating different SFL algorithms. In this section, we select some representative ones from them to introduce according to the maturity of the system and the amount of users, etc. A summary of the SFL systems is shown in Table 4. CrypTFlow [109] is an open-source SFL system under the Microsoft Research EzPC [31] project. By using [109] users can convert Tensorflow and ONNX models into SFL models. The CrypTFlow focuses on SFI tasks, and uses the security operators in SecureNN [205]. In addition, CrypTFlow can implement secure SFI algorithms under malicious models, by using TEE, i.e., SGX. CrypTen [106] is an SFL system built on PyTorch to efficiently support FSFLT and SFI. By integrating with the generic PyTorch API, CrypTen lowers the barrier to use the SFL system, enabling machine learning researchers to easily experiment with machine learning models using secure computing techniques. PySyft [273] is OpenMined's open SFL system that provides secure and private data science in Python. PySyft supports both PSFLT, FSFLT, and SFI. In detail, the private data is decoupled from model training and inference by leveraging secure computing techniques such as SMPC and HE in Pysyft. FATE1 is an SFL open-source project initiated by Webank's AI Department. By implementing multiple secure computing protocols, FATE can effectively support PSFLT, FSFLT, and SFI. Furthermore, With the help of highly modular and flexible scheduling system, FATE has good performance and availability. SecretFlow 2 is a unified programming framework initiated by Ant for privacy-preserving data intelligence and machine learning. It provides an abstract device layer consisting of ordinary devices and secret devices, whereas cryptographic devices consist of cryptographic algorithms such as SMPC, HE, TEE, and hardware devices. With a device layer containing secret devices and a workflow layer that seamlessly integrates data processing, model training, and hyperparameter tun- ing, SecretFlow enables efficient SFT and SFI. Rosetta3 is a TensorFlow-based SFL system. Specifically, by overload- ing TensorFlow's API, Rosetta allows converting traditional TensorFlow-based algorithm code to SFL algorithm code with minimal changes. The current version of Rosetta inte- grates multiple SFL algorithms to support SFT and SFI. TF- encrypted4 is also a TensorFlow-based SFL system. Unlike Rosetta, TF Encrypted makes the system easier to use by leveraging the Keras API. By integrating the relevant SFL algorithms of SMPC and HE, TF Encrypted can effectively support SFT and SFI. CryptGPU [198] and Piranha [213] are 10 two SFL systems that support GPU-accelerated computing and achieve the desired results. CryptGPU implements GPU acceleration of the SFL system by integer decomposition and then uses a submodule of the floating-point Kernel ac- celerated computational decomposition in Pytorch. Piranha, on the other hand, implements the integer Kernel directly on the GPU to support accelerated computation of the SFL system. PaddleFL5 is an open-source SFL system based on PaddlePaddle6. With PaddlePaddle's large-scale distributed training and Kubernetes' elastic scheduling capability for training tasks, PaddleFL can be easily deployed based on full-stack open-source software. In summary, the current SFL systems are designed to provide an easy-to-use conversion tool for non- cryptography, distributed systems, or high-performance computing professionals. For the sake of the usage habits of machine learning researchers, existing SFL systems are usually developed on mainstream machine learning frame- works such as Tensorflow7 or Pytorch8. Specifically, through overloading the APIs of these deep learning frameworks, the SFL systems can convert a machine learning algorithm code to SFL algorithm code with only minor changes. federated learning (RFL) 4 ROBUSTNESS focuses on defending Robust against threats to model performance during the model training process. Compared with SFL techniques that guar- antee the correctness of computing results and protect the system from external attackers, RFL considers the threats from internal. More specifically, there are three main threats in RFL, which can not be defended in SFL techniques. Firstly, Non-IID data samples collected by decentralized and inaccessible FL clients could influence the performance of the federated learning model. Furthermore, Byzantine problems may happen to unreliable clients, causing these clients to upload poisoned or failed local models to the server. Moreover, vulnerable clients could be manipulated by human attackers, and then inject backdoors into FL models. Because these threats happen in the data processing or model training procedure in local clients, the above process can not be prevented by SFL techniques. Hence, additional techniques to guarantee the model performance in a federated learning system and prevent internal attacks are required, which can be summarized as robust federated learning. In the background, robustness is a vital component in trustworthy machine learning [204], as conventional ma- chine learning models are vulnerable to various failures or attacks. When it comes to distributed machine learning sys- tems, it also suffers unreliable clients and lossy communica- tion channels. Federated learning (FL), as a new distributed learning paradigm with privacy-preserving requirements, will face the same even worse vulnerability in different ways. In this section, we focus on the robust techniques in the global aggregation stage on the FL server and discuss the main challenges in RFL that differ from a centralized and 1. FATE: https://github.com/FederatedAI/FATE. 2. SecretFlow: https://github.com/secretflow/secretflow. 3. Rosetta: https://github.com/LatticeX-Foundation/Rosetta. 4. TF-encrypted: https://github.com/tf-encrypted/tf-encrypted. 5. PaddleFL: https://github.com/PaddlePaddle/PaddleFL. 6. PaddlePaddle: https://www.paddlepaddle.org.cn. 7. TensorFlow: https://tensorflow.google.cn. 8. Pytorch: https://pytorch.org. 11 No. of Servers Security Model Semi-honest Malicious Secure Defense Methods Model Dataset References Table 3: Secure Federated Inference Algorithms 1 1 1 1 2 2 2 2 2 2 2 2 3 3 D D D D D D D D D D D D H H (cid:56) (cid:56) (cid:56) (cid:56) (cid:56) (cid:56) (cid:56) (cid:56) (cid:56) (cid:56) (cid:56) (cid:56) (cid:56) Fairness HE HE HE HE GC GC/OT/SS/HE GC/OT/SS/HE GC/OT/SS/HE GC/OT/SS HE/OT/SS HE/OT/SS OT/SS GC/OT/SS GC/OT/SS Shallow CNN Shallow CNN GP BERT-tiny Shallow CNN Shallow CNN Shallow CNN ResNet-32 Shallow CNN DenseNet-121 DenseNet-121 Heads [176] Shallow CNN SVM MNIST MNIST P. falciparum MNLI Smart-sensing CIFAR-10 CIFAR-10 CIFAR-100 CIFAR-10 ImageNet ImageNet SCUT Head [156] MNIST MNIST CryptoDL [91] CryptoNets [79] Fenner and Pyzer-Knapp [66] THE-X [37] DeepSecure [174] MiniONN [125] Gazelle [100] Delphi [142] XONN [169] Cryptflow2 [163] Cheetah [97] SIRNN [164] Chameleon [168] Astra [34] 1 "(cid:56)" denotes not support; "H" means honest-majority; "D" means dishonest-majority. 2 For the accuracy of the network structure, it is recommended to refer to the original paper. When work is performed on multiple models and datasets, we list only the most complex models and datasets in their experiments. Different works may tailor the network structure or dataset according to the characteristics of the designed FSFT algorithm, such as replacing the loss function, reducing the number of samples, etc. For the sake of the accuracy of the experiments, it is recommended to refer to the original paper. Table 4: Summary of SFL System Techniques PSFT FSFT SFI GPU Frameworks Systems SMPC SMPC/TEE SMPC/HE/TEE SMPC SMPC SMPC/HE SMPC/HE SMPC/HE/TEE SMPC SMPC (cid:56) (cid:56) (cid:56) (cid:56) (cid:56) (cid:33) (cid:33) (cid:33) (cid:56) (cid:56) (cid:56) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:56) (cid:56) (cid:56) (cid:56) (cid:33) (cid:33) (cid:56) (cid:56) (cid:33) (cid:33) Tensorflow Tensorflow Tensorflow Pytorch Pytorch Tensorflow/pytorch Tensorflow/pytorch Tensorflow/pytorch PaddlePaddle NA CrypTFlow [109] Rosetta TF-encrypted CrypTen [106] CryptGPU [198] Pysyft [273] FATE SecretFlow PaddleFL Piranha [213] "(cid:33)" denotes supported; "(cid:56)" denotes not supported; "NA" denotes not adopted. distributed data center. We put little attention to the robust system techniques because they have been summarised in the literature [182, 115, 20]. We categorize the threats to robustness FL into three classes (Non-IID issues, Byzantine problems, and targeted attacks) and discuss the defenses against them respectively. In detail, we focus on the robust- ness to Non-IID data issues in Section 4.1, the robustness to Byzantine problems in Section 4.2, and the robustness to targeted attacks in Section 4.3. 4.1 Robustness to Non-IID Data The vital methods of addressing the Non-IID data chal- lenges are to improve the ability of FL algorithms against model divergence in local training and global aggregation procedures. With the rapid increase of research interest in FL, FL algorithms for Non-IID issues have been proposed in recent years. Furthermore, a review paper [268] provides its category about FL on Non-IID data from the categories of Non-IID scenario and system view perspectives. In this section, we provide a different view to categorize the FL algorithms towards Non-IID data issues from a technical view. Non-IID Data Issue. Due to the privacy regulations that forbid the FL server from directly manipulating the local privacy data samples, the data samples are collected alone in various devices/institutions where the source distributions can be Non-IID in many ways [94]. Hence, Non-IID data issues are a fundamental challenge in RFL, which results in model performance degradation compared with distributed learning with IID data. These issues commonly exist in FL applications, which further motivate the research against model performance degradation with Non-IID data. Concretely, Non-IID data issues influence the model training performance of FL by causing the divergence of local updates [265]. Although the authors claim that Fe- dAvg [137] could solve the Non-IID data issue to some extent, studies [265, 94, 101] have indicated that the per- formance drop of FL in Non-IID settings is inevitable. Af- ter each round of federated synchronization, local models share the same parameters but converge to different local optimums due to the heterogeneity in local data distri- butions. Consequently, the divergence of uploaded local update directions causes worse global aggregation results. This divergence usually continues to accumulate during the FL, slowing down the model convergence and weakening model performance. In detail, the scenarios of Non-IID clients can be categorized into several parties [101]. • Feature Distribution Skew. The marginal distribution of label P(x) varies across clients. In a handwriting recognition task, the same words written by different users may differ in stroke width, slant, etc • Label Distribution Skew. The marginal distribution of label P(y) may vary across clients. For instance, clients' data are tied to personal preferences - customers only buy certain items on an online shopping website. • Feature Concept Skew. The condition distributions P(x|y) vary across clients, and P(y) is the same. For instance, the images of items could vary widely at different times and with different illumination. Hence, the data samples with the same label could look very different. • Label Concept Skew. The condition distributions P(y|x) vary across clients and P(x) is the same. Sim- ilar feature representations from different clients could have different labels because of personal preferences, and the same sentences may reflect different sentiments in language text. In real-world settings, the data distribution of clients can be the hybrid case of the above scenarios. Furthermore, the number of data samples may be unbalanced among clients as well. Overall, the Non-IID data issue is a basic threat to model performance. Hence, the RFL approaches to guarantee the performance of the FL model is important. RFL against Non-IID Data. Training a robust shared global model for an FL system is the most important target to achieve in RFL. For example, FedAvg aims to train a shared model on decentralized privacy datasets, where the shared model shall generalize all distributions of all datasets. How- ever, it could be hard with decentralized Non-IID data. To overcome the Non-IID data, the basic idea of FL for a shared model is to reduce the inconsistency among clients with Non-IID data. Moreover, depending on the problem formulation and targets, we broadly categorize them into optimization-based and knowledge-based methods. In this section, we focus on the robustness of the shared global model in the literature, where most approaches could be implemented on personalized FL at the same time. We note that personalized FL [197] is another solution for Non-IID data issues, which trains personalized models for heterogeneous clients. Personalized FL is robust to Non-IID data issues in most cases, because personalized models usu- ally are derived from the global model via fine-tuning [118, 196, 96] or knowledge transferring [16, 123, 88]. Hence, the personalized model naturally fits the local distributions and inherits the robustness of the global model [118]. As the robustness of the global model also affects the inherited per- sonalized models, we focus on the techniques for training a robust global model in the section. the The idea basic Typically, techniques. Optimization-based Methods. of optimization-based methods is to reduce the divergence local updates via distributed convex/non-convex of optimization proposed optimization-based methods are based on the optimization framework of FedAvg, and further implement various frameworks In detail, from different motivations. FedProx [117] adds a proximal term on the client update procedure to restrict their updates to be close. SCAFFOLD [104] uses control variates (variance reduction) for the "client drift" in its local updates. to correct FedNova [208] implements a normalized averaging method that eliminates objective inconsistency while preserving fast error convergence. Reddi et al. [166] propose a generalized FedAvg named FedOPT including client optimization and server optimization procedure. Then, FedOPT derives 12 FedADAGRAD, FedYOGI, and FedADAM by specializing in global optimizer on the server side. FedDyn [3] proposes a solution for a fundamental dilemma, in that the minima of the local-device level empirical loss are inconsistent with those of the global empirical loss. Furthermore, Reisizadeh et al. [167] propose FLRA, a general Byzantine-robust federated optimization approach against distribution shifts in samples located in different clients. In summary, optimization-based methods usually are flexible with promising convergence analysis. Knowledge-based Methods. Differing from the optimiza- tion formulations, knowledge-based approaches for Non- IID issues are motivated by knowledge-transferring tech- niques. The main drawback of such approaches is the re- quirement of a proxy dataset on the FL server. For instance, Jeong et al. [98] introduces knowledge distillation and proposed federated distillation (FD). FD exchanges model outputs as opposed to FL based on exchanging model pa- rameters. FedKD [181] presents several advanced FD appli- cations harnessing wireless channel characteristics and/or exploiting proxy datasets, thereby achieving even higher accuracy than FL. Li and Wang [112] demonstrate the model heterogeneity problems in FL, where the models differ in clients. Then, federated model distillation (FedMD), based on transfer learning and knowledge distillation, enables FL for independently designed models. Knowledge distillation usually depends on a proxy dataset, making it imprac- tical unless such a prerequisite is satisfied. In the above approaches, the quality of the proxy dataset also affects the performance of the FL model, which make knowledge- based approaches unreliable in real applications. To solve that, FedGEN [272] implements a data-free knowledge dis- tillation approach to address heterogeneous FL, where the server learns a lightweight generator to ensemble user infor- mation in a data-free manner, which is then broadcasted to users, regulating local training using the learned knowledge as an inductive bias. Clustering-based Methods. Clustering-based methods ad- dress Non-IID data issues via cluster clients with similar data distributions. Clustering-based methods are usually orthogonal with optimization and knowledge-based algo- rithms. Hence, we can run federated optimization algo- rithms among the clients in the same cluster, which is also known as clustered federated learning (CFL). CFL is presented in [178], which recursively bi-partition clients into two conflict clients clusters according to the gradients. The clustering-based methods are based on the following assumption 4.1. Assumption 4.1 (Clustered Federated Learning [178]). There exists a partitioning C = {c1, . . . , cK}, (cid:83)K k=1 ck = {1, . . . , N } (N ≥ K ≥ 2) of the client population, such that every subset of clients ck ∈ C satisfies the distri- bution learning assumption (i.e., the data distribution among these clients is similar). The key component of clustering-based methods is the algorithm to privacy-respectively distinguish the data distribution of clients and then conduct clustering on these clients. CFL works [191, 57, 155, 211, 226] clusters clients using K-means clustering based on client parameters. CFL [178, 179] separates clients into two partitions, which 13 procedure. A subset of clients may be corrupted by an adversary or random failure during the FL. These clients may upload poison local updates to the server. The fed- erated optimization procedure will be ruined if the server unconsciously aggregates these poisoned updates. In this section, an untargeted attack is a specific scenario of the Byzantine problem (clients that may behave abnormally, or even exhibit arbitrary and potentially adversarial behavior). That is, the behavior of a subset of clients is arbitrary as defined in Definition 4.1. Considering there are p Byzantine clients in an FL system, the affection of the Byzantine attacks on distributed learning can be described as follows: w = w − Λ(∆w1, . . . , ̃∆w1, . . . , ̃∆wp, . . . , ∆wK), (4) ̃∆w denotes the gradients from Byzantine clients. where The Byzantine gradients may cause the optimization di- rection deviates from the global optimum. Hence, effective Byzantine-robust FL approaches are urgently needed to guarantee the model performance of FL. The FL server could not observe the process that happened on the client side including data processing and client local training. Hence, the information for the server to determine the identity of clients is only the uploaded local updates. Based on that observation, the Byzantine-robust FL that defends the Byzantine problem could be categorized into (1) Robust aggregation, (2) Byzantine detection, and (3) Hybrid mech- anism. Definition 4.1. [Byzantine client [110, 18]] A Byzantine client can upload arbitrary local updates to the server (cid:40) ∆wi = ∗, ∇Fi(wi; Di), if the i-th client is Byzantine, otherwise, (5) where "*" represents arbitrary values and Fi represents client i's objective function. Robust Aggregation. The main goal of robust aggregation approaches is to mitigate the influence of Byzantine clients on global aggregation. Robust aggregation techniques are ef- fective in traditional data center distributed machine learn- ing. A robust aggregation scheme assumes that the poisoned local model updates are geometrically far from benign ones. Hence, methods in the literature aim to build a robust aggre- gation rule that can mitigate the impacts of malicious attacks to a certain degree. For example in distributed learning, Krum [18] and Bulyan [82] select the local updates with the smallest Euclidean distances to the remaining ones and aggregate them to update the global model. Medoid and Marginal Median [220] select a subset of clients as a repre- sentative set and uses its update to estimate the true center. GeoMed [40] estimates the center based on the local updates without distinguishing the malicious from the normal ones. Trimmed Mean and Median [236] remove the biggest and smallest values and take the average and median of the re- maining ones as the aggregated value for each of the model parameters among all the local model updates. Depending on their aggregation techniques, there are implicit voting majority rules in several methods [18, 82, 236], that is, a certain local model update away from others should follow the majority direction. Consequently, they may fail when the number of Byzantine clients is too large. Hence, they have (a) Federated learning with benign clients. (b) Federated learning with unreliable clients. Figure 6: The illustration of threats in RFL. are congruent. FL+HC [23] uses local updates to produce hierarchical clustering. IFCA [78]/HypCluster [135] implic- itly clusters clients by broadcasting different models to them and allowing them to choose which cluster to join based on local empirical loss (hypothesis-based clustering). For the model updating method, CFL [23, 178, 179] utilizes FedAvg to train cluster models for each cluster during the cluster model updating procedure, ignoring the fact that knowledge from one cluster may help the learning of other clusters. IFCA conducts parameters-sharing in feature extractor layers and trains personalized output layers via FedAvg. In addition, FedGSP [244] assigns clients to ho- mogeneous clusters to minimize the overall distribution divergence among clusters, and increases the degree of parallelism by reassigning more clusters in each round. This idea was further extended to a hierarchical cloud-edge-end FL framework for 5G empowered industries, namded a FedGS, to improve industrial FL performance on non-IID data [122]. Overall, current CFL methods focus on how to cluster clients better mostly. They learn federated model within client cluster alone and isolated. However, how to enables the federated learning process more efficient across clusters is another open problem in CFL. 4.2 Robustness to Byzantine Problem The failures that happen on the client side may damage the efficiency of the FL system, which can be summarized as the Byzantine problem (the models uploaded from clients are unreliable). In this section, we review the Byzantine problem in FL and summarise the defenses against them. FL server is susceptible to malicious clients as a distributed learning paradigm due to the inaccessibility of clients' local training data and the uninspectable local training processes as shown in Fig. 6(b). In this case, the server cannot be sure whether the clients are honest and benign. The Byzan- tine problems usually happen during the client update Server...w!w!Δw"w!=w+Aggregate(Δw"+⋯+Δw#)...Δw#Data ProcessLocalUpdateGlobalAggregateServer...Δ$w#Δw"w!=w+Aggregate(Δ/w"+⋯+Δw#)Data PoisoningModel PoisoningPoisonedGlobalAggregate...w!w! a theoretical break point, indicating the maximum number of Byzantine clients that can be defended as summarised in Table 5. Overall, robust distributed learning approaches are proposed based on the assumption that the data samples are IID in clients, which conflicts with real-world FL. Besides, the Non-IID scenarios would cause updates to diverge, making the geometric-based robust approaches fail. Other robust aggregation techniques mitigate the in- fluence of Byzantine clients via adding regularization terms [114, 147, 223]. Li et al. [114] enhance the robustness against Byzantine attacks via adding an additional l1-norm regularization on the cost function. Zeno+ [223] estimates the descent of the loss value in asynchronous SGD and declines the Byzantine clients' contribution via penalty term. Mu ̃noz-Gonz ́alez et al. [147] proposes Adaptive Federated Averaging (AFA) to estimate the quality of the client's updates and dynamically adjust its averaging weights. Regularization-based methods provide robust analysis un- der the general cases in optimization and the performance usually is better than geometric-based methods. In summary, mitigating the influence of poisoned local updates on global optimization procedures is the main idea of robust aggregation approaches. Most of the above robust aggregation schemes suffer from significant performance degradation when a relatively large proportion of clients are compromised, or data among clients is highly Non-IID. Fur- thermore, recently proposed poisoning attacks [63, 13, 173] for FL can bypass these robust aggregation algorithms. Mo- tivated by these new challenges, the Byzantine-robust fed- erated optimization approaches have been proposed [218, 157, 158], which reveals the further challenges for robust aggregation techniques. From an application view, most of the Byzantine-robust federated optimization approaches assume failure modes without generality. The complex and unpredictable threats [133] in FL motivate further studies on general Byzantine robustness, which is an open problem. Byzantine Detection. Byzantine detection schemes are to identify and exclude malicious local updates so that Byzan- tine clients will not damage the FL system. Depending on the detection rules of such approaches, we further categorize these methods as validation-based methods and gradient- based methods. For validation-based methods, Error Rate- based Rejection (ERR) rejects local updates that would decrease the global model's accuracy. Loss Function-based Rejection (LFR) [63] ranks the model's credibility according to the loss decrease. For gradient-based methods, Li et al. [116] use a variational autoencoder (VAE) to capture model- update statistics and distinguish malicious clients from be- nign ones accordingly. Zhang et al. [260] observe that the model updates from a client in multiple iterations are incon- sistent and propose FLDetector [260] to check their model- updates consistency. Recently, BytoChain [121] introduces a Byzantine resistant secure blockchained federated learning framework, which executes heavy verification workflows in parallel and detects byzantine attacks through a byzantine resistant consensus Proof-of-Accuracy (PoA). In summary, Byzantine detection is compatible with most federated op- timization algorithms. Hence, they are more robust than Robust-aggregation schemes. Thus, byzantine detection is a promising direction for exploring robust federated learning. 14 However, these approaches require extra calculation on the server and client [260, 260, 116], or additional public data on the server [63]. Hybrid Mechanism. Other works combine the above schemes and propose a hybrid defense mechanism. Di- verseFl [159] trains a bootstrapping model for each client us- ing some of the client's local data and compares the trained model with her submitted local model update to examine the local training process. FLTrust [28] trains a bootstrap- ping model on a public dataset and uses cosine similarities between local model updates and the trained bootstrapping model to rank the model's credibility. CoMT [84] couples the process of teaching and learning and thus produces directly a robust prediction model despite the extremely pervasive systematic data corruption. FedInv [263] conducts a privacy- respecting model inversion [270] to the local updates and obtains a dummy dataset. Then, FedInv scores and clusters local model updates by Wasserstein distance of the dummy dataset and removes those updates that are far from others. Hybrid mechanism robust federated learning approaches smartly preserve the advantages of both robust aggregation and Byzantine detection techniques, however, usually con- sume more resources. Hence, the resource-efficient robust approach is also an open problem in applications. 4.3 Robustness to Targeted Attacks In targeted attacks, the attackers usually could manipulate the learning process of multiple clients and inject specific backdoors into the FL model. In this way. the FL model will output unexpected results on specific inputs with trigger, while the model performance on clean data is normal. Thus, attacks with specific targets are more dangerous threats to RFL. The most discussed targeted attack in the literature is backdoor attacks [10, 81, 207], which can be further enhanced by Sybil attacks [56, 71] in FL. The backdoors in the trained model could be triggered at any time and make the model output unexpected results during the inference stage. The Sybil attacks could manipulate the model training process to control the behaviors of the FL model (backdoor FL models are easier). In this section, we introduce the targeted attacks in FL and review the proposed solutions in the literature. Backdoor Attacks. An adversary can conduct complex at- tacks (e.g., both data poisoning and model poisoning) to im- plant a backdoor trigger into the learned model. Usually, the model will behave normally on clean data, while predicting a target class if the trigger appears. The backdoor attacks in FL are carried out by adversary clients with smartly organized data/model poisoning attacks. Bagdasaryan et al. [10] introduce semantic backdoors in FL that cause the model to misclassify even unmodified inputs. Edge-case backdoors [207] force a model to misclassify on seemingly easy inputs that are however unlikely to be part of the training, or test data, i.e., they live on the tail of the input distribution. Badnet [81] lets Byzantine clients inject label- flipped data samples with specific backdoor triggers into the training datasets. Xie et al. [221] propose DBA (distributed backdoor attack), which decomposes a global trigger pattern into separate local patterns and embeds them into the train- ing set of different adversarial parties respectively. Liu et al. Table 5: Summary of representative defenses Category Type Method Technique Break Point Robust Aggregation Geometric-based Regularization-based Validation-based Gradient-based Byzantine Detection Hybrid Mechanism Euclidean distance Geometric median Geometric median Coordinate-wise median Krum + trimmed median Inner-product validation Gradient similarity Loss regularization Global validation Loss feed-back Gradient similarity Krum[18] BGD [40] Xie et al. [220] Yin et al. [236] Bulyan [82] Zeno++ [223] AFA[147] RSA[114] ERR&LFR [63] Baffle[7] FoolsGold [71] FLDetector[260] Gradient consistency Li et al. [116] CoMT [84] FLTrust [28] FedInv [263] DiverseFl [159] Sun et al. [195] CRFL [224] (K-2)/2K NA NA K/2 (K-3)/4K NA NA NA NA NA NA NA NA Anomaly detection NA Collaborative teaching Global fine-tuning NA Gradient-based clustering NA NA Filter update NA Clipping and DP NA Clipping and smoothing Non-IID Data (cid:56) (cid:56) (cid:56) (cid:56) (cid:56) (cid:56) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) 15 Robust to threats Byzantine Problem Targeted Attacks (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:56) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:56) (cid:56) (cid:56) (cid:56) (cid:56) (cid:56) (cid:56) (cid:56) (cid:56) (cid:56) (cid:33) (cid:33) (cid:33) (cid:33) (cid:33) (cid:56) (cid:56) (cid:33) (cid:33) (cid:33) (cid:33) "(cid:33)" denotes supported, and "(cid:56)" denotes not supported or not studied. [127] propose a two-phase backdoor attack, which includes a preliminary phase for a whole population distribution inference attack and generates a well-crafted dataset and the later injected backdoor attacks would benefit from the crafted dataset. If an attacker could inject c, fake partici- pants, into the FL system, the FL may suffer from Sybil attack [56, 71]. A single Sybil attacker could launch arbitrary attacks by influencing the fake participants. For example, Sybil clients contribute updates towards a specific poisoning objective [71], which achieves targeted attacks (inject back- doors) and untargeted attacks (ruin model performance). In summary, backdoor attacks are a well-designed combi- nation of poisoning attacks from adversaries. Its form and target could vary in real-world applications, which makes it hard to be detected and defend. Defense. The main idea of defending against backdoor attacks is to prevent the formulation of backdoor triggers in model training, as the backdoor attacks can be considered to add an implicit predicting task into the model without noticing and use a trigger to launch a such predicting task in the inference stage. Compared with the defense approaches against the Byzantine problem, targeted attacks are harder to defend as the adversaries may not damage the model performance on clean datasets. Based on the observation that backdoor attackers are likely to produce updates with large norms, several studies are proposed to defend against backdoor attacks by manipulating those suspicious gradi- ents. For example, Sun et al. [195] suggests using norm thresholding and differential privacy (clipping updates) to defend against backdoor attacks. CRFL [224] exploits clip- ping and smoothing on model parameters to control the global model smoothness. A sample-wise robustness certifi- cation on backdoors with limited magnitude is proved in the paper. The above techniques clip gradients from all clients to destroy the backdoor tasks. However, the hidden cost is the loss of performance of model training. The targeted at- tacks are basically conducted via model poisoning and data poisoning. Hence, previously discussed robust aggregation methods and Byzantine detection schemes could defend against backdoor attacks to some extent. Based on that, BaFFLe [7] utilizes data information feedback from multi- ple clients for uncovering model poisoning and detecting backdoor attacks. 5 PRIVACY A privacy attack in federated learning (FL) aims to expose personal information about users who are participating in the machine learning task. This not only endangers the privacy of the data used to train the machine learning models, but also the individuals who voluntarily share their personal information. Initially, it was believed that FL was a distributed machine learning paradigm that could protect personal information. However, the learning process is vulnerable to real-world applications and faces a wide range of attacks. Despite the fact that private data is never shared, exchanged models are prone to remembering the private information of the training dataset. In this section, we present a taxonomy that aims to simplify the under- standing of different privacy attacks, as shown in Table 6. 5.1 Privacy Threats in Trustworthy Federated Learning 5.1.1 Data & Label Leakage In the context of Federated Learning, the data and label attack is also commonly referred to as the reconstruction attack. The goal of these attacks is to recover the dataset of a client who participates in an FL task. The attacks typically aim to generate the original training data samples and their corresponding labels. The most common data types that can be targeted by these attacks are images or plain text, which often contain private information owned by the parties. Gradient-based Data Leakage. In a gradient-based Feder- ated Learning (FL) training procedure, as described in [113, 239], selected clients share their gradients with the federated server in communication rounds. However, model gradients may cause a significant amount of privacy leakage as they are derived from the participants' private training datasets. By observing, altering, or listening in on gradient updates during the training process, an adversary (e.g., participants or eavesdroppers) can infer private data using gradients obtained via the training datasets [270, 261]. 16 Table 6: A Summary of the Relationship between Privacy Treats and the Existing Methods Privacy Threats Data & Label Leakage Membership Leakage Proporties Leakage Parameter Updating [113, 239, 270, 261] Gradient Updating Training Phase [138, 230, 92, 212, 241] [202, 139, 92] Inference Phase Individual Proporties [186, 140] [209, 250] Population Proporties [144, 141, 229, 269, 33] Defense Methods Diff. Privacy Perturbation Anonymization Local Diff. Privacy Global Diff. Privacy Additive Multiplicative [14, 180, 203] [4, 58, 148] [215, 228, 270] [30, 72, 99] [188, 222] [139, 148, 194] [86, 148] [77, 86, 95] [32, 64] [52, 180, 192] [266, 267] [139, 148, 201] [128, 214, 270] [64, 167] [52, 180, 192] To obtain the training inputs and labels, an optimization algorithm designed by Zhu et al. [270] first creates a dummy dataset made up of fictitious samples and labels. Dummy gradients are then obtained using standard forward and backward propagation on the fictitious dataset. The learn- ing process is accomplished by minimizing the difference between the fake gradient and the real gradient. By using this approach, the attacker can infer the training samples and labels with a limited number of training rounds. Zhao et al. [261] expanded on the attack proposed in [270] by utilizing the relationship between the ground- truth labels and the gradient signs. Weight-Based Data Leakage. In weight-based Federated Learning (FL) frameworks, as described in [138], selected clients share their local model parameters with the federated server in communication rounds. Multiple participants have access to the aggregated parameters that the server calculates. A weight update can, therefore, expose the provided data to adversarial partic- ipants or eavesdroppers [230]. Malicious participants can calculate the differences between FL models in different update rounds by repeatedly saving the parameters. Xu et al. [230] showed that the model weight can be trained to reveal sensitive information by controlling spe- cific participants during the training phase. In addition, Hitaj et al. [92] offer a Generative Adversarial Network (GAN)-based active attack for recovering training images, where the key to training the GAN is employing the global model as a discriminator. The attacker misleads the target client to release more information about the target label. Furthermore, Wang et al. [212] have altered the GAN ar- chitecture to a multitask GAN. Apart from GAN-based attacks, Yuan et al. [241] focus on reconstructing text via model parameters in natural lan- guage processing tasks, especially for language modeling. 5.1.2 Membership Leakage Membership inference is a technique used to determine whether a given data sample was part of the training dataset [120, 130]. For instance, it can be used to identify whether a particular patient's records were used to train a classifier for a specific disease. Traing Phase Membership Leakage. The work by Shokri et al. [186] focused on the membership inference attack against privacy leakage in machine learning, where an in- ference model is trained to determine whether a given data sample belongs to the training dataset. Recent studies have identified the gradients and em- bedding layers as the two areas facing privacy leakage in membership inference attacks [139]. It has been shown that the embedding of a deep learning network can expose the locations of words in the training data through non-zero gradients, allowing an adversary to conduct a membership inference attack. To address this issue, Hitaj et al. [92] evaluated membership inference attacks against generative models, revealing that many models based on boundary equilibrium GANs or deep GANs are vulnerable to privacy leaks. Inference Phase Membership Leakage During the infer- ence phase, Fredrikson et al. [68] developed an inversion method for retrieving private information, revealing that it can expose user-level information. In a similar vein, Melis et al. [140] investigated mem- bership privacy leakage during the inference phase, demon- strating that deep learning models can disclose the place- ments of words in a batch. In this case, inference attacks are primarily responsible for privacy leaks when attackers can only access model query outputs, such as those returned by a machine learning-as-a-service API [202]. Furthermore, Shokri et al. [186] explored privacy leak- age during the inference phase by examining the inference membership attack against model query results. In this ap- proach, an inference model is trained to distinguish between training and non-training data samples. 5.1.3 Property Inference Attack This type of attack aims to determine whether an unrelated property of a client or the FL task population is present in the FL model, with the objective of acquiring a characteristic that should not be shared. For example, consider a machine learning model designed to detect faces. An attack might attempt to infer whether training images contain faces with blue eyes, even though this characteristic is unrelated to the primary goal of the model. Property on Population Distribution. This type of attack aims to infer the distribution of a feature in a group of clients. Wang et al. [209] propose a set of passive attacks using stochastic gradient descent that can be used to infer the label in each training round. To accomplish this, the at- tacker needs to possess internal knowledge as well as partial external knowledge, which includes information about the number of clients, the average number of labels, and the number of data samples per label. Truex et al. [202] extended this approach to a broader context, demonstrating its data-driven nature and high transferability. In a more general FL setting, Zhang et al. [250] propose a passive attack with limited knowledge to infer the distri- bution of sensitive features in the training datasets. Property on Individual Distribution. Attackers may at- tempt to infer the presence of an unrelated property in target clients. With stochastic gradient descent, Mo et al. [144] propose a formal evaluation process to measure the leak of such properties in deep neural networks. Both passive and active property inference attacks have been created by Melis et al. [141] using internal knowledge, with multitasking learning used to power the active attack [252]. In a regular FL setting, Xu and Li [229] propose two attacks, passive and active, with the active attack leveraging CycleGAN [269] to reconstruct gradients using the target attribute. Chase et al. [33] suggest a poisoning attack to infer properties, which requires partial internal information to modify the target client's dataset and external knowledge. Finally, in an unusual FL environment using blockchain-assisted HFL, Shen et al. [184] propose an active attack. 5.2 Privacy Defences Method for Trustworthy FL 5.2.1 Differential Privacy Differential Privacy (DP) allows for information leakage while carefully limiting the harm to people whose private data is stored in a training set. In essence, it hides a person's personal information by introducing random noise. This type of noise is proportional to the largest modification that a single person can make to the output. It should be noted that DP makes the assumption that the adversary has any external knowledge. Definition 5.1 (Differential Privacy [172]). A database access mechanism, M, preserves (cid:15)-DP if for all neighboring databases x, y and each possible output of M, repre- sented by S, it holds that: P [M(x) ∈ S] ≤ e(cid:15)P [M(y) ∈ S]. If, on the other hand, for 0 < δ < 1 it holds that: P [M(x) ∈ S] ≤ e(cid:15)P [M(y) ∈ S] + δ, (6) (7) then the mechanism possesses the property of ((cid:15), δ)- DP, also known as approximate DP. In other words, DP specifies a "privacy budget" given by (cid:15) and δ. The way in which it is spent is given by the concept of privacy loss. The privacy loss allows us to reinterpret both, (cid:15) and δ in a more intuitive way: • (cid:15) limits the quantity of privacy loss permitted, that is, our privacy budget. • δ is the probability of exceeding the privacy budget given by (cid:15) so that we can ensure that with probability 1 − δ, the privacy loss will not be greater than (cid:15). and there are mainly two types of DP (i.e., Global Differen- tial Privacy and Local Differential Privacy) Global Differential Privacy Methods. The global differen- tial privacy scheme has been widely used in many federated learning (FL) methods [136, 51, 58, 77, 85, 86]. Geyer et al. [77] presented an FL framework based on global differ- ential privacy by incorporating the Gaussian mechanism to protect client datasets. Specifically, the global model is obtained by randomly selecting different clients at each training round [77]. The server then adds random noise to the aggregated global model, which prevents adversary 17 clients from inferring the private information of other clients from the global model. However, this framework is vulnerable to malicious servers since they have access to clean model updates from the participants. To address this issue, Hao et al. [86] proposed adding noise to the local gradients instead of the aggregated model. Following this paradigm, [77] proposed a differential privacy-based privacy-preserving language model at the user level, which achieved comparative per- formance while preserving privacy. However, one challenge of this method is the trade-off between privacy and utility, as differential privacy inevitably incurs high computation costs. Overall, the global differential privacy method has an advantage in preserving privacy at a limited cost to model performance. This is because differential privacy is applied to the entire dataset with limited noise, guaranteeing a good statistical distribution. Local Differential Privacy Methods. Various federated learning (FL) approaches have employed the local differ- ential privacy mechanism [14, 27, 126, 132, 148, 180, 194, 194, 203, 210, 216, 266, 267]. The first attempt to combine local differential privacy scheme with deep neural networks was proposed by Abadi et al. [1]. This privacy-preserving method involves two operations: clipping the norm of up- dating gradients to limit sensitive information in the data, and injecting noise into clipped gradients. However, this method was not applied to FL systems. [267] investigated local differential privacy and evalu- ated both efficiency and privacy loss in the setting of FL, ignoring the impact of local differential privacy on model performance. Bhowmick et al. [14] designed a local differen- tial privacy-based method that is free from reconstruction attacks. This approach employs local differential privacy to protect the privacy of samples on the client side and to ensure the privacy of the global model on the server side. In mobile edge computing, Lu et al. [132] proposed asynchronous FL, which adopts local differential privacy for local model updates. In the Internet-of-Things, Cao et al. [27] designed an FL framework with local differential privacy as its privacy utility. Truex et al. [203] scaled the local differential privacy approach to large-scale network training. In the field of natural language processing, Wang et al. [210] used a local differential privacy FL framework for industrial-level text mining tasks and showed that it can guarantee data privacy while maintaining model accuracy. In summary, due to the nature of local differential privacy methods, they offer a stronger privacy guarantee compared to global differential privacy-based FL methods. 5.2.2 Perturbation Methods They are an alternative approach to provide defenses against privacy attacks that are not based on DP. Its main aim is to introduce noise to the most vulnerable components of the federated learning, such as shared model parameters or the local dataset of each client, to reduce the amount of information an attacker can extract. There are mainly two types of perturbation methods (i.e., additive based Methods and multiplicative based Methods) Additive Perturbation Methods. Additive perturbation- based FL methods are a popular class of privacy-preserving techniques in FL [30, 64, 77, 86, 95, 128, 201, 214, 228]. These methods aim to incorporate random noise into the weight updates or gradient updates to prevent private information leakage during training. While some methods add noise to the model parameters [85, 86, 201, 228], others add noise to the gradient updates [85, 86, 201, 228]. One challenge with these methods is to balance the privacy guarantee with the model's accuracy. To address this challenge, Chamikara et al. [30] propose a lossless data perturbation method that maintains model accuracy while providing a strong privacy guarantee. In this method, random noise is added to the data, rather than the model or gradients. Other studies, such as Hu et al. [95] and Liu et al. [128], focus on designing personalized FL models that add noise to intermediate updates or data attributes to ensure privacy. However, one limitation of additive perturbation methods is that they may not be a lossless solution and can affect the model's performance. Additionally, these methods are vul- nerable to noise reduction attacks, which can compromise the privacy of the data [103]. Multiplicative Perturbation Methods. Multiplicative per- turbation is an alternative method to adding random noise to data in perturbation-based machine learning. This tech- nique transforms the original data into some space [30, 32, 64, 72, 99, 246], and has been adapted for use in the context of the Internet of Things (IoT) in federated learning (FL) systems. Several studies have explored the use of multiplica- tive perturbation to preserve data privacy in FL, including Chamikara et al. [30] and Jiang et al. [99]. In particular, Jiang et al. [99] present an FL method for IoT objects that employs independent Gaussian ran- dom projection to perturb the data of each object, while Chamikara et al. [30] propose a multiplicative perturbation mechanism in fog devices. However, it should be noted that the latter method may be vulnerable to insider attackers, i.e. honest but curious servers. Other studies have used multiplicative perturbations to obfuscate the stochastic gradient update and protect the gradients from curious attackers. For example, Gade and Vaidya [72] explore the use of this method to protect the gradients in FL systems. Additionally, Chang et al. [32] and Zhang et al. [246] propose a multiplicative perturbation method for weight update-based FL frameworks, which is applied to local weights with the aim of preventing gradient leakage to servers. Overall, perturbation-based FL methods that use mul- tiplicative perturbation offer stronger privacy guarantees compared to those using additive perturbation, as it is more difficult to reconstruct the original data in this case. 5.2.3 Anonymization-based Method While perturbation-based methods are often considered to be strong privacy preservation techniques, some works [151, 77] argue that they can still degrade data utility. As a result, anonymization-based methods have been presented to address this concern [188, 52, 222, 262]. For instance, Song et al. [188] adopt a GAN-based FL framework with anonymization schemes to protect against user-level privacy attacks. 18 Similarly, Choudhury et al. [52] propose an anonymiza- tion method for FL that aims to improve both data utility and model performance. This approach involves a global anonymization mapping process for predicting the de- ployed FL model. Their evaluation shows that this method provides stronger privacy preservation and model perfor- mance compared to DP-based FL methods. In summary, anonymization-based methods provide strong privacy preservation without sacrificing data utility, and can outperform DP-based methods in terms of FL performance. Therefore, they offer a promising alternative to perturbation-based methods for privacy-preserving FL. 6 CHALLENGES AND FUTURE DIRECTIONS 6.1 Secure of Federated Learning Although SFL is currently receiving a lot of attention and making impressive progress in both academia and industry, there are still many challenges that need to be addressed. In this section, we summarize the main challenges currently faced by the SFL algorithm. Based on these challenges, some research directions that we consider valuable are proposed. • Designing more adaptable PSFT algorithms. The cur- rent PSFT algorithm is usually customized for "Fe- dAvg". In order to accommodate more complex data distributions in FL, more aggregation algorithms have been developed, such as "FedPox" [117], "SCAF- FOLD" [104]. How to customize the PSFT algorithm for these new aggregation algorithms is worthy of future research. • Design of SFL algorithms for adaptive protection. The objects protected by existing SFL algorithms are usu- ally deterministic. Specifically, the PSFT algorithm only protects the security of local model parameters, but ex- poses the complete global parameters and final model results. The FSFT and SFI algorithms protect the com- plete data and model security but greatly reduce the overall efficiency of the algorithm. However, the data and model parameters that need to be protected are often different at different stages or in different applica- tion scenarios. It makes sense to design an efficient SFL algorithm that can protect the data and models in the FL system accurately according to the requirements. • How to better integrate secure computing techniques into SFL systems? The current SFL algorithm is usually designed to apply safe computation directly. Only the feature of using the same training data for multiple iterations in the machine learning training process is exploited in Kelkar et al. [105] to improve the efficiency of secure multiplication. How to combine more features of machine learning algorithms in the training and prediction process to optimize the efficiency of SFL algorithms is a direction worth investigating in the future. • How to perform better engineering optimization of SFL algorithms? The reason for the use of secure computing techniques makes it difficult for the SFL algorithm to be directly compatible with the current mainstream machine learning frameworks. This leads to the fact that existing engineering optimization methods for ma- chine learning cannot be applied to the SFL algorithm. Only a relatively small amount of work has considered engineering optimization of SFL algorithms, such as using GPUs to accelerate FSFT training. How to make more use of engineering optimization to improve the efficiency of SFL algorithms deserves to be investigated in the future. 6.2 Robustness of Federated Learning Robust federated learning cares about the trustworthiness of model training performance. By reviewing the robust techniques in robust federated learning, we conclude the challenges and the feasible future directions as follows: • Non-IID Data issues commonly exist in real-world federated learning scenarios, which makes the lo- cal gradients geometrically diverse. Consequently, the geometric-based robust distributed learning ap- proaches fail to maintain the robustness of federated learning. Distinguishing the gradients from Byzantine clients or Non-IID clients would be an open problem for future studies on robust aggregation techniques. • From the perspective of defense against targeted at- tacks, the researchers observed that the norm of the poi- soned gradients is usually large. Hence, the commonly used approaches are conducting gradient-clipping or gradient-noising. The possibly model training perfor- mance degeneration is unavoidable due to the gradient- clipping/noising on benign gradients. Therefore, an- other open problem in robust federated learning is to keep the model training performance while defending against potential attacks. • In real-world applications, the failure, and attack modes are various. Besides, the threat modes are unknown to the server and can be different over time, which further motivates the study of general robust federated learning approaches. • Despite a few FL benchmarks [26, 199] and frame- works [227, 243, 89] having been proposed, we lack a standard benchmark to verify the robust ability of proposed FL approaches, which is future work for the FL community. 6.3 Privacy of Trustworthy Federated Learning Despite the tremendous growth of privacy-preserving FL in recent years, this research area still poses significant challenges and offers opportunities for developing existing frameworks and creating new methods to enhance both data privacy and utility. Some open research problems and directions are highlighted below: • Privacy-preserving mechanisms in FL have a trade- off between effectiveness and efficiency. Therefore, it is crucial to comprehend usage scenarios under different privacy requirements and study how to optimize the deployment of defense mechanisms. • Data memorization is a major challenge that requires serious attention since neural network-based federated learning may overfit and memorize sensitive infor- mation. Anonymizing the data and model can be a potential solution to this issue. Hence, we believe that developing an effective mechanism for anonymizing 19 training datasets is an essential way to ensure privacy preservation in FL. • Developing hybrid approaches for privacy methods in FL by combining various security techniques such as encryption is advantageous. This is because different defense strategies offer significant advantages in differ- ent areas, and it is appropriate to leverage their benefits to advance existing frameworks. Overall, TFL is a thriving research field with numerous ap- proaches and applications. This survey aims to summarize existing advances and trends in TFL, with the goal of facil- itating and advancing future TFL research and implemen- tation. From a technical perspective, this survey provides a roadmap for building TFL systems. It begins by defining TFL and presents a general picture of the vulnerabilities in the available literature associated with trustworthiness in FL. The survey then reviews recent improvements in TFL regarding security, robustness, and privacy. It explains the threats, summarizes the known defense mechanisms for establishing trustworthy FL in each aspect, and suggests potential future research routes for these elements. We con- clude that the study of TFL is a must-have in trustworthy AI due to its importance. There are still several challenges to be addressed and directions to be explored to identify additional threats or vulnerabilities of TFL and appropri- ate mechanisms to make it a resilient and robust learning paradigm against those threats. REFERENCES [1] M. Abadi, A. Chu, I. Goodfellow, H. B. McMahan, I. Mironov, K. Talwar, and L. Zhang. Deep learning In Proceedings of the 2016 with differential privacy. ACM SIGSAC conference on computer and communica- tions security, pages 308–318, 2016. In Proceedings of the 40th S. Abney. Bootstrapping. annual meeting of the Association for Computational Lin- guistics, pages 360–367, 2002. [2] [3] D. A. E. Acar, Y. Zhao, R. M. Navarro, M. Mattina, P. N. Whatmough, and V. Saligrama. Federated learn- In 9th Inter- ing based on dynamic regularization. national Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. OpenRe- view.net, 2021. URL https://openreview.net/forum? id=B7v4QMR6Z9w. [4] N. Agarwal, A. T. Suresh, F. X. X. Yu, S. Kumar, cpsgd: Communication-efficient and B. McMahan. and differentially-private distributed sgd. Advances in Neural Information Processing Systems, 31, 2018. [5] N. Agrawal, A. Shahin Shamsabadi, M. J. Kusner, and A. Gasc ́on. Quotient: two-party secure neural network training and prediction. In Proceedings of the 2019 ACM SIGSAC Conference on Computer and Communications Security, pages 1231–1247, 2019. S. Alfeld, X. Zhu, and P. Barford. Data poisoning at- tacks against autoregressive models. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 30, 2016. S. Andreina, G. A. Marson, H. M ̈ollering, and G. Karame. Baffle: Backdoor detection via feedback- In 2021 IEEE 41st Inter- based federated learning. [7] [6] [8] national Conference on Distributed Computing Systems (ICDCS), pages 852–863. IEEE, 2021. Y. Aono, T. Hayashi, L. Wang, S. Moriai, et al. Privacy- preserving deep learning via additively homomorphic encryption. IEEE Transactions on Information Forensics and Security, 13(5):1333–1345, 2017. [9] G. Ateniese, G. Felici, L. V. Mancini, A. Spognardi, A. Villani, and D. Vitali. Hacking smart machines with smarter ones: How to extract meaningful data arXiv preprint from machine learning classifiers. arXiv:1306.4447, 2013. [10] E. Bagdasaryan, A. Veit, Y. Hua, D. Estrin, and V. Shmatikov. How to backdoor federated learning. In International Conference on Artificial Intelligence and Statistics, pages 2938–2948. PMLR, 2020. [12] [11] C. Beguier and E. W. Tramel. Safer: Sparse secure arXiv preprint aggregation for federated learning. arXiv:2007.14861, 2020. J. H. Bell, K. A. Bonawitz, A. Gasc ́on, T. Lepoint, and M. Raykova. Secure single-server aggregation In Proceedings of with (poly) logarithmic overhead. the 2020 ACM SIGSAC Conference on Computer and Communications Security, pages 1253–1269, 2020. [13] A. N. Bhagoji, S. Chakraborty, P. Mittal, and S. Calo. Analyzing federated learning through an adversarial In International Conference on Machine Learning, lens. pages 634–643. PMLR, 2019. [14] A. Bhowmick, J. Duchi, J. Freudiger, G. Kapoor, and R. Rogers. Protection against reconstruction and its applications in private federated learning. arXiv preprint arXiv:1812.00984, 2018. [15] B. Biggio, B. Nelson, and P. Laskov. Poisoning at- tacks against support vector machines. arXiv preprint arXiv:1206.6389, 2012. I. Bistritz, A. Mann, and N. Bambos. Distributed distillation for on-device learning. Advances in Neural Information Processing Systems, 33:22593–22604, 2020. [16] [17] G. R. Blakley. Safeguarding cryptographic keys. In Managing Requirements Knowledge, International Work- shop on, pages 313–313, 1979. [18] P. Blanchard, E. M. El Mhamdi, R. Guerraoui, and J. Stainer. Machine learning with adversaries: Byzan- tine tolerant gradient descent. Advances in Neural Information Processing Systems, 30, 2017. [19] K. Bonawitz, V. Ivanov, B. Kreuter, A. Marcedone, H. B. McMahan, S. Patel, D. Ramage, A. Segal, and K. Seth. Practical secure aggregation for privacy- preserving machine learning. In proceedings of the 2017 ACM SIGSAC Conference on Computer and Communica- tions Security, pages 1175–1191, 2017. Ingerman, V. [20] K. Bonawitz, H. Eichner, W. Grieskamp, D. Huba, J. Koneˇcn `y, A. S. Mazzocchi, B. McMahan, et al. Towards federated learning at scale: System design. Proceedings of Machine Learning and Systems, 1:374–388, 2019. Ivanov, C. Kiddon, [21] Z. Brakerski. Fully homomorphic encryption without modulus switching from classical gapsvp. In Annual Cryptology Conference, pages 868–886. Springer, 2012. [22] Z. Brakerski, C. Gentry, and V. Vaikuntanathan. (lev- eled) fully homomorphic encryption without boot- strapping. ACM Transactions on Computation Theory 20 (TOCT), 6(3):1–36, 2014. [23] C. Briggs, Z. Fan, and P. Andras. Federated learning with hierarchical clustering of local updates to im- prove training on non-iid data. In 2020 International Joint Conference on Neural Networks (IJCNN), pages 1– 9. IEEE, 2020. [24] M.-E. Brunet, C. Alkalay-Houlihan, A. Anderson, and R. Zemel. Understanding the origins of bias in word In International conference on machine embeddings. learning, pages 803–811. PMLR, 2019. [25] M. Byali, H. Chaudhari, A. Patra, and A. Suresh. framework for privacy- Flash: Fast and robust preserving machine learning. Proceedings on Privacy Enhancing Technologies, 2:459–480, 2020. [26] S. Caldas, S. M. K. Duddu, P. Wu, T. Li, J. Koneˇcn `y, H. B. McMahan, V. Smith, and A. Talwalkar. Leaf: arXiv preprint A benchmark for federated settings. arXiv:1812.01097, 2018. [27] H. Cao, S. Liu, R. Zhao, and X. Xiong. Ifed: A novel federated learning framework for local differ- Inter- ential privacy in power internet of things. national Journal of Distributed Sensor Networks, 16(5): 1550147720919698, 2020. [28] X. Cao, M. Fang, J. Liu, and N. Z. Gong. Fltrust: Byzantine-robust federated learning via trust boot- In ISOC Network and Distributed System strapping. Security Symposium (NDSS), 2021. J. G. Chamani and D. Papadopoulos. Mitigating leakage in federated learning with trusted hardware. arXiv preprint arXiv:2011.04948, 2020. [29] [30] M. A. P. Chamikara, P. Bertok, I. Khalil, D. Liu, and S. Camtepe. Privacy preserving distributed machine learning with federated learning. Computer Communi- cations, 171:112–125, 2021. [31] N. Chandran, D. Gupta, A. Rastogi, R. Sharma, and S. Tripathi. Ezpc: programmable and efficient secure two-party computation for machine learning. In 2019 IEEE European Symposium on Security and Privacy (Eu- roS&P), pages 496–511. IEEE, 2019. Shejwalkar, R. [32] H. Chang, V. and A. Houmansadr. Cronus: Robust and heterogeneous collaborative learning with black-box knowledge transfer. arXiv preprint arXiv:1912.11279, 2019. [33] M. Chase, E. Ghosh, and S. Mahloujifar. Shokri, Prop- arXiv preprint erty inference from poisoning. arXiv:2101.11073, 2021. [34] H. Chaudhari, A. Choudhury, A. Patra, and A. Suresh. Astra: high throughput 3pc over rings with applica- In Proceedings of the 2019 tion to secure prediction. ACM SIGSAC Conference on Cloud Computing Security Workshop, pages 81–92, 2019. [35] H. Chaudhari, R. Rachuri, and A. Suresh. Trident: Ef- ficient 4pc framework for privacy preserving machine learning. arXiv preprint arXiv:1912.02631, 2019. [36] C. Chen, J. Zhou, L. Wang, X. Wu, W. Fang, J. Tan, L. Wang, A. X. Liu, H. Wang, and C. Hong. When homomorphic encryption marries secret sharing: Se- cure large-scale sparse logistic regression and applica- In Proceedings of the 27th ACM tions in risk control. SIGKDD Conference on Knowledge Discovery & Data Mining, pages 2652–2662, 2021. [37] T. Chen, H. Bao, S. Huang, L. Dong, B. Jiao, D. Jiang, H. Zhou, and J. Li. The-x: Privacy-preserving transformer inference with homomorphic encryption. arXiv preprint arXiv:2206.00216, 2022. [38] W. Chen, G. Ma, T. Fan, Y. Kang, Q. Xu, and Q. Yang. Secureboost+: A high performance gradient boosting tree framework for large scale vertical federated learn- ing. arXiv preprint arXiv:2110.10927, 2021. [39] X. Chen, C. Liu, B. Li, K. Lu, and D. Song. Targeted backdoor attacks on deep learning systems using data poisoning. arXiv preprint arXiv:1712.05526, 2017. [40] Y. Chen, L. Su, and J. Xu. Distributed statistical machine learning in adversarial settings: Byzantine gradient descent. Proceedings of the ACM on Mea- surement and Analysis of Computing Systems, 1(2):1–25, 2017. [41] Y. Chen, F. Luo, T. Li, T. Xiang, Z. Liu, and J. Li. A training-integrity privacy-preserving federated learn- ing scheme with trusted execution environment. In- formation Sciences, 522:69–79, 2020. [42] Y. Chen, H. Guo, Y. Zhang, C. Ma, R. Tang, J. Li, and I. King. Learning binarized graph representations with multi-faceted quantization reinforcement for top- k recommendation. In SIGKDD, 2022. [43] Y. Chen, M. Yang, Y. Zhang, M. Zhao, Z. Meng, J. Hao, and I. King. Modeling scale-free graphs with hy- perbolic geometry for knowledge-aware recommen- dation. In WSDM, pages 94–102, 2022. [44] Y. Chen, Y. Yang, Y. Wang, J. Bai, X. Song, and I. King. Attentive knowledge-aware graph convolutional net- works with collaborative guidance for personalized recommendation. In ICDE, 2022. [45] Y. Chen, Y. Fang, Y. Zhang, and I. King. Bipartite graph convolutional hashing for effective and efficient top-n search in hamming space. In WWW, 2023. [46] K. Cheng, T. Fan, Y. Jin, Y. Liu, T. Chen, D. Papadopou- los, and Q. Yang. Secureboost: A lossless federated IEEE Intelligent Systems, 36(6): learning framework. 87–98, 2021. [47] P.-C. Cheng, K. Eykholt, Z. Gu, H. Jamjoom, K. Ja- yaram, E. Valdez, and A. Verma. Separation of powers in federated learning (poster paper). In Proceedings of the First Workshop on Systems Challenges in Reliable and Secure Federated Learning, pages 16–18, 2021. J. H. Cheon, A. Kim, M. Kim, and Y. Song. Ho- momorphic encryption for arithmetic of approximate In International conference on the theory and numbers. application of cryptology and information security, pages 409–437. Springer, 2017. [48] [49] T.-H. Cheung, W. Dai, and S. Li. Fedsgc: Federated In simple graph convolution for node classification. International Workshop on Federated and Transfer Learn- ing for Data Sparsity and Confidentiality in Conjuncation with IJCAI, 2021. I. Chillotti, N. Gama, M. Georgieva, and M. Izabach- ene. Faster fully homomorphic encryption: Bootstrap- ping in less than 0.1 seconds. In international conference on the theory and application of cryptology and information security, pages 3–33. Springer, 2016. [50] 21 tial privacy-enabled federated learning for sensitive health data. arXiv preprint arXiv:1910.02578, 2019. [52] O. Choudhury, A. Gkoulalas-Divanis, T. Salonidis, I. Sylla, Y. Park, G. Hsu, and A. Das. A syntactic approach for privacy-preserving federated learning. In ECAI 2020, pages 1762–1769. IOS Press, 2020. [53] A. Dalskov, D. Escudero, and M. Keller. Fantastic four:{Honest-Majority}{Four-Party} secure computa- tion with malicious security. In 30th USENIX Security Symposium (USENIX Security 21), pages 2183–2200, 2021. [54] W. Diffie and M. E. Hellman. New directions in cryptography. In Democratizing Cryptography: The Work of Whitfield Diffie and Martin Hellman, pages 365–390. 2022. [55] Y. Dong, X. Chen, L. Shen, and D. Wang. Eastfly: Effi- cient and secure ternary federated learning. Computers & Security, 94:101824, 2020. J. R. Douceur. The sybil attack. In International work- shop on peer-to-peer systems, pages 251–260. Springer, 2002. [56] [57] M. Duan, D. Liu, X. Ji, Y. Wu, L. Liang, X. Chen, Y. Tan, and A. Ren. Flexible clustered federated learning for IEEE Transactions client-level data distribution shift. on Parallel and Distributed Systems, 2021. [58] A. Dubey and A. Pentland. Differentially-private fed- erated linear bandits. Advances in Neural Information Processing Systems, 33:6003–6014, 2020. [59] C. Dwork and M. Naor. On the difficulties of disclo- sure prevention in statistical databases or the case for differential privacy. Journal of Privacy and Confidential- ity, 2(1), 2010. [60] T. ElGamal. A public key cryptosystem and a sig- IEEE nature scheme based on discrete logarithms. transactions on information theory, 31(4):469–472, 1985. J. Fan and F. Vercauteren. Somewhat practical fully homomorphic encryption. Cryptology ePrint Archive, 2012. [61] [62] M. Fang, G. Yang, N. Z. Gong, and J. Liu. Poisoning attacks to graph-based recommender systems. In Pro- ceedings of the 34th annual computer security applications conference, pages 381–392, 2018. [63] M. Fang, X. Cao, J. Jia, and N. Gong. Local model poi- soning attacks to {Byzantine-Robust} federated learn- In 29th USENIX Security Symposium (USENIX ing. Security 20), pages 1605–1622, 2020. [64] Y. Feng, X. Yang, W. Fang, S.-T. Xia, and X. Tang. Practical and bilateral privacy-preserving federated learning. 2020. [65] Z. Feng, H. Xiong, C. Song, S. Yang, B. Zhao, L. Wang, Z. Chen, S. Yang, L. Liu, and J. Huan. Securegbm: In 2019 IEEE Secure multi-party gradient boosting. International Conference on Big Data (Big Data), pages 1312–1321. IEEE, 2019. [66] P. Fenner and E. Pyzer-Knapp. Privacy-preserving gaussian process regression–a modular approach to the application of homomorphic encryption. In Pro- ceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 3866–3873, 2020. [51] O. Choudhury, A. Gkoulalas-Divanis, T. Salonidis, I. Sylla, Y. Park, G. Hsu, and A. Das. Differen- [67] M. Fredrikson, E. Lantz, S. Jha, S. Lin, D. Page, and T. Ristenpart. Privacy in pharmacogenetics: An {End- to-End} case study of personalized warfarin dosing. In 23rd USENIX Security Symposium (USENIX Security 14), pages 17–32, 2014. [68] M. Fredrikson, S. Jha, and T. Ristenpart. Model inver- sion attacks that exploit confidence information and basic countermeasures. In Proceedings of the 22nd ACM SIGSAC conference on computer and communications se- curity, pages 1322–1333, 2015. [69] F. Fu, H. Xue, Y. Cheng, Y. Tao, and B. Cui. Blindfl: Vertical federated machine learning without peeking into your data. In Proceedings of the 2022 International Conference on Management of Data, pages 1316–1330, 2022. [70] C. Fung, J. Koerner, S. Grant, and I. Beschastnikh. Dancing in the dark: Private multi-party machine arXiv preprint learning in an untrusted setting. arXiv:1811.09712, 2018. [71] C. Fung, C. J. Yoon, and I. Beschastnikh. The lim- itations of federated learning in sybil settings. In 23rd International Symposium on Research in Attacks, Intrusions and Defenses (RAID 2020), pages 301–316, 2020. [72] S. Gade and N. H. Vaidya. Privacy-preserving dis- tributed learning via obfuscated stochastic gradients. In 2018 IEEE Conference on Decision and Control (CDC), pages 184–191. IEEE, 2018. [73] A. Gasc ́on, P. Schoppmann, B. Balle, M. Raykova, J. Doerner, S. Zahur, and D. Evans. Secure linear IACR regression on vertically partitioned datasets. Cryptol. ePrint Arch., 2016:892, 2016. J. Geiping, H. Bauermeister, H. Dr ̈oge, and M. Moeller. Inverting gradients-how easy is it to break privacy in federated learning? Advances in Neural Information Processing Systems, 33:16937–16947, 2020. [74] [75] C. Gentry. A fully homomorphic encryption scheme. Stanford university, 2009. [76] C. Gentry, A. Sahai, and B. Waters. Homomorphic encryption from learning with errors: Conceptually- simpler, asymptotically-faster, attribute-based. In Annual Cryptology Conference, pages 75–92. Springer, 2013. [77] R. C. Geyer, T. Klein, and M. Nabi. Differentially private federated learning: A client level perspective. arXiv preprint arXiv:1712.07557, 2017. [78] A. Ghosh, J. Chung, D. Yin, and K. Ramchandran. An efficient framework for clustered federated learning. Advances in Neural Information Processing Systems, 33: 19586–19597, 2020. [79] R. Gilad-Bachrach, N. Dowlin, K. Laine, K. Lauter, M. Naehrig, and J. Wernsing. Cryptonets: Applying neural networks to encrypted data with high through- put and accuracy. In International conference on machine learning, pages 201–210. PMLR, 2016. [80] O. Goldreich, S. Micali, and A. Wigderson. How to play any mental game, or a completeness theorem for protocols with honest majority. In Providing Sound Foundations for Cryptography: On the Work of Shafi Gold- wasser and Silvio Micali, pages 307–328. 2019. [81] T. Gu, B. Dolan-Gavitt, and S. Garg. Badnets: Iden- tifying vulnerabilities in the machine learning model supply chain. arXiv preprint arXiv:1708.06733, 2017. 22 [82] R. Guerraoui, S. Rouault, et al. The hidden vulnera- bility of distributed learning in byzantium. In Interna- tional Conference on Machine Learning, pages 3521–3530. PMLR, 2018. [83] X. Guo, Z. Liu, J. Li, J. Gao, B. Hou, C. Dong, and T. Baker. V eri fl: Communication-efficient and fast IEEE verifiable aggregation for federated learning. Transactions on Information Forensics and Security, 16: 1736–1751, 2020. [84] Y. Han and X. Zhang. Robust federated learning via In Proceedings of the collaborative machine teaching. AAAI Conference on Artificial Intelligence, volume 34, pages 4075–4082, 2020. [85] M. Hao, H. Li, X. Luo, G. Xu, H. Yang, and S. Liu. Efficient and privacy-enhanced federated learning for IEEE Transactions on industrial artificial intelligence. Industrial Informatics, 16(10):6532–6542, 2019. [86] M. Hao, H. Li, G. Xu, S. Liu, and H. Yang. Towards efficient and privacy-preserving federated deep learn- ing. In ICC 2019-2019 IEEE international conference on communications (ICC), pages 1–6. IEEE, 2019. [87] S. Hardy, W. Henecka, H. Ivey-Law, R. Nock, G. Pa- trini, G. Smith, and B. Thorne. Private federated learning on vertically partitioned data via entity reso- lution and additively homomorphic encryption. arXiv preprint arXiv:1711.10677, 2017. [88] C. He, M. Annavaram, and S. Avestimehr. Group knowledge transfer: Federated learning of large cnns at the edge. Advances in Neural Information Processing Systems, 33:14068–14080, 2020. [89] C. He, S. Li, J. So, X. Zeng, M. Zhang, H. Wang, X. Wang, P. Vepakomma, A. Singh, H. Qiu, Fedml: A research library and benchmark et al. arXiv preprint for arXiv:2007.13518, 2020. federated machine learning. [90] D. He, R. Du, S. Zhu, M. Zhang, K. Liang, and S. Chan. Secure logistic regression for vertical federated learn- ing. IEEE Internet Computing, 26(2):61–68, 2021. [91] E. Hesamifard, H. Takabi, and M. Ghasemi. Cryptodl: arXiv Deep neural networks over encrypted data. preprint arXiv:1711.05189, 2017. [92] B. Hitaj, G. Ateniese, and F. Perez-Cruz. Deep models under the gan: information leakage from collabora- In Proceedings of the 2017 ACM tive deep learning. SIGSAC conference on computer and communications se- curity, pages 603–618, 2017. [93] M. Househ, E. Borycki, and A. Kushniruk. Multi- ple Perspectives on Artificial Intelligence in Healthcare. Springer, 2021. [94] K. Hsieh, A. Phanishayee, O. Mutlu, and P. Gibbons. The non-iid data quagmire of decentralized machine learning. In International Conference on Machine Learn- ing, pages 4387–4398. PMLR, 2020. [95] R. Hu, Y. Guo, H. Li, Q. Pei, and Y. Gong. Personalized IEEE federated learning with differential privacy. Internet of Things Journal, 7(10):9530–9539, 2020. [96] Y. Huang, L. Chu, Z. Zhou, L. Wang, J. Liu, J. Pei, and Y. Zhang. Personalized cross-silo federated learning on non-iid data. In AAAI, pages 7865–7873, 2021. [97] Z. Huang, W.-j. Lu, C. Hong, and J. Ding. Cheetah: Lean and fast secure two-party deep neural network inference. IACR Cryptol. ePrint Arch., 2022:207, 2022. arXiv:1910.03581, 2019. 23 [98] E. Jeong, S. Oh, H. Kim, J. Park, M. Bennis, and S.-L. Kim. Communication-efficient on-device ma- chine learning: Federated distillation and augmen- arXiv preprint tation under non-iid private data. arXiv:1811.11479, 2018. [99] L. Jiang, R. Tan, X. Lou, and G. Lin. On lightweight privacy-preserving collaborative learning for internet- In Proceedings of the international of-things objects. conference on internet of things design and implementation, pages 70–81, 2019. [100] C. Juvekar, V. Vaikuntanathan, and A. Chandrakasan. {GAZELLE}: A low latency framework for secure In 27th USENIX Security neural network inference. Symposium (USENIX Security 18), pages 1651–1669, 2018. [101] P. Kairouz, H. B. McMahan, B. Avent, A. Bellet, M. Bennis, A. N. Bhagoji, K. Bonawitz, Z. Charles, G. Cormode, R. Cummings, et al. Advances and open problems in federated learning. Foundations and Trends® in Machine Learning, 14(1–2):1–210, 2021. [102] Y. Kang, Y. He, J. Luo, T. Fan, Y. Liu, and Q. Yang. Privacy-preserving federated adversarial do- main adaptation over feature groups for interpretabil- ity. IEEE Transactions on Big Data, 2022. [103] H. Kargupta, S. Datta, Q. Wang, and K. Sivakumar. On the privacy preserving properties of random data In Third IEEE international perturbation techniques. conference on data mining, pages 99–106. IEEE, 2003. [104] S. P. Karimireddy, S. Kale, M. Mohri, S. Reddi, S. Stich, and A. T. Suresh. Scaffold: Stochastic controlled av- In International Con- eraging for federated learning. ference on Machine Learning, pages 5132–5143. PMLR, 2020. [105] M. Kelkar, P. H. Le, M. Raykova, and K. Seth. Secure In 31st USENIX Security Sympo- poisson regression. sium (USENIX Security 22), pages 791–808, 2022. [106] B. Knott, S. Venkataraman, A. Hannun, S. Sengupta, M. Ibrahim, and L. van der Maaten. CrypTen: Secure multi-party computation meets machine learning. In Proc. NeurIPS, 2021. [107] N. Koti, M. Pancholi, A. Patra, and A. Suresh. {SWIFT}: Super-fast and robust {Privacy-Preserving} machine learning. In 30th USENIX Security Symposium (USENIX Security 21), pages 2651–2668, 2021. [108] N. Koti, A. Patra, R. Rachuri, and A. Suresh. Tetrad: actively secure 4pc for secure training and inference. arXiv preprint arXiv:2106.02850, 2021. [109] N. Kumar, M. Rathee, N. Chandran, D. Gupta, A. Ras- togi, and R. Sharma. Cryptflow: Secure tensorflow In 2020 IEEE Symposium on Security and inference. Privacy (SP), pages 336–353. IEEE, 2020. [110] L. Lamport, R. Shostak, and M. Pease. The byzantine In Concurrency: the works of leslie generals problem. lamport, pages 203–226. 2019. [111] B. Li, Y. Wang, A. Singh, and Y. Vorobeychik. Data poisoning attacks on factorization-based collaborative filtering. Advances in neural information processing sys- tems, 29, 2016. [112] D. Li and J. Wang. Fedmd: Heterogenous feder- arXiv preprint ated learning via model distillation. [113] H. Li and T. Han. An end-to-end encrypted neural network for gradient upda tes transmission in feder- ated learning. arXiv preprint arXiv:1908.08340, 2019. [114] L. Li, W. Xu, T. Chen, G. B. Giannakis, and Q. Ling. Rsa: Byzantine-robust stochastic aggregation methods for distributed learning from heterogeneous datasets. In Proceedings of the AAAI Conference on Artificial Intel- ligence, volume 33, pages 1544–1551, 2019. [115] Q. Li, Z. Wen, Z. Wu, S. Hu, N. Wang, Y. Li, X. Liu, and B. He. A survey on federated learning systems: vision, hype and reality for data privacy and protection. IEEE Transactions on Knowledge and Data Engineering, 2021. [116] S. Li, Y. Cheng, W. Wang, Y. Liu, and T. Chen. Learning to detect malicious clients for robust federated learn- ing. arXiv preprint arXiv:2002.00211, 2020. [117] T. Li, A. K. Sahu, M. Zaheer, M. Sanjabi, A. Talwalkar, and V. Smith. Federated optimization in heteroge- neous networks. Proceedings of Machine Learning and Systems, 2:429–450, 2020. [118] T. Li, S. Hu, A. Beirami, and V. Smith. Ditto: Fair and robust federated learning through personaliza- In International Conference on Machine Learning, tion. pages 6357–6368. PMLR, 2021. [119] Y. Li and W. Xu. Privpy: General and scalable privacy- In Proceedings of the 25th preserving data mining. ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 1299–1307, 2019. [120] Z. Li and Y. Zhang. Label-leaks: Membership infer- ence attack with label. arXiv preprint arXiv:2007.15528, 2020. [121] Z. Li, H. Yu, T. Zhou, L. Luo, M. Fan, Z. Xu, and G. Sun. Byzantine resistant secure blockchained feder- ated learning at the edge. IEEE Network, 35(4):295–301, 2021. [122] Z. Li, Y. He, H. Yu, J. Kang, X. Li, Z. Xu, and D. Niy- ato. Data heterogeneity-robust federated learning via group client selection in industrial iot. IEEE Internet Things J., 9(18):17844–17857, 2022. [123] T. Lin, L. Kong, S. U. Stich, and M. Jaggi. Ensemble distillation for robust model fusion in federated learn- ing. Advances in Neural Information Processing Systems, 33:2351–2363, 2020. [124] H. Liu, Y. Wang, W. Fan, X. Liu, Y. Li, S. Jain, Y. Liu, A. K. Jain, and J. Tang. Trustworthy ai: A compu- tational perspective. arXiv preprint arXiv:2107.06641, 2021. [125] J. Liu, M. Juuti, Y. Lu, and N. Asokan. Oblivious neu- ral network predictions via minionn transformations. In Proceedings of the 2017 ACM SIGSAC conference on computer and communications security, pages 619–631, 2017. [126] R. Liu, Y. Cao, M. Yoshikawa, and H. Chen. Fedsel: Federated sgd under local differential privacy with top-k dimension selection. In International Conference on Database Systems for Advanced Applications, pages 485–501. Springer, 2020. [127] T. Liu, X. Hu, and T. Shu. Technical report: Assisting backdoor federated learning with whole population knowledge alignment. arXiv preprint arXiv:2207.12327, 2022. [128] X. Liu, H. Li, G. Xu, R. Lu, and M. He. Adaptive privacy-preserving federated learning. Peer-to-Peer Networking and Applications, 13(6):2356–2366, 2020. [129] Y. Liu, Y. Kang, T. Zou, Y. Pu, Y. He, X. Ye, Y. Ouyang, Y.-Q. Zhang, and Q. Yang. Vertical federated learning. arXiv preprint arXiv:2211.12814, 2022. [130] H. Lu, C. Liu, T. He, S. Wang, and K. S. Chan. Sharing models or coresets: A study based on membership inference attack. arXiv preprint arXiv:2007.02977, 2020. [131] S. Lu, Y. Zhang, and Y. Wang. Decentralized federated In 2020 54th learning for electronic health records. Annual Conference on Information Sciences and Systems (CISS), pages 1–5. IEEE, 2020. [132] Y. Lu, X. Huang, Y. Dai, S. Maharjan, and Y. Zhang. Differentially private asynchronous federated learn- ing for mobile edge computing in urban informatics. IEEE Transactions on Industrial Informatics, 16(3):2134– 2143, 2019. [133] L. Lyu, H. Yu, and Q. Yang. Threats to federated arXiv preprint arXiv:2003.02133, learning: A survey. 2020. [134] K. Mandal, G. Gong, and C. Liu. Nike-based fast privacy-preserving highdimensional data aggregation IEEE T Depend Secure; Technical for mobile devices. Report; University of Waterloo: Waterloo, ON, Canada, pages 142–149, 2018. [135] Y. Mansour, M. Mohri, J. Ro, and A. T. Suresh. Three approaches for personalization with applications to arXiv preprint arXiv:2002.10619, federated learning. 2020. [136] Y. Mao, C. You, J. Zhang, K. Huang, and K. B. Letaief. A survey on mobile edge computing: The commu- IEEE communications surveys & nication perspective. tutorials, 19(4):2322–2358, 2017. [137] B. McMahan, E. Moore, D. Ramage, S. Hampson, and B. A. y Arcas. Communication-efficient learning of In Artificial deep networks from decentralized data. intelligence and statistics, pages 1273–1282. PMLR, 2017. [138] B. McMahan, E. Moore, D. Ramage, S. Hampson, and B. A. y Arcas. Communication-efficient learning of In Artificial deep networks from decentralized data. intelligence and statistics, pages 1273–1282. PMLR, 2017. [139] H. B. McMahan, D. Ramage, K. Talwar, and L. Zhang. language Learning differentially private recurrent models. arXiv preprint arXiv:1710.06963, 2017. [140] L. Melis, C. Song, E. De Cristofaro, and V. Shmatikov. Exploiting unintended feature leakage in collabora- tive learning. In 2019 IEEE symposium on security and privacy (SP), pages 691–706. IEEE, 2019. [141] L. Melis, C. Song, E. De Cristofaro, and V. Shmatikov. Exploiting unintended feature leakage in collabora- tive learning. In 2019 IEEE symposium on security and privacy (SP), pages 691–706. IEEE, 2019. [142] P. Mishra, R. Lehmkuhl, A. Srinivasan, W. Zheng, and R. A. Popa. Delphi: A cryptographic inference service for neural networks. In 29th USENIX Security Symposium (USENIX Security 20), pages 2505–2522, 2020. [143] F. Mo and H. Haddadi. Efficient and private federated In Proc. EuroSys Conf., Dresden, learning using tee. Germany, 2019. 24 [144] F. Mo, A. Borovykh, M. Malekzadeh, H. Haddadi, and S. Demetriou. Layer-wise characterization of latent information leakage in federated learning. arXiv preprint arXiv:2010.08762, 2020. [145] P. Mohassel and P. Rindal. ABY3: A mixed protocol framework for machine learning. In Proc. CCS, pages 35–52, 2018. [146] P. Mohassel and Y. Zhang. SecureML: A system for scalable privacy-preserving machine learning. In IEEE Symposium on Security and Privacy, pages 19–38, 2017. [147] L. Mu ̃noz-Gonz ́alez, K. T. Co, and E. C. Lupu. learning arXiv preprint Byzantine-robust through adaptive model averaging. arXiv:1909.05125, 2019. federated machine [148] M. Naseri, J. Hayes, and E. De Cristofaro. Toward robustness and privacy in federated learning: Exper- imenting with local and central differential privacy. arXiv e-prints, pages arXiv–2009, 2020. [149] M. Nasr, R. Shokri, and A. Houmansadr. Machine learning with membership privacy using adversarial regularization. In Proceedings of the 2018 ACM SIGSAC conference on computer and communications security, pages 634–646, 2018. [150] M. Nasr, R. Shokri, and A. Houmansadr. Comprehen- sive privacy analysis of deep learning: Passive and active white-box inference attacks against centralized In 2019 IEEE symposium on and federated learning. security and privacy (SP), pages 739–753. IEEE, 2019. [151] K. L. Ng, Z. Chen, Z. Liu, H. Yu, Y. Liu, and Q. Yang. A multi-player game for studying federated learning incentive schemes. In Proceedings of the Twenty-Ninth International Conference on International Joint Confer- ences on Artificial Intelligence, pages 5279–5281, 2021. [152] P. Paillier. Public-key cryptosystems based on com- posite degree residuosity classes. In International con- ference on the theory and applications of cryptographic techniques, pages 223–238. Springer, 1999. [153] A. Patra and A. Suresh. Blaze: Blazing fast privacy- Cryptology ePrint preserving machine learning. Archive, 2020. [154] A. Patra, T. Schneider, A. Suresh, and H. Yalame. {ABY2. 0}: Improved {Mixed-Protocol} secure {Two- Party} computation. In 30th USENIX Security Sympo- sium (USENIX Security 21), pages 2165–2182, 2021. [155] W. Pedrycz. Federated fcm: Clustering under privacy IEEE Transactions on Fuzzy Systems, requirements. 2021. [156] D. Peng, Z. Sun, Z. Chen, Z. Cai, L. Xie, and L. Jin. Detecting heads using feature refine net and cascaded In 2018 24th International multi-scale architecture. Conference on Pattern Recognition (ICPR), pages 2528– 2533. IEEE, 2018. [157] K. Pillutla, S. M. Kakade, and Z. Harchaoui. Robust arXiv preprint aggregation for federated learning. arXiv:1912.13445, 2019. [158] A. Portnoy, Y. Tirosh, and D. Hendler. Towards feder- ated learning with byzantine-robust client weighting. Applied Sciences, 12(17):8847, 2022. [159] S. Prakash and A. S. Avestimehr. Mitigating byzan- arXiv preprint tine attacks in federated learning. arXiv:2010.07541, 2020. [160] A. Pustozerova and R. Mayer. Information leaks In Proceedings of the Network in federated learning. and Distributed System Security Symposium, volume 10, 2020. [161] Y. Qu, L. Gao, T. H. Luan, Y. Xiang, S. Yu, B. Li, and G. Zheng. Decentralized privacy using blockchain- IEEE enabled federated learning in fog computing. Internet of Things Journal, 7(6):5171–5183, 2020. [162] M. O. Rabin. How to exchange secrets with oblivious transfer. Cryptology ePrint Archive, 2005. [163] D. Rathee, M. Rathee, N. Kumar, N. Chandran, D. Gupta, A. Rastogi, and R. Sharma. Cryptflow2: In Proceedings of Practical 2-party secure inference. the 2020 ACM SIGSAC Conference on Computer and Communications Security, pages 325–342, 2020. [164] D. Rathee, M. Rathee, R. K. K. Goli, D. Gupta, R. Sharma, N. Chandran, and A. Rastogi. Sirnn: A In 2021 IEEE math library for secure rnn inference. Symposium on Security and Privacy (SP), pages 1003– 1020, 2021. [165] R. Rau, R. Wardrop, and L. Zingales. The Palgrave Handbook of Technological Finance. Springer, 2021. [166] S. Reddi, Z. Charles, M. Zaheer, Z. Garrett, K. Rush, J. Koneˇcn `y, S. Kumar, and H. B. McMahan. arXiv preprint Adaptive federated optimization. arXiv:2003.00295, 2020. [167] A. Reisizadeh, F. Farnia, R. Pedarsani, and A. Jad- babaie. Robust federated learning: The case of affine distribution shifts. Advances in Neural Information Processing Systems, 33:21554–21565, 2020. [168] M. S. Riazi, C. Weinert, O. Tkachenko, E. M. Songhori, T. Schneider, and F. Koushanfar. Chameleon: A hybrid secure computation framework for machine learning In Proceedings of the 2018 on Asia con- applications. ference on computer and communications security, pages 707–721, 2018. [169] M. S. Riazi, M. Samragh, H. Chen, K. Laine, K. Lauter, and F. Koushanfar. {XONN}:{XNOR-based} oblivi- ous deep neural network inference. In 28th USENIX Security Symposium (USENIX Security 19), pages 1501– 1518, 2019. [170] R. L. Rivest, L. Adleman, M. L. Dertouzos, et al. On data banks and privacy homomorphisms. Foundations of secure computation, 4(11):169–180, 1978. [171] M.-A. Rizoiu, T. Graham, R. Zhang, Y. Zhang, R. Ack- land, and L. Xie. # debatenight: The role and influence of socialbots on twitter during the 1st 2016 us presi- dential debate. In Proceedings of the international AAAI conference on web and social media, volume 12, 2018. [172] N. Rodr ́ıguez-Barroso, D. Jim ́enez-L ́opez, M. V. Luz ́on, F. Herrera, and E. Mart ́ınez-C ́amara. Survey on federated learning threats: concepts, taxonomy on attacks and defences, experimental study and chal- lenges. Information Fusion, 90:148–173, 2023. [173] D. Rong, Q. He, and J. Chen. Poisoning deep learn- ing based recommender model in federated learning scenarios. arXiv preprint arXiv:2204.13594, 2022. [174] B. D. Rouhani, M. S. Riazi, and F. Koushanfar. Deepse- cure: Scalable provably-secure deep learning. In Pro- ceedings of the 55th annual design automation conference, pages 1–6, 2018. 25 [175] T. Ryffel, P. Tholoniat, D. Pointcheval, and F. Bach. Ar- iaNN: Low-interaction privacy-preserving deep learn- ing via function secret sharing. Proc. on Privacy En- hancing Technologies, 2022(1):291–316, 2020. [176] O. Saha, A. Kusupati, H. V. Simhadri, M. Varma, and P. Jain. Rnnpool: efficient non-linear pooling for ram constrained inference. Advances in Neural Information Processing Systems, 33:20473–20484, 2020. [177] A. Sannai. Reconstruction of training samples from loss functions. arXiv preprint arXiv:1805.07337, 2018. [178] F. Sattler, K.-R. M ̈uller, and W. Samek. Clustered federated learning: Model-agnostic distributed mul- IEEE titask optimization under privacy constraints. transactions on neural networks and learning systems, 32 (8):3710–3722, 2020. [179] F. Sattler, K.-R. M ̈uller, T. Wiegand, and W. Samek. On the byzantine robustness of clustered federated learn- ing. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 8861–8865. IEEE, 2020. [180] M. Seif, R. Tandon, and M. Li. Wireless federated learning with local differential privacy. In 2020 IEEE International Symposium on Information Theory (ISIT), pages 2604–2609. IEEE, 2020. [181] H. Seo, J. Park, S. Oh, M. Bennis, and S.-L. Kim. arXiv preprint Federated knowledge distillation. arXiv:2011.02367, 2020. [182] M. Shafique, M. Naseer, T. Theocharides, C. Kyrkou, O. Mutlu, L. Orosa, and J. Choi. Robust machine learn- ing systems: Challenges, current trends, perspectives, and the road ahead. IEEE Design & Test, 37(2):30–57, 2020. [183] A. Shamir. How to share a secret. Communications of the ACM, 22(11):612–613, 1979. [184] M. Shen, H. Wang, B. Zhang, L. Zhu, K. Xu, Q. Li, and X. Du. Exploiting unintended property leakage in blockchain-assisted federated learning for intelligent edge computing. IEEE Internet of Things Journal, 8(4): 2265–2275, 2020. [185] R. Shokri, M. Stronati, C. Song, and V. Shmatikov. Membership inference attacks against machine learn- In 2017 IEEE symposium on security and ing models. privacy (SP), pages 3–18. IEEE, 2017. [186] R. Shokri, M. Stronati, C. Song, and V. Shmatikov. Membership inference attacks against machine learn- In 2017 IEEE symposium on security and ing models. privacy (SP), pages 3–18. IEEE, 2017. [187] N. A. Smuha. The eu approach to ethics guidelines for trustworthy artificial intelligence. Computer Law Review International, 20(4):97–106, 2019. [188] M. Song, Z. Wang, Z. Zhang, Y. Song, Q. Wang, J. Ren, and H. Qi. Analyzing user-level privacy attack against IEEE Journal on Selected Areas in federated learning. Communications, 38(10):2430–2444, 2020. [189] Z. Song, Z. Meng, Y. Zhang, and I. King. Semi- supervised multi-label learning for graph-structured In Proceedings of the 30th ACM International data. Conference on Information & Knowledge Management, pages 1723–1733, 2021. [190] Z. Song, Y. Zhang, and I. King. Towards an op- timal asymmetric graph structure for robust semi- In Proceedings of the supervised node classification. 28th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, pages 1656–1665, 2022. P. Mittal, and T. Rabin. Falcon: Honest-majority ma- liciously secure framework for private deep learning. arXiv preprint arXiv:2004.02229, 2020. 26 [191] M. Stallmann and A. Wilbik. Towards federated clus- tering: A federated fuzzy c-means algorithm (ffcm). arXiv preprint arXiv:2201.07316, 2022. [192] L. Su and J. Xu. Securing distributed gradient descent in high dimensional statistical learning. Proceedings of the ACM on Measurement and Analysis of Computing Systems, 3(1):1–41, 2019. [193] P. Subramanyan, R. Sinha, I. Lebedev, S. Devadas, and S. A. Seshia. A formal foundation for secure remote execution of enclaves. In Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security, pages 2435–2450, 2017. [194] L. Sun, J. Qian, and X. Chen. Ldp-fl: Practical private aggregation in federated learning with local differen- tial privacy. arXiv preprint arXiv:2007.15789, 2020. [195] Z. Sun, P. Kairouz, A. T. Suresh, and H. B. McMahan. Can you really backdoor federated learning? arXiv preprint arXiv:1911.07963, 2019. [196] C. T Dinh, N. Tran, and J. Nguyen. Personalized fed- erated learning with moreau envelopes. Advances in Neural Information Processing Systems, 33:21394–21405, 2020. [197] A. Z. Tan, H. Yu, L. Cui, and Q. Yang. Towards personalized federated learning. IEEE Transactions on Neural Networks and Learning Systems, 2022. [198] S. Tan, B. Knott, Y. Tian, and D. J. Wu. Cryptgpu: Fast privacy-preserving machine learning on the gpu. In 2021 IEEE Symposium on Security and Privacy (SP), pages 1021–1038. IEEE, 2021. [199] J. O. d. Terrail, S.-S. Ayed, E. Cyffers, F. Grimberg, C. He, R. Loeb, P. Mangold, T. Marchand, O. Marfoq, E. Mushtaq, et al. Flamby: Datasets and benchmarks for cross-silo federated learning in realistic healthcare settings. arXiv preprint arXiv:2210.04620, 2022. [200] V. Tolpegin, S. Truex, M. E. Gursoy, and L. Liu. Data poisoning attacks against federated learning systems. In European Symposium on Research in Computer Secu- rity, pages 480–501. Springer, 2020. [201] A. Triastcyn and B. Faltings. Federated learning with In 2019 IEEE Interna- bayesian differential privacy. tional Conference on Big Data (Big Data), pages 2587– 2596. IEEE, 2019. [202] S. Truex, L. Liu, M. E. Gursoy, L. Yu, and W. Wei. De- mystifying membership inference attacks in machine IEEE Transactions on Services learning as a service. Computing, 2019. [203] S. Truex, L. Liu, K.-H. Chow, M. E. Gursoy, and W. Wei. Ldp-fed: Federated learning with local dif- In Proceedings of the Third ACM ferential privacy. International Workshop on Edge Systems, Analytics and Networking, pages 61–66, 2020. [204] K. R. Varshney. Trustworthy machine learning and artificial intelligence. XRDS: Crossroads, The ACM Magazine for Students, 25(3):26–29, 2019. [205] S. Wagh, D. Gupta, and N. Chandran. SecureNN: 3- Party secure computation for neural network training. Proc. Priv. Enhancing Technol., 2019(3):26–49, 2019. [206] S. Wagh, S. Tople, F. Benhamouda, E. Kushilevitz, [207] H. Wang, K. Sreenivasan, S. Rajput, H. Vishwakarma, S. Agarwal, J.-y. Sohn, K. Lee, and D. Papailiopou- los. Attack of the tails: Yes, you really can backdoor federated learning. Advances in Neural Information Processing Systems, 33:16070–16084, 2020. [208] J. Wang, Q. Liu, H. Liang, G. Joshi, and H. V. Poor. Tackling the objective inconsistency problem in het- erogeneous federated optimization. Advances in neural information processing systems, 33:7611–7623, 2020. [209] L. Wang, S. Xu, X. Wang, and Q. Zhu. Eavesdrop the composition proportion of training labels in federated learning. arXiv preprint arXiv:1910.06044, 2019. [210] Y. Wang, Y. Tong, and D. Shi. Federated latent dirichlet allocation: A local differential privacy based frame- work. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 6283–6290, 2020. [211] Y. Wang, M. Jia, N. Gao, L. Von Krannichfeldt, M. Sun, and G. Hug. Federated clustering for electricity con- IEEE Transactions on sumption pattern extraction. Smart Grid, 13(3):2425–2439, 2022. [212] Z. Wang, M. Song, Z. Zhang, Y. Song, Q. Wang, and H. Qi. Beyond inferring class representatives: User- level privacy leakage from federated learning. In IEEE INFOCOM 2019-IEEE Conference on Computer Communications, pages 2512–2520. IEEE, 2019. [213] J.-L. Watson, S. Wagh, and R. A. Popa. Piranha: A {GPU} platform for secure computation. In 31st USENIX Security Symposium (USENIX Security 22), pages 827–844, 2022. [214] K. Wei, J. Li, M. Ding, C. Ma, H. H. Yang, F. Farokhi, S. Jin, T. Q. Quek, and H. V. Poor. Federated learn- ing with differential privacy: Algorithms and per- IEEE Transactions on Information formance analysis. Forensics and Security, 15:3454–3469, 2020. [215] W. Wei, L. Liu, M. Loper, K.-H. Chow, M. E. Gursoy, S. Truex, and Y. Wu. A framework for evaluating client In European privacy leakages in federated learning. Symposium on Research in Computer Security, pages 545–566. Springer, 2020. [216] M. Wu, D. Ye, J. Ding, Y. Guo, R. Yu, and M. Pan. Incentivizing differentially private federated learning: A multidimensional contract approach. IEEE Internet of Things Journal, 8(13):10639–10651, 2021. [217] Y. Wu, S. Cai, X. Xiao, G. Chen, and B. C. Ooi. Privacy preserving vertical federated learning for tree-based models. arXiv preprint arXiv:2008.06170, 2020. [218] Z. Wu, Q. Ling, T. Chen, and G. B. Giannakis. Fed- erated variance-reduced stochastic gradient descent IEEE Transac- with robustness to byzantine attacks. tions on Signal Processing, 68:4583–4596, 2020. [219] X. Xiao, G. Wang, and J. Gehrke. Differential privacy via wavelet transforms. IEEE Transactions on knowledge and data engineering, 23(8):1200–1214, 2010. and I. Gupta. [220] C. Xie, O. Koyejo, alized byzantine-tolerant arXiv:1802.10116, 2018. sgd. arXiv Gener- preprint [221] C. Xie, K. Huang, P.-Y. Chen, and B. Li. Dba: Dis- tributed backdoor attacks against federated learning. In International Conference on Learning Representations, 2019. cal rates. In International Conference on Machine Learn- ing, pages 5650–5659. PMLR, 2018. 27 [222] C. Xie, O. Koyejo, and I. Gupta. Slsgd: Secure and effi- cient distributed on-device machine learning. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pages 213–228. Springer, 2019. [223] C. Xie, S. Koyejo, and I. Gupta. Zeno++: Robust fully asynchronous sgd. In International Conference on Machine Learning, pages 10495–10503. PMLR, 2020. [224] C. Xie, M. Chen, P.-Y. Chen, and B. Li. Crfl: Certifiably robust federated learning against backdoor attacks. In International Conference on Machine Learning, pages 11372–11382. PMLR, 2021. [225] L. Xie, J. Liu, S. Lu, T.-H. Chang, and Q. Shi. An efficient learning framework for federated xgboost using secret sharing and distributed optimization. ACM Transactions on Intelligent Systems and Technology (TIST), 13(5):1–28, 2022. [226] M. Xie, G. Long, T. Shen, T. Zhou, X. Wang, J. Jiang, and C. Zhang. Multi-center federated learning. arXiv preprint arXiv:2005.01026, 2020. [227] Y. Xie, Z. Wang, D. Chen, D. Gao, L. Yao, W. Kuang, Y. Li, B. Ding, and J. Zhou. Federatedscope: A com- prehensive and flexible federated learning platform via message passing. arXiv preprint arXiv:2204.05011, 2022. [228] G. Xu, H. Li, S. Liu, K. Yang, and X. Lin. Verifynet: Secure and verifiable federated learning. IEEE Transac- tions on Information Forensics and Security, 15:911–926, 2019. [229] M. Xu and X. Li. Subject property inference attack In 2020 12th International in collaborative learning. Conference on Intelligent Human-Machine Systems and Cybernetics (IHMSC), volume 1, pages 227–231. IEEE, 2020. [230] X. Xu, J. Wu, M. Yang, T. Luo, X. Duan, W. Li, Y. Wu, and B. Wu. Information leakage by model weights on federated learning. In Proceedings of the 2020 Work- shop on Privacy-Preserving Machine Learning in Practice, pages 31–36, 2020. [231] K. Yang, C. Weng, X. Lan, J. Zhang, and X. Wang. Ferret: Fast extension for correlated ot with small com- munication. In Proceedings of the 2020 ACM SIGSAC Conference on Computer and Communications Security, pages 1607–1626, 2020. [232] Q. Yang, Y. Liu, T. Chen, and Y. Tong. Federated ma- chine learning: Concept and applications. ACM Trans- actions on Intelligent Systems and Technology (TIST), 10 (2):1–19, 2019. [233] S. Yang, B. Ren, X. Zhou, and L. Liu. Paral- lel distributed logistic regression for vertical feder- ated learning without third-party coordinator. arXiv preprint arXiv:1911.09824, 2019. [234] A. C. Yao. Protocols for secure computations. In 23rd annual symposium on foundations of computer science (sfcs 1982), pages 160–164. IEEE, 1982. [235] A. C.-C. Yao. How to generate and exchange secrets. In Annual Symposium on Foundations of Computer Sci- ence, pages 162–167, 1986. [236] D. Yin, Y. Chen, R. Kannan, and P. Bartlett. Byzantine- robust distributed learning: Towards optimal statisti- [237] H. Yin, A. Mallya, A. Vahdat, J. M. Alvarez, J. Kautz, See through gradients: Image and P. Molchanov. batch recovery via gradinversion. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 16337–16346, 2021. [238] X. Yin, Y. Zhu, and J. Hu. A comprehensive survey of privacy-preserving federated learning: A taxonomy, review, and future directions. ACM Computing Surveys (CSUR), 54(6):1–36, 2021. [239] C. Yu, H. Tang, C. Renggli, S. Kassing, A. Singla, D. Alistarh, C. Zhang, and J. Liu. Distributed learning In International Conference over unreliable networks. on Machine Learning, pages 7202–7212. PMLR, 2019. [240] H. Yu, S. Yang, and S. Zhu. Parallel restarted sgd with faster convergence and less communication: Demysti- fying why model averaging works for deep learning. In Proceedings of the AAAI Conference on Artificial Intel- ligence, volume 33, pages 5693–5700, 2019. [241] X. Yuan, X. Ma, L. Zhang, Y. Fang, and D. Wu. Beyond class-level privacy leakage: Breaking record- IEEE Internet of level privacy in federated learning. Things Journal, 9(4):2555–2565, 2021. [242] K. Yue, R. Jin, C.-W. Wong, D. Baron, and H. Dai. Gradient obfuscation gives a false sense of security in federated learning. arXiv preprint arXiv:2206.04055, 2022. [243] D. Zeng, S. Liang, X. Hu, and Z. Xu. Fedlab: A flexible federated learning framework. CoRR, abs/2107.11621, 2021. URL https://arxiv.org/abs/2107.11621. [244] S. Zeng, Z. Li, H. Yu, Y. He, Z. Xu, D. Niyato, and H. Yu. Heterogeneous federated learning via grouped In Database Systems sequential-to-parallel training. for Advanced Applications - 27th International Confer- ence, DASFAA 2022,, volume 13246, pages 455–471. Springer, 2022. [245] C. Zhang, S. Li, J. Xia, W. Wang, F. Yan, and Y. Liu. {BatchCrypt}: Efficient homomorphic encryption for {Cross-Silo} federated learning. In 2020 USENIX Annual Technical Conference (USENIX ATC 20), pages 493–506, 2020. [246] C. Zhang, Y. Liu, L. Wang, Y. Liu, L. Li, and N. Zheng. Joint intelligence ranking by federated multiplicative update. IEEE Intelligent Systems, 35(4):15–24, 2020. [247] C. Zhang, J. Xia, B. Yang, H. Puyang, W. Wang, R. Chen, I. E. Akkus, P. Aditya, and F. Yan. Citadel: Protecting data privacy and model confidentiality for In Proceedings of the ACM collaborative learning. Symposium on Cloud Computing, pages 546–561, 2021. [248] H. Zhang, B. Wu, X. Yuan, S. Pan, H. Tong, and J. Pei. Trustworthy graph neural networks: Aspects, methods and trends. arXiv preprint arXiv:2205.07424, 2022. [249] J. Zhang, Z. Zhang, X. Xiao, Y. Yang, and M. Winslett. Functional mechanism: regression analysis under dif- ferential privacy. arXiv preprint arXiv:1208.0219, 2012. [250] W. Zhang, S. Tople, and O. Ohrimenko. Leakage of dataset properties in {Multi-Party} machine learning. In 30th USENIX Security Symposium (USENIX Security 21), pages 2687–2704, 2021. 28 preprint arXiv:1806.00582, 2018. [266] Y. Zhao, J. Zhao, M. Yang, T. Wang, N. Wang, L. Lyu, D. Niyato, and K.-Y. Lam. Local differential privacy- based federated learning for internet of things. IEEE Internet of Things Journal, 8(11):8836–8853, 2020. [267] H. Zheng, H. Hu, and Z. Han. Preserving user privacy for machine learning: local differential privacy or fed- erated machine learning? IEEE Intelligent Systems, 35 (4):5–14, 2020. [268] H. Zhu, J. Xu, S. Liu, and Y. Jin. Federated learning on non-iid data: A survey. Neurocomputing, 465:371–390, 2021. [269] J.-Y. Zhu, T. Park, P. Isola, and A. A. Efros. Unpaired image-to-image translation using cycle-consistent ad- versarial networks. In Proceedings of the IEEE interna- tional conference on computer vision, pages 2223–2232, 2017. [270] L. Zhu, Z. Liu, and S. Han. Deep leakage from gradients. Advances in neural information processing systems, 32, 2019. [271] W. Zhu, M. Wei, X. Li, and Q. Li. Securebinn: 3- party secure computation for binarized neural net- In European Symposium on Research work inference. in Computer Security, pages 275–294. Springer, 2022. [272] Z. Zhu, J. Hong, and J. Zhou. Data-free knowledge distillation for heterogeneous federated learning. In International Conference on Machine Learning, pages 12878–12889. PMLR, 2021. [273] A. Ziller, A. Trask, A. Lopardo, B. Szymkow, B. Wagner, E. Bluemke, J.-M. Nounahon, J. Passerat- Palmbach, K. Prakash, N. Rose, et al. Pysyft: A library In Federated Learning for easy federated learning. Systems, pages 111–139. Springer, 2021. [251] X. Zhang, A. Fu, H. Wang, C. Zhou, and Z. Chen. A privacy-preserving and verifiable federated learning scheme. In ICC 2020-2020 IEEE International Conference on Communications (ICC), pages 1–6. IEEE, 2020. [252] Y. Zhang and Q. Yang. A survey on multi-task IEEE Transactions on Knowledge and Data learning. Engineering, 2021. [253] Y. Zhang and H. Zhu. Doc2hash: Learning discrete latent variables for documents retrieval. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Pa- pers), June 2019. doi: 10.18653/v1/N19-1232. URL https://aclanthology.org/N19-1232. [254] Y. Zhang and H. Zhu. Additively homomorphical encryption based deep neural network for asymmet- rically collaborative machine learning. arXiv preprint arXiv:2007.06849, 2020. [255] Y. Zhang and H. Zhu. Additively homomorphical encryption based deep neural network for asymmet- rically collaborative machine learning. arXiv preprint arXiv:2007.06849, 2020. [256] Y. Zhang and H. Zhu. Discrete wasserstein autoen- coders for document retrieval. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 8159–8163. IEEE, 2020. [257] Y. Zhang, H. Zhu, Z. Meng, P. Koniusz, and I. King. Graph-adaptive rectified linear unit for graph neural In Proceedings of the ACM Web Conference networks. 2022, pages 1331–1339, 2022. [258] Y. Zhang, H. Zhu, Z. Song, P. Koniusz, and I. King. Costa: Covariance-preserving feature augmentation In Proceedings of the for graph contrastive learning. 28th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, pages 2524–2534, 2022. [259] Y. Zhang, H. Zhu, Z. Song, P. Koniusz, and I. King. Spectral feature augmentation for graph contrastive learning and beyond. arXiv preprint arXiv:2212.01026, 2022. [260] Z. Zhang, X. Cao, J. Jia, and N. Z. Gong. Fldetector: Defending federated learning against model poison- ing attacks via detecting malicious clients. In Proceed- ings of the 28th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, pages 2545–2555, 2022. [261] B. Zhao, K. R. Mopuri, and H. Bilen. idlg: Im- proved deep leakage from gradients. arXiv preprint arXiv:2001.02610, 2020. [262] B. Zhao, K. Fan, K. Yang, Z. Wang, H. Li, and Y. Yang. Anonymous and privacy-preserving federated learn- IEEE Transactions on ing with industrial big data. Industrial Informatics, 17(9):6314–6323, 2021. [263] B. Zhao, P. Sun, T. Wang, and K. Jiang. Fedinv: Byzantine-robust federated learning by inversing lo- cal model updates. 2022. [264] K. Zhao, W. Xi, Z. Wang, J. Zhao, R. Wang, and Z. Jiang. Smss: Secure member selection strategy in federated learning. IEEE Intelligent Systems, 35(4):37– 49, 2020. [265] Y. Zhao, M. Li, L. Lai, N. Suda, D. Civin, and V. Chan- arXiv dra. Federated learning with non-iid data.
http://arxiv.org/abs/2302.10636v2
2023-05-25T22:19:58
2023-02-21T12:50:05
$ω$PAP Spaces: Reasoning Denotationally About Higher-Order, Recursive Probabilistic and Differentiable Programs
We introduce a new setting, the category of $\omega$PAP spaces, for reasoning denotationally about expressive differentiable and probabilistic programming languages. Our semantics is general enough to assign meanings to most practical probabilistic and differentiable programs, including those that use general recursion, higher-order functions, discontinuous primitives, and both discrete and continuous sampling. But crucially, it is also specific enough to exclude many pathological denotations, enabling us to establish new results about both deterministic differentiable programs and probabilistic programs. In the deterministic setting, we prove very general correctness theorems for automatic differentiation and its use within gradient descent. In the probabilistic setting, we establish the almost-everywhere differentiability of probabilistic programs' trace density functions, and the existence of convenient base measures for density computation in Monte Carlo inference. In some cases these results were previously known, but required detailed proofs with an operational flavor; by contrast, all our proofs work directly with programs' denotations.
[ "Mathieu Huot", "Alexander K. Lew", "Vikash K. Mansinghka", "Sam Staton" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10636v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10636v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.PL", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.PL", "cs.LG", "cs.LO" ]
ωPAP Spaces: Reasoning Denotationally About Higher-Order, Recursive Probabilistic and Differentiable Programs Mathieu Huot∗, Alexander K. Lew∗, Vikash K. Mansinghka, and Sam Staton 3 2 0 2 y a M 5 2 ] L P . s c [ 2 v 6 3 6 0 1 . 2 0 3 2 : v i X r a Abstract-We introduce a new setting, the category of ωPAP spaces, for reasoning denotationally about expressive differen- tiable and probabilistic programming languages. Our semantics is general enough to assign meanings to most practical probabilistic and differentiable programs, including those that use general recursion, higher-order functions, discontinuous primitives, and discrete and continuous sampling. But crucially, it is also specific enough to exclude many pathological denotations, enabling us to establish new results about differentiable and probabilistic programs. In the differentiable setting, we prove general correct- ness theorems for automatic differentiation and its use within gradient descent. In the probabilistic setting, we establish the almost-everywhere differentiability of probabilistic programs' trace density functions, and the existence of convenient base measures for density computation in Monte Carlo inference. In some cases these results were previously known, but required detailed proofs of an operational flavor; by contrast, all our proofs work directly with programs' denotations. I. INTRODUCTION This paper introduces a new setting, the category of ωPAP spaces, for reasoning denotationally about expressive prob- abilistic and differentiable programs, and demonstrates its utility in several applications. The ωPAP spaces are built using the same categorical machinery [1] that underlies the ω-quasi-Borel spaces [2] and the ω-diffeological-spaces [3, 4], two other recent proposals for understanding higher-order, recursive probabilistic and differentiable programs. The key difference is that instead of taking the measurable maps (as in ωQbs) or the smooth maps (as in ωDiff) as the primitives in our development, we instead use the functions that are piecewise analytic under analytic partition, or PAP [5]. Whereas the smooth functions exclude many primitives used in practice (e.g., < : real → real → B), and the measurable functions admit many pathological examples from analysis (the Cantor function, the Weierstrass function, space-filling curves), the PAP functions manage to exhibit very few patholo- gies while still including nearly all primitives exposed by to- day's differentiable and probabilistic programming languages. As a result, our semantics can interpret most differentiable and probabilistic programs that arise in practice, and can be used to provide short denotational proofs of many interesting properties. As evidence for this claim, we use our semantics to establish new results (and give new, simplified proofs of old results) about the correctness of automatic differentiation, the *Equal contribution 979-8-3503-3587-3/23/$31.00 ©2023 IEEE convergence of automatic-differentiation gradient descent, and the supports and densities of recursive probabilistic programs. A. A "Just-Specific-Enough" Semantic Model In denotational accounts of deterministic and probabilis- tic programming languages, deterministic programs typically denote functions and probabilistic programs typically denote measure kernels. But what kinds of functions and kernels? The more specific our answer to that question, the more we can hope to prove-purely denotationally-about our lan- guages. For example, consider the question of commutativity: is it the case that, whenever x does not occur free in s, Jlet x = t in let y = s in uK = Jlet y = s in let x = t in uK? In the probabilistic setting, this amounts to asking whether iterated integrals can always be reordered. If our semantics interprets programs as arbitrary measure kernels, then there is no obvious answer, because Fubini's theorem, which jus- tifies the interchange of iterated integrals, does not apply unconditionally. But by interpreting an expressive probabilistic language using only the s-finite kernels, Staton [6] was able to prove commutativity denotationally, using the specialization of Fubini's theorem to the s-finite case. Unfortunately, in the quest for semantic models with con- venient properties, we may end up excluding programs that programmers might write in practice. For example, in [3], all programs are interpreted as smooth functions, enabling an elegant semantic account of why automatic differentia- tion algorithms work (even in the presence of higher-order functions). But to achieve this nice theory, all non-smooth primitives (including, e.g., the function λx.λy.x < y) were excluded from the language under consideration. As a result, the theory has little to say about the behavior of automatic differentiation on non-smooth programs. In this work, our aim is to find a "just specific enough" semantic model of expressive probabilistic and differentiable programming languages: specific enough to establish interest- ing properties via denotational reasoning, but general enough to include nearly all programs of practical interest. Like the recently introduced quasi-Borel predomains [2], our model covers most probabilistic and differentiable programs that can be expressed in today's popular languages: it supports general recursion, higher-order functions, discrete and contin- uous sampling, and a broad class of primitive functions that includes nearly all the mathematical operations exposed by cant or : R - > R cant or x = i f x <= 1/ 3 t hen cant or ( 3 * x) el se i f x < 2/ 3 t hen x * x el se cant or ( 3 * x – 2) Fig. 1. A program that diverges on the 1 3 -Cantor set, but halts elsewhere in (0, 1). The characteristic function of the 1 3 -Cantor set is not PAP, so a naively defined interpretation of "partial PAP functions into R" as PAP functions into R + 1 would not suffice to interpret a language with general recursion. Our definition of partial ωPAP maps in Section II resolves the issue. comprehensive libraries for scientific computing and machine learning (such as numpy and scipy). But crucially, it also excludes many pathological functions and kernels that cannot be directly implemented in practice, such as the characteristic function of the Cantor set (whose construction involves an infinite limit that programs cannot compute in finite time). As a result, it is often possible to establish that a desirable property holds of all ωPAP maps between two spaces, and to then conclude that it holds of all programs of the appropriate type, without reasoning inductively about their construction or their operational semantics. The starting point in our search for a semantic model is Lee et al. [5]'s notion of piecewise analyticity under analytic partition (or PAP). The PAP functions are a particularly well- behaved subset of the functions between Euclidean spaces, and [5] makes a compelling argument that they are "specific enough" in the sense we describe above. For example, even though they are not necessarily differentiable, PAP functions admit a generalized notion of derivative, as well as a gen- eralized chain rule that can be used to give a denotational justification of automatic differentiation. These nice properties do not hold for slight generalizations of PAP, e.g. the class of almost-everywhere differentiable functions. Nevertheless, a reasonable worry is that PAP functions may be too narrow a semantic domain: do all programs arising in practice really denote PAP functions, or does the definition assume properties that not all programs enjoy? Lee et al. [5] establish that in a first-order language with PAP primitives and conditionals, all programs denote PAP functions. But real- world programs use many additional features, such as higher- order functions, general recursion, and probabilistic effects. In the presence of these features, do terms of first-order type still denote PAP functions? Consider the program in Fig. 1, for example: it uses recursion to define a partial function that diverges on the 1 3 -Cantor set, and halts on its complement. But we know that the (total) indicator function for the 1 3 - Cantor set is not PAP. This may seem like reason to doubt that [5]'s proposal can be cleanly extended to the general- recursive setting. Fortunately, however, it can: in Section II, we extend the definition of PAP to cover partial and higher-order functions. The resulting class of functions, the ωPAP maps, suffice to interpret all recursive, higher-order programs in an expressive call-by-value PCF, with a type of real numbers and PAP primitives (Theorem II.2). The ωPAP category also supports a strong monad of measures (Definition IV.5), enabling an interpretation of continuous sampling and soft conditioning, features common in modern probabilistic languages. To be clear, existing semantic frameworks can interpret sim- ilarly expressive languages (e.g., [2]). Our value proposition is that the ωPAP domain usefully excludes certain patholog- ical denotations that other settings allow. After defining our semantics in Section II, we devote the remainder of the paper to presenting evidence for this claim: new results (and new proofs of old results) that follow cleanly from denotational reasoning about ωPAP spaces and maps. B. Differentiable Programming and Automatic Differentiation Our first application of our semantics is to the study of automatic differentiation (AD), a family of techniques for mechanically computing derivatives of user-defined functions. It has found widespread use in machine learning and related disciplines, where practitioners are often interested in using gradient-based optimization algorithms, such as gradient de- scent, to fit model parameters to data. Languages with support for automatic differentiation are often called "differentiable programming languages," even if it may be the case that some programs do not denote everywhere-differentiable functions. When applied to straight-line programs built from differ- entiable primitives (without if statements, loops, and other control flow), AD has a straightforward justification using the chain rule. But in the presence of more expressive program- ming constructs, AD is harder to reason about: some programs encode partial or non-differentiable functions, and even when programs are differentiable, AD can fail to compute their true derivatives at some inputs. Our ωPAP semantics gives a clean account of the class of partial functions that recursive, higher-order programs built from "AD-friendly" primitives can express. In Section III, we use this characterization to establish guarantees about AD's behavior when applied to such programs: • We define a generalized notion of derivative, based on [5]'s intensional derivatives, and establish that every first- order ωPAP map is intensionally differentiable. • We adapt Huot et al. [3]'s denotational correctness proof of AD to prove that AD correctly computes intensional derivatives of all programs with first-order type, even if they use recursion and discontinuous primitives (Theo- rem III.4). This result is stronger than Mazza and Pagani [7]'s, which follows as a straightforward corollary. But the main benefit over their development is the simplicity of our proof, which mirrors Huot et al. [3]'s quite closely despite the greatly increased complexity of our language. • Using this characterization of what AD computes, we further prove the novel result that intensional gradient de- scent (which optimizes a differentiable function but using gradients computed by AD) converges with probability 1, if initialized with a randomized initial location and a randomized learning rate (Theorem III.8). This implies that gradient descent can be safely applied to recursive programs with conditionals so long as they denote differ- entiable functions, even if AD (which can disagree with the true derivative at some inputs) is used to compute gradients. Interestingly, if either the initial location or the learning rate is not randomized, a.s.-convergence is not guaranteed, and we present counterexamples of PyTorch programs that denote differentiable functions but cause PyTorch's gradient descent implementation to diverge (Propositions III.6 & III.7). Taken together, these results give a characterization of the behavior of AD in real systems like PyTorch and Tensorflow, even when they are applied to non-differentiable or recursive programs. C. Probabilistic Programming Probabilistic programming languages extend determinis- tic languages with support for random sampling and soft conditioning, making them an expressive representation both for probability distributions and for general (unnormalized) measures. Many probabilistic programs are intended to model some aspect of the world, and many questions of interest can be posed as questions about the expectations of cer- tain functions under (normalized versions of) these models. Probabilistic programming languages often come with tools for automatically running inference algorithms that estimate such posterior expectations. But the machinery for inference may make assumptions about the programs the user has written-for example, that the program has a density with respect to a well-behaved reference measure, or that its density is differentiable. Our next application of our semantics is to the problem of verifying that such properties hold for any program in an expressive probabilistic language. In Section IV, we extend the core language from Section II to include the sample and score commands. This requires changing our monad of effects, which in Section II covered only divergence, to also interpret randomness and condition- ing. We consider two different strong monads on ωPAP: one interprets probabilistic programs as s-finite measures (fol- lowing [2]), and the other as weighted sampling procedures (following [8, 9]). In each case, we can prove interesting properties of all probabilistic programs by working just with the class of ωPAP maps they denote: • Interpreting programs as weighted samplers, we prove that almost-surely terminating probabilistic programs have almost-everywhere differentiable weight functions (Theorem IV.1). This has been previously shown by Mak et al. [9], but our proof is substantially simpler, with no need for [9]'s stochastic symbolic execution technique. Our theorem is also slightly stronger, covering some programs that do not almost surely halt, and ruling out some pathological a.e.-differentiable weight functions. • Interpreting probabilistic programs as ωPAP measures, we prove that all programs of type Rn denote dis- tributions supported on a countable union of smooth submanifolds of Rn, and thus admit convenient densities with respect to a particular class of reference measures (Theorem IV.3). Besides being interesting in their own right, these results have consequences for the practical design and implementation of probabilistic programming systems. The first result is relevant to the application of gradient- least) based inference algorithms, which often require (at almost-everywhere differentiability to be sound. The second result is relevant for the automatic computation of densities or Radon-Nikodym derivatives of probabilistic programs, key ingredients in higher-level algorithms such as importance sampling and MCMC. To see why, suppose a user has constructed two closed probabilistic programs of type Rn, p and q, and wishes to use q as an importance sampling proposal for p. If JpK is absolutely continuous with respect to JqK (JpK ≪ JqK), such an importance sampler does exist, but implementing it requires computing importance weights: at a point x ∼ JqK, we must compute dJpK dJqK (x). If JpK and JqK were both absolutely continuous with respect to the Lebesgue measure on Rn, we could compute probability density func- tions ρp and ρq for JpK and JqK respectively, and then compute the importance weight as the ratio of these densities. But not all programs denote measures that have densities with respect to the Lebesgue measure.1 Our result gives us an alternative to the Lebesgue measure: we can compute the density of JpK (and JqK) with respect to the Hausdorff measures over the manifolds on which they are supported. (Indeed, computing densities with respect to Hausdorff measures has previously been proposed by Radul and Alexeev [10]; our result is that, unlike the Lebesgue base measure, this choice does not exclude any possible programs a user might write, because every program is absolutely continuous with respect to such a base measure.) D. Summary • We present the category of ωPAP spaces (Section II), a new setting suitable for a denotational treatment of higher-order, recursive differentiable or probabilistic pro- gramming languages. It supports sound and adequate semantics of a call-by-value PCF with a type of real numbers and a very expressive class of primitives. • To demonstrate that our semantics enables denotational reasoning about a broad class of interesting program properties, we present new results (and new, much- simplified proofs of old results) about differentiable (Sec- tion III) and probabilistic (Section IV) programs. II. ωPAP SEMANTICS This section develops the ωPAP spaces, and shows how to use them to interpret a higher-order, recursive language 1Consider, e.g., the program that samples u ∼ Unif(0, 1), and returns (u, u) ∈ R2. Because it is supported only on a 1-dimensional line segment within the plane, it has no density function with respect to the Lebesgue measure in the plane. That is, there is no nonnegative function ρ such that the probability of an event E ⊆ R2 is equal to RRR2 1E(x, y) * ρ(x, y)dxdy. with conditionals and discontinuous primitives. Our starting point is [5]'s definition of piecewise analyticity under ana- lytic partition (PAP), a property of some functions defined on Euclidean spaces. The ωPAP construction significantly extends Lee et al. [5]'s definition to cover partial and higher- order functions between Euclidean or other spaces. The ωPAP setting is general enough to interpret almost all primitives encountered in practice, but restricted enough to allow precise denotational reasoning. A. ωPAP Spaces We first recall a standard definition from analysis: Definition II.1 (analytic function). If the Taylor series of a smooth function f : U → V (for U ⊆ Rn, V ⊆ Rm) converges pointwise to f in a neighborhood around x, we say f is analytic at x. An analytic function is a function that is analytic at every point in its domain. When a subset of Rn can be carved out by finitely many analytic inequalities, we call it an analytic set [5]. Definition II.2 (analytic set [5]). We call a set A ⊆ Rn an analytic set if there exists a finite collection {gi}i∈I of analytic functions into R, with open domain U ⊆ Rn, such that A = {x ∈ U | ∀i ∈ I.gi(x) ≤ 0}. (This definition is simpler than in [5], but is equivalent.) Lee et al. [5]'s key definition was the class of PAP functions, which are piecewise analytic: Definition II.3 (PAP function [5]). For U ⊆ Rn and V ⊆ Rm, we call f : U → V piecewise analytic under analytic partition (PAP) if there is a countable family {(Ai, fi)}i∈I such that: 1) the sets Ai are analytic and form a partition of U ; 2) each fi : Ui → Rm is an analytic function defined on an open domain Ui ⊇ Ai; 3) when x ∈ Ai, fi(x) = f (x). In our development, PAP functions will play, at first order, the role that smooth functions play in the construction of diffeological spaces [11], and that measurable functions play in the construction of quasi-Borel spaces [12]. The change to PAP is essential: many primitives exposed by languages like TensorFlow and PyTorch fail to be smooth at some inputs, but virtually none fail to be PAP. And while PAP functions are all measurable, they helpfully exclude many pathological measurable functions, making it possible to prove stronger results through denotational reasoning. The development that follows generalizes PAP functions to cover higher-order and partial maps, using recently developed categorical techniques [1, 2, 4] (see Appx. B).2 First, we introduce a term for the valid domains of PAP functions. Definition II.4 (c-analytic set). A set A ⊆ Rn is c-analytic if the inclusion A ֒→ Rn is PAP.3 Definition II.5 (ωPAP space). An ωPAP space is a triple (|X|, PX, ≤X ), where (|X|, ≤) is an ωcpo and PX is a family of sets of functions, called plots in X. For each c-analytic set A, we have P A X ⊆ |X|A. Plots have to satisfy the following closure conditions: • Every map from R0 to |X| is a plot in X. • If φ ∈ |X|A is a plot in X and f : A′ → A is a PAP function, then φ ◦ f is a plot in X. • Suppose the c-analytic sets Aj ⊆ A form a countable par- tition of the c-analytic set A, with inclusions ij : Aj → A. If φ ◦ ij is a plot in X for every j, then φ is a plot in X. X under the pointwise • Whenever (αi)i is an ω-chain in P A order, ( i αi)(x) := i(αi(x)) defines a plot in P A X . W W Definition II.6 (ωPAP map). An ωPAP map f : X → Y is a Scott-continuous function between the underlying ωcpos (|X|, ≤X) and (|Y |, ≤Y ), such that if φ ∈ P A X, f ◦ φ ∈ P A Y . We now look at several examples of ωPAP-spaces. Our first example establishes that PAP functions between Euclidean spaces are a special case of ωPAP maps. Example II.1. Any subset A ⊆ Rn can be given the structure of an ωPAP-space (A, PA, =) where for every c-analytic set C, the plots P C A are given by P C A := {f : C → A | f is a PAP function}. Next, we construct products, coproducts, and exponential ωPAP spaces, which will be useful for interpreting the tuples, sums, and function types of our language. Example II.2 (Products). Given ωPAP spaces X and Y , define X × Y to be their product as ωcpo's, with plots hf, gi ∈ P A X×Y whenever f ∈ P A X and g ∈ P A Y . More generally, given ωPAP spaces Xi for i ∈ I, we can i∈I Xi by their product as ωcpos, with plots f ∈ whenever each projection πi ◦ f ∈ P A Xi define P A . Q Qi∈I Xi Example II.3 (Coproducts). Let I be a countable index set, i Xi is again an and Xi a ωPAP space for each i ∈ I. Then i |Xi|, and the partial order ωPAP space, with carrier set inherited from each Xi (elements of different spaces Xi and F i |Xi| is a plot Xj are not comparable). A function f : A → if there exists a countable partition {Aj}j of A into c-analytic sets, such that for each j, there is a plot fj : Aj → Xkj , where kj ∈ I, such that on Aj, f (x) = inkj fj(x), i.e., if the preimage of each Xi under f is a c-analytic set for each i. F F Example II.4 (Exponentials). Let X and Y be ωPAP spaces. Then X ⇒ Y is again a ωPAP space, with carrier set ωPAP(X, Y ), the set of ωPAP-morphisms from X to Y . g(x). A function for all x, f (x) ≤Y f ≤X⇒Y f : A → |X ⇒ Y | is a plot if uncurry f : A × X → Y is an ωPAP morphism. g iff B. Core Calculus 2Full paper with appendices is available at https://arxiv.org/abs/2302.10636 . 3Equivalently, A is c-analytic if and only if it is equal to a countable union of (possibly overlapping) analytic subsets of Rn (Cor. B.9). We present our core calculus in Figure 2. It is a simple call-by-value variant of PCF (e.g. as in Abramsky and Mc- Cusker [13]), with ground types B for Booleans and real for real numbers. It is parameterized by a set of primitives f representing PAP functions, including analytic functions such as +, ∗, exp, tan and comparison operators such as >, =. The language also includes constants c for each real c and true, false for Booleans. The typing rules and operational semantics are standard, and given in Appendices A-A and A-B. We will use realn as sugar for the n-fold product real×. . .× real. We denote by ⋆ the unique inhabitant of the type 1. types 1 real τ ::= | | | B | | t ::= τ1 × τ2 τ1 → τ2 unit type real numbers booleans product function terms ⋆ | c | f (t1, . . . , tn) ht1, t2i let hx1, x2i = t1 in t2 if t1 then t2 else t3 | x | | | | | λx.t | t s | μf.λx.t variable unit/constants/ops pair constructor pair elimination conditionals function abstraction/app. recursive function Fig. 2. Types and terms of our language constructs present in [2, 4]. Overall, (L, return, ≫=) forms a (commutative) monad. Proposition II.1. (L, return, ≫=) is a (strong, commutative) monad on the category of ωPAP-spaces and morphisms. We can now interpret types and terms of our language. The semantics of types and terms is given in Fig. 3. A context Γ = (x1 : τ1, . . . , xn : τn) is interpreted as the product space JΓK def= n i=1JτiK. Substitution is given by the usual Kleisli composition of effectful programs [14]. Q J1K JrealK JBK Jhτ1, τ2iK Jτ1 → τ2K def= ({⋆}, P1, =) def= (R, PR, =) def= (1 + 1, P1+1, =) def= Jτ1K × Jτ2K def= Jτ1K ⇒ LJτ2K JxK(ρ) J⋆K(ρ) JcK(ρ) Jf (t1, . . . , tn)K(ρ) def= return ρ(x) def= return ⋆ def= return c def= Jt1K(ρ) ≫= (λx1.Jt2K(ρ) ≫= . . . ≫= (λxn. f (x1, . . . , xn))) def= Jt1K(ρ) ≫= (λx.Jt2K(ρ) ≫= (λy.return (x, y))) def= return λv.JtK(ρ[x 7→ v]) C. Denotational semantics Jht1, t2iK(ρ) We give a denotational semantics to our language using ωPAP spaces and maps. A program Γ ⊢ t : τ is interpreted as an ωPAP map JtK : JΓK → LJτ K, for a suitable partiality monad L that we now define. For an ωPAP space Y , we define the space LY as follows. • The underlying set is |LY | := |Y | ⊔ {⊥}. • The order structure is given by ∀x ∈ |Y |, ⊥ ≤LY x and ∀x, x′ ∈ |Y |, x ≤LY x′ iff x ≤Y x′. • Plots are given by P A LY := {g : A → |Y | ⊔ {⊥} | ∃B ⊆ A c-analytic; g−1(|Y |) = B and g|B ∈ P B Y } The intuition for P A LY is that the partial ωPAP maps into Y are defined on c-analytic sets of inputs, but the region on which they are not defined need not satisfy any special property. This is how we account for the example from Fig. 1; although it is undefined on the 1 3 -Cantor set (which is not c-analytic), its domain (the complement of the 1 3 -Cantor set) is c-analytic. We also have (natural) ωPAP-morphisms, that we can write using lambda-calculus notation as • returnX : X → LX given by λx.inl x • ≫=X,Y : LX × (X ⇒ LY ) → LY given by λ(x, g).match x with inr ⊥ 7→ inr ⊥, inl x 7→ g(x) where inl, inr are respectively left and right injections (as set functions, they are not ωPAP-morphisms). L extends to ωPAP maps f : X → Y by setting Lf : LX → LY to equal inl ◦ f on all inputs inl x and setting Lf (inr ⊥) = inr ⊥. This definition is inspired by similar Jλx : τ.tK(ρ) Jlet hx1, x2i = t1in def= Jt1K(ρ) ≫=(λv.Jt2K(ρ[x1 7→ π1v, t2K Jt1 t2K(ρ) Jif t1then t2 else t3K(ρ) Jμf.λx.tK(ρ) x2 7→ π2v])) def= Jt1K(ρ) ≫=(λf.Jt2K(ρ) ≫= f ) def = Jt1K(ρ) ≫= λb.if b then Jt2K(ρ) else Jt3K(ρ) def= return i∈N fi where f0 = λx.inr ⊥, fi+1 = λv.JtK(ρ[f 7→ fi, x 7→ v]) W Fig. 3. Denotational semantics in ωPAP. Blue and bold indicate syntactic and mathematical keywords, respectively. Our denotational semantics in ωPAP is sound and adequate w.r.t. our (standard) operational semantics (Appendix A-B). Theorem II.2. The denotational semantics of our language is sound and adequate. Proof sketch. We show that ωPAP spaces and morphisms are a category of ω-concrete sheaves on a concrete site, as defined in Matache et al. [1], and use their development. More details are given in Appendix B. III. REASONING ABOUT DIFFERENTIABLE PROGRAMS Our first application of our semantics is to the problem of characterizing the behavior of automatic differentiation on the terms of our language. Automatic differentiation is a program transformation intended to convert programs representing real- valued functions into programs representing their derivatives. Program automatic differentiation / Program denotational semantics Smooth function denotational semantics / Smooth function mathematical differentiation Program automatic differentiation / Program denotational semantics ωPAP function intensional differentiation denotational semantics ωPAP function Fig. 4. Common approach to the correctness of AD, e.g. [3]. Fig. 5. Our approach to the correctness of AD. When all programs denote smooth functions, this informal specification can easily be made precise; for example, Figure 4 illustrates the correctness property that Huot et al. [3] prove for forward-mode AD in a higher-order language with smooth primitives. Their proof is elegant and compositional, relying on logical relations defined over the denotations of open terms. In our setting, not all programs denote smooth functions, and even when they do, standard AD algorithms can return incorrect results, in ways that depend on exactly how the smooth function in question was expressed as a program. For example, Mazza and Pagani [7] define a program SillyId = λx : R.if x = 0 then 0 else x, that denotes the identity function (with derivative λx.1), but for which AD incorrectly computes a derivative of 0 when x = 0. Because two extensionally equal programs can have different derivatives as computed by AD, it may seem unclear how any proof strategy based on Figure 4, relating the syntactic operation of AD to the semantic operation of derivative-taking, could apply. Indeed, in showing their correctness result for AD, Mazza and Pagani [7] had to develop new operational techniques for reasoning about derivatives of traces of recursive, branching programs. Our ωPAP semantics lets us take a different route, illustrated in Figure 5. Like Huot et al. [3], we work directly with the denotations of terms, which in our setting, are ωPAP maps. But we do not attempt to assign a unique derivative to each ωPAP function; instead, we define a relation on ωPAP maps that characterizes when one is an intensional derivative [5] of another. Our correctness proof, which follows exactly the structure of Huot et al. [3]'s, then establishes that AD produces a program denoting an (not the) intensional derivative of the original program's denotation (Theorem III.4). All ωPAP maps have intensional derivatives, so there is no need to restrict the correctness result to only the differentiable functions. But when an ωPAP map is differentiable in the stan- dard sense, its intensional derivatives agree almost everywhere with its true derivative. Thus, reasoning denotationally, we are able to recover Mazza and Pagani [7]'s result: AD is almost everywhere correct. Interestingly, this almost-everywhere cor- rectness result is not sufficient to prove the convergence of randomly initialized gradient descent, even for programs with differentiable denotations (Proposition III.6). A. Correctness of Automatic Differentiation Terms in our language denote ωPAP maps X → LY , and so to speak of correct AD in our language, we need some notion of derivative that applies to such maps. We begin by recalling Lee et al. [5]'s notion of intensional derivative, then lift it to our setting: Definition III.1 (intensional derivative [5]). Let f : U → V be an ωPAP map, with c-analytic domain U ⊆ R and V ⊆ R (seen as ωPAP spaces). Then an ωPAP map g : U → R is an intensional derivative of f if there exists a countable family {(Ai, fi)}i∈I such that: • the sets Ai are analytic and form a partition of U ; • the functions fi : Ui → R are analytic with open domain Ui ⊇ Ai; and • for x ∈ Ai, f (x) = fi(x) and g(x) = d dx fi(x). Definition III.2 (lifted intensional derivative). Let f : U → LV be an ωPAP map, with c-analytic domain U ⊆ R and V ⊆ R (seen as ωPAP spaces). Then an ωPAP map g : U → LR is a lifted intensional derivative of f if it is defined on exactly the inputs that f is, and restricted to this common domain, g is an intensional derivative of f . (These definitions can be straightforwardly extended to the multivariate case, where U ⊆ Rn and V ⊆ Rm, and our full correctness theorem does cover such functions. But here we demonstrate the reasoning principles in the simpler univariate setting. Of course, a program of type real → real may still be defined in terms of multivariate primitives.) We now establish that AD, applied to terms with a free : real, computes these lifted parameter θ : real ⊢ t intensional derivatives. It does so in two steps: • First, we apply a macro D (defined in Fig. 6) to t, yielding a term θ : real × real ⊢ D(t) : real × real. This new term operates not on a single real, but on a dual number, which intuitively stores both a value and its (intensional) derivative with respect to an external parameter. • Then, θ : real ⊢ let θ = hθ, 1i in let hx, dx dθ i = dθ is output as the lifted intensional derivative D(t) in dx of JtK. The key hurdle in showing the correctness of this AD proce- dure is establishing that the macro D is correctly propagating intensional dual numbers. To show this compositionally, and in a way that exploits our denotational framework, we first define for each type τ a relation Vτ between pairs of ωPAP plots in Jτ K and in JD(τ )K. It captures more precisely the properties that the dual numbers flowing through our program should have. (cid:15) (cid:15) / (cid:15) (cid:15) / (cid:15) (cid:15) / (cid:15) (cid:15) o o / / / o / o / o / o / o / o / o / o / o D(real) def= real × real D(τ1 × τ2) def= D(τ1) × D(τ2) def= τ (τ = 1, B) D(τ1 → τ2) def= D(τ1) → D(τ2) D(τ ) D(x) D(⋆) D(c : real) D(c : B) D(f (t1, . . . , tn)) D(λx.t) D(t s) D(ht1, t2i) D(let hx1, x2i = t in s) D(μf.t) D(if t1 then t2 else t3) def= x def= ⋆ def= hc, 0i def= c def= fD(D(t1), . . . , D(tn)) def= λx.D(t) def= D(t) D(s) def= hD(t1), D(t2)i def= let hx1, x2i = D(t) in D(s) def = μf.D(t) def= if D(t1) then D(t2) else D(t3) Fig. 6. AD macro for our higher-order recursive language Definition III.3 (correct dual-number intensional derivative at A ⊆ R). Let τ be a type and let f : A → Jτ K, for some c-analytic subset A ⊆ R. Then we say f ′ : A → JD(τ )K is a correct dual-number intensional derivative of f if (f, f ′) ∈ Vτ (A), where Vτ (A) is defined inductively: • Vreal(A) = {(f, f ′) | f ′(x) = (f (x), g(x)) for some intensional derivative g of f }. • Vτ (A) = {(f, f ′) | f = f ′} for τ ∈ {1, B}. • Vτ1×τ2(A) = {(f, f ′) | (πi ◦ f, πi ◦ f ′) ∈ Vτi(A) for i = 1, 2}. • Vτ1→τ2 (A) = {(f, f ′) | ∀(g, g′) ∈ Vτ1(A), (λx.f (x)(g(x)), λx.f ′(x)(g′(x))) ∈ Vτ2(A)}. Readers may recognize V as defining a (semantic) logical relation; its definition at product and function types is com- pletely standard, so only at ground types did we make any real choices. For partial functions, we need to extend the definition: Definition III.4 (correct lifted dual-number intensional deriva- tive at A ⊆ R). Let τ be a type and let f : A → LJτ K, for some c-analytic subset A ⊆ R. Then we say f ′ : A → LJD(τ )K is a correct lifted dual-number intensional derivative of f if f and f ′ are defined (i.e., not ⊥) on the same domain and, restricted to this common domain, f ′ is a correct dual-number intensional derivative of f . We are now in a position to state more precisely what it would mean for the D macro to correctly propagate dual num- bers. In particular, the macro transforms terms Γ ⊢ t : τ into their correct dual-number translations D(Γ) ⊢ D(t) : D(τ ), the specification for which is given below. LJD(τ2)K is a correct dual-number translation of f if, for all c-analytic A, and all pairs (g, g′) ∈ Vτ1 (A), fD ◦ g′ is a correct lifted dual-number intensional derivative of f ◦ g. We assume that each primitive f : τ1 → τ2 in our language is equipped with a built-in correct dual-number translation fD, which the definition of D in Figure 6 uses. Because the primitives are translated correctly, so are whole programs: Lemma III.1 (Correctness of D macro (limited)). For any term Γ ⊢ t : τ , JD(t)K : JD(Γ)K → JD(τ )K is a correct dual- number translation of JtK. Proof Sketch. This is the Fundamental Lemma of our logical relations proof, and can be obtained using general machin- ery [15], after verifying several properties of our particular setting: • Vreal(A) is closed under piecewise gluing: if {Ai}i∈I is a countable partition of A, and (f |Ai , f ′|Ai) ∈ Vreal(Ai) for each i ∈ I, then (f, f ′) ∈ Vreal(A). This follows from our definition of intensional derivative. • Vreal(A) is closed under restriction: if (f, f ′) ∈ Vreal(A), and A′ ⊆ A is c-analytic, then (f |A′ , f ′|A′ ) ∈ Vreal(A′). This also follows easily from our definition. • The lifted dual-number intensional derivatives are closed under least upper bounds: if {(fn, f ′ n)}n∈N is a sequence n : A → LJR × RK a correct lifted dual- with each f ′ number intensional derivative of f : A → LR, and with n∈N f ′ fn ≤ fn+1 and f ′ n is a correct lifted dual-number intensional derivative of n∈N fn. This is more involved, but its proof mirrors the one that establishes LR as an ωPAP space in the W first place: we explicitly construct representations of the lubs in question as piecewise functions, satisfying Definition III.2. n+1 for each n ∈ N, then n ≤ f ′ W The overall correctness theorem follows easily: apply Lemma Theorem III.2 (Correctness of AD Algorithm (limited)). For any term θ : real ⊢ t : real, the ωPAP map λθ.Jlet hx, dx dθ i = D(t) in dx dθ K((θ, 1)) is a lifted intensional derivative of JtK. III.1, Proof. We from setting Definition III.5 to (λθ.θ, λθ.(θ, 1)). This that (JtK, λθ.JD(t)K(θ, 1)) are defined on the same domain, and on that domain A, their restrictions are in Vreal(A). This implies that on that domain, λθ.π2(JD(t)K((θ, 1))) is an intensional derivative of JtK, from which the result follows by unfolding the definition of J*K on let expressions. (g, g′) implies This result, which we achieved via denotational reasoning, immediately implies the result of Mazza and Pagani [7]: Corollary III.3. If θ : real ⊢ t : real denotes a total differentiable function, then the set of input points on which the AD algorithm fails has measure zero.4 Definition III.5 (correct dual-number translation). Let τ1 and τ2 be types, and let f : Jτ1K → LJτ2K. Then fD : JD(τ1)K → 4Mazza and Pagani [7] prove a slightly stronger result, and we can also show something slightly stronger; see Prop. C.17. Proof. Because JtK is total, it is PAP and AD computes an intensional derivative of JtK. Intensional derivatives are almost everywhere equal to true derivatives [5]. Using more complex logical predicates, we can prove correctness for multivariate functions (see Appx. C). In the multivariate setting, forward-mode AD typically computes Jacobian-vector products; for us, it computes lifted intensional Jacobian-vector products. Definition III.6 (lifted intensional Jacobian). Let f : U → LV be an ωPAP map, with U ⊆ Rn c-analytic and V ⊆ Rm. An ωPAP map g : U → LRm×n is an intensional Jacobian of f if it is defined (i.e., not ⊥) exactly when f is, there exists a countable analytic partition {Ai}i∈I of its domain, and there exist analytic functions fi : Ui → Rm with open domains Ui ⊇ Ai such that when x ∈ Ai, f (x) = fi(x) and g(x) = Jfi(x), where J is the Jacobian operator. : real, . . . , xn Theorem III.4 (Correctness of AD (full)). For any term realm, and real x1 : : any vector v ∈ Rn, the ωPAP map λθ.let x = JD(t)K((θ1, v1), . . . , (θn, vn)) in (π2x1, . . . , π2xm) is equal to g(θ) * v for some intensional Jacobian g of JtK. ⊢ t AD, this may not be the case, even if f is differentiable: we proved only that AD computes intensional derivatives, which may disagree with true derivatives on a measure-zero set of inputs. Intuitively, it may seem as though we can avoid the measure- zero set of inputs on which AD may be incorrect by randomly selecting an initial point x0. Indeed, similar arguments have been made informally in the literature [7]. But this turns out not to be the case: Proposition III.6. Let ǫ > 0. There exists a program P such that JP K : R → R satisfies the condition of Theorem III.5, and yet, for all x0 ∈ R, the gradient descent method diverges to −∞, when the gradients are computed with AD. Proof sketch. Let P be the closed program defined by the following code, where lr is our chosen learning rate ǫ. # Recursive helper def g(x, n): if x > 0: return ((x - n)*(x - n))/(lr * 2) return x / lr + n*n / (2*lr) if x == 0: else: return g(x+1, n+1) B. Optimization of Differentiable Programs with AD- computed Derivatives Our characterization of AD's behavior, proven in the pre- vious section, can be used to establish the correctness of algorithms that use the results of AD. In optimization, for example, a very common technique for minimizing a differ- entiable function f : Rd → R is gradient descent. Starting at an initial point x0 ∈ Rd, for a set step size ǫ > 0, we iterate the following update: xt+1 := xt − ǫ∇f (xt). (1) If the step size ǫ is too large, we cannot hope to converge on an answer. To ensure that a small-enough step size can be found, we need to know that f 's gradient changes slowly: Definition III.7. A differentiable function f : Rd → R is L-smooth if for all x, y ∈ Rd k∇f (x) − ∇f (y)k ≤ Lkx − yk. When f is L-smooth, it is well known that ǫ can be chosen small enough for gradient descent to converge (albeit not necessarily to a global minimum): Theorem III.5 (e.g. [16]). Let f be L-smooth, bounded below, L . Then, for any initial x0 ∈ Rd, following the and 0 < ǫ < 2 method from Equation 1, the gradient of f tends to 0: ∇f (xt) = 0 lim t→∞ and the function f monotonically decreases on values of the sequence {xt}t, that is for all t ∈ N, f (xt+1) ≤ f (xt). However, this theorem assumes that the true gradient of f is used to make each update. When gradients are obtained by def P(x): return g(x,0) One can show that JP K = x 7→ x2 2ǫ and satisfies the conditions of Theorem III.5, yet gradient descent will diverge to −∞ initial points x0. The full explanation is given in for all Appendix D-A. The proof applies to an idealized setting where gradient descent is run with real numbers, rather than floating-point numbers, but in our experiments, PyTorch did diverge on this program. Similar counterexamples can be constructed for some variants of the gradient descent algorithm, e.g. when the learning rate is changing according to a schedule. Likewise, it is easy to derail the algorithm when the learning rate ǫ is random but the initial point x0 is fixed. Proposition III.7. Let x0 be a fixed initial point. Then there exists a program P such that JP K : R → R satisfies the conditions of Theorem III.5, and ∇JP K(x0) 6= 0, and yet, for all ǫ > 0, the gradient descent method yields xt = x0 for all t, when the gradients are computed with AD. Proof. Simply choose P (x) = if x = x0 then (x0)2 else x2, for which AD will give the intentional derivative 0 at x0. The counterexamples constructed for the proofs above are tied to a specific learning rate or to a specific initialization. It is therefore reasonable to think that by randomizing both quantities, one might be able to almost surely avoid such counter-examples. Thankfully, this is the case. Theorem III.8 (Convergence of GD with intensional deriva- tives). Let f be PAP, bounded below, L-smooth. Let (ǫ, x0) be drawn randomly from a continuous probability distribution Γ ⊢ e : real Γ ⊢ score e : 1 Γ ⊢ sample : real Fig. 7. Type system of the probabilistic part of the language L ) × Rd. Then when gradient descent com- supported on (0, 2 putes gradients using AD, the true gradient tends to 0 with probability 1: ∇f (xt) = 0. lim t→∞ Furthermore, with probability 1, the function f (x) monotoni- cally decreases: f (xt+1) ≤ f (xt). The proof is given in Appendix D-B. IV. REASONING ABOUT PROBABILISTIC PROGRAMS PAP functions were originally developed in Lee et al. [5] to reason about automatic differentiation, so perhaps it is not surprising that their generalization to ωPAP was useful, in the previous section, for characterizing AD's behavior. In this section, we show that the ωPAP semantics also makes it nice to reason about probabilistic programs: by excluding pathological deterministic primitives, we also prevent many pathologies from arising in the probabilistic setting, enabling clean denotational arguments for several nice properties. To reason about probabilistic programs, we must extend our core calculus (Figure 2) with the standard effectful opera- tions exposed by probabilistic programming languages (PPLs): sample samples a real from the uniform distribution on (0, 1), and score r reweights program traces (to implement soft constraints). Their typing rules are given in Figure 7. The language needs no new types, but the semantics change: instead of interpreting our language with the monad L, which models divergence, we must use a new monad that also tracks probabilistic computation. In Section IV-A, we introduce a monad of weighted samplers [8], which can informally be seen as deterministic functions from a source of randomness to output values. We use this monad to reason about the de- terministic weight functions that some probabilistic program- ming systems use during inference, presenting a new (much simplified) proof of Mak et al. [9]'s result that almost-surely- terminating probabilistic programs have almost-everywhere differentiable weight functions. In Section IV-B, we introduce a commutative monad of measures, which can be seen as a smaller version of V ́ak ́ar et al. [2]'s monad of measures, excluding those measures which can't be defined using ωPAP deterministic primitives. We use this smaller monad to prove that all definable measures in our language are supported on countable unions of smooth manifolds. This implies that they have densities with respect to a particular well-behaved class of base measures, and we close by briefly discussing the implications for PPL designers. A. Almost-Everywhere Differentiability of Weight Functions First, we define a monad S of weighted samplers, that interprets programs as partial ωPAP maps from a space Ω of random seeds to a space of weighted values. Intuitively, the measure represented (or "targeted") by a sampler of weighted pairs (x, w) is the one that assigns measure E[w * 1A(x)] to each measurable set A. But this semantics does not validate many important program equivalences, like commutativity, intuitively because it exposes "implementation details" of weighted samplers, that can differ even for samplers targeting the same measure. This is intentional: our first goal is to prove a property of these "implementation details," one that inference algorithms automated by PPLs might rely on. First, we fix our source of randomness Ω to be the lists of reals, ⊔i∈NRi (which is an ωPAP space, see Example II.3). We then define our monad: Definition IV.1 (monad of weighted samplers). Let S be the monad (S, returnS, ≫=S), defined as follows: • SX := Ω ⇒ L((X + 1) × [0, ∞) × Ω) • returnS • ≫=S X,Y := λm.λk.λr.m(r) ≫=L(λ(x?, w, r′).match x? inl x → X := λx.λr.inl(inl x, 1, r) → inl with {inr k(x)(r′) ≫=L λ(y?, v, r′′).inl (y?, w * v, r′′)}. (x?, 0, r′) | JsampleK(ρ) def= λr.match r with{ () → inl (inr ⋆, 0, r) | (r1, r2:n) → inl (inl r1, 1, r2:n)} Jscore tK(ρ) def= JtK(ρ) ≫=(λw.λr.inl(inl ⋆, 0 ∨ w, r)) Jμf.λx.tK(ρ) def= return i∈N fi W where f0 = λx.λr.inr ⊥, fi+1 = λv.JtK(ρ[f 7→ fi, x 7→ v]) Fig. 8. Updated semantics for new monad S of effects This monad interprets a probabilistic program as a partial function mapping lists of real-valued random samples, called traces, to: (1) the output values they possibly induce in X (or inr ⋆ if the input trace does not contain enough samples to complete execution of the program), (2) a weight in [0, ∞), and (3) a remainder of the trace, containing any samples not yet used. The return of the monad consumes no randomness, and successfully returns its argument with a weight of 1. The ≫= of the monad runs its continuation on the random numbers remaining in the trace after its first argument has executed, and multiplies the weights from both parts of the computation. Figure 8 gives the semantics of sample and score, as well as updated semantics for μf.t (the only change is that the bottom element, from which least fixed points are calculated, is now the bottom element of SX rather than LX). The sample command fails to produce a value when given an empty trace, but otherwise consumes the first value in the trace and returns it. The score command consumes no randomness, and uses its argument (if non-negative) as the weight. One way to use a weighted sampler is to run it, contin- ually providing longer and longer lists of uniform random numbers until a value from X (and an associated weight) is generated. But many probabilistic programming systems also expose more sophisticated inference algorithms. Gradient- based methods, such as Hamiltonian Monte Carlo or Langevin ascent, attempt to find executions with high weights by per- forming hill-climbing optimization or MCMC over the space of traces, guided by a program's weight function. Definition IV.2 (weight function). For any p ∈ |S X|, define its weight function wp : ⊔i∈N[0, 1]i → [0, ∞), as follows: • When p(r) = inr ⊥, wp(r) = 0. • When p(r) = inl (x, v, r′) for r′ non-empty, wp(r) = 0. • When p(r) = inl (x, v, ()), wp(r) = v. The weight function can be viewed as a density with respect to a particular base measure on traces; scaling the base measure by this density yields an unnormalized measure, and the normalized version of this measure, which is a probability distribution placing high mass on traces that lead to high weights, is called the posterior over traces. Inference algorithms like HMC are designed to generate samples ap- proximately distributed according to this posterior. Using our definition of the weight function, we can re- cover Mak et al. [9]'s result about the almost-everywhere differentiability of weight functions, a convenient property when reasoning about gradient-based inference: Theorem IV.1. Probabilistic programs that almost surely halt have almost-everywhere differentiable weight functions. Proof. Let ⊢ t : X be a program. Almost-sure termination im- plies that for almost all inputs r ∈ ⊔i∈N[0, 1]i, JtK(r) 6= inr ⊥. Restricted to the intersection of ⊔i∈N[0, 1]i with JtK's domain, its weight function wJtK is ωPAP,5 and thus almost-everywhere differentiable. Almost all of almost all of ⊔i∈N[0, 1]i is almost all of ⊔i∈N[0, 1]i, concluding the proof. We note that the proof only uses the fact that for almost all r ∈ ⊔i∈N[0, 1]i, JtK(r) 6= inr ⊥-which is strictly weaker than almost-sure termination. Almost-sure termination can fail even though a program halts on any finite trace of random numbers. Some probabilistic context-free grammars, for ex- ample, do not always surely halt, but as they execute, they consume an unbounded amount of randomness, so that when provided a finite trace, they will eventually halt with an error. Our proof shows that such programs, although they do not almost surely halt, do have almost-everywhere differentiable weight functions. As such, our result is slightly stronger than that of Mak et al. [9], and followed immediately from the interpretation of probabilistic programs in the ωPAP category. B. Existence of Convenient Base Measures for Monte Carlo We now wish to prove a result not about the intensional properties of probabilistic programs (like their weight func- tions), but the extensional properties of the measures that programs denote. To do so, we construct a final monad in which to interpret our language: a commutative monad of measures, similar to that of V ́ak ́ar et al. [2]. Definition IV.3 (ωPAP space of measure weights). Define W to be the ωPAP space with: • |W| = R≥0 ∪ {∞}, the extended non-negative reals; • w ≤W v when v = ∞ or when w < v < ∞. W whenever φ : A → W is measurable. • φ ∈ P A Note that although many maps into W exist, very few maps exist out of W, because its ωPAP diffeology is so permissive: any measurable function is a plot. Following ́Scibior et al. [8], measures can be seen as equivalence classes of samplers that behave the same way as integrators. Given a weighted sampler p ∈ |SX|, we can define the integrator it represents: Definition IV.4 (integrator associated to a sampler). We define ωPAP maps IntX : SX → (X ⇒ W) ⇒ W sending samplers to their associated integrators: IntX p = λf. Dom(αp) ΛΩ(dr)f (αp(r)), where R • ΛΩ is a Lebesgue base measure over |Ω|, assigning to i∈N Λi({x | each measurable subset A ⊆ Ω the value (i, x) ∈ A}) (where Λi is the Lebesgue measure on Ri). • αp : Ω → LX is an ωPAP map that on input r, returns inr ⊥ if any of the following hold: r is empty; 6∈ [0, 1]|r|−1; p(r2:|r|) returns inr⊥; or r1 < 0; r2:|r| p(r2:|r|) returns inl (x, v, r′) and either r′ is non-empty, x = inr ⋆, or v < r1. Otherwise, p(r2:|r|) must return inl (inl x, , ), and αp also returns inl x. P • Dom(αp) is the domain of the partial map αp. Then, following V ́ak ́ar et al. [2], we take the measures to be those integrators that lie in the image of Int: Definition IV.5 (monad of measures). The monad M of measures is defined by: • MX is the image of SX under IntX . It is a subobject of (X ⇒ W ) ⇒ W and inherits its order. • returnM • ≫=M X := λx.λf.f (x). X,Y := λm.λk.λf.m(λx.k(x)(f )). JsampleK(ρ) def= λf. R Jscore tK(ρ) def= λf.JtK(ρ)(λw.(0 ∨ w) * f (⋆)) Jμf.λx.tK(ρ) def= return [0,1] f (x)dx i∈N fi where f0 = λx.λf.0, fi+1 = λv.JtK(ρ[f 7→ fi, x 7→ v]) W Fig. 9. Updated semantics for new monad M of effects 5Under our semantics, JtK is an ωPAP morphism from 1 (the empty context) to SJτ K for any closed term t. Elements of SJτ K are themselves ωPAP morphisms from Ω to L((Jτ K + 1) × R≥0 × Ω) - so t denotes such a map. Now consider post-composing this map with the ωPAP map sending ⊥ to ⊥, and (x, v, r) to v when r is empty and 0 otherwise. The result is an ωPAP map from Ω to LR≥0. We next precompose this map with the inclusion ⊔i[0, 1]i → Ω, to obtain an ωPAP map from i[0, 1]i to LR≥0, equal to the weight function for JtK everywhere on its domain. F This monad is a submonad of the continuation monad [2], and so the return and ≫= are inherited. The sample command is interpreted as the uniform measure on [0, 1], and the score t command as a measure on a one-point space, with a certain total mass given by t. Our semantics under M (Fig. 9) is related to the one from the previous section (Fig. 8) in that for any closed term ⊢ t : X, IntX (JtKS) = JtKM. Using this, we can establish this lemma about the definable measures: Lemma IV.2. Let ⊢ t : realn. Then, there exists a partial ωPAP function ft : Ω ⇀ Rn such that JtK = ft∗ΛΩ. That is, any probabilistic program returning reals must arise as a well-behaved transformation of "input randomness" represented by Ω. This is not particularly surprising, of course, because a probabilistic program is defined by specifying an (ωPAP) transformation of input randomness, but it highlights the way we will use our ωPAP semantics to establish general properties of the measures denoted by probabilistic programs. The proof is given in Appendix E-A. In particular, we will characterize the definable measures as absolutely continuous with respect to a particular class of base measures. We first recall some relevant definitions from differential geometry, starting with the smooth manifolds, a well-studied generalization of Euclidean spaces; common examples include lines, spheres, and tori. Definition IV.6. A smooth manifold M is a second-countable Hausdorff topological space together with a smooth atlas: an open cover U together with homeomorphisms (φU : U → Rn)U∈U called charts such that φV ◦ φ−1 U is smooth on its domain of definition for all U, V ∈ U. A function f : M → N between manifolds is smooth if φV ◦ f ◦ φ−1 U is smooth for all charts φU , φV of M and N . When there's a global bound K on the local dimensions n of a smooth manifold, it's well known by a theorem of Whitney that the manifold can be embedded as a submanifold of an Euclidean space, that is its topology is given by restricting the standard one from the surrounding Euclidean space. There is a natural measure on smooth manifolds that gener- alizes the Lebesgue measure on Euclidean spaces, and matches our intuitive notions of area and volume on curved spaces. Definition IV.7. The k-Hausdorff measure on a metric space (X, d) is defined as H k (S) := lim δ→0 inf (Ui)i∈N n ∞ X i=1 k diam(Ui) | S ⊆ ∞ [ i=1 Ui, diam(Ui) < δo x, y ∈ U } and where diam(U ) := sup {d(x, y) diam(∅) := 0. The Hausdorff dimension is then defined as dimHaus(S) := inf{k | H k(S) = 0}. | The Hausdorff measure computes the sizes of sets S in a dimension-dependent way: • The 0-Hausdorff measure counts the points in S. • The 1-Hausdorff measure sums the lengths of curves within a set. It will be infinite on surfaces, and 0 on sets of isolated points. • The 2-dimensional Hausdorff measure sums the areas of surfaces, and will be infinite on volumes and 0 on curves. • More generally, the k-Hausdorff measure will quantify k-dimensional volumes. For smooth manifolds, the Hausdorff dimension matches the intuitive notion of dimension, e.g. a sphere in R3 has Hausdorff dimension 2 , a path on such a sphere will have Hausdorff dimension 1, and an open of Rn has dimension n. We now define our class of s-Hausdorff measures, which measure the sizes of sets by measuring the d-dimensional volumes of their intersections with d-dimensional manifolds, for every d: Definition IV.8 (s-Hausdorff measure on Rn). An s-Hausdorff measure on Rn is a measure μ that decomposes as μ(A) = n Xd=0 H d(A ∩ M d) where each M d is a countable union smooth manifolds M d i . i M d i of d-dimensional S Our main result in this section is a construction assigning an s-Hausdorff measure B(t) to every closed probabilistic program ⊢ t : realn, such that JtK has a density w.r.t. B(t). Theorem IV.3. Any closed probabilistic program ⊢ t : realn admits an s-Hausdorff measure B(t) on Rn such that • JtK has a density (possibly infinite) ρt w.r.t B(t); • if μ is another s-Hausdorff measure w.r.t. which JtK has a density, then that density is JtK-a.e. equal to ρt. • if t2 has the same type and Jt1K ≪ Jt2K (where ≪ denotes absolute continuity) then B(t1) ≪ B(t2); and • there is a set A ⊆ Rn such that 1A is a density of B(t1) with respect to B(t2). Finally, In particular, this means that a sensible design decision for a PPL is to always compute densities of probabilistic programs p with respect to an s-Hausdorff base measure B(p). In order to compute Radon-Nikodym derivatives between multiple programs, the theorem implies we can separately compute their densities and then take the ratio, so long as we also include a "support check" (of the sort described by [10]). the class of s- Hausdorff measures seems appropriate to serve as base mea- sures, as for each s-Hausdorff measure, there is a closed prob- abilistic program whose posterior distribution has a strictly positive density w.r.t that measure. This means that we cannot 'carve out' any mass from the s-Hausdorff measure, and that the underlying supporting manifolds faithfully represent the possible supports of posterior distributions of probabilistic programs. the following result shows that Theorem IV.4. Assume that the language has all partial PAP functions as primitives. Then, for every n ∈ N and every s- Hausdorff measure μ, there exists a program ⊢ t : realn such that JtK and μ are mutually absolutely continuous. The proofs are given at the end of Appendix E-B. V. RELATED WORK AND DISCUSSION Summary. We introduced the category of ωPAP spaces and used it as a denotational model for expressive higher-order recursive effectful languages. We first looked at a determin- istic language with conditionals and partial PAP functions, which we argued covers almost all differentiable programs that can be implemented in practice. We showed that AD computes correct intentional derivatives in such an expressive setting, extending Lee et al. [5]'s result, and recovering the fact that AD computes derivatives which are correct almost- everywhere. Next, we showed that gradient descent on pro- grams implementing differentiable functions can be soundly used with intentional derivatives, as long as both the learning rate and the initialization and randomized. We then looked at applications in probabilistic programming. After introducing a strong monad capturing traces of probabilistic programs, we gave a denotational proof that the trace density function of every probabilistic program is almost everywhere differen- tiable. Finally, we defined a commutative monad of measures on ωPAP, and proved that all programs denote measures with densities with respect to some s-Hausdorff measures. As such, we argued that the s-Hausdorff measures form a set of convenient base measures for density computations in Monte Carlo inference, and showed that every closed probabilistic program has a density w.r.t. some s-Hausdorff measure. Together, these results demonstrate the value of denotational reasoning with a "just-specific-enough" model like ωPAP. Results previously established in the literature by careful operational reasoning, such as Theorem IV.1, follow almost immediately after setting up the definitions the right way. And we have also shown new theorems, such as Theorem IV.3, by applying methods from analysis to characterize the restricted class of denotations in our semantic domain. Semantics of higher-order differentiable programming. We continue a recent line of work on giving denotational seman- tics for higher-order differentiable programming in functional languages. Our semantics and logical relations proof builds on insights proposed in the smooth setting in Huot et al. [3], and takes inspiration from V ́ak ́ar [4] for the treatment of recursion. In this work, we considered a simple forward- mode AD translation, but a whole body of work focused their attention on provably correct and efficient reverse-mode AD algorithms on higher-order languages [7, 17, 18, 19, 20]. We believe our correctness result could be adapted to a reverse-mode AD algorithm, perhaps following the neat ideas developed in Krawiec et al. [20], Radul et al. [21], or Smeding and V ́ak ́ar [22], but we leave this for future work. There are also more synthetic approaches to studying differentiation in a more purely categorical tradition, sometimes called synthetic differential geometry [23]. Some of these approaches are particularly appealing from a theoretical point of view [24, 25], but their precise relations with AD and its implementations remains to be further studied. Semantics of differentiable programming with non-smooth functions. Our work directly builds on and extends Lee et al. [5]'s setting to a higher-order recursive language. As is shown in Lee et al. [26], when moving beyond the differentiable set- ting, there are many seemingly reasonable classes of functions that behave pathologically in subtle ways, usually preventing compositional reasoning. ωPAP spaces combine the advantage of restricting to PAP functions at first-order with expressive power provided by abstract categorical constructions, which conservatively extend the first-order setting. Bolte and Pauwels [27] investigated a similar problem as Lee et al. [5] on a more restricted first-order language, but proved a convergence of gradient descent result in their setting. It would be interesting to see if some of the ideas developed in Chizat and Bach [28] could be adapted to prove some convergence of stochastic gradient descent when AD is used on programs denoting PAP functions, thus going beyond the setting of neural networks. Semantics of probabilistic programming. Our commutative monad of measures takes clear inspiration from Staton [6] and V ́ak ́ar et al. [2], adding an extra step in the recent search of semantic models for higher-order probabilistic programming [12, 29]. In particular, our work refines the model of V ́ak ́ar et al. [2] by restricting to PAP functions, instead of merely measurable ones, but keeping its essential good properties for interpreting probabilistic programs. By doing so, our work is closer in spirit to Freer and Roy [30]'s study of computable properties for higher-order probabilistic languages. Our monad for tracking traces of probabilistic programs is similar to what is presented in Lew et al. [31], giving a denotational version of similar work that focus on operational semantics, such as Mak et al. [9]. Our result about densities and s-Hausdorff measures has some of its foundations based on the careful study of s-finite measures and kernels from V ́ak ́ar and Ong [32]. It would be interesting to see if the work of Lew et al. [33] could be extended to a non-differentiable setting with PAP primitives, proving that an AD algorithm on a probabilistic language yields unbiased gradient estimates, perhaps using the estimator derived in Lee et al. [34] for non-smooth functions. Disintegration and base measure. Our result on base mea- sures for probabilistic programs is related to the literature on symbolic disintegration [35, 36, 37], which has also had to wrestle with the problem of finding base measures with respect to which expressive programs have densities. Our approach builds on the idea presented by Radul and Alexeev [10]: we extend the Hausdorff base measures to s-Hausdorff base measures, and prove that they suffice for ensuring all programs have densities. We leave open the question of characterizing exactly the class of densities on s-Hausdorff measures that arise from probabilistic programs, and the investigation of the closure of these measures under least upper bounds. ACKNOWLEDGMENT We have benefited from discussing this work with many friends and colleagues, Wonyeol Lee, Faustyna Krawiec, Michele Pagani, Sean Moss, and the Oxford group. We are also grateful to anonymous referees for their very helpful feedback. This material is based on work supported by the NSF Graduate Research Fellowship under Grant No. 1745302. Our work is also supported by a Royal Society University Research Fellowship, the ERC BLAST grant, the Air Force Office of Scientific Research (Award No. FA9550–21–1–0038), and the DARPA Machine Common Sense and SAIL-ON projects. REFERENCES 246, 2013. [1] C. Matache, S. Moss, and S. Staton, "Concrete categories and higher-order recursion: With applications including probability, differentiability, and full abstraction," in Pro- ceedings of the 37th Annual ACM/IEEE Symposium on Logic in Computer Science, 2022, pp. 1–14. [2] M. V ́ak ́ar, O. Kammar, and S. Staton, "A domain theory for statistical probabilistic programming," Proceedings of the ACM on Programming Languages, vol. 3, no. POPL, p. 36, 2019. [3] M. Huot, S. Staton, and M. V ́ak ́ar, "Correctness of automatic differentiation via diffeologies and categorical gluing." in FoSSaCS, 2020, pp. 319–338. [4] M. V ́ak ́ar, "Denotational correctness of foward-mode automatic differentiation for iteration and recursion," arXiv preprint arXiv:2007.05282, 2020. [5] W. Lee, H. Yu, X. Rival, and H. Yang, "On correct- ness of automatic differentiation for non-differentiable functions," Advances in Neural Information Processing Systems, vol. 33, pp. 6719–6730, 2020. [6] S. Staton, "Commutative semantics for probabilistic pro- gramming," in European Symposium on Programming. Springer, 2017, pp. 855–879. [7] D. Mazza and M. Pagani, "Automatic differentiation the ACM on Programming in PCF," Proceedings of Languages, vol. 5, no. POPL, pp. 1–27, 2021. [8] A. ́Scibior, O. Kammar, M. V ́ak ́ar, S. Staton, H. Yang, Y. Cai, K. Ostermann, S. K. Moss, C. Heunen, and Z. Ghahramani, "Denotational validation of higher-order Bayesian inference," Proceedings of the ACM on Pro- gramming Languages, vol. 2, no. POPL, p. 60, 2017. [9] C. Mak, C.-H. L. Ong, H. Paquet, and D. Wagner, "Densities of almost surely terminating probabilistic pro- grams are differentiable almost everywhere," Program- ming Languages and Systems, vol. 12648, p. 432, 2021. [10] A. Radul and B. Alexeev, "The base measure problem and its solution," in International Conference on Artificial Intelligence and Statistics. PMLR, 2021, pp. 3583– 3591. [11] J. Baez and A. Hoffnung, "Convenient categories of smooth spaces," Transactions of the American Mathe- matical Society, vol. 363, no. 11, pp. 5789–5825, 2011. [12] C. Heunen, O. Kammar, S. Staton, and H. Yang, "A convenient category for higher-order probability theory," in 2017 32nd Annual ACM/IEEE Symposium on Logic in Computer Science (LICS). IEEE, 2017, pp. 1–12. [13] S. Abramsky and G. McCusker, "Call-by-value games," in Computer Science Logic: 11th International Work- shop, CSL'97 Annual Conference of the EACSL Aarhus, Denmark, August 23–29, 1997 Selected Papers 11. Springer, 1998, pp. 1–17. [14] E. Moggi, "Notions of computation and monads," Infor- mation and computation, vol. 93, no. 1, pp. 55–92, 1991. [15] S.-y. Katsumata, "Relating computational effects by TT- lifting," Information and Computation, vol. 222, pp. 228– [16] B. T. Polyak, "Introduction to optimization. optimization software," Inc., Publications Division, New York, vol. 1, p. 32, 1987. [17] A. Brunel, D. Mazza, and M. Pagani, "Backpropaga- tion in the simply typed lambda-calculus with linear the ACM on Programming negation," Proceedings of Languages, vol. 4, no. POPL, pp. 1–27, 2019. [18] M. V ́ak ́ar and T. Smeding, "CHAD: Combinatory ho- momorphic automatic differentiation," ACM Transactions on Programming Languages and Systems (TOPLAS), vol. 44, no. 3, pp. 1–49, 2022. and A. [19] M. Huot correct, automatic differentiation," 2022. https://arxiv.org/abs/2212.09801 functional, purely Shaikhha, efficient "Denotationally reverse-mode [Online]. Available: [20] F. Krawiec, S. P. Jones, N. Krishnaswami, T. Ellis, R. A. Eisenberg, and A. W. Fitzgibbon, "Provably cor- rect, asymptotically efficient, higher-order reverse-mode automatic differentiation." Proc. ACM Program. Lang., vol. 6, no. POPL, pp. 1–30, 2022. [21] A. Radul, A. Paszke, R. Frostig, M. J. Johnson, and D. Maclaurin, "You only linearize once: Tangents trans- pose to gradients," Proceedings of the ACM on Program- ming Languages, vol. 7, no. POPL, pp. 1246–1274, 2023. [22] T. J. Smeding and M. I. V ́ak ́ar, "Efficient dual-numbers reverse ad via well-known program transformations," Proceedings of the ACM on Programming Languages, vol. 7, no. POPL, pp. 1573–1600, 2023. [23] J. R. B. Cockett and G. S. Cruttwell, "Differential struc- ture, tangent structure, and SDG," Applied Categorical Structures, vol. 22, no. 2, pp. 331–417, 2014. [24] R. Cockett, G. Cruttwell, J. Gallagher, J.-S. P. Lemay, B. MacAdam, G. Plotkin, and D. Pronk, "Reverse deriva- tive categories," arXiv preprint arXiv:1910.07065, 2019. [25] R. Blute, T. Ehrhard, and C. Tasson, "A convenient differential category," arXiv preprint arXiv:1006.3140, 2010. [26] W. Lee, X. Rival, and H. Yang, "Smoothness analysis for probabilistic programs with application to optimised variational inference," Proceedings of the ACM on Pro- gramming Languages, vol. 7, no. POPL, pp. 335–366, 2023. [27] J. Bolte and E. Pauwels, "A mathematical model for automatic differentiation in machine learning," Advances in Neural Information Processing Systems, vol. 33, pp. 10 809–10 819, 2020. [28] L. Chizat and F. Bach, "On the global convergence of gradient descent for over-parameterized models using optimal transport," Advances in neural information pro- cessing systems, vol. 31, 2018. [29] T. Ehrhard, M. Pagani, and C. Tasson, "Measurable cones and stable, measurable functions: a model for probabilistic higher-order programming," Proceedings of the ACM on Programming Languages, vol. 2, no. POPL, pp. 1–28, 2017. [46] B. Mityagin, "The zero set of a real analytic function," Mathematical Notes, vol. 107, no. 3, pp. 529–530, 2020. [30] C. E. Freer and D. M. Roy, "Computable de finetti measures," Annals of Pure and Applied Logic, vol. 163, no. 5, pp. 530–546, 2012. [31] A. K. Lew, M. F. Cusumano-Towner, B. Sherman, M. Carbin, and V. K. Mansinghka, "Trace types and de- notational semantics for sound programmable inference in probabilistic languages," Proceedings of the ACM on Programming Languages, vol. 4, no. POPL, pp. 1–32, 2019. [32] M. V ́ak ́ar and L. Ong, "On s-finite measures and ker- nels," arXiv preprint arXiv:1810.01837, 2018. [33] A. K. Lew, M. Huot, S. Staton, and V. K. Mansinghka, "ADEV: Sound automatic differentiation of expected values of probabilistic programs," Proceedings of the ACM on Programming Languages, vol. 7, no. POPL, pp. 121–153, 2023. [34] W. Lee, H. Yu, and H. Yang, "Reparameterization gradi- ent for non-differentiable models," in Advances in Neural Information Processing Systems, 2018, pp. 5553–5563. [35] C.-c. Shan and N. Ramsey, "Exact Bayesian inference by symbolic disintegration," in Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages, 2017, pp. 130–144. [36] K. Cho and B. Jacobs, "Disintegration and Bayesian inversion via string diagrams," Mathematical Structures in Computer Science, vol. 29, no. 7, pp. 938–971, 2019. [37] P. Narayanan and C.-c. Shan, "Symbolic disintegration with a variety of base measures," ACM Transactions on Programming Languages and Systems (TOPLAS), vol. 42, no. 2, pp. 1–60, 2020. [38] B. Jacobs, Categorical logic and type theory. Elsevier, 1999. [39] J. C. Mitchell and A. Scedrov, "Notes on sconing and re- lators," in International Workshop on Computer Science Logic. Springer, 1992, pp. 352–378. [40] S.-y. Katsumata, "A semantic formulation of TT-lifting and logical predicates for computational metalanguage," in International Workshop on Computer Science Logic. Springer, 2005, pp. 87–102. [41] S. MacLane and I. Moerdijk, Sheaves in geometry and Springer logic: A first introduction to topos theory. Science & Business Media, 2012. [42] A. Carboni and P. Johnstone, "Connected limits, familial representability and Artin glueing," Mathematical Struc- tures in Computer Science, vol. 5, no. 4, pp. 441–459, 1995. [43] P. T. Johnstone, S. Lack, and P. Soboci ́nski, "Quasito- poses, quasiadhesive categories and Artin glueing," in International Conference on Algebra and Coalgebra in Computer Science. Springer, 2007, pp. 312–326. [44] P. T. Johnstone, Sketches of an elephant: A topos theory compendium. Oxford University Press, 2002, vol. 2. [45] O. Kammar and D. McDermott, "Factorisation systems for logical relations and monadic lifting in type-and- effect system semantics," Electronic notes in theoretical computer science, vol. 341, pp. 239–260, 2018. APPENDIX A LANGUAGE A. Type System The type-system for the deterministic language (Section III) is given in Figure 10. Γ ⊢ x : τ (x : τ ∈ Γ) Γ, x : τ1 ⊢ t : τ2 Γ ⊢ λx : τ1.t : τ1 → τ2 Γ ⊢ c : τ (c ∈ Cτ ) Γ ⊢ t1 : τ1 → τ2 Γ ⊢ t2 : τ1 Γ ⊢ t1t2 : τ2 Γ ⊢ t1 : τ1 Γ ⊢ t1 : τ2 Γ ⊢ ht1, t2i : τ1 × τ2 Γ ⊢ ⋆ : 1 Γ ⊢ t : τ1 × τ2 Γ, x1 : τ1, x2 : τ2 ⊢ s : τ Γ ⊢ let hx1, x2i = t in s : τ Γ ⊢ t1 : B Γ ⊢ t2 : τ Γ ⊢ if t1 then t2 else t3 : τ Γ ⊢ t3 : τ Γ, f : τ1 → τ2 ⊢ t : τ1 → τ2 Γ ⊢ μf : τ1 → τ2.t : τ1 → τ2 Fig. 10. Type system of the deterministic part of the language. Cτ denotes the set of primitives of type τ . B. Operational semantics Values are given by the following grammar v ::= x | c | f | λx.t | μf.t | hv1, v2i | ⋆ A big step-semantics is given in Figure 11. c ⇓ c t2 ⇓ λx.t t1 ⇓ v1 t2t1 ⇓ v2 t[v1/x] ⇓ v2 ∀i, ti ⇓ vi t ⇓ f t(t1, . . . , tn) ⇓ f (v1, . . . , vn) t1 ⇓ true t2 ⇓ v if t1 then t2 else t3 ⇓ v t1 ⇓ false t3 ⇓ v if t1 then t2 else t3 ⇓ v t ⇓ hv1, v2i t2[v1/x1, v2/x2] ⇓ v let hx1, x2i = t in t2 ⇓ v t[μf.t/f ] ⇓ v μf.t ⇓ v Fig. 11. Big step operational semantics of the deterministic part of the language APPENDIX B SOUND AND ADEQUATE DENOTATION Definition B.1 (Reproduced from [1]). A concrete category is a category C with a terminal object 1 such that the functor C(1, −) : C → Set is faithful. Example B.1. Let OpenCont be the category whose objects are open subsets U of Rn (for all n ∈ N), and whose morphisms U → V are continuous functions. R0 is a terminal object, and OpenCont(R0, −) simply sends an open set to its underlying set, and sends a continuous function to its underlying function. Therefore, OpenCont(R0, −) is faithful and OpenCont is concrete. Definition B.2 (Reproduced from [1]). A concrete site (C, J ) is a small concrete category C with an initial object 0, together with a coverage J , which specifies for each object c a set J (c) of families of maps with codomain c . We call such a family {fi : ci → c}i∈I ∈ J (c) a covering family and say it covers c. The coverage must satisfy the following axioms. 1) For every map h : d → c in C, if {fi : ci → c}i∈I covers c, then there is a covering family {gj : dj → d}j∈I ′ of d such that every h ◦ gj factors through some fi. i∈I Im(|fi|) = |c|. 2) If {fi : ci → c}i∈I covers c, then 3) the initial object 0 is covered by the empty set. 4) The identity is always covering 5) If {fi : ci → c}i∈I ∈ J (c) and {gij : cij → ci}j∈Ji ∈ J (ci) for each i, then {fi ◦ gij : cij → c}i∈I,j∈Ji ∈ J (c). S Example B.2 (Cartesian spaces and smooth maps). CartSp is a concrete site, where {fi : Ui → V }i is a covering family i fi(Ui) = V , i.e. the images of the fi cover the codomain if V in the usual sense. S Example B.3. Similarly to CartSp, OpenCont is a con- : Ui → V }i is a covering family if crete site, where {fi i fi(Ui) = V , i.e. the images of the fi cover the codomain V in the usual sense. Its initial object is the empty set. S Example B.4 (Standard Borel spaces). The category Sbs has objects the Borel subsets of R and morphisms the measurable functions between these objects. It is a concrete site where the coverage contains the countable sets of inclusions functions {Ui → U }i such that U = i Ui and the Ui are disjoint. Definition B.3 (Reproduced from [1]). A concrete sheaf X on a concrete site (C, J ) is a set |X|, together with, for each object c ∈ C, a set P c X of functions |c| → |X|, such that S X contains all the constant functions; • each P c • for any map h : d → c ∈ C, and any g ∈ P c composite function g ◦ |h| : |d| → |X| is in P d X ; X , the • for each function g : |c| → |X| and each covering family X , then g : |c| → {fi : ci → c}i∈I , if each g ◦ |fi| ∈ P ci |X| ∈ P c X. 1) Concrete sites and sheaves: Our proof of soundness and adequacy uses reusable machinery developed by Matache et al. [1]. Their framework requires establishing various properties; for convenience, in this section, we reproduce the relevant definitions, and recall the theorem that we will use. A morphism α : X → Y between concrete sheaves is a function α : |X| → |Y | that preserves the structure, namely if g ∈ P c X , then α ◦ g ∈ P c Y . Example B.5. Let Cont be the category defined as follows. Its objects are pairs (X, PX ) where for each open U ⊆ Rn, P U X ⊆ X U is closed under the following axioms: • Constant functions are in P U X X and g : V → U is continuous, then f ◦g ∈ P V • If f ∈ P U X • If {Ui}i∈N is an open cover of an open U , and for all i, fi ∈ P Ui X , such that for all i, j ∈ N2, fi and fj agree on Ui ∩ Uj, then f : U → X defined by x ∈ Ui 7→ fi(x), is an element of P U X . Its morphisms X → Y are functions α : X → Y such that α ◦ f ∈ P U X . Then, Cont is a category of concrete sheaves on the concrete site OpenCont. Y whenever f ∈ P U Example B.6. Diffeological spaces and Quasi-Borel spaces are examples of categories of concrete sheaves and morphisms between concrete sheaves. Other examples are given in Baez and Hoffnung [11]. sheaves: To 2) ω-Concrete the concrete-sheaf structure will not be sufficient in general. Instead of evoking what is to my knowledge the yet-to-be- formalised theory of enriched sheaves over the category of ωcpo's, we continue with the setting from Matache et al. [1]. recursion, interpret Definition B.4 (Reproduced from [1]). An ω-concrete sheaf on a site (C, J ) is a concrete sheaf X together with an ordering ≤X on |X| that equips X with the structure ofωcpo, such that each P c X is closed under pointwise suprema of chains with respect to the pointwise ordering. A morphism α : X → Y of ω-concrete sheaves is a continuous function between ωcpo's, α : |X| → |Y |, that is also a morphism of concrete sheaves. ω-concrete sheaves form a category ωConc(C, J ), which is a Cartesian-closed category with binary coproducts [1]. Example B.7. The category of ω-diffeological spaces [4] and of ω-Quasi-Borel spaces [2] are examples of categories of ω-concrete sheaves. 3) Partiality: admissible monos and a partiality monad: To model recursion, we first need to define a (strong) partiality monad L on ωConc(C, J ). There are many choices for the lifting of the plots, so we parametrize the definition of partiality monad by a class M of monomorphisms from the site (C, J ), which we call admissible monos. Recall that, in any category, monos with the same codomain are preordered. If m1 : d1 ֌ c, m2 : d2 → c then m1 ≤ m2 iff there exists f : d1 → d2 such that m2 ◦ f = m1 We write Sub(c) for the poset quotient of the set of monos with codomain c. For any class M of monos, we write SubM(c) for the full subposet of Sub(c) whose elements have representatives in M. Definition B.5 (Reproduced from [1]). A class M of admis- sible monos for a concrete site (C, J ) consists of, for each object c ∈ C, a set of monos M(c) with codomain c satisfying the following conditions 1) For all c ∈ C, 0 → c ∈ M(c) 2) M contains all isomorphisms 3) M is closed under composition 4) All pullbacks of M-maps exist and are again in M (This makes SubM a functor Cop → Set). 5) For each c, the function SubM(c) → Set(|c|, {0, 1}) is componentwise injective and order-reflecting, and the image of SubM is closed under suprema of ω-chains 6) Given an increasing chain in SubM(c), (cn ֌ c)n∈N, denote its least upper bound by c∞ ֌ c. Then the closure under precomposition (with any morphism) of the set {cn ֌ c∞}n∈N contains a covering family of c∞. Now, given a class M of admissible monos, we can define a partiality monad LM on the category of ω-concrete sheaves: Definition B.6 (Reproduced from [1]). We define the strong partiality monad LM associated to the class of admissible monos M as • |LMX| = |X| ⊔ {⊥} • ∀x ∈ |X|, ⊥ ≤LMX x • ∀x, x′ ∈ |X|, x ≤LMX x′ iff x ≤X x′ • P c |c| → |X| ⊔ {⊥} | ∃c′ ֌ c ∈ LMX = {g : M(c) s.t. g−1(|X|) = Im(|c′|) and g|Im(|c′|) ∈ P c′ X } The strong monad structure is exactly the same as the maybe monad on Set. Proposition B.1 ([1]). LM : ωConc(C, J ) → ωConc(C, J ) is a strong monad. 4) Soundness and adequacy: Matache et al. [1] defined a language PCFv, a call-by-value variant of PCF. It has product, sum types, and a recursion operator similar to ours, and is presented as a fine-grained call-by-value language. This language is essentially equivalent to our language, except that we have extra base types real and B, and more basic primitives involving these types. Our conditional is definable using their sum types. They give their language a standard call-by-value operational semantics, which translates directly to an operational semantics for our language. In summary, even though their theorem is stated for PCFv, it directly applies to our language, without needing further changes or extra proofs, as long as we also interpret our base types and primitives in the model, as in standard [14]. Theorem B.2 ([1]). A concrete site with a class of admissible monos, (C, J , M), is a sound and adequate model of PCFv in ωConc(C, J ). Having recalled the general setting of ω-concrete sheaves, we now show how ωPAP is an instance of this general construction. To do so, we will show define the category cP AP and show it is a concrete-site (which is the one for ωPAP) in Section B-6. We will define a set of admissible monos for cP AP in Section B-7. In order to achieve this, we will need a key technical proposition (Proposition B.4) and a few other technical lemmas, proved in Section B-5. 5) C-analytic sets: The definition of c-analytic sets does not require that the analytic sets that make up a c-analytic set be disjoint. Still, it turns out that it is always possible to partition a c-analytic set into countably many pairwise disjoint analytic sets. Lemma B.3. Definition II.2 of analytic sets is equivalent to the following definition from Lee et al. [34]. A ⊆ Rn is an analytic set if there exists finite collections : U + j }j∈J of analytic functions : U − i → R}i∈I and {g+ {g− i on open domains, such that j A = x ∈ (cid:8) (cid:0) ∩i∈I U − i ∩ ∩j∈J U + j (cid:0) (cid:1) ∀j ∈ J.g+ j (x) > 0 | ∀i ∈ I.g− i (x) ≤ 0, (cid:1) (cid:9) Proof. • U := is a finite intersection of open sets and is open, and we can restrict (cid:1) each analytic function to U . ∩j∈J U + j ∩i∈I U − i ∩ (cid:0) (cid:0) (cid:1) • Given g : U → R, the inequality g(x) > 0 can be changed to the inequality f (x) ≤ 0 where f : V → R defined by f (x) = −g(x), and V := U ∩ {x ∈ U | g(x) 6= 0} is open. We use Lee et al. [34]'s definition in the rest of the appendix. Proposition B.4. For any c-analytic set A, there exists a countable collection of pairwise disjoint analytic sets {Bi}i∈N such that A = ∪i∈NBi. This is an important property, and most of this section is devoted to proving the proposition. Let {Ai}i∈N be a countable set of analytic subsets of Rn. Each analytic set Ai is associated with an open domain Ui and a finite number Ji of analytic functions {fij}j∈[1,...,Ji], so that Ai = {x ∈ Ui | ∀j.fij ≤ 0}. Because any open set is a countable union of open balls in Rn, we can assume without loss of generality that the Ui are open balls. Definition B.7. A simple analytic set is a set A = {x ∈ Bǫ(x0) | ∀i ≤ I.g+ i (x) > 0 ∧ ∀j ≤ J.g− i (x) ≤ 0}, for natural numbers I and J and some 0 < ǫ ≤ ∞ and x0 ∈ Rn. Lemma B.5. The complement of any simple analytic set is a finite union of pairwise disjoint simple analytic sets. Proof. A point x can fail to be in a simple analytic set A for I + J + 1 mutually exclusive reasons, each of which applies to a simple analytic set of points: 1) If ǫ < ∞, it can fail to lie in Bǫ(x0). The set of points 1 (x) = ǫ − ||x − outside Bǫ(x0) is simple analytic: let h− x0||2 and consider {x ∈ Rn | h− 1 (x) ≤ 0}. 2) (For each 1 ≤ i ≤ I.) It can lie within Bǫ(x0), and n (x) > 0 for all n < i, but fail to satisfy n (x) for n < i, and i (x). Then the set of all such points is satisfy g+ g+ i (x) > 0. Let h+ h− 1 (x) = g+ {x ∈ Bǫ(x0) | ∀n < i.h+ n (x) > 0 ∧ h− n (x) = g+ 1 (x) ≤ 0}. i (x) > 0 for all i ≤ I, and satisfy g− 3) (For each 1 ≤ j ≤ J.) It can lie within Bǫ(x0), and n (x) ≤ 0 j (x) ≤ 0. Let h+ i (x) = n (x) for all n < j, and j (x). Then the set of all points to which satisfy g+ for all n < j, but fail to satisfy g− g+ n (x) = g− i (x) for all i ≤ I, h− I+1(x) = g− h+ this reason applies is {x ∈ Bǫ(x0) | ∀i ≤ I +1.h+ 0 ∧ ∀n < j.h− n (x) ≤ 0}. i (x) > The union of these simple analytic sets is the complement of A. Corollary B.6. If A1, . . . , An are simple analytic sets, then ∪i≤nAi is a finite union of disjoint analytic sets. Proof. We have ∪Ai = ∩Ai = ∩(∪m≤Mi Bim), where {Bim}m≤Miis a representation of Ai's complement as a dis- joint union of finitely many simple analytic sets. Distributing, this is in turn equal to ∪m1≤M1 * * * ∪mn≤Mn (∩i≤nBimi ). Each element of this large union is analytic, because it is the intersection of n analytic sets. Furthermore, these analytic sets are pairwise disjoint: any pair will disagree on mi for some i, and so the intersection will include disjoint sets Bimi and i. Because these two sets are disjoint, the Bim′ overall intersections will be disjoint. , for mi 6= m′ i Corollary B.7. If A1, . . . , An are simple analytic sets, then An \ ∪i<nAi is a finite union of disjoint analytic sets, each of which is a finite intersection of simple analytic sets. Proof. An \ ∪i<nAi = An ∩ (∪i<nAi), and by the previous corollary, the right-hand term can be rewritten as a finite union of disjoint analytic sets ∪i<mBi. The intersection is then equal to ∪i<mAn ∩ Bi. Each element of this finite union is analytic because analytic sets are closed under intersection. They are also disjoint since the Bi are disjoint. Lemma B.8. Let A = ∪n∈NAn be a countable union of simple analytic sets An. Then there are countably many pairwise disjoint analytic sets {Bm}m∈N such that A = ∪m∈NBm. Proof. Consider the countably many disjoint sets A′ (∪i<kAi). Each A′ union of pairwise disjoint sets, by the previous corollary. k = Ak \ k can itself be expressed as a countable Corollary B.9. Every c-analytic set A can be written as a countable disjoint union of analytic sets. Proof. Any open domain U can be expressed as a countable in a countable union of union of open balls. Therefore, arbitrary analytic sets, any analytic set A with a complicated open domain U can be replaced by countably many analytic sets with open-ball domains (and the same defining inequal- ities as A). We conclude with Lemma B.8, using the fact that a countable family of countable families is a countable family. Next, we show a corollary that will be useful in the next section. Corollary B.10. An inclusion U ⊆ V of c-analytic sets U, V is a PAP function U → V . Proof. By Corollary B.9, we can write U = i∈N Ai and j∈N Bj where the Ai and Bj are analytic sets. Analytic V = sets are closed under intersection, so {Ai ∩ Bj}i∈N,j∈N is a countable partition of U into analytic sets. Hence, {(Ai ∩ F F Bj, id)}i∈N,j∈N is a piecewise representation of the inclusion U ֌ V . Finally, we show a few closure properties of c-analytic sets. Lemma B.11. If f : U → V is analytic and A ⊆ V is analytic, then f −1(A) is analytic. Proof. By definition, A = {x ∈ ( ∀i.g+ i , g− g+ i (x) > 0 ∧ ∀j.g− j . Thus, i X + j ) | j (x) ≤ 0} for some analytic functions i ) ∩ ( j X − T T f −1(A) ( \i = {x ∈ f −1 X + i ) ∩ ( X − j ) | \j (cid:16) i (f (x)) > 0 ∧ ∀j.g− ∀i.g+ f −1(X + i ) ∩ ( j (f (x)) ≤ 0} j )) | f −1(X − (cid:17) = {x ∈ ( \i ∀i.(g+ \j i ◦ f )(x) > 0 ∧ ∀j.(g− As f is analytic, it is continuous and so the sets f −1(X + i ) and f −1(X − j ) are open. And again, as f is analytic, so are the functions g+ j ◦ f )(x) ≤ 0} i ◦ f and g− j ◦ f . Corollary B.12. If f : U → V is PAP and A ⊆ V is c- analytic, then f −1(A) is c-analytic. Proof. By Corollary B.9, we can write A = for analytic sets Ai. Thus, f −1(A) = f −1( i∈N Ai i∈N Ai) = i∈N f −1(Ai) and it is sufficient to show that each f −1(Ai) F F is c-analytic. F f is PAP so there exists a partition U = i∈N Bi where Bi are analytic sets and analytic functions fi : Ui → Rn such F i∈N f −1 that f |Bi = fi. Therefore, f −1(A) = (A)∩Bi. Each f −1 (A) is analytic by Lemma B.11, and so each f −1 (A) ∩ Bi i is analytic. This means f −1(A) is indeed c-analytic. F i i 6) Category cPAP: Definition B.8 (cPAP). We call cPAP the category whose objects are c-analytic sets and whose morphisms are PAP functions between them. Composition is given by the usual composition of functions. Lemma B.13. cPAP is a concrete category. Proof. • cPAP has a terminal object. The analytic set R0 is terminal. • The functor hom(1, −) : cP AP → Set is faithful. The functor is the identity on morphisms. Proposition B.14. cPAP is a concrete site, where the cover- ings for a c-analytic set U are given by countable c-analytic partitions of U , i.e., {(Ui)i | ∪iUi = U ∧∀i 6= j, Ui∩Uj = ∅}. Proof. First, note that our definition for the coverings is a well- defined, as inclusions are PAP functions by Corollary B.10. We now show that the given coverings satisfy the 5 axioms of a concrete site. 1) Suppose we have a cPAP morphism g : C → D, and a c-analytic partition {Di}i∈I of D. Then we wish to find a partition of C so that g can be represented as a piecewise gluing of functions with codomains Di. First, note that since they are objects of cPAP, each Di can be further partitioned into countably many distinct analytic subsets {Dij}j∈Ji, Dij ⊆ Di. Furthermore, because g is a morphism, it has a PAP representation {(Ck, gk)}k∈K for analytic subsets Ck ⊆ C and analytic functions gk. For each i, j, k define Cijk = {c ∈ Ck | gk(c) ∈ Dij}: since gk is an analytic function and Dij is an analytic set, Cijk is analytic. Define g∗ ijk to be the restriction of gk to Cijk. Then {(Cijk, g∗ ijk)}i∈I,j∈Ji,k∈K is a piecewise representation of g in which each piece's codomain is Di for some i. 2) Let {fi : ci → c}i∈I be a covering of c. Then i∈I Im(|fi|) = |c|. This follows from the definition of partition. S 3) The initial object 0 is covered by the empty set. 4) The identity is always covering. 5) Let {fi : ci → c}i∈I be a covering of c and {gij : cij → ci}j∈Ji be a cover of ci for each i. Then {fi ◦ gij : cij → c}i∈I,j∈Ji ∈ J (c). This also follows from the definition of partition, and the fact that a countable union of countable sets is countable. Lemma B.15. cPAP is a subcanonical site. Proof. Let X be a representable presheaf on cPAP. Then, up to natural isomorphism, X maps a c-analytic set A to cPAP(A, B) for some fixed c-analytic set B. Consider a covering family {(Ai)}i∈I for A, and a compatible collection of plots φi ∈ X(Ai), which can be identified (via the natural isomorphism) with cPAP morphisms φi : Ai → B. Then we must show that there is a unique φ ∈ X(A) whose restriction to each Ai is φi. To see this, note that each φi has a PAP representation {(Aij , φij )}j∈Ji. By the definition of a covering family on cPAP, the Ai are disjoint, and so is a PAP representation; the φ we are {(Aij, φij )}i∈I,j∈Ji looking for is the function it represents. 7) Admissible monos for cPAP: As an admissible set of monos, we choose those given by the monos defined on an c-analytic subset of their domain of definition. More formally, we define MP AP for cPAP as follows: MP AP (B) = {m : A ֌ B | A ∼= A′, A′ is a c-analytic subset of B} Proposition B.16. MP AP is an admissible class of monos. Proof. 1) For all c ∈ C, 0 → c ∈ MP AP (c): the empty-set is c-analytic. 2) MP AP contains all isomorphisms: clear. 3) MP AP is closed under composition: clear. 4) All pullbacks of MP AP -maps exist and are again in MP AP : this amounts to showing that the preimage B := f −1(A) for a PAP function f and a c-analytic set A is c-analytic. This is true by Corollary B.12. S 5) For each c, the function SubM(c) → Set(|c|, {0, 1}) is componentwise injective and order-reflecting, and the image of SubM is closed under suprema of ω- chains: the function is the identity on sets, and is thus injective and order-reflecting. Given an omega chain {Ai ⊆ B}i∈N, we have i < j ⇒ Ai ⊆ Aj . Let i∈N Ai ⊆ B. It is a countable union of c-analytic A := sets and is thus a c-analytic set. 6) Given an increasing chain in SubM(c), (cn ֌ c)n∈N, denote its least upper bound by c∞ ֌ c. Then the closure under precomposition (with any morphism) of the set (cn ֌ c∞)n∈N contains a covering family of c∞: as shown in the previous point, c∞ is c-analytic i∈N Ai where the Ai are and by Corollary B.9, c∞ = analytic sets. Note that the intersection of two analytic sets is an analytic set, and therefore the intersection of a c-analytic set with an analytic set is c-analytic. Thus, (cn ∩ Ai ֌ c∞)n∈N,i∈N is a covering family of c∞ that is contained in the closure by precomposition of (cn ֌ c∞)n∈N. F A. Soundness and adequacy We can now prove Theorem II.2: Theorem B.17. ωPAP has products, coproducts, exponentials and L : ωPAP → ωPAP is a strong lifting monad. Proof. It follows directly from the fact that we have seen that ωPAP is a category of ω-concrete sheaves for the concrete site cP AP (Proposition B.14), and L is obtained from an admissible class of monos on cP AP (Propositions B.16 and B.1), by Proposition 7.5 in Matache et al. [1]. Proof of Theorem II.2. We apply theorem B.2 to the con- crete site (P AP, JP AP , MP AP ) with the admissible class of monos MP AP . APPENDIX C CORRECTNESS OF AD A. Fibrations for logical relations Roughly, fibrations offer a useful and unifying point of view for reasoning about generalized predicates on a category. Indeed, the functor p : Gl → C from a glueing/sconing category [39] to the base category is an example of nice fibration. This justifies to study a categorical version of logical relations using fibrations. We follow closely this point of view developed in [15, 40]. 1) Fibrations: We recall some basic facts from the theory of fibrations [38]. Definition C.1 (Reproduced from [38]). Let p : E → B be a functor. A morphism f : X → Y ∈ E is Cartesian over u : I → J ∈ B if pf = u and every g : Z → Y ∈ E for which pg = u ◦ w for some w : pZ → I, there is a unique h : Z → X ∈ E above w with f ◦ h = g. Definition C.2 (Reproduced from [38]). A fibration is a func- tor p : E → B such that for every Y ∈ E and u : I → pY ∈ B, there is a Cartesian morphism f : X → Y ∈ E above u. It is also called fibred category or category (fibred) over B. Example C.1. Let Pred be the category whose objects are pairs (X, S) of a set X and a subset S ⊆ X, and morphisms (X, S) → (Y, T ) are functions f : X → Y such that f (S) ⊆ T . Let p : Pred → Set be the functor that forgets the subsets S. It is a fibration. Proposition C.1. (Change-of-base, [38]) Let p : B → B be a fibration and K : A → B be a functor. Form the pullback in Cat: A ×B E ❴ K ∗(p) A K E p / B In this situation, the functor K ∗(p) is also a fibration. Example C.2. Consider the functor K : Set × Set → Set that sends a pair of sets to their product. In this case, BRel ❴ K ∗(p) Set × Set K Pred p / Set The main goal of this section is to show Theorem III.2. To do so, we apply the categorical machinery of fibrations for logical relations developed in [15]. They build on the well- known theory of fibrations [38]. As we follow their recipe closely, we recall the minimal amount of fibration theory in Section C-A needed to understand their machinery, which we also reproduce in Section C-A2 for convenience. We finally use the machinery of fibrations for logical relations in Section C-B to prove Theorem III.2, our correctness result on AD. BRel is a category of functions that preserve a binary relation. An object in BRel is a binary relation S ⊆ X × Y , and a morphism S ⊆ X × Y → R ⊆ X2 × Y2 is a function f : X×Y → X2×Y2 such that for all (x, y) ∈ S, f (x, y) ∈ R. Proposition C.2. (Composition, [38]) Let p : E → B and r : B → A be fibrations. Then rp : E → A is also a fibration, in which f ∈ E is a Cartesian morphism iff f is a Cartesian morphism for p and p(f ) is is a Cartesian morphism for r. For each I ∈ A one obtains a fibration pI (rp)−1(I) → BI = r−1(I) by restriction. : EI = ✤ / / (cid:15) (cid:15) (cid:15) (cid:15) / ✤ / / (cid:15) (cid:15) (cid:15) (cid:15) / Definition C.3 (Reproduced from [38]). Given a fibration p : E → B, the fibre category over I ∈ B is the subcategory EI of E whose objects are above I and morphisms above idI . Definition C.4. p : E → B is an opfibration if pop : Eop → Bop is a fibration. Example C.3. p : Pred → Set is an opfibration. 2) Fibrations for logical relations for effectful languages: We now recall the setting of fibrations for logical relations from [15]. Definition C.5 (Reproduced from [15]). A partial order bifibration with fibrewise small products is a faithful functor p : E → B such that • p is a fibration • p is an opfibration • each fibre category is a partial order • each fibre category has small products, and the inverse image functors (necessarily) preserve them Definition C.6. A fibration for logical relations over a bi-CCC B is a partial order bifibration p : E → B with fibrewise small products such that E is a bi-CCC and p strictly preserves the bicartesian-closed structure. Proposition C.3 ([15]). The pullback of a fibration for logical relations along a finite product preserving functor is a fibration for logical relations. In particular, the usual subscone fibration is recovered as a change of base along the functor B(1, −) : B → Set. Definition C.7 (Reproduced from [15]). Let p : E → B be a functor. Given X, Y ∈ E, and f : pX → pY , we write * f : X *→ Y to denote the following proposition: ∃ f : X → Y.p( * f ) = f . We say that f has a lift (in E). The setting of Katsumata [15] works for fairly general languages with effects. One way to describe them is in terms of algebraic operations, or equivalently in terms of generic effects. Definition C.8 (Reproduced from [15]). Let C be a category and T a strong monad on it. Given objects C, D f C, a (D, C) algebraic operation or generic effect for is a morphism C → T D. A lambda-calculus with effect is parametrized by a set of base types and (effectful) primitives, each having an arity and coarity, describing the number and types of arguments and return values. This is encapsulated as a signature: Definition C.9 (Reproduced from [15]). A λc-signature Σ is a tuple (B, K, O, ar, car : K O → GT ype(B)) where B is a set of base types, K a set of effect-free constants, O a set of S algebraic operations, and GT ype(B) the set of ground types on B. ar, car are the arity and co-arity functions. Definition C.10 (Reproduced from [15]). Let Σ be a signa- ture. A λc(Σ)-structure is a tuple A = (B, T, A, a) where B is a bi-CCC, T a strong monad on B, A a functor B → B. In other words, a λc(Σ)-structure gives an interpretation of the base types and primitives of the language. Note that we can always extend A to a structure preserving functor AJ−K : Gtype(B) → B. We now recall the main theorems from [15]: Definition C.11 (Reproduced from [15]). A property over a λc(Σ)-structure A is a pair (V, C) of functors V, C : B → E such that p ◦ V = A and p ◦ C = T ◦ A That is, a property is the choice for any base type b ∈ B of a predicate V b in the category of predicates E over values of type b, and of a predicate Cb over computations T (Ab) of type b. The question of interest is then whether all programs preserve the property, which is answered with the following theorem. Theorem C.4 (Logical relations, [15]). Let Σ be a signature, A = (B, T, A, a) be an λc(Σ)-structure, p : E → B be a fibration for logical relations and (V, C) be a property over A. If the property satisfies the following conditions • for all b ∈ B, return has a lift • for all k ∈ K, AJkK has a lift • for all o ∈ O, JoK has a lift then for all well-typed terms x1 : b1, . . . , xn : bn ⊢ t : b, AJtK lifts to the total category. 3) Fibrations for logical relations for effectful languages with recursion: So far, we have reviewed the way to use fibra- tions for logical relations for higher-order effectful languages, but not for languages with recursion. We review this next. Definition C.12 (Reproduced from [15]). An ωcpo-enriched bi-CCC is a bi-CCC C such that each homset is an ωcpo, and the composition, tupling (−, −), cotupling [−, −] and currying λ(−) of the bi-CC structure on C are all monotone and continuous. Definition C.13 (Reproduced from [15]). A pseudo-lifting monad on an ωcpo-enriched bi-CC category B is a monad on the underlying non-enriched category such that it has its component at I, an algebraic operation bt such that btI : 1 → T I, is the least morphism. Definition C.14 (Reproduced from [15]). An ωcpo-enriched λc(Σ)-structure is a tuple (B, T, A, a) such that B is an ωcpo- enriched bi-CCC, T is a pseudo-lifting monad over B and (B, T, A, a) is a λc(Σ)-structure. Definition C.15 (Reproduced from [15]). We call X ∈ E above T I ∈ B admissible if • ⊥pX : 1 *→ X • for all Y ∈ E and ω-chain fi ∈ B(pY, pX) such that fi : Y *→ X, we have ∞ i=0 fi : Y *→ X. Theorem C.5 (Logical relations for language with recursion, [15]). Let Σ be a signature, A = (B, T, A, a) an ωcpo- enriched λc(Σ)-structure, p : E → B a fibration for logical F relations and (V, C) be a property over A. If the property satisfies are natural transformations F → F ′ subsheaves. that restrict to the • the conditions of Theorem C.4 • for all b ∈ B, Cb is admissible Then for all well-typed terms of the language with iteration, x1 : b1, . . . , xn : bn ⊢ t : b we have AJtK : *→ Cb. i V bi B. Correctness of AD Q We will show correctness of AD (Theorem III.4) via the the- ory of fibrations for logical relations. The goal is to construct a category of predicates on ωPAP and to encode correctness of AD as a predicate preservation property. To construct such a fibrations for logical relations, we obtain one by pulling back another one along a product preserving functor. There are several possibilities that give us different sort of predicates on ωPAP spaces. One constraint is that we need to be able to interpret our choice of logical predicate for AD as such a predicate, and make sure all of our constants are predicate preserving. This is in particular non-trivial when dealing with constants involving coproducts, such as <: real × real → B as the booleans are interpreted as the coproduct 1 + 1. Lastly, we need to make sure that our choice of predicate for base types is closed under lubs of ω-chains. We organize this section as follows. First, we construct a suitable category of predicates on ωPAP × ωPAP (i.e. a fibration for logical relations). Second, we construct a property (Definition C.11) on this category of predicates. Note that the fact that derivatives are not unique any more is what will make this logical relation more complex. Lastly, we will show the correctness of AD by combining these elements and Theorem C.5. 1) A fibration for logical relations on ωPAP × ωPAP: Definition C.16. We define the category Inj, a subcategory of cP AP , whose objects are c-analytic sets and morphisms are PAP injections. Lemma C.6. Inj is a site, with coverage J where coverings are given as in cPAP. Proof. The proof for the case of cPAP carries through to this restricted setting. Definition C.17. We define Sh(Inj) to be the category of sheaves on the site Inj. Lemma C.7. Sh(Inj) is a Grothendieck topos, and in par- ticular it is Cartesian-closed, complete and co-complete. Proof. This is standard sheaf theory, see e.g. MacLane and Moerdijk [41]. By a subsheaf P of F , we mean a sheaf F such that for all c-analytic set A, P (A) ⊆ F (A), and P (f ) is the restriction of F (f ) for all morphisms f . Definition C.18. We denote by Sub(Sh(Inj)) the category whose objects are pairs of sheaves (P, F ) of Sh(Inj), where P is a subsheaf of F , and morphisms (P, F ) → (P ′, F ′) Lemma C.8. The second projection (P, F ) 7→ F is a fibrations for logical relations p : Sub(Sh(Inj)) → Sh(Inj). Proof. As Sh(Inj) has pullbacks, it is a fibration. It is clearly faithful. By the theory of glueing ([39, 42, 43, 44]), as Sub(Sh(Inj)) is a CCC and has an epi-mono factorisation system, Sub(Sh(Inj)) is a CCC, has finite colimits, and p preserves the CCC-structure. In addition, each fibre category is a partial order and has small products. It remains to show that cod is an opfibration and that p preserves coproducts. By Lemma 4.6 in Kammar and McDermott [45], it suffices to show that monos are closed under coproducts, as we already have the other conditions for having a factorization system for logical relations. The arrow category on Sh(Inj) is cocomplete, as Sh(Inj) is (it is a topos). As Sh(Inj) is a topos, it has a epi-mono factorization system, and therefore it has image factorization. Therefore, the category of monos is a reflective subcategory of the arrow category. As such, it is cocomplete, and in particular it has coproducts. So monos are closed under coproducts, and we conclude by Lemma 4.6 in Kammar and McDermott [45], as said above. Q We now define the functor F : ωPAP × ωPAP → Sub(Sh(Inj)) given by F (X, Y ) = X × i∈N Y , where i∈N Y forgets that it is an ω-concrete sheaf on the site X × cP AP , and only remembers that it is in particular a sheaf on the site Inj. It is a product preserving functor, and therefore, by Proposition C.3, the pullback of p : Sub(Sh(Inj)) → Sub(Sh(Inj)) along F is a fibration for logical relations. We denote this pullback by π : Gl :→ ωPAP × ωPAP. Q Remark C.1. Before moving on, let us say a few words on this category of predicates Gl. One reason why we defined the category of sheaves Sub(Sh(Inj)) is that the property we will define for the correctness of AD will not be a concrete subsheaf, and this excludes directly using subobjects on ωPAP as the fibration for logical relations of interest. Secondly, the base type B is interpreted as a coproduct, and if we simply choose the category of presheaves on Inj, primitives like > will not lift, for a similar reason to the one presented in V ́ak ́ar [4]. We could have chosen sheaves on cP AP instead. This would not change much, but this is a bit overkill for our purpose and simply adds some unnecessary complexity. Thirdly, we do seem to need to have the property indexed by all c-analytic sets A. One reason is that the fact that we have partial functions forces the definition of a lift for LR, as well as for R. A second reason is that the non-uniqueness of intentional derivatives creates a technical complication: being a correct intentional derivative at a point is essentially non- informative, so we cannot use the same trick as we did in the smooth case. That is, the problem is that the input space R is smaller than Rn, and the quantification only shows that h is 'correct' on a set of at most the size of R inside Rn, which is Lebesgue-negligible. This problem disappears when we can show that h is correct on each open of an open cover of its domain. 2) A property for the correctness of AD: Definition C.19. Let f : A ⊆ Rn → R a PAP function. Given any intentional derivative g : A → Rn of f , we call πi ◦ g : A → R an i-th partial intentional derivative of f . We write hoti for the vector in Rn that consist only of zeros, except it has a single 1 at the i-th position. Given any dual- number intentional representation g : A × Rn → R2 of f , define the PAP function gi : A → R2 given by gi(x) = g(x, hoti) is called an i-th partial dual-number intentional repre- gi sentation of f , and its second component is an i-th partial intentional derivative of f . We write ∂i DN Rf for the set of i-th partial dual-number intentional representations of f . We extend the definition of ∂i i by setting ∂i Definition C.20. Let V (R) := (R, each c-analytic set A, we have DN Rf = {λx.0} for any i > n. i∈N R× R, VR) where for Q DN Rf to all natural numbers VR(A) = {(f : A → R, (gi : A → R2)i∈N) | f, g PAP, and gi ∈ ∂i DN Rf } Likewise, let C(R) := (LR, L( each c-analytic set A, we have Q i∈N R × R), CR) where for CR(A) = {(f : A → LR, g : A → L( R × R)) | Dom(f ) = Dom(g) and Yi∈N Let V (B) = (B, A, we have ∀i.( f , ^Lπi ◦ g) ∈ VR(Dom(f ))} i∈N B, VB) where for each c-analytic set e Q VB(A) = {f : A → B, g : A → B | ∀i, πi ◦ g = f } equalizer of B × canonical map VB ֌ B × Q i∈N B, which exists in any topos and the i∈N B is a mono. Let us now look a bit more into what morphisms preserving Q the property look like. Definition C.21. Let V (Rk) := (Rk, ( where for each c-analytic set A, we have Q i∈N R × R)k, VRk ) VRk (A) = {(f : A → Rk, g : A → ( R × R)k) | ∀1 ≤ j ≤ k, (πjf, πjg) ∈ VR(A)} Yi∈N Let f : Rn → LR represent a PAP function. We define V (f ) i∈N R × R)k → i∈N R × R) is ωPAP, and such that for any c-analytic set to be pairs of functions (f, h), where h : ( L( A, and any (g1, g2) ∈ VRk (A), (f ◦ g1, h ◦ g2) ∈ CR(A). Q Q This means that given a PAP functions g1, . . . , gn : A → R, h will send i-th partial intentional representations of each of the gi to i-th partial intentional representations of f ◦ hg1, . . . , gni. Note that if A ⊆ Rk, this will be trivially satisfied for any i > k. Let us now see how we will interpret and a lift primitive t : real2 → real of our language. This interpretation will only be required for the correctness proof. We set JtKωPAP×ωPAP = i∈NJD(t)K). In other words, we make countably many (JtK, copies of the semantics of the AD-translation of t. We can now more generally show that every primitive of the language, whose semantics is interpreted in ωPAP × ωPAP following the example above, will lift to Gl. Q Lemma C.10. Every primitive of the language has a lift in Gl. Finally, to satisfy the conditions of Theorem C.5, we need to show that for each base B, C(B) is admissible. Lemma C.11. C(B) and C(R) are admissible. Yi∈N 3) Correctness of AD: i∈N B), CB) where for each c- Lemma C.12. ωPAP is an ωcpo-enriched bi-CCC. Let C(B) = (LB, L( analytic set A, we have Q CB(A) = {(f : A → LB, g : A → L( B)) | Yi∈N Dom(f ) = Dom(g) and ∀i.( f , ^Lπi ◦ g) ∈ VB(Dom(f ))} Lemma C.9. We have defined a property for our language. e Q Q i∈N R2, B × i∈N R2, LR × L Proof. The only thing to show is that VR, CR, VB, CB are sub- i∈N B, LB × sheaves of R × i∈N B respectively. It is immediate for the C's once we L Q have shown the result for the V 's. For VR, it amounts to showing two things. First, whether partial intentional deriva- tives restrict to a subset of the domain of a function, which is evidently true. Second, whether partial intentional derivatives glue if they agree on their intersection, which as for usual derivatives, is true as well. For VB, it is immediate as it is an Q Proof. Each homset is an ωcpo by forgetting the PAP- structure. For composition and coproducts, it is immediate as lubs are taken point-wise. For products, if f = i fi and i(fi, gi). Finally, g = W if fi : X × Y → Z, for currying we have ( fi)(x, y) = λ(fi)(x)(y). As lubs are taken pointwise, λ(fi)(x))(y). This means that i gi, then (f, g) = ( λ(fi)(x)(y) = ( fi(x, y) = i gi) = i fi, W W W W W W λ(fi). The monotonicity part is similar. W we have W λ( fi) = W W In summary, it follows from the fact that the forgetful func- W tor ωPAP → ωCPO preserves and reflects limits, coproducts, exponentials, and the ωcpo-structure. Lemma C.13. Let f : A ⊆ Rn → R be PAP. Then h : A × Rn → R2 is a dual-number representation of f iff for all natural number i, h(x, hoti) is an i-th partial dual number representation of f . Theorem C.14. For any x1 : real, . . . , xn : real ⊢ t : real, JtKωPAP×ωPAP has a lift. APPENDIX D FAILURE AND CONVERGENCE OF GRADIENT DESCENT Proof. We have done all the work in the previous subsections. We simply check the condition to apply Theorem C.5. First, note that we indeed have a semantics in ωPAP×ωPAP, i∈NJD(t)K), extending what given by JtKωPAP×ωPAP := (JtK, we have seen in Section C-B2. Then, Q • We have defined a fibrations for logical-relations π : Gl → ωPAP × ωPAP in Section C-B1. • We have defined a property (V, C) in Gl in Section C-B2. • We check that x 7→ return(x) lifts, but this is immedi- ate. • Each primitive has a lift, by Lemma C.10. • ωPAP is an ωcpo-enriched bi-CCC by Lemma C.12. • L is a pseudo-lifting monad. It means that we have an algebraic element ⊥A : 1 → LA that is interpreted in LA as the bottom element. This is true by construction. • C(R) and C(B) are admissible, by Lemma C.11. Corollary C.15 (Correctness of AD (limited)). For any term x1 : real, . . . , xn : real ⊢ t : real, the PAP function JD(t)K : A × Rn → R × R is a dual-number intentional representation of JtK : A ⊆ Rn → R. Proof. Let x1 : real, . . . , xn : real ⊢ t : real. By Theo- rem C.14, JtKωPAP×ωPAP has a lift. Consider the c-analytic set Rn and the pair (idRn , λx. (πk(x), [i = k]π′ i(x))) Yi≤k≤n Yi∈N where, by convention, πi(x) = π′ i(x) = 0 whenever i > n. We use Iverson brackets, [i = k], which equals to 1 when the condition is satisfied, and 0 otherwise. This pair is an element of VRk (Rn). This means that JtK, (cid:16) Yi≤k≤n Yi∈N JD(t)K ◦ λx. (cid:0) (πk(x), Y1≤k≤n ∈ CR(Rn) [i = k]π′ i(x)) (cid:1)(cid:17) This simplifies a bit more, and by the definition of CR(Rn), this means that for all i, JD(t)K(x, hoti) is an i-th intentional partial representation of JtK. By Lemma C.13, this means that JD(t)K is a dual-number intentional representation for JtK, as desired. With the same proof, Theorem C.14 gives us directly the stronger result at all ground types: Corollary C.16 (Correctness of AD (full)). For any term well- typed term Γ ⊢ t : τ of ground type τ in a ground context Γ, the PAP function JD(t)K : A × Rn → R × R is a dual-number intentional representation of JtK : A ⊆ Rn → R. Proposition C.17. A. Failure of gradient descent for PAP functions Proof. Let ǫ > 0. Let P be the closed program defined by the following code, where lr is our chosen learning rate ǫ. # Recursive helper def g(x, n): if x > 0: return ((x - n) * (x - n)) / (lr * 2) if x == 0: else: return x / lr + n*n / (2*lr) return g(x+1, n+1) def P(x) = g(x,0) This can easily be written in our language with recursion and conditionals, but it would slightly impact readability. JP K is PAP, and by inspection, we see that JP K = x 7→ x2 2ǫ . This is proved by simple induction on N for the recursive function g defining P . Let us now show that f := JP K satisfies the hypothesis of Theorem III.5 and is strictly convex: • f is strictly convex: this is well-known for the x2 function • f is bounded below: f ≥ 0 • f is L-smooth for some L: − = 1 ǫ 2y 2ǫ (x − y) ∇f (x) − ∇f (y) = And therefore f is 1 2x 2ǫ ǫ -smooth. This means that for all 0 < ǫ′ < 2 = 2ǫ, gradient descent on f with rate ǫ′ converges to the global minimum of f , which is at 0 at 0. Now, let us see that this is not the case when we use the intentional derivatives for f computed by AD, in the case ǫ′ := ǫ. 1 ǫ PAP function P ′ (x+⌊|x|⌋+1)−(⌊|x|⌋+1) ǫ Applying our standard AD macro to P , we obtain a ǫ when x ∈ R>0, and when x ∈ R<0 − {−n | n ∈ N}, and ǫ for x ∈ {−n | n ∈ N}. Note that ∇JP K(x) 6= JP ′K(x) 1 exactly when x ∈ {−n | n ∈ N}. returns x that Let x0 ∈ R be any initialization for the gradient descent algorithm. Then, after one step of gradient descent, we obtain x1 := x0 − ǫ × P ′(x0). If x0 > 0, then JP ′(x0)K = x0 ǫ and thus x1 = 0. When x0 < 0 is not an integer, JP ′(x0K = x0 ǫ as thus x1 = 0 as well. Finally, when x0 < 0 is an integer, JP ′(x0)K = 1 ǫ and therefore x1 = x0 − 1. In any case, x1 is a non-positive integer, and for x2 we'll always have x2 = x1−1. Therefore, xt → −∞ as t → ∞. A similar program P can be constructed when the learning rate is non-fixed. The recursive program inside P 's definition simply calls ǫ(n) instead of using ǫ, and the analysis will be very similar, except that x1 will not necessarily be an integer when x0 is a non-positive integer, but this happens for almost no x0. B. Almost-sure convergence of Gradient Descent Proof. Given a fixed intentional derivative ∇f of f , Fint(ǫ, x) = (ǫ, x − ǫ∇xf ). Let Ftrue(ǫ, x) = (ǫ, x − ǫ∇∗ let xf ) where ∇∗ f . We restrict the domain of Ftrue and Fint to (0, 2 For δ > 0 and t ∈ N, we define xf is the true gradient of the differentiable function L ) × Rd. X ∗ t,δ := {(ǫ, x0) ∈ (0, 2 L )×Rd | |∇∗f (π2F t true(ǫ, x0))| ≤ δ} where gt is the t-fold composition of a function g with itself. As f is L-smooth, ∇∗f is locally L-Lipschitz and thus con- tinuous. Therefore, by the first conclusion of Theorem III.5, for any δ > 0, occur for finitely many ǫ (at most n). Thus, J(Ftrue)ǫ,x has max rank n + 1 almost everywhere. Denote by R this set. f being PAP, F is PAP as well. Therefore, Ftrue is almost everywhere analytic, and denote this set C. Let N = R ∩ C. Note that N c is a null-set. On N , F is F ∈ C1 and its Jacobian is invertible. Therefore, by the implicit function theorem, the result is locally true around any point x ∈ N . This means, for all x ∈ N , there exists a neighborhood Ux of x such that F −1 true(A) ∩ Ux is a null-set. We can use a countable cover {Ui}i∈N of N of such neighborhoods, and thus ∞ [t=0 X ∗ t,δ = (0, 2 L ) × Rd We define similarly, for any δ > 0, Xt,δ := {(ǫ, x0) ∈ (0, 2 L ) × Rd | |∇∗f (π2F t int(ǫ, x0))| ≤ δ} We will show by induction on t ∈ N that Xt,δ and X ∗ t,δ only differ by a null-set, i.e. that there exists null-sets Nt,δ and Mt,δ such that Xt,δ ∩ N c t,δ. This implies that t,δ = X ∗ t,δ ∩ M c ∞ [t=0 ∞ Xt,δ ⊇ Xt,δ ∩ Nt,δ = [t=0 ∞ [t=0 ∞ X ∗ t,δ ∩ Mt,δ ⊇ ( X ∗ t,δ) ∩ ((0, ∞ ) × Rd − Mt,δ) 2 L [t=0 ∞ ) × Rd − Mt,δ) [t=0 [t=0 2 L = (0, = (0, 2 L ) × Rd ∩ ((0, 2 L ) × Rd − ∞ [t=0 Mt,δ As a countable union of negligible sets is negligible, this L ) × Rd up to a negligible means that set, as desired. S ∞ t=0 Xt,δ equals (0, 2 By induction on t ∈ N, we show the following property: ∀A ⊆ (0, 2 L ) × Rd measurable of measure 0, {(ǫ, x) | F t true(ǫ, x) ∈ A} is measurable with measure 0 true is the identity and it's obvious. Let t ∈ N such If t = 0, F t L ) × Rd be of measure that the property holds. Let A ⊆ (0, 2 0. To use the induction hypothesis, it suffices to show that F −1 true(A) has measure 0. The Jacobian matrix of Ftrue is an (n + 1) × (n + 1) matrix, given by J(Ftrue)ǫ,x = 1 Jxf T (cid:18) 0T n In − ǫHxf (cid:19) where In is the n × n identity matrix, 0n the zero vector in Rn, Hxf is the Hessian matrix of f , and (−)T is the transpose operation. The rank of J(Ftrue)ǫ,x is lower bounded by one plus the rank of In − ǫHfx. The latter is strictly less than n exactly when 1 ǫ is an eigenvalue of Hxf . For a fixed x, this can only true(A) = F −1 F −1 ⊆ F −1 true(A) ∩ (N ∪ N c) ( true(A) ∩ [i∈N (cid:2) true(A) ∩ Ui F −1 Ui) ∪ N c (cid:3) ∪ Z (cid:3) ⊆ (cid:2) [i true(A) is measurable as A is, and as null-sets are closed true(A) has measure F −1 under countable unions, this shows that F −1 0, which concludes the induction. Now, we show by induction on t ∈ N that for almost all (ǫ, x0) ∈ (0, 2 L ) × Rd, true(ǫ, x0) = F t F t int(ǫ, x0) Once again, the base case is immediate. Let t ∈ N such that the property holds. As ∇f is an intentional derivative of f , for almost all x ∈ R, we have that ∇xf = ∇∗ xf . Therefore, for almost all (ǫ, x), we have that Ftrue(ǫ, x) = Fint(ǫ, x). Let A be the set of points on which they differ. By the previous proposition, F −1 true and F t+1 int may differ only on the set F −1 true(A), which has measure 0. This concludes the induction. true(A) has measure 0. Therefore, F t+1 true(ǫ, x0) and F t true(ǫ, x0) or π2F t As a corollary of what we have just shown, we have that for almost all (ǫ, x0), xt is the same, whether it was obtained from true or AD-computed gradients. Indeed, xt is either π2F t int(ǫ, x0), and we have shown that F t true(ǫ, x0) agree almost everywhere. Therefore f (xt=1) ≤ f (xt) remains true almost-everywhere for all t, as a countable union of negligible sets is negligible. Finally, if f is strongly convex, then {xt}t will reach the global minimum. As xt is the same, whether it was obtained from true or AD-computed gradients, for almost all (ǫ, x0), this means that gradient-descent with AD-computed gradients will also almost surely converge to the global minimum. APPENDIX E S-HAUSDORFF MEASURES A. Monad of measure on ωPAP The goal of this section is to give the key steps in the proof of Theorem IV.2. These are the following. We adapt the proof technique used in V ́ak ́ar et al. [2]. We define an expectation operator IntX : SX → (X → W) → W). We show that it is a well-defined ωPAP-morphism, and natural in X. Next, we show that ωPAP admits a proper orthogonal- factorization system, extending the known result on categories of concrete sheaves to this category of ω-concrete sheaves. Using a theorem from Kammar and McDermott [45], we show that the image of Int induces a strong monad M on ωPAP. This monad is easily shown to be commutative. Lemma E.4. Let f : U ⊆ Rn → Rm be real analytic on a connected open U . Let k be the maximal rank of f on U . Then V := {x ∈ U | rank(f (x)) = k} is Using this, we can show Lemma IV.2. Proof. JtKM in the new measure semantics is given by IntRn ◦ JtKS. By definition, this means it is the integrator f (αJtKS(x))ΛΩ(dx), which can be seen as the push- λf. forward of ΛΩ by the function αJtKS, defined by the second point in Definition IV.4. This function is an ωPAP morphism Ω → L(Rn), i.e. a partial ωPAP function ft : Ω ⇀ Rn such that JtK = ft∗ΛΩ. R B. Pushforward of PAP functions In this section, we prove the following Theorem: Theorem E.1. Let f : U → Rn be the total restriction of a partial ωPAP morphism to its domain U ⊆ Rm. Let λ be the restriction of the Lebesgue measure to U . Then f∗λ has a density w.r.t. some s-Hausdorff measure μ on Rn. It is the core technical theorem that is required to prove Theorem IV.3. To prove Theorem E.1, we will first prove a restricted form of it: Theorem E.2. Let f : U ⊆ Rn → Rm be real analytic on a connected open U . Then there is an integer k such that f (U ) i∈N Mi of smooth is contained is a countable union M := submanifolds Mi of Rm of dimension k, up to a set of k- Hausdorff measure 0. Furthermore, f∗λ has a density w.r.t. the k-Hausdorff measure on M . S Before proving the theorem, we need a few other technical lemmas. 0≤k≤m i .μk i∈N f k Lemma E.3. Let μ = some non-negative measurable functions f k i {∞}, and such that μk dimensional submanifold M k measure given by the (μk i ∈ MRm for : Rm → R+ ∪ i is the k-Hausdorff measure on some k- i of Rm. Let B be the s-Hausdorff i ). Then μ has a density w.r.t. B. P P i S P i . As the f k i M k i∈N 1x∈M k Proof. Let Xk = i and μk be the k-Hausdorff measure .f k i are non-negative on Xk. Let gk = and can take the value ∞, the limit exists and therefore the gk are measurable. By construction, we have the equality i = gk.μk for all 0 ≤ k ≤ m. This follows from the simpler equality f1.ν|A + f2.ν|B = (f1 + f2).ν|A∪B P which is also valid for countable unions, given that the μk i are all restrictions of the k-Hausdorff measure. Therefore μ = i∈N f k i .μk 1≤k≤m gk.μk. P Let g = g0 + 1x6∈X0(g1 + 1x6∈X1(g2 + 1x6∈X2(. . . + 1x6∈Xm−1gm))). g is clearly measurable and non-negative (with the convention that 0.∞ = 0 here). For all i < k, Xi is H k negligible. Thus gk.μk = gk.μk|Xk−Xi = (1x6∈Xigk).μk. From this fact, we deduce that 1≤k≤m gk.μk = g.B, and therefore conclude that μ = g.B, i.e. that μ has a density w.r.t. B. P • open, • dense in U , • and λ(U − V ) = 0. Proof. Let's first show V is open. Given a coordinate system for U and V , for any x ∈ V , denote by G(x) the matrix for Txf in these bases. By hypothesis, G(x) has at least an invertible k × k sub-matrix, and this is a characterisation of rank. Then denote by H : Mn×m(R) → R : A 7→ B k×k submatrix of A |det(B)|. H is continuous as the de- terminant is, and V = (HG)−1(R − {0}) is thus open. Let's P show V is dense. Note that this is not true in general for smooth functions. Pick a base for U and V again, and let G(x) the matrix for Txf in these bases. Thus x 7→ G(x) is also real analytic. Let p ∈ ̄V − V . Pick a k × k submatrix B of matrices in Mn×m(R), then let HB : Mn×m(R) → R be the determinant of that submatrix. Assume HBG is 0 on a open neighbourhood WB of p for all B. Then W = ∩WB is a finite intersection of opens and thus is open, and W ∩ V 6= ∅ as by assumption p is in the boundary of V . But that's a contradiction as we know that for some B and any x in the intersection, HBG(x) 6= 0. Therefore, there is a B such that HBG is not 0 at some point x in a neighbourhood WB on p. As f is analytic, so is df , and so is G. The determinant is a polynomial function of its arguments, it is thus real analytic, and thus so is HB. As HBG is analytic and non-identically 0 on WB, it must be non-zero on a dense subset of WB. Let's assume that the closure ̄V is not all of U . We obtain a contradiction by picking a point close to ̄V that would end up in one of the WB. In more detail, assume by ways of contradiction that U − ̄V 6= ∅. Let p ∈ U − ̄V . Let g : U → R+ be defined as g(x) = d(x, ̄V ). By assumption, as ̄V is closed, we have g(p) > 0. Also, note that g is continuous. As k is the maximal ranked reached by f , ̄V 6= ∅. Thus, there exists y ∈ ̄V such that g(y) = 0. As U is connected (and thus path connected, as an open of a Euclidean space), there is a continuous path c : [0, 1] → U such that c(0) = y and c(1) = p. The composition g ◦ c is continuous and so there a point x ∈ ̄V − V such that c(t) = x and g(x) = 0 for some t0 < 1. By compactness of [0, 1], let's choose the biggest such t0, which exists as c(1) = p 6∈ ̄V . For all t > t0, we therefore have g(c(t)) > 0. However, by the result above, there is a dense open subset W of a WB, a neighbourhood of x, such that W ⊆ V . By density of W , this means that c(t) = 0 on c−1(WB)∩[t0, 1] 6= ∅, a contradiction. We will now prove that X := U − V has Lebesgue measure 0. For a fixed k × k matrix B of any n × m matrix, consider the same analytic function HB as above. Then gB := G; HB : U → R is analytic. Using the theorem from Mityagin [46], it is either the 0 function or the preimage of 0 has Lebesgue B ({0}). measure 0. We can write X = As f has rank k somewhere, not every gB is the 0 analytic function, and thus X is contained in a Lebesgue measure 0 B k×k submatrix g−1 T set, and therefore has Lebesgue measure 0. Lemma E.5. Let f : A → C where A ⊆ Rn is λ-measurable, and let U ⊆ A be λ-measurable. Assume that λ(A − U ) = 0. Then f∗λ = (f |U )∗λ. Proof. f∗λ(S) = λ(f −1(S)) = λ(f −1(S) ∩ A) = λ(f −1(S) ∩ (A − U + U )) = λ((f −1(S) ∩ (A − U )) ∪ (f −1(S) ∩ U )) ≤ λ(f −1(S) ∩ (A − U )) + λ(f −1(S) ∩ U ) ≤ λ(A − U ) + λ|U (f −1(S) = 0 + λ|U (f −1(S)) = (f |U )∗λ(S) As the other inequality is obvious, we showed that f∗λ(S) = (f |U )∗λ(S). Lemma E.6. Let f : U ⊆ Rn → Rm be real analytic on a connected open U . Further, assume f has constant rank. Then f (U ) is a countable union of manifolds. Proof. As f has constant rank, by the constant rank theorem, f is locally of the form (x1, . . . , xn) 7→ (x1, . . . , xk, 0, . . . , 0). More precisely, around any x ∈ U , there is a neighbour- hood W of x and smooth diffeomorphisms φ : Rm → Rm, ψ : Rn → Rn such that g(x1, . . . , xn) := φ ◦ f |W ◦ ψ(x1, . . . , xn) = (x1, . . . , xk, 0, . . . , 0). If k = m, Rk = φ ◦ f |W ◦ ψ(Rn) is a k-dimensional smooth manifold. If k < m, let π : Rm → Rm−k given by π(x1, . . . , xm) = (xk+1, . . . , xm). π is an orthogonal projection and therefore a submersion. By the submersion theorem, π−1(0) = φ◦f |W ◦ψ(Rn) is a k-dimensional smooth manifold. Therefore, as φ is a diffeomorphism, f |W (W ) = f |W ◦ ψ(Rn) = φ−1(π−1(0)) is also a k-dimensional smooth manifold. Now consider the open cover of U given by {Wx | x ∈ U } where Wx is a neighbourhood of x as above. As opens of Euclidean spaces are Lindel ̈of spaces, we can extract a countable open sub-cover {Wxn | xn ∈ U }n∈N of U . From what we just proved, for each n, f (Wxn ) is a k-dimensional manifold. Thus, F (V ) = n∈N f (Wxn ) is a countable union of k-dimensional manifolds. S Proof of Theorem E.2. Let k be the maximal rank of f on U . Let V := {x ∈ U | rank(f (x)) = k}. Let's first show that it is sufficient to show the result for f |V . By Lemma E.4, V is open and dense in U , and U − V has Lebesgue measure 0. By Lemma E.5, f∗λ = (f |V )∗λ, so we reduced the second statement to showing it for (f |V ). In addition, by Sard's theorem, f (U − V ) has k-Hausdorff measure 0. Therefore, it is sufficient to prove the theorem for f |V , which we call f again. Now, write V = i Vi where the Vi are the connected components of V . On each connected component Vi, f |Vi ver- ifies the hypothesis of Lemma E.6. Thus f (Vi) is a countable F union of k-dimensional manifolds for each Vi. As Euclidean spaces are locally connected spaces with a countable basis, the same holds for V . Therefore, V has at most countably many connected components Vi. A countable union of countable sets is countable, and we finished proving the first part of the theorem. Finally, it remains to show that f∗λ has a density w.r.t. the k-Hausdorff measure on f (V ). By Lemma E.3, it is sufficient to show it for each (f |W )∗λ, f (W ), where W is as constructed above. First, let's show that it is also sufficient to restrict to the case where W is contained in a compact set. There exists a countable cover Ki of compact sets of Rn that cover W (e.g. by taking closed spheres of radius 1 at points with rational coordinates). Each Wi := Ki ∩ W is thus compact in W . Assume for now that we have proved that (f |Wi )∗λ has a A hi(x)dHk(x) density w.r.t. f (W ), i.e. that (f |Wi )∗λ(A) = for some measurable function hi : f (W ) → R+ ∪ {∞}. Then, R f∗λ(A) = (f |Wi )∗λ(A) Xi∈N = Xi∈N ZA hi(x)dHk(x) = ZA ( Xi∈N hi(x))dHk(x) where the last equality holds by the Fubini-Tonelli theorem as hi ≥ 0. h := i h is measurable, and we are done. P So we can now assume that W is contained in a compact set. As f is analytic, it is locally Lipschitz and is thus Lipschitz on W , as W is contained in a compact set. What's more, As f has rank k, its Jacobian matrix Jx at every point x has rank k. A standard result in linear algebra asserts that JxJ T x also has rank k and therefore the correction term JW f (x) is non- JW f (x) is therefore measurable zero for all x. Let g(x) := and non-negative. By the co-area formula, we have 1 f∗λ(A) = λ(f −1(A)) = = = 1.dλ Zf −1(A) g(x)JW f (x).dλ Zf −1(A) Zf (W ) (cid:16) Zf −1(y) g(x)dHn−k(x) (cid:17) dHk(y) = h(y)dHk(y) Zf (W ) f −1(y) g(x)dHn−k(x) is measurable and non- where h(y) := negative, yet possibly infinite. R Lemma E.7. Let A be an analytic set. There is an open U ⊆ A such that λ(A − U ) = 0. Proof. Let A = ∩iX + sets. Write X − loss of generality, assume that none of the g− j as in the definition of analytic j )−1({0}). Without j are the constant j = Xj ⊔Zj where Zj = (g− i ∩ ∩j X − 0 function. Then, U := ∩iX + i ∩ ∩jXj is clearly open and U ⊆ A. Let's now show that A − U has Lebesgue measure 0. It suffices to show that this is the case for each Zj, as they cover A − U . However, by Mityagin [46]'s result, g− j is either the 0 function or the preimage of 0 has Lebesgue measure 0. This shows that the Zj have Lebesgue measure 0, as desired. F Theorem E.8. Let f : A → Rm be PAP. Then f∗λ has a density w.r.t. an s-Hausdorff measure μ on Rm. Proof. Let f : A → Rm be PAP. A is c-analytic, so we can i∈N Ai where each Ai is analytic and (fi, Ai) write it as A = is a PAP representation for f . By Lemma E.7, for each i ∈ N, there is an open Ui ⊆ Ai such that λ(Ai − Ui) = 0. By Lemma E.5, it is thus sufficient to consider the case where fi is defined on an open set Ui. Any open V ⊆ Rn can always be i∈N Vi for a countable family of connected written as V = opens Vi. Applying this to the Ui, we have a countable family of analytic functions fi,j : Ui,j → Rm defined on connected opens Ui,j, where fi,j is the restriction of fi to Ui,j, and j ∈ N. By theorem E.2, for each (i, j) ∈ N2, there exists an l mki,j integer 0 ≤ ki,j ≤ m such that (fi,j)∗λ = , where each f ki,j : Rm → R+ ∪ {∞} is measurable, and each mki,j is the ki,j -Hausdorff measure on some ki,j-submanifold l M i,j of Rm. Therefore, l l∈N f ki,j P F l l f∗λ = (fi,j)∗λ Xi,j = = = l mki,j f ki,j l Xi,j Xl∈N X0≤k≤m X{(i,j) | ki,j =k} Xl nmk f k n X0≤k≤m Xn l mki,j f ki,j l where in the last equality we simply re-index the countable sum. We can now conclude by Lemma E.3 that f∗λ has a density w.r.t. some s-Hausdorff measure. Finally, we can prove Theorem IV.3. Proof. Let ⊢ t : realn. By Lemma IV.2, there exists an ωPAP morphism f : Ω → LRn such that f∗ΛΩ = JtK. As Ω is a coproduct, by the universal property of the coproduct, f decomposes as a family of ωPAP morphisms fi : Ri → LRn. By definition of the lifting monads, the fi represent PAP : Ai → Rn where each Ai is c-analytic. By functions fi Theorem E.8, each fi∗λ has a density w.r.t. an s-Hausdorff measure μi on Rn, i.e. fi∗λ = gi.μi for some non-negative measurable function gi : Rn → R+ ∪ {∞}. Therefore JtK = f∗ΛΩ = fi∗λ = gi.μi Xi∈N Xi∈N And we conclude that this last formula has a density w.r.t. some base measure on Rn by Lemma E.3. We proved the first point in the theorem. For the second point, let g be the density of JtK w.r.t. μ, and d H d(− ∩ f the density of JtK w.r.t. B(t). Write B(t) = M d). P By induction on d in [0, n], we show that g(x) = f (x) for all x ∈ M d, except for a H d-null set. • Base case d = 0: Let x ∈ M 0. JtK(x) = (g.μ)(x) = g(x)JtK(x) = (f.B(t))(x) = f (x) • Inductive case n ≥ d > 0. i<d M i). 2) For any H d measurable A ⊆ M d, we have: 1) For all i < d, M i is a H d-null set, and therefore it suffices to show the result for Sd := M d − ( S JtK(A) = g.μ(A) = A∩Sd f (x)H d(dx) There- JtK(A) = f.B(t)(A) = − g(x)H d(dx) are fore the integrators/measures R equal as measures on Sd, and therefore f (x) = g(x) R for all x on Sd except on a H d null set. A∩Sd g(x)H d(dx) R S d M d)c. ThenJtK(Z) = f.B(t)(Z) = 0. Let Let Z = ( d Cd where Cd is the H d-null set in Sd on which f C = and g disagree. Then JtK(C) = 0 and thus JtK(Z ∪ C) = 0. As the set of points on which f and g disagree is contained in Z ∪ C, we are done. S For the third point, by definition of base measures, B(t) = d H d(−∩M d). By the way we constructed B(t), the density ρt satisfies ρt(x) > 0 for every x in M d, except at an H d- P null set. Let A be such that B(t2)(A) = 0. Then, by the positive density ρt2 of Jt2K w.r.t. the base measure B(t2), we also have Jt2K(A) = 0. Therefore, Jt1K(A) = 0 using the assumption of absolute continuity. Finally, using the first point in Theorem IV.3, we conclude that B(t1)(A) = 0. P P i<d(M ′i ∪M i) and A := For the fourth point, this follows from general properties d H d(− ∩ M d) and of s-Hausdorff measures. Let μ1 = d H d(− ∩ M ′d) be two s-Hausdorff measure such μ2 = that μ1 ≪ μ2. As they are σ-finite measures, by the Radon- Nikodym theorem we can write μ1 = g.μ2. Let Sd := M d \ d Sd. Let B ⊆ A∩M d. We have μ1(B) = H d(B ∩ M d), as for each i < d, H i(B ∩ M i) ≤ S H i(A ∩ M d ∩ M i) = H i(∅) = 0, and for each i > d, H i(B ∩ M i) ≤ H i(M d) = 0. Likewise, μ2(B) = H d(B ∩ M ′d). As μ1(B) = g.μ2(B), we have proved that the measures H d(− ∩ M d) and g.H d(− ∩ M ′d ∩ A) are the same measures when restricted to A ∩ M d, and therefore g(x) = 1 for H d almost d A ∩ M d is measurable and all x ∈ M d ∩ A. As A = μ1(Ac) = 0, we conclude that the ωPAP morphism 1A : A → S W is a density for μ1 w.r.t. μ2. S To conclude, we prove Theorem IV.4. Proof. By a theorem of Whitney (refined by Morrey and Grauert), all (finite-dimensional, second-countable, Hausdorff, without boundary) smooth manifolds admit a (unique) analytic structure, and two smooth manifolds are diffeomorphic iff they are analytic-equivalent. Our case is even simpler, as we consider embedded submanifolds of Rn. Let M be a smooth submanifold of Rn of dimension d. There exists a tubular envelope U ⊆ Rn of M , and a smooth projection p : U → Rn such that M = p(U ). This means that p∗λ|U and H d on M are mutually absolutely continuous. By reasoning in local coordinates, using analytic charts, we see that p is locally a linear projection, and is thus analytic, and therefore PAP. Now let μ be an arbitrary s-Hausdorff measure on Rn, and {M k i }i∈N,0≤k≤n be a support for μ. Let pi,k : Ui,k → Rn be analytic projections such that i , where i ∈ N, 0 ≤ k ≤ n. Every open set p(Ui,k) = M k U ⊆ Rn is diffeomorphic to a bounded open V of radius at most 1, and the diffeomorphism and its inverse can be chosen to be analytic functions. Let φi,k : Vi,k → Ui,k be such diffeomorphisms. Let (Wi,k)i∈N,0≤k≤n be the same opens as the (Vi,k)i∈N,0≤k≤n, but translated to be disjoint, which is always possible as the (Vi,k)i∈N,0≤k≤n have radius at most 1 and there are countably many of them. Let ti,k : Wi,k → Vi,k be the associated translations, which are linear and therefore i∈N,0≤k≤n Wi,k. Then the function analytic. Let W = f : W → Rn defined by x ∈ Wi,j 7→ ti,k; φi,k; pi,k is analytic, and f∗λ and μ are mutually absolutely continuous. F
http://arxiv.org/abs/2302.10633v1
2023-02-21T12:44:59
2023-02-21T12:44:59
Generalization Bounds for Adversarial Contrastive Learning
Deep networks are well-known to be fragile to adversarial attacks, and adversarial training is one of the most popular methods used to train a robust model. To take advantage of unlabeled data, recent works have applied adversarial training to contrastive learning (Adversarial Contrastive Learning; ACL for short) and obtain promising robust performance. However, the theory of ACL is not well understood. To fill this gap, we leverage the Rademacher complexity to analyze the generalization performance of ACL, with a particular focus on linear models and multi-layer neural networks under $\ell_p$ attack ($p \ge 1$). Our theory shows that the average adversarial risk of the downstream tasks can be upper bounded by the adversarial unsupervised risk of the upstream task. The experimental results validate our theory.
[ "Xin Zou", "Weiwei Liu" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10633v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10633v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "stat.ML" ]
3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 3 3 6 0 1 . 2 0 3 2 : v i X r a Journal of Machine Learning Research 24 (2023) 1-54 Submitted 7/22; Revised 12/22; Published 2/23 Generalization Bounds for Adversarial Contrastive Learning Xin Zou School of Computer Science Wuhan University Wuhan, Hubei, China Weiwei Liu∗ School of Computer Science Wuhan University Wuhan, Hubei, China Editor: Joan Bruna [email protected] [email protected] Abstract Deep networks are well-known to be fragile to adversarial attacks, and adversarial training is one of the most popular methods used to train a robust model. To take advantage of unlabeled data, recent works have applied adversarial training to contrastive learning (Adversarial Contrastive Learning; ACL for short) and obtain promising robust performance. However, the theory of ACL is not well understood. To fill this gap, we leverage the Rademacher complexity to analyze the generalization performance of ACL, with a particular focus on linear models and multi-layer neural networks under (cid:96)p attack (p ≥ 1). Our theory shows that the average adversarial risk of the downstream tasks can be upper bounded by the adversarial unsupervised risk of the upstream task. The experimental results validate our theory. Keywords: Robustness, Adversarial learning, Contrastive learning, Rademacher complex- ity, Generalization bound. 1 Introduction Deep neural networks (DNNs) have achieved state-of-the-art performance in many fields. However, several prior works (Szegedy et al., 2014; Goodfellow et al., 2015) have shown that DNNs may be vulnerable to imperceptibly changed adversarial examples, which causes a lot of focus on the robustness of the models (Madry et al., 2018; Mao et al., 2020; Li et al., 2022). One of the most popular approaches to achieving adversarial robustness is adversarial training, which involves training the model with samples perturbed to maximize the loss on the target model (Goodfellow et al., 2015; Madry et al., 2018; Zhang et al., 2019). Schmidt et al. (2018) show that adversarial robust generalization requires a larger amount of data, while Yin et al. (2019); Awasthi et al. (2020) show that the Rademacher Complexity of adversarial training is strictly larger in theory than that of natural training, which implies that we need more data for adversarial training. ∗. Corresponding Author. ©2023 Xin Zou and Weiwei Liu. License: CC-BY 4.0, see https://creativecommons.org/licenses/by/4.0/. Attribution requirements are provided at http://jmlr.org/papers/v24/22-0866.html. Zou and Liu Since the labeled data is limited and expensive to obtain, one option would be to use large-scale unlabeled data and apply self-supervised learning (Gidaris et al., 2018; Noroozi and Favaro, 2016), an approach that trains the model on unlabeled data in a supervised manner by utilizing self-generated labels from the data itself. Contrastive Learning (CL) (Chen et al., 2020; He et al., 2020), which aims to maximize the feature similarity of similar pairs and minimize the feature similarity of dissimilar ones, is a popular self-supervised learning technique. Recently, Kim et al. (2020); Ho and Vasconcelos (2020); Jiang et al. (2020) apply adversarial training in CL and achieve state-of-the-art model robustness. They find that if adversarial training is conducted on the upstream contrastive task, the trained model will be robust on the downstream supervised task. However, their results are all empirical and lack theoretical analysis. To fill this gap, we here present a theoretical analysis of adversarial contrastive learning through the lens of Rademacher complexity, with a particular focus on linear models and multi-layer neural networks. Our theoretical results show that the average adversarial risk of the downstream tasks can be upper bounded by the adversarial unsupervised risk of the upstream task; this implies that if we train a robust feature extractor on the upstream task, we can obtain a model that is robust on downstream tasks. The remainder of this article is structured as follows: §2 introduces some related works in this field. §3 provides some basic definitions and settings that will be used in the following sections. §4 presents our first part's main results, which show a connection between the robust risk for the upstream task and the robust risk for the downstream tasks. §5 shows our second part's results, it outlines our bounds for linear models and multi-layer neural networks by bounding the Rademacher complexity of each hypothesis class. §6 shows some experimental results that verify our theory; finally, the conclusions are presented in the last section. 2 Related Work Adversarial Robustness. Szegedy et al. (2014) show that DNNs are fragile to impercep- tible distortions in the input space. Subsequently, Goodfellow et al. (2015) propose the fast gradient sign method (FGSM), which perturbs a target sample towards its gradient direction to increase the loss and then uses the generated sample to train the model in order to improve the robustness. Following this line of research, Madry et al. (2018); Moosavi-Dezfooli et al. (2016); Kurakin et al. (2017); Carlini and Wagner (2017) propose iterative variants of the gradient attack with improved adversarial learning frameworks. Besides, Ma et al. (2022) analyze the trade-off between robustness and fairness, Li and Liu (2023) study the worst-class adversarial robustness in adversarial training. For the theoretical perspective, Montasser et al. (2019) study the PAC learnability of adversarial robust learning, Xu and Liu (2022) extend the work of Montasser et al. (2019) to multiclass case and Yin et al. (2019); Awasthi et al. (2020) give theoretical analysises to adversarial training by standard uniform convergence argumentation and giving a bound of the Rademacher complexity. Our work is quite different from Yin et al. (2019); Awasthi et al. (2020), firstly, they just analyze the linear models and two-layer neural networks, but we consider linear models and multi-layer deep neural networks; secondly, they consider the classification loss, which is much easier to analyze than our contrastive loss. 2 Generalization Bounds for Adversarial Contrastive Learning Contrastive Learning. Contrastive Learning is a popular self-supervised learning paradigm that attempts to learn a good feature representation by minimizing the feature distance of similar pairs and maximizing the feature distance of dissimilar pairs (Chen et al., 2020; Wang and Liu, 2022). SimCLR (Chen et al., 2020) learns representations by maximizing the agreement between differently augmented views of the same data, while MoCo (He et al., 2020) builds large and consistent dictionaries for unsupervised learning with a contrastive loss. From the theoretical perspective, Saunshi et al. (2019) first presents a framework to analyze CL. We generalize their framework to the adversarial CL. The key challenging issues in this work are how to define and rigorously analyze the adversarial CL losses. Moreover, we further analyze the Rademacher complexity of linear models and multi-layer deep neural networks composited with a complex adversarial contrastive loss. Neyshabur et al. (2015) show an upper bound of the Rademacher complexity for neural networks under group norm regularization. In fact, the Frobenius norm and the (cid:96)1,∞-norm in our theoretical analysis are also group norms, while the settings and proof techniques between Neyshabur et al. (2015) and our work are quite different: (1) they consider the standard setting while we consider a more difficult adversarial setting; (2) they consider the Rademacher complexity of neural networks with size 1 output layer, while we consider the case that the neural network is composited with a complex contrastive learning loss; (3) they prove their results by reduction with respect to the number of the layers, while motivated by the technique of Gao and Wang (2021), we use the covering number of the neural network to upper bound the Rademacher complexity in the adversarial case. Adversarial Contrastive Learning. Several recent works (Kim et al., 2020; Ho and Vasconcelos, 2020; Jiang et al., 2020) apply adversarial training in the contrastive pre- training stage to improve the robustness of the models on the downstream tasks, achieving good robust performance in their experiments. Our work attempts to provide a theoretical explanation as to why models robustly trained on the upstream task can be robust on downstream tasks. 3 Problem Setup We introduce the problem setups in this section. 3.1 Basic Contrastive Learning Settings We first set up some notations and describe the contrastive learning framework. Let X ∈ Rm be the domain of all possible data points, this paper assumes that X is bounded. Contrastive learning assumes that we get the similar data in the form of pairs (x, x+), which is drawn from a distribution Dsim on X 2, and k independent and identically distributed (i.i.d.) negative samples x− k drawn from a distribution Dneg on X . Given the training set S = {(xi, x+ i=1, we aim to learn a representation f from F that maps similar pairs (x, x+) into similar points (f (x), f (x+)), while at the same time keeping f (x− k ) away from f (x), where F is a class of representation functions f : X → Rn. 1 , x− i1, . . . , x− 2 , . . . , x− ik)}M i ), * * * , f (x− i , x− Latent Classes. Let C denote the set of all latent classes (Saunshi et al., 2019) that are all possible classes for points in X ; for each class c ∈ C , moreover, the probability Dc 3 Zou and Liu over X captures the probability that a point belongs to class c. The distribution on C is denoted by ρ. To formalize the similarity among data in X , assume we obtain i.i.d. similar data points x, x+ from the same distribution Dc, where c is randomly selected according to the distribution ρ on latent classes C. We can then define Dsim and Dneg as follows: Definition 1 (Dsim and Dneg, Saunshi et al., 2019) For unsupervised tasks, we define the distribution of sampling similar samples Dsim(x, x+) and negative sample Dneg(x−) as follows: Dsim(x, x+) = E c∼ρ Dc(x)Dc(x+), Dneg(x−) = E c∼ρ Dc(x−). Supervised Tasks. For supervised tasks, we focus on the tasks in which a representation function f will be tested on a (k + 1)-way supervised task T consisting of distinct classes {c1, c2, . . . , ck+1} ⊆ C, while the labeled data set of task T consists of M i.i.d. examples drawn according to the following process: A label c ∈ {c1, . . . , ck+1} is selected according to a distribution DT , and a sample x is drawn from Dc. The distribution of the labeled pair (x, c) is defined as: DT (x, c) = DT (c)Dc(x). 3.2 Evaluation Metric for Representations We evaluate the quality of a representation function f with reference to its performance on a multi-class classification task T using a linear classifier. Consider a task T = {c1, . . . , ck+1}. A multi-class classifier for T is a function g : X −→ Rk+1, the output coordinates of which are indexed by the classes c in task T . Let {g(x)y − g(x)y(cid:48)}y(cid:48)(cid:54)=y be a k-dimensional vector of differences in the coordinates of the output of the classifier g. The loss function of g on a point (x, y) ∈ X × T is defined as (cid:96)({g(x)y − g(x)y(cid:48)}y(cid:48)(cid:54)=y). For example, one often considers the standard hinge loss (cid:96)(v) = max{0, 1 + maxi{−vi}} and the logistic loss (cid:96)(v) = log2(1 + (cid:80) i exp(−vi)) for v ∈ Rk. The supervised risk of classifier g is defined as follows: Lsup(T , g) := (cid:16) (cid:104) (cid:96) E (x,c)∼DT {g(x)c − g(x)c(cid:48)}c(cid:48)(cid:54)=c (cid:17)(cid:105) . The risk Lsup(T , g) of classifier g on task T measures the quality of the outputs of g, take the hinge loss as an example, our goal is to get a classifier that has much higher confidence for the true class (i.e., the value g(x)c) than others (i.e., the values g(x)c(cid:48) for c(cid:48) (cid:54)= c), so we want all the differences g(x)c − g(x)c(cid:48) for c (cid:54)= c(cid:48) to be as large as possible. If (cid:54)= c, of course, (cid:96) on (x, c) is not smaller than 1; g wrongly classifies x, i.e., arg max g(x)c(cid:48) however, even thought g correctly classifies x, the loss value can not decrease to zero unless g(x)c − g(x)c(cid:48) ≥ 1 for all c(cid:48) (cid:54)= c. Let {ci}k+1 i=1 = {c1, . . . , ck+1} be a set of classes from C. Given the matrix W ∈ R(k+1)×n, we have g(x) = W f (x) as a classifier that composite the feature extractor g and linear classifier W . The supervised risk of f is defined as the risk of g when the best W is chosen: c(cid:48) Lsup(T , f ) := inf W ∈R(k+1)×n Lsup(T , W f ). 4 Generalization Bounds for Adversarial Contrastive Learning When training a feature extractor f on the upstream task, we do not make predictions on the examples, so we can't define the risk of the feature extractor f as we do for the classifier g. Our goal on the upstream task is to train a feature extractor that can perform well on the downstream tasks, so we consider the potential of the feature extractor here, i.e., the minimal possible classification risk of a linear classifier on the feature extracted by f . So we define the risk of the feature extractor f as above by taking the infimum over all linear classifiers. Definition 2 (Mean Classifier, Saunshi et al., 2019) For a function f and task T = {c1, . . . , ck+1}, the mean classifier is W μ, whose cth row is the mean μc := E [f (x)] and x∼Dc we define Lμ sup(T , f ) := Lsup(T , W μf ). Since Lsup(T , f ) involves taking infimum over all possible linear classifiers, it is difficult to analyze Lsup(T , f ) and establish connections between the risk of the unsupervised upstream task and Lsup(T , f ). We introduce the mean classifier to bridge them by bounding average Lμ sup(T , f ) over the tasks with the risk of the unsupervised upstream risk (for more details, please refer to §4). Definition 3 (Average Supervised Risk) The average supervised risk for a function f on (k + 1)-way tasks is defined as: Lsup(f ) := E {ci}k+1 i=1 ∼ρk+1 [Lsup({ci}k+1 i=1 , f )|ci (cid:54)= cj] Given the mean classifier, the average supervised risk for a function f is defined as follows: Lμ sup(f ) := E {ci}k+1 i=1 ∼ρk+1 [Lμ sup({ci}k+1 i=1 , f )|ci (cid:54)= cj]. In contrastive learning, the feature extractor is trained as a pretrained model to be used on downstream tasks. There may be many different downstream tasks such as binary classification tasks with classes {c1, c2} ⊆ C and many other multi-class classification tasks, so here we consider the average error of Lμ sup(T , f ) over all possible tasks T sampled from ρk+1 as the final performance measure of a feature extractor f . 3.3 Contrastive Learning Algorithm We denote k as the number of negative samples used for training and (x, x+) ∼ Dsim, (x− 1 , . . . , x− k)∼Dk neg. Definition 4 (Unsupervised Risk) The unsupervised risk is defined as follows: Lun(f ) := E[(cid:96)({f (x)T (f (x+) − f (x− i ))}k i=1)]. (cid:110) Given M samples j1, . . . , x− jk) of unsupervised risk is defined as follows: (xj, x+ j , x− (cid:111)M j=1 from Dsim × Dk neg, the empirical counterpart (cid:98)Lun(f ) := 1 M M (cid:88) j=1 (cid:96)({f (xj)T (f (x+ j ) − f (x− ji))}k i=1). 5 Zou and Liu In the contrastive learning upstream task, we want to learn a feature extractor f such that f maps examples from the same class to similar features and makes the features of examples from different classes far away from each other. So for the examples (x, x+, x− k ), we want f (x)T f (x+) to be as large as possible while f (x)T f (x− i ), i = 1, . . . , k to be as small as possible. The loss (cid:96) we defined before elegantly captures the aim of contrastive learning, if we set vi = f (x)T f (x+) − f (x)T f (x− i=1) will yield large f (x)T f (x+) and small f (x)T f (x− i ), i = 1, . . . , k. So optimizing over Lun(f ) can reach our goal for contrastive learning. i ), minimizing (cid:96)({f (x)T (f (x+) − f (x− 1 , . . . , x− i ))}k Following Saunshi et al. (2019), the unsupervised risk can be described by the following equation: Lun(f ) = E i ∼ρk+1 c+,c− x,x+∼D2 E c+ ,x− i ∼D [(cid:96)({f (x)T (f (x+) − f (x− i ))}k i=1)]. c− i The Empirical Risk Minimization (ERM) algorithm is used to find a function (cid:98)fERM ∈ (cid:98)Lun(f ) that minimizes the empirical unsupervised risk. The function (cid:98)fERM can be arg min f ∈F subsequently used for supervised linear classification tasks. 3.4 Adversarial Setup A key question in adversarial contrastive learning is that of how to define the adversary sample in contrastive learning. From a representation perspective, one can find a point (cid:101)x that is close to x and keeps the feature f ((cid:101)x) both as far from f (x+) as possible and as close to the feature of some negative sample f (x−) as possible. Inspired by this intuition, we define the Contrastive Adversary Sample as follows: Definition 5 (U-Contrastive Adversary Sample) Given a neighborhood U(x) of x, x+ ∼ Dc+, x− for i = 1, . . . , k, we define the U-Contrastive Adversary Sample of x as fol- lows: i ∼ Dc− i (cid:101)x := arg sup x(cid:48)∈U (x) E x+∼Dc+ ,x− i ∼D c− i [(cid:96)({f (x(cid:48))T (f (x+) − f (x− i ))}k i=1)]. In this article, we suppose that the loss function (cid:96) is convex. By the subadditivity of sup, we have, ∀f ∈ F: E x+∼Dc+ x− i ∼D c− i sup x(cid:48)∈U (x) [(cid:96)({f (x(cid:48))T(f (x+)−f (x− i ))}k i=1)] ≤ E (cid:96)({f (x(cid:48))T(f (x+)−f (x− i ))}k i=1)]. [ sup x(cid:48)∈U (x) x+∼Dc+ x− i ∼D c− i (1) In the following sections, we analyze the theoretical properties of the right-hand side of (1), which can be easily optimized in practice by Adversarial Empirical Risk Minimization (AERM). The U-Adversarial Unsupervised Risk and its surrogate risk can be defined as below. Definition 6 (U-Adversarial Unsupervised Risk) Given a neighborhood U(x) of x, the U-Adversarial Unsupervised Risk of a presentation function f is defined as follows: (cid:101)Lun(f ) := E c+,c− i ∼ρk+1 E x∼Dc+ [ sup x(cid:48)∈U (x) E x+∼Dc+ x− i ∼D c− i [(cid:96)({f (x(cid:48))T (f (x+) − f (x− i ))}k i=1)]]. (2) 6 Generalization Bounds for Adversarial Contrastive Learning Moreover, the surrogate risk of (2) is as follows: (cid:101)Lsun(f ) = E c+,c− i ∼ρk+1 E x,x+∼D2 x− i ∼D c− i c+ sup x(cid:48)∈U (x) (cid:96)({f (x(cid:48))T (f (x+) − f (x− i ))}k i=1). By (1), we have (cid:101)Lun(f ) ≤ (cid:101)Lsun(f ) for any f ∈ F. The Adversarial Supervised Risk of a classifier g for a task T is defined as follows: (cid:101)Lsup(T , g) := E (x,c)∼DT [ sup x(cid:48)∈U (x) (cid:96)({g(x)c − g(x)c(cid:48)}c(cid:48)(cid:54)=c)]. The Adversarial Supervised Risk of a representation function f for a task T is defined as follows: (cid:101)Lsup(T , f ) := inf W ∈R(k+1)×n (cid:101)Lsup(T , W f ). (3) For the mean classifier, we define: sup(T , f ) := (cid:101)Lsup(T , W μf ) (cid:101)Lμ The Average Adversarial Supervised Risk for a representation function is as defined below. Definition 7 (Average U-Adversarial Supervised Risk) (cid:101)Lsup(f ) := E {ci}k+1 i=1 ∼ρk+1 [(cid:101)Lsup({ci}k+1 i=1 , f )|ci (cid:54)= cj]. For the mean classifier, we have the following: (cid:101)Lμ sup(f ) := E {ci}k+1 i=1 ∼ρk+1 [(cid:101)Lμ sup({ci}k+1 i=1 , f )|ci (cid:54)= cj]. 4 Theoretical Analysis for Adversarial Contrastive Learning This section presents some theoretical results for adversarial contrastive learning. 4.1 One Negative Sample Case Let τ = P c,c(cid:48)∼ρ2 [c = c(cid:48)], σ be an M -dimensional Rademacher random vector with i.i.d. en- tries, define (gf )|S = (gf (z1), . . . , gf (zM )) and RS(G) := E σ∼{±1}M G := {gf (x, x+, x− 1 , . . . , x− k ) = sup (cid:96) (cid:0){f (x(cid:48))T (f (x+) − f (x− i ))}k i=1 x(cid:48)∈U (x) (cid:34) sup f ∈F (cid:10)σ, (gf )|S (cid:1) |f ∈ F}, (cid:35) (cid:11) where let (cid:98)f ∈ arg min f ∈F (cid:98)(cid:101)Lsun(f ) where (cid:98)(cid:101)Lsun(f ) is the empirical counterpart of (cid:101)Lsun(f ), we have: 7 Zou and Liu Theorem 8 (The proof can be found in the Appendix A.1) Let (cid:96) : Rk −→ R be bounded by B. Then, for any δ ∈ (0, 1),with a probability of at least 1 − δ over the choice of the training set S = {(xj, x+ j , x− j )}M (cid:101)Lsup( (cid:98)f ) ≤ (cid:101)Lμ ((cid:101)Lsun(f ) − τ (cid:96)(0)) + j=1, for any f ∈ F: 1 1 − τ sup( (cid:98)f ) ≤ 1 1 − τ AGM , where AGM = O( RS(G) M + B (cid:115) log 1 δ M ). (4) Remark 9 Theorem 8 shows that when the hypothesis class F is rich enough to contain some f with low surrogate adversarial unsupervised risk, the empirical minimizer of the surrogate adversarial unsupervised risk will then obtain good robustness on the supervised downstream task. 1 Note that we can take f = (cid:98)f in the upper bound of Theorem 8 and get a bound (cid:101)Lsup( (cid:98)f ) ≤ 1−τ ((cid:101)Lsun( (cid:98)f ) − τ (cid:96)(0)) + 1 1−τ AGM . Then we can see that if the output of AERM (i.e., (cid:98)f ) achieves small unsupervised adversarial risk, then (cid:98)f is a robust feature extractor such that it can achieve good robustness after fine-tuning on the downstream tasks. Theorem 8 gives a relationship between the robustness of the contrastive (upstream) task and the robustness of the downstream classification tasks and explains why adversarial contrastive learning can help improve the robustness of the downstream task, as shown empirically in Kim et al. (2020); Ho and Vasconcelos (2020); Jiang et al. (2020). 4.2 Blocks of Similar Points Saunshi et al. (2019) show a refined method that operates by using blocks of similar data and determine that the method achieves promising performance both theoretically and empirically. We adapt this method to adversarial contrastive learning. 1 , . . . , x+ b from c+ ∼ ρ and b negative i.i.d. samples from c− ∼ ρ. The block adversarial contrastive learning risk is as follows: Specifically, we sample (b + 1) i.i.d. similar samples x, x+ (cid:101)Lblock sun (f ) := E (cid:34) (cid:32) (cid:96) sup x(cid:48)∈U (x) f (x(cid:48))T (cid:32) (cid:80)b i=1 f (x+ i ) b − (cid:80)b i=1 f (x− i ) b (cid:33)(cid:33)(cid:35) , and its empirical counterpart is as follows: block sun (f ) := (cid:98)(cid:101)L 1 M (cid:34) M (cid:88) i=1 (cid:96) sup x(cid:48)∈U (xi) (cid:32) f (x(cid:48))T (cid:32) (cid:80)b j=1 f (x+ ij) b (cid:80)b j=1 f (x− ij) b − (cid:33)(cid:33)(cid:35) , Theorem 10 (The proof can be found in the Appendix A.2) For any f ∈ F, we have: (cid:101)Lsup(f ) ≤ 1 1 − τ (cid:16) (cid:17) sun (f ) − τ (cid:96)(0) (cid:101)Lblock ≤ (cid:16) 1 1 − τ (cid:101)Lsun(f ) − τ (cid:96)(0) (cid:17) . Remark 11 Theorem 10 shows that using blocks of similar data yields a tighter upper bound for the adversarial supervised risk than in the case for pairs of similar data. Theorem 10 implies that using the blocks in adversarial contrastive learning may improve the robust performance of the downstream tasks; this will be verified by the empirical results in §6. 8 Generalization Bounds for Adversarial Contrastive Learning 4.3 Multiple Negative Sample Case This subsection extends our results to k negative samples. To achieve this, more definitions are required. Let [k] denote the set {1, 2, . . . , k}. Definition 12 We define a distribution D over the supervised tasks as follows: First, sample k + 1 classes (allow repetition) c+, c− k ∼ ρk+1, conditioned on the event that c− i (cid:54)= c+, ∀i ∈ [k]. Then, set the task T as the set of distinct classes in {c+, c− 1 , . . . , c− 1 , . . . , c− k }. Definition 13 The Average U-Adversarial Supervised Risk of a representation function f ∈ F over D is defined as follows: (cid:101)Lsup(f ) := E T ∼D (cid:105) (cid:104) (cid:101)Lsup(T , f ) . Let Edistinct be the event such that {c+, c− 1 , . . . , c− k } is distinct and p = P 1 ,...,c− k )∼D (c+,c− For any f ∈ F, we have (The proof can be found in the Appendix A.3): (cid:101)Lsup(f ) ≤ (cid:101)Lsup(f ) p . [Edistinct]. (5) From (5), we can turn to analyze the relation between (cid:101)Lsup(f ) and (cid:101)Lsun(f ) in the multiple negative sample case. Our Theorem 16 handles (cid:101)Lsup(f ) instead of (cid:101)Lsup(f ). Assumption 14 Assume that ∀I1, I2 ⊆ [d] such that I1 ∪ I2 = [d], (cid:96) satisfies the following inequations: (cid:96)({vi}i∈I1) ≤ (cid:96)({vi}i∈[d]) ≤ (cid:96)({vi}i∈I1) + (cid:96)({vi}i∈I2), (cid:96)({vi}i∈I2) ≤ (cid:96)({vi}i∈[d]) ≤ (cid:96)({vi}i∈I1) + (cid:96)({vi}i∈I2). (6) (7) Proposition 15 (The proof can be found in the Appendix A.4) The hinge loss and the logistic loss satisfy Assumption 14. If C is finite, we obtain a simple (and informal) bound of (cid:101)Lsup( (cid:98)f ), for the more complex case that allows infinite C and the formal form of Theorem 16 (Theorem 32), please refer to the Appendix A.5. Theorem 16 (The proof can be found in the Appendix A.6) Suppose C is finite, for any c ∈ C, ρ(c) > 0, and (cid:96) satisfies Assumption 14. Then, with a probability of at least 1 − δ over the choice of the training set S, ∀f ∈ F: (cid:101)Lsup( (cid:98)f ) ≤ α(ρ) (cid:16) (cid:101)Lsun(f ) + AGM (cid:17) − β. 9 Zou and Liu 5 Generalization Bounds for Example Hypothesis Classes This section presents a concrete analysis of the Rademacher complexity for linear hypothesis class and multi-layer neural networks based on covering number (Wainwright, 2019, Definition 5.1). We first introduce some definitions and required lemmas. Lemma 17 (Wainwright, 2019, Lemma 5.7, volume ratios and metric entropy) Consider a pair of norms (cid:107) * (cid:107) and (cid:107) * (cid:107)(cid:48) on Rd, and let B and B(cid:48) be their corresponding unit balls (i.e. B = {θ ∈ Rd|(cid:107)θ(cid:107) ≤ 1}, with B(cid:48) similarly defined). The δ-covering number of B in the (cid:107) * (cid:107)(cid:48)-norm then obeys the following bounds (Wainwright, 2019, Lemma 5.7): (cid:18) 1 δ (cid:19)d vol(B) vol(B(cid:48)) ≤ N (δ; B, (cid:107) * (cid:107)(cid:48)) ≤ B + B(cid:48)) vol( 2 δ vol(B(cid:48)) , where we define the Minkowski sum A + B := {a + b : a ∈ A, b ∈ B}, vol(B) := (cid:82) 1{x ∈ B}dx is the volume of B based on the Lebesgue measure, and N (δ; B, (cid:107) * (cid:107)(cid:48)) is the δ-covering number of B with respect to the norm (cid:107) * (cid:107)(cid:48). Lemma 18 (The proof can be found in the Appendix A.7) Let Bp(r) be the p-norm ball in Rd with radius r. The δ-covering number of Bp(r) with respect to (cid:107) * (cid:107)p thus obeys the following bound: N (δ; Bp(r), (cid:107) * (cid:107)p) ≤ 1 + (cid:18) (cid:19)d . 2r δ Definition 19 (Wainwright, 2019, Definition 5.16, sub-Gaussian process) A collec- tion of zero-mean random variables {Xθ, θ ∈ T} is a sub-Gaussian process with respect to a metric ρX on T if: E[eλ(Xθ−X (cid:101)θ)] ≤ e λ2ρ2 X (θ,(cid:101)θ) 2 , ∀θ, (cid:101)θ ∈ T, λ ∈ R. It is easy to prove that the Rademacher process (Wainwright, 2019, §5.2) satisfies the condition in Definition 19 with respect to the (cid:96)2-norm. Lemma 20 (Wainwright, 2019, the Dudley's entropy integral bound) Let {Xθ, θ ∈ T} be a zero-mean sub-Gaussian process with respect to the induced pseudometric ρX from Definition 19. Then, for any δ ∈ [0, D], we have: (cid:34) E sup θ,(cid:101)θ∈T (Xθ − X (cid:35) (cid:101)θ)   ≤ 2E   sup γ,γ(cid:48)∈T ρX (γ,γ(cid:48))≤δ (Xγ − Xγ(cid:48))   + 32J (δ/4; D). (8) Here, D = supθ,(cid:101)θ∈T ρX (θ, (cid:101)θ) and J (a; b) = (cid:82) b u-covering number of T in the ρX -metric. a (cid:112)lnNX (u; T)du, where NX (u; T) is the Remark 21 Given θ0 ∈ T, since E [Xθ0] := E [(cid:104)θ0, σ(cid:105)] = 0, we have: (cid:20) E Xθ sup θ∈T (cid:21) = E (cid:20) sup θ∈T (cid:21) (Xθ − Xθ0) (cid:34) ≤ E 10 sup θ,(cid:101)θ∈T (Xθ − X . (9) (cid:35) (cid:101)θ) Generalization Bounds for Adversarial Contrastive Learning Combining (8) with (9), we have: E (cid:20) (cid:21) Xθ sup θ∈T ≤ 2E    sup γ,γ(cid:48)∈T ρX (γ,γ(cid:48))≤δ  (Xγ − Xγ(cid:48))   + 32J (δ/4; D), which can be used to draw the upper bound of RS(G) by establishing a connection between the Rademacher process and the Rademacher complexity of the hypothesis classes when proper norm is chosen. For more details, please refer to the Appendix, details are in the proof of Theorem 22, Theorem 24 and Theorem 26. To make Theorem 8 and Theorem 16 concrete, we need to upper bound RS(G). Assume that loss (cid:96) is a non-increasing function; for example, hinge loss and logistic loss satisfy this (cid:96) (cid:0)f (x(cid:48))T (f (x+) − f (x−))(cid:1) |f ∈ F}. Since (cid:96) is assumption. Let G = {gf (x, x+, x−) = sup x(cid:48)∈U (x) non-increasing, we have: (cid:26) (cid:18) G = (cid:96) min x(cid:48)∈U (x) (cid:0)f (x(cid:48))T (cid:0)f (x+) − f (x−)(cid:1)(cid:1) (cid:19) (cid:27) |f ∈ F . Let H = (cid:26) min x(cid:48)∈U (x) (cid:0)f (x(cid:48))T (f (x+) − f (x−))(cid:1) |f ∈ F (cid:27) . Suppose (cid:96) is η-Lipschitz. By the Ledoux-Talagrand contraction inequality (Ledoux and Talagrand, 2013), we have: RS(G) ≤ ηRS(H). (10) Thus, we only need to upper bound RS(H). Let (cid:107)A(cid:107)a,b be the (cid:96)b-norm of the (cid:96)a-norm i=1. Let X be a matrix It is easy to see that of the rows of A. Consider the training set S = {(xi, x+ i )}M whose ith row is xi. We define X + and X − in a similar way. ∀p ≥ 1, ∀i = 1, . . . , M , (cid:107)xi(cid:107)p ≤ (cid:107)X(cid:107)p,∞. i , x− 5.1 Linear Hypothesis Class Let F = {f : x −→ W x|W ∈ Rn×m, |||W |||p ≤ w}. To simplify notations, ∀p ≥ 1 and 1 let p + 1 p∗ = 1, P = max(cid:8)(cid:107)X(cid:107)p,∞, (cid:107)X +(cid:107)p,∞, (cid:107)X −(cid:107)p,∞ (cid:9) , P ∗ = max(cid:8)(cid:107)X(cid:107)p∗,∞, (cid:107)X +(cid:107)p∗,∞, (cid:107)X −(cid:107)p∗,∞ (cid:9) . (11) We then have ∀p ≥ 1, ∀i = 1, . . . , M , (cid:107)xi(cid:107)p, (cid:107)x+ i (cid:107)p, (cid:107)x− i (cid:107)p ≤ P. We now present the upper bound of RS(H) under (cid:107) * (cid:107)r attack. Theorem 22 (RS(H) under (cid:107) * (cid:107)r attack for linear models) Consider the (cid:96)r attack, i.e. let U(x) = {x(cid:48)|(cid:107)x(cid:48) − x(cid:107)r ≤ (cid:15)}. We then have: RS(H) = O (cid:16) [P P ∗ + (cid:15)R∗s(r∗, p, m)] (cid:104) ms(p∗, p, m)w2 √ (cid:105)(cid:17) , M where s(p, q, n) := n (11). max (cid:110) 1 p − 1 q , 1 q − 1 p (cid:111) , 1 p + 1 p∗ = 1, 1 r + 1 r∗ = 1, and R∗ is defined similarly to 11 Zou and Liu The proof can be found in the Appendix A.8. Remark 23 Combining Theorem 22 with (4), we have: AGM = O   [P P ∗ + (cid:15)R∗s(r∗, p, m)] mηs(p∗, p, m)w2 + B √ M (cid:113) log 1 δ   . (12) 5.2 Multi-layer Neural Network In this section, we analyze fully connected multi-layer neural networks. Suppose that X ⊆ Rm. Let F = {Wdσ(Wd−1σ(* * * σ(W1x))) | |||Wl||| ≤ Ml, l = 1, . . . , d}, where |||*||| is the norm of the matrix and σ(*) is an elementwise L-Lipschitz function with σ(0) = 0 and Wl ∈ Rhl×hl−1, where hd = n, h0 = m. Assume (cid:96) is η-Lipschitz and non- increasing. From (10), we need only to bound the Rademacher complexity of H. We here consider two cases of the matrix norm |||*|||. Let U(x) = {x(cid:48)|(cid:107)x(cid:48) − x(cid:107)p ≤ (cid:15)} for some p ≥ 1. 5.2.1 Frobenius-norm Case. We first consider using the Frobenius-Norm in the definition of the multi-layer neural networks hypothesis class F. Theorem 24 (RS(H) under (cid:107) * (cid:107)p attack for NNs under |||*|||F constraint) Let U(x) = {x(cid:48)|(cid:107)x(cid:48) − x(cid:107)p ≤ (cid:15)} (i.e. consider the (cid:96)p attack), σ(0) = 0 with Lipschitz constant L and let F = (cid:8)Wdσ(Wd−1σ(* * * σ(W1x)))(cid:12) l , l = 1, . . . , d(cid:9). We then have: (cid:12)|||Wl|||F ≤ M F RS(H) = O   (cid:118) (cid:117) (cid:117) (cid:116) √ √ d  M  , hlhl−1K d (cid:88) l=1 (13) where where BF X,(cid:15) = Ld−1 M F l max (cid:110) 1, m d (cid:89) l=1 K = 2BF X,(cid:15) * (cid:0)BF X + + BF X − (cid:1) , 1 2 − 1 p (cid:111) ((cid:107)X(cid:107)p,∞ +(cid:15)) , BF X = Ld−1 M F l max (cid:110) 1, m d (cid:89) l=1 1 2 − 1 p (cid:111) (cid:107)X(cid:107)p,∞. The proof can be found in the Appendix A.9. Remark 25 Combining Theorem 24 with (4), we have:  (cid:115) AGM = O Kη (cid:115)   . log 1 δ M + B d (cid:80)d l=1 hlhl−1 M 12 Generalization Bounds for Adversarial Contrastive Learning 5.2.2 (cid:96)1,∞-norm Case We consider the (cid:107) * (cid:107)1,∞ norm constraint. Theorem 26 (RS(H) under (cid:107) * (cid:107)p attack for NNs under (cid:107) * (cid:107)1,∞ constraint) Let U(x) = {x(cid:48)|(cid:107)x(cid:48) − x(cid:107)p ≤ (cid:15)} (i.e. consider the (cid:96)p attack), σ(0) = 0 with Lipschitz constant L; moreover, let F = (cid:110) Wdσ(Wd−1σ(* * *σ(W1x)))(cid:12) (cid:12)(cid:107)Wl(cid:107)1,∞≤M 1,∞ (cid:111) , l=1, . . . ,d . We then have: l RS(H) = O   (cid:118) (cid:117) (cid:117) (cid:116) d (cid:88) l=1 hlhl−1 (cid:112) dK0K1 √  M  , where where K0 = 2B1,∞ X,(cid:15) * (cid:0)B(cid:48) X + + B(cid:48) X − (cid:1) , K1 = K0 2 (cid:16) + B(cid:48) X,(cid:15) * X + + B1,∞ B1,∞ X − (cid:17) , B(cid:48) X,(cid:15) = Ld−1 B1,∞ X,(cid:15) = Ld−1 d (cid:89) l=1 d (cid:89) l=1 hlM 1,∞ l m1− 1 p ((cid:107)X(cid:107)p,∞ + (cid:15)) , B(cid:48) X = Ld−1 d (cid:89) l=1 hlM 1,∞ l m1− 1 p (cid:107)X(cid:107)p,∞, M 1,∞ l ((cid:107)X(cid:107)p,∞ + (cid:15)) , B1,∞ X = Ld−1 d (cid:89) l=1 M 1,∞ l (cid:107)X(cid:107)p,∞. The proof can be found in the Appendix A.10. Remark 27 Combining Theorem 26 with (4), we have:  (cid:115) AGM = O η dK0K1 (cid:80)d l=1 hlhl−1 M + B (cid:115)   . log 1 δ M Remark 28 Our bound has important implications for the design of regularizers for adver- sarial contrastive learning. To achieve superior robust performance on the downstream tasks, the usual approach is to make (cid:107)X(cid:107)p,∞ small. For example, Pytorch scales the images to tensors with entries within the range [0, 1]. Moreover, Theorem 24 shows that we can take the norms of the layers as the regularizers to reduce the adversarial supervised risk. In our analysis for the Rademacher complexity, we consider models with norm-constrained weights, which means that the hypothesis class is uniformly Lipschitz, although the Lipschitz constant may be large (the product of maximal weight norms for the layers). One may wonder what will happen if we remove the constrains on the norm of the weights. For simplicity, let's consider a hypothesis class H ⊆ {±1}X for binary classification, we have: (cid:34) RS(H) = E σσσ sup h∈H (cid:35) σih(xi) , 1 n n (cid:88) i=1 where σ1, . . . , σn ∈ {±1} are i.i.d. uniform random variables. We can regard σ1, . . . , σn as random labels that we need to fit by hypothesis from H, so we can interpret RS(H) as the 13 Zou and Liu Attack PGD FGSM (cid:15) 0.01 0.02 0.01 0.02 Type Clean Adv Clean Adv Clean Adv Clean Adv 0 75.73 67.67 53.11 46.71 74.42 67.28 54.28 45.93 λ 0.002 74.8 69.25 55.72 48.17 76.13 68.79 54.29 45.94 0.05 74.5 68.59 55.73 48.17 76.12 68.8 54.28 45.92 0.2 75.67 67.65 55.72 48.16 76.11 68.8 66.68 55.64 Table 1: Results of experiments on the regularizer. In this table, we list the clean accuracy (Clean) and adversarial accuracy (Adv) of the mean classifier under the PGD and FGSM attack with (cid:15) = 0.01 and (cid:15) = 0.02. λ is chosen from {0, 0.002, 0.05, 0.2}, and λ = 0 indicates no regularizer. ability of H to fit random ±1 binary labels. Now let H be the neural network, if we do not constrain the norm of the weights, theoretically, the universal approximation theorem (Maiorov and Pinkus, 1999) tells us that neural networks can fit any continuous function on a bounded input space, which means that in this case RS(H) ≈ 1, leading to vacuous bounds in the binary classification case; experimentally, Zhang et al. (2017) show that deep neural networks easily fit random labels. From another perspective, to derivate an upper bound for RS(H) by covering number, we need to find a δ-covering set for H under some metric ρ(*, *). If the weights of the layers are not bounded, we can not cover H by a finite subset of H, the δ-covering number of H under ρ(*, *) will be infinite, which means that Lemma 20 does not hold. So it is difficult to go beyond the Lipschitz network. 6 Experiments In this section, we conduct several experiments to support our theory. We emphasize that we are not proposing a method to try to get better robustness on the downstream tasks, we do the experiments to verify our two claims from our theoretical results: (1) As shown in Remark 11, using the blocks may improve the robust performance; (2) As shown in Remark 28, using the norms of the layers of the neural networks as the regularizer may help improve the robust performance. Data sets. We use two data sets (Krizhevsky and Hinton, 2009) in our experiments: (1) the CIFAR-10 data set and (2) the CIFAR-100 data set. CIFAR-10 contains 50000/10000 train/test images with size 32 × 32, which are categorized into 10 classes. CIFAR-100 contains 50000/10000 train/test images with size 32 × 32, which are categorized into 100 classes. Model. We use a neural network with two convolutional layers and one fully connected layer. Following He et al. (2020), we use the Stochastic Gradient Descent (SGD) optimizer 14 Generalization Bounds for Adversarial Contrastive Learning (a) Influence on clean accuracy (b) Influence on adversarial accuracy Figure 1: The effect of block size on the accuracy. In the figure, we show the clean accuracy and the adversarial accuracy of the mean classifier under PGD and FGSM attack with (cid:15) = 0.01 and (cid:15) = 0.02. The block size is choosen from {1, 2, 4, 6, 8, 10}. (a) The influence on the clean accuracy; (b) The influence on the adver- sarial accuracy. with momentum 0.9 but set the weight decay to be 5 × 10−4 and the learning rate to be 0.001. Evaluation of robustness. For representation f , we first calculate (cid:98)uc = 1 i=1 f (xi) to estimate the c-th row of the mean classifier, where x1, . . . , xnc are the data points with label c in our training set. Denote (cid:99)W μ as the estimator of W , we use the robustness of the classifier (cid:99)W μf as an evaluation of the robustness of f on the downstream task. nc (cid:80)nc We show the results for CIFAR-10 here; the results for CIFAR-100 can be found in the Appendix B. 6.1 Improvement from the regularizer Inspired by our bound (13) in Theorem 24 and Theorem 8, the adversarial supervised risk can be upper bounded by the sum of the adversarial unsupervised loss and AGM , which is related to the maximal Frobenius-norm of the network layers. We choose to simultaneously optimize the contrastive upstream pre-train risk and the Frobenius norm of the parameters of the model. We set the norm of the parameters for the layers as a regularizer and test the performance of the mean classifier; here, W μ is calculated by averaging all features of the training data set as done in Nozawa et al. (2020). We use a hyper-parameter λ to balance the trade-off of the the contrastive upstream pre-train risk and the Frobenius norm of the parameters of the model. We choose to minimize the following regularized empirical risk: L(f ) = (cid:98)(cid:101)Lsun(f ) + λN (f ) (14) where N (f ) is a regularizer that constrains the Frobenius norm of the parameters of the model f , here we choose N (f ) = (cid:80)d l=1 |||Wl|||F where |||Wl|||F is the Frobenius norm of the 15 1246810block size556065707580clean accuracy(%)pgd-0.01pgd-0.02fgsm-0.01fgsm-0.021246810block size45505560657075adv accuracy(%)pgd-0.01pgd-0.02fgsm-0.01fgsm-0.02 Zou and Liu parameters for the l-th layer of f and: (cid:98)(cid:101)Lsun(f )= 1 M M (cid:88) j=1 max x(cid:48) j ∈U (xj ) (cid:96)({f (x(cid:48) j)T(f (x+ j )−f (x− ji))}k i=1). More details about our algorithm are in Algorithm 1. Algorithm 1: The AERM algorithm for adversarial contrastive learning Input (cid:110) (cid:111)M : The training data set S = j1, . . . , x− jk) neg; the hyper-parameter λ in (14); the adversarial perturbation sampled from Dsim × Dk U; learning rate α; the total iteration number T ; (xj, x+ j , x− j=1 1 initialize θ0 to be randomized parameters; 2 t ← 0; 3 while t < T do 4 randomly sample a batch of data with size N : B ⊆ S ; (cid:101)B ← ∅; for (x, x+, x− 1 , . . . , x− calculate adversarial example k ) in B do (cid:16)(cid:8)fθt(x(cid:48))T (cid:0)fθt(x+) − fθt(x− i )(cid:1)(cid:9)k (cid:17) ; i=1 1 , . . . , x− k )}; (cid:96) ̃x ∈ arg sup x(cid:48)∈U (x) (cid:101)B ← (cid:101)B ∪ {( ̃x, x+, x− (cid:80) end L(fθt) = 1 N θt+1 ← θt − α∇θtL(fθt); t ← t + 1; ( ̃x,x+,x− 5 6 7 8 9 10 11 12 13 end 1 ,...,x− k )∈ (cid:101)B (cid:96) (cid:16)(cid:8)fθt( ̃x)T (cid:0)fθt(x+) − fθt(x− i )(cid:1)(cid:9)k i=1 (cid:17) + λN (fθt); Output : The feature extractor fθT ∈ F that tries to minimize (14); The results are shown in Table 1. From Table 1, we can see that the F -norm regularizer can improve the adversarial accuracy (the prediction performance of a model on adversarial examples generated by attacker) of the mean classifier, which is in line with our Theorem 24. 6.2 Effect of block size To verify Theorem 10, we analyze the effect of block size on the adversarial accuracy of the mean classifier. Figure 1 presents the results for clean accuracy and adversarial accuracy, respectively. From Figure 1, we can see that a larger block size will yield better adversarial accuracy. The results are consistent with Theorem 10: as the block size grows, Theorem 10 shows that we are optimizing a tighter bound, which leads to better performance as shown in Figure 1. 16 Generalization Bounds for Adversarial Contrastive Learning 7 Conclusion This paper studies the generalization performance of adversarial contrastive learning. We first extend the contrastive learning framework to the adversarial case, then we upper bound the average adversarial risk of the downstream tasks with the adversarial unsupervised risk of the upstream task and an adversarial Rademacher complexity term. Furthermore, we provide the upper bound of the adversarial Rademacher complexity for linear models and multi-layer neural networks. Finally, we conduct several experiments and the experimental results are consistent with our theory. Acknowledgments and Disclosure of Funding This work is supported by the National Natural Science Foundation of China under Grant 61976161. 17 Zou and Liu Appendix A. Proofs In this section, we display the proofs of our theorems, lemmas and corollaries. For reading convenience, we will restate the theorem before proving. A.1 Proof of Theorem 8 In the below, we present some useful lemmas that will be used in the proofs of our main theorems. Lemma 29 For any f ∈ F, we have: (cid:101)Lsup(f ) ≤ (cid:101)Lμ sup(f ) ≤ 1 1 − τ ((cid:101)Lun(f ) − τ (cid:96)(0)) ≤ 1 1 − τ ((cid:101)Lsun(f ) − τ (cid:96)(0)). (A.1) Remark 30 (cid:98)(cid:101)Lsun(f ) denotes the empirical (cid:101)Lsun(f ) and (cid:98)f ∈ arg min f ∈F (cid:98)(cid:101)Lsun(f ). Applying Lemma 29 to (cid:98)f shows that, if we can train a robust feature extractor with low surrogate adversarial unsupervised risk, we can obtain a robust classifier with low adversarial supervised risk on the downstream task. Lemma 31 Let (cid:96) : Rk −→ R be bounded by B. Then, for any δ ∈ (0, 1), with a probability of at least 1 − δ over the choice of the training set S = {(xj, x+ j=1, for any f ∈ F: j=1 = {zj}M j1, . . . , x− jk)}M j , x− where AGM = O( RS (G) M + B {gf (x, x+, x− 1 , . . . , x− k ) = sup x(cid:48)∈U (x) (cid:101)Lsun( (cid:98)f ) ≤ (cid:101)Lsun(f ) + AGM , (cid:113) log 1 M ), RS(G) := (cid:96) (cid:0){f (x(cid:48))T (f (x+) − f (x− E σ∼{±1}M i ))}k δ i=1 (cid:34) (cid:35) (cid:11) (cid:10)σ, (gf )|S sup f ∈F (cid:1) |f ∈ F}, where σ is an M - , and G := dimensional Rademacher random vector with i.i.d. entries and (gf )|S = (gf (z1), . . . , gf (zM )). Proof [Proof of Lemma 29] By the definition of (cid:101)Lsup(T , f ), i.e., (3), it's obvious that (cid:101)Lsup(f ) ≤ (cid:101)Lμ sup(f ), so we only need to prove the second part of (A.1). From definition (2), we have, ∀f ∈ F: (cid:101)Lun(f ) = E c+,c−∼ρ2      sup x(cid:48)∈U (x)    E x+∼Dc+ x−∼Dc− (cid:0)(cid:96) (cid:0)f (x(cid:48))T (cid:0)f (x+) − f (x−)(cid:1)(cid:1)(cid:1)            E x∼Dc+    (cid:40) (cid:34) (cid:96) (cid:0)f (x(cid:48))T (μc+ − μc−)(cid:1) (cid:35)(cid:41) (i) ≥ E c+,c−∼ρ2 E x∼Dc+ (ii) = (1 − τ ) E c+,c−∼ρ2 sup x(cid:48)∈U (x) (cid:34) (cid:40) E x∼Dc+ (cid:96) (cid:0)f (x(cid:48))T (μc+ − μc−)(cid:1) sup x(cid:48)∈U (x) (cid:41) c+ (cid:54)= c− + τ (cid:96)(0), (cid:35) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (A.2) where (i) comes from the convexity of (cid:96) and Jensen's Inequality, and (ii) comes from the property of conditional expectations. Then we have: 18 Generalization Bounds for Adversarial Contrastive Learning E c+,c−∼ρ2 (cid:40) (cid:34) E x∼Dc+ (cid:40) (cid:96) (cid:0)f (x(cid:48))T (μc+ − μc−)(cid:1) sup x(cid:48)∈U (x) (cid:41) (cid:35) (cid:12) (cid:12) c+ (cid:54)= c− (cid:12) (cid:12) (cid:12) (cid:34) sup x(cid:48)∈U (x) (cid:96) (cid:0)f (x(cid:48))T (μc+ − μc−)(cid:1) (cid:35) (i) = E c+,c−∼ρ2 DT (c+) E x∼Dc+ (cid:34) + DT (c−) E x∼Dc− (cid:40) (ii) = E c+,c−∼ρ2 DT (c+) E x∼Dc+ (cid:34) sup x(cid:48)∈U (x) (cid:34) sup x(cid:48)∈U (x) (cid:96) (cid:0)f (x(cid:48))T (μc− − μc+)(cid:1) (cid:41) c+ (cid:54)= c− (A.3) (cid:35) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:96) (cid:0)g(x(cid:48))c+ − g(x(cid:48))c− (cid:35) (cid:1) + DT (c−) E x∼Dc− sup x(cid:48)∈U (x) (cid:96) (cid:0)g(x(cid:48))c− − g(x(cid:48))c+ (cid:1) c+ (cid:54)= c− (cid:41) , (cid:35) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) where T = {c+, c−}, g(x) =   μT c+f (x) μT c−f (x)   = W μf (x) and (i) comes from the symmetry of c+, c−; (ii) is directly from some linear algebras. From (A.3) we know that: E c+,c−∼ρ2 (cid:40) (cid:34) E x∼Dc+ (cid:40) sup x(cid:48)∈U (x) (cid:34) (i) = E c+,c−∼ρ2 E c∼DT E x∼Dc sup x(cid:48)∈U (x) (cid:96) (cid:35) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:16)(cid:8)g(x(cid:48))c − g(x(cid:48))c(cid:48) (cid:96) (cid:0)f (x(cid:48))T (μc+ − μc−)(cid:1) c+ (cid:54)= c− (cid:41) (cid:9) c(cid:48)(cid:54)=c (cid:41) (cid:17) (cid:35) (cid:12) (cid:12) c+ (cid:54)= c− (cid:12) (cid:12) (cid:12) (ii) = E c+,c−∼ρ2 (cid:34) (cid:101)Lsup (cid:0)(cid:8)c+, c−(cid:9) , W μf (cid:1) (cid:35) (cid:12) (cid:12) c+ (cid:54)= c− (cid:12) (cid:12) (cid:12) (cid:34) (iii) = E c+,c−∼ρ2 (cid:101)Lμ sup (cid:0)(cid:8)c+, c−(cid:9) , f (cid:1) (cid:35) (cid:12) (cid:12) c+ (cid:54)= c− (cid:12) (cid:12) (cid:12) (iv) = (cid:101)Lμ sup(f ), (A.4) where (i) is due to the tower property of expectation;(ii) is obvious by the definition of (cid:101)Lsup(T , g); (iii) comes from the definition of (cid:101)Lμ sup(T , f ) and (iv) is from the definition of (cid:101)Lμ sup(f ). Combine (A.2) with (A.4), we conclude that: (cid:101)Lun(f ) ≥ (1 − τ )(cid:101)Lμ sup(f ) + τ (cid:96)(0), ∀f ∈ F. So we have: (1 − τ )(cid:101)Lsup(f ) + τ (cid:96)(0) ≤ (1 − τ )(cid:101)Lμ sup(f ) + τ (cid:96)(0) ≤ (cid:101)Lun(f ), ∀f ∈ F. (A.5) Rearranging (A.5) yields (A.1). 19 Zou and Liu Proof [Proof of Lemma 31] Denote (x, x+, x− Mohri et al. (2012), we have: With probability at least 1 − δ set S, 1 , * * * , x− k ) by z, then by the Theorem 3.3 in 2 over the choice of the training (cid:20) 1 B E z (cid:21) gf (z) ≤ 1 M M (cid:88) i=1 1 B gf (zi) + 2 M RS( G B ) + 3 which is equivalent to: (cid:115) log 4 δ M , (cid:101)Lsun(f ) ≤ (cid:98)(cid:101)Lsun(f ) + 2 M RS(G) + 3B (cid:115) log 4 δ M , ∀f ∈ F. (A.6) (cid:101)Lsun(f ), since E S (cid:20) (cid:98)(cid:101)Lsun(f ) (cid:21) = (cid:101)Lsun(f ) and (cid:96) is bounded by B, Hoeffding's Let f ∗ = arg min f ∈F inequality tells us that: ∀f ∈ F, ∀t ∈ R: (cid:21) (cid:20) (cid:98)(cid:101)Lsun(f ) − (cid:101)Lsun(f ) ≥ t P ≤ e− 2M t2 B2 . Set t = B (cid:113) log 2 δ 2M , we have: ∀f ∈ F, with probability at least 1 − δ 2 , (cid:98)(cid:101)Lsun(f ) − (cid:101)Lsun(f ) ≤ B (cid:115) log 2 δ 2M . (A.7) Combine (A.6) with (A.7), the union bound tells us that: ∀f ∈ F, with probability at least 1 − δ over the choice of the training set S, (cid:101)Lsun( (cid:98)f ) (i) ≤ (cid:98)(cid:101)Lsun( (cid:98)f ) + O   RS(G) M + B (cid:115)   log 1 δ M (ii) ≤ (cid:98)(cid:101)Lsun(f ∗) + O   RS(G) M + B (cid:115)   log 1 δ M (iii) ≤ (cid:101)Lsun(f ∗) + O   RS(G) M + B (cid:115)   log 1 δ M (iv) ≤ (cid:101)Lsun(f ) + O   RS(G) M + B (cid:115)   , log 1 δ M where (i) comes from (A.6);(ii) is directly from the fact that (cid:98)(cid:101)Lsun( (cid:98)f ) ≤ (cid:98)(cid:101)Lsun(f ∗), which is from the definition of (cid:98)f ;(iii) is a result of (A.7) and (iv) is obvious by the definition of f ∗. Theorem 8 Let (cid:96) : Rk −→ R be bounded by B. Then, for any δ ∈ (0, 1),with a probability of at least 1 − δ over the choice of the training set S = {(xj, x+ j=1, for any f ∈ F: j , x− (cid:101)Lsup( (cid:98)f ) ≤ (cid:101)Lμ sup( (cid:98)f ) ≤ 1 1 − τ ((cid:101)Lsun(f ) − τ (cid:96)(0)) + j )}M 1 1 − τ AGM . Proof From Lemma 29 we know that: (cid:101)Lsup( (cid:98)f ) ≤ (cid:101)Lμ sup( (cid:98)f ) ≤ 1 1 − τ ((cid:101)Lun( (cid:98)f ) − τ (cid:96)(0)) ≤ 1 1 − τ ((cid:101)Lsun( (cid:98)f ) − τ (cid:96)(0)), Then Lemma 31 directly yields the result we need. 20 Generalization Bounds for Adversarial Contrastive Learning A.2 Proof of Theorem 10 Theorem 10 For any f ∈ F, we have: (cid:101)Lsup(f ) ≤ 1 1 − τ (cid:16) (cid:17) sun (f ) − τ (cid:96)(0) (cid:101)Lblock ≤ (cid:16) 1 1 − τ (cid:101)Lsun(f ) − τ (cid:96)(0) (cid:17) . Proof By the convexity of (cid:96) and Jensen's inequality, we have: ∀x(cid:48), x+ i , x− i : (cid:32) (cid:96) f (x(cid:48))T (cid:32) (cid:80)b i=1 f (x+ i ) b − (cid:80)b i=1 f (x− i ) b (cid:33)(cid:33) (cid:32) = (cid:96) 1 b b (cid:88) i=1 f (x(cid:48))T (cid:0)f (x+ i ) − f (x− i )(cid:1) (cid:33) ≤ 1 b b (cid:88) i=1 Take maximization about x(cid:48) both sides, we have: (cid:96) (cid:0)f (x(cid:48))T (cid:0)f (x+ i ) − f (x− i )(cid:1)(cid:1) . (cid:32) (cid:96) sup x(cid:48)∈U (x) f (x(cid:48))T (cid:32) (cid:80)b i=1 f (x+ i ) b (cid:33)(cid:33) (cid:80)b i=1 f (x− i ) b − ≤ ≤ 1 b 1 b (cid:34) b (cid:88) (cid:96)(cid:0)f (x(cid:48))T(cid:0)f (x+ i )−f (x− (cid:35) i )(cid:1)(cid:1) sup x(cid:48)∈U (x) i=1 (cid:34) b (cid:88) i=1 sup x(cid:48)∈U (x) (cid:96)(cid:0)f (x(cid:48))T(cid:0)f (x+ i )−f (x− (cid:35) i )(cid:1)(cid:1) . Taking expectations both sides yields: (cid:101)Lblock sun (f ) = E x,x+ i ,x− i (cid:34) (cid:32) (cid:96) sup x(cid:48)∈U (x) f (x(cid:48))T (cid:32) (cid:80)b i=1 f (x+ i ) b − (cid:80)b i=1 f (x− i ) b (cid:33)(cid:33)(cid:35) ≤ E x,x+ i ,x− i (cid:40) 1 b (cid:34) = E x,x+,x− sup x(cid:48)∈U (x) (cid:34) b (cid:88) i=1 (cid:96) (cid:0)f (x(cid:48))T (cid:0)f (x+ i ) − f (x− i )(cid:1)(cid:1) sup x(cid:48)∈U (x) (cid:35)(cid:41) (cid:96) (cid:0)f (x(cid:48))T (cid:0)f (x+) − f (x−)(cid:1)(cid:1) (cid:35) = (cid:101)Lsun(f ), which proves the second inequality. For the first inequality, we have, ∀f ∈ F: 21 (cid:101)Lblock sun (f ) = E c+,c−∼ρ2 Zou and Liu (cid:34) (cid:32) sup x(cid:48)∈U (x) (cid:96) f (x(cid:48))T (cid:32) (cid:80)b i=1 f (x+ i ) b − (cid:80)b i=1 f (x− i ) b (cid:33)(cid:33)(cid:35)    sup x(cid:48)∈U (x) (cid:34) (cid:32) (cid:32) (cid:80)b f (x(cid:48))T i=1 f (x+ i ) b (cid:96) E x+ i ∼Db c+ x− i ∼Db c−  (cid:32) (cid:32) (cid:80)b f (x(cid:48))T i=1 f (x+ i ) b   (cid:96) sup  x(cid:48)∈U (x)  E x+ i ∼Db c+ x− i ∼Db c− (cid:80)b i=1 f (x− i ) b − (cid:80)b i=1 f (x− i ) b − (cid:33)(cid:33)(cid:35) (cid:33)(cid:33)                     E i ∼Db+1 x,x+ c+ x− i ∼Db c−     E x∼Dc+       E x∼Dc+   (i) ≥ E c+,c−∼ρ2 (ii) ≥ E c+,c−∼ρ2 (iii) = E c+,c−∼ρ2 (cid:40) (cid:34) E x∼Dc+ (cid:96) (cid:0)f (x(cid:48))T (μc+ − μc−)(cid:1) sup x(cid:48)∈U (x) (cid:35)(cid:41) (iv) = (1 − τ )(cid:101)Lμ sup(f ) + τ (cid:96)(0), where (i) and (ii) are directs result of Jensen's Inequality and convexity of maximization function and (cid:96); (iii) is from the linearity of expectation and the last equality follows the same argumentation as in (A.4), which proves the Theorem. A.3 Proof of (5) Proof For any f ∈ F, we have: (cid:101)Lsup(f ) = E T ∼D (cid:104) (cid:101)Lsup(T , f ) (cid:105) (i) = p E T ∼D (cid:104) (cid:101)Lsup(T , f ) (cid:12) (cid:12) (cid:12)Edistinct (cid:105) +(1−p) E T ∼D (cid:12) (cid:104) (cid:12) (cid:101)Lsup(T , f ) (cid:12) (cid:105) ̄Edistinct (cid:104) ≥ p E T ∼D (cid:101)Lsup(T , f ) where Edistinct is the event that {c+, c− = p (cid:101)Lsup(f ), 1 , . . . , c− (cid:12) (cid:12) (cid:12)Edistinct (cid:105) (ii) k } is distinct and p = P 1 ,...,c− k )∼D (c+,c− [Edistinct] and (i) is from the property of conditional expectation and (ii) comes from the definition of (cid:101)Lsup(f ). A.4 Proof of Proposition 15 Proposition 15 The hinge loss and the logistic loss satisfy Assumption 14. Proof Since I1 and I2 are symmetric, We only need to prove (6). For the Hinge Loss: (cid:26) (cid:96) ({vi}i∈I1) = max 0, 1 + max i∈I1 {−vi} (cid:27) (i) ≤ max (cid:26) 0, 1 + max i∈[d] {−vi} (cid:27) = (cid:96) (cid:0){vi}i∈[d] (cid:1) , 22 Generalization Bounds for Adversarial Contrastive Learning where (i) is from the fact that I1 ⊆ [d], so the first inequality is proved, for the second one: (cid:96) (cid:0){vi}i∈[d] (cid:1) = max (cid:26) 0, 1 + max i∈[d] (cid:27) (cid:26) {−vi} = max (cid:27) 0, 1 + max i∈I1∪I2 {−vi} , where the last equality is directly from the definition of I1 and I2. 1. if 1 + max i∈I1∪I2 have: {−vi} ≤ 0, then (cid:96) ({vi}i∈I1∪I2) = 0, since Hinge Loss is non-negative, we (cid:96) ({vi}i∈I1∪I2) = 0 + 0 ≤ (cid:96) ({vi}i∈I1) + (cid:96) ({vi}i∈I2) . 2. if 1 + max i∈I1∪I2 {−vi} > 0 (a) if 1 + max i∈I1 have: {−vi} ≤ 0, then (cid:96) ({vi}i∈I1) = max (cid:26) (cid:27) 0, 1 + max i∈I1 {−vi} = 0. So we (cid:96) ({vi}i∈I1∪I2) = max 0, 1 + max i∈I1∪I2 {−vi} = max 0, 1 + max i∈I2 {−vi} (cid:26) (cid:27) (cid:26) (cid:27) = 0 + (cid:96) ({vi}i∈I2) = (cid:96) ({vi}i∈I1) + (cid:96) ({vi}i∈I2) . (b) if 1 + max i∈I2 {−vi} ≤ 0, by the same discussion of (a), we have: (cid:96) ({vi}i∈I1∪I2) ≤ (cid:96) ({vi}i∈I1) + (cid:96) ({vi}i∈I2) . (c) if 1 + max i∈I1 {−vi} > 0 and 1 + max i∈I2 {−vi} > 0, (cid:96) ({vi}i∈I1∪I2) = max 0, 1+ max i∈I1∪I2 {−vi} ≤ max 0, 1+max i∈I1 {−vi}+1+max i∈I2 {−vi} (cid:26) (cid:27) (cid:26) (cid:27) (cid:26) ≤ max 0, 1 + max i∈I1 (cid:27) (cid:26) {−vi} + max (cid:27) 0, 1 + max i∈I2 {−vi} = (cid:96) ({vi}i∈I1) + (cid:96) ({vi}i∈I2) . So the second inequality is proved. For the Logistic Loss:    (cid:96) ({vi}i∈I1) = log2 1 + e−vi  ≤ log2 1 + (cid:88) i∈I1   = (cid:96) (cid:0){vi}i∈[d] (cid:1) . (cid:88) e−vi i∈[d] 23 Zou and Liu So the first inequality is proved. For the second one:    (cid:96) ({vi}i∈I1∪I2) = log2 1 + (cid:88) i∈I1∪I2 e−vi  ≤ log2 1 + e−vi + (cid:88) i∈I1 (cid:88) i∈I2   e−vi  ≤ log2 1 + (cid:88) i∈I1   = log2  1 + (cid:88) i∈I1 e−vi + (cid:88) e−vi +       (cid:88) e−vi   (cid:88) e−vi   i∈I2   i∈I1   i∈I2 e−vi  1 + (cid:88) e−vi     i∈I2   = log2 1 + (cid:88) i∈I1 e−vi  + log2 1 + (cid:88) i∈I2 e−vi  = (cid:96) ({vi}i∈I1) + (cid:96) ({vi}i∈I2) , which proves the second inequality. A.5 Proof of Theorem 32 We here introduce some further notations, which will be used in our main results. For a tuple (c+, c− i = c+} and Q as the set of distinct classes [I + (cid:54)= ∅], while (cid:96)N ((cid:126)0) in (c+, c− k ), we define I + := {i ∈ [k]|c− k ). We define pmax(T ) := maxc DT (c), τk := 1 , . . . , c− 1 , . . . , c− P c+,c− i ∼ρk+1 is defined as the loss of the N -dimensional zero vector. Let T be a task sample from distribution D and ρ+(T ) be a distribution of c+ when (c+, c− k ) are sampled from ρk+1 conditioned on Q = T and I + = ∅ and ρ+ 1 , . . . , c− ρ+(T )(c). min(T ) := min c∈T Theorem 32 Assume that (cid:96) satisfies Assumption 14. With a probability of at least 1 − δ over the choice of the training set S, for any f ∈ F, we have: E T ∼D ≤ (cid:20) ρ+ min(T ) pmax(T ) (cid:16) 1 1 − τk (cid:101)Lsup(T , (cid:98)f ) (cid:101)Lsun(f ) + AGM − (cid:21) sup(T , (cid:98)f ) (cid:101)Lμ (cid:21) ≤ E T ∼D (cid:17) (cid:20) ρ+ min(T ) pmax(T ) τk 1 − τk E i ∼ρk+1 c+,c− (cid:104) (cid:105) (cid:96)|I +|((cid:126)0)|I + (cid:54)= ∅ , (A.8) where |I +| is the cardinality of set I +. Before proceeding with the proof of Theorem 32, we introduce some useful lemmas. Lemma 33 For any T sampled from D, we have: ρ+(T )(c) ≥ ρ+ min(T ) pmax(T ) DT (c), ∀c ∈ T . Lemma 34 Assume that f satisfies Assumption 14. For any f ∈ F, we have: (1 − τk) E T ∼D (cid:20) ρ+ min(T ) pmax(T ) (cid:21) (cid:101)Lsup(T , f ) ≤ (1 − τk) E T ∼D (cid:20) ρ+ min(T ) pmax(T ) (cid:21) (cid:101)Lμ sup(T , f ) ≤ (cid:101)Lsun(f ) − τk E i ∼ρk+1 c+,c− (cid:104) (cid:96)|I +|((cid:126)0)|I + (cid:54)= ∅ (cid:105) . 24 Generalization Bounds for Adversarial Contrastive Learning Proof [Proof of Lemma 33] By the definition of ρ+(T ) and ρ+ min(T ), we can find that: So we have: ∀c ∈ T , ρ+ min(T ) ≤ ρ+(T )(c). ∀c ∈ T , ρ+(T )(c) ρ+ min(T ) ≥ 1. By the definition of pmax(T ), we have: ∀c ∈ T , DT (c) pmax(T ) ≤ 1. Combine (A.9) and (A.10), we have: ∀c ∈ T , ρ+(T )(c) ≥ ρ+ min(T ) pmax(T ) DT (c). Proof [Proof of Lemma 34] By the definition of (cid:101)Lsun(f ), we have: c+,c− x,x+∼D2 i ∼D (cid:16)(cid:8)f (x(cid:48))T (cid:0)f (x+) − f (x− i )(cid:1)(cid:9)k i=1 (cid:35) (cid:17) (cid:34) (cid:96) sup x(cid:48)∈U (x) c− i (cid:101)Lsun(f ) = = (i) ≥ (ii) ≥ E i ∼ρk+1 c+ ;x−       (cid:34) E i ∼ρk+1 c+,c− x∼Dc+ E x+∼Dc+ x− i ∼D c− i E i ∼ρk+1 c+,c− x∼Dc+ sup x(cid:48)∈U (x) E i ∼ρk+1 c+,c− x∼Dc+ (cid:96) sup x(cid:48)∈U (x) (cid:34) sup x(cid:48)∈U (x) (cid:96) (cid:16)(cid:8)f (x(cid:48))T (cid:0)f (x+) − f (x− i )(cid:1)(cid:9)k i=1 (cid:17)  (cid:96)     E x+∼Dc+ x− i ∼D c− i (cid:16)(cid:8)f (x(cid:48))T (cid:0)f (x+) − f (x− i )(cid:1)(cid:9)k i=1 (cid:17) (cid:18)(cid:110) f (x(cid:48))T (cid:16) μc+ − μc− i (cid:19)(cid:35) (cid:17)(cid:111)k i=1 (cid:44) R1,   (cid:35)          (A.9) (A.10) (A.11) where (i), (ii) is from the Jensen's inequality and convexity of (cid:96). Then we analyze lower bound of R1: 25 Zou and Liu (cid:34) sup x(cid:48)∈U (x) (cid:96) (cid:18)(cid:110) f (x(cid:48))T (cid:16) μc+ − μc− i (cid:17)(cid:111)k i=1 (cid:35) (cid:19) (cid:12) (cid:12) I + = ∅ (cid:12) (cid:12) R1 (i) = (1 − τk) E i ∼ρk+1 c+,c− x∼Dc+ (cid:34) + τk E i ∼ρk+1 c+,c− (cid:96) sup x(cid:48)∈U (x) (cid:18)(cid:110) f (x(cid:48))T (cid:16) μc+ − μc− i (cid:17)(cid:111)k i=1 (cid:35) (cid:19) (cid:12) (cid:12) I + (cid:54)= ∅ (cid:12) (cid:12) (ii) ≥ (1 − τk) E i ∼ρk+1 c+,c− x∼Dc+ (cid:34) (cid:96) sup x(cid:48)∈U (x) (cid:16)(cid:8)f (x(cid:48))T (μc+ − μc)(cid:9) c∼Q,c(cid:54)=c+ (cid:35) I + = ∅ (cid:17) (cid:12) (cid:12) (cid:12) (cid:12) x∼Dc+ (A.12) (cid:34) + τk E i ∼ρk+1 c+,c− (cid:96) sup x(cid:48)∈U (x) (cid:18)(cid:110) f (x(cid:48))T (cid:16) μc+ − μc− i (cid:17)(cid:111)k i=1 (cid:35) (cid:19) (cid:12) (cid:12) I + (cid:54)= ∅ (cid:12) (cid:12) (iii) ≥ (1 − τk) E i ∼ρk+1 c+,c− x∼Dc+ x∼Dc+ (cid:34) (cid:96) sup x(cid:48)∈U (x) (cid:16)(cid:8)f (x(cid:48))T (μc+ − μc)(cid:9) c∼Q,c(cid:54)=c+ (cid:35) (cid:17) (cid:12) (cid:12) I + = ∅ (cid:12) (cid:12) + τk E i ∼ρk+1 c+,c− (cid:20) (cid:12) (cid:12) (cid:96)|I +|((cid:126)0) I + (cid:54)= ∅ (cid:12) (cid:12) (cid:21) , where (i) comes from the property of conditional expectation, (ii) is a result of the fact that Q ⊆ [k] and (cid:96) satisfies Assumption 14 and (iii) is from the fact that [|I +|] ⊆ [k] and (cid:96) satisfies (cid:34) (cid:16)(cid:8)f (x(cid:48))T (μc+ − μc)(cid:9) c∼Q,c(cid:54)=c+ (cid:35) (cid:17) (cid:12) (cid:12) I + = ∅ (cid:12) (cid:12) , we Assumption 14. Let R2 = have: E i ∼ρk+1 c+,c− x∼Dc+ (cid:96) sup x(cid:48)∈U (x) (cid:34) R2 = E i ∼ρk+1 c+,c− sup x(cid:48)∈U (x) (cid:96) (cid:16)(cid:8)f (x(cid:48))T (μc+ − μc)(cid:9) c∼Q,c(cid:54)=c+ (cid:35) (cid:17) (cid:12) (cid:12) I + = ∅ (cid:12) (cid:12) x∼Dc+   (i) = E T ∼D E i ∼ρk+1 c+,c− x∼Dc+ (ii) = E T ∼D E c+∼ρ+(T ) x∼Dc+     (cid:34) (cid:96) sup x(cid:48)∈U (x) (cid:16)(cid:8)f (x(cid:48))T (μc+ − μc)(cid:9) c∼Q,c(cid:54)=c+ (cid:35) Q = T , I + = ∅ (cid:17) (cid:12) (cid:12) (cid:12) (cid:12)    (A.13) (cid:34) (cid:96) sup x(cid:48)∈U (x) (cid:16)(cid:8)f (x(cid:48))T (μc+ − μc)(cid:9) c∼T ,c(cid:54)=c+ (cid:35)   (cid:17) ,  where (i) is from the tower property of expectation and (ii) is directly obtained by the (cid:34) (cid:16)(cid:8)f (x(cid:48))T (μc+ − μc)(cid:9) (cid:17) c∼T ,c(cid:54)=c+ , we have: (cid:35) definition of ρ+(T ). Let R3 = E c+∼ρ+(T ) x∼Dc+ (cid:96) sup x(cid:48)∈U (x) 26 Generalization Bounds for Adversarial Contrastive Learning R3 = E c+∼ρ+(T ) x∼Dc+ (i) ≥ ρ+ min(T ) pmax(T ) (cid:34) (cid:96) sup x(cid:48)∈U (x) (cid:16)(cid:8)f (x(cid:48))T (μc+ − μc)(cid:9) c∼T ,c(cid:54)=c+ (cid:35) (cid:17) (cid:34) (cid:96) sup x(cid:48)∈U (x) E c+∼DT x∼Dc+ (cid:16)(cid:8)f (x(cid:48))T (μc+ − μc)(cid:9) c∼T ,c(cid:54)=c+ (cid:35) (cid:17) (A.14) (ii) = ρ+ min(T ) pmax(T ) (cid:101)Lμ sup(T , f ) (iii) ≥ ρ+ min(T ) pmax(T ) (cid:101)Lsup(T , f ), where (i) is directly from Lemma 33;(ii) and (iii) are from the definition of (cid:101)Lμ (cid:101)Lsup(T , f ), respectively. Combing (A.11) (A.12) (A.13) and (A.14) yields: sup(T , f ) and (1 − τk) E T ∼D (cid:20) ρ+ min(T ) pmax(T ) (cid:21) (cid:101)Lsup(T , f ) ≤ (1 − τk) E T ∼D (cid:20) ρ+ min(T ) pmax(T ) (cid:21) (cid:101)Lμ sup(T , f ) ≤ (cid:101)Lsun(f ) − τk E i ∼ρk+1 c+,c− (cid:105) (cid:104) (cid:96)|I +|((cid:126)0)|I + (cid:54)= ∅ . Equipped with the above lemmas, now we can turn to the proof of Theorem 32. Proof [Proof of Theorem 32] From Lemma 31 we know that with probability at least 1 − δ over the choice of the training set S, ∀f ∈ F: Combing this with Lemma 34 directly yields (A.8). (cid:101)Lsun( (cid:98)f ) ≤ (cid:101)Lsun(f ) + AGM . A.6 Proof of Theorem 16 Theorem 16 Suppose C is finite. For any c ∈ C, ρ(c) > 0, and (cid:96) satisfies Assumption 14. Then, with a probability of at least 1 − δ over the choice of the training set S, ∀f ∈ F: (cid:101)Lsup( (cid:98)f ) ≤ α(ρ) (cid:16) (cid:101)Lsun(f ) + AGM (cid:17) − β, where α(ρ) = 1 1−τk pmax(T ) ρ+ min(T ) max |T |≤k+1 T distinct is a positive constant depending on ρ and β = α(ρ)τk E i ∼ρk+1 c+,c− (cid:104) (cid:96)|I +|((cid:126)0)|I + (cid:54)= ∅ (cid:105) . Proof Since C is finite and ρ(c) > 0 for any c ∈ C, we can see that: 1 α(1 − τk) = min |T |≤k+1,T distinct (cid:27) (cid:26) ρ+ min(T ) pmax(T ) > 0. (A.15) 27 Zou and Liu By Theorem 32 and the definition of (cid:101)Lsup(f ), we have: ∀f ∈ F, with probability at least 1 − δ over the choice of the training set S, 1 α(1 − τk) (cid:101)Lsup( (cid:98)f ) (i) = E T ∼D (cid:20) 1 α(1 − τk) (cid:101)Lsup(T , (cid:98)f ) (cid:21) (ii) ≤ E T ∼D (cid:20) ρ+ min(T ) pmax(T ) (cid:21) (cid:101)Lsup(T , (cid:98)f ) (iii) ≤ (cid:16) 1 1 − τk (cid:101)Lsun(f ) + AGM (cid:17) − τk 1 − τk E i ∼ρk+1 c+,c− (cid:104) (cid:96)|I +|((cid:126)0)|I + (cid:54)= ∅ (cid:105) , where (i) is from the definition of (cid:101)Lsup( (cid:98)f );(ii) is from (A.15) and (iii) is from Theorem 32. Rearranging yields the result. A.7 Proof of Lemma 18 Lemma 18 Let Bp(r) be the p-norm ball in Rd with radius r. The δ-covering number of Bp(r) with respect to (cid:107) * (cid:107)p thus obeys the following bound: N (δ; Bp(r), (cid:107) * (cid:107)p) ≤ (cid:18) 1 + (cid:19)d , 2r δ where N (δ; B, (cid:107) * (cid:107)) is the δ-covering number of B with respect to the norm (cid:107) * (cid:107). Proof Set (cid:107) * (cid:107), (cid:107) * (cid:107)(cid:48) in Lemma 17 to be (cid:107) * (cid:107)p, we have: N (δ; Bp(1), (cid:107) * (cid:107)p) ≤ Bp(1) + Bp(1)(cid:1) vol (cid:0) 2 δ vol (Bp(1)) = (cid:1) Bp(1)(cid:1) vol (cid:0)(cid:0)1 + 2 δ vol (Bp(1)) (cid:19)d (cid:18) (i) ≤ (cid:18) 1 + (cid:19)d vol (Bp(1)) vol (Bp(1)) 2 δ = 1 + , 2 δ where (i) is true because Bp(1) ⊂ Rd. Now suppose that {x1, * * * , xN } is the minimal δ-covering of Bp(1), then: ∀x ∈ Bp(1), ∃xi ∈ {x1, * * * , xN } s.t.(cid:107)x − xi(cid:107)p ≤ δ. So we have: ∀rx ∈ Bp(r), ∃rxi ∈ {rx1, * * * , rxN } s.t.(cid:107)rx − rxi(cid:107)p ≤ rδ. So {rx1, * * * , rxN } is a rδ-covering of Bp(r), so we have: N (rδ; Bp(r), (cid:107) * (cid:107)p) ≤ N (δ; Bp(1), (cid:107) * (cid:107)p) ≤ (cid:18) 1 + (cid:19)d . 2 δ Letting δ r take place of δ, we have N (δ; Bp(r), (cid:107) * (cid:107)p) ≤ (cid:0)1 + 2r δ (cid:1)d . 28 Generalization Bounds for Adversarial Contrastive Learning A.8 Proof of Theorem 22 Theorem 22 Let U(x) = {x(cid:48)|(cid:107)x(cid:48) − x(cid:107)r ≤ (cid:15)} (i.e. consider the (cid:96)r attack). We then have : RS(H) = O (cid:16) [P P ∗ + (cid:15)R∗s(r∗, p, m)] (cid:104) ms(p∗, p, m)w2 √ (cid:105)(cid:17) , M where s(p, q, n) := n (11). max (cid:110) 1 p − 1 q , 1 q − 1 p (cid:111) , 1 p + 1 p∗ = 1, 1 r + 1 r∗ = 1, and R∗ is defined similarly to Before giving the proof of the theorem, we introduce some lemmas will be used in our proof. Lemma 35 For any x ∈ Rn,0 < p2 ≤ p1, we have: (cid:107)x(cid:107)p1 ≤ (cid:107)x(cid:107)p2 ≤ n 1 p2 − 1 p1 (cid:107)x(cid:107)p1. Proof [Proof of Lemma 35] Firstly, we prove (cid:107)x(cid:107)p1 ≤ (cid:107)x(cid:107)p2. For any x ∈ Rn, suppose ai = |xi|, lep f (p) = ((cid:80)n i=1 ap i ) p . In order to prove (cid:107)x(cid:107)p1 ≤ (cid:107)x(cid:107)p2, it suffices to prove that: ∀ai ≥ 0, i = 1, 2, . . . , n, f (p) is non-increasing on (0, 1]. 1 1. if ai = 0, ∀i, f is a constant function, so f is non-increasing. 2. if ∃i, ai (cid:54)= 0, suppose {ai|ai (cid:54)= 0} has K elements, without loss of generality, suppose {ai|ai (cid:54)= 0} = {a1, a2, * * * , aK} and a1 = max 1≤k≤K {ak}, then we have: 0 < (cid:19)p (cid:18) ak a1 ≤ 1, (cid:19)p K (cid:88) k=1 (cid:18) ak a1 ≥ 1, ln (cid:19)p(cid:33) (cid:32) K (cid:88) k=1 (cid:18) ak a1 ≥ 0, k = 1, 2, . . . , K. (A.16) 1 p = a1 (cid:16)(cid:80)K k=1 (cid:16) ak a1 (cid:17)p(cid:17) 1 p = a1exp{ 1 p ln (cid:16)(cid:80)K k=1 (cid:16) ak a1 (cid:17)p(cid:17) }, We can write f (p) = ((cid:80)n (cid:16) ak a1 (cid:16)(cid:80)K k=1 i=1 ap i ) (cid:17)p(cid:17) p ln let g(p) = 1 , by the monotone property of composite functions, to prove f (p) is non-increasing, it suffices to prove g(p) is non-increasing.Taking derivation of g yields: (cid:17)(cid:105) (cid:16) ak a1 (cid:17)p ln − (cid:16)(cid:80)K k=1 p2 (cid:17)p(cid:17) (cid:16) ak a1 . g(cid:48)(p) = (cid:80)K k=1 (cid:17)p (cid:104)(cid:16) ak a1 p (cid:80)K k=1 ln (cid:16) ak a1 (cid:17)p (cid:80)K (cid:104)(cid:16) ak a1 p (cid:80)K From (A.16) we know that ln (cid:16) ak a1 g(cid:48)(p) ≤ 0, so g is non-increasing, which means that (cid:107)x(cid:107)p1 ≤ (cid:107)x(cid:107)p2, ∀x ∈ Rn. ≤ 0 and k=1 p2 k=1 k=1 ln (cid:16)(cid:80)K (cid:17)p(cid:17) (cid:16) ak a1 (cid:17)(cid:105) (cid:16) ak a1 (cid:17)p ≥ 0, so we have Nextly, we prove that (cid:107)x(cid:107)p2 ≤ n i=1 |xi|p2(cid:1) p1 p1 p2 = (cid:0) 1 ((cid:80)n n i=1 |xi|p2) p1 p2 is convex. By Jensen's Inequality we know that: p1 p2 .Since p2 ≤ p1, i.e. p1 p2 h(t) = t p2 * n (cid:80)n 1 p2 − 1 p1 (cid:107)x(cid:107)p1. By the definition of (cid:107) * (cid:107)p, we have: (cid:107)x(cid:107)p1 p2 = ≥ 1, we know the function ∀λi s.t. λi ≥ 0 and n (cid:88) i=1 λi = 1, ∀ti ∈ R : h (cid:33) λiti ≤ (cid:32) n (cid:88) i=1 n (cid:88) i=1 λih(ti). (A.17) 29 Zou and Liu Set λ1 = λ2 = * * * = λn = 1 n , ti = |xi|p2, i = 1, 2, . . . , n in (A.17), we have: (cid:33) p1 p2 |xi|p2 (cid:32) 1 n n (cid:88) i=1 ≤ 1 n n (cid:88) i=1 (|xi|p2) p1 p2 = 1 n n (cid:88) i=1 |xi|p1. Multiplying both sides by n p1 p2 yields (cid:0) 1 n (cid:80)n p2 * n i=1 |xi|p2(cid:1) p1 −1 * (cid:107)x(cid:107)p1 p1. p1 p2 (cid:107)x(cid:107)p1 p2 ≤ n p1 p2 ≤ 1 n (cid:80)n i=1 |xi|p1 * n p1 p2 , i.e. Taking both sides the p1th power yields (cid:107)x(cid:107)p2 ≤ n 1 p2 − 1 p1 (cid:107)x(cid:107)p1. Lemma 36 Suppose that ∃A, B ∈ R+ s.t. A(cid:107)x(cid:107)p ≤ (cid:107)x(cid:107)q ≤ B(cid:107)x(cid:107)p (p, q ≥ 1) for any x ∈ Rn, then ∀W ∈ Rm×n: |||W |||p ≤ B Proof [Proof of Lemma 36] If we have A(cid:107)x(cid:107)p ≤ (cid:107)x(cid:107)q ≤ B(cid:107)x(cid:107)p, then: A |||W |||q. |||W |||p = max (cid:107)x(cid:107)p≤1 (cid:107)W x(cid:107)p (i) ≤ max (cid:107)x(cid:107)p≤B (cid:107)W x(cid:107)p (ii) ≤ max (cid:107)x(cid:107)p≤B 1 A (cid:107)W x(cid:107)q = max (cid:107)x(cid:107)p≤1 B A (cid:107)W x(cid:107)q = B A |||W |||q, where (i) is from the fact that (cid:107)x(cid:107)q ≤ B(cid:107)x(cid:107)p, which means that {x|(cid:107)x(cid:107)p ≤ 1} ⊆ {x|(cid:107)x(cid:107)q ≤ 1} and (ii) is from the condition that A(cid:107)x(cid:107)p ≤ (cid:107)x(cid:107)q. Lemma 37 For any p, q ≥ 1, then ∀W ∈ Rm×n: |||W |||q ≤ nmax{ 1 p − 1 q , 1 q − 1 p }|||W |||p. Remark 38 If we denote nmax{ 1 s(p, q, n)|||W |||p. p − 1 q , 1 q − 1 p } by s(p, q, n), then we have: ∀W ∈ Rm×n, |||W |||q ≤ Proof [Proof of Lemma 37] We discuss it in two cases. 1. If p ≤ q, by Lemma 35, we have: ∀x ∈ Rn, (cid:107)x(cid:107)q ≤ (cid:107)x(cid:107)p ≤ n we know that ∀W ∈ Rm×n, |||W |||q ≤ n 1 p − 1 q |||W |||p. 1 p − 1 q (cid:107)x(cid:107)q. By Lemma 36, 2. If p ≥ q, by Lemma 35, we have: ∀x ∈ Rn, (cid:107)x(cid:107)p ≤ (cid:107)x(cid:107)q ≤ n 1 p − 1 q (cid:107)x(cid:107)q ≤ (cid:107)x(cid:107)p ≤ (cid:107)x(cid:107)q. n 1 q − 1 p (cid:107)x(cid:107)p, i.e. By Lemma 36, we know that ∀W ∈ Rm×n, |||W |||q ≤ n 1 q − 1 p |||W |||p. So we conclude that ∀W ∈ Rm×n, |||W |||q ≤ nmax{ 1 p }|||W |||p. Now we turn to bound the Rademacher complexity of H, where p − 1 q − 1 q , 1 (cid:26) H = h(x, x+, x−) = min x(cid:48)∈U (x) (cid:0)f (x(cid:48))T (cid:0)f (x+) − f (x−)(cid:1)(cid:1) |f ∈ F (cid:27) , F = {f : x −→ W x|W ∈ Rn×m, |||W |||p ≤ w}. 30 Generalization Bounds for Adversarial Contrastive Learning Let H0 = (cid:8)h(x, x+, x−) = f (x)T (cid:0)f (x+) − f (x−)(cid:1) |f ∈ F(cid:9) (cid:110) (x, x+, x−) −→ xT W T W (x+ − x−)(cid:12) (cid:12)W ∈ Rn×m, |||W |||p ≤ w (cid:111) . = [Proof of Theorem 22] Firstly, we drop the complicated and unwieldy min operate Proof by directly solving the minimization problem. h(x, x+, x−) = min f (x(cid:48))T (cid:0)f (x+) − f (x−)(cid:1) = min (cid:107)δ(cid:107)r≤(cid:15) (cid:107)x(cid:48)−x(cid:107)r≤(cid:15) (W (x + δ))T (cid:0)W x+ − W x−(cid:1) = xT W T W (x+ − x−) + min (cid:107)δ(cid:107)r≤(cid:15) δT W T W (x+ − x−) (i) = xT W T W (x+ − x−) − (cid:15)(cid:107)W T W (x+ − x−)(cid:107)r∗, where (i) is from Holder's Inequality and taking the value of δ that can get equality. Define: H1 = Hw 0 = Hw 1 = (cid:110) (x, x+, x−) −→ (cid:107)W T W (x+ − x−)(cid:107)r∗ (cid:12) (cid:12)W ∈ Rn×m, |||W |||p ≤ w (cid:111) , (cid:110) (x, x+, x−) −→ xT A(x+ − x−)(cid:12) (cid:110) (x, x+, x−) −→ (cid:107)A(x+ − x−)(cid:107)r∗ (cid:12)A ∈ Rm×m, |||A|||p ≤ w (cid:111) , (cid:12) (cid:12)A ∈ Rm×m, |||A|||p ≤ w (cid:111) . Since ∀W ∈ Rn×m s.t. |||W |||p ≤ w, we have: (cid:12) (cid:12) (cid:12)W T W (cid:12) (cid:12) (cid:12) (cid:12) (cid:12)p (cid:12) (cid:12) (cid:12) (cid:12) (i) (cid:12) (cid:12) (cid:12)W T (cid:12) (cid:12) (cid:12) ≤ (cid:12) (cid:12)p * |||W |||p = |||W |||p∗ * |||W |||p (cid:12) (cid:12) (cid:12) (cid:12) (ii) ≤ s(p∗, p, m)|||W |||2 p ≤ s(p∗, p, m)w2, where 1 Lemma 37. So we have: p + 1 p∗ = 1 and (i) comes from the Submultiplicativity of matrix norm and (ii) is from (cid:110) W (cid:12) (cid:12) (cid:12)|||W |||p ≤ w (cid:111) (cid:110) W ⊆ (cid:12) (cid:12) (cid:12) (cid:12)W T W (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12)p ≤ s(p∗, p, m)w2(cid:111) . And since W T W is positive semi-definite, it's easy to see that: (cid:110) W T W (cid:12) (cid:12) (cid:12) (cid:12)W T W (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12)p ≤ s(p∗, p, m)w2(cid:111) ⊆ (cid:110) A (cid:12) (cid:12) (cid:12)|||A|||p ≤ s(p∗, p, m)w2(cid:111) . So we have: H0 = ⊆ ⊆ (cid:110) (x, x+, x−) −→ xT W T W (x+ − x−)(cid:12) (cid:110) (x, x+, x−) −→ xT W T W (x+ − x−)(cid:12) (cid:110) (x, x+, x−) −→ xT A(x+ − x−)(cid:12) (cid:12)W ∈ Rn×m, |||W |||p ≤ w (cid:12) (cid:12) (cid:12)W ∈ Rn×m, (cid:12) (cid:12) (cid:12) (cid:12)W T W (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12)A ∈ Rm×m, |||A|||p ≤ s(p∗, p, m)w2(cid:111) (cid:111) (cid:12)p ≤ s(p∗, p, m)w2(cid:111) = Hs(p∗,p,m)w2 0 . 31 Zou and Liu Similarly, H1 ⊆ Hs(p∗,p,m)w2 1 . Given the training set S = {(xi, x+ i , x− i )}M i=1, we have: (cid:40) RS(H) = E σ sup |||W |||p≤w (i) ≤ E σ (cid:40) sup |||W |||p≤w M (cid:88) i=1 M (cid:88) i=1 σi σi (cid:2)xT i W T W (x+ i − x− i ) − (cid:15)(cid:107)W T W (x+ i − x− (cid:41) i )(cid:107)r∗(cid:3) (cid:2)xT i W T W (x+ i − x− i )(cid:3) (cid:41) (cid:40) + (cid:15) E σ sup |||W |||p≤w M (cid:88) i=1 (cid:2)−σi(cid:107)W T W (x+ i − x− (cid:41) i )(cid:107)r∗(cid:3) (cid:41) (A.18) (ii) = E σ (cid:40) sup |||W |||p≤w M (cid:88) i=1 σi (cid:2)xT i W T W (x+ i − x− i )(cid:3) (cid:40) + (cid:15) E σ sup |||W |||p≤w M (cid:88) i=1 (cid:2)σi(cid:107)W T W (x+ i − x− (cid:41) i )(cid:107)r∗(cid:3) (iii) = RS(H0) + (cid:15) RS(H1) (iv) ≤ RS(Hs(p∗,p,m)w2 0 ) + (cid:15) RS(Hs(p∗,p,m)w2 1 ), where σ is a Random Vector whose elements are i.i.d. Rademacher Random Variables and (i) comes from the subadditivity of sup function;(ii) is from the fact that −σi has the same distribution as σi, ∀i = 1, 2, . . . , M ; (iii) is by the definition of RS(H0) and RS(H1) and (iv) is from the monotone property of Rademacher Complexity and the fact that H0 ⊆ Hs(p∗,p,m)w2 and H1 ⊆ Hs(p∗,p,m)w2 0 and 1 . For RS(Hw Hw i=1, define the (cid:96)2-norm for a function in Hw . Secondly, we upper bound the Rademacher Complexity of Hw 0 ): Given the training set S = {(xi, x+ i=1 = {(zi)}M i , x− i )}M 1 0 0 as: ∀h ∈ Hw 0 , (cid:107)h(cid:107)2 := (cid:118) (cid:117) (cid:117) (cid:116) M (cid:88) i=1 [h(zi)]2, Define Hw (h(z1), h(z2), . . . , h(zM )) vh = (h(z1), h(z2), . . . , h(zM )) be the corresponding vector in Hw , we have that for any h ∈ Hw 0 (S), we have: 0 (S) = 0 0 and (cid:12) (cid:12)h ∈ Hw (cid:12) (cid:111) (cid:110) (cid:107)h(cid:107)2 = (cid:107)vh(cid:107)2. So we know that any δ-covering of Hw functional space, corresponds to a δ-covering of Hw Euclidean Space, i.e. 0 ((cid:8)h1, h2, * * * , hN (cid:9)) with respect to (cid:96)2 norm in the 0 (S) with respect to the (cid:96)2 norm in the         h1(z1) h1(z2) ... h1(zM )       ,          h2(z1) h2(z2) ... h2(zM ) , * * * ,      hN (z1) hN (z2) ... hN (zM )         . 32 Generalization Bounds for Adversarial Contrastive Learning So we have: N (δ; Hw 0 (S), (cid:107) * (cid:107)2) = N (δ; Hw 0 , (cid:107) * (cid:107)2) . (A.19) By the definition of Rademacher Complexity, we know that RS(Hw of the Rademacher Process with respect to Hw 0 (S), which is E[ 0 ) is just the expectation Xθ]. To use Lemma sup θ∈Hw 0 (S) 20, we must show that Rademacher Process is a sub-Gaussian Process with respect to some metric ρX . Denote the Euclidean metric by ρ2, we have: for Rademacher Process {Xθ, θ ∈ T}, ∀θ, (cid:101)θ ∈ T and λ ∈ R: (cid:104) E eλ(Xθ−X (cid:101)θ)(cid:105) (i) = E (cid:104) eλ((cid:104)σ,θ(cid:105)−(cid:104)σ,(cid:101)θ(cid:105))(cid:105) = E (cid:104) eλ((cid:104)σ,θ−(cid:101)θ(cid:105))(cid:105) (ii) ≤ (cid:104) eλσi(θi−(cid:101)θi)(cid:105) M (cid:89) i=1 E σi (iii) ≤ M (cid:89) i=1 λ2(θi−(cid:101)θi)2 2 e λ2 2 = e (cid:80)M i=1(θi−(cid:101)θi)2 λ2 2 ρ2 X (θ,(cid:101)θ), = e where σ is a Random Vector whose elements are i.i.d. Rademacher Random Variables and (i) is from the definition of Rademacher Process; (ii) is from the expectation property of i.i.d. random variables and (iii) is from Example 2.3 in Wainwright (2019). So we proved that the Rademacher Process is a sub-Gaussian Process with respect to the Euclidean metric ρ2. So by Lemma 20 and (9), we know that: ∀δ ∈ (0, D], RS(Hw 0 ) = E[ sup θ∈Hw 0 (S) (cid:34) Xθ] ≤ E sup θ,(cid:101)θ∈Hw 0 (S) (Xθ −X (cid:35) (cid:101)θ) ≤ 2E       (Xγ −Xγ(cid:48))   sup γ,γ(cid:48)∈Hw 0 (S) ρX (γ,γ(cid:48))≤δ +32J (δ/4; D), where D = sup θ,θ(cid:48)∈Hw 0 (S) (cid:107)θ − θ(cid:48)(cid:107)2 ≤ 2 sup θ∈Hw 0 (S) (cid:107)θ(cid:107)2 = 2 sup h∈Hw 0 (cid:107)h(cid:107)2 = 2 sup h∈Hw 0 (cid:118) (cid:117) (cid:117) (cid:116) M (cid:88) i=1 [h(zi)]2 √ (i) ≤ 2 M sup |||A|||p≤w 1≤i≤M √ (iii) ≤ 2 M sup |||A|||p≤w 1≤i≤M |xT i A(x+ i − x− i )| √ (ii) ≤ 2 M sup |||A|||p≤w 1≤i≤M (cid:107)xi(cid:107)p∗(cid:107)A(x+ i − x− i )(cid:107)p (A.20) (cid:107)xi(cid:107)p∗|||A|||p(cid:107)x+ i − x− i (cid:107)p √ (iv) ≤ 4 M P ∗P w, (cid:112)lnN (u; Hw and J (a; b) = (cid:82) b 0 , (cid:107) * (cid:107)2)du. Where (i) is from a the definition of f ; (ii) is from the Holder's Inequality; (iii) is a result of properties of matrix norm and (iv) is from the definition of P ∗ and P . Similar to the discussion of upper bound 0 (S), (cid:107) * (cid:107)2)du = (cid:82) b (cid:112)lnN (u; Hw a 33 Zou and Liu for D, for all h1, h2 ∈ Hw 0 , we have: (cid:107)h1 − h2(cid:107)2 = (cid:118) (cid:117) (cid:117) (cid:116) M (cid:88) [h1(zi) − h2(zi)]2 ≤ √ M sup 1≤i≤M |h1(zi) − h2(zi)| √ i=1 M sup 1≤i≤M √ M sup 1≤i≤M = (i) ≤ |xT i (A1 − A2)(x+ i − x− i )| (cid:107)xi(cid:107)p∗ |||A1 − A2|||p(cid:107)x+ i − x− i (cid:107)p (A.21) √ (ii) ≤ 2 M P ∗P |||A1 − A2|||p, where A1, A2 are the matrices corresponding to h1, h2, respectively and (i) is from the same argument as (ii), (iii) in (A.20) and (ii) is from the definition of P ∗ and P . Suppose NA = (cid:8)A1, * * * , AN (cid:9) is a with respect to |||*|||p , i.e.: (cid:12) (cid:12) (cid:12)|||A|||p ≤ w -covering of SA = δ 2P P ∗ A (cid:110) (cid:111) M √ (cid:12) (cid:12) (cid:12)A − Aj(cid:12) (cid:12) (cid:12) ∀A ∈ SA , ∃Aj ∈ NA, s.t. (cid:12) (cid:12)p ≤ (cid:12) (cid:12) (cid:12) (cid:12) δ 2P P ∗ √ . M Combine this with (A.21), let A be the matrix corresponding to h and Aj be the matrix corresponding to hj and let Nh = (cid:8)h1, h2, * * * , hN (cid:9), we have: ∀h ∈ Hw 0 , ∃hj ∈ Nh, s.t. (cid:107)h − hj(cid:107)2 ≤ 2 √ M P ∗P δ 2P P ∗ √ M = δ. So Nh is a δ-covering of Hw 0 with respect to (cid:107) * (cid:107)2 , so we have: N (δ; Hw 0 , (cid:107) * (cid:107)2) ≤ N ( δ 2P P ∗ √ M ; SA, |||*|||p). By Lemma 18, we know that: N (δ; Hw 0 , (cid:107) * (cid:107)2) ≤ N ( δ 2P P ∗ √ M (cid:32) ; SA, |||*|||p) ≤ 1 + √ M (cid:33)m2 4P P ∗w δ . (A.22) So we have: J (0; D) = (cid:90) D 0 (cid:113) ln N (u; Hw 0 , (cid:107) * (cid:107)2)du (cid:90) D (i) ≤ 0 (cid:118) (cid:117) (cid:117) (cid:116)m2ln (cid:32) 1 + √ M (cid:33) du 4P P ∗w u (cid:115) (cid:90) D 4P P ∗w u P P ∗wD 4√ M 0 √ (ii) ≤ m = 4m √ M √ du = 2m P P ∗w 4√ M (cid:90) D u− 1 2 du 0 (iii) ≤ 8mP P ∗w √ M , where (i) is from (A.22); (ii) is because that for any x ≥ 0, ln(1 + x) ≤ x and (iii) is from (A.20). So take δ −→ 0+, we have: RS(Hw 0 ) ≤ 32J (0; D) ≤ 256mP P ∗w √ M . 34 Generalization Bounds for Adversarial Contrastive Learning For RS(Hw define Hw have: 1 (S) = (cid:110) 1 ): The same as RS(Hw (h(z1), h(z2), . . . , h(zM )) 0 ), we consider (cid:96)2 norm for a function h ∈ Hw 1 and , by similar argument in (A.19), we (cid:111) (cid:12) (cid:12)h ∈ Hw (cid:12) 1 N (δ; Hw 1 (S), (cid:107) * (cid:107)2) = N (δ; Hw 1 , (cid:107) * (cid:107)2) . By the definition of Rademacher Complexity, we know that RS(Hw of the Rademacher Process with respect to Hw 1 (S), which is E[ 1 ) is just the expectation Xθ]. By Lemma 20 sup θ∈Hw 1 (S) and (9), we know that: ∀δ ∈ (0, D], RS(Hw 1 ) = E[ sup θ∈Hw 1 (S) sup θ,(cid:101)θ∈Hw 1 (S) (Xθ − X (cid:34) Xθ] ≤ E (cid:35) (cid:101)θ) ≤ 2E       (Xγ − Xγ(cid:48))   sup γ,γ(cid:48)∈Hw 1 (S) ρX (γ,γ(cid:48))≤δ +32J (δ/4; D), where D = sup θ,θ(cid:48)∈Hw 1 (S) (cid:107)θ − θ(cid:48)(cid:107)2 ≤ 2 sup θ∈Hw 1 (S) (cid:107)θ(cid:107)2 = 2 sup h∈Hw 1 (cid:107)h(cid:107)2 = 2 sup h∈Hw 1 (cid:118) (cid:117) (cid:117) (cid:116) M (cid:88) i=1 [h(zi)]2 √ (i) ≤ 2 M sup |||A|||p≤w 1≤i≤M (cid:107)A(x+ i − x− i )(cid:107)r∗ √ (ii) ≤ 2 M sup |||A|||p≤w 1≤i≤M |||A|||r∗(cid:107)x+ i − x− i (cid:107)r∗ √ (iii) ≤ 4 M R∗ sup |||A|||p≤w |||A|||r∗ √ (iv) ≤ 4 M R∗ sup |||A|||p≤w s(r∗, p, m)|||A|||p ≤ 4wR∗s(r∗, p, m) √ M , (cid:112)lnN (u; Hw (A.23) and J (a; b) = (cid:82) b 1 , (cid:107) * (cid:107)2)du. Where (i) is from a the definition of f ; (ii) is a result of the properties of matrix norm; (iii) is from the definition of R∗ and (iv) comes from Lemma 37. Similar to the discussion of upper bound for D, for all h1, h2 ∈ Hw 1 (S), (cid:107) * (cid:107)2)du = (cid:82) b (cid:112)lnN (u; Hw a 1 , we have: (cid:118) (cid:117) (cid:117) (cid:116) M (cid:88) i=1 √ = M sup 1≤i≤M (cid:107)h1 − h2(cid:107)2 = [h1(zi) − h2(zi)]2 ≤ √ M sup 1≤i≤M |h1(zi) − h2(zi)| (cid:107)(A1 − A2)(x+ i − x− i )(cid:107)r∗ √ (i) ≤ M sup 1≤i≤M |||A1 − A2|||r∗(cid:107)x+ i − x− i (cid:107)r∗ √ (ii) ≤ 2 M R∗|||A1 − A2|||r∗ (iii) ≤ 2R∗s(r∗, p, m) √ M |||A1 − A2|||p, (A.24) where A1, A2 are the matrices corresponding to h1, h2, respectively and (i) from the properties of matrix norm and (ii) is from the definition of R∗ and (iii) comes from Lemma 37. Suppose NA = (cid:8)A1, * * * , AN (cid:9) is a with respect to |||*|||p , i.e.: (cid:12) (cid:12) (cid:12)|||A|||p ≤ w -covering of SA = 2R∗s(r∗,p,m) A (cid:110) (cid:111) M √ δ (cid:12) (cid:12) (cid:12)A − Aj(cid:12) (cid:12) (cid:12) ∀A ∈ SA , ∃Aj ∈ NA, s.t. (cid:12) (cid:12)p ≤ (cid:12) (cid:12) (cid:12) (cid:12) 35 δ 2R∗s(r∗, p, m) √ . M Zou and Liu Combine this with (A.24), let A be the matrix corresponding to h and Aj be the matrix corresponding to hj and let Nh = (cid:8)h1, h2, * * * , hN (cid:9), we have: ∀h ∈ Hw 1 , ∃hj ∈ Nh, s.t. (cid:107)h − hj(cid:107)2 ≤ 2R∗s(r∗, p, m) √ M δ 2R∗s(r∗, p, m) √ = δ. M So Nh is a δ-covering of Hw 1 with respect to (cid:107) * (cid:107)2 , so we have: N (δ; Hw 1 , (cid:107) * (cid:107)2) ≤ N ( δ 2R∗s(r∗, p, m) √ M ; SA, |||*|||p). By Lemma 18, we know that: N (δ; Hw 1 , (cid:107) * (cid:107)2) ≤ N ( δ 2R∗s(r∗, p, m) (cid:32) √ M ; SA, |||*|||p) ≤ 1 + 4R∗s(r∗, p, m)w δ √ M (cid:33)m2 . (A.25) So we have: J (0; D) = (cid:90) D 0 (cid:113) ln N (u; Hw 1 , (cid:107) * (cid:107)2)du (cid:118) (cid:117) (cid:117) (cid:116)m2ln (cid:32) 1 + (cid:90) D (i) ≤ 0 4R∗s(r∗, p, m)w u √ (cid:33) M du (ii) ≤ m (cid:115) (cid:90) D 0 4R∗s(r∗, p, m)w √ u M du = 2m(cid:112)R∗s(r∗, p, m)w 4√ M (cid:90) D 0 u− 1 2 du = 4m(cid:112)R∗s(r∗, p, m)wD 4√ M (iii) ≤ 8mR∗s(r∗, p, m)w √ M , where (i) is from (A.25); (ii) is because that for any x ≥ 0, ln(1 + x) ≤ x and (iii) is from (A.23). So take δ −→ 0+, we have: RS(Hw 1 ) ≤ 32J (0; D) ≤ 256mR∗s(r∗, p, m)w √ M . Combine upper bounds of RS(Hw 0 ) and RS(Hw 1 ) with (A.18), we have: RS(H) ≤ RS(Hs(p∗,p,m)w2 0 ) + (cid:15) RS(Hs(p∗,p,m)w2 ) 1 √ ≤ 256mP P ∗s(p∗, p, m)w2 M + (cid:15) 256mR∗s(r∗, p, m)s(p∗, p, m)w2 √ M = 256m s(p∗, p, m)w2 √ (cid:16) = O (P P ∗ + (cid:15)R∗s(r∗, p, m)) m s(p∗, p, m)w2 (cid:17)(cid:17) . M M (P P ∗ + (cid:15)R∗s(r∗, p, m)) √ (cid:16) 36 Generalization Bounds for Adversarial Contrastive Learning A.9 Proof of Theorem 24 Theorem 24 Let U(x) = {x(cid:48)|(cid:107)x(cid:48) − x(cid:107)p ≤ (cid:15)} (i.e. consider the (cid:96)p attack), σ(0) = 0 with Lipschitz constant L and let F = (cid:8)Wdσ(Wd−1σ(* * * σ(W1x)))(cid:12) l , l = 1, . . . , d(cid:9). We then have: (cid:12)|||Wl|||F≤M F RS(H) = O   (cid:118) (cid:117) (cid:117) (cid:116) d (cid:88)  hlhl−1K √ √ d M  , where K = 2BF X,(cid:15) * (cid:0)BF X + + BF X − l=1 (cid:1), where BF X,(cid:15) = Ld−1 M F l max (cid:110) 1, m d (cid:89) l=1 1 2 − 1 p (cid:111) ((cid:107)X(cid:107)p,∞ +(cid:15)) , BF X = Ld−1 M F l max (cid:110) 1, m d (cid:89) l=1 1 2 − 1 p (cid:111) (cid:107)X(cid:107)p,∞. Lemma 39 If x∗ Before giving the proof, we firstly introduce some useful lemmas. (cid:12) i(cid:107)p ≤ (cid:15)(cid:9), then for 1 r∗ + 1 (cid:12)(cid:107)xi − x(cid:48) (cid:111) (cid:110) 1, m1− 1 i ∈ U(xi) = (cid:8)x(cid:48) (cid:107)x∗ r − 1 ((cid:107)X(cid:107)p,∞ + (cid:15)) . i (cid:107)r∗ ≤ max i p r = 1, we have: Proof [Proof of Lemma 39] We divide it into two cases. r∗ = 1 1. If p ≥ r∗, then by Holder's Inequality with 1 p + 1 s , we have: (cid:107)x∗ i (cid:107)r∗ ≤ sup (cid:107)1(cid:107)s * (cid:107)x∗ i (cid:107)p = (cid:107)1(cid:107)s * (cid:107)x∗ i (cid:107)p = m 1 s (cid:107)x∗ i (cid:107)p = m1− 1 r − 1 p (cid:107)x∗ i (cid:107)p, where the equality holds when all the entries are equal. 2. If p < r∗, by Lemma 35, we have (cid:107)x∗ i (cid:107)r∗ ≤ (cid:107)x∗ i equals to one and the others equal to zero. of the entries of x∗ i (cid:107)p, where the equality holds when one Then we have: (cid:107)x∗ i (cid:107)r∗ ≤ max ≤ max (cid:110) 1, m1− 1 r − 1 p (cid:110) 1, m1− 1 r − 1 p (cid:111) (cid:111) (cid:107)x∗ i (cid:107)p ≤ max (cid:110) 1, m1− 1 r − 1 p (cid:111) ((cid:107)xi(cid:107)p + (cid:107)xi − x∗ i (cid:107)p) ((cid:107)X(cid:107)p,∞ + (cid:15)) . Lemma 40 Let A ∈ Rm×n, b ∈ Rn, then we have: (cid:107)A * b(cid:107)2 ≤ |||A|||F * (cid:107)b(cid:107)2. Proof [Proof of Lemma 40] Let Ai be the rows of A, i = 1, 2, . . . , m, we have: (cid:107)A * b(cid:107)2 = (cid:118) (cid:117) (cid:117) (cid:116) m (cid:88) i=1 (Aib)2 (cid:118) (cid:117) (cid:117) (cid:116) m (cid:88) (i) ≤ i=1 (cid:107)Ai(cid:107)2 2 * (cid:107)b(cid:107)2 2 = (cid:118) (cid:117) (cid:117) (cid:116) m (cid:88) i=1 (cid:107)Ai(cid:107)2 2 * where (i) is from Holder's Inequality. 37 (cid:113) (cid:107)b(cid:107)2 2 = |||A|||F * (cid:107)b(cid:107)2, Zou and Liu Lemma 41 Suppose σ is a L-Lipschitz function, then the elementwise vector map corre- sponding to σ is also L-Lipschitz with respect to (cid:107) * (cid:107)2. Proof [Proof of Lemma 41] (cid:107)σ(x) − σ(y)(cid:107)2 = (i) ≤ (cid:118) (cid:117) (cid:117) (cid:116) n (cid:88) i=1 (cid:118) (cid:117) (cid:117) (cid:116) n (cid:88) i=1 (σ(x)i − σ(y)i)2 = (cid:118) (cid:117) (cid:117) (cid:116) n (cid:88) i=1 (σ(xi) − σ(yi))2 L2(xi − yi)2 = L (cid:118) (cid:117) (cid:117) (cid:116) n (cid:88) (xi − yi)2 = L * (cid:107)x − y(cid:107)2, i=1 where (i) is because σ is L-Lipschitz. Now we can turn to the proof of Theorem 24. Proof [Proof of Theorem 24] In this case, let U(x) = (cid:8)x(cid:48)(cid:12) (cid:12)(cid:107)x(cid:48) − x(cid:107)p ≤ (cid:15)(cid:9), we have: F = (cid:8)x −→ Wdσ(Wd−1σ(* * * σ(W1x))) (cid:12) (cid:12) |||Wl|||F ≤ M F l , l = 1, . . . , d(cid:9) , (cid:26) H = h(x, x+, x−) = min x(cid:48)∈U (x) (cid:0)f (x(cid:48))T (cid:0)f (x+) − f (x−)(cid:1)(cid:1) |f ∈ F (cid:27) . l = (cid:8)Wl ∈ Rhl×hl−1(cid:12) (cid:12)|||Wl|||F ≤ M F l Let SF and define: (cid:9) , l = 1, 2, . . . , d. Let CF l be the δl-covering of SF l (cid:110) F c = f c : x −→ W c d σ (cid:0)W c d−1σ (* * * σ(W c 1 x))(cid:1) (cid:12) (cid:12)W c (cid:12) l ∈ CF l , l = 1, 2, . . . , d (cid:111) ⊆ F, (cid:26) Hc = hc(x, x+, x−) = min x(cid:48)∈U (x) (cid:0)f (x(cid:48))T (cid:0)f (x+) − f (x−)(cid:1)(cid:1) |f ∈ F c (cid:27) ⊆ H. Similar to the proof of Theorem 22, we know that the Rademacher Process is a sub-Gaussian Process with respect to the Euclidean metric, which induces the (cid:96)2 norm. Given the training set S = {(xi, x+ i , x− i )}M i=1 (cid:44) {zi}M i=1, define the (cid:96)2-norm for a function in H as: ∀h ∈ H, (cid:107)h(cid:107)2 := (cid:118) (cid:117) (cid:117) (cid:116) M (cid:88) [h(zi)]2. i=1 (cid:111) (cid:110) (h(z1), h(z2), . . . , h(zM )) (cid:12) (cid:12) , we have that for any h ∈ H and vh = (cid:12)h ∈ H Define H(S) = (h(z1), h(z2), . . . , h(zM )) be the corresponding vector in H(S), we have (cid:107)h(cid:107)2 = (cid:107)vh(cid:107)2. So we know that any δ-covering of H ((cid:8)h1, h2, * * * , hN (cid:9)) with respect to (cid:96)2 norm in the functional space, corresponds to a δ-covering of H(S) with respect to the (cid:96)2 norm in the Euclidean Space, i.e.         h1(z1) h1(z2) ... h1(zM )       ,       , * * * ,         hN (z1) hN (z2) ... hN (zM )         . h2(z1) h2(z2) ... h2(zM ) 38 Generalization Bounds for Adversarial Contrastive Learning So we have: N (δ; H(S), (cid:107) * (cid:107)2) = N (δ; H, (cid:107) * (cid:107)2) . By the definition of Rademacher Complexity, we know that RS(H) is just the expectation of the Rademacher Process with respect to H(S), which is E[ sup θ∈H(S) Xθ]. So by Lemma 20 and (9), we know that: ∀δ ∈ (0, D]: RS(H) = E[ sup θ∈H(S) Xθ] ≤ E (cid:34) (Xθ −X sup θ,(cid:101)θ∈H(S) (cid:35) (cid:101)θ)   ≤ 2E   sup γ,γ(cid:48)∈H(S) (cid:107)γ(cid:48)−γ(cid:107)2≤δ (Xγ −Xγ(cid:48))   + 32J (δ/4; D), where D = sup (cid:107)θ − θ(cid:48)(cid:107)2 ≤ 2 sup θ∈H(S) θ,θ(cid:48)∈H(S) (cid:107)θ(cid:107)2 = 2sup h∈H (cid:107)h(cid:107)2 = 2sup h∈H (cid:118) (cid:117) (cid:117) (cid:116) M (cid:88) i=1 [h(zi)]2 ≤ 2 √ |h(zi)|, M sup h∈H 1≤i≤M (A.26) and J (a; b) = (cid:82) b a (cid:112)lnN (u; H(S), (cid:107) * (cid:107)2)du = (cid:82) b (cid:112)lnN (u; H, (cid:107) * (cid:107)2)du. a For any f ∈ F, x ∈ X , let xl be the output of x passing through the first l − 1 layers, we have: (cid:107)f (x)(cid:107)2 = (cid:107)Wdσ(Wd−1xd−1)(cid:107)2 (i) ≤ |||Wd|||F *(cid:107)σ(Wd−1xd−1)(cid:107)2 (ii) = |||Wd|||F *(cid:107)σ(Wd−1xd−1)−σ(0)(cid:107)2 (iii) ≤ LM F d (cid:107)Wd−1xd−1(cid:107)2 ≤ * * * ≤ Ld−1 d (cid:89) l=2 M F l (cid:107)W1x(cid:107)2 ≤ Ld−1 d (cid:89) l=1 M F l (cid:107)x(cid:107)2 (iv) ≤ Ld−1 d (cid:89) l=1 M F l max (cid:110) 1, m 1 2 − 1 p (cid:111) (cid:107)x(cid:107)p ≤ Ld−1 M F l max (cid:110) 1, m d (cid:89) l=1 1 2 − 1 p (cid:111) (cid:107)X(cid:107)p,∞, where (i) is from Lemma 40; (ii) is from the fact that σ(0) = 0; (iii) comes from the assumption d and (iv) is attained by setting r = r∗ = 2 in the that σ is L-Lipschitz and |||Wd|||F ≤ M F proof of Lemma 39. To simplify the notations, we define: BF X,(cid:15) = Ld−1 M F l max (cid:110) 1, m d (cid:89) l=1 So we have: Similarly, we have: 1 2 − 1 p (cid:111) ((cid:107)X(cid:107)p,∞ +(cid:15)) , BF X = Ld−1 M F l max (cid:110) 1, m d (cid:89) l=1 1 2 − 1 p (cid:111) (cid:107)X(cid:107)p,∞. ∀x ∈ X , f ∈ F, (cid:107)f (x)(cid:107)2 ≤ BF X . (A.27) ∀x ∈ X , f ∈ F, ∀ (cid:107)x(cid:48) − x(cid:107)p ≤ (cid:15), (cid:107)f (x(cid:48))(cid:107)2 ≤ BF X,(cid:15). (A.28) 39 Zou and Liu For any h ∈ H, z ∈ X 3, let x∗ = arg min (cid:107)x(cid:48)−x(cid:107)p≤(cid:15) of x∗ passing through the first l − 1 layers, we have: f (x(cid:48))T (f (x+) − f (x−)) and let xl be the output |h(z)| = | inf (cid:107)x(cid:48)−x(cid:107)p≤(cid:15) f (x(cid:48))T (cid:0)f (x+) − f (x−)(cid:1) | = |f (x∗)T (cid:0)f (x+) − f (x−)(cid:1) | ≤ (cid:107)f (x∗)(cid:107)2 * (cid:107)f (x+) − f (x−)(cid:107)2 (i) ≤ BF X,(cid:15) * (BF X + + BF X −), where (i) is from (A.27) and (A.28). So we have: √ (i) ≤ 2 D M sup h∈H 1≤i≤M √ |h(zi)| ≤ 2 M BF X,(cid:15) * (BF X + + BF X −) (cid:44) √ M K, (A.29) where (i) is from (A.26). Now, we need to find the smallest distance between H and Hc, i.e. sup h∈H inf hc∈Hc (cid:107)h − hc(cid:107)2. i ), i = 1, 2, . . . , M , given h and hc such that |||Wl − W c l |||F ≤ δl, l = 1, 2, . . . , d, √ M max 1≤i≤M |h(zi) − hc(zi)|. For any i , x− By the discussion in (A.26), we have (cid:107)h − hc(cid:107)2 ≤ zi = (xi, x+ we have: |h(zi)−hc(zi)| = (cid:12) (cid:12) i)T (cid:0)f (x+ i ) − f (x− f (x(cid:48) inf i−xi(cid:107)p≤(cid:15) (cid:107)x(cid:48) i )(cid:1)− inf (cid:107)x(cid:48) i−xi(cid:107)p≤(cid:15) f c(x(cid:48) i)T (cid:0)f c(x+ i ) − f c(x− i )(cid:1) (cid:12) (cid:12). Let x∗ i = arg inf (cid:107)x(cid:48) i−xi(cid:107)p≤(cid:15) and let f (x(cid:48) i)T (cid:0)f (x+ i ) − f (x− i )(cid:1) and xc f c(x(cid:48) i)T (cid:0)f c(x+ i ) − f c(x− i )(cid:1), i = arg inf (cid:107)x(cid:48) i−xi(cid:107)p≤(cid:15) yi = (cid:26) xc i x∗ i Then we have: i )T (cid:0)f (x+ f (x∗ otherwise i ) − f (x− i )(cid:1) ≥ f c(xc i )T (cid:0)f c(x+ i ) − f c(x− i )(cid:1) . |h(zi) − hc(zi)| = |f (x∗ i )T (cid:0)f (x+ i ) − f (x− i )(cid:1) − f c(xc i )T (cid:0)f c(x+ i ) − f c(x− i )(cid:1) | (i) ≤ |f (yi)T (cid:0)f (x+ = |f (yi)T (cid:0)f (x+ i ) − f (x− i ) − f (x− + f c(yi)T (cid:0)f (x+ i )(cid:1) − f c(yi)T (cid:0)f c(x+ i )(cid:1) − f c(yi)T (cid:0)f (x+ i ) − f (x− i )(cid:1) | i ) − f c(x− i )(cid:1) i ) − f (x− i )(cid:1) − f c(yi)T (cid:0)f c(x+ i ) − f c(x− i )(cid:1) | (ii) ≤ | (f (yi) − f c(yi))T (cid:0)f (x+ i ) − f (x− i )(cid:1) | i ) − f c(x+ + |f c(yi)T (cid:0)f (x+ i )(cid:1) | + |f c(yi)T (cid:0)f (x− i ) − f c(x− i )(cid:1) | (iii) ≤ (BF X + + BF X −)(cid:107)f (yi) − f c(yi)(cid:107)2 + BF + BF i )(cid:107)2, i ) − f c(x− X,(cid:15)(cid:107)f (x− X,(cid:15)(cid:107)f (x+ i ) − f c(x+ i )(cid:107)2 (A.30) 40 Generalization Bounds for Adversarial Contrastive Learning where (i) is easily verified by the definition of yi; (ii) is from the triangle inequality and (iii) is from (A.27) and (A.28). Define ga b (*) as: Then we have: b (y) = Wbσ (Wb−1σ (* * * Wa+1σ (W c ga a * * * σ(W c 1 y)))) . (cid:107)f (yi) − f c(yi)(cid:107)2 = (cid:107)g0 = (cid:107)g0 d(yi) − gd d(yi) − g1 d(yi)(cid:107)2 d(yi) + g1 d(yi) − g2 d(yi) + * * * + gd−1 (yi) − gd d(yi)(cid:107)2 d (i) ≤ (cid:107)g0 d(yi) − g1 d(yi)(cid:107)2 + * * * + (cid:107)gd−1 (yi) − gd d(yi)(cid:107)2, d where (i) is from the triangle inequality. Then we calculate (cid:107)gl−1 d (yi) − gl d(yi)(cid:107)2, l = 1, 2, . . . , d: (cid:107)gl−1 d (yi) − gl d(yi)(cid:107)2 = (cid:107)Wdσ (cid:16) (cid:17) gl−1 d−1(yi) − Wdσ (cid:16) gl d−1(yi) (cid:17) (cid:107)2 (i) ≤ |||Wd|||F * (cid:107)σ (cid:16) (cid:17) gl−1 d−1(yi) − σ (cid:16) (cid:17) gl d−1(yi) (cid:107)2 d−1(yi) − gl d−1(yi)(cid:107)2 ≤ * * * (ii) ≤ LM F (iii) ≤ Ld−l * d (cid:107)gl−1 d (cid:89) M F j * (cid:107)Wlσ (cid:16) (cid:17) gl−1 l−1(yi) − W c l σ (cid:16) (cid:17) gl−1 l−1(yi) (cid:107)2 (A.31) j=l+1 = Ld−l * d (cid:89) j=l+1 M F j * (cid:107) (Wl − W c l ) σ (cid:16) (cid:17) gl−1 l−1(yi) (cid:107)2 (iv) ≤ Ld−l * d (cid:89) M F j * δl * (cid:107)σ (cid:16) (cid:17) gl−1 l−1(yi) (cid:107)2, j=l+1 where (i) is from Lemma 40; (ii) comes from the assumption that σ is L-Lipschitz and |||Wd|||F ≤ M F b (*) and (iv) is from Lemma 40 and the choice of hc when h is fixed, which means that |||Wl − W c d ; (iii) is from the definition of ga l |||F ≤ δl. Next, we upper bound (cid:107)σ (cid:16) (cid:17) gl−1 l−1(yi) (cid:107)2: (cid:16) (cid:107)σ gl−1 l−1(yi) (cid:17) (cid:107)2 = (cid:107)σ (cid:16) (cid:17) gl−1 l−1(yi) − σ(0)(cid:107)2 (i) ≤ L * (cid:107)gl−1 l−1(yi)(cid:107)2 = L * (cid:107)W c l−1σ (cid:16) gl−2 l−2(yi) (cid:17) (cid:107)2 (ii) (cid:12) ≤ L * (cid:12) (cid:12) (cid:12)W c (cid:12) (cid:12) l−1 (cid:12) (cid:12) (cid:12) (cid:12)F * (cid:107)σ (cid:12) (cid:12) (cid:16) gl−2 l−2(yi) (cid:17) (cid:107)2 (iii) ≤ L M F l−1(cid:107)σ (cid:16) (cid:17) gl−2 l−2(yi) (cid:107)2 ≤ * * * ≤ Ll−1 * l−1 (cid:89) j=1 M F j * (cid:107)yi(cid:107)2, 41 (A.32) Zou and Liu where (i) is because σ is L-Lipschitz; (ii) is from Lemma 40 and (iii) is because (cid:12) (cid:12) (cid:12) (cid:12)W c (cid:12) (cid:12) M F l−1 l−1. From (A.31) and (A.32) we have: (cid:12) (cid:12) (cid:12) (cid:12)F (cid:12) (cid:12) ≤ (cid:107)gl−1 d (yi) − gl d(yi)(cid:107)2 ≤ Ld−1 (i) ≤ Ld−1 where (i) is from Lemma 39. Similarly: (cid:81)d (cid:81)d j=1 M F j M F l j=1 M F j M F l δl(cid:107)yi(cid:107)2 δl max (cid:110) 1, m 1 2 − 1 p (cid:111) ((cid:107)X(cid:107)p,∞ + (cid:15)) = BF X,(cid:15) δl M F l , (cid:107)gl−1 d (cid:107)gl−1 d (x+ i ) − gl d(x+ i )(cid:107)2 ≤ Ld−1 ≤ Ld−1 (x− i ) − gl d(x− i )(cid:107)2 ≤ Ld−1 ≤ Ld−1 (cid:81)d (cid:81)d (cid:81)d (cid:81)d j=1 M F j M F l j=1 M F j M F l j=1 M F j M F l j=1 M F j M F l δl(cid:107)x+ i (cid:107)2 δl max (cid:110) 1, m δl(cid:107)x− i (cid:107)2 δl max (cid:110) 1, m 1 2 − 1 p 1 2 − 1 p (cid:111) (cid:111) (cid:107)X +(cid:107)p,∞ = BF X + (cid:107)X −(cid:107)p,∞ = BF X − δl M F l , δl M F l . Combining the above with (A.30) yields: |h(zi) − hc(zi)| ≤ (cid:0)BF (cid:1) (cid:16) (cid:107)g0 d(yi) − g1 d(yi)(cid:107)2 + * * * + (cid:107)gd−1 d (yi) − gd d(yi)(cid:107)2 X + + BF X − (cid:16) + BF X,(cid:15) (cid:107)g0 d(x+ i ) − g1 d(x+ i )(cid:107)2 + * * * + (cid:107)gd−1 d (cid:16) + BF X,(cid:15) (cid:107)g0 d(x− i ) − g1 d(x− i )(cid:107)2 + * * * + (cid:107)gd−1 d (x+ i ) − gd d(x+ i )(cid:107)2 (x− i ) − gd d(x− i )(cid:107)2 (cid:17) (cid:17) (cid:17) = (BF X + + BF X −)BF X,(cid:15) d (cid:88) l=1 δl M F l + BF X,(cid:15)BF X + d (cid:88) l=1 δl M F l + BF X,(cid:15)BF X − d (cid:88) l=1 δl M F l = 2BF X,(cid:15)(BF X + + BF X −) d (cid:88) l=1 δl M F l = K d (cid:88) l=1 δl M F l . So (cid:107)h − hc(cid:107)2 = √ M max 1≤i≤M |h(zi) − hc(zi)| ≤ √ M (cid:80)d l=1 Kδl M F l . Let δl = M F l δ √ M dK , we have: (cid:107)h − hc(cid:107)2 ≤ √ M d (cid:88) l=1 K M F l * M F l δ √ M dK ≤ δ. Then: ∀h ∈ H, ∃hc ∈ Hc s.t. (cid:107)h − hc(cid:107)2 ≤ δ, which means that sup h∈H choosing δl = M F l δ √ M dK . inf hc∈Hc (cid:107)h − hc(cid:107)2 ≤ δ when 42 Generalization Bounds for Adversarial Contrastive Learning So Hc is a δ-covering of H, and N (δ; H, (cid:107) * (cid:107)2) ≤ |Hc| = (cid:81)d l , |||*|||F ) ≤ l | = N ( M F l δ √ M 1 + 2dK δ (cid:17)hl×hl−1 ; SF know that |CF dK (cid:16) M √ l=1 |CF . So we have: l |. By Lemma 18 we N (δ; H, (cid:107) * (cid:107)2) ≤ |Hc| = (cid:32) |CF l | ≤ 1 + √ 2dK δ M d (cid:89) l=1 (cid:33)(cid:80)d l=1 hl*hl−1 . (A.33) So we can conclude that: J (0; D) = (cid:90) D 0 (cid:112)ln N (u; H, (cid:107) * (cid:107)2)du (cid:90) D (i) ≤ 0 (cid:118) (cid:117) (cid:117) (cid:116) (cid:32) d (cid:88) (cid:33) (cid:32) hl * hl−1 ln 1 + √ 2dK u M (cid:33) du (cid:118) (cid:117) (cid:117) (cid:116) d (cid:88) (ii) ≤ l=1 hl * hl−1 (cid:115) (cid:90) D 0 √ 2dK u M du = l=1 (cid:118) (cid:117) (cid:117) (cid:116)2dK d (cid:88) l=1 hl * hl−1 (cid:90) D 4√ M u− 1 2 du 0 (cid:118) (cid:117) (cid:117) (cid:116)2dKD = 2 d (cid:88) l=1 hl * hl−1 4√ M √ (iii) ≤ 2 (cid:118) (cid:117) (cid:117) 2 (cid:116) d (cid:88) l=1 hl * hl−1 √ √ M , dK where (i) is from (A.33); (ii) comes from the fact that ln(1 + x) ≤ x, ∀x ≥ 0 and (iii) comes from (A.29).   Since we shows that RS(H) ≤ 2E δ −→ 0+, we have:   sup γ,γ(cid:48)∈H(S) (cid:107)γ(cid:48)−γ(cid:107)2≤δ (Xγ − Xγ(cid:48))   + 32J (δ/4; D) before, take RS(H) ≤ 32J (0; D) ≤ 64 √ (cid:118) (cid:117) (cid:117) 2 (cid:116) d (cid:88) l=1 hl * hl−1 √ √ dK M = O A.10 Proof of Theorem 26   (cid:118) (cid:117) (cid:117) (cid:116) d (cid:88) √ √ dK  M  . hl * hl−1 l=1 Theorem 26 Let U(x) = {x(cid:48)|(cid:107)x(cid:48) − x(cid:107)p ≤ (cid:15)} (i.e. consider the (cid:96)p attack), σ(0) = 0 with Lip- (cid:111) schitz constant L; moreover, let F = . , l=1, . . . ,d We then have: (cid:110) Wdσ(Wd−1σ(* * *σ(W1x)))(cid:12) (cid:12)(cid:107)Wl(cid:107)1,∞≤M 1,∞ l RS(H) = O  where K0 = 2B1,∞ X,(cid:15) * (cid:0)B(cid:48) X + + B(cid:48) X −  (cid:118) (cid:117) (cid:117) (cid:116) d (cid:88) hlhl−1 (cid:112) dK0K1 √ M  ,  l=1 (cid:1) , K1 = K0 2 (cid:16) + B(cid:48) X,(cid:15) * X + + B1,∞ B1,∞ X − (cid:17) , 43 Zou and Liu where B(cid:48) X,(cid:15) = Ld−1 B1,∞ X,(cid:15) = Ld−1 d (cid:89) l=1 d (cid:89) l=1 hlM 1,∞ l m1− 1 p ((cid:107)X(cid:107)p,∞ + (cid:15)) , B(cid:48) X = Ld−1 d (cid:89) l=1 hlM 1,∞ l m1− 1 p (cid:107)X(cid:107)p,∞, M 1,∞ l ((cid:107)X(cid:107)p,∞ + (cid:15)) , B1,∞ X = Ld−1 d (cid:89) l=1 M 1,∞ l (cid:107)X(cid:107)p,∞. Before giving the proof, we firstly introduce some useful lemmas. Lemma 42 Let A ∈ Rm×n, b ∈ Rn, then we have: (cid:107)A * b(cid:107)∞ ≤ (cid:107)A(cid:107)1,∞ * (cid:107)b(cid:107)∞. Proof [Proof of Lemma 42] Let Ai be the rows of A, i = 1, 2, . . . , m, we have: (cid:107)A * b(cid:107)∞ = max 1≤i≤m |Aib| (i) ≤ max 1≤i≤m ((cid:107)Ai(cid:107)1 * (cid:107)b(cid:107)∞) = (cid:107)A(cid:107)1,∞ * (cid:107)b(cid:107)∞, where (i) is from the Holder's Inequality. Lemma 43 Let A ∈ Rm×n, b ∈ Rn, then we have: (cid:107)A * b(cid:107)1 ≤ (cid:107)A(cid:107)∞,1 * (cid:107)b(cid:107)1 ≤ m(cid:107)A(cid:107)1,∞ * (cid:107)b(cid:107)1. Proof [Proof of Lemma 43] Let Ai be the rows of A, i = 1, 2, . . . , m, we have: (cid:107)A * b(cid:107)1 = (i) ≤ |Aib| m (cid:88) i=1 m (cid:88) i=1 ((cid:107)Ai(cid:107)∞ * (cid:107)b(cid:107)1) = (cid:107)A(cid:107)∞,1 * (cid:107)b(cid:107)1, where (i) is from the Holder's Inequality. And we have: (cid:107)A(cid:107)∞,1 = (cid:107) ((cid:107)A1(cid:107)∞, * * * , (cid:107)Am(cid:107)∞) (cid:107)1 (i) ≤ (cid:107) ((cid:107)A1(cid:107)1, * * * , (cid:107)Am(cid:107)1) (cid:107)1 (ii) ≤ m(cid:107) ((cid:107)A1(cid:107)1, * * * , (cid:107)Am(cid:107)1) (cid:107)∞ = m(cid:107)A(cid:107)1,∞, where (i) is from the fact that (cid:107)x(cid:107)∞ ≤ (cid:107)x(cid:107)1 and (ii) is the from the fact that for all x ∈ Rm, (cid:107)x(cid:107)1 ≤ m(cid:107)x(cid:107)∞. So we have: (cid:107)A * b(cid:107)1 ≤ (cid:107)A(cid:107)∞,1 * (cid:107)b(cid:107)1 ≤ m(cid:107)A(cid:107)1,∞ * (cid:107)b(cid:107)1. Lemma 44 Suppose σ is a L-Lipschitz function, then the elementwise vector map corre- sponding to σ is also L-Lipschitz with respect to (cid:107) * (cid:107)∞. Proof [Proof of Lemma 44] (cid:107)σ(x) − σ(y)(cid:107)∞ = max 1≤i≤n |σ(x)i − σ(y)i| = max 1≤i≤n |σ(xi) − σ(yi)| (i) ≤ max 1≤i≤n L|xi − yi| = L * (cid:107)x − y(cid:107)∞, 44 Generalization Bounds for Adversarial Contrastive Learning where (i) is because σ is L-Lipschitz. Now we can turn to the proof of Theorem 26. Proof [Proof of Theorem 26] In this case, let U(x) = (cid:8)x(cid:48)(cid:12) (cid:12)(cid:107)x(cid:48) − x(cid:107)p ≤ (cid:15)(cid:9), we have: F = (cid:110) x −→ Wdσ(Wd−1σ(* * * σ(W1x))) (cid:12) (cid:12) (cid:107)Wl(cid:107)1,∞ ≤ M 1,∞ l , l = 1, . . . , d (cid:111) , (cid:26) H = h(x, x+, x−) = min x(cid:48)∈U (x) (cid:0)f (x(cid:48))T (cid:0)f (x+) − f (x−)(cid:1)(cid:1) |f ∈ F (cid:27) . (cid:110) Wl ∈ Rhl×hl−1(cid:12) (cid:12)(cid:107)Wl(cid:107)1,∞ ≤ M 1,∞ l (cid:111) , l = 1, 2, . . . , d. Let C1,∞ l be the δl-covering l = Let S1,∞ of S1,∞ l and define: (cid:110) F c = f c : x −→ W c d σ (cid:0)W c d−1σ (* * * σ(W c 1 x))(cid:1) (cid:12) (cid:12)W c (cid:12) l ∈ C1,∞ l , l = 1, 2, . . . , d (cid:111) ⊆ F, (cid:26) Hc = hc(x, x+, x−) = min x(cid:48)∈U (x) (cid:0)f (x(cid:48))T (cid:0)f (x+) − f (x−)(cid:1)(cid:1) |f ∈ F c (cid:27) ⊆ H. Similar to the proof of Theorem 22, we know that the Rademacher Process is a sub-Gaussian Process with respect to the Euclidean metric, which induces the (cid:96)2 norm. i , x− Similar to the proof of Theorem 24, given the training set S = {(xi, x+ (cid:44) {zi}M i )}M i=1 i=1, define the (cid:96)2-norm for a function in H as: ∀h ∈ H, (cid:107)h(cid:107)2 := (cid:118) (cid:117) (cid:117) (cid:116) M (cid:88) i=1 [h(zi)]2. (cid:110) Define H(S) = Theorem 24, we have: (h(z1), h(z2), . . . , h(zM )) (cid:12) (cid:12) (cid:12)h ∈ H (cid:111) , with the same argument as in proof of and N (δ; H(S), (cid:107) * (cid:107)2) = N (δ; H, (cid:107) * (cid:107)2) , RS(H) = E[ sup θ∈H(S) Xθ]. So by Lemma 20 and (9), we know that: ∀δ ∈ (0, D]: RS(H) = E[ sup θ∈H(S) Xθ] ≤ E (cid:34) sup θ,(cid:101)θ∈H(S) (Xθ −X (cid:35) (cid:101)θ)   ≤ 2E (Xγ −Xγ(cid:48))   sup γ,γ(cid:48)∈H(S) (cid:107)γ(cid:48)−γ(cid:107)2≤δ  +32J (δ/4; D), where D = sup (cid:107)θ − θ(cid:48)(cid:107)2 ≤ 2 sup θ∈H(S) θ,θ(cid:48)∈H(S) (cid:107)θ(cid:107)2 = 2sup h∈H (cid:107)h(cid:107)2 = 2sup h∈H (cid:118) (cid:117) (cid:117) (cid:116) M (cid:88) i=1 [h(zi)]2 ≤ 2 √ and J (a; b) = (cid:82) b a (cid:112)lnN (u; H(S), (cid:107) * (cid:107)2)du = (cid:82) b a (cid:112)lnN (u; H, (cid:107) * (cid:107)2)du 45 |h(zi)|, M sup h∈H 1≤i≤M (A.34) Zou and Liu Then for any f ∈ F, x ∈ X , let xl be the output of x passing through the first l − 1 layers, we have: (cid:107)f (x)(cid:107)∞ = (cid:107)Wdσ(Wd−1xd−1)(cid:107)∞ (i) ≤ (cid:107)Wd(cid:107)1,∞ * (cid:107)σ(Wd−1xd−1)(cid:107)∞ (ii) = (cid:107)Wd(cid:107)1,∞ * (cid:107)σ(Wd−1xd−1) − σ(0)(cid:107)∞ (iii) ≤ LM 1,∞ d (cid:107)Wd−1xd−1(cid:107)∞ ≤ * * * ≤ Ld−1 d (cid:89) M 1,∞ l l=2 (cid:107)W1x(cid:107)∞ ≤ Ld−1 M 1,∞ l (cid:107)x(cid:107)∞ (iv) ≤ Ld−1 d (cid:89) l=1 = Ld−1 d (cid:89) l=1 M 1,∞ l (cid:107)x(cid:107)p ≤ Ld−1 d (cid:89) l=1 M 1,∞ l (cid:107)X(cid:107)p,∞, d (cid:89) M 1,∞ l max (cid:8)1, m−p(cid:9) (cid:107)x(cid:107)p l=1 where (i) is from Lemma 42; (ii) is from the fact that σ(0) = 0; (iii) comes from the assumption that σ is L-Lipschitz and |||Wd|||1,∞ ≤ M 1,∞ and (iv) is attained by setting r = 1, r∗ = ∞ in the proof of Lemma 39. To simplify the notations, we define: d B1,∞ X = Ld−1 * d (cid:89) l=1 M 1,∞ l * (cid:107)X(cid:107)p,∞, B(cid:48) X = Ld−1 * B1,∞ X,(cid:15) = Ld−1 * d (cid:89) l=1 So: M 1,∞ l * ((cid:107)X(cid:107)p,∞ + (cid:15)) , B(cid:48) X,(cid:15) = Ld−1 * (cid:33) hl * M 1,∞ l m1− 1 p * (cid:107)X(cid:107)p,∞ (cid:33) hl * M 1,∞ l m1− 1 p * ((cid:107)X(cid:107)p,∞ + (cid:15)) . (cid:32) d (cid:89) l=1 (cid:32) d (cid:89) l=1 ∀x ∈ X , f ∈ F, (cid:107)f (x)(cid:107)∞ ≤ B1,∞ X . Similarly, we have: Similarly, ∀x ∈ X , f ∈ F, ∀ (cid:107)x(cid:48) − x(cid:107)p ≤ (cid:15), (cid:107)f (x(cid:48))(cid:107)∞ ≤ B1,∞ X,(cid:15) . (A.35) (cid:107)f (x)(cid:107)1 = (cid:107)Wdσ(Wd−1xd−1)(cid:107)1 (i) ≤ hd * (cid:107)Wd(cid:107)1,∞ * (cid:107)σ(Wd−1xd−1)(cid:107)1 (ii) = hd * (cid:107)Wd(cid:107)1,∞ * (cid:107)σ(Wd−1xd−1) − σ(0)(cid:107)1 (iii) ≤ hd * L * M 1,∞ d (cid:107)Wd−1xd−1(cid:107)1 ≤ * * * d (cid:89) ≤ Ld−1 hlM 1,∞ l (cid:107)W1x(cid:107)1 ≤ Ld−1 d (cid:89) l=1 hlM 1,∞ l (cid:107)x(cid:107)1 l=2 (cid:32) d (cid:89) (iv) ≤ Ld−1 (cid:33) hlM 1,∞ l (cid:110) 1, m1− 1 p (cid:111) max (cid:107)x(cid:107)p = Ld−1 l=1 (cid:33) hlM 1,∞ l (cid:32) d (cid:89) l=1 m1− 1 p (cid:107)x(cid:107)p ≤ Ld−1 (cid:33) hlM 1,∞ l (cid:32) d (cid:89) l=1 m1− 1 p (cid:107)X(cid:107)p,∞, 46 Generalization Bounds for Adversarial Contrastive Learning where (i) is from Lemma 43; (ii) is from the fact that σ(0) = 0; (iii) comes from the assumption that σ is L-Lipschitz and |||Wd|||1,∞ ≤ M 1,∞ and (iv) is attained by setting r = ∞, r∗ = 1 in the proof of Lemma 39. d So we know that: Similarly, we have: ∀x ∈ X , f ∈ F, (cid:107)f (x)(cid:107)1 ≤ B(cid:48) X . (A.36) ∀x ∈ X , f ∈ F, ∀ (cid:107)x(cid:48) − x(cid:107)p ≤ (cid:15), (cid:107)f (x(cid:48))(cid:107)1 ≤ B(cid:48) X,(cid:15). (A.37) For any h ∈ H, z ∈ X 3, let x∗ = arg min (cid:107)x(cid:48)−x(cid:107)p≤(cid:15) of x∗ passing through the first l − 1 layers, we have: f (x(cid:48))T (f (x+) − f (x−)) and let xl be the output |h(z)| = | inf (cid:107)x(cid:48)−x(cid:107)p≤(cid:15) f (x(cid:48))T (cid:0)f (x+) − f (x−)(cid:1) | = |f (x∗)T (cid:0)f (x+) − f (x−)(cid:1) | ≤ (cid:107)f (x∗)(cid:107)∞ * (cid:107)f (x+) − f (x−)(cid:107)1 where (i) is from (A.35) and (A.36). So we get: (i) ≤ B1,∞ X,(cid:15) * (B(cid:48) X + + B(cid:48) X −), √ (i) ≤ 2 D M sup h∈H 1≤i≤M √ |h(zi)| ≤ 2 M B1,∞ X,(cid:15) * (B(cid:48) X + + B(cid:48) X −) (cid:44) √ M K0, (A.38) where (i) is from (A.34). Now, we need to find the smallest distance between H and Hc, i.e. sup h∈H inf hc∈Hc (cid:107)h − hc(cid:107)2. By the discussion in (A.34), we have (cid:107)h − hc(cid:107)2 ≤ zi = (xi, x+ we have: i ), i = 1, 2, . . . , M , given h and hc such that (cid:107)Wl −W c i , x− √ M max 1≤i≤M |h(zi) − hc(zi)|. For any l (cid:107)1,∞ ≤ δl, l = 1, 2, . . . , d, |h(zi)−hc(zi)| = (cid:12) (cid:12) inf i−xi(cid:107)p≤(cid:15) (cid:107)x(cid:48) f (x(cid:48) i)T (cid:0)f (x+ i ) − f (x− i )(cid:1)− inf (cid:107)x(cid:48) i−xi(cid:107)p≤(cid:15) f c(x(cid:48) i)T (cid:0)f c(x+ i ) − f c(x− i )(cid:1) (cid:12) (cid:12). Let x∗ i = arg inf (cid:107)x(cid:48) i−xi(cid:107)p≤(cid:15) and let f (x(cid:48) i)T (cid:0)f (x+ i ) − f (x− i )(cid:1) and xc f c(x(cid:48) i)T (cid:0)f c(x+ i ) − f c(x− i )(cid:1), i = arg inf (cid:107)x(cid:48) i−xi(cid:107)p≤(cid:15) yi = (cid:26) xc i x∗ i i )T (cid:0)f (x+ f (x∗ otherwise i ) − f (x− i )(cid:1) ≥ f c(xc i )T (cid:0)f c(x+ i ) − f c(x− i )(cid:1) . 47 Zou and Liu Then we have: |h(zi) − hc(zi)| = |f (x∗ i )T (cid:0)f (x+ i ) − f (x− i )(cid:1) − f c(xc i )T (cid:0)f c(x+ i ) − f c(x− i )(cid:1) | (i) ≤ |f (yi)T (cid:0)f (x+ = |f (yi)T (cid:0)f (x+ i ) − f (x− i ) − f (x− + f c(yi)T (cid:0)f (x+ i )(cid:1) − f c(yi)T (cid:0)f c(x+ i )(cid:1) − f c(yi)T (cid:0)f (x+ i ) − f (x− i )(cid:1) | i ) − f c(x− i )(cid:1) i ) − f (x− i )(cid:1) − f c(yi)T (cid:0)f c(x+ i ) − f c(x− i )(cid:1) | (ii) ≤ | (f (yi) − f c(yi))T (cid:0)f (x+ i ) − f (x− i )(cid:1) | i ) − f c(x+ + |f c(yi)T (cid:0)f (x+ i )(cid:1) | + |f c(yi)T (cid:0)f (x− i ) − f c(x− i )(cid:1) | (iii) ≤ (B(cid:48) X + + B(cid:48) X −)(cid:107)f (yi) − f c(yi)(cid:107)∞ + B(cid:48) + B(cid:48) i )(cid:107)∞, i ) − f c(x− X,(cid:15)(cid:107)f (x− X,(cid:15)(cid:107)f (x+ i ) − f c(x+ i )(cid:107)∞ (A.39) where (i) is easily verified by the definition of yi; (ii) is from the triangle inequality and (iii) is from (A.36) and (A.37). Again we define ga b (*) as: b (y) = Wbσ (Wb−1σ (* * * Wa+1σ (W c ga a * * * σ(W c 1 y)))) . Then: (cid:107)f (yi) − f c(yi)(cid:107)∞ = (cid:107)g0 = (cid:107)g0 d(yi) − gd d(yi) − g1 d(yi)(cid:107)∞ d(yi) + g1 d(yi) − g2 d(yi) + * * * + gd−1 (yi) − gd d(yi)(cid:107)∞ d (i) ≤ (cid:107)g0 d(yi) − g1 d(yi)(cid:107)∞ + * * * + (cid:107)gd−1 (yi) − gd d(yi)(cid:107)∞, d where (i) is from the triangle inequality. Then we calculate (cid:107)gl−1 d (yi) − gl d(yi)(cid:107)∞, l = 1, 2, . . . , d: (cid:107)gl−1 d (yi) − gl d(yi)(cid:107)∞ = (cid:107)Wdσ (cid:16) (cid:17) gl−1 d−1(yi) − Wdσ (cid:16) gl d−1(yi) (cid:17) (cid:107)∞ (i) ≤ (cid:107)Wd(cid:107)1,∞ * (cid:107)σ (cid:16) (cid:17) gl−1 d−1(yi) − σ (cid:16) (cid:17) gl d−1(yi) (cid:107)∞ (ii) ≤ LM 1,∞ d (cid:107)gl−1 d−1(yi) − gl d−1(yi)(cid:107)∞ ≤ * * * (iii) ≤ Ld−l * d (cid:89) j=l+1 M 1,∞ j * (cid:107)Wlσ (cid:16) (cid:17) gl−1 l−1(yi) − W c l σ (cid:16) (cid:17) gl−1 l−1(yi) (cid:107)∞ (A.40) = Ld−l * d (cid:89) j=l+1 M 1,∞ j * (cid:107) (Wl − W c l ) σ (cid:16) (cid:17) gl−1 l−1(yi) (cid:107)∞ (iv) ≤ Ld−l * d (cid:89) j=l+1 M 1,∞ j * δl * (cid:107)σ (cid:16) (cid:17) gl−1 l−1(yi) (cid:107)∞, 48 Generalization Bounds for Adversarial Contrastive Learning where (i) is from Lemma 42; (ii) comes from the assumption that σ is L-Lipschitz and (cid:107)Wd(cid:107)1,∞ ≤ M 1,∞ b (*) and (iv) is from Lemma 42 and the choice of hc when h is fixed, which means that (cid:107)Wl − W c ; (iii) is from the definition of ga l (cid:107)1,∞ ≤ δl. d Next, we upper bound (cid:107)σ (cid:16) (cid:17) gl−1 l−1(yi) (cid:107)∞: (cid:16) (cid:17) gl−1 l−1(yi) (cid:107)σ (cid:107)∞ = (cid:107)σ (cid:16) (cid:17) gl−1 l−1(yi) − σ(0)(cid:107)∞ (i) ≤ L * (cid:107)gl−1 l−1(yi)(cid:107)∞ = L * (cid:107)W c l−1σ (cid:16) gl−2 l−2(yi) (cid:17) (cid:107)∞ (ii) ≤ L * (cid:107)W c l−1(cid:107)1,∞ * (cid:107)σ (cid:16) gl−2 l−2(yi) (cid:17) (cid:107)∞ (A.41) (iii) ≤ L M 1,∞ l−1 (cid:107)σ (cid:16) gl−2 l−2(yi) (cid:17) (cid:107)∞ ≤ * * * ≤ Ll−1 * l−1 (cid:89) j=1 M 1,∞ j * (cid:107)yi(cid:107)∞, where (i) is because σ is L-Lipschitz; (ii) is from Lemma 42 and (iii) is because (cid:107)W c M 1,∞ l−1 . (A.40) and (A.41) show that: l−1(cid:107)1,∞ ≤ (cid:81)d (cid:81)d j=1 M 1,∞ j M 1,∞ l j=1 M 1,∞ j M 1,∞ l δl(cid:107)yi(cid:107)∞ δl ((cid:107)X(cid:107)p,∞ + (cid:15)) = B1,∞ X,(cid:15) δl M 1,∞ l , (cid:107)gl−1 d (yi) − gl d(yi)(cid:107)∞ ≤ Ld−1 (i) ≤ Ld−1 where (i) is from Lemma 39. Similarly, we have: (cid:107)gl−1 d (cid:107)gl−1 d (x+ i ) − gl d(x+ i )(cid:107)∞ ≤ Ld−1 ≤ Ld−1 (x− i ) − gl d(x− i )(cid:107)∞ ≤ Ld−1 ≤ Ld−1 (cid:81)d (cid:81)d j=1 M 1,∞ j M 1,∞ l j=1 M 1,∞ j M 1,∞ l (cid:81)d (cid:81)d j=1 M 1,∞ j M 1,∞ l j=1 M 1,∞ j M 1,∞ l 49 δl(cid:107)x+ i (cid:107)∞ δl (cid:107)X +(cid:107)p,∞ = B1,∞ X + δl M 1,∞ l , δl(cid:107)x− i (cid:107)∞ δl (cid:107)X −(cid:107)p,∞ = B1,∞ X − δl M 1,∞ l . Zou and Liu Combine the above with (A.39): |h(zi) − hc(zi)| ≤ (cid:0)B(cid:48) (cid:1) (cid:16) (cid:107)g0 d(yi) − g1 d(yi)(cid:107)∞ + * * * + (cid:107)gd−1 d (yi) − gd d(yi)(cid:107)∞ X + + B(cid:48) X − (cid:16) + B(cid:48) X,(cid:15) (cid:107)g0 d(x+ i ) − g1 d(x+ i )(cid:107)∞ + * * * + (cid:107)gd−1 d (cid:16) + B(cid:48) X,(cid:15) (cid:107)g0 d(x− i ) − g1 d(x− i )(cid:107)∞ + * * * + (cid:107)gd−1 d (x+ i ) − gd d(x+ i )(cid:107)∞ (x− i ) − gd d(x− i )(cid:107)∞ (cid:17) (cid:17) (cid:17) = √ So (cid:107)h − hc(cid:107)2 = = (B(cid:48) X + + B(cid:48) X −)B1,∞ X,(cid:15) d (cid:88) l=1 δl M 1,∞ l + B(cid:48) X,(cid:15)B1,∞ X + d (cid:88) δl M 1,∞ l + B(cid:48) X,(cid:15)B1,∞ X − d (cid:88) l=1 δl M 1,∞ l (cid:104) B1,∞ X,(cid:15) (B(cid:48) X + + B(cid:48) X −) + B(cid:48) X,(cid:15)(B1,∞ X + + B1,∞ X − ) l=1 (cid:105) d (cid:88) l=1 δl M 1,∞ l (cid:44) K1 d (cid:88) l=1 δl M 1,∞ l . M max 1≤i≤M |h(zi) − hc(zi)| ≤ √ M (cid:80)d l=1 K1δl M 1,∞ l . Let δl = M 1,∞ √ l dK1 δ M , then: (cid:107)h − hc(cid:107)2 ≤ √ M d (cid:88) l=1 K1 M 1,∞ l * δ M 1,∞ l √ dK1 M ≤ δ, which means that: ∀h ∈ H, ∃hc ∈ Hc s.t. (cid:107)h − hc(cid:107)2 ≤ δ, so we have sup h∈H when choosing δl = M 1,∞ √ . l dK1 δ M So Hc is a δ-covering of H, and N (δ; H, (cid:107) * (cid:107)2) ≤ |Hc| = (cid:81)d ; S1,∞ M l | = N ( M 1,∞ , (cid:107) * (cid:107)1,∞) ≤ 1 + 2dK1 δ (cid:16) √ √ l l=1 |C1,∞ (cid:17)hl×hl−1 . l l dK1 δ M know that: |C1,∞ This means: inf hc∈Hc (cid:107)h − hc(cid:107)2 ≤ δ |. By Lemma 18 we N (δ; H, (cid:107) * (cid:107)2) ≤ |Hc| = (cid:32) |C1,∞ l | ≤ 1 + √ 2dK1 δ M d (cid:89) l=1 (cid:33)(cid:80)d l=1 hl*hl−1 . (A.42) So we can conclude that: J (0; D) = (cid:90) D 0 (cid:112)ln N (u; H, (cid:107) * (cid:107)2)du (cid:90) D (i) ≤ 0 (cid:118) (cid:117) (cid:117) (cid:116) (cid:32) d (cid:88) (cid:33) (cid:32) hl * hl−1 ln 1 + √ 2dK1 u M (cid:33) du (cid:118) (cid:117) (cid:117) (cid:116) d (cid:88) (ii) ≤ l=1 hl * hl−1 (cid:115) (cid:90) D 0 √ 2dK1 u M du = l=1 (cid:118) (cid:117) (cid:117) (cid:116)2dK1 d (cid:88) l=1 hl * hl−1 (cid:90) D 4√ M u− 1 2 du 0 (cid:118) (cid:117) (cid:117) (cid:116)2dK1D = 2 d (cid:88) l=1 hl * hl−1 4√ M √ (iii) ≤ 2 (cid:118) (cid:117) (cid:117) 2 (cid:116) d (cid:88) l=1 hl * hl−1 (cid:112) dK0K1 √ M , where (i) is from (A.42); (ii) comes from the fact that ln(1 + x) ≤ x, ∀x ≥ 0 and (iii) comes from (A.38). 50 Generalization Bounds for Adversarial Contrastive Learning (a) Influence on clean accuracy (b) Influence on adversarial accuracy Figure B.1: The effect of block size on the accuracy. In the figure, we show the clean accuracy and the adversarial accuracy of the mean classifier under PGD and FGSM attack with (cid:15) = 0.01 and (cid:15) = 0.02. The block size is choosen from {1, 2, 4, 6, 8, 10}. (a) The influence on the clean accuracy; (b) The influence on the adversarial accuracy.   Since we shows that RS(H) ≤ 2E δ −→ 0+, we have:   sup γ,γ(cid:48)∈H(S) (cid:107)γ(cid:48)−γ(cid:107)2≤δ (Xγ − Xγ(cid:48))   + 32J (δ/4; D) before, take RS(H) ≤ 32J (0; D) ≤ 64 √ (cid:118) (cid:117) (cid:117) (cid:116) d (cid:88) 2 l=1 hl * hl−1 (cid:112) dK0K1 √ M = O   (cid:118) (cid:117) (cid:117) (cid:116) d (cid:88) l=1 hl * hl−1 (cid:112) dK0K1 √  M . Appendix B. Extra Experimental Results In this section, we present our experimental results for CIFAR-100. The basic settings are the same as §6. B.1 Improvement from Regularizer Table B.1 shows that the F -norm regularizer helps to improve the adversarial robustness of the model, which agrees with our Theorem 24. 51 1246810block size8283848586878889clean accuracy(%)pgd-0.01pgd-0.02fgsm-0.01fgsm-0.021246810block size7476788082adv accuracy(%)pgd-0.01pgd-0.02fgsm-0.01fgsm-0.02 Zou and Liu Attack PGD FGSM (cid:15) 0.01 0.02 0.01 0.02 Type Clean Adv Clean Adv Clean Adv Clean Adv 0 84.07 78.49 81.87 73.01 84.61 78.70 80.47 72.45 0.002 85.65 79.55 81.91 73.05 84.53 78.64 80.48 72.45 λ 0.005 85.48 79.39 81.93 73.07 84.95 79.18 80.39 72.36 0.01 85.52 79.41 82.08 73.16 84.58 78.70 80.44 72.41 0.02 58.53 79.44 81.97 73.07 84.55 78.63 82.09 73.87 Table B.1: Results of experiments on the regularizer on data set CIFAR-100. In this table, we list the clean accuracy (Clean) and adversarial accuracy (Adv) of the mean classifier under the PGD and FGSM attack with (cid:15) = 0.01 and (cid:15) = 0.02. λ is chosen from {0, 0.002, 0.005, 0.01, 0.02}, and λ = 0 indicates no regularizer. B.2 Effect of Block Size Figure B.1 records the influence of block size on the clean accuracy and the adversarial accuracy of the model, from which we can see that a larger block size will yield better adversarial accuracy. References Pranjal Awasthi, Natalie Frank, and Mehryar Mohri. Adversarial learning guarantees for linear hypotheses and neural networks. In ICML, volume 119, pages 431–441, 2020. Nicholas Carlini and David A. Wagner. Towards evaluating the robustness of neural networks. In SP, pages 39–57, 2017. Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey E. Hinton. A simple framework for contrastive learning of visual representations. In ICML, volume 119, pages 1597–1607, 2020. Qingyi Gao and Xiao Wang. Theoretical investigation of generalization bounds for adversarial learning of deep neural networks. Journal of Statistical Theory and Practice, 15(2):51, 2021. Spyros Gidaris, Praveer Singh, and Nikos Komodakis. Unsupervised representation learning by predicting image rotations. In ICLR, 2018. Ian J. Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In ICLR, 2015. Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross B. Girshick. Momentum contrast for unsupervised visual representation learning. In CVPR, pages 9726–9735, 2020. 52 Generalization Bounds for Adversarial Contrastive Learning Chih-Hui Ho and Nuno Vasconcelos. Contrastive learning with adversarial examples. In NeurIPS, 2020. Ziyu Jiang, Tianlong Chen, Ting Chen, and Zhangyang Wang. Robust pre-training by adversarial contrastive learning. In NeurIPS, 2020. Minseon Kim, Jihoon Tack, and Sung Ju Hwang. Adversarial self-supervised contrastive learning. In NeurIPS, 2020. Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009. Alexey Kurakin, Ian J. Goodfellow, and Samy Bengio. Adversarial examples in the physical world. In ICLR, 2017. Michel Ledoux and Michel Talagrand. Probability in Banach Spaces: isoperimetry and processes. Springer Science & Business Media, 2013. Boqi Li and Weiwei Liu. Wat: Improve the worst-class robustness in adversarial training, 2023. Xiyuan Li, Xin Zou, and Weiwei Liu. Defending against adversarial attacks via neural dynamic system. In NeurIPS, 2022. Xinsong Ma, Zekai Wang, and Weiwei Liu. On the tradeoff between robustness and fairness. In NeurIPS, 2022. Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. In ICLR, 2018. Vitaly Maiorov and Allan Pinkus. Lower bounds for approximation by MLP neural networks. Neurocomputing, 25(1-3):81–91, 1999. Chengzhi Mao, Amogh Gupta, Vikram Nitin, Baishakhi Ray, Shuran Song, Junfeng Yang, and Carl Vondrick. Multitask learning strengthens adversarial robustness. In ECCV, pages 158–174, 2020. Mehryar Mohri, Afshin Rostamizadeh, and Ameet Talwalkar. Foundations of Machine Learning. Adaptive computation and machine learning. MIT Press, 2012. Omar Montasser, Steve Hanneke, and Nathan Srebro. VC classes are adversarially robustly learnable, but only improperly. In COLT, pages 2512–2530, 2019. Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, and Pascal Frossard. Deepfool: A simple and accurate method to fool deep neural networks. In CVPR, pages 2574–2582, 2016. Behnam Neyshabur, Ryota Tomioka, and Nathan Srebro. Norm-based capacity control in neural networks. In COLT, volume 40, pages 1376–1401, 2015. Mehdi Noroozi and Paolo Favaro. Unsupervised learning of visual representations by solving jigsaw puzzles. In ECCV, volume 9910, pages 69–84, 2016. 53 Zou and Liu Kento Nozawa, Pascal Germain, and Benjamin Guedj. Pac-bayesian contrastive unsupervised representation learning. In UAI, volume 124, pages 21–30, 2020. Nikunj Saunshi, Orestis Plevrakis, Sanjeev Arora, Mikhail Khodak, and Hrishikesh Khan- deparkar. A theoretical analysis of contrastive unsupervised representation learning. In ICML, volume 97, pages 5628–5637, 2019. Ludwig Schmidt, Shibani Santurkar, Dimitris Tsipras, Kunal Talwar, and Aleksander Madry. Adversarially robust generalization requires more data. In NeurIPS, pages 5019–5031, 2018. Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian J. Goodfellow, and Rob Fergus. Intriguing properties of neural networks. In ICLR, 2014. Martin J. Wainwright. High-dimensional statistics: A non-asymptotic viewpoint, volume 48. Cambridge University Press, 2019. Zekai Wang and Weiwei Liu. Robustness verification for contrastive learning. In ICML, pages 22865–22883, 2022. Jingyuan Xu and Weiwei Liu. On robust multiclass learnability. In NeurIPS, 2022. Dong Yin, Kannan Ramchandran, and Peter L. Bartlett. Rademacher complexity for adversarially robust generalization. In ICML, volume 97, pages 7085–7094, 2019. Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Under- standing deep learning requires rethinking generalization. In ICLR, 2017. Hongyang Zhang, Yaodong Yu, Jiantao Jiao, Eric P. Xing, Laurent El Ghaoui, and Michael I. Jordan. Theoretically principled trade-off between robustness and accuracy. In ICML, volume 97, pages 7472–7482, 2019. 54
http://arxiv.org/abs/2302.10631v3
2023-05-31T13:35:17
2023-02-21T12:44:12
FedST: Secure Federated Shapelet Transformation for Time Series Classification
This paper explores how to customize time series classification (TSC) methods with the help of external data in a privacy-preserving federated learning (FL) scenario. To the best of our knowledge, we are the first to study on this essential topic. Achieving this goal requires us to seamlessly integrate the techniques from multiple fields including Data Mining, Machine Learning, and Security. In this paper, we systematically investigate existing TSC solutions for the centralized scenario and propose FedST, a novel FL-enabled TSC framework based on a shapelet transformation method. We recognize the federated shapelet search step as the kernel of FedST. Thus, we design a basic protocol for the FedST kernel that we prove to be secure and accurate. However, we identify that the basic protocol suffers from efficiency bottlenecks and the centralized acceleration techniques lose their efficacy due to the security issues. To speed up the federated protocol with security guarantee, we propose several optimizations tailored for the FL setting. Our theoretical analysis shows that the proposed methods are secure and more efficient. We conduct extensive experiments using both synthetic and real-world datasets. Empirical results show that our FedST solution is effective in terms of TSC accuracy, and the proposed optimizations can achieve three orders of magnitude of speedup.
[ "Zhiyu Liang", "Hongzhi Wang" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10631v3", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10631v3", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
Noname manuscript No. (will be inserted by the editor) FedST: Secure Federated Shapelet Transformation for Time Series Classification Zhiyu Liang * Hongzhi Wang 3 2 0 2 y a M 1 3 ] G L . s c [ 3 v 1 3 6 0 1 . 2 0 3 2 : v i X r a Received: date / Accepted: date Abstract This paper explores how to customize time series classification (TSC) methods with the help of external data in a privacy-preserving federated learn- ing (FL) scenario. To the best of our knowledge, we are the first to study on this essential topic. Achiev- ing this goal requires us to seamlessly integrate the techniques from multiple fields including Data Mining, Machine Learning, and Security. In this paper, we sys- tematically investigate existing TSC solutions for the centralized scenario and propose FedST, a novel FL- enabled TSC framework based on a shapelet transfor- mation method. We recognize the federated shapelet search step as the kernel of FedST. Thus, we design a basic protocol for the FedST kernel that we prove to be secure and accurate. However, we identify that the basic protocol suffers from efficiency bottlenecks and the cen- tralized acceleration techniques lose their efficacy due to the security issues. To speed up the federated pro- tocol with security guarantee, we propose several opti- mizations tailored for the FL setting. Our theoretical analysis shows that the proposed methods are secure and more efficient. We conduct extensive experiments using both synthetic and real-world datasets. Empiri- cal results show that our FedST solution is effective in terms of TSC accuracy, and the proposed optimizations can achieve three orders of magnitude of speedup. Keywords Time series classification * Federated Learning * Time series features * Time series shapelets Zhiyu Liang. Harbin Institute of Technology, Harbin, China E-mail: [email protected] Hongzhi Wang. Harbin Institute of Technology, Harbin, China E-mail: [email protected] 1 Introduction Time series classification (TSC) aims to predict the class label for given time series samples. It is one of the most important problem for data analytics, with applications in various scenarios [82, 24,78]. Despite the impressive performance existing TSC al- gorithms have been achieving [7, 39, 2, 79,68,84, 22, 83], they usually make an ideal assumption that the user has free access to enough labeled data. However, it is quite difficult to collect and label the time series for real-world applications. For instance, small manufacturing businesses mon- itor their production lines using sensors to analyze the working condition. Since the data sequences related to specific conditions, e.g., a potential failure of an in- strument, are usually rare pieces located in unknown regions of the whole monitoring time series, the users have to manually identify the related pieces for label- ing, which can be expensive due to the need of pro- fessional knowledge. As a consequence, it is costly for these businesses to benefit from the advanced TSC so- lutions, as they have no enough labeled data to learn accurate models. To deal with the problem, a natural idea is to enrich the local training data by gathering the labeled samples from external data sources, e.g., the other businesses that run the same instrument. However, it has been increasingly difficult for organizations to combine their data due to privacy concerns [90,86]. 1.1 Motivation Is it possible to develop accurate TSC methods with the help of external datasets in a privacy-preserving 2 Zhiyu Liang, Hongzhi Wang Fig. 1: Example of enabling federated learning to enrich the training time series data. A business who owns some training time series samples (blue) collaborates with the partners who have additional training samples (green) to jointly build the TSC model. They follow some secure protocols to avoid disclosing their private training data. manner? A recent concept, named Federated Learn- ing (FL) [63], provides us an inspiration [53]. FL aims to enable multiple businesses to jointly train a model without revealing their private data to each other. An example of using FL to enrich the training time series data is shown in Figure 1. However, although many FL solutions have been studied in the literature [90,47, 95, 40,61], their main focus is the training of the general models, including tree models [89,29,27,3,19,48], lin- ear models [74,70,16,5,91], and neural networks [63, 80,65,64,11,1,30], which have limitations for the TSC problem. First, the tree-based and linear classifiers are shown weak in capturing the temporal patterns for classifying time series [7], while the accuracy of neural networks usually relies on the hyper-parameter tunning, which is still a challenging problem in the FL scenario. Second, many real-world TSC applications [31,93,78,76] expect the classification decisions to be explainable, e.g., the users know why a working condition is determined as a fault. However, the time series sample usually has a large number of data points (e.g., 537 on average for the 117 fixed-length datasets of the UCR Archive [21]), which are taken as independent variables by the general models. The explanation can be much complex with so much input variables. Facing the above limitations, we propose to specifi- cally design FL solutions for the TSC problem. The ba- sic idea is to extend the customized centralized TSC ap- proaches to the federated setting. To achieve this goal, we have proposed FedTSC [53], a brand new FL system tailored for TSC, and demonstrated its utility in VLDB. In this paper, we elaborate on the design ideas and es- sential techniques of a main internal of the system, i.e., the novel Federated Shapelet Transformation (FedST) Fig. 2: Illustration of the shapelet-based features. A shapelet is a salient subsequence that represents the shape unique to certain classes. With a few shapelets of high distinguishing ability, each time series sam- ple is transformed into a low-dimensional feature vec- tor representing how similar (distant) the sample is to these shapelets. The classification is made and ex- plained based on the few features rather than the abun- dant datapoints of the raw time series. In this example, the time series similar to shapelet 1 (orange) and dis- tant to shapelet 2 (blue) are classified into class 1 and vice versa. framework. We design FedST based on the centralized shapelet transformation method due to the following benefits. First, the shapelet transformation method not only achieves competitive accuracy over existing centralized TSC approaches [7], but also serves as an essential com- ponent of the ensemble classifier named HIVE-COTE 2.0, which is currently state-of-the-art centralized TSC model [68]. Second, the method adopts the shapelet- based features rather than the raw time series as the input of the classification models. The features repre- sent the similarity between the time series and a set of shapelets (i.e., the salient subsequences), which can be order-of-magnitude less in number compared to the raw data points and very intuitive to understand [35]. Thus, building classifiers on top of the shapelet-based features can simplify the explanation. Third, the shapelets used to transform the raw time series can be extracted in an anytime manner to flexibly balance the classifiation accuracy and the efficiency (see Section 4.2), which are beneficial for practical utility. Figure 2 is an illustration of the shapelet-based features. 1.2 Challenges and contributions Although it is practical to extend the centralized ap- proach to the federated setting, it is unexplored how to achieve both security and efficiency during the feder- Local time series samplesPP1...External time series samplesSecure protocolsExternal time series samplesTSC modelAn unseen time series samplepredictWhich class the sample belongs to?DDDDDDDDDDDDDDDDboundryDistance to shapelet1Distance to shapelet2Series belongs to class 1Series belongs to class 2 FedST: Secure Federated Shapelet Transformation for Time Series Classification 3 ated shapelet search (FedSS) step, which is the kernel of the FedST framework (see Section 4.2 in detail). The goal of the federated shapelet search is to jointly utilize the distributed labeled time series data to find the shapelets with the highest quality for distinguishing the classes. To ensure security of the federated com- putation, a natural idea is to extend the centralized shapelet search using secure multi-party computation (MPC) [92,20,41, 42]. Following that, we first develop ΠF edSS−B, the basic protocol to achieve FedSS. Bene- fiting from MPC, we show that this protocol is secure and effective. However, by our analysis, the basic protocol suf- fers from low efficiency due to the high overhead in- curred by MPC during the shapelet distance computa- tion and the shapelet quality measurement stages. Al- though there are acceleration techniques in the central- ized scenario [72,43,93,77], we prove that these meth- ods are insecure in the FL setting and thus to be unfea- sible. Consequently, we propose acceleration methods tailored for the FL setting with security guarantee to tackle the efficiency bottlenecks of ΠF edSS−B. For shapelet distance computation, we identify the Euclidean norm computation as the efficiency bottle- neck, so we propose a speed-up method based on a novel secure dot-product protocol. For quality measurement, we first design an optimization to reduce the duplicated time-consuming interactive operations with secure sort- ing. Then, we propose to further boost the efficiency through an acceptable trade-off of classification accu- racy. We show both theoretically and empirically the effectiveness of these techniques. 3. We conduct extensive experiments to evaluate our solutions, which has three major observations. (1) Our FedST offers superior accuracy comparable to the non-private approach. (2) Each of our proposed acceleration approaches is individually effective, and they together bring up to three orders of magnitude of speedup. (3) The proposed trade-off method pro- vides up to 8.31x speedup over our well-optimized protocol while guaranteeing comparable accuracy. We further demonstrate the interpretabiltiy and flex- ibiltiy of our our framework. Organization. We introduce the preliminaries in Sec- tion 3. We propose the FedST framework and talk about the FedST kernel, i.e., federated shapelet search, in Sec- tion 4. The basic protocol of the federated shapelet search is presented and analyzed in Section 5. We elab- orate on the acceleration methods tailored for the two efficiency bottlenecks of the basic protocol in Section 6 and 7, respectively. We show experimental results in Section 8. We illustrate how to incorporate differential privacy to further enhance the security in Section 9 and conclude this paper in Section 10. 2 Related Work Our work is related to federated learning, feature-based time series classification, and privacy protection. Contributions. We summarize our contributions as follows. 2.1 Federated Learning 1. We investigate the customized FL solution for time series classification. In particular, we propose FedST, the first shapelet-based FL method which extends the centralized shapelet transformation to the feder- ated scenario to make use of its advantages in terms of accuracy, interpretability and flexibility. 2. We present ΠF edSS−B, a basic federated protocol for the FedST kernel, i.e., the federated shapelet search, which adopts MPC to achieve security. We analyze the protocol in terms of security, effective- ness, and efficiency. We identify the efficiency bottle- necks of ΠF edSS−B and the invalidity of the central- ized speed-up techniques due to the security issue. To boost the protocol efficiency, we propose accel- eration methods tailored for the FL setting, which are theoretically secure and are more scalable and efficient than the basic protocol. Recently, there have been numerous works that dedi- cate to the federated learning of the general models, in- cluding the linear models [74,70, 16, 5, 91], the tree mod- els [89,29,27,3,19,48], and the neural networks [63,80, 65,64,11,1,94,30]. However, none of them achieve the same goal as our solution, because these general mod- els have limitations in tackling the TSC problem [7] in terms of accuracy and interpretability. There are also FL solutions designed for specific tasks [65,57, 87, 37, 58,51,85,73,50,17,81]. These methods target scenarios that are completely different from ours. As a result, we propose to tailor FL method for TSC. In specific, we contribute to proposing the secure FedST frame- work to take advantage of the shapelet transformation in terms of accuracy, interpretability and flexibility, and addressing the security and efficiency issues within the framework. 4 Zhiyu Liang, Hongzhi Wang 2.2 Feature-based Time Series Classification Instead of directly building classifiers upon the raw time series, transforming the time series into low-dimensional or sparse feature vectors can not only achieve competi- tive classification accuracy, but also simplify the expla- nation. In summary, there are three types of TSC meth- ods based on different explainable features, i.e., the shapelet-based methods [93,72,35,12,34,46,52] that de- termine the class labels based on the localized shapes, the interval-based methods [66,13,68] that classify the time series based on the statistics at some specific time ranges, and the dictionary-based approaches [45,44,69, 67] that utilize the pattern frequency as features. These types of methods can be complement with each other to contribute to state-of-the-art accuracy [55,6,68]. This work focuses on developing a novel framework with a series of optimization techniques taking advantage of the shapelet-based approaches, while we would like to present our contributions [53] of enabling FL for interval-based and dictionary-based TSC in the future. Shapelet-based TSC is first proposed by [93]. In the early works, the shapelets are discovered in a company with a decision tree training, where a shapelet is found at each tree node to determine the best split of the node [93,72,54]. To benefit from the other classifiers, a shapelet transformation framework [35] is proposed that decouples the shapelet discovery from the decision tree training and produces a transformed dataset that can be used in conjunction with any classifier. Several works are raised to speedup the shapelet search [93, 43, 72,77] and improve the shapelet quality [12]. Another line of works dedicate to jointly learning the shapelets and the classifiers [34,52,59,46,60,28,36]. However, the learning-based methods are much more complex because they incur several additional hyperpa- rameters that highly affect the accuracy. Besides, they are inflexible due to the coupling of the shapelet and classifier, and cannot run in the anytime fashion to trade off the classification accuracy and the efficiency. Based on the above discussions, we take advantage of the shapelet transformation method [35,12,6] to de- velop our FL solution. Nevertheless, our work differs from existing studies because we carefully consider the security and efficiency issues in a brand new FL sce- nario. 2.3 Privacy Protection Data privacy is one of the most essential problems in FL [90,49,40]. Several techniques have been studied by existing works. Secure Multi-Party Computation [92] is a general framework that offers secure protocols for many arithmetic operations [20, 41,42]. These opera- tions are efficient for practical utility [4, 18,48,70, 50, 89] under the semi-honest model that most FL works consider, while they can also be extended to the mali- cious model through zero-knowledge proofs [32]. Homomorphic Encryption (HE) is another popular technique in FL [19,29,58, 94, 89], which allows a sim- ple implementation of the secure addition. However, HE does not support some complex operations (e.g., divi- sion and comparison). The encryption and decryption are also computationally intensive [89, 29]. Compared to the solutions based on MPC and HE which aim to protect the intermediate information dur- ing the federated computation, an orthogonal line of works adopt the Differential Privacy (DP) to protect the privacy for the outputs, such as the parameters of the learned models. It works by adding noises to the private data [87,88,56,51,75] to achieve a trade-off be- tween the precision and the degree of privacy for a tar- get function. Thus, DP can usually complement with MPC and HE. In this paper, we mainly adopt MPC to ensure no in- termediate information is disclosed during the complex computations of FedST, because it provides the pro- tocols for the required arithmetic operations. We also illustrate that the private data can be further protected with privacy guarantee by incorporating DP. 3 Preliminaries This section presents the preliminaries, including the target problem of the paper and the two building blocks of the proposed FedST, i.e., the shapelet transformation and the secure multi-party computation. 3.1 Problem Statement Time series classification (TSC) is the problem of creat- ing a function that maps from the space of input time series samples to the space of class labels [7]. A time series (sample) is defined as a sequence of data points T = (t1, . . . , tp, . . . , tN ) ordered by time, where tp is the observation at timestamp p, and N is the length. The class label y is a discrete variable with C possible values. i.e., y ∈ {c}C c=1 where C ≥ 2. Typically, TSC is achieved by using a training data set T D = {(Tj, yj)}M j=1 to build a model that can out- put either predicted class values or class distributions for previously unseen time series samples, where the in- stance (Tj, yj) represents the pair of the j-th time series sample and the corresponding label. FedST: Secure Federated Shapelet Transformation for Time Series Classification 5 Specifically, in this paper we target the TSC prob- lem in a federated setting, denoted as the FL-enabled TSC problem defined as follows. Definition 1 (FL-enabled TSC problem) Given a party P0 (named initiator) who owns a training data set T D0 and n − 1 partners P1, . . . , Pn−1 (named par- ticipants) who hold the labeled series T D1, . . . , T Dn−1 collected from the same area (e.g., monitoring the same type of instruments), where T Di = {(T i j=1, the goal of the problem is to coordinate the parties to build TSC models M for the initiator P0 without revealing the local data T D0, . . ., T Dn−1 to each other. j)}Mi j , yi Note that every party in the group can act as the ini- tiator to benefit from the federated learning. For ease of exposition, we denote (cid:80)n−1 i=0 T Di = T D. Ideally, the performance of M should be lossless compared to that of the model trained in a centralized scenario using the combined data T D. i=0 Mi = M and (cid:83)n−1 Similar to previous FL works [89,29,30,51,85], we consider the semi-honest model where each party fol- lows the protocols but may try to infer the private infor- mation from the received messages, while our method can be extended to the malicious model through zero- knowledge proofs [32]. Unlike existing FL works that usually conditionally allow disclosure of some private data [29,58], we adopt a stricter security definition [89, 70] to ensure no intermediate information is disclosed. Definition 2 (Security) Let F be an ideal function- ality such that the parties send their data to a trusted party for computation and receive the final results from the party. Let Π be a real-world protocol executed by the parties. We say that Π securely realizes F if for each adversary A attacking the real interaction, there exists a simulator S attacking the ideal inter- action, such that for all environments Z, the quantity | Pr[REAL(Z, A, Π, λ) = 1]−Pr[IDEAL(Z, S, F, λ) = 1]| is negligible (in λ). Intuitively, the simulator S must achieve the same effect in the ideal interaction as the adversary A achieves in the real interaction. In this paper, we identify the ideal functionality as the federated search of the high- quality shapelets, which is the kernel of the proposed FedST framework (see Section 4.2 in detail). Therefore, we contribute to design secure and efficient protocols to achieve the functionality in the real FL scenario. The federated setting in this paper is similar to the horizontal and cross-silo FL [40,61] because the data are horizontally partitioned across a few businesses and each of them has considerable but insufficient data. However, unlike the mainstream FL solutions that usu- ally rely on a trust server [37,94,62], we remove this dependency considering that identifying such a party can cause additional costs [58]. Besides, the security definition we adopt is stricter than many existing FL works as mentioned above. Therefore, our setting can be more practical but challenging. 3.2 Shapelet Transformation Time series shapelets are defined as representative sub- sequences that discriminate the classes. Denote S = (s1, . . . , sL) a shapelet generated from T D = {(Tj, yj)}M and the length of Tj is N , where L ≤ N . Let Tj[s, l] de- note the subseries of Tj = (tj,1, . . . , tj,N ) that starts at the timestamp s and has length l, i.e., j=1 Tj[s, l] = (tj,s, . . . , tj,s+l−1), 1 ≤ s ≤ N − l + 1, (1) the distance between the shapelet and the j-th time se- ries is defined as the minimum Euclidean norm (ignore the square root) between S and the L-length subseries of Tj, i.e., dTj ,S = min p∈{1,...,N −L+1} ||S − Tj[p, L]||2. (2) By definition, dTj ,S reflects the similarity between a localized shape of Tj and S, which is a class-specific fea- ture. The quality of S can be measured by computing the distances to all series in T D, i.e., DS = {dTj ,S}M j=1, and evaluating the differences in distribution of the distances between class values {yj}M j=1. The state-of- the-art method of shapelet quality measurement is to use the Information Gain (IG) with a binary strat- egy [12]. Each distance dTj ,S ∈ DS is considered as a splitting threshold, denoted as τ . The threshold is and Dτ,R used to partition the dataset DS into Dτ,L S , such that Dτ,L S = DS \ Dτ,L S . The quality of S is the maximum informa- tion gain among the thresholds, i.e., S = {dTj ,S|dTj ,S ≤ τ }M j=1 and Dτ,R S H(DS) − (H(Dτ,L S ) + H(Dτ,R S )), QIG(S) = max ∀τ where H(D) = −(p log2 p + (1 − p) log2(1 − p)), (3) (4) |D| is the fraction of samples in D that belongs p = |Dy(S)| to the class of the sample generating S, y(S) ∈ {c}C and Dy(S) = {dTj ,S|yj = y(S)}M c=1 j=1. In shapelet transformation, a set of candidates are randomly sampled from the possible subsequences of T D. After measuring the quality of all candidates, the K subsequences with the highest quality are chosen as the shapelets, which are denoted as {Sk}K k=1. The 6 Zhiyu Liang, Hongzhi Wang shapelets are used to transform the original dataset T D into a newly tabular dataset of K features, where each attribute represents the distance between the shapelet and the original series, i.e., D = {(Xj, yj)}M j=1 where Xj = (dTj ,S1, . . . , dTj ,SK ). The unseen series are trans- formed in the same way for prediction. D can be used in conjunction with any classifier, such as the well-known intrinsically interpretable decision tree and logistic re- gression [71]. 3.3 Secure Multiparty Computation Secure multiparty computation (MPC) [92] allows par- ticipants to compute a function over their inputs while keeping the inputs private. In this paper, we utilize the additive secret sharing scheme for MPC [20] since it of- fers the protocols of the common arithmetic operations applicable to practical situations [18,50]. It performes in a field Zq for a prime q. We denote a value x ∈ Zq that is additively shared among parties as ⟨x⟩ = {⟨x⟩0, . . . , ⟨x⟩n−1}, (5) where ⟨x⟩i is a random share of x hold by party Pi. Suppose x is a private value of Pi. To secretly share x, Pi randomly chooses ⟨x⟩j ∈ Zq and sends it to Pj(j ̸= i). Then, Pi sets ⟨x⟩i = x − (cid:80) j⟨x⟩j mod q. To re- construct x, all parties reveal their shares to compute x = (cid:80)n−1 i=0 ⟨x⟩i mod q. For ease of exposition, we omit the modular operation in the rest of the paper. Under the additive secret sharing scheme, a function z = f (x, y) is computed by using a MPC protocol that takes ⟨x⟩ and ⟨y⟩ as input and outputs the secret shared ⟨z⟩. In this paper, we mainly use the following MPC protocols as building blocks: (a) Addition: ⟨z⟩ = ⟨x⟩ + ⟨y⟩ (b) Multiplication: ⟨z⟩ = ⟨x⟩ * ⟨y⟩ (c) Division: ⟨z⟩ = ⟨x⟩/⟨y⟩ (d) Comparison: ⟨z⟩ = ⟨x⟩ (e) Logarithm: ⟨z⟩ = log2(⟨x⟩) We refer readers to [9,15,14,4] for the detailed im- ? < ⟨y⟩ : ⟨1⟩ : ⟨0⟩ plementation of the operations. In addition, given the result ⟨b⟩ = ⟨x⟩ ? < ⟨y⟩ : ⟨1⟩ : ⟨0⟩, the smaller one of two values ⟨x⟩, ⟨y⟩ can be se- curely assigned to ⟨z⟩, as: (f) Assignment: ⟨z⟩ = ⟨b⟩ * ⟨x⟩ + (1 − ⟨b⟩) * ⟨y⟩. With the assignment protocol, it is trivial to per- form the maximum, minimum, and top-K computation for a list of secret shares by sequentially comparing and swapping the adjacent elements in the list using the se- cure comparison and assignment protocols. Fig. 3: An illustration of the FedST framework. 4 Solution Overview This section overviews our FL-enabled TSC framework, which is a key component of our FedTSC system [53] and is built based on the centralized shapelet transfor- mation [35,12,6]. We provide the framework overview in Section 4.1. Then, we identify the FedST kernel in Section 4.2. 4.1 FedST Framework Overall, FedST has two stages: (1) federated shapelet search; (2) federated data transformation and classifier training. The two stages are illustrated in Figure 3. In the first stage, all parties jointly search for the K best shapelets {Sk}K k=1 from a candidate set SC. Note that P0 requires the found shapelets to explain the shapelet-based features, so the shapelet candidates in SC are only generated by P0 to ensure the local time series of the participants cannot be accessed by the ini- tiator. This may raise a concern that the shapelets will be missed if they do not occur in T D0. Fortunately, since the high-quality shapelets are usually highly re- dundant in the training data, it is shown enough to find them by checking some randomly sampled candidates rather than all possible subsequences [6,33]. Hence, it is feasible to generate SC by P0 in our cross-silo setting where each business has considerable (but insufficient) data. We also verify this issue in Section 8.2 and 8.5. In stage two, the time series data T Di in each party is transformed into the K dimensional secretly shared Party PP00(Initiator )Party PP11(Participant)Party PPnn−11(Participant)SSSS(TT1100,yy1100)(TT2200, yy2200)TTDD00ffffffaaaaaaSS∈SSSSTTDD11TTDD11(TT1111,yy1111)⟨DD00⟩Classifier⟨DD11⟩(TT11nn−11,yy11nn−11)TTDDnn−11TTDDnn−11⟨DDnn−11⟩*Stage 1(FedSTkernel)Stage 2SS11SSKKShapelets......⟨DDSS11⟩⟨QQIIII⟩⟨DDSS00⟩⟨DDSSnn−11⟩⟨QQFF⟩ORTTDD11TTDDnn−11CandidateGeneration*DistanceComputationShapeletRetrieval*QualityMeasurement*QualityMeasurement*DistanceComputationDataTransformationDataTransformationClassifierTrainingClassifierTrainingShapeletRetrievalLocal ComputationPrivacyPreservationFederatedComputationBasic Distance(Sec. 5.1) Retrieval(Sec. 5.1)Our Optimized Distance (Sec. 6)Our Trade-off (Sec. 7.2)Basic IG(Sec. 5.1) Our Optimized IG (Sec. 7.1)Identical Data FedST: Secure Federated Shapelet Transformation for Time Series Classification 7 tabular data as: ⟨Di⟩ = {(⟨Xi j⟩, ⟨yi j⟩)}Mi j=1, ∀i ∈ {0, . . . , n − 1}, (6) where ⟨Xi j⟩ = (⟨dT i j ,S1 ⟩, . . . , ⟨dT i j ,SK ⟩). Then, a standard classifier is built over the joint (7) secretly shared data set ⟨D⟩ = (cid:83)n−1 i=0 ⟨Di⟩. Note that there is always a trade-off between secu- rity and accuracy/interpretability in FL. To achieve a good balance, FedST ensures only P0 learns the shapelets and classifiers, while nothing else can be revealed to the parties. This degree of privacy has been shown practi- cal by many FL systems [29,30,89]. Additionally, we illustrate in Section 9 that we can further enhance the security by incorporating differential privacy [26], guar- anteeing that the revealed outputs leak limited informa- tion about the private training data. 4.2 FedST Kernel: Federated Shapelet Search The transformed data set ⟨D⟩ is a common tabular data set with continuous attributes, which can be used in conjunction with any standard classifier. Consequently, any classifier training protocol built for secretly shared data (e.g., [70,3,96,18]) can be seamlessly integrated into our framework. Nevertheless, there exists no pro- tocol that tackles the orthogonal problem of federated shapelet search and data transformation. Further, the data transformation is to compute the distances be- tween each training series and shapelet, which is just a subroutine of the shapelet search. Thus, the key tech- nical challenge within our FedST is to design secure and efficient protocols to achieve the federated shapelet search (Stage 1 in Figure 3), which becomes the kernel part of FedST. Formally, we define the functionality of the feder- ated shapelet search, FF edSS, as follows. Definition 3 (Federated shapelet search, FF edSS) Given the time series datasets distributed over the par- ties, i.e., T D0, . . . , T Dn−1, and the shapelet candidates SC generated from T D0, the goal of FF edSS is to search for the K best shapelets {Sk|Sk ∈ SC}K k=1 for P0 by leveraging the distributed data sets. To realize FF edSS under the security defined in Def- inition 2, a straightforward thought is to design secu- rity protocols by extending the centralized method to the FL setting using MPC. Following this, we present ΠF edSS−B (Section 5.1), the protocol that achieves our basic idea. We show the protocol is secure and effec- tive (Section 5.2), but we identify that it suffers from low efficiency due to the high communication overhead incurred by MPC and the failure of the pruning tech- niques due to the security issue (Section 5.3). To tackle the efficiency issue, we propose secure ac- celeration techniques tailored for the FL setting that dramatically boost the protocol efficiency by optimiz- ing the two bottlenecked processes of ΠF edSS−B, i.e., the distance computation (Section 6) and the quality measurement (Section 7). Experiment results show that each of these techniques is individually effective and they together contribute to three orders of magni- tude of speedup (Section 8.3). Besides, since the evaluation of each shapelet candi- date is in a randomized order and independent from the others, FedSS can perform in an anytime fashion [6,33]. That is, the user announces a time contract, so that the evaluation stops once the running time exceeds the con- tract, and only the assessed candidates are considered in the following steps. Since this strategy relies only on the publicly available running time, it is feasible in the FL setting [53] to flexibly balance the accuracy and efficiency. We verify this issue in Section 8.5. 5 Basic protocol ΠF edSS−B We now introduce the basic protocol ΠF edSS−B, which is extended from the centralized shapelet search us- ing MPC to protect the intermediate information (Sec- tion 5.1). We discuss the protocol in terms of security, effectiveness, and efficiency in Section 5.2, and analyze the bottlenecks of the protocol in Section 5.3. 5.1 Protocol Description ΠF edSS−B is outlined in Algorithm 1. The parties jointly assess the quality of each candidate and then select the K best as the shapelets. The algorithm performs in three steps. First, the parties compute the distance be- tween the samples and each candidate (Lines 2-8). Sec- ond, the parties evaluate the quality of the candidate over the secretly shared distances and labels (Lines 9). Finally, the parties jointly retrieve the K candidates with the highest quality and reveal the shares of the indices to P0 to recover the selected shapelets (Lines 10-11). These three steps are described as follows. Distance Computation. Since the candidates are lo- cally generated by P0, the distance between the samples of P0 and the candidates can be locally computed. Af- ter that, P0 secretly shares the results to enable the subsequent steps (Lines 3-5). 8 Zhiyu Liang, Hongzhi Wang Algorithm 1: Basic Protocol ΠF edSS−B j , yi Input: T Di = {(T i j )}Mi j=1, i = 0, . . . , n − 1: local datasets SC: A set of shapelet candidates locally generated by P0 K: the number of shapelets Output: {Sk}K k=1: shapelets revealed to P0 1 for S ∈ SC do 2 for i ∈ {0, . . . , n − 1} do if i == 0 then for j ∈ {1, . . . , M0} do P0 locally computes dT 0 j ,S and secretly shares the result among all parties else for j ∈ {1, . . . , Mi} do All parties jointly compute ⟨dT i j ,S⟩ All parties jointly compute the quality ⟨QIG(S)⟩ over the secretly shared distances and labels All parties jointly find the K candidates with the highest quality and reveal the indices {⟨Ik⟩}K to P0 k=1 3 4 5 6 7 8 9 10 11 return {Sk = SCIk }K k=1 To compute the distances between the samples of each participant Pi and the candidates (Lines 6-8), the MPC operations have to be adopted. For example, to j ,S, Pi and P0 secretly share T i j and S re- compute dT i spectively. Next, the parties jointly compute each Eu- j [p, L]||2⟩ using MPC. At last, the clidean norm ⟨||S, T i parties jointly determine the shapelet distance ⟨dT i j ,S⟩ by Eq. 2 using the secure minimum operation (see Sec- tion 3.3). Quality Measurement. Based on Eq 3, to compute the IG quality of S ∈ SC (Line 9), we need to securely partition the dataset DS using each threshold τ and compute the number of samples belonging to each class c (c ∈ {1, . . . , C}) for DS, Dτ,L S . We achieve it over the secretly shared distances and labels by lever- aging the indicating vector defined as follows. S , and Dτ,R Definition 4 (Indicating Vector) Given a dataset D = {xj}M j=1 and a subset A ⊆ D, we define the in- dicating vector of A, denoted as γA⊆D, as a vector of size M whose j-th (j ∈ {1, . . . , M }) entry represents whether xj is in A, i.e., γA⊆D[j] = 1 if xj ∈ A, and 0 otherwise. For example, for D = {x1, x2, x3} and A = {x1, x3}, the indicating vector of A is γA⊆D = (1, 0, 1). Suppose that γA1⊆D and γA2⊆D are the indicating vectors of A1 and A2, respectively, we have γA1⊆D * γA2⊆D = |A1 ∩ A2|, (8) where |A1∩A2| is the cardinality of A1∩A2. Specifically, we have γA1⊆D * 1 = |A1|. With the indicating vector, we securely compute ⟨QIG(S)⟩ as follows. At the beginning, P0 generates a vector of size C to indicate the class of S, i.e., γy(S) = γ{y(S)}⊆{c}C c=1 , and secretly shares the vector among all parties. Next, for each splitting threshold ⟨τ ⟩ ∈ n−1 (cid:91) {⟨dT i j ,S⟩}Mi j=1, (9) (10) i=0 the parties jointly compute the secretly shared vector ⟨γL⟩ = ⟨γDτ,L ⟨γR⟩ = ⟨γDτ,R S ⊆DS S ⊆DS ⟩, ⟩ = 1 − ⟨γL⟩, (11) where ⟨γDτ,L S ⊆DS [j]⟩ = ⟨dT i j ,S⟩ ? < ⟨τ ⟩, j ∈ {1, . . . , M }. (12) Meanwhile, each party Pi secretly shares the vector γi c⊆T Di to indicate its samples that belong to each class c. Denote the indicating vectors of all parties as T Di ⟨γc⟩ = (⟨γ0 T D0 c ⊆T D0 ⟩, . . . , ⟨γn−1 T Dn−1 c ⊆T Dn−1 ⟩), (13) which indicates the samples in DS that belong to class c, i.e., ⟨γc⟩ = ⟨γT Dc⊆T D⟩ = ⟨γDS,c⊆DS ⟩. (14) As such, the parties compute the following statistics using MPC: ⟨|DSτ,L|⟩ = ⟨γL⟩ * 1, ⟨|DSτ,R|⟩ = |DS| − ⟨|DSτ,L|⟩, ⟨|DS,y(S)|⟩ = ⟨γy(S)⟩ * (⟨γ1⟩ * 1, . . . , ⟨γC⟩ * 1), ⟨|Dτ,L S,y(S)|⟩ = ⟨γy(S)⟩ * (⟨γ1⟩ * ⟨γL⟩, . . . , ⟨γC⟩ * ⟨γL⟩), S,y(S)|⟩ = ⟨γy(S)⟩ * (⟨γ1⟩ * ⟨γR⟩, . . . , ⟨γC⟩ * ⟨γR⟩). ⟨|Dτ,R (15) Given the statistics in Equation 15 and the public value |DS| = M , the parties can jointly compute ⟨QIG(S)⟩ by Eq. 3. Shapelet Retrieval. Given the quality of the candi- dates in secret shares, the parties jointly retrieve the indices of the K best shapelets (Line 10) by securely comparing the adjacent quality values and then swap- ping the values and the corresponding indices based on the comparison results (see Section 3.3). The indices are output to P0 to recover the jointly selected shapelets (Line 11). FedST: Secure Federated Shapelet Transformation for Time Series Classification 9 Fig. 4: Throughputs (#operations per second) of differ- ent MPC operations executed by three parties. Secure addition is much more efficient than the others because it is executed without communication [15]. Fig. 5: Illustration of the Euclidean norm pruning and its information disclosure. 5.2 Protocol Discussion 5.3 Bottleneck Analysis This section analyzes ΠF edSS−B in terms of security, effectiveness, and efficiency. Security. The security of ΠF edSS−B is guaranteed by the following Theorem: Theorem 1 ΠF edSS−B is secure under the security de- fined in Definition 2. Proof (Proof Sketch) In ΠF edSS−B, all joint computa- tions are executed using MPC. With the indicating vec- tor, the secure computations are data-oblivious. An ad- versary learns no additional information. The security follows. Effectiveness. We discuss the protocol effectiveness in terms of classification accuracy. ΠF edSS−B is directly extended from the centralized approach by using the secret-sharing-based MPC operations, which have con- siderable computation precision [15,14,4]. Therefore, it is expected that the accuracy of FedST has no difference from the centralized approach. The experiment results in Section 8.2 validate this issue. Efficiency. As shown in Figure 4, the secret-sharing- based MPC is usually bottlenecked by communication rather than computation. Therefore, it is more indica- tive to analyze the efficiency by considering the com- plexity of only the interactive operations, including the secure multiplication, division, comparison, and loga- rithm operations. We follow this metric for efficiency analysis in the paper. ΠF edSS−B in Algorithm 1 takes O(|SC| * M N 2) for distance computation. The quality measurement has a complexity of O(|SC| * M 2). Securely finding the top- K candidates has a complexity of O(|SC| * K). Since K is usually a small constant, the total complexity of ΠF edSS−B can be simplified as O(|SC| * (M N 2 + M 2)). As discussed in Section 5.2, ΠF edSS−B is secure and effective to enable federated shapelet search. However, the basic protocol has expensive time cost in the FL setting for both distance computation and quality mea- surement steps, which bottleneck the efficiency of the protocol. Two major reasons are as below. Reason I. Heavy Communication Overhead. As discussed in Section 5.2, ΠF edSS−B takes O(|SC|*M N 2) and O(|SC * |M 2) expensive interactive operations to compute the distance and measure the quality for all candidates, which dominate in the complexity. There- fore, the efficiency of ΠF edSS−B is bottlenecked by the first two steps, i.e., distance computation and quality measurement. Reason II. Failure of Acceleration Techniques. Even using only local computation, repeatedly comput- ing the distance and quality for all candidates are time- consuming [93]. To tackle this, existing studies pro- pose pruning strategies for acceleration [72, 43,93,77]. Unfortunately, the pruning techniques are inevitably data-dependent, which violates the security of Defini- tion 2 that requires the federated computation oblivi- ous. Thus, we have to abandon these acceleration strate- gies in the FL setting. We show the security issue in Theorem 2 and Theorem 3. Theorem 2 Protocol ΠF edSS−B is insecure under the security defined in Definition 2 if using the Euclidean norm pruning strategies proposed in [43] and [77]. Proof (Proof Sketch) Figure 5 illustrates the Euclidean norm pruning. The basic idea is to maintain a best-so- far Euclidean norm at each timestamp p ∈ {1, . . . , N − LS + 1}, and incrementally compute the sum of the squared differences between each pair of data points j [p, LS]||2 (left). Once the sum when computing ||S − T i /RJ&RPS'LY0XO$GGThe early abandon ispublic to all parties.⟨22⟩>best-so-farpp=2⟨1⟩⟨−1⟩⟨−2⟩⟨1⟩⟨1⟩⟨TTjjii⟩⟨1⟩⟨0⟩⟨−1⟩⟨SS⟩⟨02⟩+⟨12⟩+⟨12⟩⟨S⟩−⟨TTjjii⟩1,32=⟨2⟩pp=1Reveal information about TTand SS.e.g., PPiiknows (ss1−tt1)2<(ss1−tt2)2and tt1=1,tt2=−1. Then it knows ss1>0⟨1⟩⟨−1⟩⟨−2⟩⟨1⟩⟨1⟩⟨1⟩⟨0⟩⟨−1⟩1Compute ⟨SS⟩−⟨TTjjii⟩[11,33]22best-so-far is ⟨2⟩for step 22Compute ⟨SS⟩−⟨TTjjii⟩[22,33]22⟨TTjjii⟩⟨SS⟩ 10 Zhiyu Liang, Hongzhi Wang exceeds the best-so-far value, the current norm com- putation can be pruned (right). In the FL setting, al- though we can incrementally compute the sum and compare it with the best-so-far value using MPC, the comparison result must be disclosed when determining the pruning, which cannot be achieved by the simulator S that attacks the ideal interaction FF edSS in Defini- tion 3. The security is violated. Similarly, We have the following theorem. Theorem 3 Protocol ΠF edSS−B is insecure under the security defined in Definition 2 if using the IG quality pruning strategies proposed in [93] and [72]. We omit the proof because it is similar to the proof of Theorem 2. Optimizations. To remedy the efficiency issue of the protocol ΠF edSS−B, we propose acceleration methods tailored for the FL setting to improve the efficiency of the distance computation and the quality measurement steps. For distance computation, we propose to speed up the bottlenecked Euclidean norm computation based on a novel secure dot-product protocol (Section 6). For quality measurement, we first propose a secure sorting-based acceleration to reduce the duplicated in- teractive operations for computing IG (Section 7.1). Then, we propose to tap an alternative F-stat measure to further improve the efficiency with comparable ac- curacy (Section 7.2). Experiment results show that each of these three techniques is individually effective and they together brings up to three orders of magnitude of speedup to ΠF edSS−B. Further, compared to our well-optimized IG, the F-stat-based method in Section 7.2 gives 1.04- 8.31x of speedup while guaranteeing no statistical dif- ference in TSC accuracy. (Section 8.3). 6 Shapelet Distance Acceleration In ΠF edSS−B, the distance between a candidate S and the M − M0 samples T i j (∀j, i ̸= 0) is straightforwardly computed using MPC. Based on Eq 2, the interactive operations used include: Algorithm 2: The Two-Party Dot-Product Protocol of [38] Input: x ∈ RL from P0; y ∈ RL from Pi (i ∈ {1, . . . , n − 1}) Output: β to P0 and α to Pi, satisfying β − α = xT * y 1 Party P0 randomly chooses Q, r, f , R1, R2, R3, xi (i ∈ {1, . . . , d}, i ̸= r) and creates X. Then, it computes b, U , c, g, and sends U , c, g to Pi 2 Party Pi randomly chooses α, creates y′, computes and sends to P0 the value a, h 3 Party P0 computes β computation by improving the efficiency of the bottle- necked Euclidean norm. The work of [38] proposes a two-party dot-product protocol (as Algorithm 2) that we find is both computa- tion and communication efficient for the calculation be- tween one vector and many others. It motivates us that we can compute the Euclidean norm between a candi- date S and the total (N − LS + 1)(M − M0) subseries of the participants using the dot-product protocol. Unfor- tunately, the protocol in Algorithm 2 (denoted as the raw protocol) has weak security that violates Defini- tion 2. To overcome the limitation, we propose ΠDP , a se- cure dot-product protocol that enhances the raw proto- col using MPC. We prove that this novel protocol not only follows the security of Definition 2, but also effec- tively accelerates the Euclidean norm. We describe the acceleration method in Section 6.1. Then, we analyze the security deficiency of the raw protocol and propose our ΠDP in Section 6.2. 6.1 Dot-Product-based Euclidean Norm Given two vectors x ∈ RL from P0 and y ∈ RL from Pi, Algorithm 2 computes the dot-product x * y as follows. (i) P0 chooses a random matrix Q ∈ Rd×d(d ≥ 2), a random value r ∈ {1, . . . , d}, a random vector f ∈ RL+1 and three random values R1, R2, R3, and selects s − 1 random vectors xi ∈ RL+1, i ∈ {1, . . . , r − 1, r + 1, . . . , d}. (16) 1. LS(N − LS + 1)(M − M0) pairwise multiplications for the Euclidean norm; Next, it creates a matrix 2. (N − LS + 1)(M − M0) times of both comparisons and assignments for the minimum. X ∈ Rd×(L+1), Because the shapelet length LS is up to N where N >> 1, the efficiency is dominated by the Euclidean norm. Thus, it is necessary to accelerate the distance whose i-th row (i ̸= r) is xi and r-th row is x′T = (x1, . . . , xL, 1). (17) (18) FedST: Secure Federated Shapelet Transformation for Time Series Classification 11 Then, P0 locally computes b = d (cid:88) j=1 Qj,r, U = Q * X, c = (cid:88) i∈{1,...,d},i̸=r (xT i * d (cid:88) j=1 Qj,i) + R1R2f T , (21) g = R1R3f . (22) Finally, it sends U , c, g to Pi (Line 1); (ii) Pi chooses a random value α to generate y′ = (y1, . . . , yL, α)T . Algorithm 3: Secure Dot-Product Protocol ΠDP (Ours) (19) Input: x ∈ RL from P0; y ∈ RL from Pi (i ∈ {1, . . . , n − 1}) (20) Output: ⟨z⟩ secretly shared by all parties, satisfying z = xT * y 1 Party P0 and Party Pi represent each element of their input vectors as fixed-point number encoded in Zq as used in MPC 2 Party P0 independently and randomly chooses each value of Q, f , R1, R2, R3, xi (i ∈ {1, . . . , d}, i ̸= r) from Zq, r ∈ {1, . . . , d}, creates X, computes b, U , c, g, and sends U , c, g to Pi. 3 Party Pi randomly chooses α ∈ Zq, creates y′, and computes the value a, h. Then, Pi sends only h to P0 4 All Parties jointly compute ⟨z⟩ = ⟨β⟩ − ⟨α⟩ = ⟨ 1 MPC b ⟩ * ⟨a⟩ + ⟨ hR2 bR3 ⟩ − ⟨α⟩ using (23) terms in secret shares using non-interactive secure ad- dition. Next, it computes and sends to P0 two scalars a and h (Line 2), as: a = d (cid:88) j=1 U j * y′ − c * y′, (24) Using the above dot-product protocol, the total com- munication cost for the (N − LS + 1)(M − M0) Eu- clidean norm between S and the subseries of the par- ticipants is reduced from O(LS(N − LS + 1)(M − M0)) to O(LS) + O((N − LS + 1)(M − M0)). h = gT * y′. (25) 6.2 Security Analysis and Enhancement (iii) P0 locally computes β (Line 3) as: β = a b + hR2 bR3 . Although the protocol in Algorithm 2 benefits the ef- ficiency of the distance computation, it is unavaliable due to the security issue. (26) Given β and α, the result satisfies xT * y = β − α. The Euclidean norm computation in our federated shapelet search can benefit from the above protocol, since each ||S, T i j [p, LS]||2 can be represented as ||S, T i j [p, LS]||2 = LS(cid:88) (sp′)2 + LS(cid:88) (tp′+p−1)2 p′=1 p′=1 + 2 LS(cid:88) p′=1 sp′tp′+p−1, where the term (27) Theorem 4 The protocol of Algorithm 2 is insecure under the security defined in Definition 2. Proof (Proof Sketch) Consider an adversary A that at- tacks P0. By executing the raw protocol in Algorithm 2, A receives the messages a and h. For ease of exposition, we represent the matrix U as a row of the column vec- tors, i.e., U = (u1, . . . , uL+1), (29) where ui = (U 1,i, . . . , U d,i)T , i ∈ {1, . . . , L + 1}. (30) z = LS(cid:88) p′=1 sp′tp′+p−1 = ST * T i j [p, LS] (28) Denote can be computed by P0 and Pi jointly executing the pro- tocol to get β and α, respectively. The terms (cid:80)LS p′=1(sp′)2 and (cid:80)LS p′=1(tp′+p−1)2 can be locally computed by the two parties. To this end, all parties aggregate the three c = (c1, . . . , cL+1) and gT = (g1, . . . , gL+1). (31) (32) 12 Zhiyu Liang, Hongzhi Wang Recall that v′ = (vT , α)T . Thus, it has a = d (cid:88) j=1 U j * v′ − c * v′ = eT 1 * v + wα, h = gT * v′ = eT 2 * v + gL+1α, where (cid:88) e1 = ( u1 + c1, . . . , (cid:88) uL + cL)T , (cid:88) w = ( uL+1 + cL+1), e2 = (g1, . . . , gL)T . Based on Eq 33-34, A knows that gL+1a − wh = (gL+1eT 1 − weT 2 ) * v, (33) (34) (35) (36) (37) (38) 1 −weT where gL+1eT 2 is created locally in P0. Obviously, the probability distribution of gL+1a − wh is dependent on the private data v, which cannot be simulated by any S. Our novel protocol ΠDP . To securely achieve the acceleration, we propose ΠDP , a novel dot-product pro- tocol that follows the security in Definition 2. The basic idea is to enhance the security of Algorithm 2 using MPC and the finite field arithmetic. This solution is simple but rather effective in terms of both security and efficiency. ΠDP is presented in Algorithm 3. It has three dif- ferences to the raw protocol: 1. P0 and Pi represent each element of their input vec- tors as fixed-point number encoded in Zq as used in MPC [15,14,4] (Line 1), generates each random masking value from the same field Zq, and compute b, U , c, g, and a, h in Zq [15] (Lines 2-3); 2. Pi only sends h to P0 but keeps a private (Line 3); 3. the value β − α is jointly computed by all parties using MPC (Line 4). Note that the protocol incurs only one additional interactive operation when computing ⟨z⟩ = ⟨ 1 b ⟩⟨a⟩. Thus, computing the Euclidean norm between S and the M − M0 series requires still O(LS) + O((N − LS + 1)(M − M0)), which is much smaller compared to the directly using of the MPC operations in ΠF edSS−B. More importantly, we verify the security guarantee of ΠDP . Theorem 5 ΠDP is secure under the security defini- tion defined in Definition 2. Proof (Proof Sketch) Since the secretly-sharing-based MPC are secure, we focus on the messages beyond it. We describe two simulators S0 and Si that simulate the messages of the adversaries for party P0 and Pi, respectively. We first present S0. Similar to Eq 34, when receiving the message h, the adversary knows h = (eT 2 * v + gL+1α) mod q (39) Since the masking values eT 2 , gL+1, and α are indepen- dently and uniformly sampled from Zq, the distribution of h is equal to h′ = gL+1α mod q. In the ideal inter- action, S0 independently and randomly chooses α and gL+1 from Zq to compute and send h′ to the adversary. Indeed the views of the environment in both ideal and real interactions are indistinguishable. Next, we discuss Si. By executing ΠDP in the real interaction, the adversary of Pi receives U , c, g. Both c and g are derived from independent and randomly chosen values. Thus, Si can follow the same procedure to compute them. Without loss of generality, we assume r = 1 and d = 2. Then, U = Q * X follows     Q1,1x1 + Q1,2x2,1 Q2,1x1 + Q2,2x2,1 . . . . . . Q1,1xL + Q1,2x2,L Q2,1xL + Q2,2x2,L Q1,1 + Q1,2x2,L+1 Q2,1 + Q2,2x2,L+1 T     (40) Note that we omit the modular operations at each entry for ease of exposition. The value of each entry is masked by a unique triplet, e.g., (Q11, Q12, x21) at the entry (1,1). Because the values of these triplets are inde- pendently and randomly chosen from Zq, the elements of U are independent and identically distributed. Sim- ilar to S0, Si can simulate U by computing U ′, where U ′ i,j = Qi,kxi,j mod q, k ∈ {1, . . . , d}, (41) and sends it along with c, g to the adversary. The views of the environment in both ideal and real interaction are identically distributed. In summary, the simulators achieve the same effect that the adversaries achieve. The security follows. With the security guarantee, we can integrate ΠDP into ΠF edSS−B to accelerate the distance computation. The protocol ΠDP can also serve as a building block for other applications. FedST: Secure Federated Shapelet Transformation for Time Series Classification 13 7 Quality Measurement Acceleration Empirically, evaluating the shapelet quality using IG with the binary strategy (Section 3.2) is the state-of- the-art method in terms of TSC accuracy. However, computing IG in the FL setting suffers from a severe efficiency issue. The reasons are concluded as follows. 1. A large number (M ) of thresholds will be evaluated for each candidate; 2. Evaluating different thresholds incurs duplicated in- teractive operations; 3. Evaluating one threshold is already inefficient mainly because the required secure division and logarithm operations are expensive (as illustrated in Figure 4); 4. The IG pruning strategies lose their efficacy due to the security issue (Section 5.3). To consider both accuracy and efficiency, we propose to speed up the quality measurement in ΠF edSS−B in two aspects: O1: Accelerating IG computation. To benefit from IG in terms of TSC accuracy, we propose a speed-up method to reduce as many interactive operations as possible in computing IG based on secure sorting (Sec- tion 7.1), which tackles the problem in reason 1. O2: Tapping alternative measures. As the prob- lems of 1, 3 and 4 are the inherent deficiencies of IG which is difficult to avoid, we propose a trade-off method tailored for the FL setting by tapping other measures that are much more secure-computation-efficient than IG, at the cost of acceptable loss of TSC accuracy (Sec- tion 7.2). 7.1 Sorting-based IG Acceleration The straightforward IG computation in Section 5.1 is inefficient since it incurs O(M 2) secure comparisons for ⟨γL⟩, and O(M 2) secure multiplications for ⟨|DSτ,L,y(S)|⟩ and ⟨|DSτ,R,y(S)|⟩. Inspired by [72] and [3], we propose to securely reduce the duplicated interactive operations by pre-sorting the secretly shared distances and labels before computing each QIG(S). Assuming ⟨DS⟩ = (cid:83)n−1 in an ordered sequence, i.e., j=1 are arranged j ,S⟩}Mi i=0 {⟨dT i ⟨D′ S⟩ = {⟨dj⟩}M j=1, (42) where dj1 < dj2 , ∀ 1 ≤ j1 < j2 ≤ M. As such, for each threshold ⟨τ ⟩ = ⟨dj⟩, we can get γ′ L without using secure comparison, as: (43) γ′ L = γDS′ τ,L⊆DS′ (44) The smaller (a) Example of Quick- sort. elements should be partitioned based on whether they are than the pivot or not. Even per- formed in secret shares, the process will disclose information the order about the input. (b) The sorting network of size 4 used to sort the sequence. It contains 5 comparison operations which are determined only by the network size. Thus, by extending the sorting network using the se- cure comparison and assignment protocols, both the value and the information can be pro- order tected. Fig. 6: Running examples of sorting the sequence (⟨3⟩, ⟨5⟩, ⟨4⟩, ⟨1⟩) using Quicksort and the sorting network. where L[j′] = γ′ (cid:40) 1, 0, j′ < j otherwise (45) Meanwhile, if ⟨γc⟩(c ∈ {1, . . . , C}) is permuted into ⟨γ′ S⟩ indicates the same sample, i.e., c⟩ such that for each entry j′, ⟨γ′ c⟩ and ⟨D′ ⟨γ′ c⟩[j′] = ⟨γi T Di c⊆T Di⟩[j] ⇐⇒ ⟨dj′⟩ = ⟨dT i j ,S⟩, (46) we can compute the statistics in Eq. 15 by replacing L, ⟨γ′ ⟨γL⟩, ⟨γR⟩, ⟨γc⟩ with γ′ R = 1 − γ′ L, γ′ c⟩, respec- tively. Note that the newly produced γ′ L is in plaintext thanks to the order of ⟨DS′⟩. Thus, it requires only O(C) secure multiplications to compute the statistics in Eq 15 for each threshold, where C is a small con- stant representing the number of classes. Based on the above observation, the key to the accel- eration is to securely sort the secretly shared distances and the indicating vectors of the class labels. Note that to satisfy the security in Definition 2, no any interme- diate information can be disclosed during the federated sorting, including not only the secretly shared values but also their order. Although we can protect each of the values using MPC, the common sorting algorithms, e.g., Quicksort or Merge sort, rely on the order information of the sort keys to reduce complexity. As a result, the order in- formation will be disclosed during their running, which violates the security in Definition 2. We take the Quick- sort as an example to illustrate the leakage of the order information, as is shown in Figure 6a. To address the security problem while achieving a complexity smaller than O(M 2), we adopt the sorting network [8] to securely sort the distances. Given an in- put size, the sorting network has a fixed order of com- parison operations, regardless of the order of the input ⟨3⟩⟨4⟩⟨1⟩⟨bb1,2⟩= (3<⟨5⟩)=⟨1⟩⟨bb3,4⟩= (4<⟨1⟩)=⟨0⟩(3<⟨1⟩)=⟨0⟩3514⟨5⟩1⟨3⟩⟨5⟩⟨4⟩⟨1⟩ppiiiiiiii(3<ppiiiiiiii)=⟨1⟩ppssppll?ppss=ppss+1Revealthatthefirstelementissmallerthanthepivot⟨3⟩⟨5⟩⟨4⟩⟨1⟩⟨5⟩⟨3⟩⟨1⟩⟨4⟩⟨4⟩⟨1⟩⟨3⟩⟨5⟩⟨3⟩⟨1⟩⟨4⟩⟨5⟩⟨bb1,2⟩=⟨1⟩⟨xx2⟩⟨xx1⟩⟨xx4⟩⟨xx3⟩⟨xx3⟩⟨xx4⟩⟨xx1⟩⟨xx2⟩⟨xx1⟩⟨xx4⟩⟨xx3⟩⟨xx2⟩⟨bb1,3⟩=⟨0⟩⟨bb3,4⟩=⟨0⟩⟨bb2,4⟩=⟨0⟩⟨bb2,3⟩=⟨0⟩⟨xx1⟩⟨xx2⟩⟨xx3⟩⟨xx4⟩⟨bb1,2⟩= (3<⟨5⟩)=⟨1⟩⟨bb3,4⟩= (4<⟨1⟩)=⟨0⟩⟨bb1,3⟩= (3<⟨1⟩)=⟨0⟩⟨bb2,4⟩= (5<⟨4⟩)=⟨0⟩⟨bb2,3⟩= (4<⟨3⟩)=⟨0⟩ 14 Zhiyu Liang, Hongzhi Wang sequence [8]. Therefore, we can protect both the value and the order information by performing the compari- son and swaping operations using the secure comparison and assignment protocols (see Section 3.3) respectively. Figure 6b is a running example of combining the sorting network and the MPC protocols. The distances ⟨DS⟩ is taken as the sorting key to permute both ⟨DS⟩ and ⟨γc⟩ (c ∈ {1, . . . , C}) con- sistently. The output corresponds to the assumption in Equation 42-43 and 46. The sorting network takes O(M log2 M ) interactive operations for the input of size M [8]. Thus, the complexity of computing each ⟨QIG(S)⟩ becomes O(M log2 M ), which is much smaller than the O(M 2) in ΠF edSS−B. Thus, we choose F-stat as the alternative measure to achieve the trade-off. Given DS = {dTj ,S}M c=1, the F-stat is defined as: {c}C j=1 and {yj}M j=1 where yj ∈ QF (S) = (cid:80)C c=1 (cid:80)C c=1(DS,c − DS)2/(C − 1) (cid:80) yj =c(dTj ,S − DS,c)2/(M − C) , (47) (cid:80) d d∈DS,c |DS,c| where DS,c = c with DS,c = {dTj ,S|yj = c}M of all distances. is the mean distance w.r.t. class j=1, and DS is the mean Similar to the IG computing in Section 5.1, we lever- age the indicating vector to indicate whether each sam- ple belongs to each of the C classes. Given Theorem 6 The sorting-based acceleration is secure under the security definition defined in Definition 2. ⟨DS⟩ = n−1 (cid:91) {⟨dT i j ,S⟩}Mi j=1, Proof (Proof Sketch) The main difference between the acceleration method and the basic protocol for the IG computation is the usage of the sorting network, which is proved to be data-oblivious [10]. Thus, the security of the sorting-based acceleration follows. 7.2 Alternative-Measures-based Trade-off As discussed at the beginning of Section 7, although IG- based method is superior in TSC accuracy, it is natu- rally difficult to efficiently compute this metric. To fur- ther accelerate the quality measure step, we propose to tap alternative measures that can be securely and more efficiently achieved in the FL setting, while guarantee- ing comparable TSC accuracy. The shapelet quality can be evaluated by other mea- sures, such as Kruskal-Wallis (KW) [54], Mood's Me- dian (MM) [54], and ANOVA F (F-stat) test [35]. How- ever, these quality measures are less considered in re- cent works [12,6,68], since they have no significant ad- vantage over IG in terms of both accuracy and effi- ciency, especially when the binary strategy [12] and the IG pruning technique [72] are integrated. In the brand new FL scenario, the expensive communication cost in- curred by interactive operations and the failure of the pruning for computing IG remind us to reexamine these alternatives. F-stat-based quality measurement. As shown in [35], using F-stat for TSC slightly outperforms the methods with KW and MM in terms of accuracy. More essen- tially, F-stat performs with O(M ) secure multiplica- tions and C + 1 secure divisions in the FL setting, while both KW and MM require O(M log2 M ) secure com- parison and assignment operations because they rely on secure sorting, and they also need C times of divisions. i=0 and the indicating vector ⟨γc⟩ (c ∈ {1, . . . , C}) as: ⟨γc⟩ = (⟨γ0 T D0 c ⊆T D0 ⟩, . . . , ⟨γn−1 c ⊆T Dn−1⟩), T Dn−1 the parties jointly compute the terms: ⟨DS,c⟩ = ⟨DS⟩ = ⟨DS⟩ * ⟨γc⟩ ⟨γc⟩ * 1 ⟨DS⟩ * 1 M . , c ∈ {1, . . . , C} (48) (49) (50) Next, they jointly compute: (cid:88) (dTj ,S − DS,c)2 = ⟨dc⟩ * ⟨dc⟩, c ∈ {1, . . . , C}, (51) yj =c where ⟨dc⟩[j] = ⟨γc⟩[j] * (⟨dTj ,S⟩ − DS,c), j ∈ {1, . . . , M }. (52) Then, the parties can jointly compute ⟨QF (S)⟩ by Equation 47. The protocol for ⟨QF (S)⟩ has a complexity of O(M ), while the computation of ⟨QIG(S)⟩ using our optimiza- tion in Section 7.1 still takes O(M log2 M ) interactive operations. Moreover, the empirical evaluation in Sec- tion 8.3 shows that the F-stat-based FedST achieves comparable accuracy to the prior IG-based solution. Theorem 7 The F-stat-based shapelet quality measure- ment is secure under the security definition defined in Definition 2. Proof (Proof Sketch) Similar to the IG-based method in Section 5.1 and Section 7.1, the input and output of the F-stat are both secret shares. The MPC operations and indicating vectors are used to make the computation data-oblivious. The security follows. FedST: Secure Federated Shapelet Transformation for Time Series Classification 15 8 Experiments In this section, we empirically evaluate the effectiveness of the FedST method and the acceleration techniques. 8.1 Experimental Setup Our experimental setups are as follows: Implementation. FedST is implemented in Python. We utilize the SPDZ library [41] for semi-honest additive- secret-sharing-based MPC. The security parameter is κ = 40, which ensures that the probability of infor- mation leakage, i.e., the quantity in Definition 2 is less than 2−λ (λ = κ) [15,14]. Environment. We build a cross-silo federated learning environment by running parties in isolated 16G RAM and 8 core Platinum 8260 CPUs docker containers in- stalled with Ubuntu 20.04 LTS. The parties communi- cate with each other through the docker bridge network with 4Gbps bandwidth. Datasets. We use both the real-world datasets and the synthetic datasets for evaluation at the following two different scales. To evaluate the effectiveness of FedST framework, we use the popular 117 fixed-length TSC datasets of the UCR Archive [21] that are collected from different types of applications, such as ECG or motion recognition. In the cross-silo and horizontal setting, each business has considerable (but still insufficient) training samples for every class. Thus, we randomly partition the training samples into 3 equal-size subsets to ensure each party has at least two samples for each class. Since there are 20 small datasets that cannot be partitioned as above, we omit them and test on the remaining 97 datasets. To investigate the effectiveness of the acceleration techniques, we first assess the efficiency improvement of these techniques using the synthetic datasets. Since the secure computation is data-independent, we randomly generate the synthetic datasets of varying parameters. Next, we compare the F-stat to the prior IG measure in terms of both accuracy and efficiency on the 97 UCR datasets to validate the effectiveness of the trade-off. Metrics. We use the accuracy to evaluate the classi- fication, which is measured as the number of samples that are correctly predicted over the testing dataset. For efficiency, we measure the running time of the pro- tocols in each step. (a) FedST vs LocalST (b) FedST vs GlobalST (c) FedST vs LocalS+FedT (d) FedST vs FedS+LocalT Fig. 7: Pairwise comparison between FedST and the baselines on 97 UCR datasets. The blue/black/red scat- ters represent the datasets where FedST wins/ties/loses the competitors. 8.2 Effectiveness of the FedST Framework Baselines. Since the advantage of the shapelet trans- formation against other TSC methods has been widely shown [7,6,68], we focus on investigating the effective- ness of enabling FL for TSC in terms of classification accuracy. To achieve this goal, we compare our FedST with the four baselines: - LocalST: the currently available solution that P0 performs the centralized shapelet transformation with only its own data; - GlobalST: the ideal solution that P0 uses the data of all parties for centralized shapelet transformation without privacy protection; - LocalS+FedT: a variant of FedST that P0 executes the shapelet search step locally and collaborates with the participants for federated data transformation and classifier training; - FedS+LocalT: a variant of FedST that P0 locally performs data transformation and classifier training us- ing the shapelets found through federated shapelet search. Following the centralized setting [6,35], we adopt random forest as the classifier over the transformed data for all the methods. The candidates are sampled with the length ranging from min(3, N 4 ) to N . The can- didate set size is M N and number of shapelets K is set 2 0.00.20.40.60.81.0/RFDO67$FFXUDF\0.00.20.40.60.81.0)HG67 RXUV $FFXUDF\Win: 81Tie: 2Loss: 140.00.20.40.60.81.0*OREDO67$FFXUDF\0.00.20.40.60.81.0)HG67 RXUV $FFXUDF\Win: 46Tie: 5Loss: 460.00.20.40.60.81.0/RFDO6)HG7$FFXUDF\0.00.20.40.60.81.0)HG67 RXUV $FFXUDF\Win: 85Tie: 1Loss: 110.00.20.40.60.81.0)HG6/RFDO7$FFXUDF\0.00.20.40.60.81.0)HG67 RXUV $FFXUDF\Win: 79Tie: 4Loss: 14 16 Zhiyu Liang, Hongzhi Wang to min{ N 2 , 200} and is reduced to 5 by clustering the found shapelets. The prior IG is used for assessing the shapelet quality. Pairwise comparison. Figure 7 reports the pairwise accuracy comparison of our FedST against the competi- tors. Figure 7a shows that FedST is more accurate than the LocalST on most of the datasets. It indicates the effectiveness of our basic idea of enabling FL to improve the TSC accuracy. Figure 7b shows that FedST achieves accuracy close to the non-private GlobalST, which co- incides with our analysis in Section 5.2. The slight dif- ference can be caused by two reasons. First, the global method samples the shapelets from all data, while in FedST the candidates are only generated by P0 for the interpretability constraints. Second, in secret sharing, the float values are encoded in fixed-point representa- tion for efficiency, which results in the truncation. For- tunately, we show later in Figure 8 that there is no statistically significant difference in accuracy between FedST and GlobalST. From Figure 7c and Figure 7d, we can see that both the variants are much worse than FedST. It means that both the stages of FedST are in- dispensable. Multiple comparisons. We present the critical dif- ference diagram [23] of the methods in Figure 8. It re- ports the mean ranking of accuracy among the 97 UCR datasets. The competitors falling in one clique (the bold horizontal line) have no statistical difference, while the opposite for the methods from different cliques. Fig- ure 8 shows that FedST is no statistically different from GlobalST and they both statistically significantly out- performs LocalST. It is notable that the variant con- ducting only local shapelet search (LocalS+FedT), even using all parties' data for transformation, is slightly in- ferior to LocalST. The reason could be that the locally selected shapelets have poor quality due to the lack of training data, which may cause the transformed data to be more misleading to degrade the accuracy. In com- parison, FedS+LocalT performs better than LocalST, because the shapelet quality is improved by FL with more training data used for shapelet search. Both vari- ants are much inferior to FedST, which indicates the positive effect of FL for both stages. 8.3 Effectiveness of the Acceleration Techniques Efficiency improvement. To assess the effectiveness of the proposed acceleration approaches, we first inves- tigate their efficiency improvement using the synthetic datasets of varying dataset size (M ), time series length (N ), number of parties (n) and candidate set size |SC|. Fig. 8: Critical difference diagram for our FedST and the baselines under the statistical level of 0.05. The average length of the shapelet candidates and the number of shapelets (K) are fixed to the moderate val- ues of 0.6N and 200, respectively. Overall, the results presented in Figure 9 coincide with our complexity anal- ysis. 1) Distance computation. Figure 9a-9c report the time of computing the shapelet distance between a can- didate S and all training samples T i j w.r.t. M , N , and n. The time for both ΠF edSS−B that directly uses MPC (d-MPC) and the optimization leveraging the proposed secure dot-product protocol (d-MPC+ΠDP) scale linearly to M and n. However, d-MPC+ΠDP can achieve up to 30x of speedup over d-MPC for the default N = 100. The time of d-MPC increases more quickly than d-MPC+ΠDP as N increases, because the complexity of d-MPC is quadratic w.r.t. N while our proposed d-MPC+ΠDP has a linear complexity of interactive operations. We also show the time of finding the minimum Eu- clidean norm (Find-Min), which is a subroutine of the shapelet distance computation. The results show that Find-Min is much faster than d-MPC, which is consistent with our analysis in Section 6 that the time of d-MPC is dominated by the Euclidean norm computation. In comparison, the time of d-MPC+ΠDP is very close to the time of Find-Min because the Euclidean norm com- putation time is substantially reduced (more than 58x speedup) with our ΠDP . 2) Quality measurement. We show the time of quality measurement for each candidate S with varying M and n in Figure 9d-9e. Compared to the IG compu- tation in the basic protocol (QIG), our proposed secure- sorting-based computation (QIG+Sorting) achieves a similar performance when M is small, but the time of QIG increases much faster than QIG+Sorting as M in- creases because QIG has a quadratic complexity to M . In comparison, the time of QIG+Sorting is dominated by the secure sorting protocol (Sorting), which has a com- plexity of O(M log2 M ). The optimized QIG+Sorting is also more scalable to n than QIG. Using F-stat in the quality measurement step (QF) can achieve more than 65x of speedup over the opti- mized QIG+Sorting. It is also noteworthy that QF is much faster than Sorting which bottlenecks the time CD=0.619543211.74GlobalST1.94FedST (ours)3.65FedS+LocalT3.76LocalST3.92LocalS+FedT FedST: Secure Federated Shapelet Transformation for Time Series Classification 17 (a) Time of distance computation w.r.t. M (b) Time of distance computation w.r.t. N (c) Time of distance computation w.r.t. n (d) Time of quality measurement w.r.t. M (e) Time of quality measurement w.r.t. n (f) Time of shapelet search w.r.t. M (g) Time of shapelet search w.r.t. N (h) Time of shapelet search w.r.t. n (i) Time of shapelet search w.r.t. |SC| Fig. 9: Performance of varying dataset size M (default 512), series length N (default 100), number of parties n (default 3), and candidate set size |SC| (default 500). of securely computing the KW and MM, as mentioned in Section 7.2. That is why we consider the F-stat for the acceleration. 3) Federated shapelet search. Finally, we assess the total running time of the federated shapelet search protocol with each proposed acceleration technique. The results are reported in Figure 9f-9i. Overall, an individual ΠDP -based acceleration (+ΠDP) brings 1.01-73.59x of improvement over ΠF edSS−B. The sorting-based (+Sorting) technique gives 1.01-96.17x of speedup alone and the F-stat-based method (+QF) indi- vidually achieves 1.01-107.76x of speedup. The combi- nation of these techniques is always more effective than each individual. ΠDP -based and Sorting-based methods together (+ΠDP+Sorting) contribute 15.12-630.97x of improvement, while the combination of the ΠDP -based and F-stat-based techniques (+ΠDP+QF) boosts the pro- tocol efficiency by 32.22-2141.64x. We notice from Figure 9f that the time of ΠF edSS−B is dominated by the distance computation when M is small. In this case, +ΠDP is more effective. With the increase of M , the quality measurement step gradually dominates the efficiency. As a result, the +Sorting and +QF play a more important role in acceleration. Simi- larly, Figure 9g shows that the efficiency is dominated by the quality measurement when N is small and is gradually dominated by the distance computation with N increases. The acceleration techniques for these two steps are always complementary with each other. It is also worth noting that the time of all competi- tors is nearly in direct proportion to |SC|, as shown in Figure 9i. The result is consistent with our analysis in Section 5.2 that the time for securely finding the top-K candidates (Algorithm 1 Line 10), which has a complex- ity of O(K * |SC|), is negligible compared to the time of distance computation and quality measurement. That is why we mainly dedicate to accelerating these two steps. Effectiveness of the trade-off strategy. We inves- tigate the effectiveness of the F-stat-based protocol in trading off TSC accuracy and the protocol efficiency. Specifically, we evaluate both the accuracy and the fed- erated shapelet search time for the two versions of FedST that adopt either the prior QIG (FedST-QIG) or the more efficient QF (FedST-QF). The experiments are con- ducted using 97 UCR datasets with the same setting as Section 8.2. Both the ΠDP -based and the sorting-based speedup methods are adopted. 27292112132152176DPSOHVM ORJ 1001011021031047LPH VHFORJ d-MPCd-MPC+DPFind-Min0500100015002000Length N100101102103104Time (sec, log)d-MPCd-MPC+DPFind-Min23510203DUWLHVn02040607LPH VHF d-MPCd-MPC+DPFind-Min27292112132152176DPSOHVM ORJ 1021001021041067LPH VHFORJ QIGSortingQIG+SortingQF23510203DUWLHVn02040607LPH VHF QIGSortingQIG+SortingQF27292112132152176DPSOHVM ORJ 1001021041061087LPH VHFORJ FedSSB+DP+Sorting+QF+DP+Sorting+DP+QF0500100015002000/HQJWKN1031051077LPH VHFORJ FedSSB+DP+Sorting+QF+DP+Sorting+DP+QF23510203DUWLHVn1021031041057LPH VHFORJ FedSSB+DP+Sorting+QF+DP+Sorting+DP+QF5001000150020002500&DQGLGDWHV||1021031041051067LPH VHFORJ FedSSB+DP+Sorting+QF+DP+Sorting+DP+QF 18 Zhiyu Liang, Hongzhi Wang Fig. 10: Accuracy and federated shapelet search time of FedST using different quality measures. Fig. 11: Critical difference diagram for FedST that uses different quality measures and the two baselines. The statistical level is 0.05. As shown in Figure 10 top, FedST-QF is faster than FedST-QIG on all 97 datasets. The efficiency improve- ment is 1.04-8.31x while the average speedup on the 97 datasets is 1.79x. Meanwhile, FedST-QF is better than FedST-QIG on 41 of the 97 datasets in terms of accuracy (Figure 10 bottom). The average accuracy of FedST-QF is just 0.5% lower than that of FedST-QIG. Figure 11 shows the critical difference diagram for these two methods and the two FL baselines (LocalST and GlobalST). The result indicates that FedST-QF achieves the same level of accuracy as FedST-QIG and GlobalST, and is significantly better than LocalST. In summary, our proposed F-stat-based trade-off strategy can effec- tively improve the efficiency of the federated shapelet search while guaranteeing comparable accuracy to the superior IG-based method. 8.4 Study of Interpretability Figure 12 demonstrates the interpretability of FedST using a real-world motion classification problem named GunPoint [21]. The data track the centroid of the ac- tors' right hand for two types of motions. For "Gun" (a) The best shapelets of each class. (b) The transformed data using the two shapelets. Fig. 12: Interpretability study using GunPoint [21]. class, they draw a replicate gun from a hip-mounted holster, point it at a target, then return the gun to the holster and their hands to their sides. For "No gun (Point)", the actors have their gun by their sides, point with their index fingers to a target, and then re- turn their hands. The best shapelets of the two classes are shown in Figure 12a, which are derived from the data of the initiator and represent the class-specific fea- tures, i.e., the hand tracks of drawing the gun (S1) and putting down the hand (S2). We transform all time se- ries samples into the distances to these shapelets and vi- sualize the results in Figure 12b. As can be seen, instead of considering the original time series space which has 150 data points per sample, by using the two shapelets, the classification can be explained with the concise rule that the samples more similar to S1 and distant from S2 belong to class "Gun" (red), and the opposite for the "No gun" data (blue). The study indicates that the shapelet-based features are easier to interpret than the raw time series. 8.5 Study of Flexibility We further investigate the flexibility of FedST as dis- cussed in Section 4.2. We evaluate the accuracy and the protocol running time on each of the 97 UCR datasets with the time contract varying from 10% to 90% of the maximum running time (the time evaluated in Sec- tion 8.3 using IG). Figure 13 reports the results. Over- all, the accuracy increases with more time is allowed, while the real running time is always close to the con- tract. It validates the effectiveness of balancing the ac- curacy and efficiency using the user-defined time con- tract, which is benificial for the practical utility. Note that with only 10% running time (approxi- mate 10% candidates assessed at random), FedST can achieve at least 77% of the maximum accuracy among the 97 datasets, which implies that the high-quality 051015202530354045505560657075808590951011001011021031047LPH PLQORJ 05101520253035404550556065707580859095'DWDVHW  0.20.30.40.50.60.70.80.91.0$FFXUDF\FedST-QIGFedST-QFCD=0.47643212.19GlobalST2.21FedST-QIG2.54FedST-QF3.07LocalST020406080100120140101Shapelet S1 of class 'Gun'Time series and shapelet of class 'Gun'020406080100120140012Shapelet S2 of class 'No gun'Time series and shapelet of class 'No gun'0.00.10.20.30.4Distance to shapelet of 'Gun' (dTi,S1)0.00.20.40.60.81.01.2Distance to shapelet of 'No gun' (dTi,S2)GunNo Gun FedST: Secure Federated Shapelet Transformation for Time Series Classification 19 model parameters. Many existing works have studied DP algorithms to protect the parameters of the com- monly used models [89,1,16], which can be seamlessly integrated into FedST. Therefore, we elaborate below on how to incorporate DP to the federated shapelet search. As defined in Definition 3, the federated shapelet search takes the parties' training time series data and the shapelet candidates as the input, and the output is the K candidates with the highest quality (QIG or QF depending on the used measure). Note that the quality of each candidate is evaluated using all training time se- ries samples. Therefore, we can keep the private training samples from being disclosed by protecting the quality of each individual candidate. To achieve this goal, we make the quality of the candidates noisy before retrieving the K best ones. Concisely, the parties jointly add secretly shared noises to the quality of all candidates using the se- cure random number generator [41]. The noise for each candidate should be identically and independently dis- tributed and follows a Laplace distribution whose pa- rameter is public and related to ε, which is referred to as the Laplace mechanism [26]. To this end, the parties retrieve the candidate with the maximum quality by executing the secure comparison and assignment pro- tocols (see Section 3.3) and reveal the index to P0. The two steps are repeated K times to find the noisy K best shapelets. The above algorithm for finding the maximum is referred to as the Report Noisy Max algorithm [26], which is (ε, 0)-differentially private. Thus, according to Theorem 3 in [25], the algorithm of retrieving the K best shapelet candidates by calling the Report Noisy Max algorithm is (ε′, δ′)-DP for any δ′ ≥ 0 where (cid:40) ε′ = min εK, εK( eε − 1 eε + 1 (cid:114) ) + 2ε2K ln( (cid:41) 1 δ′ ) . (54) In conclusion, the integration of DP provides an ad- ditional layer to protect the privacy of the revealed shapelets and models, which can further enhance the security of FedST. 10 Conclusion and future works This work studies how to customize federated learn- ing solution for the time series classification problem. We systematically investigate existing TSC methods for the centralized scenario and propose FedST, a novel FL-enabled TSC framework based on the centralized shapelet transformation. We design the security proto- col ΠF edSS−B for the FedST kernel, analyze its effec- Fig. 13: The accuracy (top) and real running time (bot- tom) w.r.t. the user-defined time contract. shapelets are highly redundant. The results also con- firm the feasibility of generating candidates from P0 in the cross-silo setting where each party has considerable (but insufficient) data. 9 Further Enhancement by Incorporating Differential Privacy As discussed in Section 4.1, FedST allows only the found shapelets and the learned models to be revealed to the initiator P0. In this section, we illustrate that we can incorporate differential privacy (DP) [26] for ad- ditional privacy protection, guaranteeing that the re- leased shapelets and models disclose limited informa- tion about the private training data of the parties. The differential privacy is defined as follows. Definition 5 (Differential Privacy) Formally, a func- tion f satisfies (ε, δ)-DP, if for any two data sets D and D′ differing in a single record and any output O of f , we have Pr[f (D) ∈ O] ≤ eε * Pr[f (D′) ∈ O] + δ, (53) where ε is the privacy budget controlling the tradeoff between the accuracy of f and the degree of privacy protection that f offers. Intuitively, the function f is differentially private since the probability of producing a given output (e.g., shapelets or models) is not highly dependent on whether a particular data record exists in D. As a result, the in- formation about each private record cannot be inferred from the output with a high probability. In FedST, we have two main stages: the federated shapelet search that produces the K best shapelets, and the data transformation and classifier training step which builds the classification model and outputs the 0.10.20.30.40.50.60.70.80.90.70.80.91.01.1$FFXUDF\  0.10.20.30.40.50.60.70.80.97LPH&RQWUDFW  0.10.30.50.70.95XQQLQJ7LPH  20 Zhiyu Liang, Hongzhi Wang tiveness, and identify its efficiency bottlenecks. To ac- celerate the protocol, we propose specific optimizations tailored for the FL setting. Both theoretical analysis and experiment results show the effectiveness of our proposed FedST framework and the acceleration tech- niques. In the future, we would like to consider other types of interpretable features to complement FedST. Fur- ther, we wish to develop high-performance system to support industrial-scale applications. References 1. Abadi, M., Chu, A., Goodfellow, I., McMahan, H.B., Mironov, I., Talwar, K., Zhang, L.: Deep learning with differential privacy. In: Proceedings of the 2016 ACM SIGSAC conference on computer and communications se- curity, pp. 308–318 (2016) 2. Abanda, A., Mori, U., Lozano, J.A.: A review on dis- tance based time series classification. Data Mining and Knowledge Discovery 33(2), 378–412 (2019) 3. Abspoel, M., Escudero, D., Volgushev, N.: Secure train- ing of decision trees with continuous attributes. Cryptol- ogy ePrint Archive (2020) 4. Aly, A., Smart, N.P.: Benchmarking privacy preserving scientific operations. In: International Conference on Ap- plied Cryptography and Network Security, pp. 509–529. Springer (2019) 5. Aono, Y., Hayashi, T., Trieu Phong, L., Wang, L.: Scal- able and secure logistic regression via homomorphic en- cryption. In: Proceedings of the Sixth ACM Conference on Data and Application Security and Privacy, pp. 142– 144 (2016) 6. Bagnall, A., Flynn, M., Large, J., Lines, J., Middlehurst, M.: A tale of two toolkits, report the third: on the usage and performance of hive-cote v1. 0. arXiv e-prints pp. arXiv–2004 (2020) 7. Bagnall, A., Lines, J., Bostrom, A., Large, J., Keogh, E.: The great time series classification bake off: a re- view and experimental evaluation of recent algorithmic advances. Data Mining and Knowledge Discovery 31, 606–660 (2017) 8. Batcher, K.E.: Sorting networks and their applications. In: Proceedings of the April 30–May 2, 1968, spring joint computer conference, pp. 307–314 (1968) 9. Beaver, D.: Efficient multiparty protocols using circuit In: Annual International Cryptology randomization. Conference, pp. 420–432. Springer (1991) 10. Bogdanov, D., Laur, S., Talviste, R.: A practical analy- sis of oblivious sorting algorithms for secure multi-party computation. In: Nordic Conference on Secure IT Sys- tems, pp. 59–74. Springer (2014) 11. Bonawitz, K., Ivanov, V., Kreuter, B., Marcedone, A., McMahan, H.B., Patel, S., Ramage, D., Segal, A., Seth, K.: Practical secure aggregation for privacy-preserving machine learning. In: proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security, pp. 1175–1191 (2017) 12. Bostrom, A., Bagnall, A.: Binary shapelet transform for In: Transactions multiclass time series classification. on Large-Scale Data-and Knowledge-Centered Systems XXXII, pp. 24–46. Springer (2017) 13. Cabello, N., Naghizade, E., Qi, J., Kulik, L.: Fast and accurate time series classification through supervised in- terval search. In: 2020 IEEE International Conference on Data Mining (ICDM), pp. 948–953. IEEE (2020) 14. Catrina, O., Hoogh, S.d.: Improved primitives for secure multiparty integer computation. In: International Con- ference on Security and Cryptography for Networks, pp. 182–199. Springer (2010) 15. Catrina, O., Saxena, A.: Secure computation with fixed- point numbers. In: International Conference on Finan- cial Cryptography and Data Security, pp. 35–50. Springer (2010) 16. Chaudhuri, K., Monteleoni, C.: Privacy-preserving logis- tic regression. Advances in neural information processing systems 21 (2008) 17. Chen, J., Zhang, A.: Fedmsplit: Correlation-adaptive fed- erated multi-task learning across multimodal split net- works. In: Proceedings of the 28th ACM SIGKDD Con- ference on Knowledge Discovery and Data Mining, pp. 87–96 (2022) 18. Chen, V., Pastro, V., Raykova, M.: Secure computa- arXiv preprint tion for machine learning with spdz. arXiv:1901.00329 (2019) 19. Cheng, K., Fan, T., Jin, Y., Liu, Y., Chen, T., Pa- padopoulos, D., Yang, Q.: Secureboost: A lossless fed- erated learning framework. IEEE Intelligent Systems 36(6), 87–98 (2021) 20. Damg ̊ard, I., Pastro, V., Smart, N., Zakarias, S.: Multi- party computation from somewhat homomorphic encryp- In: Annual Cryptology Conference, pp. 643–662. tion. Springer (2012) 21. Dau, H.A., Bagnall, A.J., Kamgar, K., Yeh, C.M., Zhu, Y., Gharghabi, S., Ratanamahatana, C.A., Keogh, E.J.: The UCR time series archive. CoRR abs/1810.07758 (2018). URL http://arxiv.org/abs/1810.07758 22. Dempster, A., Schmidt, D.F., Webb, G.I.: Minirocket: A very fast (almost) deterministic transform for time series classification. In: Proceedings of the 27th ACM SIGKDD conference on knowledge discovery & data mining, pp. 248–257 (2021) 23. Demˇsar, J.: Statistical comparisons of classifiers over mul- tiple data sets. The Journal of Machine learning research 7, 1–30 (2006) 24. Dheepadharshani, S., Anandh, S., Bhavinaya, K., La- vanya, R.: Multivariate time-series classification for auto- mated fault detection in satellite power systems. In: 2019 International Conference on Communication and Signal Processing (ICCSP), pp. 0814–0817. IEEE (2019) 25. Durfee, D., Rogers, R.M.: Practical differentially private top-k selection with pay-what-you-get composition. In: H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alch ́e- Buc, E. Fox, R. Garnett (eds.) Advances in Neural Infor- mation Processing Systems. Curran Associates, Inc. 26. Dwork, C., Roth, A., et al.: The algorithmic foundations of differential privacy. Foundations and Trends® in The- oretical Computer Science 9(3–4), 211–407 (2014) 27. Fang, W., Zhao, D., Tan, J., Chen, C., Yu, C., Wang, L., Wang, L., Zhou, J., Zhang, B.: Large-scale secure xgb for vertical federated learning. In: Proceedings of the 30th ACM International Conference on Information & Knowledge Management, pp. 443–452 (2021) 28. Fang, Z., Wang, P., Wang, W.: Efficient learning inter- pretable shapelets for accurate time series classification. In: 2018 IEEE 34th International Conference on Data Engineering (ICDE), pp. 497–508. IEEE (2018) 29. Fu, F., Shao, Y., Yu, L., Jiang, J., Xue, H., Tao, Y., Cui, B.: Vf2boost: Very fast vertical federated gradient FedST: Secure Federated Shapelet Transformation for Time Series Classification 21 boosting for cross-enterprise learning. In: Proceedings of the 2021 International Conference on Management of Data, pp. 563–576 (2021) 30. Fu, F., Xue, H., Cheng, Y., Tao, Y., Cui, B.: Blindfl: Vertical federated machine learning without peeking into your data. In: Proceedings of the 2022 International Con- ference on Management of Data, pp. 1316–1330 (2022) 31. Ghalwash, M.F., Radosavljevic, V., Obradovic, Z.: Ex- traction of interpretable multivariate patterns for early In: 2013 IEEE 13th International Confer- diagnostics. ence on Data Mining, pp. 201–210. IEEE (2013) 32. Goldreich, O., Oren, Y.: Definitions and properties of zero-knowledge proof systems. Journal of Cryptology 7(1), 1–32 (1994) 33. Gordon, D., Hendler, D., Rokach, L.: Fast randomized model generation for shapelet-based time series classifi- cation. arXiv preprint arXiv:1209.5038 (2012) 34. Grabocka, J., Schilling, N., Wistuba, M., Schmidt- Thieme, L.: Learning time-series shapelets. In: Proceed- ings of the 20th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 392–401. ACM (2014) 35. Hills, J., Lines, J., Baranauskas, E., Mapp, J., Bagnall, A.: Classification of time series by shapelet transforma- tion. Data mining and knowledge discovery 28(4), 851– 881 (2014) 36. Hou, L., Kwok, J.T., Zurada, J.M.: Efficient learning of In: Thirtieth Aaai conference on timeseries shapelets. artificial intelligence (2016) 37. Huang, Y., Chu, L., Zhou, Z., Wang, L., Liu, J., Pei, J., Zhang, Y.: Personalized cross-silo federated learning on non-iid data. In: AAAI, pp. 7865–7873 (2021) 38. Ioannidis, I., Grama, A., Atallah, M.: A secure protocol for computing dot-products in clustered and distributed environments. In: Proceedings International Conference on Parallel Processing, pp. 379–384. IEEE (2002) 39. Ismail Fawaz, H., Forestier, G., Weber, J., Idoumghar, L., Muller, P.A.: Deep learning for time series classification: a review. Data mining and knowledge discovery 33(4), 917–963 (2019) 40. Kairouz, P., McMahan, H.B., Avent, B., Bellet, A., Ben- nis, M., Bhagoji, A.N., Bonawitz, K., Charles, Z., Cor- mode, G., Cummings, R., et al.: Advances and open prob- lems in federated learning. Foundations and Trends® in Machine Learning 14(1–2), 1–210 (2021) 41. Keller, M.: Mp-spdz: A versatile framework for multi- party computation. In: Proceedings of the 2020 ACM SIGSAC conference on computer and communications se- curity, pp. 1575–1590 (2020) 42. Keller, M., Scholl, P., Smart, N.P.: An architecture for practical actively secure mpc with dishonest majority. In: Proceedings of the 2013 ACM SIGSAC conference on Computer & communications security, pp. 549–560 (2013) 43. Keogh, E., Wei, L., Xi, X., Lee, S.H., Vlachos, M.: Lb keogh supports exact indexing of shapes under ro- tation invariance with arbitrary representations and dis- tance measures. In: Proceedings of the 32nd international conference on Very large data bases, pp. 882–893. Cite- seer (2006) 44. Large, J., Bagnall, A., Malinowski, S., Tavenard, R.: On time series classification with dictionary-based classifiers. Intelligent Data Analysis 23(5), 1073–1089 (2019) 45. Le Nguyen, T., Gsponer, S., Ifrim, G.: Time series clas- sification by sequence learning in all-subsequence space. In: 2017 IEEE 33rd international conference on data en- gineering (ICDE), pp. 947–958. IEEE (2017) 46. Li, G., Choi, B., Xu, J., Bhowmick, S.S., Chun, K.P., Wong, G.L.H.: Shapenet: A shapelet-neural network ap- proach for multivariate time series classification. In: Pro- ceedings of the AAAI Conference on Artificial Intelli- gence, vol. 35, pp. 8375–8383 (2021) 47. Li, L., Fan, Y., Tse, M., Lin, K.Y.: A review of appli- cations in federated learning. Computers & Industrial Engineering 149, 106,854 (2020) 48. Li, Q., Wen, Z., He, B.: Practical federated gradient boosting decision trees. In: Proceedings of the AAAI con- ference on artificial intelligence, vol. 34, pp. 4642–4649 (2020) 49. Li, T., Sahu, A.K., Talwalkar, A., Smith, V.: Feder- ated learning: Challenges, methods, and future direc- IEEE Signal Processing Magazine 37(3), 50–60 tions. (2020) 50. Li, X., Dowsley, R., De Cock, M.: Privacy-preserving fea- ture selection with secure multiparty computation. In: International Conference on Machine Learning, pp. 6326– 6336. PMLR (2021) 51. Li, Z., Ding, B., Zhang, C., Li, N., Zhou, J.: Federated matrix factorization with privacy guarantee. Proceedings of the VLDB Endowment 15(4), 900–913 (2021) 52. Liang, Z., Wang, H.: Efficient class-specific shapelets In- learning for interpretable time series classification. formation Sciences 570, 428–450 (2021) 53. Liang, Z., Wang, H.: Fedtsc: A secure federated learn- ing system for interpretable time series classification. Proc. VLDB Endow. 15(12), 3686–3689 (2022). DOI 10.14778/3554821.3554875. URL https://doi.org/10. 14778/3554821.3554875 54. Lines, J., Bagnall, A.: Alternative quality measures for time series shapelets. In: International Conference on Intelligent Data Engineering and Automated Learning, pp. 475–483. Springer (2012) 55. Lines, J., Taylor, S., Bagnall, A.: Time series classifica- tion with hive-cote: The hierarchical vote collective of transformation-based ensembles. ACM Transactions on Knowledge Discovery from Data 12(5) (2018) 56. Liu, J., Lou, J., Xiong, L., Liu, J., Meng, X.: Projected federated averaging with heterogeneous differential pri- vacy. Proceedings of the VLDB Endowment 15(4), 828– 840 (2021) 57. Liu, Y., Kang, Y., Xing, C., Chen, T., Yang, Q.: A secure federated transfer learning framework. IEEE Intelligent Systems 35(4), 70–82 (2020) 58. Liu, Y., Wu, W., Flokas, L., Wang, J., Wu, E.: Enabling sql-based training data debugging for federated learn- ing. Proc. VLDB Endow. 15(3), 388–400 (2021). DOI 10.14778/3494124.3494125. URL https://doi.org/10. 14778/3494124.3494125 59. Ma, Q., Zhuang, W., Cottrell, G.: Triple-shapelet net- works for time series classification. In: 2019 IEEE Inter- national Conference on Data Mining (ICDM), pp. 1246– 1251. IEEE (2019) 60. Ma, Q., Zhuang, W., Li, S., Huang, D., Cottrell, G.: Ad- versarial dynamic shapelet networks. In: Proceedings of the AAAI Conference on Artificial Intelligence, vol. 34, pp. 5069–5076 (2020) 61. Mammen, P.M.: Federated learning: opportunities and challenges. arXiv preprint arXiv:2101.05428 (2021) 62. Marfoq, O., Xu, C., Neglia, G., Vidal, R.: Throughput- optimal topology design for cross-silo federated learning. Advances in Neural Information Processing Systems 33, 19,478–19,487 (2020) 63. McMahan, B., Moore, E., Ramage, D., Hampson, S., y Arcas, B.A.: Communication-efficient learning of deep 22 Zhiyu Liang, Hongzhi Wang networks from decentralized data. gence and statistics, pp. 1273–1282. PMLR (2017) 64. McMahan, H.B., Moore, E., Ramage, D., y Arcas, B.A.: Federated learning of deep networks using model averag- ing. arXiv preprint arXiv:1602.05629 2 (2016) In: Artificial intelli- 65. McMahan, H.B., Ramage, D., Talwar, K., Zhang, L.: Learning differentially private recurrent language mod- els. arXiv preprint arXiv:1710.06963 (2017) 66. Middlehurst, M., Large, J., Bagnall, A.: The canonical interval forest (cif) classifier for time series classification. In: 2020 IEEE international conference on big data (big data), pp. 188–195. IEEE (2020) 67. Middlehurst, M., Large, J., Cawley, G., Bagnall, A.: The temporal dictionary ensemble (tde) classifier for time se- ries classification. In: Joint European Conference on Ma- chine Learning and Knowledge Discovery in Databases, pp. 660–676. Springer (2020) 68. Middlehurst, M., Large, J., Flynn, M., Lines, J., Bostrom, A., Bagnall, A.: Hive-cote 2.0: a new meta ensemble for time series classification. Machine Learning 110(11), 3211–3243 (2021) 69. Middlehurst, M., Vickers, W., Bagnall, A.: Scalable dic- tionary classifiers for time series classification. In: Inter- national Conference on Intelligent Data Engineering and Automated Learning, pp. 11–19. Springer (2019) 70. Mohassel, P., Zhang, Y.: Secureml: A system for scalable privacy-preserving machine learning. In: 2017 IEEE sym- posium on security and privacy (SP), pp. 19–38. IEEE (2017) 71. Molnar, edn. C.: (2022). Interpretable Machine Learning, URL christophm.github.io/ 2 interpretable-ml-book/ 72. Mueen, A., Keogh, E., Young, N.: Logical-shapelets: an expressive primitive for time series classification. In: Pro- ceedings of the 17th ACM SIGKDD international confer- ence on Knowledge discovery and data mining, pp. 1154– 1162 (2011) 73. Muhammad, K., Wang, Q., O'Reilly-Morgan, D., Tra- gos, E., Smyth, B., Hurley, N., Geraci, J., Lawlor, A.: Fedfast: Going beyond average for faster training of fed- erated recommender systems. In: Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pp. 1234–1242 (2020) 74. Nikolaenko, V., Weinsberg, U., Ioannidis, S., Joye, M., Boneh, D., Taft, N.: Privacy-preserving ridge regression on hundreds of millions of records. In: 2013 IEEE sympo- sium on security and privacy, pp. 334–348. IEEE (2013) 75. Pan, Q., Zhu, Y.: Fedwalk: Communication efficient fed- erated unsupervised node embedding with differential privacy. Proceedings of the 28th ACM SIGKDD Con- ference on Knowledge Discovery and Data Mining (2022) 76. P ́erez-D'Arpino, C., Shah, J.A.: Fast target prediction of human reaching motion for cooperative human-robot ma- nipulation tasks using time series classification. In: 2015 IEEE international conference on robotics and automa- tion (ICRA), pp. 6175–6182. IEEE (2015) 77. Rakthanmanon, T., Campana, B., Mueen, A., Batista, G., Westover, B., Zhu, Q., Zakaria, J., Keogh, E.: Search- ing and mining trillions of time series subsequences under dynamic time warping. In: Proceedings of the 18th ACM SIGKDD international conference on Knowledge discov- ery and data mining, pp. 262–270 (2012) 78. Ramirez, E., Wimmer, M., Atzmueller, M.: A computa- tional framework for interpretable anomaly detection and classification of multivariate time series with application In: Artificial Intelligence to human gait data analysis. in Medicine: Knowledge Representation and Transparent and Explainable Systems, pp. 132–147. Springer (2019) 79. Ruiz, A.P., Flynn, M., Large, J., Middlehurst, M., Bag- nall, A.: The great multivariate time series classification bake off: a review and experimental evaluation of recent algorithmic advances. Data Mining and Knowledge Dis- covery 35(2), 401–449 (2021) 80. Shokri, R., Shmatikov, V.: Privacy-preserving deep learn- ing. In: Proceedings of the 22nd ACM SIGSAC con- ference on computer and communications security, pp. 1310–1321 (2015) 81. Smith, V., Chiang, C.K., Sanjabi, M., Talwalkar, A.S.: Federated multi-task learning. Advances in neural infor- mation processing systems 30 (2017) 82. Susto, G.A., Cenedese, A., Terzi, M.: Time-series classi- fication methods: Review and applications to power sys- tems data. Big data application in power systems pp. 179–220 (2018) 83. Tan, C.W., Dempster, A., Bergmeir, C., Webb, G.I.: Mul- tirocket: Multiple pooling operators and transformations for fast and effective time series classification. Data Min- ing and Knowledge Discovery pp. 1–24 (2022) 84. Tang, W., Long, G., Liu, L., Zhou, T., Blumenstein, M., Jiang, J.: Omni-scale cnns: a simple and effective kernel size configuration for time series classification. In: Inter- national Conference on Learning Representations (2021) 85. Tong, Y., Pan, X., Zeng, Y., Shi, Y., Xue, C., Zhou, Z., Zhang, X., Chen, L., Xu, Y., Xu, K., et al.: Hu-fu: efficient and secure spatial queries over data federation. Proceed- ings of the VLDB Endowment 15(6), 1159 (2022) 86. Voigt, P., Von dem Bussche, A.: The eu general data pro- tection regulation (gdpr). A Practical Guide, 1st Ed., Cham: Springer International Publishing 10(3152676), 10–5555 (2017) 87. Wang, Y., Tong, Y., Shi, D., Xu, K.: An efficient ap- proach for cross-silo federated learning to rank. In: 2021 IEEE 37th International Conference on Data Engineering (ICDE), pp. 1128–1139. IEEE (2021) 88. Wei, K., Li, J., Ding, M., Ma, C., Yang, H.H., Farokhi, F., Jin, S., Quek, T.Q., Poor, H.V.: Federated learning with differential privacy: Algorithms and performance anal- ysis. IEEE Transactions on Information Forensics and Security 15, 3454–3469 (2020) 89. Wu, Y., Cai, S., Xiao, X., Chen, G., Ooi, B.C.: Privacy preserving vertical federated learning for tree-based mod- els. Proceedings of the VLDB Endowment 13(11) 90. Yang, Q., Liu, Y., Chen, T., Tong, Y.: Federated machine learning: Concept and applications. ACM Transactions on Intelligent Systems and Technology (TIST) 10(2), 1– 19 (2019) 91. Yang, S., Ren, B., Zhou, X., Liu, L.: Parallel distributed logistic regression for vertical federated learning without third-party coordinator. arXiv preprint arXiv:1911.09824 (2019) 92. Yao, A.C.: Protocols for secure computations. In: 23rd annual symposium on foundations of computer science (sfcs 1982), pp. 160–164. IEEE (1982) 93. Ye, L., Keogh, E.: Time series shapelets: a novel tech- nique that allows accurate, interpretable and fast classi- fication. Data mining and knowledge discovery 22(1-2), 149–182 (2011) 94. Zhang, C., Li, S., Xia, J., Wang, W., Yan, F., Liu, Y.: {BatchCrypt}: Efficient homomorphic encryption for In: 2020 USENIX an- {Cross-Silo} federated learning. nual technical conference (USENIX ATC 20), pp. 493– 506 (2020) FedST: Secure Federated Shapelet Transformation for Time Series Classification 23 95. Zhang, C., Xie, Y., Bai, H., Yu, B., Li, W., Gao, Y.: A survey on federated learning. Knowledge-Based Systems 216, 106,775 (2021) 96. Zheng, W., Deng, R., Chen, W., Popa, R.A., Panda, A., Stoica, I.: Cerebro: A platform for {Multi-Party} crypto- graphic collaborative learning. In: 30th USENIX Security Symposium (USENIX Security 21), pp. 2723–2740 (2021)
http://arxiv.org/abs/2302.10625v1
2023-02-21T12:22:47
2023-02-21T12:22:47
Estimating long-term causal effects from short-term experiments and long-term observational data with unobserved confounding
Understanding and quantifying cause and effect is an important problem in many domains. The generally-agreed solution to this problem is to perform a randomised controlled trial. However, even when randomised controlled trials can be performed, they usually have relatively short duration's due to cost considerations. This makes learning long-term causal effects a very challenging task in practice, since the long-term outcome is only observed after a long delay. In this paper, we study the identification and estimation of long-term treatment effects when both experimental and observational data are available. Previous work provided an estimation strategy to determine long-term causal effects from such data regimes. However, this strategy only works if one assumes there are no unobserved confounders in the observational data. In this paper, we specifically address the challenging case where unmeasured confounders are present in the observational data. Our long-term causal effect estimator is obtained by combining regression residuals with short-term experimental outcomes in a specific manner to create an instrumental variable, which is then used to quantify the long-term causal effect through instrumental variable regression. We prove this estimator is unbiased, and analytically study its variance. In the context of the front-door causal structure, this provides a new causal estimator, which may be of independent interest. Finally, we empirically test our approach on synthetic-data, as well as real-data from the International Stroke Trial.
[ "Graham Van Goffrier", "Lucas Maystre", "Ciarán Gilligan-Lee" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10625v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10625v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "stat.ML", "@scheme": "http://arxiv.org/schemas/atom" }
[ "stat.ML", "cs.LG" ]
3 2 0 2 b e F 1 2 ] L M . t a t s [ 1 v 5 2 6 0 1 . 2 0 3 2 : v i X r a Proceedings of Machine Learning Research vol TBD:1–22, 2023 2nd Conference on Causal Learning and Reasoning Estimating long-term causal effects from short-term experiments and long-term observational data with unobserved confounding Graham Van Goffrier Department of Physics and Astronomy, University College London* Lucas Maystre Spotify [email protected] [email protected] Ciarán Gilligan-Lee Spotify & Department of Physics and Astronomy, University College London [email protected], [email protected] Editors: Mihaela van der Schaar, Dominik Janzing and Cheng Zhang Abstract Understanding and quantifying cause and effect is an important problem in many domains. The generally-agreed solution to this problem is to perform a randomised controlled trial. However, even when randomised controlled trials can be performed, they usually have relatively short duration's due to cost considerations. This makes learning long-term causal effects a very challenging task in practice, since the long-term outcome is only observed after a long delay. In this paper, we study the identification and estimation of long-term treatment effects when both experimental and observational data are available. Previous work provided an estimation strategy to determine long- term causal effects from such data regimes. However, this strategy only works if one assumes there are no unobserved confounders in the observational data. In this paper, we specifically address the challenging case where unmeasured confounders are present in the observational data. Our long-term causal effect estimator is obtained by combining regression residuals with short-term experimental outcomes in a specific manner to create an instrumental variable, which is then used to quantify the long-term causal effect through instrumental variable regression. We prove this estimator is unbiased, and analytically study its variance. In the context of the front-door causal structure, this provides a new causal estimator, which may be of independent interest. Finally, we empirically test our approach on synthetic-data, as well as real-data from the International Stroke Trial. Keywords: Long-term causal effects, latent confounding, linear Structural Causal Models 1. Introduction Quantifying cause and effect relationships is of fundamental importance in many fields, from medicine to economics (Richens et al. (2020); Gilligan-Lee (2020)). The gold standard solution to this problem is to conduct randomised controlled trials, or A/B tests. However, in many situations, such trials cannot be performed; they could be unethical, too expensive, or just technologically infeasible. However, even when randomised controlled trials can be performed, they usually have relatively short durations due to cost considerations. For example, online A/B tests in industry usually last for only a few weeks (Gupta et al., 2019). This makes learning long-term causal effects a very challenging task in practice, since long-term outcomes are often observed only after a long delay. Often short-term outcomes are different to long-term ones (Kohavi et al., 2012), and, as many decision-makers are interested in long-term outcomes, this is a crucial problem to address. For * Research was started while this author as an intern at Spotify. © 2023 G.V. Goffrier, L. Maystre & C. Gilligan-Lee. GOFFRIER MAYSTRE GILLIGAN-LEE instance, technology companies are interested in understanding the impact of deploying a feature on long-term retention (Chandar et al., 2022), economists are interested in long-term outcomes of job training programs (Athey et al., 2019), and doctors are interested in the long-term impacts of medical interventions, such as treatments for stroke (Carolei, 1997). In contrast to experimental data, observational data are often easier and cheaper to acquire, so they are more likely to include long-term outcome observations. Previous work by Athey et al. (2019) devised a method to estimate long-term causal effects by combining observational long-term data and short-term experimental data. However, this strategy only works if one assumes there are no unobserved confounders in the observational data. Nevertheless, observational data are very susceptible to unmeasured confounding, which can lead to severely biased treatment effect estimates. Can we combine these short-term experiments with observational data to estimate long-term causal effects when latent confounders are present in observational data? In this paper, we address this problem and study the identification and estimation of long- term treatment effects when both short-term experimental data and observational data with latent confounders are available. We initially work with linear structural equation models. Our long-term causal effect estimator is obtained by combining regression residuals with short-term experimental data in a specific manner to create an instrumental variable, which is then used to quantify the long- term causal effect through instrumental variable regression. We prove that this estimator is unbiased, and analytically study its variance. When applied in the front-door causal structure, this strategy provides a new causal estimator, which may be of independent interest. We extend this estimator from linear structural causal models to the partially linear structural models routinely studied in economics (Chernozhukov et al., 2016) and prove unbiasedness still holds under mild assumptions. Finally, we empirically test our long-term causal effect estimator, demonstrating accurate estimation of long-term effects on synthetic data, as well as real data from the International Stroke Trial. Although long-term effect estimation is our primary focus, the estimator and methods described can be applied to any single-stage causal effect. In this context, they can be interpreted as a novel strategy that combines Front-Door and Instrument Variables to estimate causal effects in the presence of unobserved confounders. In summary, our main contributions are: 1. An algorithm for estimating long-term causal effects unbiasedly from both short-term experi- ments and observational data with latent confounders in linear structural causal models. This approach allows for continuous treatment variables-hence can deal with treatment dosages. 2. An analytical study of the variance of this estimator. 3. An extension of our estimator from linear structural causal models to partially linear structural models and a proof that unbiasedness still holds under a weak assumption. 4. An empirical demonstration of our long-term causal effect estimator on synthetic and real data. Relevant source code and documentation has been made freely available in our online repository. 2. Related work Estimating long-term causal effects The estimation of long-term causal effects from short-term experiments and observational data was initiated by Athey et al. (2019). The authors of that work 2 ESTIMATING LONG-TERM CAUSAL EFFECTS IN THE PRESENCE OF UNOBSERVED CONFOUNDING devised a method to estimate such quantities by making use of short-term mediators, or surrogates, of the treatment. Their estimation strategy was comprised of two parts: first, they use the experimental data to determine the impact of the treatment on the surrogates, and then combined this impact with a predictive causal model that used the observational data to predict the impact of a change in the surrogates on the long-term outcome. This allowed them to predict the impact of the treatment on the long-term outcome directly at the end of the short-term experiment. However, this strategy only works if one assumes there are no unobserved confounders in the observational data. Recent work by Cheng et al. (2021) has expanded this approach with tools from machine learning, by learning efficient representations of the surrogates-again requiring there to be no unobserved confounders. More recent work by Imbens et al. (2022) has explored estimating long-term causal effects when unobserved confounders are present. These authors utilised results from the proximal causal inference literature, see Tchetgen et al. (2020) for an overview of these results, in their estimation strategy. However, to make use of these results, the authors have to assume existence of three sequential mediators between the treatment and long-term outcome, and that these satisfy completeness conditions that, informally, require any variation in the latent confounders is captured by variation in the mediators. Our results, on the other hand, provide long-term treatment effect estimators that are unbiased even in the presence of latent confounders that do not require such sequential mediators that are strong proxies for the latent confounders. Combining experimental and observational data Beyond using observational data and short- term experimental data to estimate long-term causal effects, previous work has explored other advantages of combining observational and experimental data. Indeed, Bareinboim and Pearl (2016) have investigated non-parametric identifiability of causal effects using both observational and ex- perimental data, and how one can utilise such data regimes to transport causal effects learned in one data to another, in a paradigm they refer to as "data fusion." Moreover, Jeunen et al. (2022) has shown that one can learn to disentangle the effects of multiple, simultaneously-applied interventions by combining observational data with experimental data from joint interventions. Lastly, Ilse et al. (2021) demonstrated the most efficient way to combine observational and experimental data to learn certain causal effects. They showed they could significantly reduce the number of samples from the experimental data required to achieve a desired estimation accuracy. Linear structural causal models Many previous authors have worked in the linear structural causal model formalism. Indeed, Shimizu et al. (2006) has shown that one can recover causal structure given just observational data if one assumes an underlying linear structural causal model with non-Gaussian noise. Gupta et al. (2021) has utilised this formalism to derive closed form expressions for the bias and variance of treatment effect estimators when both observed confounders and mediators are present. Cinelli et al. (2019) has derived closed-form expressions for the treatment effect bias when there are unobserved confounders in the dataset under investigation. Lastly, Zhang et al. (2022) has explored what conditions lead to bias when estimating causal effects from non-IID data, and how can we remove such bias given certain assumptions. 3. Methods This section is structured as follows. We first define linear structural causal models with Gaussian noise, the class of models we will mainly be working with in this paper. As a warm up to our main problem, we first explore long-term effect estimation when latent confounding influences the 3 GOFFRIER MAYSTRE GILLIGAN-LEE W (cid:15) b d c a X M Figure 1: Causal graph with mediator confounded by latent W . Y short-term treatment and long-term outcome, but does not influence the mediator. We note that this confounding may represent a single cause which persists through both short-term and long-term timescales. The causal structure in this particular case corresponds to the front-door structure studied in Pearl (2009). In this case, we derive-to our knowledge-a novel causal effect estimator for the front-door criterion, which may be of independent interest. This estimator is biased when latent confounding is present between the treatment and long-term outcome. However, the way the bias manifests is instructive, and suggests a way to adapt this estimation strategy to make it unbiased in this case. We prove that the estimator based on this strategy is indeed unbiased in the presence of latent confounding, and analytically study its variance. Finally, we extend this estimator from linear structural causal models to partial linear structural models, and prove that its bias is small in the presence of latent confounding if the treatment is strongly correlated with the latent confounder. 3.1. Setting up the problem Motivated by the desire to unbiasedly combine short-term experimental data with long-term observa- tional data, we define the following linear Gaussian structural causal model, which we will refer to as the linear confounded-mediator model (CMM): Wi = uW i , Xi = dWi + uX i , Mi = cXi + (cid:15)Wi + uM i , Yi = aMi + bWi + uY i , (1) where index i runs over samples. Here, X,M ,Y ,W are respectively the treatment, short-term mediator, long-term outcome, and latent confounder. The causal structure for this model is depicted in Figure 1. * For the observed variables X,M ,Y , the uN i are independent Gaussian noise terms with zero mean: uN in the latent confounder structural equation is also an independent Gaussian noise term, but it has non-zero mean μuW (cid:54)= 0: i ∼ N (μuW , σ2 uW uN ) for node N ∈ {X, M, Y }. The term uW i ∼ N (0, σ2 i The framework having been defined, the typically desired treatment effect is ac. But, as we assume that c can be estimated unbiasedly from experimental data, our goal is to estimate a given c and an observational dataset of samples from (X, M, Y ). That is, we ask to what extent it is possible to transfer knowledge of causation before a mediator to knowledge of causation after that mediator, in the presence of unobserved confounding on that mediator. For example, we could take c to have been conclusively estimated via an A/B test, while a is inaccessible to such experimentation due to its long timescale. This question also naturally arises in the context of chains of NM mediator variables, uW ). *. In this work we assume the causal structure follows Figure 1. To gain confidence in this assumption, one could employ causal discovery algorithms, see Lee and Spekkens (2017); Dhir and Lee (2020); Gilligan-Lee et al. (2022) for more information on these algorithms. 4 ESTIMATING LONG-TERM CAUSAL EFFECTS IN THE PRESENCE OF UNOBSERVED CONFOUNDING where the statistician hopes to propagate knowledge of an early mediation stage 'down the chain'. Although we focus on scalar-valued variables throughout, an extension of this methodology to vector- valued W and M would be straightforward, only requiring an expansion of the covariance-matrix formalism outlined in Appendix A and interpreting (cid:15) as matrix-valued. 3.2. Warm-up: a mediator without confounding With (cid:15) = 0 the CMM in Figure 1 is the standard mediator-or front-door-model, treated thoroughly in the linear setting by Gupta et al. (2021). It is well-known that so long as mediator M is not directly confounded, a may be unbiasedly estimated by the front-door criterion estimator (FDC): ˆaF DC = P (Y |do(M )) = (cid:88) X P (Y |M, X)P (X) = (X.X)(M.Y ) − (X.M )(X.Y ) (X.X)(M.M ) − (X.M )2 , (2) where we have used A.B as a shorthand for sample-space inner product (cid:80) knowledge of c is needed. Indeed c can be unbiasedly estimated by regressing M on X here. i Ai * Bi. Note that no We now give an alternative derivation of the FDC in terms of instrumental variables, a review of which is given in Pearl (2009). Essentially, an instrument for a causal arrow a : M → Y is a variable I such that a nonzero arrow f : I → M exists, and I is uncorrelated with any other causes of Y , such as W or uY in the CMM. Consider the ordinary least squares (OLS) regression of M on X, which trivially produces an unbiased estimator ˆc = M.X X.X . Naively rearranging the structural equation, the residual of this estimator appears to be noise uM . Constructing the true residual, we see that this still holds once all covariances are accounted for, Rc ≡ M − OLS[M |X]X, (3) following from independence of uM from uX and uW , the terminal causes of X. For the same reason, this residual Rc = uM is a valid instrument for a : M → Y , as seen by constructing the relevant instrumental estimator: ˆaRc = OLS[Y |Rc] OLS[M |Rc] . (4) The above expression may be phrased entirely in terms of observed variables by making the substitu- tion uM (cid:55)→ M − M.X X.X X. Simplifying, we arrive at ˆaRc = ˆaFDC. Hence, our instrumental-inspired estimator is unbiased and equal to the previously known estimator that follows from the front-door criterion. We will refer to Res[M |X] corresponding to c : X → M more generally as the c-residual Rc. To our knowledge, this construction of the FDC via an instrumental estimator has not appeared in the literature, and we will refer to it as the Instrumental FDC (IFDC). 3.3. The Instrumental FDC for confounded mediators A causal arrow (cid:15) : W → M violates the conditions for the FDC. Our reason for introducing the IFDC is that it facilitates a natural extension of the FDC to the confounded mediator model, and more generally to any model with pathway X → M → Y as a subgraph. The IFDC estimator can be presumed biased since W and M are no longer d-separated after conditioning on X. Expressions for the IFDC biases on a (and corresponding OLS bias on c) are derived in Appendix B and are given by: Bias[ˆcOLS] = d(cid:15)σ2 d2σ2 uW uW + σ2 uX Bias[ˆaRc] = (cid:15)2σ2 uW σ2 uX 5 b(cid:15)σ2 + σ2 uW uM σ2 uX (σ2 uX + d2σ2 uW ) (5) GOFFRIER MAYSTRE GILLIGAN-LEE The bias on c vanishes if d (cid:29) (cid:15) or σ2 uX or σ2 uM uM − (cid:15) However, computing the correlations of the residual with X and W in full reveals a surprise: uX , (cid:29) b(cid:15)σ2 uW . From the structural equations, we might naively expect residual Res[M |X] = d uX , and therefore explain the bias on ˆaRc by the lack of independence between uX and X. uW , while the bias on a vanishes if (cid:15) (cid:29) b, σ2 uM d2 σ2 (cid:29) σ2 (cid:29) b(cid:15) E[Cov(Rc, X)] = E[M.X − M.X X.X X.X] = 0 E[Cov(Rc, W )] = (cid:18) (cid:15) d2(N − 1) σ2 uX + E (cid:21)(cid:19) (cid:20) (X.uX )2 X.X > 0 (6) (7) This is a lesson in not relying too heavily on the intuition of structural equations for confounding variables: the bias on ˆaRc in fact arises entirely from correlation between Rc and W . In the following we will see that the residual instrument can be modified to retain unbiasedness if c is known. 3.4. The (cid:15)/d-improved IFDC We propose that the most direct route to propagate improved knowledge of c forward, in order to improve the IFDC estimator for a, is via intermediate knowledge of the quantity (cid:15) d . Ratios are desirable targets for estimation because they are insensitive to correlated biases on their numerator and denominator, and this particular ratio naively manifests in Rc as controlling the size of the biasing uX term. We have identified several strategies for constructing estimators for (cid:15) d , with a ratio estimator based on X = dW + uX and the residual M − cX ∼ (cid:15)W + uM proving the most successful: (cid:17) (cid:100)(cid:16) (cid:15) d = M − cX ̄X (8) where ̄A denotes the sample mean (cid:80) i(Ai)/N . This estimator is unbiased in the limit of large samples, as μuW (cid:54)= 0 and μuX = μuM = 0. It is possible that superior estimators exist, but we find the ratio estimator to be adequate for our purposes. The " (cid:15) d -improved" residual is then defined as the portion of M which is leftover after removing all causal contributions from X, both via direct path c and backdoor path (cid:15)/d: (cid:17) RR = Rc − (cid:100)(cid:16) (cid:15) d X = M − (cid:17)(cid:19) (cid:18) c + (cid:100)(cid:16) (cid:15) d X. (9) This construction leaves a door open to joint estimation of c and (cid:15) d from the prior stage in the model, in the sense that only the sum is needed and biases of opposite sign could destructively interfere, but we do not explore this further. The resultant instrumental estimator for a takes the form: ˆaRR = RR.Y RR.M = M.Y − M.M − (cid:16) (cid:16) (cid:1)(cid:17) c + (cid:100)(cid:0) (cid:15) d (cid:1)(cid:17) c + (cid:100)(cid:0) (cid:15) d X.Y X.M . (10) For convenience in application by the reader, we express our estimation strategy in algorithmic form: In the next section we show this strategy unbiasedly estimates the causal effect of M on Y . 6 ESTIMATING LONG-TERM CAUSAL EFFECTS IN THE PRESENCE OF UNOBSERVED CONFOUNDING d -improved Instrumental FDC Estimator Algorithm 1 (cid:15) Input: Short-term experimental dataset E = {X, M }, observational dataset O = {X, M, Y } Output: Estimator for causal effect of M on Y . 1: From E, estimate causal effect of X on M : c. 2: Using samples from O, regress M on X and compute residual: Rc 3: Using samples from O, compute sample mean of M − cX and X and take their ratio: (cid:15)/d. 4: Compute Rc − (cid:15) 5: Use RR in instrumental variable regression to estimate the causal effect of M on Y . d X and denote it by RR. 3.5. Unbiasedness and variance for the (cid:15)/d-improved IFDC Although we will argue via approximations and simulations that ˆaRR = RR.Y /RR.M is unbiased (except at its pole), it is more straightforward to show that the ratio of estimators E(RR.Y )/E(RR.M ) is unbiased. This uncorrelated-ratio approximation is justified by the fact that it holds exactly for the IFDC, even in the presence of latent confounding, and is further discussed in Appendix B. Evaluating algebraically by the methods outlined in Appendix A one obtains: (cid:104) E M.Y − (cid:16) c + (cid:17) (cid:15) d X.Y (cid:104) M.M − E (cid:16) c + (cid:17) (cid:15) d X.M (cid:105) (cid:105) (cid:32) = a σ2 uM − (cid:33) , c(cid:15)σ2 uX d = σ2 uM − c(cid:15)σ2 uX d , (11) (12) and so we can observe that ˆaRR is unbiased to the extent that the uncorrelated-ratio approximation holds. There is one exception: a unique value of (cid:15) c exists (assuming homoscedasticity of the noise terms for simplicity) for which the numerator and denominator simultaneously approach 0, and at which the bias is therefore unbounded. For finite sample sizes, one expects that this pole will be centered in a region of finite width where the estimator performs poorly, but that this region will contract to a delta function as N → ∞. In summary, we have the following: d = 1 Proposition 1 In linear CMMs, the causal effect a : M → Y can be unbiasedly estimated by computing the following ratio of expectations: E (cid:2)Rc.Y − (cid:0) (cid:15) E (cid:2)Rc.M − (cid:0) (cid:15) d d (cid:1) X.Y (cid:3) (cid:1) X.M (cid:3) = E (cid:2)M.Y − (cid:0)c + (cid:15) d E (cid:2)M.M − (cid:0)c + (cid:15) d (cid:1) X.Y (cid:3) (cid:1) X.M (cid:3) = a. Proof The result follows from application of (11) and (12). Further details appear in Appendix B Although the presence of this isolated pole in the bias is not an overwhelming obstacle, it is practically inconvenient if samples are limited and one's system happens to fall in the wrong region of parameter space. Fortunately, there is one more tool at hand. In the case of a longer chain of mediators, more precisely if there exists a prior instrument on arrow a : X → M (which we will denote g : V → X), it is no longer necessary for c to be provided by an existing experiment. Instead, it may be estimated instrumentally by ˆc = M.V d -improved IFDC can be built from an adjusted prior-instrument residual: X.V , while the (cid:15) (cid:17) RV = Res(M |X) − (cid:100)(cid:16) (cid:15) d Res(X|V ). (13) 7 GOFFRIER MAYSTRE GILLIGAN-LEE The instrumental estimator ˆaRR remains unbiased other than at a pole; but this pole is located at d = 1 (cid:15) c(g2+1) , again assuming homoscedasticity of the noise terms. The practical consequence is that, if the practitioner has access to both a prior instrument and experimental data (or a low-variance estimation of c from a previous link in the chain), they may choose whichever form of the IFDC is more suited to their value of (cid:15)/d, which will be known. Given sufficiently strong prior causation g, the two poles are well-separated. However, even if only one of these is available, with sufficient samples the bias even arbitrarily near to a pole will approach 0. Making use of the known variance properties of instrumental estimators, we construct an approx- imate expression for the asymptotic variance of ˆaRR (details in Appendix B), V∞(ˆaRR) = b2σ2 uW (d2σ2 + σ2 σ2 uW uY uX uw + σ2 (d2σ2 ) uX σ2 1 + (cid:15)2 σ2 d2 uX uM (cid:16) 1 − c(cid:15) d σ2 σ2 uX uM (cid:17)2 = V∞(ˆaF DC) * + σ2 uX ) * σ2 uM (σ2 uM + (cid:15)2 − c(cid:15) d2 σ2 uX d σ2 uX )2 (14) which demonstrates that in general the improved estimator variance need not dramatically exceed that for the typical FDC, except near the bias pole (cid:15) → 0, V∞(ˆaRR) → V∞(ˆaF DC); this is equivalent to the situation where d (cid:29) (cid:15) such that the treatment X is very strongly coupled to the confounder W . As mediator noise σ2 → 0, the variance vanishes, for the intuitive reason that weighted confounder (cid:15)W is then exactly known on a per-sample basis. c . Similarly, as treatment noise σ2 uX d = 1 uM 3.6. Performance of improved estimators in a partial linear CMM We now assess to what extent the developed estimators remain unbiased when the causal effects d : W → X and (cid:15) : W → M are permitted to be nonlinear. That is, we consider update to the confounded mediator model: X = d(W ) + uX , M = c.X + (cid:15)(W ) + uM . This is an example of a partial linear causal model, which we term the partial linear CMM. We will take functions d(W ) and (cid:15)(W ) to be polynomial-valued, requiring further that d(W ) is invertible such that backdoor path (cid:15) ◦ d−1 : X → M is well-defined. Let us write: d(W ) = ∞ (cid:88) k=1 dk W k k! , (cid:15)(W ) = ∞ (cid:88) k=1 (cid:15)k W k k! . (15) It is possible to define algebraic conditions on coefficients dk in the form of inequalities between the eigenvalues of the Hermite matrix of d(cid:48)(W ), such that d(cid:48)(W ) > 0 ∀W (permitting d(cid:48)(W ) = 0 at isolated points) such that d(W ) is invertible if and only if the algebraic conditions are satisfied. It is well-known (Abramowitz et al., 1988) that the power series of an inverse function up to order n may be computed iteratively from the coefficients of the original power series up to order n. We note however that each finite order in the original function induces nonzero terms to infinite polynomial order in the inverse function, which could be included say to order m to improve precision. Taking m = n, we quote the series expansion for (cid:15) ◦ d−1, (cid:15) ◦ d−1(X) = (cid:15)1 d1 X + d1(cid:15)2 − d2(cid:15)1 d3 1 X 2 + 1(cid:15)3 + 2d2 d2 2(cid:15)1 − d1d3(cid:15)1 − 2d1d2(cid:15)2 d5 1 X 3 + O(X 4), (16) which also enjoys the key property that only coefficients order-by-order in d and (cid:15) are needed. 8 ESTIMATING LONG-TERM CAUSAL EFFECTS IN THE PRESENCE OF UNOBSERVED CONFOUNDING We now investigate if the instrumental estimator ˆaRR, introduced in the linear case in the previous section and defined in the nonlinear case below, is biased: RR = M − cX − (cid:15) ◦ d−1(X). (17) Again, the justification for this estimation approach is that RR should be uncorrelated with confounder W , and therefore a good instrument for a : M → Y , so long as it is possible to produce unbiased or low-bias estimates of c and of the coefficients of (cid:15) ◦ d−1. In the non-linear case, how does one compute (cid:15) ◦ d−1(X)? The residual from regressing M on X is naively given by R = uM + (cid:15) ◦ d−1(X − uX ) by means of the backdoor path through W . Expanding the series representation from (16), we see that samplewise R → uM + (cid:15) ◦ d−1(X) as uX → 0, which corresponds to σ2 ux → 0. That is, to the case where X is strongly correlated with W . Therefore, in this case, by polynomial regression of R on X, it is theoretically possible to extract all coefficients of (cid:15) ◦ d−1 to a desired order. We note that this method is much less sample-efficient than the ratio-based estimator for (cid:15)/d which we identified in the linear case. Now, in the case where σ2 ux → 0, where X is strongly correlated with W , can we prove our estimation approach is unbiased? With RR well-defined, taking advantage of the structural equations, the bias on the instrumental estimator ˆaRR may then be computed as: Bias [ˆaRR] = E (cid:34) (cid:0)uM + (cid:15) ◦ d−1(X − uX ) − (cid:15) ◦ d−1(X)(cid:1) .Y (uM + (cid:15) ◦ d−1(X − uX ) − (cid:15) ◦ d−1(X)) .M (cid:35) − a = a (cid:32) σ2 uM σ2 uM + σ2 + σ2 uX uX P1(σ2 uX P2(σ2 uX , σ2 , σ2 uW uW (cid:33) ) ) − a, (18) where as in previous subsections, we have made use of the uncorrelated-ratio approximation to obtain an asymptotic bias estimate. P1,2 are generic polynomials, and are computed algebraically by Isserlis' Theorem for higher-order moments. It is clear that this bias approaches 0 as X becomes increasingly correlated with W , yielding: Proposition 2 In the partial linear CMM (15), Bias [ˆaRR] → 0 as σ2 uX /σ2 uM → 0. Proof The result follows from (18). The assumption that X is highly correlated with the latent confounder W is not too strong. Indeed, the fact that X and W are causes of M means that the confounding bias W introduces between M and Y cannot naively be removed using back-door adjustment. 4. Experiments uX uM , σ2 , σ2 , σ2 uY To empirically test our estimator in linear and partially-linear CMMs, we perform several experiments and measure prediction bias both as a function of confounding (cid:15) and of the noise variances σ2 ≡ {σ2 }. We first test on two synthetic datasets, one with linear data generation functions, and another with nonlinear data generation. To test in a more realistic setting, we create a semi-synthetic experiment using real data from the International Stroke Trial Carolei (1997). Initially, all couplings are assumed linear and are set to 1 unless otherwise specified, and noises assumed zero- mean homoscedastic Gaussian, with the exception of μW = 1. We will then relax the assumption of uW 9 GOFFRIER MAYSTRE GILLIGAN-LEE linearity on d and (cid:15), and finally relax the assumption of Gaussianity on both W and X by generating semi-synthetic data from the International Stroke Trial dataset Carolei (1997). In all cases, we use the IFDC as baseline. Relevant source code and documentation has been made freely available in our online repository. 4.1. Linear synthetic experiments First, we simulate the CMM and compare the performances of the IFDC and the (cid:15)/d-improved IFDC in estimating a. A 30 × 3 grid over (cid:15) and σ2 is specified, and at each point in parameter space, 106 model samples are generated. A sample draw consists of first performing a random Gaussian draw from N (μ, σ2) for each noise component uN , where μ = 1 for N = W and otherwise μ = 0, and second propagating this data through the structural equations (1) with a = b = c = d = 1. These samples are divided into 100 runs, from which the mean and variance of ˆa may be computed for each estimator. The results are shown in Figure 2, with the IFDC shown in the left column and the (cid:15)/d-improved IFDC in the right column. The bias and variances properties for both estimators Figure 2: Experimental IFDC (left) and (cid:15)/d-improved IFDC (right) biases (top) and variances (bottom) for a linear Gaussian model, plotted over 0 < (cid:15) < 2.0 and for σ2 ∈ {0.1, 0.5, 1.0}. The plots show our estimator, the (cid:15)/d-improved IFDC, is unbiased away from the pole at (cid:15)/d = 1/c, but the IFDC has high bias. conform to our theoretical expectations. The nonzero bias from (5) is seen in the top left, with bias as (cid:15) for small (cid:15) and as 1/(cid:15) for large (cid:15), while vanishingly small variance at this sample quantity is seen in the bottom left. For the improved estimator, the top right plot confirms unbiasedness throughout the (cid:15)-domain except at pole value (cid:15) = 1, as predicted by (12), and reflected in the diverging variance precisely at this value on the bottom right. As mentioned in Section 3, the width of this bias pole can 10 0.00.51.01.52.00.00.20.40.6Bias[a]IFDC2 = 0.12 = 0.52 = 1.00.00.51.01.52.00.00.20.40.6e/d-improved IFDC2 = 0.12 = 0.52 = 1.00.00.51.01.52.0e0.00000.00020.00040.00060.00080.0010Var[a]2 = 0.12 = 0.52 = 1.00.00.51.01.52.0e0.000.020.040.060.080.102 = 0.12 = 0.52 = 1.0 ESTIMATING LONG-TERM CAUSAL EFFECTS IN THE PRESENCE OF UNOBSERVED CONFOUNDING be improved with further samples, or alternatively can be translated by the introduction of a prior instrumental variable to a : X → M 4.2. Nonlinear synthetic experiments We now assess our perturbative approach to cubic-order nonlinearities in the coupling functions d and (cid:15). A 6 × 5 grid over the quadratic and cubic polynomial coefficients is specified and at each point in parameter space, 105 model samples are generated and divided into 100 runs. We set σ2 = 0.3 to ensure convergence, and (cid:15) = 2 to avoid the bias pole for the improved estimator. The results are shown in Figure 3 for cubic-polynomial d and linear (cid:15), and in Figure 4 for linear d and cubic-polynomial (cid:15), with the IFDC shown in the left column and the (cid:15)/d-improved IFDC in the right column. For both nonlinear experiments, the > 0.35 bias of the IFDC is drastically Figure 3: Experimental IFDC (left) and (cid:15)/d-improved IFDC (right) biases for cubic-polynomial d and linear (cid:15), plotted over −0.5 < d2 < 0.5 and for 0 < d3 < 0.5. In the non-linear case, our estimator, the (cid:15)/d-improved IFDC, has very low bias, but the IFDC has high bias (note that differing vertical scales have been employed to emphasize the trend). Figure 4: Experimental IFDC (left) and (cid:15)/d-improved IFDC (right) biases for linear d and cubic- polynomial (cid:15), plotted over −1.0 < e2 < 1.0 and for −0.4 < e3 < 0.4. Our estimator, the (cid:15)/d-improved IFDC, has very low bias, but the IFDC has high bias (note that differing vertical scales have been employed to emphasize the trend). outperformed by the improved estimator with biases largely of magnitude < 0.05. However, the 11 0.40.20.00.20.4d[2]0.360.380.400.420.44Bias[a]IFDCd3=0.1d3=0.2d3=0.3d3=0.4d3=0.50.40.20.00.20.4d[2]0.1000.0750.0500.0250.0000.0250.0500.0750.100Bias[a]e/d-improved IFDCd3=0.1d3=0.2d3=0.3d3=0.4d3=0.51.00.50.00.51.0e[2]0.260.280.300.320.34Bias[a]IFDCe3=-0.4e3=-0.2e3=0.0e3=0.2e3=0.41.00.50.00.51.0e[2]0.60.50.40.30.20.10.00.10.2Bias[a]e/d-improved IFDCe3=-0.4e3=-0.2e3=0.0e3=0.2e3=0.4 GOFFRIER MAYSTRE GILLIGAN-LEE IFDC enjoys significantly more stability against both quadratic and cubic nonlinearities, in fact appearing essentially insensitive to d2 and d3, compared with the improved estimator. For the improved estimators, the dependence on acquired bias on the polynomial coefficients largely agrees with our theoretical analysis in Section 3. Comparing the right plot of Figure 3 with Figure 7, we see confirmation both of the positive bias trend with d2 and of the negative bias trend with d3. There are, however, quantitative differences, where the perturbative approach overpredicts the bias by a factor of 5 − 10, suggesting that a more evolved approach than Taylor expansion could be required to fully understand the consequences of nonlinearities in d. Comparing the right plot of Figure 4 with Figure 8, we again see confirmation both of the weak dependence of bias on e2 and of the signed bias trend with e3. Quantitatively, the match between theory and experiment is much stronger here, confirming the convergence of the (cid:15) polynomial expansion. For large, positive e3, the numerical estimator begins to fail due to large variance, and more samples would be required to resolve this parameter region, but it is clear that beyond e3 ∼ 0.4 the improved estimator bias begins to surpass that of the original IFDC. In general we expect that higher-order nonlinearities would cause the estimator to fail more rapidly, although it is possible it might exceed expectations for specific nonlinear scenarios. 4.3. International Stroke Trial semi-synthetic experiments To assess the performance of our estimators on more realistic data, we make use of the International Stroke Trial (IST) database (Carolei, 1997), a collection of stroke treatment and 14-day/6-month outcome data for 19, 345 individual patients. We take W = AGE and X = RSBP , the systolic blood pressure at randomisation, both normalized to lie in [0, 1]. We specify linear causal effects for c, a, b, and (cid:15) and construct M and Y by propagation through the structural equations (1) for each IST sample, including Gaussian random noise with variance σ2. However, d is not specified as it is manifest in the data with strength and linearity unknown. For simulation, a 20 × 3 grid over (cid:15) and σ2 is specified, and at each point in parameter space, 200 runs are generated using the same full set of 19, 345 IST samples, but with independently-sampled noises uM and uY . The bias results are shown in Figure 5, with the IFDC plotted with dashed lines and the (cid:15)/d-improved IFDC with solid. Our improved estimator attains a generic improvement over the original IFDC for all (cid:15) ∈ [0, 3] and σ2 ∈ [0.1, 1], ranging between 20 − 40% decrease in bias. This application is only a proof of concept, and these positive results indicate that further improvement could likely be achieved by more fully taking account of the non-Gaussianity of X and W and the nonlinearity of d : X → W . 5. Conclusion In this paper, we studied estimation of long-term treatment effects when both experimental and obser- vational data were available. Specifically, we addressed the case where unmeasured confounders are present in the observational data. Our long-term causal effect estimator was obtained by combining regression residuals with short-term experimental outcomes in a specific manner to create an instru- mental variable, which was then used to quantify the long-term causal effect through instrumental variable regression. We initially worked in the linear structural causal model framework, proved this estimator is unbiased, and studied its variance. We then extended this estimator to partially linear structural models and proved unbiasedness still holds under a mild assumption. Finally, we 12 ESTIMATING LONG-TERM CAUSAL EFFECTS IN THE PRESENCE OF UNOBSERVED CONFOUNDING Figure 5: Experimental IFDC (dashed) and (cid:15)/d-improved IFDC (solid) biases for synthetic IST data as described in the text, plotted over 0 < (cid:15) < 3.0 and with σ2 ∈ {0.1, 0.5, 1.0}. In all cases, our estimator, the (cid:15)/d-improved IFDC, has smaller bias than the baseline estimator. empirically tested our long-term causal effect estimator on synthetic data, as well as real data from the International Stroke Trial-demonstrating accurate estimation. Although long-term effect estimation was our primary focus, the estimator and methods described could be applied to any single-stage causal effect with a nonzero-mean confounding variable; we therefore encourage that our results be interpreted within the much broader context of front-door and IV estimation methods. Acknowledgments GVG was supported by Spotify and by the STFC UCL Centre for Doctoral Training in Data Intensive Science (grant no. ST/P006736/1), and was funded by the UCL Graduate Research and Overseas Research Scholarships. This research began while GVG was an intern at Spotify. The authors thank Mounia Lalmas for supporting this project, and the anonymous reviewers for their valuable feedback. References Milton Abramowitz, Irene A Stegun, and Robert H Romer. Handbook of mathematical functions with formulas, graphs, and mathematical tables, 1988. Susan Athey, Raj Chetty, Guido W. Imbens, and Hyunseung Kang. The surrogate index: Combining short-term proxies to estimate long-term treatment effects more rapidly and precisely. NBER Working Paper 26463, 2019. Elias Bareinboim and Judea Pearl. Causal inference and the data-fusion problem. Proceedings of the National Academy of Sciences, 113(27):7345–7352, 2016. Colin Cameron. Instrumental variables. Available at: http://cameron.econ.ucdavis. edu/e240a/ch04iv.pdf. A. et al. Carolei. The international stroke trial (ist): a randomised trial of aspirin, subcutaneous heparin, both, or neither among 19435 patients with acute ischaemic stroke. The Lancet, 349(9065):1569– 1581, 1997. ISSN 0140-6736. doi: https://doi.org/10.1016/S0140-6736(97)04011-7. URL https: //www.sciencedirect.com/science/article/pii/S0140673697040117. 13 0.00.51.01.52.02.53.0e0.050.000.050.100.150.200.250.30Bias[a]2 = 0.12 = 0.52 = 1.0 GOFFRIER MAYSTRE GILLIGAN-LEE Praveen Chandar, Brian St. Thomas, Lucas Maystre, Vijay Pappu, Roberto Sanchis-Ojeda, Tiffany Wu, Ben Carterette, Mounia Lalmas, and Tony Jebara. Using survival models to estimate user engagement in online experiments. In Proceedings of the ACM Web Conference 2022, pages 3186–3195, 2022. Lu Cheng, Ruocheng Guo, and Huan Liu. Long-term effect estimation with surrogate representation. In Proceedings of the 14th ACM International Conference on Web Search and Data Mining, pages 274–282, 2021. Victor Chernozhukov, Denis Chetverikov, Mert Demirer, Esther Duflo, Christian Hansen, Whitney Newey, and James Robins. Double/debiased machine learning for treatment and causal parameters. arXiv preprint arXiv:1608.00060, 2016. Carlos Cinelli, Daniel Kumor, Bryant Chen, Judea Pearl, and Elias Bareinboim. Sensitivity analysis of linear structural causal models. In International conference on machine learning, pages 1252–1261. PMLR, 2019. Valentina Corradi. Instrumental variables estimators (iv) in simple model. Available at: https://warwick.ac.uk/fac/soc/economics/staff/academic/corradi/ teaching-ec976/msfe-week8.pdf. Anish Dhir and Ciarán M Lee. Integrating overlapping datasets using bivariate causal discovery. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 3781–3790, 2020. Ciarán Gilligan-Lee. Causing trouble. New Scientist, 246(3279):32–35, 2020. Ciarán M Gilligan-Lee, Christopher Hart, Jonathan Richens, and Saurabh Johri. Leveraging directed causal discovery to detect latent common causes in cause-effect pairs. IEEE Transactions on Neural Networks and Learning Systems, 2022. Shantanu Gupta, Zachary C Lipton, and David Childers. Estimating treatment effects with observed confounders and mediators. In Uncertainty in Artificial Intelligence, pages 982–991. PMLR, 2021. Somit Gupta, Ronny Kohavi, Diane Tang, Ya Xu, Reid Andersen, Eytan Bakshy, Niall Cardin, Sumita Chandran, Nanyu Chen, Dominic Coey, et al. Top challenges from the first practical online controlled experiments summit. ACM SIGKDD Explorations Newsletter, 21(1):20–35, 2019. Maximilian Ilse, Patrick Forré, Max Welling, and Joris M Mooij. Efficient causal inference from combined observational and interventional data through causal reductions. arXiv preprint arXiv:2103.04786, 2021. Guido Imbens, Nathan Kallus, Xiaojie Mao, and Yuhao Wang. Long-term causal inference under persistent confounding via data combination. arXiv preprint arXiv:2202.07234, 2022. Olivier Jeunen, Ciarán M Gilligan-Lee, Rishabh Mehrotra, and Mounia Lalmas. Disentangling causal effects from sets of interventions in the presence of unobserved confounders. arXiv preprint arXiv:2210.05446, 2022. 14 ESTIMATING LONG-TERM CAUSAL EFFECTS IN THE PRESENCE OF UNOBSERVED CONFOUNDING Ron Kohavi, Alex Deng, Brian Frasca, Roger Longbotham, Toby Walker, and Ya Xu. Trustworthy online controlled experiments: Five puzzling outcomes explained. In Proceedings of the 18th ACM SIGKDD international conference on Knowledge discovery and data mining, pages 786–794, 2012. Ciarán M Lee and Robert W Spekkens. Causal inference via algebraic geometry: feasibility tests for functional causal structures with two binary observed variables. Journal of Causal Inference, 5(2), 2017. Judea Pearl. Causality. Cambridge university press, 2009. Jonathan G Richens, Ciarán M Lee, and Saurabh Johri. Improving the accuracy of medical diagnosis with causal machine learning. Nature communications, 11(1):3923, 2020. Shohei Shimizu, Patrik O Hoyer, Aapo Hyvärinen, Antti Kerminen, and Michael Jordan. A linear non-gaussian acyclic model for causal discovery. Journal of Machine Learning Research, 7(10), 2006. Marco Taboga. Marginal and conditional distributions of a multivariate normal vec- tor. Available at: https://www.statlect.com/probability-distributions/ multivariate-normal-distribution-partitioning, 2021. Eric J Tchetgen Tchetgen, Andrew Ying, Yifan Cui, Xu Shi, and Wang Miao. An introduction to proximal causal learning. arXiv preprint arXiv:2009.10982, 2020. Chi Zhang, Karthika Mohan, and Judea Pearl. Causal inference with non-iid data using linear graphical models. Available at: https://ftp.cs.ucla.edu/pub/stat_ser/r514. pdf, 2022. Appendix A. Covariance Algebra In order to extend the derivations in Gupta et al. (2021) to cases with confounded mediators, multiple mediators, and pre-treatment covariates, it is necessary to introduce some new technology. Many key results including bias and variance for FDC-type estimators and covariance between estimators, all necessary to the estimation of the total causal effect, rely on essentially two steps. First, the desired expectation value is expanded using smoothing, also known as the law of total expectation or the tower rule: E[X] = (cid:88) (cid:88) x*P[X = x, Y = y] = x y (cid:34) (cid:88) (cid:88) y x x * P[X = x | Y = y] *P[Y = y] = E[E[X | Y ]], (cid:35) (19) where X and Y are random variables (r.v.s) defined on the same probability space, and the expansion may be performed multiple times. In our application, X is replaced by the desired expectation value, and a set of conditioners {Y } are chosen so that the denominator (and as many numerator terms as possible) are fixed under {Y }. These fixed terms simplify by symmetry in some cases, and in more complex cases reduce to known distributions such as the Inverse-Wishart. 15 GOFFRIER MAYSTRE GILLIGAN-LEE Second, the unfixed terms must be evaluated. Frequently these are of the form E[u, Y ], where u is some noise r.v. in the causal graph which is neither fixed by Y nor independent from it. Linearity in a Gaussian-noise graphical model implies that any two node or noise r.v.s are bivariate normal, and indeed that any N node or noise r.v.s are N -multivariate normal. This is hugely advantageous, because conditioning acts on a linear projection on a space of multivariate normal r.v.s. For example, suppose X and Y have a bivariate normal distribution: (cid:18) (X, Y ) ∼ N μ = (cid:19) (cid:18)μX μY , Σ = (cid:18) σ2 X ρσX σY (cid:19)(cid:19) , ρσX σY σ2 Y (20) where ρ is the correlation between u and Y . Projection implies the following conditional expectations among u and Y : E[X | Y ] = μX + ρ E[Y | X] = μY + ρ σX σY σY σX (Y − μY ), (X − μX ), V[X | Y ] = σ2 V[Y | X] = σ2 X (1 − ρ2), Y (1 − ρ2). (21) (22) As a sanity check, we can see that both variances vanish if ρ = 1, and retain their independent values if ρ = 0. ρ must be evaluated directly, which is straightforward in a linear Gaussian model; for instance, = α σX if Y = αX + U with X ⊥⊥ U , cov[X, Y ] = α * cov[X, X] = ασ2 . σY This reproduces the well-known result that the conditional expectation of one of a set of summands on their sum is proportional to the ratio of their variances. X , implying ρ = cov[X,Y ] σX σY The above result is frequently sufficient, however it is too strict for our use case. We will need to be able to compute conditional moments of the form E[(cid:81) l ui(l) | Yj], where the product may include repeated or distinct noises, but the set Yj must be distinct (and sometimes may be reducible). To achieve this, we combine two tools: the general conditional projection for Gaussian families in terms of Schur complements, to easily handle a vector of conditioned r.v.s; and Isserlis' theorem for higher-order moments to handle arbitrarily complicated products of noises, so long as all r.v.s are zero-mean. Following Taboga (2021), the multivariate Gaussian conditional moments are: suppose vector- valued r.v. X is k-multivariate normal with distribution X ∼ N (μ, Σ). Then for any partition a + b = k, where we define X = (cid:19) (cid:18)Xa Xb , μ = (cid:19) (cid:18)μa μb , Σ = (cid:18) Σa ΣT ab Σab Σb (cid:19) , the vector-valued conditional mean is E[Xa | Xb] = μa + ΣT abΣ−1 b (Xb − μb) and the matrix-valued conditional variance is V[Xa | Xb] = Σa − ΣT abΣ−1 b Σab. 16 (23) (24) (25) ESTIMATING LONG-TERM CAUSAL EFFECTS IN THE PRESENCE OF UNOBSERVED CONFOUNDING Note that in the above conditional mean, only the bilinear survives if μa = μb = 0, as in our applications. Also, the term Σa − ΣT b Σab is known as the Schur complement of block Σb in Σ. Without needing to rearrange the covariance matrix, V[Xb | Xa] can be found simply by taking the Schur complement of block Σa. abΣ−1 The complete partition above is excessive in most cases. If we only desire the expected mean for a single variable Xi ∈ Xa, for instance, the matrix equation becomes: E[Xi | Xb] = [μa]i + [ΣT ab]ij[Σ−1 b ]jk[Xb − μb]k (26) where i, j, k are matrix indices and summations are assumed to be entire. What was a full a × a matrix multiplication is now a vector bilinear. Similarly, if we only desire a particular covariance cov[Xi, Xj] for Xi, Xj ∈ Xa, the matrix equation becomes: cov[Xi, Xj | Xb] = [Σa]ij − [ΣT ab]im[Σ−1 b ]mn[Σab]nj (27) where i, j, m, n are matrix indices, and again we have arrived at a vector bilinear. Appendix B. Proofs of Estimator Biases and Variances In this section we describe the construction of four residual-based instrumental estimators for a. Two of them will be shown to be unbiased except for some zero-measure choices of structural parameters, which will be characterised. B.1. Estimators and their Biases First let us recall the structural equations for the CM model, Wi = uW i , Xi = dWi + uX i , Mi = cXi + (cid:15)Wi + uM i , Yi = aMi + bWi + uY i , (28) where all variables except the confounder W and noises u are taken to be observable. The motivation X W M uM Y Figure 6: Causal graph with mediator confounded by latent W and mediator noise term uM . for this approach is the observation that noise variable uM , were it measurable, would be an acceptable instrument for a, as shown in Figure 6. The simplest approximation of uM is to regress M on X and take residual Rc as an instrument. As discussed in the text, we could not expect Rc to deliver an unbiased instrumental estimator for a, as the regression of M on X absorbs the backdoor path 17 GOFFRIER MAYSTRE GILLIGAN-LEE X ← W → M . However it is instructive to compute the bias of the estimator by applying the law of total expectation conditioned on X and M : Bias[ˆaRc] = E[E[ˆaRc − a|X, M ]] b d b d = − = − E E (cid:20) E (cid:20) M.(uX − X)X.X − M.XX.(uX − X) M.M X.X − (M.X)2 (cid:12) (cid:12) (cid:12) (cid:12) (cid:21) (cid:20) M.E[uX |X, M ]X.X − M.XX.E[uX |X, M ] M.M X.X − (M.X)2 σ2 uX (σ2 b(cid:15)σ2 + σ2 + d2σ2 σ2 uW ) uM uX uW = (cid:15)2σ2 uW uX X, M (cid:21)(cid:21) (29) In the first line, the law of total expectation is applied, conditioned on X and M so as to isolate the numerator. In going from the first line to the second line, the independence of uY from X, M has been applied, and in the final expression the conditional expectation E[uX |X, M ] has been calculated as shown in Appendix A. Assuming homoscedasticity of the noise terms, this simplifies to Bias[ˆaRc] = b(cid:15) 1 + d2 + (cid:15)2 . (30) √ √ 4+2d2 at (cid:15) = ± b One notable property of this bias is that it vanishes in the limit of both small and large (cid:15), with global maximum bias of ± b√ 1 + d2, as demonstrated in Figure 2. Not all estimators allow for this reduction strategy; in particular, the conditional expectations of the noise terms must combine just such that the denominator is cancelled and the expectation expression becomes that of a scalar. In such cases, we will proceed by estimating the numerator and denominator separately and treating the expectation of the ratio as well-approximated by the ratio of these expectations. For example, ˆaRc has the following numerator and denominator expectations, derived by simple independence between noise terms and the fact that E[ui.ui] = σ2 ui: 1+d2 at (cid:15) = ± 2 E[X.XM.Y − X.Y M.X] = (cid:15)(b + a(cid:15))σ2 uW (cid:0)g2σ2 uV + σ2 uX (cid:1) + aσ2 uM (cid:0)g2σ2 uV + σ2 uX + d2σ2 uW (cid:1) ; (31) E[X.XM.M − (X.M )2] = (cid:15)2σ2 uW (cid:0)g2σ2 uV + σ2 uX (cid:1) + aσ2 uM (cid:0)g2σ2 uV + σ2 uX + d2σ2 uW (cid:1) . (32) The ratio of these expectations, less a, delivers exactly the bias calculated in (29), which tells us that the numerator and denominator r.v.s are independent for this front-door estimator. In general this equivalence will fail due to correlations between the numerator and denominator, but we will assume the correlations to be weak as a useful first approximation. We can now define and analyse the improved residuals which take advantage of prior-stage information about c : X → M and form the key results of this work. First, we take inspiration from the linear structural equations for the confounded mediator model, which suggest that the residual on M after regression on x should have the form uM − (cid:15) d uX . Taking the more general case of a prior instrument g : V → X in the CM model, we may arrive at this same linear structural quantity by the unique linear combination of residuals between V , X, and M which removes unobserved data W , giving: RV = Res[M, X] − (cid:15) d Res[X, V ] ∼ uM − (cid:15) d uX (33) 18 ESTIMATING LONG-TERM CAUSAL EFFECTS IN THE PRESENCE OF UNOBSERVED CONFOUNDING where ratio (cid:15) some nonzero mean. Subsequently, we construct an instrumental estimator for a: d is shown in Section 3 to be unbiasedly estimable so long as confounder W acquires ˆaRV = RV .Y RV .M = V.V V.X(M.Y − (cid:15) V.V V.X(M.M − (cid:15) d X.Y ) + (V.X)2V.Y − (cid:15) d X.M ) + (V.X)2V.M − (cid:15) d V.V V.M X.Y d V.V V.M X.M . (34) Some simplification is achieved by applying the Law of Total Expectation conditioned over V, X, M , but the result is a nontrivial integral over these three heavily-correlated random vectors (in sample space): (cid:34) Bias[ˆaRV ] = E (cid:104) uX uW uM σ2 (cid:0)d2σ2 uW V.V V.X(M.M − bσ2 + σ2 (cid:15) d dV.V M.XV.X (cid:0)dσ2 uM − (cid:15)V.V V.X (cid:0)X.X (cid:0)dσ2 uM − dV.V V.M (cid:0)X.X (cid:0)dσ2 uM (cid:18) − c(cid:15)σ2 uX (cid:1) (cid:1) + (cid:15)2σ2 uW σ2 uX X.M ) + (V.X)2V.M − V.V V.M X.M (cid:105)−1 (cid:15) d − c(cid:15)σ2 uX − c(cid:15)σ2 uX (cid:1) + σ2 uX (cid:1) + (cid:15)X.M σ2 uX (dM.M − (cid:15)X.M )(cid:1) (cid:1) (cid:19)(cid:35) + (cid:15)(V.X)3 (cid:0)dσ2 uM − c(cid:15)σ2 uX (cid:1) + (cid:15)2V.M σ2 uX (V.X)2 (35) We do not yet know how to evaluate the above integral, except numerically. Instead, we can evaluate the expectations of the numerator and denominator: (cid:104) V.V V.X(M.Y − E (cid:15) d X.Y ) + (V.X)2V.Y − V.V V.M X.Y (cid:105) = a (cid:15) d (cid:32) σ2 uM − c(cid:15)(g2σ2 uV d + σ2 uX ) (cid:33) ; (36) ) + σ2 uX (cid:105) (cid:15) d c(cid:15)(g2σ2 uV d (cid:104) V.V V.X(M.M − (cid:15) d E X.M ) + (V.X)2V.M − . (37) In contrast to our results on Bias[ˆaRc], the uncorrelated-ratio approximation suggests Bias[ˆaRV ] (cid:39) 0. This only exactly holds if the integral in (35) evaluates to 0, but is promising nonetheless. An intermediate possibility is that (35) approaches 0 as Nsamp → ∞, but has a slow dependence on Nsamp. V.V V.M X.M = σ2 uM − It is worth noting that ˆaRV could have been constructed another way; naively from the structural equations, Res[M, V ] ∼ (cid:15)W + uM just as Res[M, X] does. We might even expect Res[M, V ] to experience less bias, since V is not confounded by W . However, repeating the above analysis in the uncorrelated-ratio approximation gives a nonzero result, Bias[ˆaRV ] (cid:39) bcdσ2 uW σ2 uM + cd(cd + (cid:15))σ2 uW + c(cd−(cid:15)) d σ2 uX , (38) and so we have discarded this route. It is straightforward to simplify estimator ˆaRV and its corresponding residual to obtain the improved estimator ˆaRR explored in-depth in the text. One simply sets g = 0 to remove prior 19 GOFFRIER MAYSTRE GILLIGAN-LEE instrument V , and redefines the residual with c presumed to be provided from an oracle: RR = M − (c + (cid:15) d )X ∼ uM . (39) Importantly, this construction leaves the door open to joint estimation of c and (cid:15) d from the prior stage in the model, in the sense that only the sum is needed and biases of opposite sign could destructively interfere. The resultant instrumental estimator for a is simple, ˆaRR = RR.Y RR.M = M.Y − (cid:0)c + (cid:15) d M.M − (cid:0)c + (cid:15) d (cid:1) X.Y (cid:1) X.M . (40) Like ˆaRV , the full bias is not (yet) reducible beyond a high-dimensional integral, Bias[ˆaRR] = E[ uW bσ2 + σ2 uX uM (cid:0)d2σ2 σ2 uW M.M + (dσ2 uM (cid:15)σ2 uX − (cid:15)(2c + (cid:15) (cid:1) + (cid:15)2σ2 uW d )σ2 uX M.M − (cid:0)c + (cid:15) d σ2 uX )X.M + (c + (cid:15) (cid:1) X.M d )(c(cid:15)σ2 uX − dσ2 uM ) ] (41) but, also like ˆaRV , this expectation appears unbiased in the uncorrelated-ratio approximation: (cid:104) E M.Y − (cid:16) c + (cid:17) (cid:15) d (cid:105) X.Y = a (cid:32) σ2 uM − (cid:33) ; c(cid:15)σ2 uX d (cid:104) M.M − E (cid:16) c + (cid:105) X.M (cid:17) (cid:15) d = σ2 uM − c(cid:15)σ2 uX d . (42) (43) It is unsurprising that RR is no more biased than RV , and we should expect that evaluation of the integrals in (35) and (41) would show the same or better bias for RR even for finite sample size. In fact, numerical integration of (41) indicates that any nonzero bias terms are proportional to 1/(N + k) for constants k, and therefore asymptotically vanish. There is one crucial difference in the estimation performance of ˆaRR vs. ˆaRV , a topological one arising from the presence of prior instrument V . As seen in the uncorrelated-ratio approximation, there are values of (cid:15) d for which the numerator and denominator simultaneously approach 0. Again assuming homoscedasticity of the noise terms for simplicity, this bias pole occurs at (cid:15) c for ˆaRR and at (cid:15) c(g2+1) for ˆaRV . For finite sample sizes, one expects that each pole will be centered in a region of finite width where the estimator performs poorly, but that this bias will contract to a delta function as Nsamp → ∞. These poles are connected in the limit as g → 0, although ˆaRV is not defined at g = 0. d = 1 d = 1 The practical consequence of the above analyses is that two instrumental estimators of a, con- structed from the (cid:15)/d-improved residual and from the remainder, are essentially unbiased. They each have a pole region of slowly-converging bias, however given sufficiently large g, these regions can be well-separated. In the presence of a prior instrument g, it is therefore possible to construct an unbiased estimator for a throughout ((cid:15), d) parameter space. It is for this reason that we illustrate both estimation strategies in full despite their obvious similarities. 20 ESTIMATING LONG-TERM CAUSAL EFFECTS IN THE PRESENCE OF UNOBSERVED CONFOUNDING B.2. Variances We refer first to the variance computations in Gupta et al. (2021), where finite-sample and asymptotic variances for ˆc and ˆa are calculated taking advantage of the asymptotic normality of OLS estimators, and the properties of inverse-Wishart-distributed matrices. For the front-door estimator, the asymptotic variances are quoted as follows: V∞(ˆaF DC) = b2σ2 uw σ2 ux + σ2 (d2σ2 uy (d2σ2 ux)σ2 um uw + σ2 uw + σ2 ux) V∞(ˆc) = σ2 um uw + σ2 ux d2σ2 . , (44) (45) Via the Delta method, the asymptotic variance in estimating the total causal effect ac is given by V∞( ˆac) = c2V∞(ˆa) + a2V∞(ˆc), (46) which holds as long as Cov(ˆa, ˆc) = 0. Following Corradi; Cameron, the asymptotic variance for a scalar instrumental estimator ˆaIV = R.Y R.M may be written V∞(ˆaR) = E [(R.R) * E[ ̃uY . ̃uY |R]] Cov(R, M )2 (47) where ̃uY denotes all additive contributions to Y besides aM , and we have taken instrument R to have zero mean. Following our claim that the instrumental estimator built from Rc with no confounding on the mediator ((cid:15) = 0) is simply the FDC estimator, it is instructive to confirm that the IV asymptotic variance agrees with the FDC result from Gupta et al. (2021). For all causal structural models we consider, ̃uY = uY +b*uW . In the (cid:15) = 0 case, no confounding implies Rc ⊥⊥ ̃uY , so that E [(R.R) * E[ ̃uY . ̃uY |R]] = E [R.R] * E[ ̃uY . ̃uY |Rc]. Further computing E[Rc.Rc] = E[Rc.M ] = σ2 uM , and evaluating E[ ̃uY . ̃uY |Rc] algebraically via the covariance matrix approach, we arrive at: V∞(ˆaRc,(cid:15)=0) = σ2 uM * (σ2 uY + b2E[uW .uW |Rc]) (σ2 )2 uM = V∞(ˆaF DC). (48) When the mediator is permitted to experience some confounding (cid:15), we should expect some correlation between Rc.Rc and ̃uY . ̃uY via uW . Separating this term from the product in the numerator, and observing that E[Rc.Rc] = E[Rc.M ] = E[ M.M X.X−(M.X)2 ], we find X.X V∞(ˆaRc) = + b2E[uW .uW |Rc] σ2 uY E[ M.M X.X−(M.X)2 X.X ] + O(σ4 E[ M.M X.X−(M.X)2 X.X uW ) ]2 (49) where the quantity in the denominator has the distribution of the marginal from a Wishart-distributed matrix, as the quantity 1 D in Gupta et al. (2021). It is possible to simplify this denominator expectation directly to only one non-trivial integral, E[Rc.Rc] = σ2 uM * N N + 2 + (cid:15)2σ2 uW − (cid:15)2E[ E[(uW .X)2|X] X.X ], (50) 21 GOFFRIER MAYSTRE GILLIGAN-LEE where the final expectation value would reduce to σ2 N +2 were uW ⊥⊥ X, but numerical evaluation via cylindrical coordinates has confirmed that it approaches asymptotic σ2 uW with strong correlation between uW and X. Thus E[Rc.Rc] is bounded both above and below, with the overall V∞(ˆaRc) slowly worsening as correlation between uW and X becomes stronger. uW * 1 If we assume that c has been learned through previous experimentation, and that low-variance, d has been attained, it is possible to obtain an exact variance result for the uX and E[Rc.Rc] = d uX , E[Rc.M ] = σ2 uM unbiased estimation of (cid:15) (cid:15)/d-improved IFDC estimator. Since Rc = uM − (cid:15) σ2 uM uX . Thus, d σ2 + (cid:15)2 − c(cid:15) d2 σ2 V∞(ˆaRR) = b2σ2 uW (d2σ2 σ2 + σ2 uX uY uw + σ2 (d2σ2 uX uW ) + σ2 uX ) * σ2 uM (σ2 uM + (cid:15)2 − c(cid:15) d2 σ2 uX d σ2 uX )2 , (51) which has the expected property that as (cid:15) → 0, V∞(ˆaRR) → V∞(ˆaF DC), but with asymptotic confounding (cid:15) → ∞, V∞(ˆaRR) → V∞(ˆaF DC) * . The variance expression only becomes d = 1 unbounded at the pole (cid:15) σ2 uM c2σ2 uX c , just as expected from our computation of the bias. Appendix C. Nonlinear Bias Examples As two practical examples, we demonstrate the computed (cid:15)/d-improved IFDC biases for cubic- polynomial d and linear (cid:15), and for linear d and cubic-polynomial (cid:15). Specifically, d(W ) = d1W + d2W 2 + d3W 3, (52) in which case the invertibility condition simplifies to − 3d1d3, which may only be fulfilled if d1 and d3 have the same (or 0) sign. Setting all variances and b = c = d1 = (cid:15)1 = 1 for simplicity, we find 3d1d3 ≤ d2 ≤ √ √ Bias [ˆaRR,nd=3] = Bias [ˆaRR,n(cid:15)=3] = 6(2d2 2 − 30d3 − 108d2 2 − d3)(1 + 3d3) 3 + 18d2 3 − 180d3 2(3 + 10d3 + 20d2 3) 1 + 72d4 3(cid:15)3 2 + 12(cid:15)3 + 9(cid:15)2 (cid:15)2 3 . , (53) (54) Varying the cubic coefficient and plotting curves over the quadratic coefficient, theoretical bias estimates for these two scenarios are presented in Figures 7 and 8, respectively. We have set all noise variances to σ2 = 0.2 for these computations, in order to more clearly show trends and to assure convergence. For Figure 7, we have taken terms of d−1 up to order m = 10 to demonstrate that at this order in the expansion, the prediction still varies substantially; it is "non-perturbative", and so even to order 10 should only be taken as a qualitative estimate. The convergence up to order 3 in Figure 8, however, is taken to be sufficiently precise. To summarise these results, up to non-perturbative effects we expect that nonzero d2 pushes the bias in the positive direction, while nonzero d3 (restricted to be positive by invertibility) pushes the bias in the negative direction. Coordinates in (d2, d3) where unbiasedness is retained or nearly retained should therefore exist. In contrast, nonzero (cid:15)2 appears to have a much smaller impact on bias, in fact tending towards 0, while nonzero e3 leads to bias in the direction of sign((cid:15)3). It is noteworthy that for positive (cid:15)3, the bias is small and tentatively approaches an asymptote around 0.1, while for negative (cid:15)3, bias grows rapidly and appears unbounded. 22 ESTIMATING LONG-TERM CAUSAL EFFECTS IN THE PRESENCE OF UNOBSERVED CONFOUNDING Figure 7: Theoretical (cid:15)/d-improved IFDC biases for cubic-polynomial d and linear (cid:15), plotted over −0.5 < d2 < 0.5 and with curves ranging over 0 < d3 < 0.5. Figure 8: Theoretical (cid:15)/d-improved IFDC biases for linear d and cubic-polynomial (cid:15), plotted over −1.0 < (cid:15)2 < 1.0 and with curves ranging over −0.5 < (cid:15)3 < 0.5. 23 -0.4-0.20.20.4d2-0.20-0.15-0.10-0.050.050.10Biase3=0e3=0.5-1.0-0.50.51.0e2-0.4-0.2-0.10.00.1e3=-0.5e3=0e3=0.5
http://arxiv.org/abs/2302.10623v1
2023-02-21T12:17:14
2023-02-21T12:17:14
The Gaussian kernel on the circle and spaces that admit isometric embeddings of the circle
On Euclidean spaces, the Gaussian kernel is one of the most widely used kernels in applications. It has also been used on non-Euclidean spaces, where it is known that there may be (and often are) scale parameters for which it is not positive definite. Hope remains that this kernel is positive definite for many choices of parameter. However, we show that the Gaussian kernel is not positive definite on the circle for any choice of parameter. This implies that on metric spaces in which the circle can be isometrically embedded, such as spheres, projective spaces and Grassmannians, the Gaussian kernel is not positive definite for any parameter.
[ "Nathaël Da Costa", "Cyrus Mostajeran", "Juan-Pablo Ortega" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10623v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10623v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "math.DG" ]
3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 3 2 6 0 1 . 2 0 3 2 : v i X r a The Gaussian kernel on the circle and spaces that admit isometric embeddings of the circle Natha ̈el Da Costa, Cyrus Mostajeran, and Juan-Pablo Ortega Division of Mathematical Sciences, Nanyang Technological University, Singapore 637371 Abstract. On Euclidean spaces, the Gaussian kernel is one of the most widely used kernels in applications. It has also been used on non-Euclidean spaces, where it is known that there may be (and often are) scale pa- rameters for which it is not positive definite. Hope remains that this kernel is positive definite for many choices of parameter. However, we show that the Gaussian kernel is not positive definite on the circle for any choice of parameter. This implies that on metric spaces in which the circle can be isometrically embedded, such as spheres, projective spaces and Grassmannians, the Gaussian kernel is not positive definite for any parameter. Keywords: kernel methods * Gaussian kernel * positive definite kernels * geodesic exponential kernel * metric spaces * Riemannian manifolds 1 Introduction In many applications, it is useful to capture the geometry of the data and view it as lying in a non-Euclidean space, such as a metric space or a Riemannian manifold. Examples of such applications include computer vision [15], robot learning [5] and brain-computer interfaces [1]. We are interested in the problem of applying kernel methods on such non-Euclidean spaces. Kernel methods are prominent in machine learning, with some examples of algorithms including support vector machines [7], kernel principal component analysis [18], solvers for controlled and stochastic differential equations [16], and reservoir computing [12], [11]. These algorithms rely on the existence of a reproducing kernel Hilbert space into which the kernel maps the data. This in turn requires the chosen kernel to be positive definite (PD). One of the most common types of kernel used in applications is the Gaussian kernel. Defined on a Euclidean space, this kernel is PD for any choice of param- eter. [17] shows moreover that the Gaussian kernel defined on a metric space is PD for all parameters if and only if the metric space can be isometrically em- bedded into an inner product space. This implies that Euclidean spaces are the only complete Riemannian manifolds for which the Gaussian kernel is PD for all parameters [9], [14]. However, the problem of determining for which parameters the Gaussian kernel is PD on a given metric space is not solved. [19] shows that the Gaussian kernel may be PD for a wide range of parameters even when it is 2 N. Da Costa et al. not PD for every parameter. However, this paper rules out such a possibility for a large class of spaces of interest. We start by defining positive definite kernels. Then we give a brief review of the literature on the positive definiteness of the Gaussian kernel, and introduce some new notation to study this problem. Finally, we show that the Gaussian kernel is not PD for any choice of parameter on the circle, and consequently for any metric space admitting an isometrically embedded circle. We should note that since producing the results of this paper, we have discov- ered that certain general characterisations of positive definite functions on the circle exist in the literature, which encompass our result on the circle [20], [10]. Our proof, however, is specific to the Gaussian kernel, relies only on elementary analysis, and provides further insight into the extent to which the Gaussian ker- nel fails to be PD, which may have practical relevance for applications of kernel methods to non-Euclidean data processing. 2 Kernels Definition 1. A kernel on a set X is a symmetric map k : X × X → R . k is said to be positive definite (PD) if for all N ∈ N, x1, . . . , xN ∈ X and all c1, . . . , cN ∈ R, N (cid:88) N (cid:88) i=1 j=1 cicjk(xi, xj) ≥ 0 i.e. the matrix (cid:0)k(xi, xj)(cid:1) positive semi-definite. i,j, which we call the Gram matrix of x1, . . . , xN , is Proposition 1. Suppose the (kn)n≥1 are PD kernels on X. (i) a1k1 + a2k2 is a PD kernel on X for all a1, a2 ≥ 0. (ii) The Hadamard (pointwise) product k1 * k2 is a PD kernel on X. (iii) If kn → k pointwise as n → ∞, then k is a PD kernel on X. (iv) If Y ⊂ X then k1|Y is a PD kernel on Y . Proof. The N × N symmetric positive semidefinite matrices Sym0+(N ) form a closed convex cone in the space of symmetric matrices Sym(N ), which implies (i) and (iii). Sym0+(N ) is also closed under pointwise multiplication, as shown in [2, Chapter 3 Theorem 1.12.], which implies (ii). Finally, proving (iv) is trivial. Proposition 1 (i), (ii), and (iii) say that PD kernels on X form a convex cone, closed under pointwise convergence and pointwise multiplication. The Gaussian kernel on the circle 3 3 The Gaussian kernel In this section, X is a metric space equipped with the metric d. A common type of kernel on such a space is the Gaussian kernel k( * , * ) := exp(−λd( * , * )2) (1) where λ > 0. Write Λ+(X) := {λ > 0 : the Gaussian kernel with parameter λ is PD}. We would like to characterise Λ+(X) in terms of X. In what follows, Propositions 2 and 3 are the analogous to Proposition 1 for Gaussian kernels. Proposition 2. (i) Λ+(X) is closed under addition. (ii) Λ+(X) is topologically closed in (0, ∞). Proof. (i) and (ii) follow from Proposition 1 (ii) and (iii) respectively. Corollary 1. (i) If there is (cid:15) > 0 s.t. (0, (cid:15)) ⊂ Λ+(X) then Λ+(X) = (0, ∞). (ii) If there is (cid:15) > 0 s.t. Λ+(X) ⊂ (0, (cid:15)) then Λ+(X) = ∅. Proof. These both follow from Proposition 2 (i). Definition 2. Let Y be another metric space with metric d(cid:48). We say Y isomet- rically embeds into X, written Y (cid:44)→ X if there is a function ι : Y → X such that d(ι( * ), ι( * )) = d(cid:48)( * , * ). Note that, while the notion of 'isometry' in the context of Riemannian mani- folds and in the context of metric spaces correspond (Myers–Steenrod theorem), the notion of 'isometric embedding' is stronger in the context of metric spaces than in the context of Riemannian manifolds. For example, the unit 2-sphere S2 can be isometrically embedded in R3 in the sense of Riemannian manifolds, but not in our sense. Proposition 3. Let Y be another metric space with metric d(cid:48). If Y (cid:44)→ X, then Λ+(X) ⊂ Λ+(Y ). Proof. Follows from Proposition 1 (iv). As of now, we have only made rather elementary observations about Λ+(X), but now we state the first major result, without proof. Theorem 1 (due to I.J. Schoenberg [17]). The following are equivalent: 1. Λ+(X) = (0, ∞). 2. X (cid:44)→ V for some inner product space V. 4 N. Da Costa et al. Note that, if it exists, the isometric embedding X (cid:44)→ V is not in general related to the reproducing kernel Hilbert space (RKHS) map for the Gaussian kernel. Given a positive definite kernel k on X, the RKHS map is a set-theoretic map K : X → H where H is a Hilbert space such that k( * , * ) = (cid:104)K( * ), K( * )(cid:105). These are different objects. Theorem 1 is already very powerful, and guarantees that Λ+(X) = (0, ∞) for many spaces. Corollary 2. Λ+(X) = (0, ∞) for the following spaces X: 1. Rn with the Euclidean metric, for n ≥ 1. 2. L2 3. Sym++(n) the space of symmetric n × n positive definite matrices, with the R(Ω, μ) for any measure space (Ω, μ). Frobenius metric, for n ≥ 1. 4. Sym++(n) with the log-Euclidean metric d(A, B) = (cid:107) log(A) − log(B)(cid:107)F , for n ≥ 1, where (cid:107) * (cid:107)F denotes the Frobenius norm. 5. GrR(k, n) the real Grassmanian with the projection metric d([A], [B]) = (cid:107)AAT −BBT (cid:107)F , where A, B are the n×k matrices representing the subspaces [A], [B] respectively, for 1 ≤ k < n. Proof. Follows directly from Theorem 1. Moreover, [9] and [14] deduce from Theorem 1 the following result, which we state without proof. Theorem 2. If X is a complete Riemannian manifold, Λ+(X) = (0, ∞) if and only if X is isometric to a Euclidean space. While Theorem 1 is powerful, the full characterisation of Λ+(X) is far from solved. Λ+(X) can be non-empty and different from (0, ∞); it is easy to construct finite metric spaces with more complicated Λ+(X). This can also be the case for more complex metric spaces: [19, Theorem 3.10] shows that on the space of symmetric positive definite matrices X = Sym++(n) equipped with the metric of Stein divergence, we have Λ+(X) = (cid:110) 1 2 , 2 2 , . . . , (cid:111) n − 2 2 ∪ (cid:104) n − 1 2 (cid:17) . , ∞ While this result gives hope that the Gaussian kernel may be PD for many parameters on many interesting spaces, we show that this is often not the case. 4 The Gaussian kernel on the circle Theorem 3. Λ+(S1) = ∅ where S1 is the unit circle with its classical intrinsic metric. Proof. Let N ∈ N. Define xk = 2πk/N for 0 ≤ k ≤ N − 1. So d(xk, xl) = 2π N min{|k − l + mN | : m ∈ Z} The Gaussian kernel on the circle 5 Fig. 1. Points xk on S1 for N = 8. for all 0 ≤ k, l ≤ N − 1. So the Gram matrix of x0, . . . , xN −1 is  1 exp(−λ( 2π N )2) exp(−λ( 4π N )2) . . . exp(−λ( 2π N )2) K = ...               exp(−λ( 2π N )2) 1 ... . . . . . . exp(−λ( 4π N )2) exp(−λ( 6π N )2) . . . exp(−λ( 2π exp(−λ( 4π  N )2)   N )2)             . ... 1 To show the Gaussian kernel with parameter λ is not PD all we need to show is that we can choose N such that K has a negative eigenvalue. K is a circulant matrix, so its eigenvalues are given by the discrete Fourier transform of the first row. Explicitly, these eigenvalues are wj = (cid:98)N/2(cid:99) (cid:88) k=0 (cid:18) exp −μ (cid:19) k2 N 2 ei 2π N kj + N −1 (cid:88) k=(cid:98)N/2(cid:99)+1 (cid:18) exp −μ (cid:19) (N − k)2 N 2 ei 2π N kj for 0 ≤ j ≤ N − 1, where μ = λ(2π)2. Taking N ≡ 0 mod 2, this gives wj = 1 + N/2−1 (cid:88) (cid:18) exp −μ k=1 (cid:19) k2 N 2 (ei 2π N kj + ei 2π N (N −k)j) + exp(−μ/4)eiπj = −1 + 2 N/2−1 (cid:88) (cid:18) exp −μ k=0 (cid:19) k2 N 2 cos (cid:18) 2π N (cid:19) kj + (−1)j exp(−μ/4). Restricting further to N ≡ 0 mod 4 and j = N/2, the sum conveniently becomes alternating: wN/2 = −1 + 2 N/2−1 (cid:88) (−1)k exp k=0 (cid:124) (cid:123)(cid:122) (∗) (cid:18) −μ k2 N 2 (cid:19) (cid:125) + exp(−μ/4). (2) 6 N. Da Costa et al. We will show that wN/2 is negative for N large enough. For this, we need to estimate the second term of (2). The difficulty lies in the fact that the variable N appears in both the terms and the indices of the sum. To remedy this we define Sr(N ) := (−1)k exp ∞ (cid:88) k=0 (cid:18) −μ k2 N 2 − r k N (cid:19) for r ≥ 0. These series are instances of partial theta functions, and below we leverage two facts about them from the literature. But first, let us express wN/2 in terms of these. We have S0(N ) = ∞ (cid:88) k=0 (−1)k exp (cid:18) −μ (cid:19) k2 N 2 N/2−1 (cid:88) (−1)k exp = k=0 (cid:124) (cid:123)(cid:122) (∗) (cid:18) −μ k2 N 2 (cid:19) (cid:125) + exp(−μ/4) − exp(−μ/4) exp −μ (cid:18) (cid:19) 1 N 2 − μ 1 N ∞ (cid:88) + (−1)k exp k=N/2+2 (cid:124) (cid:123)(cid:122) (∗∗) (cid:18) −μ (cid:19) . k2 N 2 (cid:125) We remove the dependency on N from the indices of (∗∗): ∞ (cid:88) (−1)k exp k=N/2+2 (cid:18) −μ (cid:19) k2 N 2 = ∞ (cid:88) (−1)k+N/2 exp k=0 (cid:18) −μ (k + N/2 + 2)2 N 2 (cid:19) (3) (cid:18) = exp −μ (N/2 + 2)2 N 2 (cid:18) = exp(−μ/4) exp −μ k=0 (cid:19) 4 N 2 − μ 2 N (cid:19) ∞ (cid:88) (−1)k exp (cid:18) −μ k2 N 2 − μ (cid:18) 1 + (cid:19) 4 N (cid:19) k N Sμ(1+4/N )(N ). (4) Substituting (4) into (3), and in turn substituting (3) into (2) we get wN/2 = −1 + 2S0(N ) + exp(−μ/4) − 1 + 2 exp −μ (cid:18) (cid:18) (cid:18) − 2 exp −μ Now we use the following lemma. Lemma 1. Sr(N ) ≥ S0(N ) for all r ≥ 0 and for all N . (cid:19) 1 N 1 N 2 − μ (cid:19) 2 N 4 N 2 − μ Sμ(1+4/N )(N ) (cid:19) . Proof. This follows from [6, Proposition 14 Equation 5.8]. The Gaussian kernel on the circle 7 (cid:4) So wN/2 ≤ −1 + 2S0(N ) + exp(−μ/4) − 1 + 2 exp −μ (cid:18) (cid:18) 1 N 1 N 2 − μ (cid:19) 2 N 4 N 2 − μ (cid:19) (5) (cid:19) S0(N ) . (cid:18) − 2 exp −μ The limit of the RHS of (5) as N → ∞ is 0, so it is not enough just to take the limit. Instead, we will need to take an asymptotic expansion with respect to 1/N to the second order. For this, we need a second lemma. Lemma 2. for all n ≥ 1. S0(N ) = 1 2 + O(1/N n) as N → ∞ Proof. [4, Theorem 1.1 (i)] says that for n ≥ 1, S0(N ) = (cid:19)2a(cid:20) n (cid:88) a=0 (cid:18) 1 2πi ∂ ∂z 1 1 − e2πiz (cid:21) z=1/2 (−μ)a a! 1 N 2a +O(1/N 2n+1) as N → ∞. Now observe 1 1 − e2πi(z−1/2) is odd, so the even terms in the Taylor series of f vanish, and hence tan(πz) f (z) := 1 2 i 2 − = (cid:19)2a(cid:20) (cid:18) 1 2πi ∂ ∂z 1 1 − e2πiz (cid:21) z=1/2 (cid:40) 1 2 0 = if a = 0 if a ≥ 1 which gives us the fact. (cid:4) So taking the asymptotic expansion with respect to 1/N to second order, (5) simplifies to wN/2 ≤ exp(−μ/4) 2μ − μ2 N 2 + O(1/N 3) as N → ∞. If λ > 1 2π2 then μ > 2 so 2μ − μ2 < 0 and hence wN/2 is negative for N large enough, with N ≡ 0 mod 4. It is possible to improve these inequalities to obtain the result for all λ, although this is unnecessary: Corollary 1 (ii) is enough to conclude the proof. Thanks to Proposition 3, Theorem 3 gives us much more than one may suspect at first. Corollary 3. If S1 (cid:44)→ X then Λ+(X) = ∅. So Λ+(X) = ∅ for the following spaces, equipped with their classical intrinsic metric: 8 N. Da Costa et al. 1. Sn the sphere, for n ≥ 1. 2. R Pn the real projective space, for n ≥ 1. 3. GrR(k, n) the real Grassmannian, for 1 ≤ k < n. Proof sketch. This follows from Theorem 3 and Proposition 3. Now we briefly argue for the specific examples. For 1., S1 (cid:44)→ Sn (e.g., a 'great circle'). For 2., 1/2 * S1 ∼= R P1 (cid:44)→ R Pn where '∼=' means isometric and '1/2 * S1' means S1 rescaled by a factor of 1/2. This factor does not affect the conclusion. For 3., the metric in question is d([A], [B]) = (cid:19)1/2 (cid:18) k (cid:88) θ2 i i=1 where θi is the i-th principal angle between [A] and [B] (see [21] and [22]), [A], [B] ∈ GrR(k, n). Fixing any [A] ∈ GrR(k, n), travelling on GrR(k, n) while keeping θi = 0 for i > 1 and varying θ1 only, we get an isometric embedding of (cid:3) 1/2 * S1 into GrR(k, n). It is conceivable that S1 can be isometrically embedded (in the metric sense from Definition 2) into any compact Riemannian manifold (up to rescaling). We have yet to think of a counterexample. If this is true, then Theorem 3 would solve the problem of characterising Λ+(X) for all compact Riemannian man- ifolds. However, while the Lyusternik–Fet theorem tells us that any compact Riemannian manifold has a closed geodesic, it appears to be an open question whether any such manifold admits an isometric embedding of S1. Fig. 2. Examples of Riemannian manifolds that admit isometric embeddings of S1. From left to right: a sphere, a torus, a hyperbolic hyperboloid. Note that non-compact manifolds may also admit isometric embeddings of S1: consider a hyperbolic hyperboloid. There is precisely one (scaled) isometric embedding of S1 into it. This example is particularly interesting since, as op- posed to the examples above with positive curvature, it has everywhere negative curvature. See Figure 2. The Gaussian kernel on the circle 9 5 Discussion In machine learning, most kernel methods rely on the existence of an RKHS embedding. This, in turn, requires the chosen kernel to be positive definite. The- orem 3 shows that the Gaussian kernel defined in this work cannot provide such RKHS embeddings of the circle, spheres, and Grassmannians. It reinforces the conclusion from Theorem 2 that one should be careful when using the Gaussian kernel in the sense defined in this work on non-Euclidean Riemannian manifolds. The authors in [3] propose a different way to generalise the Gaussian kernel from Euclidean spaces to Riemannian manifolds by viewing it as a solution to the heat equation. This produces positive definite kernels by construction. Nevertheless, perhaps we should not be so fast to altogether reject our version of the Gaussian kernel, which has the advantage of being of particularly simple form. It is worth noting that the proof of Theorem 3 relies on taking N → ∞, where N is the number of data points. [8] lists three open problems regarding the positive definiteness of the Gaussian kernels on metric spaces. It suggests that we should not only look at whether the Gaussian kernel is PD on the whole space but whether there are conditions on the spread of the data such that the Gram matrix of this data is PD. Our proof of Theorem 3 relying on the assumption of infinite data suggests that this may be the case. In general, fixing N data points, the Gram matrix with components exp(−λd( * , * )2) tends to the identity as λ → ∞, so will be PD for λ large enough. This observation has supported the use of the Gaussian kernel on non-Euclidean spaces, for example, in [13] where it is used on spheres. However, it is important to keep Theorem 3 in mind in applications where the data is not fixed, and we need to be able to deal with new and incoming data, which is often the case. References 1. Barachant, A., Bonnet, S., Congedo, M., Jutten, C.: Riemannian geometry applied to BCI classification. In: Vigneron, V., Zarzoso, V., Moreau, E., Gribonval, R., Vincent, E. (eds.) Latent Variable Analysis and Signal Separation. pp. 629–636. Springer Berlin Heidelberg, Berlin, Heidelberg (2010) 2. Berg, C., Christensen, J.P.R., Ressel, P.: Harmonic Analysis on Semigroups, Graduate Texts in Mathematics, vol. 100. Springer, New York, NY (1984). https://doi.org/10.1007/978-1-4612-1128-0 3. Borovitskiy, V., Terenin, A., Mostowsky, P., Deisenroth, M.: Mat ́ern Gaussian pro- cesses on Riemannian manifolds. In: Larochelle, H., Ranzato, M., Hadsell, R., Bal- can, M., Lin, H. (eds.) Advances in Neural Information Processing Systems. vol. 33, pp. 12426–12437. Curran Associates, Inc. (2020) 4. Bringmann, K., Folsom, A., Milas, A.: Asymptotic behavior of partial and false theta functions arising from Jacobi forms and regularized characters. Journal of Mathematical Physics 58(1), 011702 (2017). https://doi.org/10.1063/1.4973634 5. Calinon, S.: Gaussians on Riemannian manifolds: Applications for robot learning and adaptive control. IEEE Robotics & Automation Magazine 27(2), 33–45 (2020). https://doi.org/10.1109/MRA.2020.2980548 10 N. Da Costa et al. 6. Carneiro, E., Littmann, F.: Bandlimited approximations to the truncated Gaussian and applications. Constructive Approximation 38(1), 19–57 (2013). https://doi.org/10.1007/s00365-012-9177-8 7. Cristianini, N., Ricci, E.: Support Vector Machines, pp. 2170–2174. Springer New York, New York, NY (2016) 8. Feragen, A., Hauberg, S.: Open problem: Kernel methods on manifolds and metric spaces. What is the probability of a positive definite geodesic exponential ker- nel? In: Feldman, V., Rakhlin, A., Shamir, O. (eds.) 29th Annual Conference on Learning Theory. Proceedings of Machine Learning Research, vol. 49, pp. 1647– 1650. PMLR, Columbia University, New York, New York, USA (23–26 Jun 2016), https://proceedings.mlr.press/v49/feragen16.html 9. Feragen, A., Lauze, F., Hauberg, S.: Geodesic exponential kernels: When curvature on Com- In: puter Vision and Pattern Recognition (CVPR). pp. 3032–3042 (2015). https://doi.org/10.1109/CVPR.2015.7298922 and linearity conflict. IEEE Conference 2015 10. Gneiting, T.: Strictly and non-strictly positive definite functions on spheres. Bernoulli 19(4), 1327–1349 (Sep 2013). https://doi.org/10.3150/12-BEJSP06, pub- lisher: Bernoulli Society for Mathematical Statistics and Probability 11. Gonon, L., Grigoryeva, L., Ortega, J.P.: Reservoir kernels and Volterra series. ArXiv Preprint (2022) 12. Grigoryeva, L., Ortega, J.P.: Dimension reduction in recurrent networks by canonicalization. Journal of Geometric Mechanics 13(4), 647–677 (2021). https://doi.org/10.3934/jgm.2021028 13. Jaquier, N., Rozo, L.D., Calinon, S., B ̈urger, M.: Bayesian optimization meets Riemannian manifolds in robot learning. In: Kaelbling, L.P., Kragic, D., Sugiura, K. (eds.) 3rd Annual Conference on Robot Learning, CoRL 2019, Osaka, Japan, October 30 - November 1, 2019, Proceedings. Proceedings of Machine Learning Research, vol. 100, pp. 233–246. PMLR (2019), http://proceedings.mlr.press/ v100/jaquier20a.html 14. Jayasumana, S., Hartley, R., Salzmann, M., Li, H., Harandi, M.: Kernel meth- ods on Riemannian manifolds with Gaussian RBF kernels. IEEE Transac- tions on Pattern Analysis and Machine Intelligence 37(12), 2464–2477 (2015). https://doi.org/10.1109/TPAMI.2015.2414422 15. Romeny, B.M.H.: Geometry-Driven Diffusion in Computer Vision. Springer Science & Business Media (Mar 2013), google-Books-ID: Fr2rCAAAQBAJ 16. Salvi, C., Cass, T., Foster, J., Lyons, T., Yang, W.: The Signature Kernel is the solution of a Goursat PDE. SIAM Journal on Mathematics of Data Science 3(3), 873–899 (2021) 17. Schoenberg, I.J.: Metric spaces and positive definite functions. Transactions of the American Mathematical Society 44(3), 522–536 (1938), http://www.jstor.org/ stable/1989894 18. Sch ̈olkopf, B., Smola, A., M ̈uller, K.R.: Nonlinear component analysis as a kernel eigenvalue problem. Neural Computation 10(5), 1299–1319 (1998). https://doi.org/10.1162/089976698300017467 19. Sra, S.: Positive definite matrices and the S-divergence. Proceedings of the Amer- ican Mathematical Society 144(7), 2787–2797 (2016), https://www.jstor.org/ stable/procamermathsoci.144.7.2787 20. Wood, A.T.A.: When is a truncated covariance function on the line a covariance function on the circle? Statistics & Probability Letters 24(2), 157–164 (Aug 1995). https://doi.org/10.1016/0167-7152(94)00162-2 The Gaussian kernel on the circle 11 21. Ye, K., Lim, L.H.: Schubert varieties and distances between subspaces of different dimensions. SIAM Journal on Matrix Analysis and Applications 37(3), 1176–1197 (2016). https://doi.org/10.1137/15M1054201 22. Zhu, P., Knyazev, A.: Angles between subspaces and their tangents. Journal of Numerical Mathematics 21(4), 325–340 (2013). https://doi.org/doi:10.1515/jnum- 2013-0013
http://arxiv.org/abs/2302.10612v1
2023-02-21T11:43:01
2023-02-21T11:43:01
Tree-Based Machine Learning Methods For Vehicle Insurance Claims Size Prediction
Vehicle insurance claims size prediction needs methods to efficiently handle these claims. Machine learning (ML) is one of the methods that solve this problem. Tree-based ensemble learning algorithms are highly effective and widely used ML methods. This study considers how vehicle insurance providers incorporate ML methods in their companies and explores how the models can be applied to insurance big data. We utilize various tree-based ML methods, such as bagging, random forest, and gradient boosting, to determine the relative importance of predictors in predicting claims size and to explore the relationships between claims size and predictors. Furthermore, we evaluate and compare these models' performances. The results show that tree-based ensemble methods are better than the classical least square method. Keywords: claims size prediction; machine learning; tree-based ensemble methods; vehicle insurance.
[ "Edossa Merga Terefe" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10612v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10612v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "stat.AP" ]
3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 2 1 6 0 1 . 2 0 3 2 : v i X r a Tree-Based Machine Learning Methods For Vehicle Insurance Claims Size Prediction Edossa Merga Terefe 1,2 1 Research Center for Statistics, University of Geneva, Switzerland 2 Statistics Department, Hawassa University, Ethiopia [email protected] February 22, 2023 Abstract Vehicle insurance claims size prediction needs methods to efficiently handle these claims. Machine learning (ML) is one of the methods that solve this problem. Tree-based ensemble learning algorithms are highly effective and widely used ML methods. This study considers how vehicle insurance providers incorporate ML methods in their companies and explores how the models can be applied to insurance big data. We utilize various tree-based ML methods, such as bagging, random forest and gradient boosting, to determine the relative importance of predictors in predicting claims size and to explore the relationships between claims size and predictors. Furthermore, we evaluate and compare these models' performances. The results show that tree-based ensemble methods are better than the classical least square method. Keywords: claims size prediction; machine learning; tree-based ensemble methods; vehicle insurance. 1 Introduction A key challenge for the insurance industry is to charge each customer an appropriate price for the risk they represent. Risk varies widely from customer to customer, and a deep understanding of different risk factors helps predict the likelihood and cost of insurance claims. Thus, insurance companies must have an insurance premium that is appropriate for each customer. There are two groups in the insurance industry: life insurance and non-life insurance. This study considers nonlife insurance, particularly vehicle insurance. Insurance claims occur when the policyholder creates a formal request to an insurer for coverage or compensation for an unfortunate event of an accident. 1 Policyholders can mitigate the costs involved with coverage for the property (damage or theft to a car) and liability (legal responsibility to others for the medical or property costs). Insurance companies must predict how many claims are going to occur and the severity of these claims to enable insurers to set a fair price for their insurance products accordingly. In other words, claim prediction in the vehicle insurance sector is the cornerstone of premium estimates. Furthermore, it is crucial in the insurance sector to plan the correct insurance policy for each prospective policyholder. Several studies have been done to personalize the premium estimate, such as Guillen et al. (2019) and Roel et al. (2017), they demonstrated the possible benefits of analyzing information from telematics when determining premiums for vehicle insurance. The predictive capacity of covariates obtained from telematics vehicle driving data was investigated by Gao and Wuthrich (2018) and Gao et al. (2019) using the speed–acceleration heat maps suggested by Wuthrich (2017). Prediction accuracy enables the insurance industry to better adjust its premiums, and makes vehicle insurance coverage more affordable for more drivers. Currently, many insurance companies are transitioning to ML techniques to predict claims size. However, selecting a suitable ML predictive model is far from trivial. In this study, we investigate flexible ML techniques to make accurate predictions for claims size by analyzing a large vehicle dataset given by Ethiopian Insurance Company, one of the main car insurance company based in Ethiopia, and we apply the tree-based ML methods to the dataset, such as bagging, random forest, and gradient boosting. We also evaluate and compare the performance of these models. The rest of this paper is organized as follows. In Section 2, the dataset is described and some descriptive statistics are provided. In Section 3, we present review of three tree-based ensemble methods is presented. In Section 4, we report the results from application of considered methods. In Section 5 we provide a discussion and conclusion of the study. 2 Dataset and Exploratory Analysis 2.1 The data The data used for this analysis were provided from a large database of the Ethiopian Insurance Corporation, one of the biggest insurance companies in Ethiopia. It consists of policy and claim information of vehicle insurance at the individual level. The dataset originally contains n = 288, 763 unique individual contracts, represented by the observations (X1, Y1), . . . , (Xn, Yn) where X = (X1, . . . , Xp) ∈ Rp denotes a vector of p = 10 predictors, and Y ∈ R denotes the response variable representing the claim size. The data were correspond to the period between July 2011 to June 2018. The different predictors used in the analysis are summarized in Table 2.1. The terms, liability and comprehensive coverage in Table 2.1 are defined as: • Comprehensive coverage: The company covers all the losses which happen to the car whenever the conditions of agreement are satisfied. • Liability or third party coverage: The car can cause a damage to someone or someone's property. If the policy holder already has an agreement for a liability coverage, the insurance 2 S.N Name Type Domain / Levels Description / representation 1 2 3 4 5 6 7 8 9 Sex categorical 0, 1, 2 Season categorical autumn, winter, spring, summer Insurance type categorical 1201, 1202, 1204 Type vehicle categorical pick-up, truck, bus, ... categorical fare paying passengers, taxi, general cartage, ... 0 = legal entity, 1 = male, 2 = female Beginning of contract. 1201 = private, 1202 = commercial, 1204 = motor trade road risk Type of vehicle grouped into six categories. A usual usage of the vehicle grouped into six categories. categorical Toyota, Isuzu, Nissan,... Manufacturer company. Usage Make Coverage categorical comprehensive, liability Scope of the insurance. Production year Integer 1960 - 2018 Vehicle's production year. Insured value continuous R+ Vehicle's price in USD. 10 Premium continuous R+ Premium amount in USD. Table 2.1: Description of predictors in Ethiopian vehicle insurance dataset. 3 company covers the costs in this case. Liability amount, which a policy holder has to pay as a part of premium is nationally fixed almost every year for each car type across all the insurance companies operating in the country. The liability cases are usually taken to courts or settled by negotiation. However, the affected party should not be either a family member or a relative of the policy holder. Computation of premium is determined as a function of: • Insured value. • Production year: For the first three years, age of the car is not considered, but after three years, age loader computation technique, which takes into account age of the vehicle is applied. • No claim discount (NCD): Upon the renewal of the contract after a year, a policy holder gets 20% discount from the previous year's premium and adjusted for inflation if he/she has not applied for a claim in that year. He/she can get up to 60% of discount in the consecutive years but pooled down by the age loader of the vehicle. • Contingency, Plant and Machinery (CPM): Applicable for those cars which are operated on different circumstances. For instance, loaders type vehicles premium can be computed depending on the assumption of being at the engineering (construction) sites. But in case the vehicle cause an accident while being driven on the road, the computation needs an additional consideration and computation mechanism differs. Some predictors such as carrying capacity and seat number are removed from the dataset prior to data analysis and modeling since they are not correctly coded. 2.2 Claims size Variable In our analysis, the claim size is a continuous response variable Y ∈ R. It is originally the amount in the Ethiopian currency Birr and it is converted to USD during data analysis. The distribution of the response variable Y is strongly zero-inflated since for about 92.5% of the contracts there is no claim paid. Thus, instead of visualizing and modeling this distribution directly, we first select the non zero observations. Given that the claim has to be paid for policy holder i, it is determined as Yi = Claims Size = Insured valuei Market valuei × Lossi, (2.1) where • Market value is the market price of the car when it was bought. The market price for each car type is collected by the insurer almost every year. The data on the market value are taken either from importers or informally from other institutions. It can be either more or less than the insured value. Knowing market value of the car helps to adjust the claim amount not to be too high in case insured value is not reliable. In most cases, insured value and market value are the same. 4 • Loss: When an accident happens, the damaged vehicle is inspected by the engineer experts who work in the insurance company. These experts known as server decision look at each part of the vehicle, identify the affected parts and propose either to replace or fix the vehicle. Once the affected parts have been identified, its price is determined by the server decision and a bid for repairing the damaged car is published. Including the server decision members, anyone who has a license to do so can usually participate in the bid competition. The loss is determined as follows. In some cases, the amount of claim paid can be higher than either the insured value or market price. It is mandatory to have at least a liability insurance coverage for all vehicles as a coun- try's regulation, even if comprehensive insurance coverage in for a safety of the vehicle's owner. Additionally, a policy holder can also have BSG and PLL insurance coverage, but if only the comprehensive coverage is already secured first. The terms BSG and PLL are defined as: • Bandit, Shifta and Gorilla (BSG): A contract agreement in case the car is robbed or stolen. To the maximum of the insurer's knowledge, it is a vehicle insurance component applicable in Ethiopia only. • Passengers legal liability (PLL): This is applicable for fare paying passengers, in case someone is affected by an accident being in the car. Similar to that of liability coverage, its amount is fixed to be paid as part of premium and a maximum of 40,000 birr would be paid by the insurer to a passenger in case an accident happened. Even though both BSG and PLL insurance coverage depend on the interest of policy holder and they are optional, applicable if and only if the comprehensive insurance agreement is to take place or has already taken place. The insured value in (2.1) does not include the values of liability, BSG and PLL, even though they are included in the contract. It contains the value of comprehensive coverage only. Thus, claims size can be higher than the insured value if: • (total) loss + (liability insurance) + (PLL) > insured value, where total loss is an overall loss of the car due to a severe accident and impossible to repair. In that case the insurer company pays exactly the insured value as a claim. 2.3 Exploratory Data Analysis To make assumptions about the data and find a model that fits it best, it is important to carry out an exploratory data analysis (EDA), since it has a significant role to let the data speak for themselves prior to or as part of a formal analysis. It allows the researcher to influence and criticize an intended analysis. Additionally, EDA techniques may reveal additional information that may not be directly related to the research question. For example, EDA could suggest fruitful new lines of research (Maindonald and Braun, 2010). 5 The purpose of statistical graphics is to provide visual representations of quantitative and qualitative information. As a methodological tool, statistical graphics comprise a set of strategies and techniques that provide the researchers with important insights about the data under examination and help guide for the subsequent steps of the research process. The objectives of graphical methods are to explore and summarize the contents of large and complicated data sets, address questions about the variables in an analysis (for example, the distributional shapes, ranges, typical values and unusual observations), reveal structure and pattern in the data, check assumptions in statistical models, and facilitate greater interaction between the researcher and the data. Various graphical methods were examined to visualize data in raw and amalgamated formats. The most widely recognized graphical tool to display and examine the frequency distribution and a density of a single continuous variable is the histogram. Figure 1: Frequency histogram and superimposed density plot representations of natural logarithm of claim paid distribution. The distribution of the response variable Y is strongly zero-inflated since for only about 7.5% of the contracts there is non-zero claim payment. Thus in our analysis, instead of visualizing and modeling this distribution directly, we only consider a data of policy-holders who have ever received a positive claim. Another common tool to visualize the observed distribution of data is by plotting a smoothed histogram commonly referred as empirical density, the blue curve superimposed on the histogram with blue line in Figure 1. The empirical densities overcome some of the disadvantages caused by the arbitrary discrete bins used in the basic histograms. 6 0.00.20.40.60.8123456log Claim paiddensity 2.4 Exploring relationships between covariates and Claim paid Relationships between the predictors and the response variable can be depicted by graphical methods. Side-by-side boxplots are one way of graphical displaying the relationship between qualitative and quantitative variables. It is an excellent tool for conveying location and variation information in data sets, particularly for detecting and illustrating location and variation changes between different groups of data. The boxplots of claim paid against the different qualitative predictors are shown in Figure 2. Several predictors seem to have significant heterogeneity across theirs labels. For instance, in the boxplots of log of claim paid against sex, it seems existence of differences in terms of log of claim paid across the three groups of sex. Accordingly, male policy holders appeared to have a higher claim payment than either female counterparts or legal entities. Similarly, differences in claims size are observed in vehicle usage, identifying the vehicles that used for a general cartage to have the highest claim payment followed by a fare paying passengers vehicles. Moreover, vehicles manufactured from Isuzu and Iveco companies cost the insurer more than vehicles that are from any other companies, which is consistent with the insurer's prior identification of risky vehicles. It can also be seen that there are differences across the groups in other covariates such as vehicle type, insurance type and insurance coverage. Boxplots are also a robust measure of the spread of a distribution and more informative than merely computing the variance by group as they can be helpful in identifying the homogeneity of variance between groups of a predictor. Looking at the boxplot of sex covariate again, it can be seen that the claim payment made for male policy holders appears to be more variable than either of the other two categories. And also in vehicle usage covariate, claim payment made for vehicles that are used for a general cartage and fare paying passengers purposes have more variability than any other groups. Similarly, heterogeneity of variance between a groups of insurance coverage, insurance type, manufacturer company and vehicle type covariates was observed. Analogous to boxplots, Scatterplots are an obvious way to visualize a relationship between two quantitative variables that are numerically comparable. They are useful as a preliminary step before performing a regression analysis. Figure 3 shows that scatterplots, a bivariate relationships between claim paid and quantitative predictors. It is difficult to detect clear trends in any of the plots. However, by stratifying the points according to the different groups of usage predictor, we see some differences in claims size across the groups. In addition to the scatterplot matrix seen in Figure 3, we computed correlation coefficients between claims size and insured value, premium and production year as 0.22, 0.33 and 0.11, respectively. Even though none of the coefficients between claims size and the covariates are considered to be strong, but there are some notable associations. For instance, claims size appear to have a moderate positive correlation between insured value, premium and production year , meaning that as vehicles' insured value, premium and production year increase, their claim payment also tends to increase. Correlation coefficient based relationships usually be teased out more clearly when building the (final) model. The loess curves drawn on top of the scatterplots indicates a possibly nonlinear relationship between the two variables. The curves for claims size against insured value and premium are 7 an upside-down U-shape, peaking around the middle of insured value and premium for the most groups of usage predictor. This means that the vehicles with moderate insured value and/or moderate premium have larger claims sizes than those with lower and higher insured value and /or premium. Because this trend is non-linear, this finding could not have been inferred from the correlations alone. On the other hand, when we consider the private group of usage predictor, the relationships between claim size against insured value and premium seem to be linear with a positive slope. 3 Review of Machine Learning Methods Machine learning is now well established in many areas. In contrast to the statistical modeling approach, ML algorithms do not assume any specific model structure for the data. ML methods capture the underlying structure of data and therefore, they are more efficient in handling large data with arbitrary degree of complexity. One major task of machine learning is to construct good models from data sets. Among ML algorithms, ensemble methods are one of the usual choice to analyze large and complex data. Originally developed to reduce the variance-thereby improving the accuracy of an automated decision-making system, ensemble methods have since been successfully used to address a variety of machine learning problems (Zhang and Ma, 2012), such as predictor selection, class imbalanced data, confidence estimation, error correction, among others. The main idea behind the ensemble methodology is to weigh several individual pattern learners, and combine them in order to obtain a learner that outperforms most of them. In fact, combining the learners outputs does not necessarily lead to a performance that is guaranteed to be better than the best learner in the ensemble. Rather, it reduces likelihood of choosing a learner with a poor performance. Ensemble methodology imitates to seek several opinions before making any crucial decision. The individual opinions are weighted, and combined to reach the final decision (Polikar, 2006). A general principle of ensemble methods is to construct a linear combination of some model fitting method, instead of using a single fit of the method to improve the predictive performance of a given statistical learning or model fitting technique. More precisely, consider an estimation of a real-valued function f : Rp → R based on data (cid:8)(xi, yi); i = 1, . . . , n(cid:9) where x is a p-dimensional predictor variable and y a univariate response. We may then generalize to functions f (x) and other data types. Given some input data, we learn several functions ˆf1, ˆf2, ˆf3, . . . , ˆfB, called learners, by changing the input data based on different reweighting. We can then construct an ensemble-based function estimate ˆfens (x) by taking linear combinations of the individual learners as an additive expansion of the learners (Elish, 2009) ˆfi (x): ˆfens (x) = B ∑︁ wi ˆfi (x), (3.1) i=1 where the ˆfi (x) are estimates obtained from the ith reweighted dataset and wi are the linear com- 8 bination coefficients. For instance, wi = 1/B, an averaging weights for bagging (see Section 3.1) and for boosting (see Section 3.3). In this study, three ensemble learning algorithms i.e., bagging, random forest and boosting are considered. For models performance comparison purpose, two non-ensemble learning technique i.e., ordinary linear regression and decision tree are also applied to Ethiopian vehicle insurance data set to predict claims size. 3.1 Bagging Bagging (Breiman, 1996), which stands for bootstrap aggregating, is an ensemble method for im- proving unstable estimation or classification schemes. As the name implies, the two key ingredients of Bagging are bootstrap and aggregation. Bagging adopts the bootstrap distribution for generating different learners. In other words, it applies bootstrap sampling (Efron and Tibshirani, 1993) to obtain the data subsets for training the learners. In detail, given an original data set, we generate a data set containing n number training observations by sampling with replacement. Some original observations appear more than once, while some original observations are not present in the sample. By applying the process B times, B samples of n training observations are obtained. Then, from each sample a learner can be trained by applying the learning algorithm. Bagging also adopts the most popular strategies for aggregating the outputs of the learners, that is, voting for classification and averaging for regression. To predict a test instance, taking regression for example, Bagging feeds the instance to its learners and collects all of their outputs, and then takes the average of the outputs as the prediction, where ties are broken arbitrarily. In particular, the bagging method for regression is applied as follows. A learner ˆfi (x) is fitted on each of the B bootstrapped sample, where ˆfi (x) denotes the predicted response values from i = 1, 2, . . . , B learners. Then the B learners constructed are combined using the aggregation, so that the average prediction, fav (x) is estimated as the average of predicted outputs from ˆfi (x) as: ˆfav (x) = 1 B B ∑︁ i=1 ˆfi (x) (3.2) in order to obtain a single low-variance learner. 3.2 Random Forest Random Forest (RF) is a representative of the state-of the-art ensemble methods algorithm de- veloped by Breiman and Cutler (2008), and a very powerful technique which is used frequently in the data science field across industries (Dangeti, 2017). It is an extension of Bagging, where the major difference with Bagging is the incorporation of randomized predictor selection. During the construction of a component decision tree, at each split, RF first randomly selects a subset of predictors, and then carries out the conventional split selection procedure within the selected predictor subset. 9 RF is usually applied to reduce the variance of individual trees by growing numerous trees. Each subsequent split for all trees grown is not done on the entire data set, but only on the portion of the prior split that it falls under. For each tree grown, about one third of training samples are not selected in bootstrap and it is called out of bootstrap ("out of bag" or "OOB") samples, as in case of Bagging in Section 3.1. Using OOB samples as input to the corresponding tree, predictions are made as if they were novel test samples. A particular observation can fall in the terminal nodes of many trees in the forest, each of which, potentially, can give a different prediction. Again, the OOB sample data used to fit a particular tree is used to make each tree's prediction. Through book-keeping principle, an average for continuous response is computed for all OOB samples from all trees for the prediction of RF model. For discrete outcomes, the prediction is the majority votes from all trees that have been grown without the respective observation or the average of the predicted probabilities (Jones and Linder, 2015). 3.3 Gradient Boosting Gradient Boosting algorithms have been proposed in the machine learning literature by Schapire (1990) and [ Freund (1995); Freund and Schapire (1996)]. The term boosting refers to a family of algorithms that are able to convert weak learners to strong learners for improving the predictive performance of a regression or classification procedure. Intuitively, a weak learner is just slightly better than random guess, while a strong learner is very close to perfect performance. The boosting method attempts to boost the accuracy of any given learning algorithm by fitting a series of models, each having a low error rate, and then combining them into an ensemble that may achieve better performance (Schapire, 1999). This strategy can be understood in terms of other well-known statistical approaches, such as additive models and a maximum likelihood (Friedman et al., 2000). Like bagging, boosting is a general approach that can be applied to many ensemble statistical learner for regression or classification. Unlike bagging which is a parallel ensemble method, boosting methods are sequential ensemble algorithms where the weights wi in (3.1) are depending on the previous fitted functions ˆf1, . . . , ˆfi−1. Boosting does not involve bootstrap sampling; instead each tree is fitted on a modified version of the original data set. There are several versions of the boosting algorithms for classification problems [Drucker (1997); Friedman et al. (2000); Schapire and Freund (2013)], but the most widely used is the one by Freund and Schapire (1996), which is known as AdaBoost, and it has been empirically demonstrated to be very accurate in terms of classification. There are also several studies [Friedman (2002); Friedman (2001); Drucker (1997)] conducted related to boosting for regression problems. In this paper, we rely on a recently proposed gradient boosting algorithm by Chen and Guestrin (2016), which uses regression trees as the basis functions, and it optimizes a regularized learning objective function L (φ) = ∑︁ i l ( ˆyi, yi) + Ω( fb) ∑︁ b where Ω = γT + λ||w||2. 1 2 10 (3.3) Here, l is a differentiable convex loss function that measures the difference between the pre- diction ˆyi and the target yi. The second term Ω penalizes the complexity of the model (i.e., the regression tree functions). The additional regularization term helps to smooth the final learned weights to avoid over-fitting. Boosting regression tree involves generating a sequence of trees, each grown on the residuals of the previous tree. Therefore, boosting regression tree model inherits almost all of the advantages of tree-based models, while overcoming their primary disadvantage, that is, inaccuracy Friedman and Meulman (2003). 4 Application of Machine Learning Methods to Insurance Data 4.1 Variable Importance Our goal is not only to find the most accurate model of the response, but also to identify which of the predictor variables are most important to make the predictions. For this reason, we perform variable importance. The ensemble methods algorithm estimate the importance of for instance, x j predictor variable by looking at how much prediction error increases over the baseline error, when the OOB sample for x j predictor is permuted while all others are left unchanged. The most commonly used variable importance measure is the permutation importance, introduced by Breiman (2001), which suggests that the variable importance of predictor x j is the difference in prediction accuracy after and before permuting x j averaged over all trees. More precisely, the variable importance of predictor x j is defined as VI(x j ) = 1 B B ∑︁ i=1 VI (cid:0)x j (cid:1) i (4.1) (cid:17) (cid:16) i = RMSE where VI (cid:0)x j (cid:1) x j i − RMSE0 i x j representing the RMSE value for the ith , and RMSE i model in the ensemble fitted from the dataset with a random permutation applied to the covariate x j , and RMSE0 i = 0, if variable x j is not in the ith model. The raw variable importance score for each variable is then computed as the mean importance over all trees. In fact, VI(x j ) can be computed depending on any other performance measure such as coefficient of determination, R2. i is the RMSE value for this model fitted to the original dataset. Note that VI (cid:0)x j (cid:1) Let x1, . . . , x p be the features of interest and let RMSE0 be the baseline performance metric for the trained model. The permutation-based variable importance scores can be computed as shown in Algorithm 1. 11 Algorithm 1 Permutation-based variable importance computation. 1: For j ∈ (cid:8)1, 2, . . . , p(cid:9); (a) Permute the values of feature xi in the training data. (b) Recompute the performance metric on the permuted data, RMSE. (c) Record the difference from baseline using 4.1. 2: Return the variable importance scores VI(x1), . . . , VI(x p). Figure 4: A graphical representation of average variable importance across all the trees from Bagging, boosting and regression RF. The larger the number, the bigger the effect. Figure 4 displays the importance predictor while growing the trees. Accordingly in all the three models, premium is the most crucial predictor followed by the insured value. The second most influential (slightly equally in bagging and random forest) predictors are usage and sex, followed by production year, in line with the earlier boxplots exploratory analysis. Figure 4 is obtained by repeating the permutation of each variable 20 times and the results averaged together. This helps to provide more stable VI scores, and also the opportunity to measure their variability as seen in Figure 5, since permutation approach introduces randomness into the procedure. 12 baggingboostingrandom forest0.00.10.20.00.10.20.00.10.2INSURANCE_CVRGEINSR_TYPEMAKESEASON_BEGINTYPE_VEHICLEPROD_YEARSEXUSAGEINSURED_VALUEPREMIUMImportance Figure 5: Boxplots of variable importance from Bagging (left panel) and regression RF (right panel) from 20 times repeated permutation. 4.2 Partial Dependence Plots Though determining predictor importance is a crucial task in any supervised learning problem, ranking variables is only part of the story and once the important predictors are identified it is often necessary to assess the relationship between the predictors and the response variable. The task is often accomplished by constructing partial dependence plots (PDP) (Friedman, 2001), which helps to visualize the relationship between a predictor and the response variable while accounting for the average effect of the other predictors in the model. Let ˆy be prediction function from an arbitrary model using a dataset, D = (cid:8)(xi, j , yi)(cid:9) for i = 1, . . . , n and j = 1, . . . , p. The model generates predictions of the form: ˆyi = f (cid:0)xi,1, xi,2, . . . , xi,p(cid:1) , (4.2) for some function f (...). Let xk be a single predictor of interest with unique values (cid:0)x1,k , x2,k , . . . , xn,k (cid:1). Then the partial dependence plots are obtained by computing the following average and plotting it over a useful range of x values: ̄fk (x) = 1 n n ∑︁ j=1 ˆf (cid:0)x1, j , . . . , xk−1, j , x, xk+1, j , . . . , x p, j (cid:1) (4.3) The function ̄fk (x) indicates how the value of the variable xk influences the model predictions (cid:8)y j (cid:9) after we have averaged out the influence of all other variables. The partial dependence of the response on xk can be constructed as Algorithm 2: 13 INSURANCE_CVRGEINSR_TYPEMAKESEASON_BEGINTYPE_VEHICLEPROD_YEARSEXUSAGEINSURED_VALUEPREMIUM0.00.10.20.3ImportanceINSURANCE_CVRGEINSR_TYPESEASON_BEGINMAKETYPE_VEHICLEPROD_YEARUSAGESEXINSURED_VALUEPREMIUM0.050.100.15Importance Algorithm 2 Partial dependence construction of the response on a single predictor xk . 1: For j ∈ {1, 2, . . . , n}; (a) Replace the original training values of xk with the constant xk, j . (b) Compute vector of predicted values, (cid:8) ˆy j (cid:9) from the modified version of the training data. (c) Compute the average prediction according to 4.3 to obtain ̄fk (xk, j ). 2: Plot the pairs of (cid:8)xk, j , ̄fk (xk, j )(cid:9) for j = 1, 2, . . . , n Since Algorithm 2 can be quite computationally intensive as it involves n passes over the training records, a reduced number of points is used by equally spacing the values in the range of the variable of interest. Figure 6: Two-way partial dependence plots; the marginal effect of premium on the claims size for different groups of usage predictor after integrating out the other variables. Figure 6 shows a separate partial dependency function for each group of usage predictor. Because one-way partial dependency plots display one predictor at a time, they are valid only if the predictor of interest does not interact strongly with other predictors. However, interactions are common in actual practice; in these cases, we can use higher-order (such as two- and three-way) partial dependence plots to check for interactions among predictors. For example, Figure 6 shows an interaction between premium and usage predictors. The two-way plot shows that vehicles used for a general cartage with a high premium (more than 2 in ensemble methods) have much higher expected claims size compared to the vehicles with other usages. This interaction would have not apparent in the one-way plot. 14 OLSRandom ForestBaggingBoosting1.01.52.02.53.01.01.52.02.53.02.63.03.42.63.03.4Premiumpredicted claimusageFPPG.CartageO.GoodsO.ServiceOthersPrivate 4.3 Methods Comparison In this application, the predictor variable is represented by a collection of quantitative and qualitative attributes of the vehicle and the response is the actual claims size. Given a collection of N observations (cid:8)(xi, yi); i = 1, . . . , N (cid:9) of known (x, y) values, the goal is to use this data to obtain an estimate of the function that maps the predictor vector x to the values of the response variable y. This function can then be used to make predictions on observations where only the x values are observed. Formally, we wish to learn a prediction function x ↦→ ˆf (x) that minimizes the expectation of some loss function L ( ˆf (x), y) over the joint distribution of all (x, y)-values, that is ˆf (x) = arg min f (x) E (cid:2)L ( f (x), Y )|X = x(cid:3) . In finite samples, we evaluate the performance of ˆf with the Mean Square Error (MSE), that is (4.4) MSE = 1 n(cid:48) n(cid:48) ∑︁ i=1 (cid:16) ˆf (xi) − yi (cid:17) 2 (4.5) where ˆf (x) is a fitted regression function on the test data set {xi}n(cid:48) variable. i=1 and y is the observed response Figure 7: Observed against predicted claims size on log scales For statistical modeling purposes, we first partitioned the data into train (70%) and test (30%) data sets. The train set was used for exploratory data analysis, model training and selection, and the test set to assess the predictive accuracy of the selected method. The training data goes from years 2011 to 2015 and from 2017 to 2018, while the test data is observations from the year 2016. 15 OLSrandom forestbaggingboosting2345623456234234Observed claimPredicted claimUSAGEFPPG.CartageO.GoodsO.serviceOthersPrivate Regarding performance of the methods, it can be clearly seen that OLS method is predicting all the claims less than USD 104 even though some observed claims are even larger than USD 105. However in case of ensemble methods, they could predict claims size beyond 104. Both OLS and ensemble methods underestimated high claims size, but the underestimation is higher in OLS. 5 Conclusion Ensemble methods are well established algorithms for obtaining highly accurate classifiers by combining less accurate ones. This paper has provided a brief overview of methods for constructing ensembles and reviewed the three most popular ones, namely bagging, random forest and gradient boosting. The paper has also provided some results from application of ensembles on real vehicle insurance dataset to address some problems of insurance companies. In the application section, the predictors are ranked according to their importance in predicting claims size, and the relationships between claims size and some predictors are assessed. The performances of non-ensemble (OLS) and ensemble learning algorithms (bagging, random forests and gradient boosting) are evaluated in terms of RMSE. Accordingly, the ensemble learning techniques outperformed the OLS. Thus, this study suggests that ensemble learning techniques can outperform non-ensemble techniques. Moreover, the three ensemble algorithms performed similarly. References L. Breiman. Bagging predictors, 1996. L. Breiman. Random forests. Machine Learning, 45, 5–32, 2001. ISSN 0885-6125. doi: 10.1023/A: 1010933404324. URL http://dx.doi.org/10.1023/A:1010933404324. L. Breiman and A. Cutler. Random Forests: Classification/Clustering Manual. Statistics Depart- ment, University of California, Berkeley, CA 94720, 2008. URL http://www.math.usu.edu/ ~adele/forests/cc_home.htm. T. Chen and C. Guestrin. Xgboost: A scalable tree boosting system. 2016. doi: http://dx.doi.org/ 10.1145/2939672.2939785. P. Dangeti. Statistics for machine learning: build supervised, unsupervised, and reinforcement learning models using both Python and R. Packt Publishing Ltd, Birmingham B3 2PB, UK., 2017. ISBN 978-1-78829-575-8. H. Drucker. Improving regressors using boosting techniques. In Proceedings of the 14th Interna- tional Conference on Machine Learning, 1997. B. Efron and R. Tibshirani. An Introduction to the Bootstrap. Chapman and Hall, New York, 1993. M. O. Elish. Improved estimation of software project effort using multiple additive regression trees. Expert Systems with Applications, 36(7):10774–10778, 2009. 16 Y. Freund. Boosting a weak learning algorithm by majority. Information and Computation, 121: 256–285, 1995. Y. Freund and R. E. Schapire. Experiments with a new boosting algorithm. In Machine Learning: Proceedings of 13th International Conference, pages 148–156, 1996. J. Friedman, T. Hastie, and R. Tibshirani. Additive statistical regression: a statistical view of boosting. The Annals of Statistics, 28(2):337–407, 2000. J. H. Friedman. Greedy function approximation: a gradient boosting machine. The Annals of Statistics, 29(5):1189–1232, 2001. J. H. Friedman. Stochastic gradient boosting. Computational Statistics and Data Analysis, 38(4): 367–378, 2002. J. H. Friedman and J. J. Meulman. Multiple additive regression trees with application in epidemi- ology. Statistics in Medicine, 22(9):1365–1381, 2003. G. Gao and M. V. Wuthrich. Feature extraction from telematics car driving heatmaps. European Actuarial Journal, 8:383 – 406, 2018. G. Gao, S. Meng, and M. V. Wuthrich. Claims frequency modeling using telematics car driving data. Scandinavian Actuarial Journal, pages 62 – 143, 2019. M. Guillen, J. P. Nielsen, M. Ayuso, and A. M. Pérez-Marín. The use of telematics devices to improve automobile insurance rates. Risk Analysis, 39:72 – 662, 2019. Z. Jones and F. Linder. Exploratory data analysis using random forests. 73rd annual MPSA conference, 2015. J. Maindonald and W. J. Braun. Data Analysis and Graphics Using R: An example-based approach. Cambridge series in Statistical and Probabilistic Mathematics. Cambridge University press 2003, Mathematical Sciences Institute, Australian National University, third edition edition, 2010. URL www.cambridge.org/9780521762939. R. Polikar. Ensemble based systems in decision making. Circuits and Systems Magazine, IEEE, 6 (3):21–45, 10 2006. doi: 10.1109/MCAS.2006.1688199. V. Roel, K. Antonio, and G. Claeskens. Unraveling the predictive power of telematics data in car insurance pricing. Journal of the Royal Statistical Society SSRN, 28:72 – 112, 2017. R. E. Schapire. The strength of weak learnability. Machine Learning, 5:197–227, 1990. R. E. Schapire. A brief introduction to boositng. In Proceedings of the 16th International Joint Conference on Artificial Intelligence (IJCAI'99), 2:1401–1406, 1999. R. E. Schapire and Y. Freund. Boosting: Foundations and algorithms. Kybernetes, 42(1):164–166, 2013. 17 M. V. Wuthrich. Covariate selection from telematics car driving data. European Actuarial Journal, 7:89 – 108, 2017. C. Zhang and Y. Ma. Ensemble Machine Learning: Methods and Applications. Springer Science + Business Media, LLC, 233 Spring Street, New York, NY 10013, USA, 2012. 18 Figure 2: Boxplots of natural logarithm of claim paid against qualitative predictors. 19 TYPE_VEHICLEUSAGEMAKESEXINSR_TYPEINSURANCE_CVRGEAutomobileBusOthersPick−upSt.WagonesTruckPrivateOthersFPPG.CartageO.GoodsO.serviceOthersBishoftuIsuzuIvecoNissanToyotaLegal entityMaleFemalePrivateCommercialcomprehensiveliability234523452345Claim Figure 3: Scatterplots matrix: a bivariate profiling of relationships between claim and quantitative predictors. 20 INSURED_VALUEPREMIUMPROD_YEAR34512319801990200020102020123456valueclaimusageFPPG.CartageO.GoodsO.serviceOthersPrivate
http://arxiv.org/abs/2302.10607v2
2023-06-02T11:16:33
2023-02-21T11:32:59
Differentiable Multi-Target Causal Bayesian Experimental Design
We introduce a gradient-based approach for the problem of Bayesian optimal experimental design to learn causal models in a batch setting -- a critical component for causal discovery from finite data where interventions can be costly or risky. Existing methods rely on greedy approximations to construct a batch of experiments while using black-box methods to optimize over a single target-state pair to intervene with. In this work, we completely dispose of the black-box optimization techniques and greedy heuristics and instead propose a conceptually simple end-to-end gradient-based optimization procedure to acquire a set of optimal intervention target-state pairs. Such a procedure enables parameterization of the design space to efficiently optimize over a batch of multi-target-state interventions, a setting which has hitherto not been explored due to its complexity. We demonstrate that our proposed method outperforms baselines and existing acquisition strategies in both single-target and multi-target settings across a number of synthetic datasets.
[ "Yashas Annadani", "Panagiotis Tigas", "Desi R. Ivanova", "Andrew Jesson", "Yarin Gal", "Adam Foster", "Stefan Bauer" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10607v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10607v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI", "stat.ME" ]
Differentiable Multi-Target Causal Bayesian Experimental Design Yashas Annadani * 1 2 Panagiotis Tigas * 3 Desi R. Ivanova 4 Andrew Jesson 3 Yarin Gal 3 Adam Foster † 5 Stefan Bauer † 2 6 7 3 2 0 2 n u J 2 ] G L . s c [ 2 v 7 0 6 0 1 . 2 0 3 2 : v i X r a Abstract We introduce a gradient-based approach for the problem of Bayesian optimal experimental de- sign to learn causal models in a batch setting - a critical component for causal discovery from finite data where interventions can be costly or risky. Existing methods rely on greedy approxi- mations to construct a batch of experiments while using black-box methods to optimize over a sin- gle target-state pair to intervene with. In this work, we completely dispose of the black-box op- timization techniques and greedy heuristics and instead propose a conceptually simple end-to-end gradient-based optimization procedure to acquire a set of optimal intervention target-state pairs. Such a procedure enables parameterization of the design space to efficiently optimize over a batch of multi-target-state interventions, a setting which has hitherto not been explored due to its complex- ity. We demonstrate that our proposed method outperforms baselines and existing acquisition strategies in both single-target and multi-target settings across a number of synthetic datasets. 1. Introduction Imagine a scientist entering a wet lab to conduct experi- ments in order to discover the underlying causal relations within the system of interest. The scientist first comes up with some hypotheses, based on prior knowledge and past observations. Then, based on the formed hypotheses, an experimentation protocol to disambiguate between the com- peting hypotheses is devised. Additionally, because of the *Equal contribution ,†Equal supervision 1KTH Stockholm, Swe- den 2Helmholtz AI 3OATML, University of Oxford 4Department of Statistics, University of Oxford 5Microsoft Research 6TU Munich 7CIFAR Azrieli Global Scholar. Correspondence to: Yashas Annadani <[email protected]>, Pana- giotis Tigas <[email protected]>. Code available at: https://github.com/yannadani/DiffCBED. Proceedings of the 40 th International Conference on Machine Learning, Honolulu, Hawaii, USA. PMLR 202, 2023. Copyright 2023 by the author(s). 1 Figure 1: Causal Bayesian Experimental Design optimizes experi- ments that help disambiguate between competing causal hypothe- ses. financial and ethical costs and risks involved in such exper- imentation, it is in the scientist's interest to minimize the number of batches required. This process is known as exper- imental design, and assuming that the question of interest concerns discovering the causal structure of the system of interest, the process is known as experimental design for causal discovery. A Bayesian framework for this process has been proposed in prior work (Tong & Koller, 2001; Murphy, 2001; Cho et al., 2016; Agrawal et al., 2019; Sussex et al., 2021; Tigas et al., 2022; Toth et al., 2022) which typically consists of updating an approximate posterior with past ex- perimental data and using this updated posterior to compute experiments that are maximally informative, as evaluated by expected information gain-the objective of interest in Bayesian Optimal Experimental Design (BOED) (Lindley, 1956; Chaloner & Verdinelli, 1995). The problem of Bayesian Optimal Experimental Design for Causal Discovery (BOECD) is hard; computing the Bayesian posterior over Structural Causal Models (SCM)- a common framework for capturing causal relationships-is intractable. More importantly, the estimation and optimiza- tion of batch BOED objectives are computationally chal- lenging, which has resulted in heuristics like the greedy worldposterior modelupdateobservational & interventional datahypothesesexperimentsexperimental design Differentiable Multi-Target Causal Bayesian Experimental Design Table 1: Comparison of different BOED for causal discovery methods based on their design space assumptions. Murphy (2001) Tong & Koller (2001) Cho et al. (2016) Agrawal et al. (2019) Toth et al. (2022) Tigas et al. (2022) Sussex et al. (2021) Ours Target Acquisition (Single Target) ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ Design Space Assumptions State Acquisition (Single Target) Target Acquisition (Multi-target) State Acquisition (Multi-target) Batch Acquisition ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ batch strategy (Agrawal et al., 2019; Sussex et al., 2021) and soft-top-k batch strategy (Tigas et al., 2022). Addi- tionally, in causal discovery, one is interested not only in identifying the variable (target) to intervene on but also the state to set the intervention to, resulting in a design space which is a product space of discrete targets and continuous states, making experimental design even more challenging. Tigas et al. (2022) proposed to use Bayesian Optimization (BO) to optimize over the continuous state-space of the interventions and a soft-top-k heuristic to select a batch. In this work, we propose a method for estimating and op- timizing the BOED objective in a differentiable end-to- end manner, alleviating the inefficiencies introduced by the heuristics of the batch selection but also the black-box optimization over the intervening states. Specifically, we introduce estimators of mutual information based on nested estimation (Ryan, 2003; Myung et al., 2013; Huan & Mar- zouk, 2014; Foster et al., 2019) and importance sampling and extend it to the problem of causal discovery where the optimization is over both discrete nodes and continuous states. We cast the problem of batch experiment selection as a policy optimization where the policy uses either the Gumbel-Softmax or relaxed Bernoulli distribution (Jang et al., 2016; Maddison et al., 2016) for single target and multi-target settings respectively. When combined with the straight-through gradient estimator (Bengio et al., 2013) to optimize over the targets and gradient ascent over corre- sponding states, we can explore the space of optimal designs efficiently with powerful optimizers (Kingma & Ba, 2014). Our proposed method requires very few assumptions about the causal model and can explore wide range of design set- tings as compared to prior work (see Table 1), thus opening up possibilities of experimental design for causal discovery in a broader range of applications. 2. Related Work Differentiable Bayesian Optimal Experimental Design. Huan & Marzouk (2014); Foster et al. (2019; 2020); Klei- negesse & Gutmann (2020; 2021) developed a unified frame- work for estimating expected information gain and opti- mizing the designs with gradient-based methods. More recently, Ivanova et al. (2022) applied the Gumbel-Softmax relaxation within gradient-based BOED for contextual opti- mization. In Ivanova et al. (2021); Foster et al. (2021), the authors introduced a policy-based method for performing adaptive experimentation. More recently, work like Blau et al. (2022); Lim et al. (2022) used reinforcement learning to train policies for adaptive experimental design. Experimental Design for Causal Discovery. One of the earliest works of experimental design for causal discovery in a BOED setting was proposed by (Murphy, 2001) and (Tong & Koller, 2001) in the case of discrete variables for single target acquisition. Since then, a number of works have attempted to address this problem for continuous variables in both the BOED framework (Agrawal et al., 2019; von Kügelgen et al., 2019; Toth et al., 2022; Cho et al., 2016) and other frameworks (Kocaoglu et al., 2017a; Gamella & Heinze-Deml, 2020; Eberhardt et al., 2012; Lindgren et al., 2018; Mokhtarian et al., 2022; Ghassami et al., 2018; Olko et al., 2022; Scherrer et al., 2021). In contrast to the setting studied in this paper, of particular note are the approaches for experimental design for causal discovery in a non-BOED setting in the presence of cycles (Mokhtarian et al., 2022) and latent variables (Kocaoglu et al., 2017b). Closer to our BOED setting are the approaches of (Tigas et al., 2022) and (Sussex et al., 2021). Specifically, in (Tigas et al., 2022), the authors introduce a method for select- ing single target-state pair with stochastic batch acquisition while (Sussex et al., 2021) introduce a method for selecting a batch of multi-target experiments with a greedy strategy, based on a gradient-based approximation to mutual informa- tion, without selecting the intervention state. Our presented method in contrast can acquire a batch of multi-target-state pairs. Bayesian Causal Discovery. Designing experiments in- volves approximating the posterior of causal models to esti- mate mutual information. Approximating posterior distribu- tions of causal structures and SCMs is hard due to combi- natorially growing graph space (Heinze-Deml et al., 2018). 2 Differentiable Multi-Target Causal Bayesian Experimental Design There are several works which have proposed various meth- ods of approximate inference/ posterior sampling (Friedman et al., 2013; Annadani et al., 2021; Lorch et al., 2021; Cundy et al., 2021; Deleu et al., 2022; Nishikawa-Toomey et al., 2022), which could be used for our proposed design frame- work. 3. Background 3.1. Causality Notation. Let V = {1, . . . , d} be the vertex set of any Directed Acyclic Graph (DAG) g = (V, E) and XV = {X1, . . . , Xd} ⊆ X be the random variables of interest indexed by V. Structural Causal Model. To deal with questions re- lated to modelling causal relations between variables of interest, we employ the framework of Structural Causal Models (SCM) (Peters et al., 2017). In many fields of em- pirical sciences like network inference in single cell ge- nomics (Greenfield et al., 2010), inferring protein-signalling networks (Sachs et al., 2005) and medicine (Shen et al., 2020), SCMs provide a framework to model the effects of interventions (Pearl, 2009)– experiments which perturb the state of a variable to a desired state, thereby allowing to study the mechanisms which affect the downstream vari- ables (for example, CRISPR gene knockouts (Meinshausen et al., 2016) in genomics). Under this framework, each variable Xi has an associated structural equation, and is assigned a value which is a deterministic function of its direct causes Xpa(i) as well as an exogenous noise variable εi with a distribution Pεi: Xi := fi(Xpa(i), εi) ∀i ∈ V fi's are mechanisms that relate how the direct causes affect the variable Xi. If the structural assignments are assumed to be acyclic, these equations induce a DAG g = (V, E) whose vertices correspond to the variables and edges in- dicate direct causes. An intervention on any variable Xi corresponds to changing the structural equation of that vari- able to the desired state (value), Xi := si, where si ∈ Xi. It is denoted by the do-operator (Pearl, 2009) as do(Xi = si). In this work, we assume that the SCM is causally sufficient, i.e. all the variables are measurable, and the noise variables are mutually independent. Though the mechanisms f can be nonparametric in the general case, we assume that there exists a parametric approximation to these mechanisms with parameters γ ∈ Γ. In the case of linear SCMs, γ corre- sponds to the weights of the edges in E. We further require that the functions f are differentiable with respect to their parameters. Many classes of SCMs fall under this category, including the most commonly studied one – the Gaussian additive noise models (ANM)1: Xi := fi(Xpa(i); γi) + εi, εi ∼ N (0, σ2 i ) 1, . . . , σ2 d Bayesian Causal Discovery. If the SCM for a given set of variables XV is unknown, it has to be estimated from a combination of observational data (data obtained in an unperturbed state of a system) and experimental data under an intervention. This problem is called causal induction or causal discovery (Spirtes et al., 2000). This amounts to learning the parameters of the unknown SCM given by DAG g, parameters of mechanisms, γ = (cid:2)γ1, . . . , γd (cid:3), and variances, σ2 = (cid:2)σ2 (cid:3). For notational brevity, hence- forth we denote φ = (γ, σ2) and all the parameters of inter- est with θ = (g, φ). In Bayesian causal discovery (Heck- erman et al., 1997), the parameters of SCM are treated as random variables whose beliefs are updated according to the Bayes rule. A Bayesian method for causal discovery is preferable to model epistemic uncertainty about the model due to finite data as well as characterize equivalence classes of SCM like Markov Equivalence Class (MEC) in the case of non-identifiability (Peters et al., 2012). Interventions im- prove identifiability, but they have to be planned carefully. After acquiring interventional data, Bayesian methods up- date the posterior distribution to reduce the uncertainty of the SCM. 3.2. Bayesian Optimal Experimental Design Bayesian Optimal Experimental Design (BOED) (Lindley, 1956; Chaloner & Verdinelli, 1995) is an information the- oretic approach to the problem of selecting the optimal experiment to estimate any parameter θ. For BOED, the utility of the experiment ξ is the mutual information (MI) between the observation y and θ: UBOED(ξ) ≜ I(Y; Θ | ξ) = E p(θ)p(y|θ,ξ) [log p(y | θ, ξ) − log p(y | ξ)] This objective is also known as the Expected Information Gain (EIG). The goal of BOED is to select the experiment that maximizes this objective ξ∗ = arg maxξ UBOED(ξ). Unfortunately, evaluating and optimizing this objective is challenging because of the nested expectations (Rain- forth et al., 2018) and several estimators have been intro- duced (Foster et al., 2019; Kleinegesse & Gutmann, 2019), which can be combined with various optimization methods to select the designs (Foster et al., 2020; Ivanova et al., 2021; Foster et al., 2021; Blau et al., 2022). A common setting, called static, fixed or batch design, is to optimize B designs {ξ1, . . . , ξB} at the same time. The 1Note that differentiability of f is the only assumption we require with respect to an SCM. We do not require that the noise is additive. For clarity of exposition, we restrict our focus to an ANM as they are the most commonly studied class of SCMs. 3 Differentiable Multi-Target Causal Bayesian Experimental Design designs are then executed, and the experimental outcomes are collected for a Bayesian update of the model parameters. 3.3. Causal Bayesian Experimental Design Causal Bayesian Experimental Design is concerned with designing the most informative experiments to identify the true SCM so that the number of experiments required is as few as possible. An experiment in causal discovery corre- sponds to picking the intervention targets I ∈ P(V) and the corresponding states SI ∈ ∪ Xi to set those targets to. i∈I A key component of such methods is computing a posterior over the parameters of the SCM. However, computing the posterior is a difficult task since the number of DAGs grows exponentially in the number of variables. Nevertheless, a plethora of methods exist (Friedman et al., 2013; Annadani et al., 2021; Lorch et al., 2021; Cundy et al., 2021) which can be used with our approach. Having access to such posterior models, one can estimate the EIG objective. One difficulty that still remains though is that optimizing the EIG objective over the experiments is a mixed discrete and continuous optimization problem, for which previous work has proposed to find the optimal value per candidate target via the use of black-box methods like Bayesian Optimization (BO) (Tigas et al., 2022). Ad- ditionally, for the construction of the batch of experimental designs, a greedy approximation is used to incrementally select experiments, a method that is 1 − 1 ε -approximate to the optimal solution (Krause & Golovin, 2014). 4. Differentiable Causal Bayesian Experimental Design Let Θ be a random variable that models the uncertainty in the parameters of the true SCM, of which θ := (g, φ) is a realization. An experiment to identify an intervention is denoted by ξ := {(I, SI )} := do(XI = SI ), where I ∈ P(V) is a set of target indices in the multi-target setting, and SI are the corresponding states of those targets under intervention. The outcome of the experiment is denoted by y ∼ P (cid:0)X1 = x1, . . . , Xd = xd | do (cid:0)XI = SI (cid:1)(cid:1) = p(y | ξ). Here, y is an instance of the random variable Y ⊆ X distributed according to the interventional distribution2. Due to causal sufficiency, the likelihood of data for a given θ satisfies the causal Markov condition: p(y | θ, ξ) = (cid:89) (cid:16) xj|φj, xpag(j), do (cid:0)XI = SI (cid:1)(cid:17) p j∈V\I (1) Along with a prior p(θ), the above equation defines a gen- erative model of the data. Design setting. As in prior work (Tigas et al., 2022; Sus- sex et al., 2021), we are interested in the setting of batch design where we design B experiments at once before col- lecting experimental data. In other words, we seek a multiset of intervention targets and corresponding states which are jointly maximally informative about the parameters. We de- note this multiset as ξ1:B := (I1:B, SI 1:B). After executing a batch of experiments and collecting experimental outcomes, an experimenter might wish to design a new batch of ex- periments based on collected data (as summarized by the posterior distribution). Let ht denote experimental history (ξ1, y1), . . . , (ξt, yt) after t batches of acquisition. The BOED objective for this batch setting at any point t is given by the joint mutual information: I(Yt 1:B;Θ | ξt 1:B, ht−1) (cid:20) = E p(θ|ht−1) 1:B |θ,ξt p(yt 1:B ) log p(yt 1:B | θ, ξt 1:B) 1:B, ht−1) p(yt 1:B | ξt (cid:21) (2) where Yt 1:B are the random variables corresponding to ex- perimental outcomes for iteration t, yt 1:B are the instances of these random variables and ξt 1:B is the corresponding multiset of experimental designs. We drop the superscript t from these variables for simplicity of exposition. Ideally, we wish to maximize the above objective by obtaining the gradients ∇ξ1:B I and performing gradient ascent. However, the above objective is doubly intractable (Rainforth et al., 2018) and approximations are required. This usually leads to a two-stage procedure where the above objective is first estimated with respect to an inference network and then maximized with respect to designs (Foster et al., 2019), which can be typically inefficient (Foster et al., 2020). 4.1. Estimators of the Joint Mutual Information NESTED MONTE CARLO Following (Huan & Marzouk, 2014; Foster et al., 2020; 2021), we consider an estimator that allows for approximat- ing the EIG objective while simultaneously optimizing for the experiment ξ that maximizes the objective via gradient- based methods. This estimator, called Nested Monte Carlo (NMC), is based on contrastive estimation of the experimen- tal likelihood and has been extensively used in Bayesian ex- perimental design (Ryan, 2003; Myung et al., 2013). More precisely, assuming some past observational and interven- tional data ht−1 = {(ξ1, y1), . . . , (ξt−1, yt−1)}, for every parameter sample from the posterior distribution θ0 ∼ p(θ | ht−1), a set of contrastive samples θ1:L ∼ p(θ | ht−1) are considered to obtain a unified objective: U t NMC(ξ1:B) = E p(θ0:L|ht−1) p(y1:B |θ0,ξ1:B )) (cid:34) log p(y1:B | ξ1:B, θ0) l=1 p(y1:B | ξ1:B, θl)) (cid:80)L 1 L (cid:35) (3) 2Note that when I = ∅, it corresponds to an observational/ non-experimental setting. In this case, Y = XV. This estimator converges to the true mutual information as L → ∞ (Rainforth et al., 2018). If the design space is 4 Differentiable Multi-Target Causal Bayesian Experimental Design continuous, the optimal batch of experiment ξ∗ found by directly maximizing the NMC objective (ξ∗ arg maxξ1:B U t (Huan & Marzouk, 2014). 1:B can be 1:B ← NMC(ξ1:B)) with gradient-based techniques The above objective requires estimating the posterior dis- tribution p(θ | ht−1) after every acquisition. For causal models, while it is generally hard to estimate this posterior due to DAG space of causal structures being discrete and super-exponential in the number of variables (Tong & Koller, 2001), many approaches exist in the literature (Agrawal et al., 2019; Lorch et al., 2021; Cundy et al., 2021). These approximate posteriors can be nevertheless used for estimat- ing the NMC objective. IMPORTANCE WEIGHTED NESTED MONTE CARLO To establish an alternative path to estimating the mutual information, we begin by utilizing an observation from Fos- ter et al. (2019) that it is possible to draw the contrastive samples from a distribution other than p(θ | ht−1) and ob- tain an asymptotically exact estimator, up to a constant C that does not depend on ξt 1:B. Drawing samples from the original prior p(θ) gives the estimator I(Yt 1:B; Θ | ξt 1:B, ht−1) − C = lim L→∞ (cid:34) E p(θ0|ht−1)p(θ1:L) p(y1:B |θ0,ξ1:B ) log 1 L p(y1:B|ξ1:B, θ0) (cid:80)L l=1 p(y1:B|ξ1:B, θl)p(ht−1|θl) (cid:35) The remaining wrinkle is that we must sample θ0 from p(θ0|ht−1). We propose the conceptually simplest approach of applying self-normalized importance sampling (SNIS) to the outer expectation. The resulting objective, based on efficiently re-using samples in a leave-one-out manner, can optimize designs by just sampling parameters from the prior, without having to estimate the posterior: IWNMC(ξ1:B) = U t  E   L (cid:88) m=1 ωm log 1 L−1 (cid:80) l̸=m p(ym,1:B|θm, ξ1:B) p(ym,1:B|θl, ξ1:B)p(ht−1|θl)  (4)  where θ1:L ∼ p(θ1:L) are sampled from the original prior, ym,1:B ∼ p(y1:B|θm, ξ1:B) are all the experimental out- comes in the batch for parameter θm and ωm ∝ p(ht−1|θm) are self-normalized weights. A full derivation is given in Section A. As IWNMC does not require any posterior estimation but in- stead relies entirely on the prior, it completely sidesteps the causal discovery process for designing experiments. This is a paradigm change from the NMC estimator which requires causal discovery through the estimation of the posterior. 5 However, we note that using IWNMC with just the prior (Eq. 4) as opposed to NMC (Eq. 3) comes with trade-offs. IWNMC typically requires a large L to get a good estimate of the EIG. In high dimensions, this can be computationally infeasible. Having a small L on the other hand might result in a failure case if the effective sample size of importance samples becomes 1. We can alleviate this issue if there is some prior information available which could be leveraged to design better proposal distributions. This might consist of knowledge of certain causal mechanisms of the system under study or access to some initial observational data. In such a case, a proposal distribution which encodes this in- formation (for example with support on graphs which are in the Markov Equivalence Class (MEC) of the observational distribution) can be used instead of the prior. If no prior information is available or a good approximate inference technique is at our disposal, NMC is preferable in high di- mensions. Surprisingly, we get good results on variables of size up to 5 with IWNMC from just the prior and up to 40 variables from a proposal distribution which has support on the MEC of observational distribution (see Sec 5.5). 4.2. Optimizing over Targets and States (DiffCBED) While the NMC estimator provides a unified objective to directly optimize over the designs ξ1:B, it requires that the design space is continuous so that the gradients ∂UNMC and ∂I1:B ∂UNMC can be computed. However, in the case of designing ∂SI experiments for causal models, the challenge still remains that optimizing over intervention targets I with gradient- based techniques is not possible because it is a discrete choice. 1:B In order to address this problem, we introduce a design policy πφ with learnable parameters φ that parameterize a joint distribution over possible intervention targets and corresponding states. Instead of seeking the gradients ∂UNMC ∂I1:B and ∂UNMC , the goal now instead is to estimate UNMC ∂φ so that ∂SI policy can be updated to be close to optimal. Such a charac- terization of the design space allows us to use continuous relaxations of discrete distributions (Maddison et al., 2016; Jang et al., 2016) to obtain samples of designs and estimate NMC gradients. 1:B Let I and S be the random variables which model all possi- ble intervention target combinations and states for a batch design respectively. While there are many possibilities of instantiating the policy in practice, we consider the simplest case where πφ(I, S) ≜ πφn (I)πφm (S). As the state space is continuous3, πφm can be either deterministic (a delta Dirac with φm ∈ RB×d) or Gaussian with φm ∈ R2×B×d param- eterizing its mean and log variance. In this work, we found 3If the state space is discrete, optimizing πφm would be similar to πφn which involves reparameterized gradients. Differentiable Multi-Target Causal Bayesian Experimental Design it sufficient to use a deterministic policy over the state space. For the interventional targets, φn ∈ RB×d parameterizes the logits of different relaxed versions of discrete distribu- tions depending on the setting, which we describe below. 2016) over intervention targets, which is a continuous re- laxation of the categorical distribution (in one-hot form). Additionally, we use the straight-through (ST) gradient esti- mator (Bengio et al., 2013). Algorithm 1: Differentiable CBED (DiffCBED) Input :E SCM Environment, N Initial observational samples, B Batch Size 1 Dobs ← E.sample(N ), Dint ← ∅ 2 Train q(Θ | Dobs) ≈ p(Θ | Dint) using appropriate algorithm. 3 for batch t = 1 . . . T Batches do 4 Initialize design policy parameters φ = {φn, φm}: trainable logits φn for the targets; trainable parameters φm for the states. for update step c = 1 . . . C do ▷ Sample Interventional Targets and States 1:B}O {ξ(o) ▷ Gradient ascent with o=1 ∼ πφ(I, S) straight-through gradient estimator Update φ → φ + α ∂ ∂φ (cid:104) 1 O (cid:80)O o=1 NMC(ξ(o) U t 1:B) (cid:105) ▷ Intervene with learned policy ξ1:B ∼ πφ Dint ← Dint ∪ E.intervene(ξ1:B) Update the posterior q(Θ | Dobs ∪ Dint). 5 6 7 8 9 10 SINGLE TARGET (q = 1) In this setting, the intervention targets are one-hot vectors, as demonstrated in Figure 2. To sample one-hot vectors in a differentiable manner, we parametrize πφn as a Gumbel- Softmax distribution (Maddison et al., 2016; Jang et al., Figure 2: A design sample is obtained by first sampling I1:B ∼ πφn (I), S1:B ∼ πφm (S) and then setting states to be SI 1:B = S1:B ⊙ I1:B. To obtain hard samples of I, we use the straight- through estimator (Bengio et al., 2013). Illustration for B = 1. 6 UNCONSTRAINED MULTI-TARGET (q ≤ d) If instead of a continuous relaxation of the categorical distri- bution, we parametrise the policy πφn as a continuous relax- ation of the Bernoulli distribution (Binary Concrete) (Mad- dison et al., 2016), we can now sample multi-target ex- periments. Since each interventional target sample will have at most d non-zero entries, this policy is suitable for multi-target experiments with an unconstrained number of interventions per experiment. CONSTRAINED MULTI-TARGET (q = k) Finally, when considering a setting where the number of targets per intervention is exactly k. However, this is a sig- nificantly more challenging case, since the policy needs to select a subset of k from d nodes. By using a continuous re- laxation of subset sampling, as introduced in Xie & Ermon (2019), combined with straight-through gradient estimator, we can efficiently optimize the policy to select a subset of nodes to intervene on. Note that with k = 1, this would be equal to the single-target setting. The DiffCBED algorithm is outlined in Algorithm 1. 5. Experiments We evaluate the performance of our method on synthetic and semi-synthetic datasets and a range of baselines. We aim to investigate the following aspects empirically: (1) To what extent can we design good experiments without per- forming intermediate causal discovery/ posterior estimation with IWNMC estimator from the prior? (2) Ability to design good experiments with a proposal distribution with IWNMC (3) the performance of our policy-based design in combina- tion with the differentiable NMC estimator in single-target and multi-target settings, as compared to suitable baselines. 5.1. Bivariate Setting First, we demonstrate the method in a two variable setting to qualitatively assess the objective and the optimization method. Since computing the posterior over graphs and parameters is intractable in the general case, as a first step to study how well we can optimize the EIG objective, we as- sume a simple two-variable SCM. To compute the posterior we enumerate all DAGs with two nodes and parameterize the conditional distributions as neural network parameterized Gaussian distribution (N (Xi; μNN(Xpa(i)), σNN(Xpa(i)))). We compute the posterior over the parameters of the condi- tional distributions via Monte-Carlo dropout (Gal & Ghahra- 0010000.1-1.22.3-0.90.30.92.3xinterventional target one-hot sampleinterventional states sample Differentiable Multi-Target Causal Bayesian Experimental Design Figure 3: Two variables and two experiments scenario. We assume a ground-truth graph GT of two nodes X1 → X2. (A) The conditional distribution p(X2 | X1) is shown in (A). The corresponding SCM (Fig. A) is x1 = Σx1 and x2 = f (x1) + Σx2 . The four panels represent the EIG of all possible experiments of batch size two, when intervening on nodes (0, 0), (0, 1), (1, 0), (1, 1). (B, C) Each panel shows how the EIG change on different interventional states. E.g. right top panel shows how EIG changes when applying interventions with states in ranges [−20, 20]. Fig. B Shows the designs before optimizing the objective and Fig. C after. As we can observe that the algorithm successfully places the designs (samples from the policy) on the high EIG (1.95) area of the plot (• on the plot). score of each edge being present or absent in the graphs sampled from the posterior as compared to the ground truth graph. i-MMD: interventional MMD distance uses the non- parametric distance metric MMD (Gretton et al., 2012). As compared to the graph evaluation metrics, this metric evaluates the interventional distributions induced by both the graph structure and the corresponding conditional distri- butions. We provide the full definition in Appendix C. 5.3. Evaluation of the IWNMC estimator In this section, we consider optimizing the designs with respect to the IWNMC estimator entirely from the prior, introduced in 4.1, sidestepping the causal discovery pro- cedure. As noted before, estimating posteriors of causal models is hard, so it is important to understand to what extent IWNMC can be considered a suitable candidate for designing good experiments in the absence of a posterior. For this setting, we sample from the prior distribution over graphs by first sampling an ordering of nodes at random and then sampling edges with probability p = 0.25 which adhere to this topological order. We sample the mechanism parameters and noise variances of ANM at random from a Gaussian distribution with mean 0 and variance 1. Figure 4 demonstrates results for 5 variable unconstrained multi-target setting with batch size 2. For evaluation, we train DAG Bootstrap (Friedman et al., 2013) with GIES (Hauser & Bühlmann, 2012) on the data acquired from each policy. We can see that we can recover the ground truth SCM faster than a random strategy. This is a surprising, but positive result given that our policy was trained entirely from samples from the prior. We also tested this approach for 10 variables (results in Appendix E). While this resulted in better performance of the policy as opposed to random in Figure 4: We test the designs acquired with IWNMC estimator with just the prior as opposed to the random policy (with random target and state acquisition) on variables of 5 dimensions. Plots cor- respond to unconstrained multi-target setting with B = 2 (shaded area represents 95% confidence intervals - 60 seeds). mani, 2016). We parameterize the intervention targets policy with Gumbel-Softmax and interventional states policy with a Gaussian distribution. The final policy consists of the logits of the Gumbel-Softmax and the sufficient statistics of the Gaussian distribution. We use Adam optimizer (Kingma & Ba, 2014) to optimize the parameters of the policy. As we can see in Fig.3(B-C), the optimizer successfully con- centrates the policy on the nodes and states that maximize the EIG objective. 5.2. Results We present experimental results in various settings for the following metrics: EVALUATION METRICS Expected SHD: This metric evaluates the expected struc- tural hamming distance between the graphs sampled from the posterior model and the ground truth graph. Expected F1-score: This metric evaluates the expected f1- 7 (A)(B)(C)Expected Information GainExpected Information GainrandomdiffCBED Differentiable Multi-Target Causal Bayesian Experimental Design Figure 5: (A,B,C) Single target-state design setting results for Erd ̋os–Rényi (Erd ̋os & Rényi, 1959) graphs with d = 50 variables. (D,E,F) Multi target-state design setting results for Erd ̋os–Rényi (Erd ̋os & Rényi, 1959) graphs with d = 20 variables. Each experiment was run with 30 random seeds (shaded area represents 95% CIs) terms of downstream metrics, we observed effective sample size reach 1, indicating that for 10 dimensions or higher, we might need a better proposal distribution or a posterior estimate. 5.5. Evaluation in Higher Dimensions EVALUATION OF IWNMC WITH PROPOSAL DISTRIBUTION 5.4. Baselines Before we evaluate the IWNMC estimator with a proposal distribution more informative than the prior and the NMC estimator with a posterior estimate of SCM, we present the baselines with which we can compare the designs. SINGLE TARGET Random-Fixed: Uniform random selection of target, fixing the state to a value of 0 (as introduced in (Agrawal et al., 2019; Tigas et al., 2022)). Random-Random: Uniform selection of node, uniform selection of state (introduced in (Toth et al., 2022)). SoftCBED: A stochastic approximation of greedy batch selection as introduced in (Tigas et al., 2022). MULTI-TARGET Random-Random: Multi-target version of uniform selec- tion of node, uniform selection of value (introduced in (Toth et al., 2022)). Random-Fixed: Multitarget version of uni- form selection of node, fixed value to 5 (Sussex et al., 2021), as suggested by the authors. SSGb: Finite sample baseline from (Sussex et al., 2021) with fixed value equal 5. We em- phasize that in contrast to our method, the baselines cannot select states, but they either assume a fixed predefined state or select a state at random. In this experiment, we consider 40 variables, constrained (q = 5) multi-target and batch size B = 2. Further, we use the same setup as Sussex et al. (2021) to make a fair compar- ison as well as to construct a proposal distribution. For the proposal distribution, we use 800 observational samples to train DAG Bootstrap (Friedman et al., 2013; Agrawal et al., 2019) and augment our posterior samples with samples of DAGs from the MEC of the true graph, to make sure that there is sufficient support within the MEC of the true graph (see Sussex et al. (2021) for details). We then acquire a single batch of experiments from IWNMC estimator for our approach. For the baseline, we acquire a single batch of experiments from the estimator defined in (Sussex et al., 2021). For random and SSGb baseline, we set the interventional state (value) to 5, as explained in (Sussex et al., 2021). Our approach doesn't fix the state to 5 but optimizes over states to perform the intervention with. In Table 2 we summa- rize our results. As we can see, our method outperforms random and SSGb by a great margin, indicating that with a good proposal distribution, IWNMC can still be a promising candidate in higher dimensions. RESULTS WITH NMC ESTIMATOR For the following results, we use DAG-Bootstrap (Agrawal et al., 2019), an approximate posterior method based on GIES causal discovery method (Hauser & Bühlmann, 2012). 8 SINGLE TARGET 50 nodesMULTI TARGET 20 nodes(A)(B)(C)(D)(F)diffCBEDSSGbrandom-randomrandom-fixedsoftCBED(E) Differentiable Multi-Target Causal Bayesian Experimental Design Figure 6: Results on the E. Coli gene interaction network (d = 10) of the DREAM (Greenfield et al., 2010) simulator. The data is generated based on this graph by simulating the noise and mechanisms. We find that our method performs better than the baselines. Shaded area represents 95% CI. Table 2: Results of multi-target experiments on graphs of size 40 (30 seeds ± s.e.). Similarly to (Sussex et al., 2021), we are using posterior samples trained on observational data and re-weighting them with likelihoods. Method ESHD ↓ F1 ↑ Random SSGb diffCBED 43.78±46.67 15.59±29.66 0.44±0.21 0.91±0.08 0.97±0.05 0.99±0.00 iMMD ↓ 0.16±0.07 0.10±0.06 0.07±0.01 As GIES is not a differentiable method, once we compute the posterior, we transfer the posterior samples (the boot- straps) into JAX (jax) tensors to allow for the gradients to be computed with respect to the experiments. Single-target synthetic graphs: In this experiment, we test against synthetic graphs of 50 variables and batch size 5, where the graph is sampled from the class of Erdos-Renyi (a common benchmark in the literature (Tigas et al., 2022; Toth et al., 2022; Scherrer et al., 2021)). In Figure 10 (A,B,C) we summarize the results. We observe that our method performs significantly better than the baselines. 20 nodes, unconstrained (q ≤ 20), batch size B = 2: In this experiment, we evaluate the performance of our method as compared to the baselines, on sparse graphs over several acquisitions. Figure 10 (D,E,F) summarizes the results of this setting. We observe strong empirical performance as compared to all the baselines. Additional results are given in Section G.1. 5.6. Evaluation on Semi-Synthetic Data We evaluate our proposed design framework on semi- synthetic setting based on the DREAM gene net- works (Greenfield et al., 2010). In particular, we use the E. Coli gene interaction network, which is real-world inspired gene regulatory network of 10 variables, and simulate the mechanisms (and hence the data generation process). Then we run a random node with a fixed intervention value, a random node with a random value, SSGb finite sample and our algorithm. The results are presented in Figure 6. We find that our algorithm performs better than the baselines, indicating the potential of gradient-based approach to more realistic settings. 6. Discussion Limitations: A primary limitation of our method is that it needs to estimate a posterior after every acquisition. While the proposed IWNMC estimator presents an interesting al- ternative, the designs are still non-adaptive. An interest- ing direction is to train a policy to design adaptive experi- ments (Foster et al., 2021; Greenewald et al., 2019). Conclusion: We present a gradient-based method for dif- ferentiable Bayesian optimal experimental design for causal discovery. Our method allows not only for single-target but also various multi-target (constrained and unconstrained) batch design of experiments. While prior work in relies on greedy approximations for the selection of a batch (Agrawal et al., 2019; Tigas et al., 2022) or black-box methods (Toth et al., 2022; Tigas et al., 2022) for optimizing over inter- ventional states, our method utilizes gradient-based opti- mization procedures to simultaneously optimize for various design choices. Evaluation on different datasets suggests that our method is competitive with baselines. Acknowledgements: We would like to thank Berzelius computing from NSC Sweden for providing computa- tional resource for some of the experiments of the paper. References Jax: Autograd and XLA. https://github.com/ google/jax. 9 Agrawal, R., Squires, C., Yang, K., Shanmugam, K., and 9 Differentiable Multi-Target Causal Bayesian Experimental Design Uhler, C. Abcd-strategy: Budgeted experimental de- sign for targeted causal structure discovery. In The 22nd International Conference on Artificial Intelligence and Statistics, pp. 3400–3409. PMLR, 2019. 1, 2, 5, 8, 9 Annadani, Y., Rothfuss, J., Lacoste, A., Scherrer, N., Goyal, A., Bengio, Y., and Bauer, S. Variational causal networks: Approximate bayesian inference over causal structures. arXiv preprint arXiv:2106.07635, 2021. 3, 4 Batagelj, V. and Brandes, U. Efficient generation of large random networks. Physical Review E, 71(3):036113, 2005. 16 Bengio, Y., Léonard, N., and Courville, A. Estimating or propagating gradients through stochastic neurons for con- ditional computation. arXiv preprint arXiv:1308.3432, 2013. 2, 6 Blau, T., Bonilla, E. V., Chades, I., and Dezfouli, A. Op- timizing sequential experimental design with deep re- inforcement learning. In International Conference on Machine Learning, pp. 2107–2128. PMLR, 2022. 2, 3 Chaloner, K. and Verdinelli, I. Bayesian experimental de- sign: A review. Statistical Science, pp. 273–304, 1995. 1, 3 Cho, H., Berger, B., and Peng, J. Reconstructing causal biological networks through active learning. PloS one, 11 (3):e0150611, 2016. 1, 2 Cundy, C., Grover, A., and Ermon, S. Bcd nets: Scalable variational approaches for bayesian causal discovery. Ad- vances in Neural Information Processing Systems, 34, 2021. 3, 4, 5 Deleu, T., Góis, A., Emezue, C., Rankawat, M., Lacoste- Julien, S., Bauer, S., and Bengio, Y. Bayesian structure learning with generative flow networks. arXiv preprint arXiv:2202.13903, 2022. 3 Eberhardt, F., Glymour, C., and Scheines, R. On the number of experiments sufficient and in the worst case necessary to identify all causal relations among n variables. arXiv preprint arXiv:1207.1389, 2012. 2 Erd ̋os, P. and Rényi, A. On random graphs i. publicationes mathematicae (debrecen). 1959. 8, 15, 16 Foster, A., Jankowiak, M., Bingham, E., Horsfall, P., Teh, Y. W., Rainforth, T., and Goodman, N. Variational bayesian optimal experimental design. arXiv preprint arXiv:1903.05480, 2019. 2, 3, 4, 5, 13 Foster, A., Jankowiak, M., O'Meara, M., Teh, Y. W., and Rainforth, T. A unified stochastic gradient approach to designing bayesian-optimal experiments. In International Conference on Artificial Intelligence and Statistics, pp. 2959–2969. PMLR, 2020. 2, 3, 4 Foster, A., Ivanova, D. R., Malik, I., and Rainforth, T. Deep adaptive design: Amortizing sequential bayesian experi- mental design. arXiv preprint arXiv:2103.02438, 2021. 2, 3, 4, 9 Friedman, N., Goldszmidt, M., and Wyner, A. Data analysis with bayesian networks: A bootstrap approach. arXiv preprint arXiv:1301.6695, 2013. 3, 4, 7, 8 Gal, Y. and Ghahramani, Z. Dropout as a bayesian approx- imation: Representing model uncertainty in deep learn- ing. In international conference on machine learning, pp. 1050–1059. PMLR, 2016. 6 Gamella, J. L. and Heinze-Deml, C. Active invariant causal prediction: Experiment selection through stability. arXiv preprint arXiv:2006.05690, 2020. 2 Ghassami, A., Salehkaleybar, S., Kiyavash, N., and Barein- boim, E. Budgeted experiment design for causal structure learning. In International Conference on Machine Learn- ing, pp. 1724–1733. PMLR, 2018. 2 Greenewald, K., Katz, D., Shanmugam, K., Magliacane, S., Kocaoglu, M., Boix Adsera, E., and Bresler, G. Sample efficient active learning of causal trees. Advances in Neural Information Processing Systems, 32, 2019. 9 Greenfield, A., Madar, A., Ostrer, H., and Bonneau, R. Dream4: Combining genetic and dynamic information to identify biological networks and dynamical models. PloS one, 5(10):e13397, 2010. 3, 9 Gretton, A., Borgwardt, K. M., Rasch, M. J., Schölkopf, B., and Smola, A. A kernel two-sample test. The Journal of Machine Learning Research, 13(1):723–773, 2012. 7, 15 Hauser, A. and Bühlmann, P. Characterization and greedy learning of interventional markov equivalence classes of directed acyclic graphs. The Journal of Machine Learning Research, 13(1):2409–2464, 2012. 7, 8 Heckerman, D., Meek, C., and Cooper, G. A bayesian approach to causal discovery. Technical report, Technical report msr-tr-97-05, Microsoft Research, 1997. 3 Heinze-Deml, C., Peters, J., and Meinshausen, N. Invariant causal prediction for nonlinear models. Journal of Causal Inference, 6(2), 2018. 2 Huan, X. and Marzouk, Y. Gradient-based stochastic opti- mization methods in bayesian experimental design. In- ternational Journal for Uncertainty Quantification, 4(6), 2014. 2, 4, 5 10 Differentiable Multi-Target Causal Bayesian Experimental Design Ivanova, D. R., Foster, A., Kleinegesse, S., Gutmann, M. U., and Rainforth, T. Implicit deep adaptive design: policy- based experimental design without likelihoods. Advances in Neural Information Processing Systems, 34:25785– 25798, 2021. 2, 3 Ivanova, D. R., Jennings, J., Zhang, C., and Foster, A. Ef- ficient real-world testing of causal decision making via bayesian experimental design for contextual optimisation. ICML 2022 Workshop on Adaptive Experimental Design and Active Learning in the Real World, 2022. 2 Jang, E., Gu, S., and Poole, B. Categorical repa- rameterization with gumbel-softmax. arXiv preprint arXiv:1611.01144, 2016. 2, 5, 6 Kingma, D. P. and Ba, J. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. 2, 7 Kleinegesse, S. and Gutmann, M. Bayesian experimental design for implicit models by mutual information neural estimation. In Proceedings of the 37th International Con- ference on Machine Learning, Proceedings of Machine Learning Research, pp. 5316–5326. PMLR, 2020. 2 Kleinegesse, S. and Gutmann, M. U. Efficient bayesian experimental design for implicit models. In The 22nd International Conference on Artificial Intelligence and Statistics, pp. 476–485. PMLR, 2019. 3 Kleinegesse, S. and Gutmann, M. U. Gradient-based bayesian experimental design for implicit models us- ing mutual information lower bounds. arXiv preprint arXiv:2105.04379, 2021. 2 Kocaoglu, M., Dimakis, A., and Vishwanath, S. Cost- optimal learning of causal graphs. In International Con- ference on Machine Learning, pp. 1875–1884. PMLR, 2017a. 2 Kocaoglu, M., Shanmugam, K., and Bareinboim, E. Ex- perimental design for learning causal graphs with latent variables. Advances in Neural Information Processing Systems, 30, 2017b. 2 Krause, A. and Golovin, D. Submodular function maximiza- tion. Tractability, 3:71–104, 2014. 4 Lindley, D. V. On a measure of the information provided by an experiment. The Annals of Mathematical Statistics, pp. 986–1005, 1956. 1, 3 Lorch, L., Rothfuss, J., Schölkopf, B., and Krause, A. Dibs: Differentiable bayesian structure learning. arXiv preprint arXiv:2105.11839, 2021. 3, 4, 5 Maddison, C. J., Mnih, A., and Teh, Y. W. The concrete distribution: A continuous relaxation of discrete random variables. arXiv preprint arXiv:1611.00712, 2016. 2, 5, 6 Meinshausen, N., Hauser, A., Mooij, J. M., Peters, J., Ver- steeg, P., and Bühlmann, P. Methods for causal inference from gene perturbation experiments and validation. Pro- ceedings of the National Academy of Sciences, 113(27): 7361–7368, 2016. 3 Mokhtarian, E., Salehkaleybar, S., Ghassami, A., and Kiyavash, N. A unified experiment design approach for cyclic and acyclic causal models. arXiv preprint arXiv:2205.10083, 2022. 2 Murphy, K. P. Active learning of causal bayes net structure. 2001. 1, 2 Myung, J. I., Cavagnaro, D. R., and Pitt, M. A. A tutorial on adaptive design optimization. Journal of mathematical psychology, 57(3-4):53–67, 2013. 2, 4 Nishikawa-Toomey, M., Deleu, T., Subramanian, J., Bengio, Y., and Charlin, L. Bayesian learning of causal structure and mechanisms with gflownets and variational bayes. arXiv preprint arXiv:2211.02763, 2022. 3 Olko, M., Zaj ̨ac, M., Nowak, A., Scherrer, N., Annadani, Y., Bauer, S., Kuci ́nski, Ł., and Miło ́s, P. Trust your ∇: Gradient-based intervention targeting for causal discov- ery. arXiv preprint arXiv:2211.13715, 2022. 2 Pearl, J. Causality. Cambridge university press, 2009. 3 Peters, J., Mooij, J., Janzing, D., and Schölkopf, B. Identifi- ability of causal graphs using functional models. arXiv preprint arXiv:1202.3757, 2012. 3 Peters, J., Janzing, D., and Schölkopf, B. Elements of causal inference: foundations and learning algorithms. The MIT Press, 2017. 3 Lim, V., Novoseller, E., Ichnowski, J., Huang, H., and Goldberg, K. Policy-based bayesian experimental design for non-differentiable implicit models. arXiv preprint arXiv:2203.04272, 2022. 2 Rainforth, T., Cornish, R., Yang, H., Warrington, A., and Wood, F. On nesting monte carlo estimators. In Interna- tional Conference on Machine Learning, pp. 4267–4276. PMLR, 2018. 3, 4 Lindgren, E., Kocaoglu, M., Dimakis, A. G., and Vish- wanath, S. Experimental design for cost-aware learning of causal graphs. Advances in Neural Information Pro- cessing Systems, 31, 2018. 2 Ryan, K. J. Estimating expected information gains for exper- imental designs with application to the random fatigue- limit model. Journal of Computational and Graphical Statistics, 12(3):585–603, 2003. 2, 4 11 Differentiable Multi-Target Causal Bayesian Experimental Design Sachs, K., Perez, O., Pe'er, D., Lauffenburger, D. A., and Nolan, G. P. Causal protein-signaling networks derived from multiparameter single-cell data. Science, 308(5721): 523–529, 2005. 3 Scherrer, N., Bilaniuk, O., Annadani, Y., Goyal, A., Schwab, P., Schölkopf, B., Mozer, M. C., Bengio, Y., Bauer, S., and Ke, N. R. Learning neural causal models with active interventions. arXiv preprint arXiv:2109.02429, 2021. 2, 9 Shen, X., Ma, S., Vemuri, P., and Simon, G. Challenges and opportunities with causal discovery algorithms: applica- tion to alzheimer's pathophysiology. Scientific reports, 10(1):2975, 2020. 3 Spirtes, P., Glymour, C. N., Scheines, R., and Heckerman, D. Causation, prediction, and search. MIT press, 2000. 3 Sussex, S., Uhler, C., and Krause, A. Near-optimal multi- perturbation experimental design for causal structure learning. Advances in Neural Information Processing Systems, 34:777–788, 2021. 1, 2, 4, 8, 9 Tigas, P., Annadani, Y., Jesson, A., Schölkopf, B., Gal, Y., and Bauer, S. Interventions, where and how? experimen- tal design for causal models at scale. Advances in Neural Information Processing Systems, 35, 2022. 1, 2, 4, 8, 9 Tong, S. and Koller, D. Active learning for structure in bayesian networks. In International joint conference on artificial intelligence, volume 17, pp. 863–869. Citeseer, 2001. 1, 2, 5 Toth, C., Lorch, L., Knoll, C., Krause, A., Pernkopf, F., Peharz, R., and von Kügelgen, J. Active bayesian causal inference. arXiv preprint arXiv:2206.02063, 2022. 1, 2, 8, 9 von Kügelgen, J., Rubenstein, P. K., Schölkopf, B., and Weller, A. Optimal experimental design via bayesian optimization: active causal structure learning for gaus- sian process networks. arXiv preprint arXiv:1910.03962, 2019. 2 Xie, S. M. and Ermon, S. Reparameterizable subset sampling via continuous relaxations. arXiv preprint arXiv:1901.10517, 2019. 6 12 Differentiable Multi-Target Causal Bayesian Experimental Design A. Derivation of Importance Weighted Nested Monte Carlo Estimator In this section, we derive the UIWNMC (Eq. 4) estimator. We derive the estimator for a single design with an experiment denoted by ξ, parameters θ and experimental outcome random variable Y and its instance y. Since it is a static design, all the steps of the derivation hold if we replace ξ with ξ1:B, Y with Y1:B and y with y1:B. We begin from the variational NMC (VNMC) estimator, introduced by Foster et al. (2019) I(Y; Θ | ξ) ≤ UVNMC(ξ) =  log p(y | ξ, θ0) 1 L (cid:80)L l=1 p(y|ξ,θl)p(θl|ht−1) q(θ1:L|ht−1,y)   . E p(θ0|ht−1) p(y|θ0,ξ) q(θ1:L|ht−1,y) This can be rewritten as UVNMC(ξ) = E p(θ0|ht−1) p(y|θ0,ξ) q(θ1:L|ht−1,y)  log 1 L (cid:80)L l=1 p(y | ξ, θ0) p(y|ξ,θl)p(θl)p(ht−1|θl) q(θ1:L|ht−1,y)  + log p(ht−1)  (5) (6) and Foster et al. (2019) observed that log p(ht−1) is a constant that does not depend on ξ and so can be safely neglected when optimizing over designs. If we take the original prior p(θl) as our proposal distribution q, then we arrive at UVNMC-prior(ξ) = E p(θ0|ht−1)p(θ1:L) p(y|θ0,ξ) (cid:34) log p(y | ξ, θ0) 1 L (cid:80)L l=1 p(y | ξ, θl)p(ht−1 | θl) (cid:35) + C (7) where C = log p(ht−1). This allows us to sample contrastive samples from any distribution, but does not account for θ0. If we were to sample θ0 from p(θ0), we can correct using an importance weight UVNMC-prior(ξ) = (cid:34) p(θ0 | ht−1) p(θ0) log E p(θ0:L) p(y|θ0,ξ) p(y | ξ, θ0) 1 L (cid:80)L l=1 p(y | ξ, θl)p(ht−1 | θl) (cid:35) + C, (8) but unfortunately, this relies on knowing the density of the posterior or using the fact that p(θ0 | ht−1)/p(θ0) = p(ht−1 | θ0)/p(ht−1), knowing the marginal likelihood of the data ht−1. Neither of these is usually tractable. Instead, we can use a self-normalized importance sampling approach, which amounts to estimating p(ht−1) by a sum over θ0:L, giving the approximation IWNMC: UIWNMC(ξ) = (cid:34) E p(θ0:L) p(y|θ0,ξ) p(ht−1 | θ0) (cid:80)L k=0 p(ht−1 | θk) log 1 L 1 L+1 p(y | ξ, θ0) (cid:80)L l=1 p(y | ξ, θl)p(ht−1 | θl) The form that is given in (4) is obtained by first relabelling the θ samples to start from 1 UIWNMC(ξ) = (cid:34) E p(θ1:L) p(y|θ1,ξ) p(ht−1 | θ1) k=1 p(ht−1 | θk) (cid:80)L 1 L log 1 L−1 p(y | ξ, θ1) (cid:80)L l=2 p(y | ξ, θl)p(ht−1 | θl) noting that the role of θ1 is arbitrary and can be replaced by any m ∈ {1, . . . , L} (cid:35) (cid:35) + C. (9) + C, (10) UIWNMC(ξ) = (cid:34) E p(θ1:L) p(y|θm,ξ) p(ht−1 | θm) k=1 p(ht−1 | θk) (cid:80)L 1 L log 1 L−1 p(y | ξ, θm) (cid:80)L l̸=m p(y | ξ, θl)p(ht−1 | θl) (cid:35) + C, and finally taking the mean over m, noting that this does not change the expected value due to linearity UIWNMC(ξ) = (cid:34) L (cid:88) m=1 E p(θ1:L) p(y|θm,ξ) p(ht−1 | θm) k=1 p(ht−1 | θk) (cid:80)L log 1 L−1 p(y | ξ, θm) (cid:80)L l̸=m p(y | ξ, θl)p(ht−1 | θl) (cid:35) + C. We finally drop the constant C as it is independent of ξ and take ωm = p(ht−1 | θm) k=1 p(ht−1 | θk) (cid:80)L . 13 (11) (12) (13) Differentiable Multi-Target Causal Bayesian Experimental Design B. Expected Information Gain for 6 Variables and Batch Size 2 Figure 7: Here we visualize the Expected Information Gain of batch size two, on two nodes over different interventional states of the range [−10, 10]. C. Metrics . E-SHD: Defined as the expected structural hamming distance between samples from the posterior model over graphs and the true graph E-SHD := Eg∼p(G|D) (cid:2)SHD(g, ̃g)(cid:3) Expected edges F1: The expected F1 score of the binary classification task of predicting the presence/ absence of all edges. 14 Differentiable Multi-Target Causal Bayesian Experimental Design The expectation is taken over multiple posterior samples. i-MMD: Interventional MMD is defined as MMD distance (Gretton et al., 2012) between the true interventional distribution and the interventional distribution induced by θ and g (posterior sample). We take an expectation over different posterior samples, interventional targets and interventional states. For the kernel choice, we use the median heuristic as described in (Gretton et al., 2012). D. DAG Bootstrap The DAG bootstrap bootstraps observations and interventions to infer a different causal structure per bootstrap. We used GIES as the causal inference algorithm because of the adaptation of GES on interventional data as well. In our experiments, we used the pcalg R implementation https://github.com/cran/pcalg/blob/master/R/gies.R to discover 100 graphs. Each graph can be seen as a posterior sample from p(G | ht−1). For each of the sampled graphs Gi we compute the appropriate θMLE under linear Gaussian assumption for the conditional distributions. E. Importance Weighted Nested Monte Carlo Full Results Figure 8: Multi target-state design setting results for Erd ̋os–Rényi (Erd ̋os & Rényi, 1959) graphs with d = 5 variables. Each experiment was run with 60 random seeds (shaded area represents 95% CIs) Figure 9: Single target-state design setting results for Erd ̋os–Rényi (Erd ̋os & Rényi, 1959) graphs with d = 10 variables. Each experiment was run with 60 random seeds (shaded area represents 95% CIs) 15 randomdiffCBEDrandomdiffCBED Differentiable Multi-Target Causal Bayesian Experimental Design F. 20 nodes, unconstrained (q ≤ 20), batch size B = 1: Figure 10: Multi target-state design setting results for Erd ̋os–Rényi (Erd ̋os & Rényi, 1959) graphs with d = 50 variables. Each experiment was run with 30 random seeds (the shaded area represents 95% CIs). We observe that for batch size 1, the difference between the methods becomes more significant. G. Datasets and Experiment Details G.1. Synthetic Graphs Experiments In the synthetic data experiments, we focus on Erd ̋os-Rényi graph model. We used networkx4 and method fast_gnp_random_graph (Batagelj & Brandes, 2005) to generate graphs based on the Erd ̋os-Rényi model. We set the expected number of edges per vertex to 1. H. Optimizer Settings Table 3: Table indicating the hyperparameters and optimizer settings for different experimental results. L Number of outer DAGs No Batch Size Relaxation temperature Optimizer Learning rate of optimizer Number of starting samples (observational) Number of batches Number of DAG Bootstraps Number of training steps per batch Optimization settings Single Target NMC 30 30 5 5 → .5 Adam 0.1 60 10 30 100 Multi-Target NMC 30 30 2 5 → .5 Adam 0.1 60 10 30 100 Multi-Target IWNMC with prior 1000 1000 2 0.1 Adam 0.01 2 5 - 100 Multi-Target IWNMC with proposal 60 60 2 5 → .5 Adam 0.1 800 1 60 100 I. Relaxed Distribution Temperature Sensitivity Analysis We perform ablation where we empirically test the sensitivity to temperature hyperparameter for the relaxed distribution. Results are presented in Figure 11 for the unconstrained multi-target setting (d = 20). We find that our approach is fairly robust to different temperatures. Note that for the reported results, we anneal the temperature during the course of training and hence a single choice of temperature is not necessary. 4https://networkx.org/documentation/networkx-1.10/reference/generated/networkx. generators.random_graphs.fast_gnp_random_graph.html 16 (A)(B)(C)diffCBEDSSGbrandom-randomrandom-fixed Differentiable Multi-Target Causal Bayesian Experimental Design Figure 11: Performance of our proposed design strategy for different temperatures of the relaxed distribution for the unconstrained multi-target setting (d = 20). We find that our method is fairly robust. 17
http://arxiv.org/abs/2302.10586v3
2023-10-31T11:38:08
2023-02-21T10:24:53
Diffusion Models and Semi-Supervised Learners Benefit Mutually with Few Labels
In an effort to further advance semi-supervised generative and classification tasks, we propose a simple yet effective training strategy called dual pseudo training (DPT), built upon strong semi-supervised learners and diffusion models. DPT operates in three stages: training a classifier on partially labeled data to predict pseudo-labels; training a conditional generative model using these pseudo-labels to generate pseudo images; and retraining the classifier with a mix of real and pseudo images. Empirically, DPT consistently achieves SOTA performance of semi-supervised generation and classification across various settings. In particular, with one or two labels per class, DPT achieves a Fr\'echet Inception Distance (FID) score of 3.08 or 2.52 on ImageNet 256x256. Besides, DPT outperforms competitive semi-supervised baselines substantially on ImageNet classification tasks, achieving top-1 accuracies of 59.0 (+2.8), 69.5 (+3.0), and 74.4 (+2.0) with one, two, or five labels per class, respectively. Notably, our results demonstrate that diffusion can generate realistic images with only a few labels (e.g., <0.1%) and generative augmentation remains viable for semi-supervised classification. Our code is available at https://github.com/ML-GSAI/DPT.
[ "Zebin You", "Yong Zhong", "Fan Bao", "Jiacheng Sun", "Chongxuan Li", "Jun Zhu" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10586v3", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10586v3", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.CV", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.CV", "cs.AI", "cs.LG" ]
3 2 0 2 t c O 1 3 ] V C . s c [ 3 v 6 8 5 0 1 . 2 0 3 2 : v i X r a Diffusion Models and Semi-Supervised Learners Benefit Mutually with Few Labels Zebin You1,2∗, Yong Zhong1,2∗, Fan Bao3, Jiacheng Sun4, Chongxuan Li1,2†, Jun Zhu3 1 Gaoling School of Artificial Intelligence, Renmin University of China, Beijing, China 2 Beijing Key Laboratory of Big Data Management and Analysis Methods, Beijing, China 3 Dept. of Comp. Sci. & Tech., BNRist Center, THU-Bosch ML Center, Tsinghua University 4 Huawei Noah's Ark Lab [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected] Abstract In an effort to further advance semi-supervised generative and classification tasks, we propose a simple yet effective training strategy called dual pseudo training (DPT), built upon strong semi-supervised learners and diffusion models. DPT operates in three stages: training a classifier on partially labeled data to predict pseudo-labels; training a conditional generative model using these pseudo-labels to generate pseudo images; and retraining the classifier with a mix of real and pseudo images. Empirically, DPT consistently achieves SOTA performance of semi-supervised generation and classification across various settings. In particular, with one or two labels per class, DPT achieves a Fréchet Inception Distance (FID) score of 3.08 or 2.52 on ImageNet 256 × 256. Besides, DPT outperforms competitive semi-supervised baselines substantially on ImageNet classification tasks, achieving top-1 accuracies of 59.0 (+2.8), 69.5 (+3.0), and 74.4 (+2.0) with one, two, or five labels per class, respectively. Notably, our results demonstrate that diffusion can generate realistic images with only a few labels (e.g., < 0.1%) and generative augmentation remains viable for semi-supervised classification. Our code is available at https://github.com/ML-GSAI/DPT. 1 Introduction Diffusion probabilistic models [1, 2, 3, 4, 5, 6, 7] have achieved excellent performance in image generation. However, empirical evidence has shown that labeled data is indispensable for training such models [8, 4]. Indeed, lacking labeled data leads to much lower performance of the generative model. For instance, the representative work (i.e., ADM) [4] achieves an FID of 10.94 on fully labeled ImageNet 256 × 256, while an FID of 26.21 without labels. To improve the performance of diffusion models without utilizing labeled data, prior work [8, 9] initially conducts clustering and subsequently trains diffusion models conditioned on the cluster indices. Although these methods can, in some instances, exhibit superior performance over supervised models on low-resolution data, such phenomena have not yet been observed on high-resolution data (e.g., on ImageNet 256 × 256, an FID of 5.19, compared to an FID of 3.31 achieved by supervised models, see Appendix C). Besides, cluster indices may not always align with ground truth labels, making it hard to control semantics in samples. Compared to unsupervised methods, semi-supervised generative models [10, 11, 12] often perform much better and provide the same way to control the ∗Equal contribution. †Correspondence to Chongxuan Li. 37th Conference on Neural Information Processing Systems (NeurIPS 2023). Figure 1: Selected samples from DPT. Top row: 512 × 512 samples from DPT trained with five (< 0.4%) labels per class. Bottom rows: 256 × 256 samples from DPT trained with one (< 0.1%) label per class (Left: "Ostrich"; Mid: "King penguin"; Right: "Indigo bunting"). semantics of samples as the supervised ones by using a small number of labels. However, to our knowledge, although it is attractive, little work in the literature has investigated semi-supervised diffusion models. This leads us to a key question: can diffusion models generate high-fidelity images with controllable semantics given only a few (e.g., < 0.1%) labels? On the other hand, while it is natural to use images sampled from generative models for semi- supervised classification [10, 11], discriminative methods [13, 14, 15] dominant the area recently. In particular, self-supervised based learners [16, 17, 18] have demonstrated state-of-the-art performance on ImageNet. However, generative models have rarely been considered for semi-supervised classi- fication recently. Therefore another key question arises: can generative augmentation be a useful approach for such strong semi-supervised classifiers, with the aid of advanced diffusion models? To answer the above two key and pressing questions, we propose a simple but effective training strategy called dual pseudo training (DPT), built upon strong diffusion models and semi-supervised classifiers. DPT is three-staged (see Fig. 3). First, a classifier is trained on partially labeled data and used to predict pseudo-labels for all data. Second, a conditional generative model is trained on all data with pseudo-labels and used to generate pseudo images given labels. Finally, the classifier is trained on real data augmented by pseudo images with labels. Intuitively, in DPT, the two opposite conditional models (i.e. diffusion model and classifier) provide complementary learning signals to each other and benefit mutually (see a detailed discussion in Appendix E). We evaluate the effectiveness of DPT through diverse experiments on multi-scale and multi-resolution benchmarks, including CIFAR-10 [19] and ImageNet [20] at resolutions of 128 × 128, 256 × 256, and 512 × 512. Quantitatively, DPT obtains SOTA semi-supervised generation results on two common metrics, including FID [21] and IS [22], in all settings. In particular, in the highly appealing task, i.e. ImageNet 256 × 256 generation, DPT with one (i.e., < 0.1%) labels per class achieves an FID of 3.08, outperforming strong supervised diffusion models including IDDPM [23], CDM [24], ADM [4] and LDM [25] (see Fig. 2 (a)). It is worth noting that the comparison with previous models here is meant to illustrate that DPT maintains good performance even with minimal labels, rather than directly comparing it to these previous models (direct comparison is unfair as different diffusion models were used). Furthermore, DPT with two (i.e., < 0.2%) labels per class is comparable to supervised baseline 2 (a) DPT vs. supervised diffusion models. (b) DPT vs. semi-supervised classifiers. Figure 2: Generation and classification results of DPT on ImageNet with few labels. (a) DPT with < 0.1% labels outperforms strong supervised diffusion models [4, 24, 25]. (b) DPT substantially improves SOTA semi-supervised learners [17]. U-ViT [5] (FID 2.52 vs. 2.29). Moreover, on ImageNet 128 × 128 generation, DPT with one (i.e., < 0.1 %) labels per class outperforms SOTA semi-supervised generative models S3GAN [12] with 20% labels (FID 4.59 vs. 7.7). Qualitatively, DPT can generate realistic, diverse, and semantically correct images with very few labels, as shown in Fig 1. We also explore why classifiers can benefit generative models through class-level visualization and analysis in Appendix H. As for semi-supervised classification, DPT achieves state-of-the-art (SOTA) performance in various settings, including ImageNet with one, two, five labels per class and 1% labels. On the smaller dataset, namely CIFAR-10, DPT with four labels per class achieves the second-best error rate of 4.68±0.17%. Besides, on ImageNet classification benchmarks with one, two, five labels per class and 1% labels, DPT outperforms competitive semi-supervised baselines [17, 16], achieving state-of-the- art top-1 accuracy of 59.0 (+2.8), 69.5 (+3.0), 74.4 (+2.0) and 80.2 (+0.8) respectively (see Fig. 2 (b)). Similarly to generation tasks, we also investigate why generative models can benefit classifiers via class-level visualization and analysis in Appendix I. In summary, our novelty and key contributions are as follows: • We present Dual Pseudo Training (DPT), a straightforward yet effective strategy designed to advance the frontiers of semi-supervised diffusion models and classifiers. • We achieve SOTA semi-supervised generation performance on CIFAR-10 and ImageNet datasets across various settings. Moreover, we demonstrate that diffusion models with a few labels (e.g., < 0.1%) can generate realistic, diverse, and semantically accurate images, as depicted in Fig 1. • We achieve SOTA semi-supervised classification performance on ImageNet datasets across various settings and the second-best results on CIFAR-10. Besides, we demonstrate that aided by diffusion models, generative augmentation remains a viable approach for semi-supervised classification. • We explore why diffusion models and semi-supervised learners benefit mutually with few labels via class-level visualization and analysis, as showcased in Appendix H and Appendix I. 2 Settings and Preliminaries We present settings and preliminaries on two representative self-supervised based learners for semi- supervised learning [17] [16] in Sec. 2.1 and conditional diffusion probabilistic models [2, 5, 26] in Sec. 2.2, respectively. We consider image generation and classification in semi-supervised learning, where the training set consists of N labeled images S = {(xl i=1 and M unlabeled images D = {xu i=1. We assume N ≪ M . For convenience, we denote the set of all real images as i=1 ∪ {xl X = {xu i=1, and the set of all possible classes as Y. i }M i }M i)}N i, yl i}N 3 Figure 3: An overview of DPT. First, a (semi-supervised) classifier is trained on partially labeled data and used to predict pseudo-labels for all data. Second, a conditional generative model is trained on all data with pseudo-labels and used to generate pseudo images given random labels. Finally, the classifier is trained or fine-tuned on real data augmented by pseudo images with labels. 2.1 Semi-Supervised Classifier Masked Siamese Networks (MSN) [17] employ a ViT-based [27] anchor encoder fθ(*) and a target encoder f ̄θ(*), where ̄θ is the exponential moving average (EMA) [28] of parameters θ. For a real image xi ∈ X , 1 ≤ i ≤ M + N , MSN obtains H + 1 random augmented images, denoted as xi,h, 1 ≤ h ≤ H + 1. MSN then applies either a random mask or a focal mask to the first H augmented images and obtain mask(xi,h), 1 ≤ h ≤ H. MSN optimizes θ and a learnable matrix of prototypes q by the following objective function: 1 H(M + N ) M +N (cid:88) H (cid:88) i=1 h=1 CE(pi,h, pi,H+1) − λH( ̄p), (1) where CE and H are cross entropy and entropy respectively, pi,h = softmax((fθ(mask(xi,h)) * q/τ ) , ̄p is the mean of pi,h, pi,H+1 = softmax(f ̄θ(xi,H+1) * q/τ ′), τ ,τ ′ and λ are hyper-parameters, and * denotes cosine similarity. MSN is an efficient semi-supervised approach by extracting features for all labeled images in S and training a linear classifier on top of the features using L2-regularized logistic regression. When a self-supervised pre-trained model is available, MSN demonstrates high efficiency in training a semi-supervised classifier on a single CPU core. Semi-ViT [16] is three-staged. First, it trains a ViT-based encoder fθ(*) on all images in X via self-supervised methods such as MAE [29]. Second, fθ(*) is merely fine-tuned on S in a supervised manner. Let ̄θ be the EMA of θ, and xu,s denote the strong and weak augmentated versions of xu and xu,w i i respectively. Finally, Semi-ViT optimizes a weighted sum of two cross-entropy losses: i L = Ll + μLu = 1 N N (cid:88) j=1 CE(fθ(xl j), vec(yl j)) + μ M M (cid:88) i=1 I[f ̄θ(xu,w i )ˆyi ≥ τ ]CE(fθ(xu,s i ), vec(ˆyi)), (2) where f ̄θ(x)y is the logit of f ̄θ(x) indexed by y, ˆyi = arg maxy f ̄θ(xu,w vec(*) returns the one-hot representation, and τ and μ are hyper-parameters. i )y is the pseudo-label, 4 Conditional Generative ModelClassifierClassifierPartially Labeled Real ImagesAll Real Images with Pseudo Labels Pseudo Labels for All Real Images Pseudo Images with Uniform LabelsReal Data Augmented by Pseudo Ones"bird""panda"TrainingPredicting"bird""panda"123Sampling"bird""panda""bird""panda" 2.2 Conditional Diffusion Probabilistic Models Denoising Diffusion Probabilistic Model (DDPM) [2] gradually adds noise ε ∼ N (0, I) to data x0 from time t = 0 to t = T in the forward process, and progressively removes noise to recover data starting at xT ∼ N (0, I) in the reverse process. It trains a predictor εθ to predict the noise ε by the following objective: L = Et,x0,ε[||εθ(xt, c, t) − ε||2 2], (3) where c indicates conditions such as classes and texts. Classifier-Free Guidance (CFG) [26] leverages a conditional noise predictor εθ(xt, c, t) and an unconditional noise predictor εθ(xt, t) in inference to improve sample quality and enhance semantics. Formally, CFG iterates the following equation starting at xT : xt−1 = 1 √ αt (xt − βt√ 1 − ̄αt ̃εt) + σ2 t z, (4) where ̃εt = (1 + ω)εθ(xt, c, t) − ωεθ(xt, t), ω is the guidance strength, z ∼ N (0, I), and αt, βt, ̄αt and σt are constants w.r.t. the time t. U-ViT [5] is a ViT-based backbone for diffusion probabilistic models, which achieves excellent performance in conditional sampling on large-scale datasets. 3 Method we propose a three-stage strategy called dual pseudo training (DPT) to advance semi-supervised generation and classification tasks, illustrated in Fig. 3 and detailed as follows. 3.1 First Stage: Train Classifier DPT trains a semi-supervised classifier on partially labeled data S ∪ D, predicts a pseudo-label ˆy of any image x ∈ X by the classifier, and constructs a dataset consisting of all images with pseudo-labels, i.e. S1 = {(x, ˆy)|x ∈ X }3. Notably, here we treat the classifier as a black box without modifying the training strategy or any hyperparameter. Therefore, any well-trained classifier can be adopted in DPT in a plug-and-play manner. Indeed, we use recent advances in self-supervised based learners for semi-supervised learning, i.e. MSN [17], and Semi-ViT [16]. These two classifiers both provide the generative model with accurate, low-noise labels of high quality. 3.2 Second Stage: Classifier Benefits Generative Model DPT trains a conditional generative model on all real images with pseudo-labels S1, samples K pseudo images for any class label y after training, and constructs a dataset consisting of pseudo images with uniform labels4. We denote the dataset as S2 = ∪y∈Y {(ˆxi,y, y)}K i=1, where ˆxi,y is the i-th pseudo image for class y. Similarly to the classifier, DPT also treats the conditional generative model as a black box. Inspired by the impressive image generation results of diffusion probabilistic models, we take a U-ViT-based [5] denoise diffusion probabilistic model [2] with classifier-free guidance [26] as the conditional generative model. Everything remains the same as the original work (see Sec. 2.2) except that the set of all real images with pseudo-labels S1 is used for training. We emphasize that S1 obtained by the first stage is necessary. In fact, S is of small size (e.g., one label per class) and not sufficient to train conditional diffusion models. Besides, it is unclear how to leverage unlabeled data to train such models. Built upon efficient and strong semi-supervised approaches [17, 16], S1 provides useful learning signals (with relatively small noise) to train conditional diffusion models. We present quantitative and qualitative empirical evidence in Fig. 2 (a) and Fig. 1 respectively to affirmatively answer the first key question, namely, diffusion models with a few labels (e.g., < 0.1%) can generate realistic and semantically accurate images. 3For simplicity, we also use pseudo-labels instead of the ground truth for real labeled data, which are rare and have a small zero-one training loss, making no significant difference. 4The prior distribution of y can be estimated on S. 5 3.3 Third Stage: Generative Model Benefits Classifier MSN based DPT. We train the classifier employed in the first stage on real data augmented by S2 to boost classification performance. For simplicity and efficiency, we freeze the models pre-trained by Eq. (1) in the first stage and replace S with S ∪ S2 to train a linear probe in MSN [17]. DPT substantially boosts the classification performance as presented in Fig. 2 (b). Semi-ViT based DPT. We freeze the models, which are pre-trained in a self-supervised manner in the first stage of Semi-ViT, and replace S with S ∪ S2 to train a classifier in the third stage of Semi-ViT. We argue that pseudo images can be used in different stages of Semi-ViT and can both boost the classification performance. (see Appendix F.2). Both consistent improvements provide a positive answer to the second key question, namely, gener- ative augmentation remains a useful approach for semi-supervised classification. Besides, we can leverage the classifier in the third stage to refine the pseudo-labels and train the generative model with one more stage. Although we observe an improvement empirically (see results in Appendix F.3), we focus on the three-stage strategy in the main paper for simplicity and efficiency. 4 Related Work Semi-Supervised Classification and Generation. The two tasks are often studied indepen- dently. For semi-supervised classification, classical work includes generative approaches based on VAE [10, 30, 31] and GAN [32, 22, 33, 34, 35, 36], and discriminative approaches with confi- dence regularization [37, 38, 39, 40], consistency regularization [41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 13, 14, 51, 52] and other approaches [53, 54, 55, 56]. Recently, large-scale self-supervised based approaches [18, 28, 57, 17, 16] have made remarkable progress in semi-supervised learning. Besides, semi-supervised conditional image generation is challenging because generative modeling is more complex than prediction. In addition, it is highly nontrivial to design proper regularization when the input label is missing. Existing work is based on VAE [10] or GAN [11, 12], which are limited to low-resolution data (i.e., ≤ 128 × 128) and require 10% labels or so to achieve comparable results to supervised baselines. In comparison, DPT handles both classification and generation tasks in extreme settings with very few labels (e.g., one label per class, < 0.1% labels). Built upon recent advances in semi-supervised learners and diffusion models, DPT substantially improves the state-of-the-art results in both tasks. Pseudo Data and Labels. We mention additional empirical work on generating pseudo data for supervised learning [58], adversarial robust learning [59, 60], contrastive representation learning [61] and zero-shot learning [62, 63]. Regarding theory, in the context of supervised classification, Zheng et al. [64] have mentioned that when the training dataset size is small, generative data augmentation can improve the learning guarantee at a constant level. This finding can be extended to semi-supervised classification, which is left as future work. Besides, prior work [65, 66, 67, 8] uses cluster index or instance index as pseudo-labels to improve unsupervised generation results, which are not directly comparable to DPT. With additional few labels, DPT can generate images of much higher quality and directly control the semantics of images with class labels. Diffusion Models. Recently, diffusion probabilistic models [32, 2, 3, 6] achieve remarkable progress in image generation [4, 25, 24, 8, 26, 7], text-to-image generation [68, 69, 70, 25, 71], 3D scene generation [72], image-editing [73, 74, 75], molecular design [76, 77], and semi-supervised medical science [78, 79]. There are learning-free methods [80, 81, 82, 83, 84] and learning-based ones [85, 86] to speed up the sampling process of diffusion models. In particular, we adopt third-order DPM- solver [84], which is a recent learning-free method, for fast sampling. As for the architecture, most diffusion models rely on variants of the U-Net architecture introduced in score-based models [87] while recent work [5] proposes a promising vision transformer for diffusion models, as employed in DPT. To the best of our knowledge, there has been little research on semi-supervised conditional diffusion models and diffusion-based semi-supervised classification, which are the focus of this paper. 6 5 Experiment We present the main experimental settings in Sec. 5.1. For more details, please refer to Appendix C. To evaluate the performance of DPT, we compare it with state-of-the-art conditional diffusion models and semi-supervised learners in Sec. 5.2 and Sec. 5.3 respectively. We also visualize and analyze the interaction between the stages to explain the excellent performance of DPT (see Appendix I, H). 5.1 Experimental Settings Dataset. We evaluate DPT on the ImageNet [20] dataset, which consists of 1,281,167 training and 50,000 validation images. In the first and third stages, we use the same pre-processing protocol for real images as the baselines [17, 16]. For instance, in MSN, the real data are resized to 256 × 256 and then center-cropped to 224 × 224. In the second stage, real images are center-cropped to the target resolution following [5]. In the third stage, we consider pseudo images at resolution 256 × 256 and center-crop them to 224 × 224. For semi-supervised classification, we consider the challenging settings with one, two, five labels per class and 1% labels. The labeled and unlabeled data split is the same as that of corresponding methods [17, 16]. We also evaluate DPT on CIFAR-10 (see detailed experiments in Appendix A). Baselines. For semi-supervised classification, we consider state-of-the-art semi-supervised ap- proaches [17, 16] in the setting of low-shot (e.g., one, two, five labels per class and 1% labels) as baselines. For conditional generation, we consider the state-of-the-art diffusion models with a U-ViT architecture [5] as the baseline. Model Architectures and Hyperparameters. For a fair comparison, we use the exact same architectures and hyperparameters as the baselines [17, 16, 5]. In particular, for MSN based DPT, we use a ViT B/4 (or a ViT L/7) model [17] for classification and a U-ViT-Large (or a U-ViT-Huge) model [5] for conditional generation. As for Semi-ViT based DPT, we use a ViT-Huge model [16] for classification and a U-ViT-Huge model [5] for conditional generation. More details are provided in Appendix C for reference. Evaluation metrics. We use the top-1 accuracy on the validation set to evaluate classification performance. For a comprehensive evaluation of generation performance, we first consider the Fréchet inception distance (FID) [21], sFID [88], Inception Score (IS) [22], precision, and recall [89] on 50K generated samples. We calculate all generation metrics based on the implementation of ADM [4]. We also add the metric FIDCLIP, which operates similarly to FID but substitutes the Inception-V3 feature spaces with CLIP features, to eliminate confusion that FID can be artificially reduced by aligning the histograms of Top-N classifications without the actual improvement of image quality [90]. Implementation. DPT is easy to understand and implement. In particular, it only requires several lines of code based on the implementation of the classifier and conditional diffusion model. We provide the pseudocode of DPT in the style of PyTorch in Appendix B. The choice of K and CFG. We conduct detailed ablation experiments on the number of augmented pseudo images per class (i.e., K) and the classifier-free guidance scale (i.e., CFG) in Appendix G and find that the optimal K value is 128 and the optimal CF G values for different ImageNet resolutions are 0.8 for 128 × 128, 0.4 for 256 × 256, and 0.7 for 512 × 512. The choice of resolution and number of labels. We were primarily driven by the task of ImageNet 256×256 generation to systematically compare with a large family of baselines. In this context, we conducted detailed experiments, including settings with one, two, five labels per class, and 1% labels. We find that the performance of DPT with five labels per class is comparable to the supervised baseline, leading us to use this setting as the default in our other tasks such as ImageNet 128×128 and ImageNet 512×512 generation. 5.2 Image Generation with Few Labels We show that diffusion models with a few labels can generate realistic and semantically accurate images. In particular, DPT achieves better results than semi-supervised methods on ImageNet 128 × 128 and comparable results to supervised methods on both ImageNet 256 × 256 and 512 × 512. 7 Table 1: Image generation results on ImageNet 128 × 128. † labels the results taken from the corresponding references and ⋆ labels baseline achieved by us. We bold the best result under the corresponding setting. With < 0.1% labels, DPT outperforms strong semi-supervised generative models S3GAN [12]. Method Model Label fraction (# labels/class) FID-50K ↓ IS ↑ U-ViT-Huge(supervised baseline)⋆ Diff. 100% S3GAN [12]† GAN S3GAN [12]† GAN S3GAN [12]† GAN DPT (ours, with U-ViT-Huge and MSN) Diff. DPT (ours, with U-ViT-Huge and MSN) Diff. 5% 10% 20% < 0.1%(1) < 0.4%(5) 4.53 10.4 8.0 7.7 4.59 4.58 219.8 59.6 78.7 83.1 153.6 210.9 Table 2: Image generation results on ImageNet 256 × 256. † labels the results taken from the corresponding references and ⋆ labels baselines achieved by us. DPT and the corresponding baselines employ the same model architectures [5]. With < 0.4% labels, DPT outperforms strong conditional generative models with full labels, including CDM [24], ADM [4] and LDM [25]. We bold the best result achieved with full labels and underline the best result achieved with few labels. For a fair comparison, we also list the parameters of the diffusion model, including its auxiliary components. Method IC-GAN [67]† BigGAN-deep [91]† StyleGAN-XL [92]† IDDPM [23]† CDM [24]† ADM [4]† LDM-4-G [25]† DiT-XL/2-G [7] † U-ViT-Large [5]† With U-ViT-Large Supervised baseline⋆ Unsupervised baseline⋆ DPT (ours, with MSN) DPT (ours, with MSN) DPT (ours, with MSN) DPT (ours, with MSN) With U-ViT-Huge Supervised baseline† Diff. DPT (ours, with MSN) Diff. DPT (ours, with MSN) Diff. DPT (ours, with MSN) Diff. DPT (ours, with Semi-ViT) Diff. Model Label fraction (# labels/class) FID ↓ FIDCLIP ↓ sFID ↓ IS ↑ Precision ↑ Recall ↑ # Params GAN GAN GAN Diff. Diff. Diff. Diff. Diff. Diff. Diff. Diff. Diff. Diff. Diff. Diff. 0% 100% 100% 100% 100% 100% 100% 100% 100% 100% 0% < 0.1%(1) < 0.2%(2) < 0.4%(5) 1%(≈ 12) 100% < 0.1%(1) < 0.2%(2) < 0.4%(5) 1%(≈ 12) 15.6 6.95 2.30 12.26 4.88 3.94 3.60 2.27 3.40 3.31 27.99 4.34 3.44 3.37 3.35 2.29 3.08 2.52 2.50 2.42 - - - - - - - - - 2.39 5.40 2.57 2.37 2.35 2.34 1.75 1.84 1.81 1.82 1.77 59.0 7.36 4.02 5.42 - 6.14 - 4.60 6.63 6.68 7.03 6.68 6.58 6.71 6.66 5.68 5.56 5.49 5.54 5.48 - 171.4 265.12 - 158.71 215.84 247.67 278.24 219.94 221.61 33.86 162.96 199.74 217.53 223.09 263.88 201.68 230.34 243.10 259.93 - 0.87 0.78 0.70 - 0.83 0.87 0.83 0.83 0.83 0.60 0.80 0.82 0.83 0.83 0.82 0.80 0.81 0.83 0.82 - 0.28 0.53 0.62 - 0.53 0.48 0.57 0.52 0.53 0.62 0.53 0.53 0.52 0.52 0.57 0.58 0.57 0.55 0.56 - - - 550M - 673M 455M 675M 371M 371M 371M 371M 371M 371M 371M 585M 585M 585M 585M 585M We evaluate semi-supervised generation performance of DPT on ImageNet 128 × 128, as shown in Tab. 1. In particular, DPT with only < 0.1% labels outperforms the SOTA semi-supervised generative model S3GAN [12] with 20% labels (FID 4.59 vs. 7.7), suggesting DPT has superior label efficiency. In Tab. 2, we compare DPT with state-of-the-art generative models on ImageNet 256 × 256. We construct highly competitive baselines based on diffusion models with U-ViT-Large [5]. According to Tab. 2, our supervised and unsupervised baselines achieve an FID of 3.31 and 27.99, respectively. Leveraging the pseudo-labels predicted by the strong semi-supervised learner [17], DPT with few labels improves the unconditional baseline significantly and is even comparable to the supervised baseline under all metrics. In particular, with only two labels per class, DPT improves the FID of the unsupervised baseline by 24.55 and is comparable to the supervised baseline with a gap of 0.13. Moreover, we also construct more competitive baselines based on U-ViT-Huge to advance DPT. With one (i.e., < 0.1%) label per class, our more powerful DPT achieves an FID of 3.08, outperforming strong supervised diffusion models including IDDPM [23], CDM [24], ADM [4] and LDM [25]. Additionally, with 1% labels, DPT achieves an FID of 2.42, comparable to the 8 Table 3: Image generation results on ImageNet 512 × 512. † labels the results taken from the corresponding references. We bold the best result under the corresponding setting. Model Label fraction (# labels/class) FID-50K ↓ IS ↑ Method BigGAN-deep [91]† StyleGAN-XL [92]† ADM [4]† DiT-XL/2-G [7]† U-ViT-Huge (supervised baseline)† GAN GAN Diff. Diff. Diff. 100% 100% 100% 100% 100% DPT (ours, with U-ViT-Huge and MSN) Diff. < 0.4%(5) 8.43 2.41 3.85 3.04 4.05 4.05 177.90 267.75 221.72 240.82 263.79 252.08 Table 4: Top-1 accuracy on the ImageNet validation set with few labels. † labels the results taken from corresponding references, ‡ labels the results taken from Assran et al. [17] and ⋆ labels the baselines reproduced by us. DPT and the corresponding baseline employ exactly the same classifier architectures. With one, two, five labels per class and 1% labels, DPT improves the state-of-the-art semi-supervised learner [17, 16] consistently and substantially. We bold the best result under the corresponding setting and underline the second-best result. Method Architecture Top-1 accuracy ↑ given # labels per class (label fraction) ≈ 12(1%) 1(< 0.1%) 5(< 0.5%) 2(< 0.2%) EMAN [57]† PAWS [51]† BYOL [28]† SimCLRv2 [18]† ResNet-50 ResNet-50 ResNet-200 ResNet-152 - - - - - - - - - - - - ViT-Huge ViT-B/16 ViT-B/8 ViT-H/14 ViT-B/4 ViT-L/7 Semi-ViT [16]† iBOT [93]‡ DINO [94]‡ MAE [29]‡ MSN [17]† MSN [17]† MSN (baseline)⋆ DPT (ours) MSN (baseline)⋆ DPT (ours) Semi-ViT (baseline)⋆ ViT-Huge DPT (ours) ViT-Huge ViT-B/4 ViT-B/4 ViT-L/7 ViT-L/7 - 46.1 ± 0.3 45.8 ± 0.5 11.6 ± 0.4 54.3 ± 0.4 57.1 ± 0.6 - 56.2 ± 0.7 55.9 ± 0.6 18.6 ± 0.2 64.6 ± 0.7 66.4 ± 0.6 - 64.7 ± 0.3 64.6 ± 0.2 32.8 ± 0.2 72.4 ± 0.3 72.1 ± 0.2 52.9 58.6 56.2 58.9 - - 64.9 69.5 66.5 69.2 - - 72.4 74.4 72.0 73.4 - - 63.0 66.5 71.2 76.6 80.0 - - - 75.7 75.1 - - - - 79.4 80.2 state-of-the-art supervised diffusion model [7]. Lastly, DPT with few labels performs comparably to the fully supervised baseline under the FIDCLIP metric, which suggests that DPT can generate high-quality samples and does not achieve a lower FID solely due to better Top-N alignment. We also conduct an experiment on higher resolution (i.e., 512 × 512) in Tab. 3, with five (i.e., < 0.4%) labels, DPT achieves an FID of 4.05, which is the same as that of the supervised baseline. The above quantitative results demonstrate that DPT can achieve excellent generation performance and label efficiency at diverse resolutions. Qualitatively, as presented in Fig. 1, DPT can generate realistic, diverse, and semantically correct images even with a single label, which agrees with the quantitative results in Tab. 2 and Tab. 3. We provide more samples and failure cases in Appendix F.1 and a detailed class-wise analysis to show how classification helps generation in Appendix H. Besides, Tab. 5 in Appendix A compares DPT with state-of-the-art generative models on CIFAR-10. DPT achieves competitive performance using only 0.08% labels with EDM [6], which relies on full labels (FID 1.81 vs. 1.79). This result demonstrates the generalizability of DPT on different datasets. 9 5.3 Image Classification with Few Labels We demonstrate that generative augmentation remains a useful approach for semi-supervised clas- sification aided by diffusion models. In particular, DPT achieves state-of-the-art semi-supervised classification performance on ImageNet datasets across various settings and the second-best results on CIFAR-10. Tab. 4 compares DPT with state-of-the-art semi-supervised classifiers on the ImageNet validation set with few labels. Specifically, DPT outperforms strong semi-supervised baselines [17, 16] consistently and substantially with one, two, five labels per class and 1% labels and achieves state-of-the-art top-1 accuracies of 59.0, 69.5, 74.4 and 80.2, respectively. In particular, with two labels per class, DPT leverages the pseudo images generated by the diffusion model and improves MSN with ViT-B/4 by an accuracy of 4.6%. Besides, we compare the performance of DPT with that of SOTA fully supervised models (as shown in Tab. 12 in Appendix F.2) and find that DPT performs comparably to Inception-v4 [95], using only 1% labels. Moreover, Tab. 6 in Appendix A compares DPT with state-of-the-art semi-supervised classifiers on CIFAR-10. DPT with four labels per class achieves the second-best error rate of 4.68±0.17%. 6 Conclusions This paper presents a simple yet effective training strategy called DPT for conditional image gen- eration and classification in semi-supervised learning. Empirically, we demonstrate that DPT can achieve SOTA semi-supervised generation and classification performance on ImageNet datasets across various settings. DPT probably inspires future work in diffusion models and semi-supervised learning. Limitation. One limitation of DPT is directly using the pseudo images to improve the performance of DPT for its simplicity and effectiveness while we could use pre-trained models like CLIP to filter out noisy image-label pairs that images do not semantically align well with the label. Another limitation pertains to the direct use of pseudo labels. Given our use of classifier-free guidance, we have the flexibility to assign low-confidence pseudo labels to the null token with a high probability, which aids in filtering out noisy pseudo labels. Social impact. We believe that DPT can benefit real-world applications with few labels (e.g., medical analysis). However, the proposed semi-supervised diffusion models may aggravate social issues such as "DeepFakes". The problem can be relieved by automatic detection with machine learning, which is an active research area. Acknowledgement This work was supported by NSF of China (Nos. 62076145); Beijing Outstanding Young Scientist Program (No. BJJWZYJH012019100020098); Major Innovation & Planning Interdisciplinary Platform for the "Double-First Class" Initiative, Renmin University of China; the Fundamental Research Funds for the Central Universities, and the Research Funds of Renmin University of China (No. 22XNKJ13). C. Li was also sponsored by Beijing Nova Program (No. 20220484044). References [1] J. Sohl-Dickstein, E. A. Weiss, N. Maheswaranathan, and S. Ganguli, "Deep unsupervised learning using nonequilibrium thermodynamics," in Proceedings of the 32nd International Conference on Machine Learning, 2015. [2] J. Ho, A. Jain, and P. Abbeel, "Denoising diffusion probabilistic models," in Advances in Neural Information Processing Systems, 2020. [3] Y. Song, J. Sohl-Dickstein, D. P. Kingma, A. Kumar, S. Ermon, and B. Poole, "Score-based generative modeling through stochastic differential equations," in 9th International Conference on Learning Representations, 2021. [4] P. Dhariwal and A. Nichol, "Diffusion models beat gans on image synthesis," Advances in Neural Information Processing Systems, vol. 34, pp. 8780–8794, 2021. 10 [5] F. Bao, C. Li, Y. Cao, and J. Zhu, "All are worth words: a vit backbone for score-based diffusion models," arXiv preprint arXiv:2209.12152, 2022. [6] T. Karras, M. Aittala, T. Aila, and S. Laine, "Elucidating the design space of diffusion-based generative models," in Proc. NeurIPS, 2022. [7] W. Peebles and S. Xie, "Scalable diffusion models with transformers," arXiv preprint arXiv:2212.09748, 2022. [8] F. Bao, C. Li, J. Sun, and J. Zhu, "Why are conditional generative models better than uncondi- tional ones?" in NeurIPS 2022 Workshop on Score-Based Methods, 2022. [9] V. T. Hu, D. W. Zhang, Y. M. Asano, G. J. Burghouts, and C. G. Snoek, "Self-guided diffusion models," in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2023, pp. 18 413–18 422. [10] D. P. Kingma, S. Mohamed, D. J. Rezende, and M. Welling, "Semi-supervised learning with deep generative models," in Advances in Neural Information Processing Systems, 2014. [11] C. Li, K. Xu, J. Zhu, and B. Zhang, "Triple generative adversarial nets," in Advances in Neural Information Processing Systems, 2017, pp. 4088–4098. [12] M. Luˇci ́c, M. Tschannen, M. Ritter, X. Zhai, O. Bachem, and S. Gelly, "High-fidelity image PMLR, generation with fewer labels," in International conference on machine learning. 2019, pp. 4183–4192. [13] K. Sohn, D. Berthelot, N. Carlini, Z. Zhang, H. Zhang, C. A. Raffel, E. D. Cubuk, A. Ku- rakin, and C.-L. Li, "Fixmatch: Simplifying semi-supervised learning with consistency and confidence," Advances in neural information processing systems, vol. 33, pp. 596–608, 2020. [14] B. Zhang, Y. Wang, W. Hou, H. Wu, J. Wang, M. Okumura, and T. Shinozaki, "Flexmatch: Boosting semi-supervised learning with curriculum pseudo labeling," Advances in Neural Information Processing Systems, vol. 34, pp. 18 408–18 419, 2021. [15] Y. Wang, H. Chen, Q. Heng, W. Hou, M. Savvides, T. Shinozaki, B. Raj, Z. Wu, and J. Wang, "Freematch: Self-adaptive thresholding for semi-supervised learning," arXiv preprint arXiv:2205.07246, 2022. [16] Z. Cai, A. Ravichandran, P. Favaro, M. Wang, D. Modolo, R. Bhotika, Z. Tu, and S. Soatto, "Semi-supervised vision transformers at scale," in NeurIPS, 2022. [17] M. Assran, M. Caron, I. Misra, P. Bojanowski, F. Bordes, P. Vincent, A. Joulin, M. Rabbat, and N. Ballas, "Masked siamese networks for label-efficient learning," in European Conference on Computer Vision. Springer, 2022, pp. 456–473. [18] T. Chen, S. Kornblith, K. Swersky, M. Norouzi, and G. E. Hinton, "Big self-supervised models are strong semi-supervised learners," Advances in neural information processing systems, vol. 33, pp. 22 243–22 255, 2020. [19] A. Krizhevsky and G. Hinton, "Learning multiple layers of features from tiny images," Citeseer, 2009. [20] J. Deng, W. Dong, R. Socher, L. Li, K. Li, and L. Fei-Fei, "Imagenet: A large-scale hierarchical image database," in IEEE Computer Society Conference on Computer Vision and Pattern Recognition, 2009, pp. 248–255. [21] M. Heusel, H. Ramsauer, T. Unterthiner, B. Nessler, and S. Hochreiter, "Gans trained by a two time-scale update rule converge to a local nash equilibrium," in Advances in Neural Information Processing Systems, 2017, pp. 6626–6637. [22] T. Salimans, I. Goodfellow, W. Zaremba, V. Cheung, A. Radford, and X. Chen, "Improved techniques for training GANs," in Advances in Neural Information Processing Systems, 2016. [23] A. Q. Nichol and P. Dhariwal, "Improved denoising diffusion probabilistic models," in Inter- national Conference on Machine Learning. PMLR, 2021, pp. 8162–8171. 11 [24] J. Ho, C. Saharia, W. Chan, D. J. Fleet, M. Norouzi, and T. Salimans, "Cascaded diffusion models for high fidelity image generation." J. Mach. Learn. Res., vol. 23, pp. 47–1, 2022. [25] R. Rombach, A. Blattmann, D. Lorenz, P. Esser, and B. Ommer, "High-resolution image synthesis with latent diffusion models," in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2022, pp. 10 684–10 695. [26] J. Ho and T. Salimans, "Classifier-free diffusion guidance," arXiv preprint arXiv:2207.12598, 2022. [27] A. Dosovitskiy, L. Beyer, A. Kolesnikov, D. Weissenborn, X. Zhai, T. Unterthiner, M. De- hghani, M. Minderer, G. Heigold, S. Gelly, J. Uszkoreit, and N. Houlsby, "An image is worth 16x16 words: Transformers for image recognition at scale," in 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021, 2021. [28] J.-B. Grill, F. Strub, F. Altché, C. Tallec, P. Richemond, E. Buchatskaya, C. Doersch, B. Avila Pires, Z. Guo, M. Gheshlaghi Azar et al., "Bootstrap your own latent-a new approach to self-supervised learning," Advances in neural information processing systems, vol. 33, pp. 21 271–21 284, 2020. [29] K. He, X. Chen, S. Xie, Y. Li, P. Dollár, and R. B. Girshick, "Masked autoencoders are scalable vision learners," in IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2022, pp. 15 979–15 988. [30] L. Maaløe, C. K. Sønderby, S. K. Sønderby, and O. Winther, "Auxiliary deep generative models," in International conference on machine learning. PMLR, 2016, pp. 1445–1453. [31] C. Li, J. Zhu, and B. Zhang, "Max-margin deep generative models for (semi-) supervised learning," IEEE transactions on pattern analysis and machine intelligence, vol. 40, no. 11, pp. 2762–2775, 2017. [32] J. T. Springenberg, "Unsupervised and semi-supervised learning with categorical generative adversarial networks," in 4th International Conference on Learning Representations, ICLR 2016, San Juan, Puerto Rico, May 2-4, 2016, Conference Track Proceedings, Y. Bengio and Y. LeCun, Eds., 2016. [33] Z. Dai, Z. Yang, F. Yang, W. W. Cohen, and R. R. Salakhutdinov, "Good semi-supervised learning that requires a bad gan," in Advances in Neural Information Processing Systems, 2017, pp. 6510–6520. [34] Z. Gan, L. Chen, W. Wang, Y. Pu, Y. Zhang, H. Liu, C. Li, and L. Carin, "Triangle generative adversarial networks," in Advances in Neural Information Processing Systems, 2017, pp. 5247–5256. [35] C. Li, K. Xu, J. Zhu, J. Liu, and B. Zhang, "Triple generative adversarial networks," IEEE Transactions on Pattern Analysis and Machine Intelligence, 2021. [36] Y. Zhang, H. Ling, J. Gao, K. Yin, J.-F. Lafleche, A. Barriuso, A. Torralba, and S. Fidler, "Datasetgan: Efficient labeled data factory with minimal human effort," in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2021, pp. 10 145–10 155. [37] T. Joachims et al., "Transductive inference for text classification using support vector machines," in ICML, vol. 99, 1999, pp. 200–209. [38] Y. Grandvalet and Y. Bengio, "Semi-supervised learning by entropy minimization," in Ad- vances in Neural Information Processing Systems, vol. 17, 01 2004. [39] D.-H. Lee et al., "Pseudo-label: The simple and efficient semi-supervised learning method for deep neural networks," in Workshop on challenges in representation learning, ICML, vol. 3, 2013, p. 896. [40] A. Iscen, G. Tolias, Y. Avrithis, and O. Chum, "Label propagation for deep semi-supervised learning," in Proceedings of the IEEE conference on computer vision and pattern recognition, 2019, pp. 5070–5079. 12 [41] T. Miyato, S.-i. Maeda, M. Koyama, and S. Ishii, "Virtual adversarial training: a regularization method for supervised and semi-supervised learning," IEEE transactions on pattern analysis and machine intelligence, vol. 41, no. 8, pp. 1979–1993, 2018. [42] A. Tarvainen and H. Valpola, "Mean teachers are better role models: Weight-averaged consis- tency targets improve semi-supervised deep learning results," in Advances in Neural Informa- tion Processing Systems, 2017, pp. 1195–1204. [43] S. Laine and T. Aila, "Temporal ensembling for semi-supervised learning," in International Conference on Learning Representations, 2017. [44] Y. Luo, J. Zhu, M. Li, Y. Ren, and B. Zhang, "Smooth neighbors on teacher graphs for semi- supervised learning," in Proceedings of the IEEE conference on computer vision and pattern recognition, 2018, pp. 8896–8905. [45] B. Athiwaratkun, M. Finzi, P. Izmailov, and A. G. Wilson, "There are many consistent explanations of unlabeled data: Why you should average," in 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019, 2019. [46] A. Oliver, A. Odena, C. A. Raffel, E. D. Cubuk, and I. Goodfellow, "Realistic evaluation of deep semi-supervised learning algorithms," in Advances in Neural Information Processing Systems, 2018, pp. 3235–3246. [47] D. Berthelot, N. Carlini, I. Goodfellow, N. Papernot, A. Oliver, and C. A. Raffel, "Mixmatch: A holistic approach to semi-supervised learning," in Advances in Neural Information Processing Systems, 2019, pp. 5049–5059. [48] D. Berthelot, N. Carlini, E. D. Cubuk, A. Kurakin, K. Sohn, H. Zhang, and C. Raffel, "Remix- match: Semi-supervised learning with distribution matching and augmentation anchoring," in International Conference on Learning Representations, 2019. [49] J. Li, C. Xiong, and S. C. Hoi, "Comatch: Semi-supervised learning with contrastive graph regularization," in Proceedings of the IEEE/CVF International Conference on Computer Vision, 2021, pp. 9475–9484. [50] M. Zheng, S. You, L. Huang, F. Wang, C. Qian, and C. Xu, "Simmatch: Semi-supervised learning with similarity matching," in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2022, pp. 14 471–14 481. [51] M. Assran, M. Caron, I. Misra, P. Bojanowski, A. Joulin, N. Ballas, and M. Rabbat, "Semi- supervised learning of visual features by non-parametrically predicting view assignments with support samples," in Proceedings of the IEEE/CVF International Conference on Computer Vision, 2021, pp. 8443–8452. [52] H. Tang, L. Sun, and K. Jia, "Stochastic consensus: Enhancing semi-supervised learning with consistency of stochastic classifiers," in European Conference on Computer Vision. Springer, 2022, pp. 330–346. [53] X. Wang, L. Lian, and S. X. Yu, "Unsupervised selective labeling for more effective semi- Springer, 2022, pp. supervised learning," in European Conference on Computer Vision. 427–445. [54] B. Chen, J. Jiang, X. Wang, P. Wan, J. Wang, and M. Long, "Debiased self-training for semi-supervised learning," Advances in Neural Information Processing Systems, vol. 35, pp. 32 424–32 437, 2022. [55] H. Tang and K. Jia, "Towards discovering the effectiveness of moderately confident samples for semi-supervised learning," in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2022, pp. 14 658–14 667. [56] J. Lim, D. Um, H. J. Chang, D. U. Jo, and J. Y. Choi, "Class-attentive diffusion network for semi-supervised classification," in Proceedings of the AAAI Conference on Artificial Intelligence, vol. 35, no. 10, 2021, pp. 8601–8609. 13 [57] Z. Cai, A. Ravichandran, S. Maji, C. Fowlkes, Z. Tu, and S. Soatto, "Exponential moving average normalization for self-supervised and semi-supervised learning," in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2021, pp. 194–203. [58] S. Azizi, S. Kornblith, C. Saharia, M. Norouzi, and D. J. Fleet, "Synthetic data from diffusion models improves imagenet classification," arXiv preprint arXiv:2304.08466, 2023. [59] S.-A. Rebuffi, S. Gowal, D. A. Calian, F. Stimberg, O. Wiles, and T. Mann, "Fixing data augmentation to improve adversarial robustness," arXiv preprint arXiv:2103.01946, 2021. [60] Z. Wang, T. Pang, C. Du, M. Lin, W. Liu, and S. Yan, "Better diffusion models further improve adversarial training," arXiv preprint arXiv:2302.04638, 2023. [61] A. Jahanian, X. Puig, Y. Tian, and P. Isola, "Generative models as a data source for multiview representation learning," in The Tenth International Conference on Learning Representations, ICLR 2022, Virtual Event, April 25-29, 2022, 2022. [62] R. He, S. Sun, X. Yu, C. Xue, W. Zhang, P. Torr, S. Bai, and X. Qi, "Is synthetic data from generative models ready for image recognition?" arXiv preprint arXiv:2210.07574, 2022. [63] V. Besnier, H. Jain, A. Bursuc, M. Cord, and P. Pérez, "This dataset does not exist: training models from generated images," in ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP). IEEE, 2020, pp. 1–5. [64] C. Zheng, G. Wu, and C. Li, "Toward understanding generative data augmentation," arXiv preprint arXiv:2305.17476, 2023. [65] M. Noroozi, "Self-labeled conditional gans," arXiv preprint arXiv:2012.02162, 2020. [66] S. Liu, T. Wang, D. Bau, J.-Y. Zhu, and A. Torralba, "Diverse image generation via self- conditioned gans," in Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, 2020, pp. 14 286–14 295. [67] A. Casanova, M. Careil, J. Verbeek, M. Drozdzal, and A. Romero Soriano, "Instance- conditioned gan," Advances in Neural Information Processing Systems, vol. 34, pp. 27 517– 27 529, 2021. [68] A. Q. Nichol, P. Dhariwal, A. Ramesh, P. Shyam, P. Mishkin, B. McGrew, I. Sutskever, and M. Chen, "GLIDE: towards photorealistic image generation and editing with text-guided diffusion models," in International Conference on Machine Learning, ICML 2022, 17-23 July 2022, Baltimore, Maryland, USA, vol. 162, 2022, pp. 16 784–16 804. [69] A. Ramesh, P. Dhariwal, A. Nichol, C. Chu, and M. Chen, "Hierarchical text-conditional image generation with clip latents," arXiv preprint arXiv:2204.06125, 2022. [70] S. Gu, D. Chen, J. Bao, F. Wen, B. Zhang, D. Chen, L. Yuan, and B. Guo, "Vector quantized diffusion model for text-to-image synthesis," in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2022, pp. 10 696–10 706. [71] Y. Balaji, S. Nah, X. Huang, A. Vahdat, J. Song, K. Kreis, M. Aittala, T. Aila, S. Laine, B. Catanzaro et al., "ediffi: Text-to-image diffusion models with an ensemble of expert denoisers," arXiv preprint arXiv:2211.01324, 2022. [72] B. Poole, A. Jain, J. T. Barron, and B. Mildenhall, "Dreamfusion: Text-to-3d using 2d diffusion," arXiv preprint arXiv:2209.14988, 2022. [73] C. Meng, Y. He, Y. Song, J. Song, J. Wu, J. Zhu, and S. Ermon, "Sdedit: Guided image synthe- sis and editing with stochastic differential equations," in The Tenth International Conference on Learning Representations, ICLR 2022, Virtual Event, April 25-29, 2022, 2022. [74] J. Choi, S. Kim, Y. Jeong, Y. Gwon, and S. Yoon, "Ilvr: Conditioning method for denoising diffusion probabilistic models," in 2021 IEEE/CVF International Conference on Computer Vision (ICCV), 2021, pp. 14 347–14 356. 14 [75] M. Zhao, F. Bao, C. Li, and J. Zhu, "Egsde: Unpaired image-to-image translation via energy- guided stochastic differential equations," Advances in Neural Information Processing Systems, 2022. [76] E. Hoogeboom, V. G. Satorras, C. Vignac, and M. Welling, "Equivariant diffusion for molecule PMLR, 2022, pp. generation in 3d," in International Conference on Machine Learning. 8867–8887. [77] F. Bao, M. Zhao, Z. Hao, P. Li, C. Li, and J. Zhu, "Equivariant energy-guided sde for inverse molecular design," arXiv preprint arXiv:2209.15408, 2022. [78] A. Alshenoudy, B. Sabrowsky-Hirsch, S. Thumfart, M. Giretzlehner, and E. Kobler, "Semi- supervised brain tumor segmentation using diffusion models," in IFIP International Conference on Artificial Intelligence Applications and Innovations. Springer, 2023, pp. 314–325. [79] S. Gong, C. Chen, Y. Gong, N. Y. Chan, W. Ma, C. H.-K. Mak, J. Abrigo, and Q. Dou, "Diffusion model based semi-supervised learning on brain hemorrhage images for efficient midline shift quantification," in International Conference on Information Processing in Medical Imaging. Springer, 2023, pp. 69–81. [80] J. Song, C. Meng, and S. Ermon, "Denoising diffusion implicit models," in 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021, 2021. [81] F. Bao, C. Li, J. Zhu, and B. Zhang, "Analytic-dpm: an analytic estimate of the optimal reverse variance in diffusion probabilistic models," in The Tenth International Conference on Learning Representations, ICLR 2022, Virtual Event, April 25-29, 2022, 2022. [82] C. Lu, Y. Zhou, F. Bao, J. Chen, C. Li, and J. Zhu, "Dpm-solver++: Fast solver for guided sampling of diffusion probabilistic models," arXiv preprint arXiv:2211.01095, 2022. [83] Q. Zhang and Y. Chen, "Fast sampling of diffusion models with exponential integrator," in NeurIPS 2022 Workshop on Score-Based Methods, 2022. [84] C. Lu, Y. Zhou, F. Bao, J. Chen, C. Li, and J. Zhu, "Dpm-solver: A fast ode solver for diffusion probabilistic model sampling in around 10 steps," arXiv preprint arXiv:2206.00927, 2022. [85] F. Bao, C. Li, J. Sun, J. Zhu, and B. Zhang, "Estimating the optimal covariance with imperfect mean in diffusion probabilistic models," in Proceedings of the 39th International Conference on Machine Learning, 2022, pp. 1555–1584. [86] T. Salimans and J. Ho, "Progressive distillation for fast sampling of diffusion models," in The Tenth International Conference on Learning Representations, ICLR 2022, Virtual Event, April 25-29, 2022, 2022. [87] Y. Song and S. Ermon, "Generative modeling by estimating gradients of the data distribution," Advances in Neural Information Processing Systems, vol. 32, 2019. [88] C. Nash, J. Menick, S. Dieleman, and P. W. Battaglia, "Generating images with sparse representations," in Proceedings of the 38th International Conference on Machine Learning, ICML 2021, 18-24 July 2021, Virtual Event, vol. 139, 2021, pp. 7958–7968. [89] T. Kynkäänniemi, T. Karras, S. Laine, J. Lehtinen, and T. Aila, "Improved precision and recall metric for assessing generative models," Advances in Neural Information Processing Systems, vol. 32, 2019. [90] T. Kynkäänniemi, T. Karras, M. Aittala, T. Aila, and J. Lehtinen, "The role of imagenet classes in fr\'echet inception distance," arXiv preprint arXiv:2203.06026, 2022. [91] A. Brock, J. Donahue, and K. Simonyan, "Large scale gan training for high fidelity natural image synthesis," in International Conference on Learning Representations, 2018. [92] A. Sauer, K. Schwarz, and A. Geiger, "Stylegan-xl: Scaling stylegan to large diverse datasets," in ACM SIGGRAPH 2022 Conference Proceedings, 2022, pp. 1–10. 15 [93] J. Zhou, C. Wei, H. Wang, W. Shen, C. Xie, A. Yuille, and T. Kong, "ibot: Image bert pre- training with online tokenizer," International Conference on Learning Representations (ICLR), 2022. [94] M. Caron, H. Touvron, I. Misra, H. Jégou, J. Mairal, P. Bojanowski, and A. Joulin, "Emerging properties in self-supervised vision transformers," in Proceedings of the IEEE/CVF Interna- tional Conference on Computer Vision, 2021, pp. 9650–9660. [95] C. Szegedy, S. Ioffe, V. Vanhoucke, and A. Alemi, "Inception-v4, inception-resnet and the impact of residual connections on learning," in Proceedings of the AAAI conference on artificial intelligence, vol. 31, no. 1, 2017. [96] T. Karras, M. Aittala, J. Hellsten, S. Laine, J. Lehtinen, and T. Aila, "Training generative adversarial networks with limited data," in Advances in Neural Information Processing Systems, 2020. [97] Y. Chen, X. Tan, B. Zhao, Z. Chen, R. Song, J. Liang, and X. Lu, "Boosting semi-supervised learning by exploiting all unlabeled data," in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2023, pp. 7548–7557. [98] A. Rasmus, M. Berglund, M. Honkala, H. Valpola, and T. Raiko, "Semi-supervised learning with ladder networks," in Advances in Neural Information Processing Systems, 2015. [99] T. Miyato, S.-i. Maeda, M. Koyama, and S. Ishii, "Virtual adversarial training: a regularization method for supervised and semi-supervised learning," IEEE transactions on pattern analysis and machine intelligence, vol. 41, no. 8, pp. 1979–1993, 2018. [100] Q. Xie, Z. Dai, E. Hovy, T. Luong, and Q. Le, "Unsupervised data augmentation for consistency training," Advances in Neural Information Processing Systems, vol. 33, pp. 6256–6268, 2020. [101] Y. Xu, L. Shang, J. Ye, Q. Qian, Y.-F. Li, B. Sun, H. Li, and R. Jin, "Dash: Semi-supervised learning with dynamic thresholding," in International Conference on Machine Learning. PMLR, 2021, pp. 11 525–11 536. [102] H. Pham, Z. Dai, Q. Xie, and Q. V. Le, "Meta pseudo labels," in Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, 2021, pp. 11 557–11 568. [103] J. Mairal, "Cyanure: An open-source toolbox for empirical risk minimization for python, c++, and soon more," arXiv preprint arXiv:1912.08165, 2019. [104] K. He, H. Fan, Y. Wu, S. Xie, and R. B. Girshick, "Momentum contrast for unsupervised visual representation learning," in IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2020, pp. 9726–9735. [105] T. Chen, S. Kornblith, M. Norouzi, and G. E. Hinton, "A simple framework for contrastive learning of visual representations," in International Conference on Machine Learning, vol. 119, 2020, pp. 1597–1607. [106] X. Chen and K. He, "Exploring simple siamese representation learning," in IEEE Conference on Computer Vision and Pattern Recognition, 2021, pp. 15 750–15 758. [107] Z. Xie, Z. Zhang, Y. Cao, Y. Lin, J. Bao, Z. Yao, Q. Dai, and H. Hu, "Simmim: A simple framework for masked image modeling," in International Conference on Computer Vision and Pattern Recognition (CVPR), 2022. [108] R. A. Fisher, "On the mathematical foundations of theoretical statistics," Philosophical trans- actions of the Royal Society of London. Series A, containing papers of a mathematical or physical character, vol. 222, no. 594-604, pp. 309–368, 1922. [109] K. He, X. Zhang, S. Ren, and J. Sun, "Deep residual learning for image recognition," in Proceedings of the IEEE conference on computer vision and pattern recognition, 2016, pp. 770–778. 16 [110] C. Szegedy, V. Vanhoucke, S. Ioffe, J. Shlens, and Z. Wojna, "Rethinking the inception architecture for computer vision," in Proceedings of the IEEE conference on computer vision and pattern recognition, 2016, pp. 2818–2826. [111] J. Hu, L. Shen, and G. Sun, "Squeeze-and-excitation networks," in Proceedings of the IEEE conference on computer vision and pattern recognition, 2018, pp. 7132–7141. [112] M. Tan and Q. Le, "Efficientnet: Rethinking model scaling for convolutional neural networks," in International conference on machine learning. PMLR, 2019, pp. 6105–6114. [113] H. Touvron, M. Cord, M. Douze, F. Massa, A. Sablayrolles, and H. Jégou, "Training data- efficient image transformers & distillation through attention," in International Conference on Machine Learning. PMLR, 2021, pp. 10 347–10 357. [114] Z. Liu, Y. Lin, Y. Cao, H. Hu, Y. Wei, Z. Zhang, S. Lin, and B. Guo, "Swin transformer: Hierarchical vision transformer using shifted windows," in Proceedings of the IEEE/CVF International Conference on Computer Vision, 2021, pp. 10 012–10 022. 17 A Results of CIFAR-10 To evaluate the generalizability of DPT across different datasets, we also conduct an experiment on CIFAR-10 [19]. A.1 Baselines For semi-supervised classification, we consider a state-of-the-art method called FreeMatch [15] as the baseline. For conditional generation, we consider a state-of-the-art method called EDM [6] as the baseline. The training configuration of EDM is variance preserving (VP) [3], as it achieves slightly better generation performance compared to the alternative configuration of variance exploding (VE) [3]. A.2 Settings In the second stage of DPT, we generate pseudo images using the same sampling process as EDM [6]. We set the number of augmented pseudo images per class, i.e., K, to 1001 as the default value if not specified. In the third stage of DPT, we replace S with S ∪ S2 to re-train FreeMatch [15]. A.3 Evaluation metrics We use the error rate on the validation set to evaluate classification performance and consider the Fréchet inception distance (FID) score [21] to evaluate generation performance. A.4 Image Generation with Few Labels Tab. 5 presents a quantitative comparison of DPT with state-of-the-art generative models on the CIFAR-10 generation benchmark. In particular, DPT achieves an FID of 1.81 with only four (i.e., 0.08%) labels per class, outperforming strong supervised generative models such as StyleGAN- XL [92] and IDDPM [23], and even demonstrating competitive performance compared to the state- of-the-art supervised generative model EDM [6]. Table 5: Image generation results on CIFAR-10 32×32. Method StyleGAN2-ADA [96] StyleGAN-XL[92] EDM [6] DDPM [2] IDDPM [23] U-ViT [5] EDM [6] Model Label fraction (# labels/class) FID-50K ↓ GAN GAN Diff. Diff. Diff. Diff. Diff. 100% 100% 0% 100% 100% 100% 100% 2.92 1.85 1.97 3.17 2.90 3.11 1.79 1.81 DPT (ours, with EDM and FreeMatch) Diff. 0.08% (4) A.5 Image Classification with Few Labels Tab. 6 presents a comparison of DPT with state-of-the-art semi-supervised classifiers on CIFAR-10. DPT outperforms competitive baselines [15, 14, 13] substantially with four labels per class, achieving the second-best error rate of 4.68±0.17%. Meanwhile, it's worth noting that the state-of-the-art method Full-flex and our work DPT are orthogonal. Since DPT is a flexible framework, integrating FullFlex [97] into DPT could potentially lead to further performance improvements. 18 Table 6: Error rates on CIFAR-10 32×32. Bold indicates the best result and underline indicates the second-best result. † labels the results taken from corresponding references, and ⋆ labels the baselines reproduced by us. Method given # labels per class (label fraction) Error rate ↓ 4 (0.08%) 25 (0.5%) Π Model [98]† Pseudo Label [39]† VAT [99]† MeanTeacher [42]† MixMatch [47]† ReMixMatch [48]† UDA [100]† FixMatch [13]† PPF [55] † STOCO [52]† Dash [101]† MPL [102]† FlexMatch [14]† DST [54]† FullFlex [97]† FreeMatch [15]† FreeMatch (baseline)⋆ DPT (ours) with EDM and FreeMatch 74.34±1.76 74.61±0.26 74.66±2.12 70.09±1.60 36.19±6.48 9.88±1.03 10.62±3.75 7.47±0.28 7.71±3.06 7.18±1.95 8.93±3.11 6.62±0.91 4.97±0.06 5.00 4.44±0.15 4.90±0.04 4.93±0.13 4.68±0.17 46.24±1.29 46.49±2.20 41.03±1.79 37.46±3.30 13.63±0.59 6.30±0.05 5.16±0.06 4.86±0.05 4.84±0.17 4.78±0.30 5.16±0.23 5.76±0.24 4.98±0.09 - 4.39±0.04 4.88±0.18 - - Algorithm 1 Pseudocode of DPT in a PyTorch style. # Classifier : a classifier # Generative_model : conditional generative models , such as diffusion models # re al_ lab ele d_d ata : real labeled data # r e a l _ u n l a b e l e d _ d at a : real unlabeled data # all_real_images : all images in real labeled and unlabeled data # C : the number of classes in real labeled and unlabeled data # K : the number of pseudo samples # Uniform : uniform sampling function # ## first stage : # train a classifier Classifier . train ([( rea l_l abe led _d ata . images , r eal _la bel ed_ da ta . labels ) , ( r e a l _ u n l a b el e d _ d a t a . images , )]) # predict pseudo labels for all real images pseudo_labels = Classifier . predict ( all_real_images ) # ## second stage # train a conditional diffusion model G en erative_model . train ([( all_real_images , pseudo_labels )]) uniform_labels = Uniform (C , K ) # uniformly sample K labels from [0 , C ) # sample K pseudo images by Generative_model pseudo_images = Generative_model . sample ( uniform_labels ) # ## third stage # re - train the classifier Classifier . train ([( rea l_l abe led _d ata . images , re al_ lab ele d_d at a . labels ) , ( pseudo_images , uniform_labels ) , ( r e a l _ u n l a b el e d _ d a t a . images , )]) B Pseudocode of DPT Algorithm 1 presents the pseudocode of DPT in the PyTorch style. Based on the implementation of the classifier and the conditional generative model, DPT is easy to implement with a few lines of code in PyTorch. 19 Table 7: The code links and licenses. Method ADM LDM U-ViT DPM-Solver FreeMatch Semi-ViT MSN EDM Link https://github.com/openai/guided-diffusion https://github.com/CompVis/latent-diffusion https://github.com/baofff/U-ViT https://github.com/LuChengTHU/dpm-solver https://github.com/TorchSSL/TorchSSL https://github.com/amazon-science/semi-vit https://github.com/facebookresearch/msn https://github.com/NVlabs/edm License MIT License MIT License MIT License MIT License MIT License Apache License CC BY-NC 4.0 CC BY-NC-SA 4.0 Table 8: Model architectures in semi-supervised classifier and U-ViT. Model Param # Layers Hidden Size MLP Size # Heads Semi-Supervised Classifier (MSN) ViT B/4 ViT L/7 Semi-Supervised Classifier (Semi-ViT) ViT Huge Conditional Diffusion Model (U-ViT) U-ViT-Large U-ViT-Huge 86M 304M 632M 371M 585M 12 24 32 21 29 768 1024 1280 1024 1152 3072 4096 5120 4096 4608 12 16 16 16 16 C Experimental Setting We implement DPT upon the official code of LDM [25], DPM-Solver [84], ADM [4], MSN [17], Semi-ViT [16], EDM [6], FreeMatch [15] and U-ViT [5], whose code links and licenses are presented in Tab. 7. All the architectures and hyperparameters are the same as the corresponding baselines [5, 17, 16, 15, 6]. For completeness, we briefly mention important settings and refer the readers to the original paper for more details. We also report the computational cost in Appendix. D. SCDM. We extract features of ImageNet using the self-supervised method MSN [17] and perform k-means on these features to obtain meaningful cluster indices as conditions for training U-ViT-Large. Notably, in this way, we achieve an FID of 5.19 on ImageNet 256 × 256 without labels. However, the performance is still inferior to an FID of 3.31 achieved by supervised models. The usage of pseudo images in the third stage. We focus on using pseudo images at a resolution of 256 × 256 because this resolution is closest to the commonly applied 224 × 224 resolution used for ImageNet classification. It is worth noting that for MSN based DPT, we utilize pseudo images generated by U-ViT-Large, except in cases where the DPT employs ViT-B/4 and has five labels per class and we use pseudo images generated by U-ViT-Huge instead. This is done to explore whether the pseudo images from the more powerful generative model can provide additional benefits to the classifier. For Semi-ViT based DPT, we employ pseudo images generated by U-ViT-Huge. Network architectures. We present the network architectures in Tab. 8. MSN. MSN adopts a warm-up strategy over the first 15 epochs of training, which linearly increases the learning rate from 0.0002 to 0.001, and then decays the learning rate to 0 following a cosine schedule. The total training epochs are 200 and 300 for the architecture of ViT L/7 and ViT B/4, separately. The batch size is 1024 for both two architectures. Actually, we reuse the two pre-trained models ViT L/7 and ViT B/4 provided by MSN [17] to reduce the training cost. After extracting the features by MSN, we use the cyanure package [103] to train the classifier following MSN [17]. In particular, we run logistic regression on a single CPU core based on cyanure. U-ViT. U-ViT is based on the latent diffusion [25]. Specifically, we adopt two best configurations of U-ViT: U-ViT-Large and U-ViT-Huge. U-ViT-Large trains a transformer-based conditional generative 20 Table 9: The training time of DPT using U-ViT-H/2 and MSN with ViT-L/7 on ImageNet 256 × 256 with 5 labels per class. U-ViT-H/2 indicates that we use the U-ViT-Huge with the input patch size of 2 × 2. We present the percentage of additional computation cost of DPT in parentheses. Process V100-hours Cpu-hours Model Classifier Self supervised pre-training Extracting features Linear classification Generator Generation DPT (extra cost) Sampling Extracting features Linear classification 2850 30 - 5760 46 4 - DPT All training (sum all above) 8690 (0.57%) - - 1 - - - 3 4 model with a batch size of 1024, a training iteration of 300k, and a learning rate of 2e-4. U-ViT-Huge uses the same learning rate and batch size as U-ViT-Large but is trained for 500k iterations. EDM. We use EDM for conditional generation on CIFAR-10 dataset. EDM trains a conditional diffusion model with a batch size of 512, a training duration of 200 Mimg, and a learning rate 1e-3. Semi-ViT. We consider the best configuration of Semi-ViT with 1% labels, i.e., ViT-Huge. In the first stage, Semi-ViT uses the pre-training model of MAE. In the second stage, Semi-ViT trains a transformer-based classifier with a batch size of 128, a training epoch of 50, and a learning rate of 0.01. In the third stage, Semi-ViT trains a transformer-based classifier with a batch size of 64, a training epoch of 50, and a learning rate of 5e-3. FreeMatch. FreeMatch trains a WRN-28-2 model with a batch size of 64, a training iteration of 220, and a learning rate 0.03. D Computational Cost We present the detailed computational cost of MSN based DPT and Semi-ViT based DPT on ImageNet 256 × 256 in Tab. 9 and Tab. 10, respectively. DPT (extra cost) As illustrated in Tab. 9, DPT with MSN introduces an additional computation cost of approximately Classifier + Generator = 50 8640 = 0.57%, which is negligible. In particular, for conditional generation, the extra overhead we introduce is the cost of training the classifier. We reuse the pre-trained MSN to extract the features, and thus the training cost of the classifier can be reduced to only 30 V100-hours, which is negligible compared to the cost of the generator. For semi-supervised classification, the extra overhead we introduce is the cost of generative augmentation. The percentage of additional time cost over MSN is approximately 201.7%, calculated as Generator + DPT extra cost 2881 = 201.7%. Although DPT requires nearly twice the training time compared to the MSN baseline, it's still more time-efficient than other methods like Triple-GAN [11, 35], which demands at least 5 times the training time of its classifier. = 5813 Classifier DPT (extra cost) Classifier + Generator = Moreover, the percentage of additional computation cost of DPT with Semi-ViT is 3886 9664 = 40.21%, as shown in Tab. 10. Although Semi-ViT brings more accurate pseudo labels for conditional generation, it also needs more expensive training costs, creating a trade-off between label accuracy and computational expenses. Furthermore, the computational cost of DPT on CIFAR-10 is presented in Tab. 11. The percentage of Classifier + Generator = 169 additional computation cost of DPT is 552 = 30.62%. DPT (extra cost) E Thought experiment Classification and class-conditional generation are dual tasks that characterize opposite conditional distributions, e.g., p(label|image) and p(image|label). Learning such conditional distributions is con- 21 Table 10: The training time of DPT using Semi-ViT and U-ViT-H/2 on ImageNet 256 × 256 with 1% labels. U-ViT-H/2 indicates that we use the U-ViT-Huge with the input patch size of 2 × 2. We present the percentage of additional computation cost of DPT in parentheses. Model Classifier Process V100-hours Supervised fine-tuning Semi-supervised fine-tuning Generator Generation DPT (extra cost) Sampling Semi-supervised fine-tuning 64 3840 5760 46 3840 DPT All training (sum all above) 13550 (40.21%) Table 11: The training time of DPT using FreeMatch and EDM on CIFAR-10 with 4 labels per class. We present the percentage of additional computation cost of DPT in parentheses. Model Classifier Generator DPT (extra cost) Process Classification Generation Sampling Classification V100-hours 168 384 1 168 DPT All training (sum all above) 721 (30.62%) ceptually natural given a sufficient amount of image-label pairs. Recent advances in self-supervised learning5 [104, 105, 106, 28, 107, 29] and diffusion probabilistic models [1, 2, 3, 4, 5, 6] achieve excellent performance in the two tasks respectively. However, both learning tasks are nontrivial in semi-supervised learning, where only a small fraction of the data are labeled (see Sec. 4 for a comprehensive review). Most previous work solves the two tasks independently in semi-supervised learning while they can benefit mutually in intuition. The idea is best illustrated by a thought experiment with in- finite model capacity and zero optimization error. Let p(image) be the true marginal distribu- tion, from which we obtain massive samples in semi-supervised learning. Suppose we have a sub-optimal conditional distribution pc(label|image) characterized by a classifier, a joint distribu- tion pc(image, label) = pc(label|image)p(image) is induced by predicting pseudo-labels for un- labeled data. Meanwhile, a conditional generative model trained on sufficient pseudo data from pc(image, label) can induce the same joint distribution, as long as it is Fisher consistent6 [108]. Because the generative model can further leverage the real data in a complementary way to the classifier, the induced joint distribution (denoted as pg(image, label)) is probably closer to the true distribution than pc(image, label). Similarly, the classifier can be enhanced by training on pseudo data sampled from pg(image, label)). In conclusion, the classifier and the conditional generative model can benefit mutually through pseudo-labels and data in the ideal case. F Additional Results and Discussions F.1 More Samples and Failure Cases Fig. 4 shows more random samples generated by DPT, which are natural, diverse, and semantically consistent with the corresponding classes. 5Self-supervised methods learn representations without labels but require full labels to obtain p(label|image). 6It means that the returned hypothesis in a sufficiently expressive class can recover the true distribution given infinite data. 22 (a) Random samples with one label per class. Left: "Gondola". Right: "Yellow lady's slipper". (b) Random samples with two labels per class. Left: "Triceratops". Right: "Echidna". (c) Random samples with five labels per class. Left: "School bus". Right: "Fig". Figure 4: More random samples in specific classes from DPT. Moreover, Fig. 5 depicts the randomly generated images in selected classes, from DPT trained with one, two, and five real labels per class. As shown in Fig. 5 (a), if the classifier can make accurate predictions given one label per class, then DPT can generate images of high quality. However, we find failure cases of DPT in Fig. 5 (d) and (g), where the samples are of incorrect semantics due to the large noise in the pseudo-labels. Nevertheless, as the number of labels increases, the generation performance of DPT becomes better due to more accurate predictions. Notably, in Fig. 5, we fix the same random seed for image generation in the same class across DPT with a different number of labels (e.g., Fig. 5 (a-c)) for a fair and clear comparison. The samples of different models given the same random seed are similar because all models attempt to characterize the same diffusion ODE and the discretization of the ODE does not introduce extra noise [84], as observed in existing diffusion models [3, 5]. 23 (a) One label per class, P (0.93), R (0.98) (b) Two labels per class, P (0.97), R (0.97) (c) Five labels per class, P (0.97), R (0.97) (d) One label per class, P (0.08), R (0.00) (e) Two labels per class, P (0.79), R (0.85) (f) Five labels per class, P (0.94), R (0.99) (g) One label per class, P (0.02), R (0.02) Figure 5: Random samples by varying the number of real labels in the first stage. More real labels result in smaller noise in pseudo-labels and samples of better visual quality and correct semantics. Top: "Custard apple". Middle: "Geyser". Bottom: "Goldfish". (h) Two labels per class, P (0.60), R (0.98) (i) Five labels per class, P (0.65), R (0.98) F.2 How to use pseudo images in Semi-ViT For Semi-ViT based DPT, in order to fully leverage the pseudo images, we consider the two settings: (1) replaces S with S ∪ S2 in the third stage of Semi-ViT, which is mainly considered in the main text. (2) replaces S with S ∪ S2 in the two and third stages of Semi-ViT. As shown in Fig. 6, pseudo images indeed improve the performance of Semi-ViT. Besides, we also find that although the utilization of pseudo images in the second stage of Semi-ViT can provide initial points with high classification accuracy for the third stage, the final top-1 accuracy is lower than just utilizing pseudo images in the third stage of Semi-ViT. 24 (a) Top-1 Accuracy (b) Top-5 Accuracy Figure 6: Semi-ViT based DPT. 2 and 3 stage means that we replaces S with S ∪ S2 in the two and third stage of Semi-ViT. 3 stage means that we replaces S with S ∪ S2 in the third stage of Semi-ViT. (a-b) These two settings both improve the performance of Semi-ViT and stabilize the training. Table 12: Comparison with the state-of-the-art fully supervised models on ImageNet classifica- tion † labels the results taken from corresponding references and ⋆ labels the baselines reproduced by us. Method Data Top-1 Top-5 ResNet-50 [109]† ResNet-152 [109]† Inception-v3 [110]† Inception-v4 [95]† SENet-154 [111]† EfficientNet-L2 [112]† DeiT-B [113]† Swin-B [114]† MAE [29]† Semi-ViT [16]† Semi-ViT [16]⋆ DPT (ours) ImageNet ImageNet ImageNet ImageNet ImageNet ImageNet ImageNet ImageNet ImageNet 1% ImageNet 1% ImageNet 1% ImageNet 76.0 77.8 78.8 80.0 81.3 85.5 81.8 83.3 86.9 80.0 79.4 80.2 93.0 93.8 94.4 95.0 95.5 97.5 - - - 93.1 93.4 94.0 We also compare DPT with Semi-ViT and state-of-the-art fully supervised models (see Tab. 12) and find that DPT performs comparably to Inception-v4 [95], using only 1% labels. F.3 Results with More Stages According to Tab. 4, we find that using generative augmentation can lead to more accurate predictions on unlabeled images. Therefore, we attempt to add a further stage employing the refined classifier to predict pseudo-labels for all data, and then re-train the conditional generative model on them. As shown in Tab. 13, these refined pseudo-labels indeed bring a consistent improvement on all quantitative metrics, showing promising promotion of more-stage training. However, note that re- training the conditional generative model is time-consuming and we focus on the three-stage strategy in this paper for simplicity and efficiency. Table 13: Effect of refined pseudo-labels. Results on ImageNet 256 × 256 benchmark with one label per class. Method FID↓ sFID ↓ IS ↑ Precision ↑ Recall ↑ DPT DPT with refined pseudo-labels 4.34 4.00 6.68 6.56 162.96 178.05 0.80 0.81 0.53 0.53 25 F.4 Can DPT Improve the Upper Bound of Generation Quality When all labels are available, the second stage of DPT becomes equivalent to training a supervised diffusion model with real labels. This is essentially the same as a supervised conditional baseline. Therefore, by combining fully supervised labeled data, DPT will not surpass the baseline (e.g. 2.29 FID of U-ViT). G Ablation Studies Sensitivity of K. The most important hyperparameter in DPT is the number of augmented pseudo images per class, i.e., K. In order to analyze the sensitivity of DPT with respect to K, we perform a simple grid search on {12, 128, 256, 512, 1280} in MSN (ViT-L/7) with two and five labels per class and find that K = 128 is the best choice. Therefore, we set K = 128 as the default value if not specified (see Fig. 7 (c)). We observed that K = 128 was the optimal choice in both settings. Intuitively, an overly large K would cause the classifier to be dominated by pseudo images and ignore real data, which explains the sub-optimal performance with K > 128. Nevertheless, according to Fig. 7 (c), DPT consistently and substantially improved the baselines (K = 0) over a large range of values in {12, 128, 256, 512, 1280}. Sensitivity of CFG. In the third stage of DPT, we replaces S with S ∪ S2. The choice of w is highly non-trivial for the quality of pseudo images, Therefore, it is also significant for classification. We conducted experiments on the ImageNet dataset with five labels per class, sweeping over a range of values for w from 0.1 to 4.0, and evaluated the performance of the model in terms of FID-50K and top-1 Accuracy. The results are presented in Figure 7 (a-b). Moreover, we find that the choice of CFG that minimizes FID will lead to the best accuracy. Specifically, we find that CF G = 0.4 achieves the best performance for ImageNet 256 × 256, while CF G = 0.8 and CF G = 0.7 are the optimal choices for ImageNet 128 × 128 and 512 × 512, respectively. (a) (b) Figure 7: Sensitivity. (a-b) CF G is highly non-trivial for FID-50K and accuracy. When choosing the CF G that minimizes FID, accuracy tends to be higher, and to some extent, the higher the FID, the worse the accuracy will be. For ImageNet 256 × 256, CF G = 0.4 is the best choice. (c) DPT improves the baselines (K = 0) with K in a large range. K = 128 is the best choice. (c) H How Does Classifier Benefit Generation? We explain why the classifier can benefit the generative model through class-level visualization and analysis based on precision and recall on training data. For a given class y, the precision and recall w.r.t. the classifier is defined by P = TP/(TP + FP)7 and R = TP/(TP + FN), where TP, FP, and FN denote the number of true positive, false positive, and false negative samples respectively. Intuitively, higher P and R suggest smaller noise in pseudo-labels and result in better samples. Therefore, we employ strong semi-supervised learners [17] in the first stage to reduce the noise. We select three representative classes with different values of P and R and visualize the samples in Fig. 8. In particular, the pseudo-labels in a class with both high P and R contain little noise, leading to good samples (Fig. 8 (a)). In contrast, on one hand, a low P means that a large fraction of images labeled as y in S1 are not actually in class y, and the samples from the generative model given the 7We omit the dependence on y for simplicity. 26 (a) P(0.99),R(1.00) "Giant Panda" (b) P(0.16),R(0.75) "Purse" Figure 8: Random samples in selected classes with different P and R. (a) High P and R ensure good samples. (b) Low P leads to semantical confusion. (c) Low R lowers the visual quality. (c) P(0.99),R(0.23) "Hornbill" (a) Distribution of R (b) Distribution of P Figure 9: Distributions of R and P. The vertical axis represents the values of P and R w.r.t the classifier trained in the first stage. The horizontal axis represents all classes sorted by the values. label y can be semantically wrong (Fig. 8 (b)). On the other hand, a low R means that a large fraction of images in class y are misclassified as other labels and the samples from the generative model can be less realistic due to the lack of training images in class y (Fig. 8 (c)). Through the analysis of the three representative classes above, the classifier benefits the generator by bringing more accurate and low-noise pseudo labels to the generator. In particular, with one label per class, MSN [17] with ViT-L/7 achieves a top-1 training accuracy of 60.3%. As presented in Fig. 9, R and P of most classes are higher than 0.5. Quantitatively, despite using only < 0.1% of the labels, DPT achieves an FID of 3.08, compared to the FID of 2.29 achieved by U-ViT-Huge with full labels. The reduction in FID is not significant. This demonstrates that although noise exists, such a strong classifier can benefit the generative model overall and reduce the usage of labels. I How Does Generative Model Benefit Classification? Similarly to Appendix. H, we explain why the generative model can benefit the classifier through class-level visualization and analysis based on precision (P) and recall (R). We select three representative classes with different values of change of R for visualization in Fig. 10. If the pseudo images in class y are realistic, diverse, and semantically correct, then it can increase the corresponding R as presented in Fig. 10 (a-b). Instead, poor samples may hurt the classification performance in the corresponding class, as shown in Fig. 10 (c). The analysis of P involves pseudo images in multiple classes. According to the definition of precision (i.e. P = TP/(TP + FP)), the pseudo images can affect P through not only TP but also FP. We select two representative classes with positive changes of P to visualize both cases, as shown in Fig. 11. We select the top-three classes according to the number of images classified as "throne" and present the numbers w.r.t. the classifier after the first and third stages in Fig. 11 (a) and (b) respectively. As 27 (a) R (0.24 → 0.87) "Albatross" (b) R (0.22 → 0.75) "Timber wolf" Figure 10: Random samples in selected classes with different values of change of R. Values of change are presented in parentheses. (a-b) If pseudo images are realistic and semantically correct, they can benefit classification. (c) Otherwise, they hurt performance. (c) R (0.26 → 0.01) "Bathtub" shown in Fig. 11 (c), high-quality samples in the class "throne" directly increases TP (i.e., the number of images in class "throne" classified as "throne") and improves P. We also present the top-three classes related to "four poster" in Fig. 11 (d) and (e). It can be seen that P in class "four poster" increases because of FP (of class "quilt" especially) decreases. We visualize random samples in both "four poster" and "quilt" in Fig. 11 (f). These high-quality samples help the classifier to distinguish the two classes, which explains the change of FP and P. A similar analysis can be conducted for classes with negative change of P. We mention that we analyze the change of P and R in the third stage on the training set instead of the validation set. This is because the training set is of a much larger size and therefore leads to a much smaller variance in the estimate of P and R. Since most of the data are unlabeled in the training set, this does not introduce a large bias in the estimate of P and R. 28 (a) P = 0.67 without pseudo images. (b) P = 0.89 with pseudo images. (c) "Throne". (d) P = 0.52 without pseudo images. (e) P = 0.86 with pseudo images. (f) Left: "Four poster". Right: "Quilt". Figure 11: Detailed analysis in selected classes with a positive change of P. Top: "Throne". High-quality samples in the class "throne" (c) directly increase TP and improve P (a-b). Bottom: "Four poster". The samples in both "four poster" and "quilt" are of high quality (f). The classifier reduces FP with such pseudo samples and improves P (d-e). 29 (a) (b) Figure 12: 512×512 samples of DPT trained with five labels per class. CFG = 3.0 30 (a) (b) Figure 13: 512×512 samples of DPT trained with five labels per class. CFG = 3.0 31 (a) (b) Figure 14: 512×512 samples of DPT trained with five labels per class. CFG = 3.0 32
http://arxiv.org/abs/2302.10580v3
2023-04-20T04:44:17
2023-02-21T10:19:33
Classy Ensemble: A Novel Ensemble Algorithm for Classification
We present Classy Ensemble, a novel ensemble-generation algorithm for classification tasks, which aggregates models through a weighted combination of per-class accuracy. Tested over 153 machine learning datasets we demonstrate that Classy Ensemble outperforms two other well-known aggregation algorithms -- order-based pruning and clustering-based pruning -- as well as the recently introduced lexigarden ensemble generator. We then present three enhancements: 1) Classy Cluster Ensemble, which combines Classy Ensemble and cluster-based pruning; 2) Deep Learning experiments, showing the merits of Classy Ensemble over four image datasets: Fashion MNIST, CIFAR10, CIFAR100, and ImageNet; and 3) Classy Evolutionary Ensemble, wherein an evolutionary algorithm is used to select the set of models which Classy Ensemble picks from.
[ "Moshe Sipper" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10580v3", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10580v3", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.NE" ]
Springer Nature 2021 LATEX template 3 2 0 2 r p A 0 2 ] G L . s c [ 3 v 0 8 5 0 1 . 2 0 3 2 : v i X r a Classy Ensemble: A Novel Ensemble Algorithm for Classification Moshe Sipper1* 1*Department of Computer Science, Ben-Gurion University, Beer-Sheva, 84105, Israel. Corresponding author(s). E-mail(s): [email protected]; Abstract We present Classy Ensemble, a novel ensemble-generation algorithm for classification tasks, which aggregates models through a weighted combi- nation of per-class accuracy. Tested over 153 machine learning datasets we demonstrate that Classy Ensemble outperforms two other well-known aggregation algorithms-order-based pruning and clustering-based pruning-as well as the recently introduced lexigarden ensemble gener- ator. We then present three enhancements: 1) Classy Cluster Ensemble, which combines Classy Ensemble and cluster-based pruning; 2) Deep Learning experiments, showing the merits of Classy Ensemble over four image datasets: Fashion MNIST, CIFAR10, CIFAR100, and ImageNet; and 3) Classy Evolutionary Ensemble, wherein an evolutionary algorithm is used to select the set of models which Classy Ensemble picks from. Keywords: ensemble learning, classification, machine learning, deep learning, ImageNet 1 Introduction Ensemble techniques-which aggregate the outputs of several models to pro- duce a final prediction-are prevalent nowadays within the field of machine learning (ML) and deep learning (DL). Well-known methods such as bag- ging [1], boosting [2], and stacking [3] have been around for decades. These traditionally rely on the aggregation of many weak models. In more recent years the merits of combining strong models have been shown, which serves as the starting point for our work herein. We will present 1 Springer Nature 2021 LATEX template 2 Classy Ensemble: A Novel Ensemble Algorithm for Classification a novel ensemble-generation algorithm for classification tasks, called Classy Ensemble, which aggregates models by examining their per-class accuracy. Through extensive experimentation we will show that our new algorithm is often able to improve upon top ML algorithms. We shall also show strong results for DL models. The next section discusses ensemble learning. In Section 3 we describe our novel algorithm: Classy Ensemble . We delineate the experimental setup in Section 4, followed by results in Section 5, and a discussion in Section 6. Further experimentation on three enhancements is presented in Section 7, ending with concluding remarks in Section 8. 2 Ensemble Learning The field of ensemble learning has an illustrious history spanning several decades, and it is beyond the scope of this paper to survey it all. In several recent works we presented novel ensemble algorithms and we refer the reader to literature surveys therein (in particular, our most recent work [4]): • In [5, 6] we presented conservation machine learning, which conserves models across runs, users, and experiments. As part of this work we compared mul- tiple ensemble-generation methods, also introducing lexigarden, discussed below. • [7] presented SyRBo-Symbolic-Regression Boosting-an ensemble method based on strong learners that are combined via boosting, used to solve regression tasks. • [8] introduced AddGBoost, a gradient boosting-style algorithm, wherein the decision tree is replaced by a succession of stronger learners, which are optimized via a state-of-the-art hyperparameter optimizer. • [4] presented a comprehensive, stacking-based framework for combining deep learning with good old-fashioned machine learning, called Deep GOld. The framework involves ensemble selection from 51 retrained pretrained deep networks as first-level models, and 10 ML algorithms as second-level models. We continue in the vein of the above works, maintaining ensemble com- ponent models that are not weak, as usually done with bagging and boosting methods (going back to the seminal paper of Schapire, "The strength of weak learnability" [9]). On the contrary, we aim to find strong models, to be improved upon through "intelligent" aggregation. Ultimately, we chose to implement three ensemble-generation methods, which will be compared with our new Classy Ensemble (all code described herein is available at https://github.com/moshesipper): 1. Order-based pruning. We implemented two methods of ensemble pruning [6, 10]. The first, order-based, sorts all available models from best model to worst (according to validation score), and then selects the top k models for the ensemble, with k being a specified hyperparameter. We denote this Order Ensemble. Springer Nature 2021 LATEX template Classy Ensemble: A Novel Ensemble Algorithm for Classification 3 2. Clustering-based pruning. The second ensemble-pruning method performs k-means clustering over all model validation output vectors, with a given number of clusters, k, and then produces an ensemble by collecting the top- scoring model of each cluster. We denote this Cluster Ensemble (for more details see [6]). The above two ensemble algorithms were implemented as part of our research in [6], and re-implemented herein, with some programmatic improvements. 3. Lexigarden, introduced in [6], receives a collection of models, a dataset along with target values, and the number of models the generated "garden" (ensemble) is to contain-garden size. Lexigarden performs the following operations garden size times, to obtain en ensemble of models: randomly shuffle the dataset, then successively iterate through it, retaining only the models that provide a correct answer for each instance; ultimately we are left with either a single model or a small number of models (from which one is chosen at random)-these are precisely those models that have correctly classified the subset of the dataset engendered through the looping process. Lexigarden thus selects a diverse subset of all the models by picking ones that each excels on a particular random subset of instances. More details about lexigarden can be found in [6]. 3 Classy Ensemble Algorithm 1 implements basic ensemble functionality. As such, Order-based pruning (Order Ensemble) is obtained through the topk parameter of the init method. The class BasicEnsemble is also used by classes ClusterEnsemble and Lexigarden, which implement, respectively, Cluster Ensemble and Lexi- garden. Algorithm 1 BasicEnsemble 1: function init(models, topk=None) # models: list of fitted models # topk : how many top models to include in ensemble if topk is None then ensemble ← all models ensemble ← topk models else 2: 3: 4: 5: end if 6: 7: end function 8: function predict(X ) 9: 10: 11: end function predictions ← concatenate predictions of all models in ensemble over data X Compute and return majority prediction of each row (sample) in predictions Algorithm 2 delineates our new ensemble algorithm, Classy Ensemble. It receives as input a collection of fitted models, each one's overall accu- racy score, and per-class accuracy, i.e., each model's accuracy values as computed separately for every class (note: we used scikit-learn's [11] Springer Nature 2021 LATEX template 4 Classy Ensemble: A Novel Ensemble Algorithm for Classification balanced accuracy score, which avoids inflated performance estimates on imbalanced datasets). Algorithm 2 ClassyEnsemble 1: function init(models, n classes, topk ) # models: list of fitted models # n classes: number of classes in dataset # topk : how many top models to include in ensemble for c ← 1 to n classes do sorted ← sort models according to validation accuracy over class c for each model ∈ topk of sorted do if model /∈ ensemble then Add model to ensemble end if Mark model as voter for class c 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: end function end for end for 12: function predict(X ) 13: 14: 15: 16: 17: 18: predictions ← 0 # vector of appropriate dimensions for each model ∈ ensemble do sc ← model overall validation score cls ← model voter vector p ← model.predict proba(X) # prediction probabilities per class predictions += p * sc * cls # p is a matrix of dimensions number of samples × n classes, sc is a scalar, cls is a vector of size n classes; the matrix multiplication uses Python broadcasting 19: 20: 21: end function end for Return majority votes (per each sample) of predictions As seen in Algorithm 2, Classy Ensemble adds to the ensemble the topk best-performing (over validation set) models, for each class. A model may be in the topk set for more than one class. Thus, for each model in the ensemble, we also maintain a list of classes for which it is a voter, i.e., its output for each voter class is taken into account in the final aggregation. The binary voter vector of size n classes is set to 1 for classes the model is permitted to vote for, 0 otherwise. Thus, a model not in the ensemble is obviously not part of the final aggre- grated prediction; further, a model in the ensemble is only "allowed" to vote for those classes for which it is a voter-i.e., for classes it was amongst the topk. Classy Ensemble provides a prediction by aggregating its members' predicted-class probabilities, weighted by the overall validation score, and taking into account voter permissions. 4 Experimental Setup To test our new algorithm and compare it against the three benchmark ensem- ble algorithms described above (Order, Cluster, Lexigarden), we used the recently introduced PMLB repository of datasets [12]. A full experiment over a single dataset consisted of 30 replicate runs (described below). Of the 162 classification datasets in PMLB, we were able to complete full experiments for Springer Nature 2021 LATEX template Classy Ensemble: A Novel Ensemble Algorithm for Classification 5 153 datasets (we imposed a 10-hour limit to avoid overly lengthy runs, so that we could collect a sizeable chunk of results to analyze). The number of sam- ples was in the range 32 – 58,000, the number of features was in the range 2 – 1000, and the number of classes was in the range 2 – 18. Algorithm 3 details the experimental setup per dataset. Each replicate fits 250 randomly chosen models (from a set of 8 algorithms) to the dataset. For each model, the dataset is split randomly into training, validation, and test sets, the model is trained on the training set, and then validated on the validation set. The model with the highest validation score is tested on the test set. Algorithm 3 Experimental setup (per dataset) Input: dataset ← dataset to be used n replicates ← 30 n models ← 250 topk ← [1, 2, 3, 5, 20, 50, 100, n models] models ← {LogisticRegression, SGDClassifier, DecisionTreeClassifier, RandomForestClassifier, KNeighborsClassifier, AdaBoostClassifier, XGBClassifier, LGBMClassifier} Output: Statistics (over all replicates) for modeli ← 1 to n models do 1: for rep ← 1 to n replicates do 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: for k in topk do Randomly split dataset into training, validation, and test sets # 60-20-20% Fit StandardScaler to training set and apply fitted scaler to validation and test sets Select model at random from models Train model over training set and compute score over validation set end for Test model with best validation score over test set for ensemble in [OrderEnsemble, ClassyEnsemble, Lexigarden, ClusterEnsemble] do Generate ensemble with parameter k # k is top models for BasicEnsemble and ClassyEnsemble, garden size for Lexigarden, and number of clusters for ClusterEnsemble; validation set is used in ensemble generation end for best ensemble ← ensemble with highest validation score over k ∈ topk Test best ensemble over test set 12: 13: 14: 15: 16: end for 17: Compute test-set statistics over all replicates end for The experiment then proceeds to generate ensembles and assess their performance. For each of the four ensemble methods, an ensemble is gen- erated with hyperparameter k (top models, garden size, or number of clusters-depending on the ensemble method), with 8 values of k being used: [1, 2, 3, 5, 20, 50, 100, 250]. The ensemble that performs best on the validation data is tested on the test data. Note that we divided the training data further into training and validation sets, using the former to train the models, and the latter to pick the best model, as well as to compose the ensembles. This provides a better assessment of generalization capabilities, while still using what is essentially training data Springer Nature 2021 LATEX template 6 Classy Ensemble: A Novel Ensemble Algorithm for Classification (i.e., no data leakage). The test data is used only at the very end for final model or ensemble evaluation. 5 Results Table 1 shows the number of statistically significant "wins", i.e., datasets for which the 30-replicate experiment produced ensembles that bested the top single-model performers. We assessed statistical significance by performing a 10,000-round permutation test, comparing the median (test-set) scores of the replicates' single top models vs. ensembles; if the ensemble's median score was higher and the p-value was < 0.05, the improvement was considered significant. Table 1 Summary of results over 153 dataset experiments, as described in Section 4 and delineated in Algorithm 3. The statistics reported are for the test-set scores. Wins: Number of datasets for which the method bested the best single model in a statistically significant manner. Unique: Number of Wins for which the method was the only one to improve upon best single model. Size: Mean (SD) of median ensemble sizes per experiment. Best k: Mean (SD) of median best-k values per experiment, i.e., k values that produced best ensembles (Algorithm 3, lines 10–13) Ensemble Wins Unique Size Classy Ensemble Order Ensemble Cluster Ensemble Lexigarden 45 12 10 22 25 2 1 9 56 (69) 40 (44) 2.7 (1) 32 (32) Best k 27 (45) 40 (44) 2.7 (1) 32 (32) Note that in Table 1 'Size' and 'Best k' are equal for all but Classy Ensem- ble. This is to be expected since ensemble size matches the k value, except for Classy Ensemble, wherein k specifies selection of top k models per class, and thus the total number of models is usually larger. Table 2 shows the 45 datasets for which Classy Ensemble's win was significant, along with the models it won against. Table 3 shows dataset properties for the wins of each method. 6 Discussion Table 1 demonstrates the superiority of Classy Ensemble over other ensemble- generation methods, outperforming them by a wide margin. Further, it is able to improve results in a statistically significant manner on close to one third of the datasets. Examining Table 2, we observe that Classy Ensemble often beats top ML algorithms, such as XGBoost, LightGBM, Random Forest, and SGD. This adds strength to our argument regarding the potency of the newly proposed method. Springer Nature 2021 LATEX template Classy Ensemble: A Novel Ensemble Algorithm for Classification 7 Table 2 Left: Datasets for which Classy Ensemble improved upon the best single models in a statistically significant manner. Right: Best single models with counts, over the 30 replicate runs Dataset Best Single Models allbp allhyper analcatdata boxing2 analcatdata germangss analcatdata lawsuit ann thyroid auto cleveland nominal cmc colic dis dna ecoli flags Epistasis...1000... Epistasis...20... Heterogeneity...20... heart h heart statlog Hill Valley... hypothyroid ionosphere iris kr vs kp led7 lymphography magic mfeat fourier mfeat morphological mfeat pixel molecular biology... pendigits phoneme prnn fglass prnn synth satimage solar flare 1 solar flare 2 splice twonorm waveform 21 waveform 40 wdbc wine quality red wine quality white DecisionTreeClassifier: 30 XGBClassifier: 30 SGDClassifier: 30 SGDClassifier: 22, LGBMClassifier: 8 RandomForestClassifier: 25, SGDClassifier: 5 LGBMClassifier: 27, RandomForestClassifier: 3 XGBClassifier: 30 RandomForestClassifier: 29, SGDClassifier: 1 SGDClassifier: 30 SGDClassifier: 26, RandomForestClassifier: 3, KNeighborsClassifier: 1 DecisionTreeClassifier: 30 XGBClassifier: 30 KNeighborsClassifier: 29, SGDClassifier: 1 SGDClassifier: 29, LogisticRegression: 1 KNeighborsClassifier: 27, RandomForestClassifier: 3 LGBMClassifier: 28, RandomForestClassifier: 2 LGBMClassifier: 25, RandomForestClassifier: 5 SGDClassifier: 26, DecisionTreeClassifier: 3, RandomForestClassifier: 1 SGDClassifier: 29, RandomForestClassifier: 1 SGDClassifier: 25, DecisionTreeClassifier: 5 LGBMClassifier: 30 DecisionTreeClassifier: 30 SGDClassifier: 29, RandomForestClassifier: 1 RandomForestClassifier: 16, DecisionTreeClassifier: 14 SGDClassifier: 30 SGDClassifier: 29, AdaBoostClassifier: 1 RandomForestClassifier: 29, XGBClassifier: 1 RandomForestClassifier: 30 LogisticRegression: 25, SGDClassifier: 5 KNeighborsClassifier: 25, RandomForestClassifier: 5 RandomForestClassifier: 19, AdaBoostClassifier: 11 RandomForestClassifier: 25, LGBMClassifier: 5 RandomForestClassifier: 30 RandomForestClassifier: 17, DecisionTreeClassifier: 12, SGDClassifier: 1 DecisionTreeClassifier: 27, SGDClassifier: 3 LGBMClassifier: 30 SGDClassifier: 27, LGBMClassifier: 3 RandomForestClassifier: 26, SGDClassifier: 4 LGBMClassifier: 30 SGDClassifier: 28, RandomForestClassifier: 2 LogisticRegression: 19, SGDClassifier: 11 SGDClassifier: 28, RandomForestClassifier: 2 KNeighborsClassifier: 21, RandomForestClassifier: 7, SGDClassifier: 2 LGBMClassifier: 16, RandomForestClassifier: 13, SGDClassifier: 1 RandomForestClassifier: 30 Table 3 Dataset properties for the significant wins of each method (Table 1). Samples: Median number of samples. Features: Median number of features. Classes: Median number of classes Ensemble Samples Features Classes Classy Ensemble Order Ensemble Cluster Ensemble Lexigarden 1600 1473 951 690 20 16.5 27 22 3 2.5 2 2 Table 3 attempts to discern whether Classy Ensemble is better on some types of datasets than others. Conclusions from this table should be taken with a grain of salt as the number of wins is particularly small for Order Ensemble and Cluster Ensemble. That said, Classy Ensemble seems to be able to handle larger datasets with more classes. Springer Nature 2021 LATEX template 8 Classy Ensemble: A Novel Ensemble Algorithm for Classification 7 Enhancements Classy Cluster Ensemble. We next combined two of the above methods- the newly introduced Classy Ensemble and cluster-based pruning-to form Classy Cluster Ensemble: The model outputs are clustered, and the per-class sorting of Classy Ensemble is done per cluster, with the top models per class, per cluster, added to the ensemble. Technically, an additional outer loop is added above line 2 in Algorithm 2, looping over all clusters, and the sorting in line 3 is done over the cluster models rather than all models. While this proved effective, it still came in second to Classy Ensemble, with 38 significant datasets wins. We tested a second version of Classy Cluster Ensemble, wherein instead of maintaining a single global ensemble, we maintain an ensemble per cluster, but results were poor. Deep Learning. We experimented with deep networks by adapting the framework to run with PyTorch [13], using models we had trained in [4] (see Section 2). Four image datasets were employed (Table 4): Fashion MNIST, CIFAR10, CIFAR100, and ImageNet. Note that for these datasets there are public, given training and test sets. Table 4 DL datasets Dataset Images Classes Training Test Fashion MNIST 28x28 grayscale CIFAR10 CIFAR100 ImageNet 32x32 color 32x32 color 224x224 color 10 10 100 1000 60,000 50,000 50,000 1,281,167 10,000 10,000 10,000 50,000 We performed 3 runs for each dataset, each run with a set of 5 different models. Ensembles were generated with topk values of [1, 2, 3]. Results are shown in Table 5. Classy Evolutionary Ensemble. We observed in Table 5 that different sets of models given to Classy Ensemble to "pick from" yielded quite different results. We asked whether a good set could be derived algorithmically, instead of pre-specified manually (Pretrained1/2/3 in Table 5). Towards this end we devised a simple evolutionary algorithm, using the recently introduced EC- KitY package [14]. We focused on ImageNet, somewhat of a "holy grail" of DL classifica- tion, and undoubtedly significantly more difficult than the other 3 datasets in Table 5. We also went beyond the PyTorch pretrained models, obtaining better-performing models through timm-PyTorch Image Models [15]. The population comprised binary vectors, each representing a set of models given to Classy Ensemble, with a value of 1 in position i denoting inclusion of model i, and a value of 0 denoting exclusion of model i (of a list of 30 models given to the evolutionary algorithm as input). Springer Nature 2021 LATEX template Classy Ensemble: A Novel Ensemble Algorithm for Classification 9 Table 5 Accuracy results for DL runs: test-set accuracy of best single model vs. Classy Ensemble (the winner is boldfaced). Models: set of 5 models. Best: best single model test-set accuracy, with model in parentheses. Classy: best Classy Ensemble test-set accuracy, with best topk in parentheses Dataset Models Best Fashion MNIST CIFAR10 CIFAR100 ImageNet Pretrained1 Pretrained2 Pretrained3 Pretrained1 Pretrained2 Pretrained3 Pretrained1 Pretrained2 Pretrained3 Pretrained1 Pretrained2 Pretrained3 92.4% (efficientnet b6) 94.2% (vgg16 bn) 92.3% (resnet34) 77.0% (efficientnet b7) 87.8% (vgg16 bn) 76.2% (resnet18) 48.8% (efficientnet b7) 61.7% (vgg16 bn) 48.7% (resnet34) 79.3% (efficientnet b4) 74.2% (vgg19 bn) 78.3% (resnet152) Classy 93.0% (3) 94.7% (2) 93.6% (3) 79.9% (2) 89.8% (2) 79.4% (2) 53.0% (3) 68.4% (3) 52.5% (2) 80.3% (2) 74.0% (3) 78.9% (3) Pretrained1: {efficientnet b3, efficientnet b4, efficientnet b5, efficientnet b6, efficientnet b7} Pretrained2: {vgg13 bn, vgg16, vgg16 bn, vgg19, vgg19 bn} Pretrained3: {resnet18, resnet34, resnet50, resnet101, resnet152} To compute the fitness of a single individual in the population, the set of models it represented was given to Classy Ensemble (Algorithm 2) and the generated ensemble was tested on ImageNet's train set (we used a subset of the full train set to afford more runs). We experimented with 3 fitness functions: 1. accuracy, 2. accuracy + 1/ensemble size (to encourage small ensembles), 3. accuracy − cosine similarity of ensemble output vectors (to encourage diverse ensembles). Each evolutionary run used one of the 3 fitness functions, as well as a pre-set value of topk ∈ [1, 2, 3, 4, 5, 6, 7]. We performed a total of 63 evolutionary runs-3 per each (fitness, topk ) pair-with the (main) hyperparemeters being: population size – 200, gener- ation count – 20, tournament selection with tournament size 3, single-point crossover with probability 0.5, and bitwise mutation with probability 0.05. The best single-model test-set score was 86.1%, attained by model beitv2 base patch16 224. Classy Evolutionary Ensemble improved this to 86.4% (with topk = 5 and the first fitness function) by finding the following {maxvit xlarge 224, beitv2 base patch16 224, xcit large 24 p16 224 dist, swinv2 cr large 224, vit huge patch14 224, deit3 huge patch14 224}. of models: set Springer Nature 2021 LATEX template 10 Classy Ensemble: A Novel Ensemble Algorithm for Classification 8 Concluding Remarks We presented a novel ensemble-generation algorithm that takes a collection of fitted models and creates a potent ensemble. We demonstrated the efficacy of our algorithm by running experiments over 153 datasets. We note that the implementation of Classy Ensemble is fairly simple (and, as noted above, the code is available at https://github.com/moshesipper). It is straightforward to incorporate our method in one's setup, using models that are often available anyway, as part of multiple runs. We then enhanced our method to work with state-of-the-art DL models, showing that improvements could be attained. In the future we plan to continue work on improving the algorithm, e.g., use class-dependent weighting, which may prove useful where imbalanced datasets are concerned. We could perform a more in-depth analysis of datasets for which Classy Ensemble is successful. We also wish to further explore the merit of Classy Ensemble in deep network settings. Acknowledgments I thank Raz Lapid for helpful comments. Declarations • Funding: N/A • Conflict of interest/Competing interests: None • Ethics approval: N/A • Consent to participate: N/A • Consent for publication: N/A • Availability of data and materials: public datasets • Code availability: https://github.com/moshesipper • Authors' contributions: N/A, single author References [1] Breiman, L.: Bagging predictors. Machine learning 24(2), 123–140 (1996) [2] Freund, Y., Schapire, R.E.: A desicion-theoretic generalization of on-line learning and an application to boosting. In: European Conference on Computational Learning Theory, pp. 23–37 (1995). Springer [3] Wolpert, D.H.: Stacked generalization. Neural networks 5(2), 241–259 (1992) [4] Sipper, M.: Combining deep learning with good old-fashioned machine learning. SN Computer Science 4(1), 85 (2022) Springer Nature 2021 LATEX template Classy Ensemble: A Novel Ensemble Algorithm for Classification 11 [5] Sipper, M., Moore, J.H.: Conservation machine learning. BioData Mining 13(1), 9 (2020) [6] Sipper, M., Moore, J.H.: Conservation machine learning: a case study of random forests. Nature Scientific Reports 11(1), 3629 (2021) [7] Sipper, M., Moore, J.H.: Symbolic-regression boosting. Genetic Program- ming and Evolvable Machines 22, 357–381 (2021) [8] Sipper, M., Moore, J.H.: AddGBoost: A gradient boosting-style algorithm based on strong learners. Machine Learning with Applications 7, 100243 (2022) [9] Schapire, R.E.: The strength of weak learnability. Machine learning 5(2), 197–227 (1990) [10] Tsoumakas, G., Partalas, I., Vlahavas, I.: An ensemble pruning primer. In: Okun, O., Valentini, G. (eds.) Applications of Supervised and Unsu- pervised Ensemble Methods. Studies in Computational Intelligence vol. 245, pp. 1–13. Springer, Berlin, Heidelberg (2009) [11] Pedregosa, F., Varoquaux, G., Gramfort, A., Michel, V., Thirion, B., Grisel, O., Blondel, M., Prettenhofer, P., Weiss, R., Dubourg, V., Vander- plas, J., Passos, A., Cournapeau, D., Brucher, M., Perrot, M., Duchesnay, E.: Scikit-learn: Machine learning in Python. Journal of Machine Learning Research 12, 2825–2830 (2011) [12] Romano, J.D., Le, T.T., La Cava, W., Gregg, J.T., Goldberg, D.J., Chakraborty, P., Ray, N.L., Himmelstein, D., Fu, W., Moore, J.H.: PMLB v1.0: an open source dataset collection for benchmarking machine learning methods. arXiv preprint arXiv:2012.00058v2 (2021) [13] Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., Killeen, T., Lin, Z., Gimelshein, N., Antiga, L., et al.: PyTorch: An imperative style, high-performance deep learning library. arXiv preprint arXiv:1912.01703 (2019) [14] Sipper, M., Halperin, T., Tzruia, I., Elyasaf, A.: EC-KitY: Evolution- ary computation tool kit in Python with seamless machine learning integration. SoftwareX 22, 101381 (2023) [15] Wightman, R.: Pytorch image models. https://github.com/rwightman/pytorch-image-models (2019)
http://arxiv.org/abs/2302.10578v1
2023-02-21T10:14:13
2023-02-21T10:14:13
Don't guess what's true: choose what's optimal. A probability transducer for machine-learning classifiers
In fields such as medicine and drug discovery, the ultimate goal of a classification is not to guess a class, but to choose the optimal course of action among a set of possible ones, usually not in one-one correspondence with the set of classes. This decision-theoretic problem requires sensible probabilities for the classes. Probabilities conditional on the features are computationally almost impossible to find in many important cases. The main idea of the present work is to calculate probabilities conditional not on the features, but on the trained classifier's output. This calculation is cheap, needs to be made only once, and provides an output-to-probability "transducer" that can be applied to all future outputs of the classifier. In conjunction with problem-dependent utilities, the probabilities of the transducer allow us to find the optimal choice among the classes or among a set of more general decisions, by means of expected-utility maximization. This idea is demonstrated in a simplified drug-discovery problem with a highly imbalanced dataset. The transducer and utility maximization together always lead to improved results, sometimes close to theoretical maximum, for all sets of problem-dependent utilities. The one-time-only calculation of the transducer also provides, automatically: (i) a quantification of the uncertainty about the transducer itself; (ii) the expected utility of the augmented algorithm (including its uncertainty), which can be used for algorithm selection; (iii) the possibility of using the algorithm in a "generative mode", useful if the training dataset is biased.
[ "K. Dyrland", "A. S. Lundervold", "P. G. L. Porta Mana" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10578v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10578v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "physics.data-an", "stat.ML", "68T37, 68T07, 68Q87", "I.2.0; I.6.5" ]
Don't guess what's true: choose what's optimal A probability transducer for machine-learning classifiers K. Dyrland <kjetil.dyrland gmail.com> A. S. Lundervold † <alexander.selvikvag.lundervold hvl.no> P.G.L. Porta Mana <pgl portamana.org> (listed alphabetically) Dept of Computer science, Electrical Engineering and Mathematical Sciences, Western Norway University of Applied Sciences, Bergen, Norway †& Mohn Medical Imaging and Visualization Centre, Dept of Radiology, Haukeland University Hospital, Bergen, Norway Draft. 1 June 2022; updated 21 February 2023 In fields such as medicine and drug discovery, the ultimate goal of a classification is not to guess a class, but to choose the optimal course of action among a set of possible ones, usually not in one-one correspondence with the set of classes. This decision-theoretic problem requires sensible probabilities for the classes. Probabilities conditional on the features are computationally almost impossible to find in many important cases. The main idea of the present work is to calculate probabilities conditional not on the features, but on the trained classifier's output. This calculation is cheap, needs to be made only once, and provides an output-to-probability 'transducer' that can be applied to all future outputs of the classifier. In conjunction with problem- dependent utilities, the probabilities of the transducer allow us to find the optimal choice among the classes or among a set of more general decisions, by means of expected-utility maximization. This idea is demonstrated in a simplified drug-discovery problem with a highly imbalanced dataset. The transducer and utility maximization together always lead to improved results, sometimes close to theoretical maximum, for all sets of problem-dependent utilities. The one-time-only calculation of the transducer also provides, automatically: (i) a quantification of the uncertainty about the transducer itself; (ii) the expected utility of the augmented algorithm (including its uncertainty), which can be used for algorithm selection; (iii) the possibility of using the algorithm in a 'generative mode', useful if the training dataset is biased. 1 3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 8 7 5 0 1 . 2 0 3 2 : v i X r a r e p a p r e t t e L r o 4 A n o g n i t n i r p p u o w - t d n a i g n d a e r n e e r c s r o f d e n g i s e d s i t n e m u c o d s i h T Dyrland, Lundervold, Porta Mana Probability transducer for classifiers 1 The inadequacy of common classification approaches As the potential of using machine-learning algorithms in important fields such as medicine or drug discovery increases1, the machine- learning community ought to keep in mind what the actual needs and inference contexts in such fields are. We must avoid trying (intentionally or unintentionally) to convince such fields to change their needs, or to ignore their own contexts just to fit machine-learning solutions that are available and fashionable at the moment. Rather, we must make sure the that solutions fit needs & context, and amend them if they do not. The machine-learning mindset and approach to problems such as classification in such new important fields is often still inadequate in many respects. It reflects simpler needs and contexts of many inference problems successfully tackled by machine learning earlier on. A stereotypical 'cat vs dog' image classification, for instance, has four very important differences from a 'disease I vs disease II' medical classification, or from an 'active vs inactive' drug classification: (i) Nobody presumably dies or loses large amounts of money if a cat image is misclassified as dog or vice versa. But a person can die if a disease is misdiagnosed; huge capitals can be lost if an ultimately ineffective drug candidate is pursued. The gains and losses – or generally speaking the utilities – of correct and incorrect classifications in the former problem and in the two latter problems are vastly different. (ii) To what purpose do we try to guess whether an image's subject is a cat or a dog? For example because we must decide whether to put it in the folder 'cats' or in the folder 'dogs'. To what purpose do we try to guess a patient's disease or a compound's chemical activity? A clinician does not simply tell a patient "You probably have such-and-such disease. Goodbye!", but has to decide among many different kinds of treatments. The candidate drug compound may be discarded, pursued as it is, modified, and so on. The ultimate goal of a classification is always some kind of decision, not just a class guess. In the cat-vs-dog problem there is a natural one-one correspondence between classes and decisions. But in the medical or drug-discovery 1 Lundervold & Lundervold 2019; Chen et al. 2018; Green 2019. 2 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers problems the set of classes and the set of decisions are very different, and have even different numbers of elements. (iii) If there is a 70% probability that an image's subject is a cat, then it is natural to put it in the folder 'cats' rather than 'dogs' (if the decision is only between these two folders). If there is a 70% probability that a patient has a particular health condition, it may nonetheless be better to dismiss the patient – that is, to behave as if there was no condition. This is the optimal decision, for example, when the only available treatment for the condition would severely harm the patient if the condition were not present. Such treatment would be recommended only if the probability for the condition were much higher than 70%. Similarly, even if there is a 70% probability that a candidate drug is active it may nonetheless be best to discard it. This is the economically most advantageous choice if pursuing a false- positive leads to large economic losses. The target of a classification is not what's most probable, but what's optimal. (iv) The relation from image pixels to house-pet subject may be almost deterministic; so we are effectively looking for or extrapolating a function pet= f (pixels) contaminated by little noise. But the relation between medical-test scores or biochemical features on one side, and disease or drug activity on the other, is typically probabilistic; so a function disease = f (scores) or activity = f (features) does not even exist. We are assessing statistical relationships P(disease, scores) or P(activity, features) instead, which include deterministic ones as special cases. In summary, there is place to improve classifiers so as to (i) quantitat- ively take into account actual utilities, (ii) separate classes from decisions, (iii) target optimality rather than 'truth', (iv) output and use proper probabilities. In artificial intelligence and machine learning it is known how to address all these issues in principle – the theoretical framework is for example beautifully presented in the first 18 chapters or so of Russell & Norvig's 2022 text2. Issues (i)–(iii) are simply solved by adopting the standpoint of Decision Theory, which we briefly review in § 3 below and discuss at length in a 2 see also Self & Cheeseman 1987; Cheeseman 1988; 2018; Pearl 1988; MacKay 2005. 3 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers companion work3. In short: The set of decisions and the set of classes pertinent to a problem are separated if necessary. A utility is associated to each decision, relative to the occurrence of each particular class; these utilities are assembled into a utility matrix: one row per decision, one column per class. This matrix is multiplied by a column vector consisting in the probability for the classes. The resulting vector of numbers contains the expected utility of each decision. Finally we select the decision having maximal expected utility, according to the principle bearing this name. Such procedure also takes care of the class imbalance problem4. Clearly this procedure is computationally inexpensive and ridicu- lously easy to implement in any machine-learning classifier. The difficulty is that this procedure requires sensible probabilities5 for the classes, which brings us to issue (iv), the most difficult. Some machine-learning algorithms for classification, such as support- vector machines, output only a class label. Others, such as deep networks, output a set of real numbers that can bear some qualitative relation to the plausibilities of the classes. But these numbers cannot be reliably in- terpreted as proper probabilities, that is, as the degrees of belief assigned to the classes by a rational agent6; or, in terms of 'populations'7, as the expected frequencies of the classes in the hypothetical population of units (degrees of belief and frequencies being related by de Finetti's theorem8). Algorithms that internally do perform probabilistic calculations, for instance naive-Bayes or logistic-regression classifiers9, unfortunately rest on strong probabilistic assumptions, such as independence and particular shapes of distributions, that are often unrealistic (and their consistency with the specific application is rarely checked). Only particular classifiers such as Bayesian neural networks10 output sensible probabilities, but they are computationally very expensive. The stumbling block is the extremely high dimensionality of the feature space, which makes the calculation of the conditional probabilities P(class, feature | training data) 3 Dyrland et al. 2022a. 'cost' instead of 'utility'). there were any rational men" Good 1966. Russell & Norvig 2022 chs 2, 12, 13. 2000 ch. 4; Dawid 2013. ch. 10, § 17.4. 4 cf. the analysis by Drummond & Holte 2005 (they use the term 5 "credibilities [that] would be agreed by all rational men if 6 MacKay 1992a; Gal & Ghahramani 2016; 8 Bernardo & Smith 9 Murphy 2012 § 3.5, ch. 8; Bishop 2006 §§ 8.2, 4.3; Barber 2020 10 Neal & Zhang 2006; Bishop 2006 § 5.7. 7 Lindley & Novick 1981. 4 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers (a problem opaquely called 'density regression' or 'density estimation'11) computationally unfeasible. If we solved the issue of outputting proper probabilities then the remaining three issues would be easy to solve, as discussed above. In the present work we propose an alternative solution to calculate proper class probabilities, which can then be used in conjunction with utilities to perform the final classification or decision. This solution consists in a sort of 'transducer' that transforms the algorithm's raw output into a probability. This probability transducer has a low computational cost, can be applied to all commonly used classifiers and to simple regression algorithms, does not need any changes in algorithm architecture or in training procedures, and is grounded on first principles. The probability obtained from the transducer can be combined with utilities to perform the final classification or decision task. Notably, the set of available decisions and their utilities can be changed on the fly, for each new classification instance. This probability transducer also has three other great benefits, which come automatically with its computation. First, it gives a quantification of how much the probability would change if we had further data to calculate the transducer. Second, it can give an evaluation of the whole classifier – including an uncertainty about such evaluation – that allows us to compare it with other classifiers and choose the optimal one. Third, it allows us to calculate both the probability of class conditional on features, and the probability of features conditional on class. In other words it allows us to use the classification algorithm in both 'discriminative' and 'generative' modes12, even if the algorithm was not designed for a generative use. In § 2 we present the general idea behind the probability transducer and its calculation. Its combination with the rule of expected-utility maximization to perform classification is discussed in § 3; we call this combined use the 'augmentation' of a classifier. In § 4 we demonstrate the implementation, use, and benefits of clas- sifier augmentation in a concrete drug-discovery classification problem and dataset, with a random forest and a convolutional neural network classifiers. 11 Ferguson 1983; Thorburn 1986; Hjort 1996; Dunson et al. 2007. 2022 § 21.2.3; Murphy 2012 § 8.6. 12 Russell & Norvig 5 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers Section 5 offers a synopsis of further benefits and uses of the prob- ability transducer, which are obtained almost automatically from its calculation. Finally, we give a summary and discussion in § 6, including some teasers of further applications to be discussed in future work. 2 An output-to-probability transducer 2.1 Main idea: algorithm output as a proxy for the features Let us first consider the essentials behind a classification (or regression) problem. We have the following quantities: • the feature values of a set of known units, • the classes of the same set of units, which together form our learning or training data; and • the feature value of a new unit, where the 'units' could be widgets, images, patients, drug compounds, and so on, depending on the classification problem. From these quantities we would like to infer • the class of the new unit. This inference consists in probabilities P(class of new unit | feature of new unit, classes & features of known units) (1) for each possible class. These probabilities are obtained through the rules of the probability calculus13; in this case specifically through the so-called de Finetti theorem14 which connects training data and new unit. This theorem is briefly summarized in appendix B.1. Combined with a set of utilities, these probabilities allow us to determ- ine an optimal, further decision to be made among a set of alternatives. Note that the inference (1) includes deterministic interpolation, i.e. the assessment of a function class = f (feature), as a special case, when the probabilities are essentially 0s and 1s. 13 Jaynes 2003; Russell & Norvig 2022 chs 12–13; Gregory 2005; Hailperin 2011; Jeffreys 14 Bernardo & Smith 2000 ch. 4; Dawid 2013. 1983:see further references in appendix B. 6 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers A trained classifier should ideally output the probabilities above when applied to the new unit. Machine-learning classifiers trade this capability for computational speed – with an increase in the latter of several orders of magnitude15. Thus their output cannot be considered a probability, but it still carries information about both class and feature variables. Our first step is to acknowledge that the information contained in the feature and in the training data, relevant to the class of the new unit, is simply inaccessible to us because of computational limitations. We do have access to the output for the new unit, however, which does carry relevant information. Thus what we can do is to calculate the probability P(class of new unit | output for new unit) (2) for each class. Once we calculate the numerical values of these conditional probab- ilities, we effectively have a function that maps the algorithm's output to class probabilities. It therefore acts as an output-to-probability transducer. This idea can also be informally understood in two ways. First: the classifier's output is regarded as a proxy for the feature. Second: the classifier is regarded as something analogous to a diagnostic test, such as any common diagnostic or prognostic test used in medicine for example. A diagnostic test is useful because its result has a probabilistic relationship with the unknown of interest, say, a medical condition. This relationship is easier to quantify than the one between the condition and the more complex biological variables that the test is exploiting 'under the hood'. Likewise, the output of a classifier has a probabilistic relationship with the unknown class (owing to the training process); and this relationship is in many cases easier to quantify than the one between the class and the typically complex 'features' that are the classifier's input. We do not take diagnostic-test results at face value – if a flu test is 'positive' we do not conclude that the patient has the flu – but rather arrive at a probability that the patient has the flu, given some statistics about results of tests performed on verified samples of true-positive and true-negative patients16. Analogously, we need some calibration data to find the probabilities (2). 15 to understand this trade-off in the case of neural-network classifiers see e.g. MacKay 1992b,c,a; Murphy 2012 § 16.5 esp. 16.5.7; see also the discussion by Self & Cheeseman 16 Sox et al. 2013 ch. 5; Hunink et al. 2014 ch. 5; see also Jenny et al. 2018. 1987. 7 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers 2.2 Calibration data To calculate the conditional probabilities (2) it is necessary to have examples of further pairs (class of unit, output for unit), of which the new unit's pair can be considered a 'representative sample'17 and vice versa – exactly for the same reason why we need training data in the first place to calculate the probability of a class given the feature. Or, with a more precise term, the examples and the new unit must be exchangeable18. For this purpose, can we use the pairs (class of unit, output for unit) of the training data? This would be very convenient, as those pairs are readily available. But answer is no. The reason is that the outputs of the training data are produced from the features and the classes jointly; this is the very point of the training phase. There is therefore a direct informational dependence between the classes and the outputs of the training data. For the new unit, on the other hand, the classifier produces its output from the feature alone. As regards the probabilistic relation between class and output, the new unit is not exchangeable with (or a representative sample of) the training data. We need a data set where the outputs are generated by simple application of the algorithm to the feature, as it would occur in its concrete use, and the classes are known. The test data of standard machine-learning procedures are exactly what we need. The new unit can be considered exchangeable with the test data. We rename such data 'transducer-calibration data', owing to its new purpose. The probability we want to calculate is therefore P(class of new unit | output for new unit, classes & outputs of calibr. data) . (3) For classification algorithms that output a quantity much simpler than the features, like a vector of few real components for instance, the probability above can be exactly calculated. Thus, once we obtain the classifier's output for the new unit, we can calculate a probability for the new unit's class. The probability values (4), for a fixed class and variable output, con- stitute a sort of 'calibration curve' (or hypersurface for multidimensional outputs) of the output-to-probability transducer for the classifier. See the concrete examples of figs 1 on page 16, and 2 on page 18. It must be 17 for a critical analysis of the sometimes hollow term 'representative sample' see Kruskal 18 Lindley & Novick 1981. & Mosteller 1979a,b,c; 1980. 8 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers stressed that such curve needs to be calculated only once, and it can be used for all further applications of the classifier to new units. What is the relation between the ideal incomputable probability (1) and the probability (4) obtained by proxy? If the output y of the classifier is already very close to the ideal probability (1), or a monotonic function thereof, isn't the proxy probability (4) throwing it away and replacing it with something different? Quite the opposite. Owing to de Finetti's theorem, if the output y is almost identical with the ideal probability, then it becomes increasingly close to the frequency distribution of the training data, as their number increases (see appendix B.1); the same happens with the proxy probability and the frequency distribution of the calibration data. But these two data sets should be representative of each other and of future data – otherwise we would be 'learning' from irrelevant data – and therefore their frequency distributions should also converge to each other. Consequently, by transitivity we expect the proxy probability to become increasingly close to the output y. Actually, if the output is not exactly the ideal probability (1) but a monotonic function of it, the proxy probability (4) will reverse such monotonic relationship, giving us back the ideal probability. Obviously all these considerations only hold if we have good training and calibration sets, exchangeable with (representative of) the real data that will occur in our application. Since we are using as calibration data the data traditionally set aside as 'test data' instead, an important question arises. Do we then need a third, separate test dataset for the final evaluation and comparison of candidate classifiers or hyperparameters? This would be inconvenient: it would reduce the amount of data available for training. The answer is no: the calibration set automatically also acts as a test set. In fact, from the calculations for the probability transducer, discussed in the next section, we can also arrive at a final evaluation value for the algorithm as a whole. See § 5.2 and appendix B.5 for more details about this. It may be useful to explain why this is the case, especially for those who may mistakenly take for granted the universal necessity of a test set. Many standard machine-learning methodologies need a test set because they are only an approximation of the ideal inference performed with the probability calculus. The latter needs no division of available data 9 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers into different sets: something analogous to such division is automatically made internally, so to speak (see appendix B.1). It can be shown19 that the mathematical operations behind the probability rules correspond to making all possible divisions of available data between 'training' and 'test', as well as all possible cross-validations with folds of all orders. It is this completeness and thoroughness that makes the ideal inference by means of the probability calculus almost computationally impossible in some cases. We thus resort to approximate but faster machine-learning methods. These methods do not typically perform such data partitions 'internally' and automatically, so we need to make them – and only approximately – by hand. Let us stress that the performance of a classifier equipped with a probability transducer still depends on the training of the raw classifier, which is the stage where a probabilistic relation between output and class is established. If the classifier's output has no mutual information with the true class (their probabilities are essentially independent), then the transducer will simply yield a uniform probability over the classes. The question then arises of what is the optimal division of available data into the training set and the calibration set. If the calibration set is too small, the transducer curve is unreliable. If the training set is too small, the correlation between output and class is unreliable. In future work we would like to find the optimal balance, possibly by a first-principle calculation. 2.3 Calculation of the probabilities Let us denote by c the class value of a new unit, by y the output of the classifier for the new unit, and by D := {ci , yi } the classes and classifier outputs for the transducer-calibration data. It is more convenient to focus on the joint probability of class and output given the data, p(c, y | D) , (4) rather than on the conditional probability of the class given the output and calibration data, (4). 19 Porta Mana 2019; Fong & Holmes 2020; Wald 1949; many examples of this fact are scattered across the text by Jaynes 2003. 10 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers The joint probability is calculated using standard non-parametric Bayesian methods20. 'Non-parametric' in this case means that we do not make any assumptions about the shape of the probability curve as a function of c, y (contrast this with logistic regression, for instance), or about special independence between the variables (contrast this with naive-Bayes). The only assumption made – and we believe it is quite realistic – is that the curve must have some minimal degree of smoothness. This assumption allows for much leeway, however: figs 1 and 3 for instance show that the probability curve can still have very sharp bends, as long as they are not cusps. Non-parametric methods differ from one another in the kind of 'coordinate system' they select on the infinite-dimensional space of all possible probability curves, that is, in the way they represent a general positive normalized function. We choose the representation discussed by Dunson & Bhattacharya21. The end result of interest in the present section is that the probability density p(c, y | D), with c discrete and y continuous and possibly multi- dimensional, is expressed as a sum p(c, y | D) = (cid:88) k qk A(c | αk) B(y | βk) (5) of a finite but large number of terms22. Each term is the product of a positive weight qk, a probability distribution A(c | αk) for c depending on parameters αk, and a probability density B(c | βk) for y depending on parameters βk. These distributions are chosen by us according to convenience; see the appendix B.1 for further details. The parameter values can be different from term to term, as indicated by the index k. The weights {qk } are normalized. For simplicity we shall from now on omit the dependence ' | . . . , D)' on the calibration data, leaving it implicitly understood. This mathematical representation can approximate (under some norm) any smooth probability density in c and y. It has the advantages of being automatically positive and normalized, and of readily producing 20 for introductions and reviews see e.g. Walker 2013; Müller & Quintana 2004; Hjort 1996. 21 Dunson & Bhattacharya 2011; see also the special case discussed by Rasmussen 1999. 22 see Ishwaran & Zarepour 2002 on why the number of terms does not need to be infinite. 11 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers the marginal distributions for c and for y: p(c) = (cid:88) k qk A(c | αk) , p(y) = (cid:88) k qk B(y | βk) , (6) from which also the conditional distributions are easily obtained: p(c | y) = p(y | c) = (cid:88) k (cid:88) k (cid:80) qk B(y | βk) l ql B(y | βl) (cid:80) qk A(c | αk) l ql A(c | αl) A(c | αk) B(y | βk) . (7a) (7b) In the rest of the paper we shall use formula (7a), the probability of the class given the algorithm's output, as typically done with discriminative algorithms. The weights and parameters {qk , αk , βk } are the heart of this repres- entation, because the shape of the probability curve p(c | y, D) depends on their values. They are determined by the test data D. Their calcu- lation is done via Markov-chain Monte Carlo sampling, discussed in appendix B.3. For low-dimensional y and discrete c (or even continuous, low-dimensional c, which means we are working with a regression algorithm), this calculation can be done in a matter of hours, and it only needs to be done once. Once calculated, these parameters are saved in memory and can be used to compute any of the probabilities (5), (6), (7) as needed, as discussed in the next subsection. Such computations take less than a second. Note that the role of the classifier in this calculation is simply to produce the outputs y for the calibration data, after having been trained in any standard way on a training data set. No changes in its architecture or in its training procedure have been made, nor are any required. 3 Utility-based classification We refer to our companion work Dyrland et al. 2022a, § 2, for a more de- tailed presentation of decision theory and for references. In the following we assume familiarity with the material presented there. Our classification or decision problem has a set of decisions, which we can index by i = 1, 2, . . . . As discussed in § 1, these need not be 12 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers the same as the possible classes; the two sets may even be different in number. But the true class, which is unknown, determines the utility that a decision yields. If we choose decision i and the class c is true, our eventual utility will be Uic.23 These utilities are assembled into a rectangular matrix (Uic) with one row per decision and one column per class. Note that the case where decisions and classes are in a natural one-one correspondence, as in the cat-vs-dog classification example of § 1, is just a particular case of this more general point of view. In such a specific case we may replace 'decision' with 'class' in the following discussion, and the utility matrix is square. Now let us consider the application of the algorithm, with the probabilities calculated in the preceding section, to a new unit. 1. Fed the unit's features to the classifier, which outputs the real value y. 2. Calculate p(c | y), for each value of c, from formula (7a), using the parameters {qk , αk , βk } stored in memory. These are the prob- abilities of the classes, which are collected in a column vector (pc). 3. The expected utility ̄Ui of decision i is given by the matrix product of an appropriate utility matrix (Uic) and the column vector (pc): (cid:88) ̄Ui := Uic pc . (8) c 4. Choose the decision i∗ having largest ̄Ui, according to the principle of maximum expected utility: choose i∗ = arg max i (cid:8) ̄Ui (cid:9) ≡ arg max i (cid:26)(cid:88) (cid:27) Uic pc c (9) We call the procedure above, especially steps 2.–4., the augmentation of the classifier. In step 2. we have effectively translated the classifier's raw output into a more sensible probability. From this point of view the function 23 We apologize for the difference in notation from our companion work, where the class variable is 'j' and the utilities 'Uij ' 13 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers p(c | y) can be considered as a more appropriate substitute of the softmax function, for instance, at the output of a neural network (compare fig. 2). The matrix multiplication of and subsequent selection of steps 3.–4. are computationally inexpensive; they can be considered as substitutes of the 'argmax' selection that typically happen at the continuous output of a classifier. It should be noted that the utilities Uic used in step 3. can either be the same for each new unit, or different from unit to unit. The augmentation procedure is therefore extremely flexible, at no additional computational cost. 4 Demonstration 4.1 Overview We illustrate the implementation of the probability transducer and its combination with utility-based decisions in a concrete example. The evaluation of the results is also made from the standpoint of decision theory, using utility-based metrics, as explained in our companion paper24. A couple of remarks may clarify the purpose of this illustration and our choice of classification problem. The internal consistency of decision theory guarantees that utility- based decisions always improve on, or at least give as good results as, any other procedure, including the standard classification procedures used in machine learning. This is intuitively obvious: we are, after all, grounding our single class choices upon the same gains & losses that underlie our classification problem and that are used in its evaluation. The present illustration is therefore not a proof for such improvement – none is needed. It is a reassuring safety check, though: if the results were negative it would mean that errors were made in applying the method or in the computations. Rather than looking for some classification problem and dataset on which the decision-theoretic approach could lead to astounding improvements, we choose one where machine-learning classifiers already give excellent results, therefore difficult to improve upon; and which 24 Dyrland et al. 2022a. 14 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers is characterized by a naturally high class imbalance. The classification problem is moreover of interest to us for other ongoing research projects. The binary-classification task is a simplified version of an early-stage drug-discovery problem: to determine whether a molecule is chemically 'inactive' (class 0) or 'active' (class 1) towards one specific target protein. Two machine-learning classifiers are considered: a Random Forest and a residual Convolutional Neural Network (ResNet), details of which are given in appendix A. The random forest takes as input a set of particular physico-chemical characteristics of a molecule, and outputs a real number in the range [0, 1], corresponding to the fraction of decision trees which vote for class 1, 'active'. The convolutional-neural-network takes as input an image representing the chemical and spatial structure of the molecule, and outputs two real numbers roughly corresponding to scores for the two classes. We use data from the ChEMBL database25, previously used in the literature for other studies of machine-learning applications to drug discovery26. One set with 60% of the data is used to train and validate the two classifiers. One set with 20% is used for the calibration of the probability transducer and evaluation of the classifiers. One further data set with 20% is here used as fictive 'real data' to illustrate the results of our procedure; we call this the 'demonstration set'. Note that the additional demonstration dataset has an illustrative purpose only for the sake of the present example. In a real design & evaluation of a set of candidate classifiers, the calibration set will at the same time be the evaluation test set, and no further data subset will be necessary, as explained in § 2.2. In all data sets, class 0 ('inactive') occurs with a 91% relative frequency, and class 1 ('active') with 9%; a high class imbalance. Technical details about the setup and training of the two classifiers and of the calculation of the probability-transducer parameters are given in appendix B.3. 4.2 Probability-transducer curves Mathematical details about the expression of the joint probability p(c, y), eq. (5), for the random forest and the convolutional neural network are given in appendix B.3. 25 Bento et al. 2014. 26 Koutsoukas et al. 2017. 15 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers Figure 1 Probabilities of class 1 ('active', blue solid curve) and class 0 ('inactive', red dashed curve) conditional on the random-forest output. Their extremal values are 0.0014 and 0.929. The random-forest output clearly cannot be interpreted as a probability. The shaded region around each curve represents its 12.5%–87.5% range of possible variability if more data were used to calculate the probabilities. Random forest Figure 1 shows the probabilities of classes 1 and 0 conditional on the random-forest output: p(class 1 | output) and p(class 0 | output). It also shows the range of variability that these probabilities could have if more data were used for the calibration: with a 75% probability they would remain within the shaded regions. This variability information is provided for free by the calculation; we plan to discuss and use it more 16 0.00.10.20.30.40.50.60.70.80.91.00.00.10.20.30.40.50.60.70.80.91.0outputP (class | output)class 1class 0 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers in future work. This curve is not a straight line, which means that the random-forest output cannot be interpreted as a probability. Note that for an output of around 0.32 both classes are equally probable. For an output of 0.5, class 1 has a probability of around 75%. The probabilities increase (class 1) or decrease (class 0) monotonic- ally up to output values of around 0.9. The minimum and maximum probabilities are 0.14% and 92.9%; these values will be important for a later discussion. The output, if interpreted as a probability for class 1 ('active'), tends to be too pessimistic for this class (and too optimistic for the other) in a range from roughly 0.25 to 0.95; and too optimistic outside this range. For instance, for an output of 0.3 the probability for class 1 is 40%; for an output of 1 the probability for class 1 is 92%. Convolutional neural network Figure 2 shows the probability of class 1 conditional on the bivariate output of the convolutional neural network, p(class 1|outputs). Its extremal values are 0.14% and 92.3%. It is interesting to compare this probability with the softmax function of the outputs, shown in the smaller side plot, typically used as a proxy for the probability. A cross-section of this probability surface along the bisector of the II and IV quadrants of the output space is shown in fig. 3, together with the cross-section of the softmax. The probability takes on extremal values, around 1% and 90%, only in very narrow ranges, and quickly returns and extrapolates to 50% everywhere else. The softmax, on the other hand, extrapolates to extreme probability values – a known problem of neural networks27. The conservative extrapolation of the transducer is also reflected in the 75% interval of possible variability of the probability (shaded region), which becomes extremely wide at the extremities. 4.3 Results on demonstration data The essential point of the decision-theoretic approach is that we first need to specify the utilities involved in the classification problem, because they determine (i) together with the probabilities, which class we choose in each single instance; (ii) the metric to evaluate a classifier's performance. 27 Gal & Ghahramani 2016. 17 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers Figure 2 Probability of class 1 conditional on the convolutional-neural-network outputs. Its extremal val- ues are 0.0014 and 0.923. Plot on the side: softmax function of the same outputs, for comparison. The utilities are assembled into a utility matrix which we write in the format true class 1 0 (cid:20) n o i s i c e d 0 1 True 0 False 0 False 1 True 1 (cid:21) . (10) 18 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers Figure 3 Cross-section of the probability surface of fig. 2 across the bisector of the II and IV quadrants of output space. The shaded region represents the 12.5%–87.5% range of possible variability upon increase of the calibration dataset. The cross-section of the softmax function (grey dashed curve) is also shown for comparison. We call equivalent two utility matrices that differ by a constant additive term and a positive multiplicative term, since changes in the zero or unit of measurement of utilities do not affect comparative evaluations. For illustration we choose four utility matrices: utility case I (cid:21) (cid:20)1 0 0 1 utility case II (cid:21) (cid:20)1 −10 10 0 utility case III (cid:20) (cid:21) 0 1 −10 10 utility case IV (cid:21) (cid:20) 10 −10 0 1 . (11) Case I represents any case where the correct classification of either class is equally valuable; and the incorrect classification, equally invaluable. (cid:3) Note that this utility matrix is equivalent to any other of the form (cid:2) a b with a > b. Accuracy is the correct metric to evaluate this case. Case II represents any case where the correct classification of class 1, 'active' or 'positive', is ten times more valuable than that of class 0, 'inactive' or 'negative', and its incorrect classification is as damaging as correct classification is valuable. The remaining two cases are interpreted in an b a 19 −10−8−6−4−202468100.00.10.20.30.40.50.60.70.80.91.0output 1=-output 0P (class 1 | output 1=-output 0)softmax Dyrland, Lundervold, Porta Mana Probability transducer for classifiers analogous way. The 'value' could simply be the final average monetary revenue at the end of the drug-discovery project that typically follows any of these four situations. Of particular relevance to drug discovery, where false positives are known to be especially costly28, is the utility matrix of case II and possibly that of case III. We consider each of these utility matrices, in turn, to be the one underlying our classification problem. In each case we perform the classification of every item – a molecule – in the demonstration data as follows: 1. feed the features of the item to the classifier and record its output 2. feed this output to the probability transducer and record the result- ing probability for class 1; form the normalized probability vector for the two classes 3. multiply the probability vector by the utility matrix to determine the expected utility of each class choice, eq. (8) 4. choose the class with higher expected utility (ties have to be decided unsystematically, to avoid biased results), eq. (9). Confusion matrices – and a peculiar situation Once all items in the demonstration dataset are classified, we compare their chosen classes with their true ones and compute the resulting confusion matrix, which we also write in the format (10). The confusion matrices for all cases, methods, and algorithms are presented in table 1 on page 23. Ties (both classes were equally preferable) are solved by giving half a point to each class. The standard method produces the same confusion matrix in all four utility cases because it does not use utilities to choose a class. The augmentation produces instead a different confusion matrix in each utility case: even if the class probabilities for a give datum are the same in all cases, the threshold of acceptance varies so as to always be optimal for the utilities involved. A peculiar case of this automatic optimization of the threshold is visible for the transducer applied to either algorithm in case IV: it leads, 28 Sink et al. 2010; Hingorani et al. 2019. 20 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers (cid:21) for both the random forest and the convolutional neural network, to the confusion matrix (cid:20)3262 0 which means that all items were classified as '0', 'inactive'. How can this happen? Let us say that the probabilities for class 0 and 1, determined by the transducer from algorithm output, are 1 − p and p. In case IV, the expected utilities of choosing class 0 or 1 are given by the matrix multiplication (cid:2) 10 0 −10 1 326 0 (cid:3) (cid:2) 1−p p (12) (cid:3): choose 0: expect choose 1: expect −10 * (1 − p) + 1 * p = −10 + 11 p . 10 * (1 − p) + 0 * p = 10 − 10 p , (13) It is optimal to choose class 1 only if (disregarding ties) − 10 + 11 p > 10 − 10 p or p > 20/21 ≈ 0.952 , (14) that is, only if the probability of class 1 is higher than 95%. The threshold is so high because on the one hand there is a high cost (−10) if the true class is not 1, and on the other hand a high reward (10) if the true class is indeed 0. Now, a look at the transducer curve for the random forest, fig. 1, shows that the transducer never assigns a probability higher than 93% to class 1. Similarly the transducer for the convolutional neural network, fig. 2, never reaches probabilities above 92%. So the threshold of 95% will never be met in either case, and no item will be classified as 1. It is simply never rewarding, on average, to do so29. It can be seen that this (cid:3), with a > c and d > b, situation will occur with any utility matrix (cid:2) a b such that a−c+d−b ≈ 0.93. a−c c d This peculiar situation has a notable practical consequence. We have found the transducer curve for a classifier, and see that its maximum probability for class 1 is 93%. We have assessed that the utilities involved (cid:3), so the threshold to classify as 1 is 95%. Then we immediately are (cid:2) 10 0 −10 1 find that there is no need to employ that classifier, in this utility case: it is simply more profitable to automatically treat all data as class 0. A look at the other confusion matrices of table 1 shows the effect of the automatic threshold optimization also in utility cases II and III: as the cost of some misclassification increases, the number of the correspoding misclassifications decreases. 29 Drummond & Holte 2005 cf. the analysis by. 21 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers Utility yields We can finally assess the performance of both classifiers, with and without augmentation, on the demonstration dataset. As explained in our companion work30 and summarized in § 3, the correct metric for such performance must naturally depend on the utilities that underlie the problem. It is the utility yield per datum produced by the classifier on the dataset, obtained by taking the grand sum of the products of the homologous elements of the utility matrix (Uij) and the confusion matrix (Cij): (cid:88) Uij Cij . (15) ij The utility yields for the different cases, classifiers, and methods are presented in table 2. The maximum and minimum theoretically achievable yields, which are obtained when all data are correctly classi- fied or incorrectly misclassified, are also shown for each case. Since the maximum and minimum differ from case to case, the table also reports the rescaled utilities: for each case, the rescaled utility is obtained by a change in the zero and scale of its measurement unit such that the minimum and maximum achievable yields become 0 and 1: rescaled utility = utility − theoretical min theoretical max − theoretical min . (16) Let us first compare the two algorithms when employed in the standard way (red). Their performance is very close to the theoretical maximum in most cases, the worse being the random forest in case II. The random forest outperforms the convolutional neural network in cases I, III, IV. Then let us look at the performances obtained with the augmentation (blue bold). We note the following: • The augmentation improves the performance of each algorithm in all cases. The improvement also occurs in case IV for the random forest, where the standard method already had an extremely high performance (rescaled utility of 0.988). • In cases II and IV the augmentation improves the originally worse algorithm above the originally better one. 30 Dyrland et al. 2022a. 22 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers (cid:3) (cid:2) 1 0 0 1 (cid:2) 1 −10 10 0 (cid:3) (cid:2) 1 0 −10 10 (cid:3) (cid:2) 10 0 −10 1 (cid:3) m o d n a R t s e r o F k r o w t e N l a r u e N standard method augmentation (cid:2) 3207 38 55 288 (cid:3) standard method augmentation (cid:2) 3189 65 73 261 (cid:3) (cid:3) (cid:2) 3225 79.5 37 246.5 (cid:3) (cid:2) 3050 7 212 319 (cid:2) 3207 40 55 286 (cid:3) (cid:2) 3165 49 97 277 (cid:3) (cid:2) 2882 12 380 314 (cid:2) 3189 66 73 260 (cid:3) (cid:3) (cid:2) 3262 326 0 0 (cid:3) (cid:2) 3262 326 0 0 (cid:3) Table 1 Confusion matrices from demonstration dataset (cid:3) (cid:2) 1 0 0 1 min achievable utility max achievable utility 0 1 (cid:3) (cid:2) 1 −10 0 10 −0.91 1.82 (cid:3) (cid:2) 1 0 −10 10 −9.09 1.82 (cid:3) (cid:2) 10 0 −10 1 −9.09 9.18 m o d n a R t s e r o F k r o w t e N l a r u e N m o d n a R t s e r o F k r o w t e N l a r u e N standard method augmentation standard method augmentation standard method augmentation standard method augmentation 0.968 0.974 0.959 0.962 0.968 0.974 0.959 0.962 1.36 1.72 1.52 1.64 1.48 1.54 1.38 1.41 Rescaled utility yields, eq. (16) 0.834 0.964 0.890 0.937 0.969 0.974 0.960 0.963 8.95 9.09 8.63 9.09 0.988 0.995 0.970 0.995 Table 2 Utility yields from demonstration dataset 23 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers Figure 4 Space of utility matrices (modulo equivalence) for binary classification. • In case IV the augmentation brings the utility yield to above 99% of the theoretical maximum; remember from the previous section that this is achieved by classifying all data as class 0. • With augmentation, the random forest outperforms the convolu- tional neural network in all cases, with a possible tie for case IV. These were four particular cases only, though. Does the augmentation lead to an improvement (or at least to no change), on average, over all possible utility matrices? We expect this to be the case, owing to the internal consistency of decision theory. We give evidence of this fact by considering a large number (10 000) of utility matrices selected uniformly from the utility-matrix space (more precisely: manifold) for binary classification. This two-dimensional space, shown in fig. 4, is discussed in our companion work31. For each of these utility matrices, we calculate the rescaled utility yields obtained by using either classifier in the standard way, and with the augmentation – probability-transducer & utility-based classification. The utility yields obtained in the two ways are plotted against each other in fig. 5. Histograms of their distributions are also shown on the sides. The augmentation clearly leads to increased utility yields, especially for those cases where the standard performance of the two algorithms is particularly high or low – compare the left tails of the histograms for the 31 Dyrland et al. 2022a § 3.2. 24 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers Figure 5 Rescaled utility yields obtained using the two classifiers in the standard way, vs those obtained with augmentation, for a uniform distribution of possible utility matrices over the utility-matrix space of fig. 4. The augmentation always leads to an improved utility yield, especially in cases where the standard method has a low or high performance. Owing to noise coming from numerical rounding, in some cases the yield from augmentation may appear lower than from the standard method (points below the dashed grey line). standard method and augmentation. The standard method in some cases has utility yields as low as 0.76 for the random forest and 0.85 for the convolutional neural network; whereas the augmentation never leads to yields below 0.96 for the random forest and 0.92 for the convolutional neural network. This explains the U-shapes of the scattered points. Note that the minimum values of the plot's axes is 0.75, so the improvement is upon utility yields that are already quite high. 25 0.760.800.840.880.920.961.000.760.780.800.820.840.860.880.900.920.940.960.981.00rescaled utility yield, standard method rescaled utility yield, augmentation Random Forest Neural Network Dyrland, Lundervold, Porta Mana Probability transducer for classifiers There are a few apparent decreases in the utility yield, in some cases. The extremal relative decreases are −0.09% for random forest and −0.2% for convolutional neural network. Given their small magnitude, we believe them to be caused by numerical-precision error rather than to be real decreases 4.4 From 'inactive vs active' to more general decisions In the demonstration just discussed we assumed that the decisions available for each molecule examined were just two: 'molecule is inactive' vs 'molecule is active', corresponding to the two unknown classes. In a more general drug-discovery problem we could have a different set of decisions, for instance 'discard' vs 'promote to next examination stage' vs 'examine with different method'. Each decision would have its own utilities conditional on the two possible classes, forming a 3×2 utility matrix. The analysis and calculations of the present section would be easily generalized to such case. 5 Additional uses of the probability-transducer: an overview The probability-transducer presented in § 2 and illustrated in the previous section has several other uses and advantages, all of which come for free or almost for free with its calculation. We give a brief overview of them in the present section, leaving a more thorough discussion and applications to future works. The additional uses are mainly three: • Quantification of the possible variability of the transducer probab- ility curve. • Evaluation of the optimal algorithm, including the uncertainty about such evaluation. • 'Generative use' of the augmented algorithm, even if the original algorithm is not designed for generative use. 5.1 Variability of the transducer's probability curve The output-to-probability function, eq. (4), such as those plotted in figs 1 and 2–3, is determined by the data in the calibration set. There is the question, then, of how the function could change if we used more 26 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers calibration data. Such possible variability could be of importance. For example, we may find that the transducer only yields class probabilities around 0.5, and wonder whether this is just a statistical effect of a too small calibration dataset, or whether it would persist even if we used more calibration data. The calculation of the transducer parameters automatically tells us the probabilities of these possible variations, in the form of a set of possible alternative transducer curves, from which we can for example calculate quantiles. The shaded regions in figs 1, 7 and 3 are examples of such probability intervals. Their calculation is sketched in appendix B.4. 5.2 Expected utility of the classifying algorithm At the end of the discussion about the calibration dataset, § 2.2, we gave our assurances that no additional data must be set apart – with a detrimental reduction in training data – for evaluation or testing purposes. This is because from the probabilities (4), obtained from the calibration data, we can also calculate the expected, future utility yield of the augmented algorithm, once we have specified the utility matrix underlying the particular application. More details about this calculation, which amounts to a low-dimensional integration, are given in appendix B.5; see especially formula (29). For the random forest and convolutional neural network of the demonstration § 4, for instance, this calculation gives the expected utilities (non-rescaled) of table 3. The augmented random forest is expected to be optimal for cases I and II, possibly also in case III, although the difference in utilities is likely affected by numerical-precision error. There is no preference in case IV. Let us emphasize again that these values are obtained from the parameters of the transducer curve, without the need of any additional dataset. The demonstration dataset discussed in § 4.1 was not used for their calculation. The results from that dataset, reported in table 2, corroborate these values. One may ask: but how can you be sure that what you basically found from the calibration data will generalize to new data? The answer goes back to the discussion at the end of § 2.2, about how the probability calculus works, and to the technical details explained in appendix B: the 27 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers Random Forest Neural Net (cid:3) (cid:2) 1 0 0 1 0.973 0.962 (cid:2) 1 −10 10 0 (cid:3) (cid:2) 1 0 −10 10 (cid:3) (cid:2) 10 0 −10 1 (cid:3) 1.68 1.62 9.59 9.56 9.08 9.08 Table 3 Expected utilities for the two algorithms of § 4 case I case II case III case IV Figure 6 Probability distributions of the long-run utility yields of random forest and convolutional neural network in the four cases of § 4 28 0.9500.9550.9600.9650.9700.9750.980algorithm's long−run utilityprobability densityRandom ForestConv. Neural Net1.451.501.551.601.651.701.751.801.85algorithm's long−run utility8.08.59.09.510.010.511.011.5algorithm's long−run utilityprobability density8.908.959.009.059.109.159.209.25algorithm's long−run utility Dyrland, Lundervold, Porta Mana Probability transducer for classifiers probability calculus automatically considers all possible sets of new data that could be encountered in the future application32. In fact, the calculation of an algorithm's expected utility automatically produces a probability distribution of the possible long-run yields the algorithm could give. The distributions for the long-run utilities of the random forest and the convolutional neural network in cases I–IV of § 4 are shown in fig. 6. It can be calculated, eq. (30), that in case I the random forest will very probably, 99%, be superior to the convolutional neural network. In case II the probability is somewhat lower, 83%. In cases III and IV it is completely uncertain (50%) which algorithm will be best. The evaluation of candidate classifiers' performances and their un- certainties are obviously extremely important for the choice and final deployment of the optimal classifier. 5.3 Discriminative and generative modes The transducer parameters, calculated as discussed in § 2.3 and ap- pendix B, allow us to calculate not only the 'discriminative' probability of the class given the algorithm's output, formula (7a), but also the inverse, 'generative' probability33 of the output given the class, formula (7b). The transducer thus allow us to use the original algorithm both in 'discrim- inative mode' and in 'generative mode', even if it is not a generative algorithm in itself. Having an available generative mode is extremely useful, because it is the required way to calculate the class probabilities if the calibration and training sets do not have the same class frequencies as the real population on which the classifier will be employed. For instance, two classes may appear in a 50%/50% proportion in the calibration set but in a 90%/10% pro- portion in the real population. This discrepancy in the two populations' frequencies can occur for several reasons. Examples: samples of the real population are unavailable or too expensive to be used for calibration purposes; the class statistics of the real population has suddenly changed right after the deployment of the classifier; it is necessary to use the classifier on a slightly different population; or the sampling of calibration data was poorly designed. 32 cf. Smith & Winkler 2006. 33 Russell & Norvig 2022 § 21.2.3; Murphy 2012 § 8.6. 29 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers In such situations, the discriminative probabilities p(c | y) are usually no longer the same in the two populations either, owing to the identity p(c | y) p(y) ≡ p(y | c) p(c) . (17) Typically, a change in p(c) leaves p(y | c) the same; but then both p(y) and p(c | y) must change as well. This means that the discriminative probabilities the algorithm and transducer have learned from the training and calibration sets are actually wrong: they cannot lead to reliable inferences on the real population. But, as we just said, the generative probabilities p(y | c) often remain the same. And these have been automatically computed in the transducer calibration, formula (7b). We can then use them to calculate the prob- ability of class c through Bayes's theorem, by supplying the population prevalence rc of the class: p(c | y, prevalences) = (cid:80) p(y | c) rc c p(y | c) rc . (18) The population prevalences34, also called base rates35, are the relative frequencies of occurrence of the various classes in the population whence our unit originates. This notion is very familiar in medicine and epidemi- ology. For example, a particular type of tumour can have a prevalence of 0.01% among people of a given age and sex, meaning that 1 person in 10 000 among them has that kind of tumour, as obtained through a large survey. We recommend the outstandingly insightful discussion by Lindley & Novick 1981 on the problem of population mismatch and on which conditional probabilities to use in that case. Figure 7 shows the 'generative' probability densities p(output | class 1), p(output | class 0) of the random-forest output from the demonstration of § 4. The shaded regions are 75% intervals of possible variability upon increase of the calibration dataset. There is a high probability of output values close to 0 when the true class is 0 ('inactive'), and a peak density around 0.8 when the true class is 1 ('active'), as expected. The density conditional on class 0 is narrower than the one conditional on class 1 owing to the much larger proportion 34 Sox et al. 2013 ch. 3; Hunink et al. 2014 § 5.1. 35 Bar-Hillel 1980; Axelsson 2000. 30 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers Figure 7 Probability densities of the random-forest output conditional on class 1 ('active', blue solid curve) and on class 0 ('inactive', red dashed curve, truncated). The shaded region around each curve represents its 12.5%–87.5% range of possible variability upon increase of the calibration dataset. data in the former class. Intuitively speaking, we have seen that most data in class 1 correspond to high output values, but we have seen too few data in this class to reliably conclude, yet, that future data will show the same correspondence. We can show the usefulness of using the probability transducer in generative mode by altering the class frequencies of the demonstration set: we keep all data of class 1 (the less frequent) and unsystematically select a number of data from class 0 equal to half that of class 1. This new demonstration set has thus a proportion 1/3 vs 2/3 of class 0 and class 1: their preponderance has been almost inverted. Finally we apply both classifiers in the standard way and with the augmentation in generative mode, considering again a large number of possible utility matrices, uniformly selected from their space. The rescaled utility yields are shown in fig. 8. We see that the performance of the standard method has worsened; this is especially manifest by a comparison of the top histograms of figs 5 31 0.00.10.20.30.40.50.60.70.80.91.0012345678outputp (output | class)class 1class 0 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers Figure 8 Rescaled utility yields obtained using the two classifiers in the standard way, vs those obtained with augmentation in generative mode, on an altered dataset with very different class balance from the training and calibration sets. The distribution of possible utility matrices is uniform over their space, as before. The utility yields of the standard method have worsened with respect to those of fig. 5, as can be seen from the histogram tails. The augmentation in generative mode, however has not suffered from this dataset mismatch. and 8. The median utility yield of the random forest has gone from 0.967 to 0.834; that of the convolutional neural network from 0.959 to 0.893. And yet the augmentation in generative mode is almost unaffected, the median changing from 0.974 to 0.967 for the random forest and from 0.961 to 0.941 for the convolutional neural network. 32 0.760.800.840.880.920.961.000.760.780.800.820.840.860.880.900.920.940.960.981.00rescaled utility yield, standard method rescaled utility yield, augmentation in generative mode Random Forest Neural Network Dyrland, Lundervold, Porta Mana Probability transducer for classifiers 6 Summary and discussion The successful application of machine-learning classifiers in fields such as medicine or drug discovery, which involve high risks and special courses of action, demands that we replace a too-simplistic view of classification with a more articulated and flexible one. A classifier must be able to handle decisions that do not correspond to some unknown classes; it must take into account problem-specific gains and losses arising from such decisions; it must choose not what's likely, but what's optimal; and the uncertainties underlying its operation must be amenable to assessment. And it should preferably face all these requirements with methods based on first-principles guaranteeing consistency and universal applicability. The basic theory that allows us to face most of these requirements has been around for a long time36: Decision Theory, whose methods keep on see-sawing in machine learning37. It allows us to consider decisions separate from classes, to evaluate gains and losses, and to decide what's optimal. In the present work we have tried to revive it, showing that its application is straightforward, involves little computational cost, and always leads to improvement on results obtained with standard machine-learning methods, even when these are already nearly optimal. The main obstacle in using decision theory is that it requires proper probabilities, which in many applications might only be obtained at too high computational costs – if these probabilities are conditional on the 'features' constituting the input to classifier. We have proposed the idea of using probabilities conditional on the output of the classifier instead. This is somehow like using the classifier in the guise of a diagnostic test, such as a typical medical test. This probabilistic quantification is not computationally expensive, can be calculated exactly by Bayesian model-free (non-parametric) density- regression methods38, and only needs to be done once per trained algorithm. We have called the resulting output-to-probability function a 'prob- ability transducer'. Concrete examples are given in fig. 1 for the output of a random-forest classifier, and in figs 2, 3 for the bivariate output of a convolutional neural network. In the latter case, the probability transducer is essentially a replacement of the popular softmax. 36 at least since Luce & Raiffa 1957; cf. Russell & Norvig 2022 § 1.2. Cheeseman 1987; Elkan 2001; Drummond & Holte 2005. 2011. 37 e.g. Self & 38 Dunson & Bhattacharya 33 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers The quantification of the probabilistic relationship between a clas- sifier's output and the unknown class requires a 'calibration dataset', whose role can perfectly be played by the 'test' or 'evaluation' set of standard machine-learning methodology. The calibration dataset also delivers all necessary evaluations; thus a third, additional test set is not required. The probability transducer gives probabilities that are easily com- bined with the set of utilities specific to the problem, to make a classi- fication or a more general decision based on maximum expected utility, according to the principles of decision theory. This procedure is compu- tationally inexpensive: a low-dimensional matrix multiplication followed by an 'argmax'. We have called 'augmentation' the joint use of transducer and utility-maximization. The utilities employed by the augmentation can also differ from one tested item to the other, without any changes to the computational costs. We have demonstrated the use of the probability transducer and augmentation on a random forest and a convolutional neural network in a drug-discovery problem: classifying molecules as 'inactive' or 'active'. The problem has a naturally high class imbalance, and standard machine- learning classifiers often have nearly optimal performance on the dataset used to explore this problem. Yet, the augmentation led to improvements for all possible choice of utilities underlying the classification, as shown in fig. 5. The calculation of the two probability transducers' parameters took at most 75 min. The calculation of a probability transducer from a calibration dataset also provides extremely useful additional information, for free or almost so: (a) the possible variability of the transducer function, if more calibra- tion data were acquired; (b) the expected utility of the whole algorithm on which the transducer is used, including the uncertainty about such utility; (c) the possibility of using the classifier in a 'generative mode', giving the probability of the output conditional on the class; this is useful when the only available data for training has different statistical properties from the real-use data. Some literature has promoted and employed the use of utilities in so called cost-sensitive learning39. One approach is to bake utilities into the loss function used at the training stage, so that the utilities can 39 Elkan 2001; Correa Bahnsen et al. 2015; Ling & Sheng 2017. 34 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers have an effect on the training of the classifier. This approach effectively wastes information and has computational disadvantages. First, since the optimal decision depends on the product of utilities and probabilities, the algorithm learns about this product only, and not about the two factors separately.40 Yet, the utilities are known, otherwise they could not be combined with the loss function. The information about them is therefore wasted. Second, if the statistics of the data involved remain the same, but the utilities suddenly change, the classifier has to be trained anew. Such a classifier cannot be used in cases where the utilities differ from one tested item to the next (see discussion above). The method proposed in the present work does not suffer from either of these drawbacks. The training phase needs no changes, and focuses on retrieving information about the data's statistics – which is then extracted by the probability transducer. The full information contained in the utilities is used. And the utilities can even be changed on the fly during the use of the classifier. Future directions It is possible to construct a probability transducer that takes the output from several classifiers at once. This would be the optimal way of doing 'ensembling' from the point of view of the probability theory. In future work we plan to examine this possibility and compare it with standard ensembling methods. As mentioned at the end of § 2.2, we also plan to assess what is the best way to split available data into the training set and the calibration set, in order to have an optimal amount of mutual information between features, class, and algorithm output (training data) and a reliable transducer (calibration data). For the demonstration of § 4 we also tried a 'mixed' method: directly combining the output of the classifier (raw output for the random forest and standard softmax for the CNN), as it were a probability, with the utilities; and then classifying by utility maximization as usual. This method generally led to improvements with respect to the standard one, and in some cases also with respect to the probability-transducer augmentation. But on average, over the space of utility matrices, the 40 In Elkan 2001 §§ 2–3, for example, the decision threshold of the algorithm is changed by making the algorithm learn wrong class probabilities on purpose. 35 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers mixed method was worse than the augmentation method, for both random forest and convolutional neural network. In future work we may try to compare the performance of the two methods with different kinds of dataset. Author contributions The authors were so immersed in the development of the present work, that unfortunately they forgot to keep a detailed record of who did what. Thanks KD and ASL acknowledge support from the Trond Mohn Research Foundation, grant number BFS2018TMT07, and PGLPM from The Re- search Council of Norway, grant number 294594. The computations of the parameters for the probability transducer were performed on resources provided by Sigma2 – the National Infra- structure for High Performance Computing and Data Storage in Norway (project NN8050K). KD would like to thank family for endless support; partner Synne for constant love, support, and encouragement; and the developers and maintainers of Python, FastAi, PyTorch, scikit-learn, NumPy and RDKit for free open source software and for making the experiments possible. PGLPM thanks Maja, Mari, Miri, Emma for continuous encourage- ment and affection; Buster Keaton and Saitama for filling life with awe and inspiration; and the developers and maintainers of LATEX, Emacs, AUCTEX, Open Science Framework, R, Nimble, Inkscape, LibreOffice, Sci-Hub for making a free and impartial scientific exchange possible. 36 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers Appendices: mathematical and technical details A Algorithms and data used in the demonstration A.1 Data The data comes from the open-access ChEMBL bioactivity database41. The dataset used in the present work was introduced by Koutsoukas et al. (2017). The data consist in structure-activity relationships from version 20 of ChEMBL, with Carbonic Anhydrase II (ChEMBL205) as protein target. A.2 Pre-processing For our pre-processing pipeline, we use two different methods to rep- resent the molecule, one for the Random Forest (RF) and one for the Convolutional Neural Network (CNN). The first method turns the mo- lecule into a hashed bit vector of circular fingerprints called Extended Connectivity Fingerprints (ECFP)42. From our numerical analysis, there was little to no improvement using a 2048-bit vector over a 1024-bit vector. For our convolutional neural network, the data is represented by converting the molecule into images of 224 pixels × 224 pixels. This is done by taking a molecule's SMILES (Simplified Molecular Input Line Entry System) string43 from the dataset and converting it into a canonical graph structure by means of RdKit44. This differs from ECFP in that it represents the actual spatial and chemical structure (or something very close to it) of the molecule rather than properties generated from the molecule. The dataset has in total 1631 active molecules and 16310 non-active molecules which act as decoys. For training, the active molecules are oversampled, as usually done with imbalanced datasets45, to match the same number of non-active molecules. A.3 Prediction Virtual screening is the process of assessing chemical activity in the interaction between a compound (molecule) and a target (protein). The 41 Bento et al. 2014. 2017. 45 Provost 2000. 42 Rogers & Hahn 2010. 43 David et al. 2020. 44 Landrum et al. 37 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers goal of the machine learning algorithms is to find structural features or chemical properties that show that the molecule is active towards the protein46. Deep neural networks have previously been shown to outperform random forests and various linear models in virtual high- throughput screening and in quantitative structure-activity relationship (QSAR) problems47. A.4 Chosen classifiers The algorithms and methods used to create the models have previously been shown to give great results for a lot of different fields. Random Forest The first machine learning model used in the experiments is an RF model implemented in sci-kit learn48. RF is an ensemble of classifying or regression trees where the majority of votes is chosen as the predicted class49. It is known for being robust when dealing with a large number of features (as in our case), being resilient to over-fitting, and achieving good performance. And has already been shown to deliver powerful and accurate results in compound classification and QSAR analysis50. The following parameters were used when training the model: Number of trees: 200 Criterion: Entropy Max Features: Square root Convolutional Neural Network The second model is a pre-trained residual network (ResNet)51 with 18 hidden layers trained on the well-known ImageNet dataset52 by using the PyTorch framework53. ResNet has shown to outperform other pre-trained convolutional neural network models54. A ResNet with 34 hidden layers 46 Green 2019. 50 Svetnik et al. 2003. 54 He et al. 2016. 47 Koutsoukas et al. 2017. 51 He et al. 2016. 48 Pedregosa et al. 2011. 52 Russakovsky et al. 2015. 49 Breiman 2001. 53 Paszke et al. 2019. 38 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers showed little to no performance gain, so we chose to go with the simpler model. The model is trained with the following hyperparameters: Learning rate: 0.003 Optimization technique: Stochastic Gradient Descent Activation Function: Rectified linear unit (ReLU) Dropout: 50% Number of epochs: 20 Loss function: Cross-entropy loss A.5 Dateset split The data set is split into four parts: • Training set: 45% of the dataset to train the model. • Validation set: 15%, for validating the model after each epoch. • Calibration set: 20%, for calibrating the probability transducer. • Demonstration set: 20%, for evaluation. B Mathematical details and computation of the transducer The notation is the one used in § 2.3: the class is denoted c and the algorithm output y. In our demonstration c takes on values in {0, 1}, and y either in [0, 1] or in R2; but the method can be applied to more general cases, such as continuous but low-dimensional spaces for both c and y, or combinations of continuous and discrete spaces. For convenience we use a single symbol for the pair d := (c, y). For general references about the probability calculus and concepts and specific probability distributions see Jaynes 2003; MacKay 2005; Jeffreys 1983; Gregory 2005; Bernardo & Smith 2000; Hailperin 1996; Good 1950; Fenton & Neil 2019; Johnson et al. 1996; 2005; 1994; 1995; Kotz et al. 2000. 39 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers B.1 Exchangeability and expression for the probability transducer There is a fundamental theorem in the probability calculus that tells us how extrapolation from known units – molecules, patients, widgets, images – to new, unknown units takes place: de Finetti's theorem55. It is a consequence of the assumption that our uncertainty is invariant or 'exchangeable' under permutations of the labelling or order of the units (therefore it does not apply to time series, for example). De Finetti's theorem states that the probability density of a value d0 for a new unit '0', conditional on data D, is given by the following integral: ∫ p(d0 | D) = F(d0) w(F | D) dF , (19) which can be given an intuitive interpretation. We consider every possible long-run frequency distribution F(d) of data; give it a weight density w(F | D) which depends on the observed data; and then take the weighted sum of all such long-run frequency distributions. The weight w(F | D) given to a frequency distribution F is proportional to two factors: w(F | D) ∝ F(D) wg(F) . (20) • The first factor ('likelihood') F(D) quantifies how well F fits known data of the same kind, in our case the calibration data D := {d1, . . . , dM }. It is simply proportional to how frequent the known data would be, according to F: F(D) := F(d1) * F(d2) * * * * * F(dM) ≡ exp (cid:88) (cid:20) M d ˆF(d) ln F(d) (cid:21) , (21) where ˆF(d) is the frequency distribution observed in the data. • The second factor ('prior') wg(F) quantifies how well F generalizes beyond the data we have seen, owing to reasons such as physical or biological constraints for example. In our case we expect F to be somewhat smooth in X when this variable is continuous56. No assumptions are made about F when X is discrete. Formula (20) is just Bayes's theorem. Its normalization factor is the ∫ F(D) wg(F) dF, which ensures that w(F) is normalized. integral 55 Bernardo & Smith 2000 ch. 4; Dawid 2013; de Finetti 1929; 1937. Gaskins 1971. 56 Cf. Good & 40 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers The exponential expression in eq. (21) is proportional to the number M of data, and in it we recognize the cross-entropy between the observed ˆF and F. This has two consequences. First, it makes frequency distribution the final probability p(d0) increasingly identical with the distribution ˆF(d) observed in the data, because the average (19) gets more and more ˆF. Second, a large amount of data indicating a concentrated around non-smooth distribution F will override any smoothness preferences embodied in the second factor. Note that no assumptions about the shape of F – Gaussians, logistic curves, sigmoids, or similar – are made in this approach (compare fig. 9). B.2 Conditional probabilities From eq. (19), which is expressed in terms of joint probabilities for c0 and y0, there are two ways of obtaining the probability of c0 conditional on y0, which we report without proof: Exchangeable output: if the newly observed value y0 of the output is considered to be exchangeable with (or representative of) the y values in the calibration data, then p(c0, y0 | D) p(y0 | D) ∫ F(c0, y0) w(F | D) dF ∫ F(y0) w(F | D) dF p(c0 | y0, D, exch.) = , (22) = (cid:80) where F(y0) = c F(c, y0). This expression is effectively doing two things: first, implicitly updating the probability distribution for y, taking as new evidence the observed y0; second, yielding the conditional distribution of c0 given y0. Non-exchangeable output: if the newly observed value y0 of the output is not considered to be exchangeable with the y values in the calibration data, then p(c0 | y0, D, non-exch.) = ∫ F(c0, y0) F(y0) w(F | D) dF ; (23) This expression does not implicitly update of the distribution for y. The second formula should be used if new data are considered to lead to a distribution of features different from that of the calibration data – although the basic assumption that the conditional distributions of classes given features are the same still holds57. 57 see Lindley & Novick 1981 for a thorough discussion of these two cases. 41 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers The two formulae converge to one another and to the long-run conditional probability of c given y, as the number of calibration data increases. With a large number of calibration data, say hundreds or more, the values obtained from the two formulae are negligible. B.3 Representation of the long-run distribution and Markov-chain Monte Carlo sampling n The integral in (19) is calculated in either of two ways, depending on whether d is discrete or continuous. For d discrete, the integral is , where n is the number of possible values of d, and can be over R done analytically. For d with continuous components, the integral is numerically approximated by a sum over T representative samples, obtained by Markov-chain Monte Carlo, of distributions F according to the weights (20): ∫ p(d0 | D) = F(d0) w(F | D) dF ≈ 1 T T(cid:88) t=1 Ft(d0) . (24) The error of this approximation can be calculated and made as small as required by increasing the number of Monte Carlo samples. We must find a way to express any kind of distribution F(d). As mentioned in § 2.3, this is done by writing it as F(c, y) = (cid:88) l wl A(c | αl) B(y | βl) , (25) where the sum has a large number of terms58, {wl } are normalized weights, and A(c | α), B(y | β ) are distributions, possibly the product of further one-dimensional distributions. Effectively we are expressing F( * ) by the 'coordinates' (wl , αl , βl) in a space of extremely high dimensions. This representation59 has several advantages: • Its marginal distributions for c and y are also of the form (25), as shown in § 2.3, and easily computable. • Its conditional distributions for c given y and vice versa have also a form similar to eq. (25) and easily computable. • It can be used with conjugate priors. 58 see Ishwaran & Zarepour 2002 on why the number of terms does not need to be infinite. 59 promoted by Dunson & Bhattacharya 2011; see also Rasmussen 1999. 42 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers • The final probability p(c, y), approximated by the sum (24), has also the form (25): p(c0, y0) ≈ (cid:88) t,l wt,l T A(c0 | αt,l) B(y0 | βt,l) . (26) This is the expression given in § 2.3 with k running over both indexes t, l and with qk := wt,l/T. In the demonstration of § 4, where the class variable c takes on conventional values {0, 1}, we use a Bernoulli distribution for the class variable c: A(c | α) = c α + (1 − c) (1 − α) ≡ (cid:40) if c = 1, α 1 − α if c = 0 , (27) both in the case of the random forest and of the convolutional neural network. For the output variable we use a Gaussian distribution in the case of the random forest, β ≡ (μ , σ) being its mean and standard deviation: B(y | β ) = N(y | μ , σ) := 1√ 2πσ 2 exp (cid:20) − (y − μ)2 2σ 2 (cid:21) . (28) The random-forest output is actually bounded, y ∈ [0, 1], and this Gaussian should in principle be truncated; we did not use any truncation as the error committed is small and the computation much faster. In the case of the convolutional neural network's output we use a product of two Gaussians, each with its own parameters. In both cases, the sum of the representation (25) has 64 terms, and the approximating sum (24) 4096 terms. The samples {Ft( * )} of the sum (24) – these are samples of the distribu- tion w(F) – are obtained through Markov-chain Monte Carlo; specifically Gibbs sampling60. Effectively we obtain samples of the coordinates (wl , αl , βl), and the prior wg(F) is a prior over these coordinates. For the demonstration of § 4 we use a Dirichlet distribution for (wl), a beta distribution for (αl), a Gaussian distribution for (μl), and a gamma distribution for (1/σl 2). 60 Neal 1993; MacKay 2005 ch. 29. 43 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers The Markov-chain Monte Carlo sampling scheme is implemented using the R61 package nimble62, and uses 16 parallel chains63. The sampling took approximately 45 min for the random forest and 75 min for the convolutional neural network, wall-clock time. The resulting parameters are available in our supplementary data64. B.4 Assessment of the possible variability of the probability In § 5.1 we mentioned that the calculation of the transducer parameters automatically also tells us how much the probabilities curves could change if we used more data for the calibration. The range of this possible variability was shown for example in figs 1, 7, and 3 of the demonstration. This possible variability is encoded in the weight w(F | D), which can be interpreted as the probability distribution of the long-run frequency distribution F; remember that the probability p(d0 | D), for the new unit, eq. (19), becomes closer and closer to the distribution F at which w(F | D) peaks, as the number of data increases. In the approximation (24), the probability w(F | D) is effectively represented by a large number of samples {Ft } from it. Plotting these samples alongside p(d0 | D) gives an approximate idea of how the latter probability could change with new data. Figure 9 shows a small number of such samples for the transducer curve of the random forest of § 4 (cf. fig. 1). For fixed d, the samples {Ft(d)} also give estimates of the quantiles of such change. This is how the ranges of figs 1, 7, 3 were obtained. An analogous discussion holds for the marginal and conditional probabilities that we can obtain from p(d0 | D). B.5 Assessment of the augmented algorithm's long-run utility yield Besides making a decision – such as choosing a class – for each new unit, we generally must also decide which algorithm to use for such a future task, among a set of candidates. This latter decision depends on the future performance of each algorithm, which in turn depends on the decision that the algorithm will make for each new unit. Two kinds of unknown accompany this double decision: we do not know the classes 61 R Core Team 2023. NNmcmc.R. transducer_params-Neural_Net.zip. 63 Dyrland et al. 2022b, scripts RFmcmc.R and 64 Dyrland et al. 2022b, files transducer_params-Random_Forest.zip and 62 nimble 2021. 44 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers Figure 9 Samples (thin light-blue curves) of probable transducer curves (for class 1) that could be obtained if we had more calibration data in the demonstration of § 4. They are samples obtained from the distribution w(F | D) of eq. (20). According to the probability calculus, the curve to be used for a new unit is their average (thicker dark-blue curve), which is the same as plotted in fig. 1. of the future units, and we do not know which outputs each algorithm will give for the future data. This more complex kind of decision & uncertainty problems are also dealt with decision theory. Their theory is presented and applied step- by-step in the humorous lectures by Raiffa 1970 ch. 2; other references are65. We here give only a sketch and refer to the works above for details. Our double decision & uncertainty problem can be represented as a decision tree. A very simplified example is illustrated in fig. 10. We imagine to have to choose between two classification algorithms and M′′ . This choice corresponds to the decision node on the left M′ (green). Decision nodes are represented by squares. 65 Lindley 1988; Bernardo & Smith 2000 § 2.2; Pratt et al. 1996; Raiffa & Schlaifer 2000; Luce & Raiffa 1957. 45 0.00.10.20.30.40.50.60.70.80.91.00.00.10.20.30.40.50.60.70.80.91.0outputP (class 1 | output) Dyrland, Lundervold, Porta Mana Probability transducer for classifiers Figure 10 Decision tree for the choice of algorithm. From left to right: Decision node about the algorithm (green), uncertainty node about the algorithm's output (yellow), decision node (e.g. about class) for the inspected item (blue), uncertainty node about the class (red). Only some example nodes and branches are labelled. If we choose to use algorithm M′ , then it may happen that it will give either output y1 or y2 when applied to a new unit. We are uncertain about which output will occur, with probabilities P(y1 | M′) and P(y2 | M′). This uncertainty corresponds to an uncertainty node (yellow). Uncertainty nodes are represented by circles. Once the output of the algorithm is known, we must decide (blue and i′′ , for example to choose whether decision nodes) among choices i′ to consider the new unit as class 0 or class 1. The unit will turn out to be class 0 or class 1: we are uncertain about which (red decision nodes), with probabilities P(c = 0 | y1, M′), P(c =1 | y1, M′) if the output was y1, and with probabilities P(c =0 | y2, M′), P(c =1 | y2, M′) if the output was y2. Finally, depending on our choice between i′ and on the actual class, we will gain one of the four utility amounts Ui1 0, Ui′ 1, Ui′′ 0, Ui′′ 1. These are the elements of the utility matrix discussed in § 3; we have and i′′ 46 M'Ui'0Ui'1Ui"0Ui"1y1i'c = 0c = 1i"y2M" Dyrland, Lundervold, Porta Mana Probability transducer for classifiers seen concrete numerical examples in the demonstration of § 4. M′′ An analogous analysis and probabilities hold if we choose algorithm (the output space of this algorithm can be different from that of M′ ). The basic procedure of this decision problem is to first calculate expected utilities starting from the terminal uncertainty nodes, making optimal decisions at the immediately preceding decision nodes. Each such decision will therefore have an associated utility equal to its corres- ponding maximal expected utility. The same procedure is then applied to the uncertainty nodes about the outputs. In this way each algorithm receives a final expected utility; in formulae, utility of algorithm M = (cid:88) (cid:20) (cid:26)(cid:88) max i y c Uic P(c | y, M) (cid:27)(cid:21) P(y | M) . (29) Either sum is replaced by an integral over a density if the related quantity, y or c, is continuous. What is important in the formula above is that the probabilities for the outputs and the conditional probabilities for the classes given the outputs are known: they are the ones calculated for the transducer from the calibration set. The expected utilities of table 3, § 5.2, were calculated with the formula above (the integral over y being approximated by a sum over a dense grid). These values are expected utilities, though. One may ask: what is the probability that the final utility of one model will actually be higher or lower than the other's? We can answer this question, again thanks to de Finetti's formula (19), similarly to how we did with the variability of the transducer curves, explained in the previous § B.4. The long-run utility of the algorithm M is given by formula (29) but with the probabilities replaced by the long-term frequencies F(c | y) and F(y). The probability of this long-run utility is then determined by the density w(F) represented by a set of samples. Calculating the long-run utility for each sample we can finally construct a probability histogram for each algorithm's utility. The histograms of fig. 6 are obtained this way. From them we can also calculate the probability that an algorithm's utility u′ will be higher than another's utility u′′ , corresponding to the integral ∫∫ δ(u′ > u′′) p(u′) p(u′′) du′ du′′ . (30) 47 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers Bibliography ('de X' is listed under D, 'van X' under V, and so on, regardless of national conventions.) Alvarez-Melis, D., Broderick, T. (2015): A translation of "The characteristic function of a random phenomenon" by Bruno de Finetti. arXiv doi:10.48550/arXiv.1512.01229. Transl. of de Finetti (1929). Axelsson, S. (2000): The base-rate fallacy and the difficulty of intrusion detection. ACM Trans. Inf. Syst. Secur. 33, 186–205. doi:10.1145/357830.357849, http://www.scs.carleton. ca/~soma/id-2007w/readings/axelsson-base-rate.pdf. Bar-Hillel, M. (1980): The base-rate fallacy in probability judgments. Acta Psychol. 443, 211–233. doi:10.1016/0001-6918(80)90046-3. Barber, D. (2020): Bayesian Reasoning and Machine Learning, online update. (Cambridge University Press, Cambridge). http://www.cs.ucl.ac.uk/staff/d.barber/brml. First publ. 2007. Bento, A. P., Gaulton, A., Hersey, A., Bellis, L. J., Chambers, J., Davies, M., Krüger, F. A., Light, Y., et al. (2014): The ChEMBL bioactivity database: an update. Nucleic Acids Res. 42D1, D1083–D1090. doi:10.1093/nar/gkt1031. Release doi:10.6019/CHEMBL.database.20. Bernardo, J. M., Bayarri, M. J., Berger, J. O., Dawid, A. P., Heckerman, D., Smith, A. F. M., West, M., eds. (2011): Bayesian Statistics 9. (Oxford University Press, Oxford). doi: 10.1093/acprof:oso/9780199694587.001.0001. Bernardo, J.-M., Berger, J. O., Dawid, A. P., Smith, A. F. M., eds. (1996): Bayesian Statistics 5. (Oxford University Press, Oxford). Bernardo, J.-M., Smith, A. F. (2000): Bayesian Theory, repr. (Wiley, New York). doi: 10.1002/9780470316870. First publ. 1994. Bishop, C. M. (2006): Pattern Recognition and Machine Learning. (Springer, New York). https://www.microsoft.com/en-us/research/people/cmbishop/prml-book. Breiman, L. (2001): Random forests. Mach. Learn. 451, 5–32. doi:10.1023/A:1010933404324. Cheeseman, P. (1988): An inquiry into computer understanding. Comput. Intell. 42, 58–66. doi:10.1111/j.1467-8640.1988.tb00091.x. - (2018): On Bayesian model selection. In: Wolpert (2018): 315–330. First publ. 1995. Chen, H., la Engkvist, Wang, Y., Olivecrona, M., Blaschke, T. (2018): The rise of deep learning in drug discovery. Drug Discov. Today 236, 1241–1250. doi:10.1016/j.drudis.2018. 01.039. Correa Bahnsen, A., Aouada, D., Ottersten, B. (2015): Example-dependent cost-sensitive decision trees. Expert Syst. Appl. 4219, 6609–6619. doi:10.1016/j.eswa.2015.04.042. Damien, P., Dellaportas, P., Polson, N. G., Stephens, D. A., eds. (2013): Bayesian Theory (Oxford University Press, Oxford). doi:10 . 1093 / acprof : oso / and Applications. 9780199695607.001.0001. David, L., Thakkar, A., Mercado, R., Engkvist, O. (2020): Molecular representations in AI-driven drug discovery: a review and practical guide. J. Cheminf. 12, 56. doi:10.1186/s13321-020- 00460-5. Dawid, A. P. (2013): Exchangeability and its ramifications. In: Damien, Dellaportas, Polson, Stephens (2013): ch. 2:19–29. doi:10.1093/acprof:oso/9780199695607.003.0002. de Finetti, B. (1929): Funzione caratteristica di un fenomeno aleatorio. In: atti del congresso internazionale dei matematici: ed. by S. Pincherle (Zanichelli, Bologna): 179–190. https://www.mathunion.org/icm/proceedings, http://www.brunodefinetti.it/ Opere.htm. Transl. in Alvarez-Melis, Broderick (2015). See also de Finetti (1930). 48 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers de Finetti, B. (1930): Funzione caratteristica di un fenomeno aleatorio. Atti Accad. Lincei: Sc. Fis. Mat. Nat. IV5, 86–133. http://www.brunodefinetti.it/Opere.htm. Summary in de Finetti (1929). - (1937): La prévision: ses lois logiques, ses sources subjectives. Ann. Inst. Henri Poincaré 71, 1–68. http://www.numdam.org/item/AIHP_1937__7_1_1_0. Transl. in Kyburg, Smokler (1980), pp. 53–118, by Henry E. Kyburg, Jr. de Valpine, P., Paciorek, C., Turek, D., Michaud, N., Anderson-Bergman, C., Obermeyer, F., Wehrhahn Cortes, C., Rodríguez, A., et al. (2021): NIMBLE: MCMC, particle filtering, and programmable hierarchical modeling. https://cran.r- project.org/package=nimble, doi:10.5281/zenodo.1211190, https://r-nimble.org. First publ. 2016. Drummond, C., Holte, R. C. (2005): Severe class imbalance: why better algorithms aren't the answer. Eur. Conf. Mach. Learn. 2005, 539–546. doi:10 . 1007 / 11564096 _ 52, https://webdocs.cs.ualberta.ca/~holte/Publications. Dunson, D. B., Bhattacharya, A. (2011): Nonparametric Bayes regression and classification through mixtures of product kernels. In: Bernardo, Bayarri, Berger, Dawid, Hecker- man, Smith, West (2011): 145–158. doi:10.1093/acprof:oso/9780199694587.003. 0005, older version at https : / / www . researchgate . net / publication / 228447342 _ Nonparametric _ Bayes _ Regression _ and _ Classification _ Through _ Mixtures _ of _ Product_Kernels. Dunson, D. B., Pillai, N., Park, J.-H. (2007): Bayesian density regression. J. R. Stat. Soc. B 692, 163–183. Dyrland, K., Lundervold, A. S., Porta Mana, P. G. L. (2022a): Does the evaluation stand up to evaluation?: A first-principle approach to the evaluation of classifiers. Open Science Framework doi:10.31219/osf.io/7rz8t. - (2022b): Bayesian augmentation of machine-learning algorithms: supplementary data. Open Science Framework doi:10.17605/osf.io/mfz5w. Elkan, C. (2001): The foundations of cost-sensitive learning. In: Proceedings of the seventeenth international joint conference on artificial intelligence, ijcai 2001, ed. by B. Nebel (Kaufmann): 973–978. https://www.ijcai.org/Proceedings/01/IJCAI-2001-k.pdf. Fenton, N., Neil, M. (2019): Risk Assessment and Decision Analysis with Bayesian Networks, 2nd ed. (CRC Press, Boca Raton, USA). doi:10.1201/b21982. First publ. 2013. Ferguson, T. S. (1983): Bayesian density estimation by mixtures of normal distributions. In: Rizvi, Rustagi, Siegmund (1983): 287–302. Fong, E., Holmes, C. C. (2020): On the marginal likelihood and cross-validation. Biometrika 1072, 489–496. doi:10.1093/biomet/asz077. Gal, Y., Ghahramani, Z. (2016): Dropout as a Bayesian approximation: representing model uncertainty in deep learning. Proc. Mach. Learn. Res. 48, 1050–1059. See also Appendix at arXiv doi:10.48550/arXiv.1506.02157. Good, I. J. (1950): Probability and the Weighing of Evidence. (Griffin, London). - (1966): How to estimate probabilities. J. Inst. Maths. Applics 24, 364–383. Good, I. J., Gaskins, R. A. (1971): Nonparametric roughness penalties for probability densities. Biometrika 582, 255–277. doi:10.1093/biomet/58.2.255. Green, D. V. S. (2019): Using machine learning to inform decisions in drug discovery: an industry perspective. In: Machine learning in chemistry: data-driven algorithms, learning systems, and predictions, ed. by E. O. Pyzer-Knapp, T. Laino (American Chemical Society, Washington, DC): ch. 5:81–101. doi:10.1021/bk-2019-1326.ch005. 49 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers Gregory, P. C. (2005): Bayesian Logical Data Analysis for the Physical Sciences: A Comparative Approach with Mathematica Support. (Cambridge University Press, Cambridge). doi: 10.1017/CBO9780511791277. Guyon, I., Gunn, S., Nikravesh, M., Zadeh, L. A., eds. (2006): Feature Extraction: Foundations and Applications. (Springer, Berlin). doi:10.1007/978-3-540-35488-8. Hailperin, T. (1996): Sentential Probability Logic: Origins, Development, Current Status, and Technical Applications. (Associated University Presses, London). - (2011): Logic with a Probability Semantics: Including Solutions to Some Philosophical Problems. (Lehigh University Press, Plymouth, UK). He, K., Zhang, X., Ren, S., Sun, J. (2016): Deep residual learning for image recognition. IEEE Conf. Comput. Vis. Pattern Recognit. (CVPR) 2016, 770–778. doi:10.1109/CVPR.2016.90, https://openaccess.thecvf.com/content_cvpr_2016/html/He_Deep_Residual_ Learning_CVPR_2016_paper.html. Hingorani, A. D., Kuan, V., Finan, C., Kruger, F. A., Gaulton, A., Chopade, S., Sofat, R., MacAllister, R. J., et al. (2019): Improving the odds of drug development success through human genomics: modelling study. Sci. Rep. 9, 18911. doi:10.1038/s41598-019-54849-w. Hjort, N. L. (1996): Bayesian approaches to non- and semiparametric density estimation. In: Bernardo, Berger, Dawid, Smith (1996): 223–253. With discussion by M. Lavine, M. Gasparini, and reply. Hunink, M. G. M., Weinstein, M. C., Wittenberg, E., Drummond, M. F., Pliskin, J. S., Wong, J. B., Glasziou, P. P. (2014): Decision Making in Health and Medicine: Integrating Evidence and Values, 2nd ed. (Cambridge University Press, Cambridge). doi:10.1017/ CBO9781139506779. First publ. 2001. Ishwaran, H., Zarepour, M. (2002): Dirichlet prior sieves in finite normal mixtures. Stat. Sinica 123, 941–963. http://www3.stat.sinica.edu.tw/statistica/J12n3/j12n316/ j12n316.htm. Jaynes, E. T. (2003): Probability Theory: The Logic of Science. (Cambridge University Press, Cambridge). Ed. by G. Larry Bretthorst. First publ. 1994. doi:10 . 1017 / CBO9780511790423, https : / / archive . org / details / XQUHIUXHIQUHIQXUIHX2, http : //www-biba.inrialpes.fr/Jaynes/prob.html. Jeffreys, H. (1983): Theory of Probability, 3rd ed. with corrections. (Oxford University Press, London). First publ. 1939. Jenny, M. A., Keller, N., Gigerenzer, G. (2018): Assessing minimal medical statistical literacy using the Quick Risk Test: a prospective observational study in Germany. BMJ Open 8, e020847, e020847corr2. doi:10.1136/bmjopen- 2017- 020847, doi:10.1136/bmjopen- 2017-020847corr2. Johnson, N. L., Kemp, A. W., Kotz, S. (2005): Univariate Discrete Distributions, 3rd ed. (Wiley, New York). First publ. 1969. Johnson, N. L., Kotz, S., Balakrishnan, N. (1994): Continuous Univariate Distributions. Vol. 1, 2nd ed. (Wiley, New York). First publ. 1970. - (1995): Continuous Univariate Distributions. Vol. 2, 2nd ed. (Wiley, New York). First publ. 1970. - (1996): Discrete Multivariate Distributions. (Wiley, New York). First publ. 1969 in chapter form. Kotz, S., Balakrishnan, N., Johnson, N. L. (2000): Continuous Multivariate Distributions. Vol. 1: Models and Applications, 2nd ed. (Wiley, New York). First publ. 1972 by N. L. Johnson and S. Kotz. 50 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers Koutsoukas, A., Monaghan, K. J., Li, X., Huan, J. (2017): Deep-learning: investigating deep neural networks hyper-parameters and comparison of performance to shallow methods for modeling bioactivity data. J. Cheminf. 9, 42. doi:10.1186/s13321-017-0226-y. Kruskal, W., Mosteller, F. (1979a): Representative sampling, I: Non-scientific literature. Int. Stat. Rev. 471, 13–24. See also Kruskal, Mosteller (1979b,c; 1980). - (1979b): Representative sampling, II: Scientific literature, excluding statistics. Int. Stat. Rev. 472, 111–127. See also Kruskal, Mosteller (1979a,c; 1980). - (1979c): Representative sampling, III: The current statistical literature. Int. Stat. Rev. 473, 245–265. See also Kruskal, Mosteller (1979a,b; 1980). - (1980): Representative sampling, IV: The history of the concept in statistics, 1895–1939. Int. Stat. Rev. 482, 169–195. See also Kruskal, Mosteller (1979a,b,c). Kyburg Jr., H. E., Smokler, H. E., eds. (1980): Studies in Subjective Probability, 2nd ed. (Robert E. Krieger, Huntington, USA). First publ. 1964. Landrum, G., Kelley, B., Tosco, P., sriniker, NadineSchneider, Vianello, R., gedeck, adalke, et al. (2017): RDKit: open-source cheminformatics software. https://www.rdkit.org. Release doi:10.5281/zenodo.268688. Lindley, D. V. (1988): Making Decisions, 2nd ed. (Wiley, London). First publ. 1971. Lindley, D. V., Novick, M. R. (1981): The role of exchangeability in inference. Ann. Stat. 91, 45–58. doi:10.1214/aos/1176345331. Ling, C. X., Sheng, V. S. (2017): Cost-sensitive learning. In: Sammut, Webb (2017): 285–289. doi:10.1007/978-1-4899-7687-1_181. Luce, R. D., Raiffa, H. (1957): Games and Decisions: introduction and critical survey. (Wiley, New York). Lundervold, A. S., Lundervold, A. (2019): An overview of deep learning in medical imaging focusing on MRI. Z. Med. Phys. 292, 102–127. doi:10.1016/j.zemedi.2018.11.002. MacKay, D. J. C. (1992a): The evidence framework applied to classification networks. Neural Comput. 45, 720–736. http://www.inference.phy.cam.ac.uk/mackay/PhD.html, doi: 10.1162/neco.1992.4.5.720. - (1992b): Bayesian interpolation. Neural Comput. 43, 415–447. http://www.inference. phy.cam.ac.uk/mackay/PhD.html, doi:10.1162/neco.1992.4.3.415. - (1992c): A practical Bayesian framework for backpropagation networks. Neural Comput. 43, 448–472. http : / / www . inference . phy . cam . ac . uk / mackay / PhD . html, doi: 10.1162/neco.1992.4.3.448. - (2005): Information Theory, Inference, and Learning Algorithms, Version 7.2 (4th pr.) (Cambridge University Press, Cambridge). https://www.inference.org.uk/itila/ book.html. First publ. 1995. Müller, P., Quintana, F. A. (2004): Nonparametric Bayesian data analysis. Stat. Sci. 191, 95–110. http://www.mat.puc.cl/~quintana/publications/publications.html. Murphy, K. P. (2012): Machine Learning: A Probabilistic Perspective. (MIT Press, Cambridge, USA). https://probml.github.io/pml-book/book0.html. Neal, R. M. (1993): Probabilistic inference using Markov chain Monte Carlo methods. Tech. rep. CRG-TR-93-1. (University of Toronto, Toronto). http://www.cs.utoronto.ca/ ~radford/review.abstract.html, https://omega0.xyz/omega8008/neal.pdf. Neal, R. M., Zhang, J. (2006): High dimensional classification with Bayesian neural networks and Dirichlet diffusion trees. In: Guyon, Gunn, Nikravesh, Zadeh (2006): ch. 10:265–296. doi: 10.1007/978-3-540-35488-8_11. Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., Killeen, T., Lin, Z., et al. (2019): PyTorch: an imperative style, high-performance deep learning library. Adv. Neural 51 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers Inf. Process. Syst. (NIPS) 32, 8026–8037. https : / / papers . nips . cc / paper / 9015 - pytorch-an-imperative-style-high-performance-deep-learning-library. https: //pytorch.org. Pearl, J. (1988): Probabilistic Reasoning in Intelligent Systems: Networks of Plausible Inference, rev. 2nd pr. (Kaufmann, San Francisco). doi:10.1016/C2009-0-27609-4. Pedregosa, F., Varoquaux, G., Gramfort, A., Michel, V., Thirion, B., Grisel, O., Blondel, M., Prettenhofer, P., et al. (2011): Scikit-learn: machine learning in python. J. Mach. Learn. Res. 1285, 2825–2830. https://www.jmlr.org/papers/v12/pedregosa11a.html. https://scikit-learn.org. Porta Mana, P. G. L. (2019): A relation between log-likelihood and cross-validation log-scores. Open Science Framework doi:10.31219/osf.io/k8mj3, hal:hal-02267943, arXiv doi: 10.48550/arXiv.1908.08741. Pratt, J. W., Raiffa, H., Schlaifer, R. (1996): Introduction to Statistical Decision Theory, 2nd pr. (MIT Press, Cambridge, USA). First publ. 1995. Provost, F. (2000): Machine learning from imbalanced data sets 101. Tech. rep. WS-00-05-001. (AAAI, Menlo Park, USA). https://aaai.org/Library/Workshops/2000/ws00- 05- 001.php. R Core Team (2023): R: A Language and Environment for Statistical Computing. R Foundation for Statistical Computing. https://www.R-project.org. First released 1995. Raiffa, H. (1970): Decision Analysis: Introductory Lectures on Choices under Uncertainty, 2nd pr. (Addison-Wesley, Reading, USA). First publ. 1968. Raiffa, H., Schlaifer, R. (2000): Applied Statistical Decision Theory, repr. (Wiley, New York). First publ. 1961. Rasmussen, C. E. (1999): The infinite Gaussian mixture model. Adv. Neural Inf. Process. Syst. (NIPS) 12, 554–560. https://www.seas.harvard.edu/courses/cs281/papers/ rasmussen-1999a.pdf. Rizvi, M. H., Rustagi, J. S., Siegmund, D., eds. (1983): Recent Advances in Statistics: Papers in Honor of Herman Chernoff on His Sixtieth Birthday. (Academic Press, New York). Rogers, D., Hahn, M. (2010): Extended-connectivity fingerprints. J. Chem. Inf. Model. 505, 742–754. doi:10.1021/ci100050t. Russakovsky, O., Deng, J., Su, H., Krause, J., Satheesh, S., Ma, S., Huang, Z., Karpathy, A., et al. (2015): ImageNet large scale visual recognition challenge. Int. J. Comput. Vis. 1153, 211–252. doi:10.1007/s11263-015-0816-y. https://www.image-net.org. Russell, S. J., Norvig, P. (2022): Artificial Intelligence: A Modern Approach, Fourth Global ed. (Pearson, Harlow, UK). http://aima.cs.berkeley.edu/global- index.html, https : / / archive . org / details / artificial - intelligence - a - modern - approach - 4th-edition. First publ. 1995. Sammut, C., Webb, G. I., eds. (2017): Encyclopedia of Machine Learning and Data Mining, 2nd ed. (Springer, Boston). doi:10.1007/978-1-4899-7687-1. First publ. 2011. Self, M., Cheeseman, P. C. (1987): Bayesian prediction for artificial intelligence. In: Proceedings of the third conference on uncertainty in artificial intelligence (uai'87), ed. by J. Lemmer, T. Levitt, L. Kanal (AUAI Press, Arlington, USA): 61–69. Repr. in arXiv doi:10.48550/ arXiv.1304.2717. Sink, R., Gobec, S., Pečar, S., Zega, A. (2010): False positives in the early stages of drug discovery. Curr. Med. Chem. 1734, 4231–4255. doi:10.2174/092986710793348545. Smith, J. E., Winkler, R. L. (2006): The optimizer's curse: skepticism and postdecision surprise in decision analysis. Manag. Sci. 523. doi:10.1287/mnsc.1050.0451. 52 Dyrland, Lundervold, Porta Mana Probability transducer for classifiers Sox, H. C., Higgins, M. C., Owens, D. K. (2013): Medical Decision Making, 2nd ed. (Wiley, New York). doi:10.1002/9781118341544. First publ. 1988. Svetnik, V., Liaw, A., Tong, C., Culberson, J. C., Sheridan, R. P., Feuston, B. P. (2003): Random forest: a classification and regression tool for compound classification and QSAR modeling. J. Chem. Inf. Comput. Sci. 436, 1947–1958. doi:10.1021/ci034160g. Thorburn, D. (1986): A Bayesian approach to density estimation. Biometrika 731, 65–75. Wald, A. (1949): Statistical decision functions. Ann. Math. Stat. 202, 165–205. doi:10.1214/ aoms/1177730030. Walker, S. G. (2013): Bayesian nonparametrics. In: Damien, Dellaportas, Polson, Stephens (2013): ch. 13:249–270. Wolpert, D. H., ed. (2018): The Mathematics of Generalization, repr. (CRC Press, Boca Raton, USA). doi:10.1201/9780429492525. First publ. 1995. 53
http://arxiv.org/abs/2302.10575v1
2023-02-21T10:06:01
2023-02-21T10:06:01
Managing multi-facet bias in collaborative filtering recommender systems
Due to the extensive growth of information available online, recommender systems play a more significant role in serving people's interests. Traditional recommender systems mostly use an accuracy-focused approach to produce recommendations. Today's research suggests that this single-dimension approach can lead the system to be biased against a series of items with certain attributes. Biased recommendations across groups of items can endanger the interests of item providers along with causing user dissatisfaction with the system. This study aims to manage a new type of intersectional bias regarding the geographical origin and popularity of items in the output of state-of-the-art collaborative filtering recommender algorithms. We introduce an algorithm called MFAIR, a multi-facet post-processing bias mitigation algorithm to alleviate these biases. Extensive experiments on two real-world datasets of movies and books, enriched with the items' continents of production, show that the proposed algorithm strikes a reasonable balance between accuracy and both types of the mentioned biases. According to the results, our proposed approach outperforms a well-known competitor with no or only a slight loss of efficiency.
[ "Samira Vaez Barenji", "Saeed Farzi" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10575v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10575v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.IR", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.IR", "cs.LG" ]
Managing multi-facet bias in collaborative filtering recommender systems Samira Vaez Barenji1, Saeed Farzi2 1Computer Engineering Faculty, K. N. Toosi University of Technology, Tehran, Iran, [email protected] 2Computer Engineering Faculty, K. N. Toosi University of Technology, Tehran, Iran, Iran School of Computer Science, Institute for Research in Fundamental Sciences (IPM), Tehran, Iran, [email protected] Abstract Due to the extensive growth of information available online, recommender systems play a more significant role in serving people's interests. Traditional recommender systems mostly use an accuracy-focused approach to produce recommendations. Today's research suggests that this single-dimension approach can lead the system to be biased against a series of items with certain attributes. Biased recommendations across groups of items can endanger the interests of item providers along with causing user dissatisfaction with the system. This study aims to manage a new type of intersectional bias regarding the geographical origin and popularity of items in the output of state-of-the-art collaborative filtering recommender algorithms. We introduce an algorithm called MFAIR, a multi-facet post-processing bias mitigation algorithm to alleviate these biases. Extensive experiments on two real-world datasets of movies and books, enriched with the items' continents of production, show that the proposed algorithm strikes a reasonable balance between accuracy and both types of the mentioned biases. According to the results, our proposed approach outperforms a well-known competitor with no or only a slight loss of efficiency. Keywords Fairness; recommender systems; collaborative filtering; popularity; geographic bias. 1. Introduction Recommender system (RS) is a kind of information filtering system that helps users find their items of interest [1]. These systems predict users' preferences and ratings for unknown items by learning their interactive patterns in historical data. The training data fed to a recommender model may be imbalanced, which would cause the model to discriminate unfairly against individual items or groups of items [2, 3]. Bias occurs when discrimination systematically results in unfair outcomes [4]. Users are among the most important stakeholders in any RS, but they are not the only group [5]. The interests of system owners, item providers, and users are intertwined in these systems. Any kind of bias can endanger the interests of one or more of these groups. For instance, if item providers do not receive enough exposure in recommendations, they would eventually leave the system. On the other hand, since provider bias results in an unbalanced share of visibility for providers, this limits the user's choices and thus results in their dissatisfaction. Sometimes the origin of bias is directly related to the sensitive attributes of the items (e.g., race or gender) [6, 7]. This might reveal the prevalence of cultural or political discrimination within a society, which is reflected in the data and reinforced by the RS model [8]. These sensitive attributes can belong to item providers or users. For example, users in a movie recommendation system may observe a different distribution of movie genres in their recommendation list depending on their gender [9]. Data imbalance, however, can be tied to the underlying mechanisms of a society or an industry. It does not always point to social discrimination or a biased data collection process. An obvious case of this phenomenon is the modern film industry, where Hollywood holds the highest market share of both movies produced and revenues1. Gómez et al. [10] demonstrate how state-of-the-art collaborative filtering (CF) algorithms reinforce the geographic imbalance of providers in the input data. They propose a post-processing method to balance the actual distribution of items belonging to different geographical areas. They suggest two measures of visibility and exposure which we are inspired by to assess the existing geographic bias in recommendations. Different kinds of bias in information retrieval and RS are considered in the literature, and various definitions are provided for each [11]. In this study, bias in RS is simultaneously examined from two different perspectives: the geographical origin of item providers and the items' popularity. Each of these two cases has been studied independently in recent studies [3, 12, 13]. But when items are discriminated against in several different ways, the problem of intersectional bias arises. Intersectional bias means that an under-represented item is likely to be subject to more discrimination than other under-represented items due to having more than one sensitive attribute at a time [14]. Therefore, bias management for a single aspect cannot ensure the fairness of the system. In this research, the goal is to simultaneously improve two facets of bias in CF recommender systems to overcome the intersectional bias problem. In order to examine this problem in the state-of-the-art CF algorithms, we consider two well-known domains of RS: movies and books. A continent is considered as the granularity level of geographical origin. In both of our datasets, North America accounts for the largest share in terms of both produced items and given ratings. As shown in [10], this imbalance leads to biased recommendations across continents. According to UNESCO, our two study areas, cinema and literature are effective platforms for culture, education, entertainment, and propaganda [3]. Therefore, assessing how recommender systems might encourage a nation's product consumption is an important topic in terms of provider fairness [3]. Furthermore, the items from both datasets are classified into different popularity groups. Similar to geographic imbalance, popularity imbalance also leads to unfair results for long-tail or under-represented groups [15, 16]. The overall objective is to provide a better opportunity for under-represented items to be exposed by improving fairness from two different aspects, which in turn can attract the user's interest. Our proposed algorithm conducts a set of optimal swaps in recommendation lists to improve the distribution of under-represented groups in the output of a recommender algorithm. These swaps slightly demote the over-represented items in the lists while promoting the under-represented items with the highest scores. Note that the geographical distribution of recommendations is adjusted according to the continents' distribution in the input data, based on the equity concept [17]. While establishing geographic equity, the algorithm gains more visibility and exposure [3] for items from sensitive popularity groups. We intend to examine both mentioned biases in terms of visibility and exposure and provide an algorithm to manage them. Additionally, comparing our approach to the one proposed in [3] demonstrates how it ignores popularity bias and occasionally even exacerbates it. The results of our experiments show that the presented approach in this paper can establish a reasonable and flexible balance between the two facets of bias while maintaining the quality of the recommendations. To the best of our knowledge, there are very few studies of intersectional bias in the literature, and a great lack is felt in the scope of the multifaceted bias examination. 1 https://www.boxofficepro.com/global-box-office-rebounds-to-21-3-billion-in-2021-as-exhibition-transitions-from- closures-to-blockbusters/ The rest of the paper is structured as follows: in Section 2, we present background and related work. The problem formulation and our proposed approach are discussed in Section 3, and in Section 4, experimental studies are provided. We conclude the paper and suggest future work in Section 5. 2. Background and related work In this section, previous works in the literature are discussed in two separate parts. The first part reviews some recent studies in the traditional RS area. The second part focuses on fairness in recommendation and ranking, which is the main scope of this work. 2.1. Traditional recommender systems The foundation of traditional RSs is solely built on maximizing accuracy and user satisfaction [18, 19]. They use the user's previous interactions and preferences to predict their actual interests. Reddy et al. [20] present a content-based movie recommender system that operates based on genre correlation. It recommends those movies to the user that are likely to be of their favorite genre. Jiang et al. [21] propose a CF recommender system in the E-commerce domain that uses trust data to achieve higher accuracy. A cross-domain CF algorithm is proposed in [22], which expands user and item features via the latent factor space of auxiliary domains to address the data sparsity problem of CF methods. Sujithra Alias Kanmani et al. [23] use the temporal characteristics of transactions and demographic attributes to solve the cold start and data sparsity problems as well as increase accuracy in a movie recommender system. CF methods are more prone to bias generation since they leverage the existing patterns of user interactions in historical data to make recommendations. Furthermore, we don't need descriptive features of items or demographic attributes about users to implement CF methods. Therefore, CF methods will be the main focus of this study. 2.2. Fairness in recommendation A recommender system, like any data-driven system, is prone to amplifying the inherent bias in data and delivering unfair output. The fairness issue in RS has attracted a lot of attention in recent years. The literature has focused on either user fairness, provider fairness, or both. Burke et al. [24] propose a balanced neighborhood mechanism to maintain personalization in RS while improving the fairness of recommendations for protected groups. Li et al. [25] classify users into different groups based on their activity level in the system, and by offering a re-ranking technique, they reduce the bias of the RS towards a protected group. Abdollahpouri et al. [26] examine popularity bias from a user perspective by dividing users into different groups according to their interest in long-tail items. Unlike them, we measure popularity bias based on the distribution of popularity groups in the entire input data rather than considering a personalized form of popularity bias for users. Managing geographic bias along with a personalized version of popularity bias for users can be addressed in future work. Regarding provider-side fairness, Gómez et al. [3, 10] adjust the geographic distribution of items in the movie and book recommender systems to establish the geographic equity of providers in the output. They propose a post-processing method to achieve this goal. They also applied their method to an educational RS [12]. We demonstrate how popularity bias is ignored in their work and then combine geographic and popularity fairness to achieve fair and high-quality recommendations. Qi et al. [27] introduce a fairness- aware news recommendation framework that learns fair recommendation models for various news provider groups from biased user data. Abdollahpouri et al. [28] present a configurable regularization-based framework to establish a flexible trade-off between accuracy and coverage rate of long-tail items in a learning-to-rank RS. Zhang et al. [13] leverage the popularity bias in recommendation using a new training paradigm for recommendation, which adjusts the recommendation score with the desired popularity bias via causal intervention. Lin et al. [29] propose measures and a framework to assess and manage popularity bias in conversational recommender systems. Considering both item-side and user-side fairness, Ranjbar Kermany et al. [16] present a fairness-aware multi-objective recommender system using an evolutionary method. They consider personalized diversity and popularity along with provider fairness to achieve high-quality recommendations. The two-sided fairness problem in E-commerce platforms is also formulated as a multi-objective optimization problem in [30]. Patro et al. [31] map the fairness-aware recommendation problem to the constrained fair allocation of indivisible goods to ensure a minimum level of fairness for both users and providers. In this research, we will only focus on provider fairness and popularity bias while maintaining the accuracy of recommendations. 3. Proposed method In this Section, we first define the preliminaries of the problem as well as both popularity and geographic bias. Then, to address the issue, the post-processing mitigation approach is presented in Section 3.2. 3.1. Preliminaries Consider a set of users U = {u1, u2, ... un} and a set of items I = {i1, i2, ... , im} where each user has rated one or more items. The whole data can be formed as a set of triplets in which each record consists of user ID, movie ID, and the corresponding rating. To train and evaluate the recommender model, the data is split into test and train sets in a fixed ratio. The whole training data can be defined as D = {(u, i, rui) ∶ u ∈ U, i ∈ Φu, Φu ⊆ I}. rui denotes the rating of user u for item i, and Φu represents the subset of items rated by user u in the input data. After feeding the algorithm with the training dataset, the recommender learns a function that estimates the relevance value ruî for each user-item pair (u, i) that doesn't exist in the training data ((u, i, ruî) ∉ D). The top-n items with the highest predicted relevance values ruî form their recommendation list Ψu. In the following, two concepts of popularity and geographic bias are explained based on the above notations. Popularity bias: The popularity of an item is defined as the number of ratings the item has received in the dataset [13, 32]. Sorting the items based on their popularity rate in the input data, they fall into three separate categories, with 10% of the items on top of the list in group 1 (the most popular), the next 10% in group 2 (relatively popular), and the remaining items being placed in group 3 (unpopular). Since the frequency of the items in these groups is very unbalanced, the total popularity value of a group is not a suitable measure to determine the share of that group's popularity in the whole data. According to equation 1, the total popularity value of each group is divided by the total number of items in that group. Pg = ∑ πi i∈g |g| (1) Where g is a popularity group, and πi is the popularity of item i. The Pg values are then normalized to sum the popularity values of the three groups to 1. As shown in Figure 1, there is a severe imbalance across the popularity proportion of popularity groups. Our goal is to bring the share of each popularity group in the whole recommendation listsΨ close to the value obtained for that group in equation 1, such that the efficiency of the system does not decrease as much as is feasible. Geographic bias: As mentioned in Section 1, the production continent serves as the geographic granularity level in this study. Figure 2 illustrates the distribution of produced items and given ratings at the continent level for both the MovieLens-1M and Book-Crossing datasets. As shown in the figure, there is a significant imbalance in the geographical distribution of items and ratings in both datasets. Figure 1. Popularity representation in the input data: a) MovieLens-1M and b) Book-Crossing datasets. Group 1 includes the most popular items. Groups 2 and 3 include long-tail items. Figure 2. Continent representation in the input data: a) MovieLens-1M and b) Book-Crossing datasets. PI denotes the proportion of items belonging to a continent, and PR denotes the proportion of ratings given to items of a continent. In order to establish geographical equity in the recommendations, the distribution of the producer continents of items inΨ is expected to closely match their distribution in the input data, which is henceforth called the target proportions. The target proportions can be defined in two ways: i) The proportion of items belonging to each continent in the input data given in equation 2. ii) The proportion of available ratings for items of each continent in the input data given in equation 3. PI(c) = |{i: i ∈ Φc}| ∑ c∈C |{i: i ∈ Φc}| (2) PR(c) = c}| |{rui: u ∈ U, i ∈ Φu ∑ |{rui: u ∈ U, i ∈ Φu c∈C c}| (3) c denotes the items belonging to continent c, which are rated by user u. PI (c) and PR(c) are the item- Φu based and rating-based target proportions for continent c, respectively. Note that, in our study, an item can belong to more than one continent. The goal is to match the distribution of continents in Ψ with one of the target proportions mentioned above while imposing the least loss in accuracy. Figure 3 illustrates a toy example where the output of a vanilla (i.e., unaware of bias) traditional CF technique is compared to two different fairness-ware recommendation lists. Figure 3. A toy example to explain the intersectional bias of popularity and geographical origin. R2 accounts for geographic bias, and R3 accounts for both geographic and popularity bias. As shown in the figure, there is a geographical imbalance in the item dataset. Out of the total of eight books, NA (North America) and EU (Europe) represent three and two of them, respectively. While AF (Africa), SA (South America), and AS (Asia) are each represented by a single item. Additionally, in the rating dataset, some items like I4 or I5 have received fewer ratings than others, or the average rating value they have received is quite low. As a result, items I3, I4, I5, I7, and I8 are placed in the second popularity group (i.e., items with relative popularity). Items I4, I5, and I8 are subject to intersectional discrimination since they belong to an under-represented continent, and at the same time, to the second popularity group. There are three recommendation lists for user 4 at the bottom of the figure. R1 includes the top-4 recommendations based on the relevance scores predicted by the matrix factorization algorithm. There is one item from EU and three from NA in R1, as would be expected. Moreover, only one item from the second popularity group is included in this list. R1 is re-ranked in two ways, including R2 and R3, to generate a fairness-aware recommendation list. In R2, I1 is excluded from the list, and the 5th highest-scoring item, according to the predicted scores, is included in the list. I1 is selected as the best choice to be excluded from the list since it is a geographically over-represented item from the first popularity group, and has a lower score than its peers and is expected to result in a lower loss if we exclude it. Similarly, item I1 in R3 is excluded from the list and replaced with the 6th highest-scoring item for the target user. I5 can be a better choice than I7 to be added to the list since it belongs to an under-represented continent that has got no share in the list, and at the same time, belongs to the second popularity group. As a result, it experiences a kind of intersectional discrimination. On the other hand, there is just a slight difference in their predicted scores with I7, which leads to a negligible efficiency loss. R3 has intelligently handled both kinds of geographic and popularity bias overall, highlighting our intended approach in this study. In essence, both types of biases will be measured based on a target distribution derived from the input data. We refer to the set of g. In recommended items to user u belonging to a group g (i.e., a continent or popularity group) as Ψu addition, the measurement of both biases will be based on two scales: visibility and exposure [3, 33]. Visibility means the proportion of items from each group in the top-k. Exposure describes how far items in a group have been placed in higher positions. Finally, all the notations are summarized in Table 1. Table 1. A summary of notations. notation meaning U I D Φu ruî Ψu g Ψu Ψ Pg PI(c) PR(c) Set of users Set of items Training data Subset of items rated by user u in the training data Predicted relevance value for the user-item pair (u, i) Recommendation list of user u Set of items belonging to group g (e.g., a continent or popularity group) in Ψu Total recommendation lists Target proportion for popularity group g Item-based target proportion for continent c Rating-based target proportion for continent c 3.2. Approach In this section, we introduce MFAIR, a multi-facet post-processing bias mitigation algorithm. The proposed algorithm adopts a flexible and adjustable approach to managing the trade-off between popularity bias and accuracy. Algorithm 1 provides the pseudo-code for MFAIR. The algorithm operates based on raising the position of an item in the list, considering the geographic and popularity bias in the entire recommendations. An item is chosen to be promoted, considering all the recommendation lists and all possible swaps to impose the least loss on the system. Algorithm 2 presents the supporting function called in MFAIR. Figure 4 shows the main procedure of our approach, considering both visibility and exposure of popularity groups and continents. The distribution of groups is adjusted in two phases. The first phase re-ranks the lists to mitigate bias in terms of visibility, and the second phase in terms of exposure. In both phases MFAIR takes the recommendation lists for all users, the target proportions for popularity groups and continents, as well as the bias type (i.e., visibility or exposure) as input. In the second phase, the input recommendation lists are the output of the previous phase, re-ranked for visibility. This two-phase multi- facet bias mitigation process results in fairness-aware recommendation lists in terms of both visibility and exposure. MFAIR adjusts the visibility or exposure of popularity groups and continents in recommendations, taking into account their bias rates. The bias rate of a group is the difference between the target proportion of the group and its actual exposure or visibility proportion in the recommendations. First, the required data structures are initialized, and the existing biases in the recommendations are calculated for popularity groups and continents (lines 2 and 3) based on the bias type. Figure 4. A flowchart of the proposed approach. ALGORITHM 1. MFAIR: MULTI-FACET BIAS MITIGATION ALGORITHM Input: recs: initial recommendation lists targetCont: list of the target proportions for all continents targetPop: list of the target proportions for all popularity groups biasType: visibility or exposure recs: re-ranked fair recommendation lists Output: define MFAIR (recs, targetCont, targetPop, biasType) begin recsUp, recsDown, swaps ← list (), list (), list (); contDelta, popDelta ← calculate biases for continents and popularity groups based on biasType; foreach user ∈ recs do foreach rec ∈ user.recs (top-n) do // loop through the top-n recommended items to each user if rec.position == True and underRepresented (rec, biasType ) == False then recsDown.add (rec); elseif rec.position == False and underRepresented (rec, biasType ) == True then recsUp.add (rec); end end while recsUp.size != 0 and recsDown.size != 0 do recUp ← recsUp.pop(first); recDown ← recsDown.pop(last); loss = recDown.relevance – recUp.relevance; swaps.add (id, recDown, recUp, loss); end end addPenalty (swaps, popDelta); // Add some penalty to each loss value based on the popularity group of items swaps.sortAscending (key = loss); // sort possible swaps based on the loss values while any (contDelta > 0) and swaps.size != 0 do swap ← swaps.pop (nextItem); if swap.position == True and underRepresented (swap, biasType) == True then recs.swap ( swap.recDown, swap.recUp); contDelta, popDelta ← update biases for continents and popularity groups based on biasType; end end return recs; end 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 ALGORITHM 2. SUPPORTING FUNCTION 1 define addPenalty (swaps, popDelta) begin 2 3 4 5 6 7 8 9 10 11 12 averageLoss = |swaps. loss| foreach swap ∈ swaps do ̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅; // calculate the average of absolute loss values if popDelta [swap.recUp] > 0 and popDelta [swap.recDown] < 0 then swap.loss -= (averageLoss * eps); elseif popDelta [swap.recUp] < 0 and popDelta [swap.recDown] > 0 then swap.loss += (averageLoss * eps); end end return swaps end Then two lists of items that can be demoted and promoted are created as recsDown and recsUp, respectively. recsDown contains items that don't belong to an under-represented continent and can be demoted to lower positions in the list. recsUp includes items that belong to an under-represented continent, and the geographic bias can be reduced by promoting their position in the list. Underrepresented(.) returns true if the given item is under-represented in recs. In lines 12-17, the pair of items are stored in swaps whose swapping in a user's list causes the minimum loss. The selection process of these pairs is as follows: At each iteration, the item with the lowest score from recsDown and the item with the highest score from recsUp is selected. The two selected items represent a possible minimum-loss swap, and they are added as a record to swaps along with the potential loss value that would result from making this swap. In line 19, a penalty value is added to each swap loss to prioritize swaps based on their imposable popularity bias. Then, swaps is sorted based on the loss values, and they are performed respectively until we reach the desired geographical distribution. Finally, the re- ranked lists are returned. Algorithm 2 first calculates the average of absolute loss values as the base value of the penalty. Then, for each swap, it adds or subtracts an epsilon of the calculated average to or from each loss value. If the item to be swapped out is in an over-represented popularity group and the one to be swapped in is from an under- represented popularity group, the penalty value will be subtracted from its loss to prioritize this swap, and in the opposite case, the value will be added to its loss. In case the swapping items are both from an under- or over-represented group, the loss remains unchanged. eps is an adjustable parameter with a value between 0 and 1. If it is equal to 1, the popularity bias will improve the most. 4. Experimental studies We perform a set of experiments on two real-world datasets enriched with producer continents of items to evaluate our proposed approach. The Java LibRec library v.2 is used to implement some state-of-the-art CF recommender algorithms and generate initial recommendation lists. The length of each recommendation list (top-n) will be 150, while the re-reranked lists will contain 20 items (top-k) for each user. In the following, both datasets of our study are introduced. Then, the evaluation measures are described in section 4.2. Finally, we report the results of our experiments and compare our approach to a state-of-the-art post- processing method in this scope. 4.1. Datasets MovieLens-1M. This is a well-known movie dataset in the recommendation domain provided by the GroupLens research group2. It contains 1,000,209 ratings given by 6,040 users on 3,706 movies. Each user has rated at least 20 movies in the range (1-5). The IMDb ID provided for each movie allowed us to enrich the dataset with movies' continents of production using OMDB APIs3. The items in the dataset belong to one or more of the six continents of Africa, Asia, Europe, North America, Oceania, and South America. Book-Crossing. The dataset is collected by Cai-Nicolas Ziegler over a 4-week crawl from the Book- Crossing community [34]. It includes 1,149,781 ratings given by 105,283 users on 340,556 books in the range (1-10). Since the rating data was quite sparse for this dataset, we removed users and books with less than five ratings. This process resulted in 132,762 ratings given by 7,704 users on 13,631 items. We enriched the dataset with the books' continents of production using the data provided by [3]. The books in the dataset belong to one of the four continents of Europe, North America, Oceania, and South America. Table 2 provides an overview of statistics for both datasets. Table 2. A summary of statistical information of both datasets: Number of items (|I|), number of users (|U|), number of ratings (|R|), and item's proportion ( PI(c)) – ratings' proportion ( PR(c)) – average rating (AR(c)) across continent c (AF: Africa, AS: Asia, EU: Europe, NA: North America, OC: Oceania, SA: South America) Dataset |I| |U| |R| PI(c)- PR(c)- AR(c) MovieLens-1M 3,706 6,040 1,000,209 AF : 0.42- 0.32- 3.97 AS : 3.72- 2.24- 3.45 EU : 23.25- 18.22- 3.66 NA : 70.66- 77.55- 3.56 OC : 1.62- 1.60- 3.65 SA : 0.35- 0.08- 3.21 Book-Crossing 13,631 7,704 132,762 EU : 12.68- 7.70- 7.83 NA : 87.21- 92.27- 7.80 OC : 0.07- 0.02- 7.78 SA : 0.04- 0.02- 8.41 PI(c) and PR(c) are in percentage. 4.2. Evaluation metrics As mentioned in the previous sections, the bias evaluation in this study will be in two dimensions. In the following, the evaluation measures for both dimensions of visibility and exposure are explained. Visibility Bias (VB). The visibility bias for a continent c is the difference between the target proportion (rating-based or item-based) of c and its actual visibility proportion in the top-k items of recommendation lists, formulated as follows: 2 https://grouplens.org/ 3 http://www.omdbapi.com/ VB(c)@k = (∑ u∈U c@k| |Ψu ∑ |Ψu c∈C c@k| ) − PI/R(c) (4) Where C is the set of all available continents in the recommendation list of user u, and Ψu top-k recommendations of user u that belong to continent c. The actual proportion of a popularity group in the top-k recommendations is calculated slightly differently than for geographical groups. Thus, the visibility bias for a popularity group g is formulated according to equation 5. c@k denotes the VB(g)@k = ( Vg@k ∑ g∈G Vg@k ) − Pg Vg@k = ∑ u∈U |Ψu g@k| |Φg| (5) Where Vg@k is the visibility of group g in the top-k recommendations. Exposure Bias (EB). The exposure bias for a continent c is the difference between the target proportion (rating-based or item-based) of c and its actual exposure share in top-k of the whole recommendation lists, formulated as follows: EB(c)@k = (∑ u∈U ∑ i∈Ψu c@k 1 log2(1 + posui) ∑ c∈C ∑ i∈Ψu c@k 1 log2(1 + posui ) ) − PI/R(c) (6) posui indicates the position of item i in Ψu. Furthermore, the exposure bias for a popularity group g is formulated according to equation 7. EB(g)@k = ( Eg@k ∑ g∈G Eg@k ) − Pg Eg@k = ∑ u∈U ∑ g@k i∈Ψu 1 log2(1 + posruî ) |Φg| (7) Where Eg@k is the exposure of group g in top-k recommendations. The positive and negative values of the bias measures indicate, respectively, the over- and under- representation of a group in recommendations. In the best scenario, its value will be zero, suggesting that the distribution of a group in the output is fair (i.e., equal to the target proportion of the group). Moreover, the Normalized Discounted Cumulative Gain (NDCG) [35] is used to assess the accuracy of recommendations. 4.4. Configuration and setting parameters All the algorithms are implemented in Python and run on an Intel Core i7-8550U 2.20 GHz CPU with 16 GB RAM. The epsilon parameter in MFAIR is set to 1 for all experiments. This parameter can be tuned to balance the popularity bias rate in recommendations. Decreasing its value can slightly increase the popularity bias, which can, in turn, lead to an improvement in other measures, including accuracy4. 4.5. Mitigation Results In this section, the results of applying MFAIR to the movies and books datasets are examined in terms of accuracy and bias. Figures 5 and 6 show the results of our experiments on the movies and books datasets, respectively. The bar graphs and scatter plots represent the geographic and popularity biases, respectively. As shown by the thick bars in the figures provided for the two datasets, the geographic bias rate of original recommender algorithms in rating-based experiments is often lower than that of an item-based experiment. In other words, the algorithms can better adapt to the geographical distribution of user interactions rather than the distribution of items. Figure 5. Bias representation in MovieLens-1M. Visibility and exposure bias of the state-of-the-art CF algorithms on movies dataset based on PI (figures a and b) and PR (figures c and d). The bar graphs and scatter plots represent the biases for continents and popularity groups, respectively. Thick bars show the bias in vanilla recommendations, and thin bars indicate the bias after applying MFAIR in two phases. The text at the bottom of each figure presents the resulting NDCG of each algorithm before and after mitigation, separated by '/'. 4 We performed extensive experiments with different values of epsilon. To contextualize our approach and compare it to the baseline one, we considered this parameter equal to 1 in all experiments. Figure 6. Bias representation in Book-Crossing. Visibility and exposure bias of the state-of-the-art CF algorithms on books dataset based on PI (figures a and b) and PR (figures c and d). The bar graphs and scatter plots represent the bias for continents and popularity groups, respectively. Thick bars show the bias in vanilla recommendations, and thin bars indicate the bias after applying MFAIR in two phases. The text at the bottom of each figure presents the resulting NDCG of each algorithm before and after mitigation, separated by '/'. This case is only violated in RandomGuess, which fits better with the geographical distribution of items by recommending random items. However, in terms of NDCG, this algorithm is the least efficient technique. As shown in the figures, the height of the thin bars in both datasets, which show the results produced by MFAIR, is much lower than the corresponding thick bars. Even in some cases, especially in the books dataset, it is almost zero. Popularity bias has also improved after mitigation across most experiments. The results show that in both datasets, the popularity bias has improved to a higher degree in the item-based mitigation than in the rating-based scenario since, in the former evaluation, the popularity of items in user interactions is not taken into account. All the recommender algorithms except RandomGuess over-represent the first popularity group while under-representing the other groups. Looking more closely at the performance of algorithms on each dataset, Figure 5 shows that BPR has resulted in the lowest amount of rating-based geographic bias on the movies dataset, both in terms of visibility and exposure. Additionally, this algorithm has achieved the highest NDCG value of all the others, even after bias mitigation. Therefore, it can be claimed that BPR performs the best in terms of both geographic bias and NDCG, considering the rating-based distribution of movies. On the other hand, BiasedMF produces the best results in terms of popularity bias in all experiments on the movies dataset. However, in some experiments, the resulting popularity bias of some algorithms is slightly worsened due to geographical regulation. This phenomenon is observed in rating-based experiments with BiasedMF and SVD++. Compared to others, these two algorithms have caused a higher degree of over-representation for Asia and Europe while simultaneously under-representing North America to a higher degree, and since there are more popular items in the North American item group than in other continent groups, mitigating geographic bias will inevitably result in a slightly more popularity bias. But, as we will see in the following, our approach is better optimized than the competitor one in terms of popularity bias. The NDCG values of RandomGuess, BiasedMF, and SVD++ have slightly improved after bias mitigation in both rating- and item-based experiments. The other algorithms experience just a minor or no loss of accuracy after mitigation. On the books dataset, considering the rating-based experiments, BPR is still the best-performing algorithm in terms of geographic bias. It also has the second-best performance in terms of popularity bias among all other algorithms. The lowest amount of popularity bias is produced by UserKNN. However, itemKNN outperforms the other algorithms in terms of NDCG. Moreover, since the geographical distribution of items in this dataset is highly unbalanced (i.e., a high proportion of items belong to one of the continents of Europe or North America), rating-based experiments have resulted in a lower degree of geographic bias and less geographic bias overall is produced when compared to the movies dataset. Finally, in all of the experiments on this dataset, the NDCG values remain the same after applying the mitigation algorithm. A remarkable trend in both datasets is that among the two most frequent continents in the input data (i.e., North America and Europe), when one is over- or under-represented, the other is directly affected in the opposite direction (e.g., when one is over-represented, the other gets under-represented). This trend is evident in almost all experiments and in all algorithms. Furthermore, the lowest bias rate in each experiment belongs to highly under-represented continents such as Africa and Oceania. Since the share of these continents in the input data is almost equal to zero which results in the least bias. In the following, we compare the results of the approach presented in this paper with those of a state-of- the-art competitor method presented in [3]. Their method mitigates the geographic bias in the output of a vanilla recommender algorithm through a re-ranking approach but ignores the popularity bias in the recommendations. Tables 3-6 show the results of the comparison of the two approaches, MFAIR and the baseline (baseL.), on the movies and books datasets5. For both baseline method and MFAIR, both visibility and exposure biases are reported considering the item-based target distribution (VBI and EBI rows) and rating-based target distribution (VBR and EBR rows) across all continents (Tables 3 and 4) or popularity groups (Tables 5 and 6). Total BS represents the total absolute bias across all groups in a row. For each algorithm, two NDCG values is reported, which are obtained from item- and rating-based re-raking, respectively (from top to bottom). The numbers in bold show an improvement or no change in a measure compared to the one produced by the baseline method. Tables 3 and 4 show the resulting geographic biases of our experiments. Based on the algorithm and other experimental settings, as the popularity bias decreases, the geographic bias of MFAIR gets slightly better or worse than the baseline's. For example, according to the total BS of algorithms SVD++, RandomGuess, and BiasedMF (in rating-based case), our method has performed better in improving the geographic bias, but in cases of UserKNN and ItemKNN (both in rating-based cases), the competitor performs slightly better 5 All numbers in Tables 3-6 except NDCGs are in percentage. while the cost of this improvement is a higher rate of popularity bias. The direct or inverse relationship between geographic and popularity bias is entirely dependent on the algorithm, dataset, target proportions (rating- or item-based), and type of bias measure (exposure or visibility). Additionally, there is no significant difference in terms of NDCG between the two algorithms, and in most experiments, this measure is almost the same or even better with our approach. Tables 5 and 6 show that in both rating- and item-based experiments for all algorithms, the resulting total popularity bias of MFAIR is lower than that of the baseline one. The popularity bias remains the same only for MostPopular on the books dataset when compared to the competitor due to the lack of long-tail items in the algorithm's top-n recommendations. Table 3. The resulting geographic bias and accuracy of different mitigation approaches on MoviesLens-1M dataset6. Algorithm MostPop RandomG UserKNN ItemKNN BPR BiasedMF SVD++ AF AS EU NA OC SA Total BS NDCG baseL. MFAIR baseL. MFAIR baseL. MFAIR baseL. MFAIR baseL. MFAIR baseL. MFAIR baseL. MFAIR baseL. MFAIR VBI EBI VBR EBR VBI EBI VBR EBR VBI EBI VBR EBR VBI EBI VBR EBR VBI EBI VBR EBR VBI EBI VBR EBR VBI EBI VBR EBR -0.22 -0.24 -0.1 -0.13 0.05 0.03 -0.01 0.01 0.06 0.04 0.2 0.17 -0.08 -0.16 0.4 0.25 0.07 0.07 0.14 0.15 0.16 0.19 0.28 0.34 0.34 0.44 0.5 0.59 -0.22 -0.24 -0.11 -0.13 0.05 0.03 -0.0 0.01 0.06 0.04 0.2 0.16 0.0 -0.1 0.4 0.25 0.07 0.08 0.13 0.15 0.15 0.18 0.25 0.31 0.33 0.43 0.48 0.57 0.21 -0.99 1.74 0.55 -0.13 -0.09 0.23 0.35 0.37 0.22 -0.98 1.75 0.56 -0.19 -0.14 0.21 0.33 0.45 -0.87 -0.81 1.69 0.51 -3.14 -3.29 1.06 0.23 0.0 1.92 0.69 -2.57 -2.88 1.12 0.28 0.0 -0.85 -0.78 2.29 1.26 -0.69 -1.29 1.03 3.33 -0.51 0.07 1.1 1.89 2.54 1.53 -0.81 -1.13 1.04 1.5 -0.36 0.17 -0.19 -0.48 0.23 -5.92 1.23 -3.75 -0.31 -0.15 -1.71 -0.71 0.41 -4.55 1.09 -2.59 0.0 -5.35 1.1 -2.84 0.03 -2.92 -1.76 -3.02 -0.89 1.23 -1.3 0.55 0.14 0.09 -1.39 0.5 0.23 -5.91 1.23 -3.73 -0.19 -0.08 -1.59 -0.65 0.36 -4.56 0.95 -2.66 0.0 -5.28 1.06 -2.86 0.04 -2.61 -2.01 -3.14 -0.72 1.13 -1.25 0.14 0.09 0.05 -1.06 0.69 -1.22 5.93 -4.06 1.91 0.33 0.16 1.38 0.21 -1.27 4.25 -3.69 0.52 3.32 8.89 -2.6 2.3 -0.12 3.37 -0.64 1.62 2.46 0.82 0.72 -1.22 5.91 -4.08 1.86 0.21 0.09 1.27 0.17 -1.35 4.16 -3.83 0.38 2.71 8.38 -2.61 2.28 -0.49 3.09 -0.07 2.05 2.42 0.78 0.8 -3.64 -1.21 1.28 0.59 0.68 -2.17 1.19 0.53 1.78 0.16 1.32 1.55 1.27 1.5 0.05 0.04 1.33 1.55 1.29 1.52 0.1 0.09 -0.01 -0.01 -0.0 0.76 1.46 0.8 1.47 0.22 0.23 0.11 0.14 0.26 0.21 0.03 0.06 -0.73 -0.64 -0.69 -0.58 -0.94 -0.88 -0.82 -0.73 0.0 0.8 1.49 0.84 1.51 0.19 0.2 0.12 0.14 0.62 0.46 -0.52 -0.5 -0.72 -0.65 -0.77 -0.68 -0.94 -0.87 -0.93 -0.87 -0.33 -0.33 -0.08 -0.08 0.02 0.02 0.12 0.14 -0.33 -0.33 -0.08 -0.08 -0.33 -0.33 -0.08 -0.08 -0.24 -0.24 -0.06 -0.07 -0.31 -0.31 -0.03 -0.01 -0.3 -0.3 -0.07 -0.07 -0.33 -0.33 -0.08 -0.08 0.01 0.01 0.12 0.13 -0.33 -0.33 -0.08 -0.08 -0.33 -0.33 -0.08 -0.08 -0.24 -0.24 -0.08 -0.08 -0.31 -0.31 -0.07 -0.07 -0.3 -0.3 -0.07 -0.07 3.53 3.54 0.104 0.104 14.95 14.93 8.48 7.91 0.89 0.49 3.46 1.42 3.2 11.5 7.54 5.35 7.09 8.53 7.88 0.76 0.45 3.21 1.3 3.36 11.39 7.81 5.47 5.8 18.23 17.17 5.36 5.84 0.71 8.02 4.92 6.17 5.24 4.49 4.03 8.44 3.52 2.36 4.58 5.96 5.38 5.88 1.46 7.26 5.35 7.44 5.14 4.17 4.17 3.91 3.21 2.35 4.52 2.83 0.106 0.106 0.011 0.011 0.011 0.012 0.123 0.123 0.125 0.125 0.121 0.121 0.122 0.122 0.137 0.135 0.141 0.14 0.065 0.064 0.065 0.066 0.082 0.081 0.083 0.083 6 All numbers in tables 3-6 except NDCGs are in percentage. Table 4. The resulting geographic bias and accuracy of different mitigation approaches on Book-Crossing dataset. Algorithm MostPop RandomG UserKNN ItemKNN BPR BiasedMF SVD++ EU NA OC SA Total BS NDCG baseL. MFAIR baseL. MFAIR baseL. MFAIR baseL. MFAIR baseL. MFAIR baseL. MFAIR VBI EBI VBR EBR VBI EBI VBR EBR VBI EBI VBR EBR VBI EBI VBR EBR VBI EBI VBR EBR VBI EBI VBR EBR VBI EBI VBR EBR 0.0 -0.83 -0.14 -0.05 -0.0 -0.02 -1.48 -0.65 0.0 -1.7 0.0 0.0 -0.83 -0.14 -0.05 -0.0 -0.03 -1.39 -0.59 0.0 -1.69 0.0 -0.24 -0.25 0.0 0.0 -2.19 -2.02 0.0 -0.62 0.14 -1.5 0.0 -0.05 0.0 -3.41 0.0 0.0 -0.61 0.25 -1.31 0.01 -0.05 0.0 -3.3 0.0 -1.75 -1.73 0.0 -3.4 0.0 0.0 -3.3 0.0 -1.74 -1.73 0.11 0.94 0.18 0.08 0.0 0.01 1.46 0.62 0.04 1.75 -0.0 0.24 0.07 2.27 0.01 0.64 -0.11 1.55 -0.01 0.05 0.09 3.51 0.02 1.78 0.02 3.44 0.0 1.75 0.11 0.94 0.18 0.08 0.0 0.02 1.37 0.56 0.04 1.75 -0.0 0.25 0.07 2.1 0.01 0.64 -0.22 1.36 -0.01 0.05 0.09 3.4 0.02 1.75 0.02 3.35 0.0 1.74 -0.07 -0.07 -0.02 -0.02 0.0 0.01 0.02 0.03 -0.04 -0.05 0.0 -0.01 -0.07 -0.07 -0.02 -0.02 -0.03 -0.05 0.0 -0.01 -0.06 -0.06 -0.0 -0.07 -0.07 -0.02 -0.02 0.0 0.01 0.02 0.03 -0.04 -0.05 0.0 -0.01 -0.07 -0.07 -0.02 -0.02 -0.03 -0.05 0.0 -0.01 -0.06 -0.06 -0.0 -0.01 -0.01 0.0 0.0 -0.02 -0.02 0.0 0.0 -0.04 -0.04 -0.02 -0.02 0.0 0.0 -0.0 0.0 0.0 -0.0 0.0 0.0 0.0 -0.04 -0.04 -0.02 -0.02 0.0 0.0 -0.0 0.0 0.0 -0.0 0.0 0.0 0.0 -0.01 -0.01 0.0 -0.0 0.0 -0.0 0.0 0.0 -0.04 -0.04 -0.02 -0.02 -0.02 -0.02 -0.0 0.0 -0.0 0.0 -0.0 0.0 0.0 -0.04 -0.04 -0.02 -0.02 -0.02 -0.02 -0.0 -0.01 -0.01 -0.01 -0.01 0.22 1.89 0.35 0.17 0.01 0.04 2.96 1.3 0.08 3.5 0.0 0.49 0.14 4.55 0.03 1.29 0.28 3.11 0.01 0.11 0.19 7.01 0.04 3.55 0.04 6.88 0.01 3.51 0.22 1.89 0.35 0.17 0.01 0.05 2.78 1.19 0.08 3.5 0.0 0.5 0.14 4.21 0.03 1.27 0.5 2.72 0.02 0.11 0.19 6.79 0.04 3.51 0.04 6.7 0.01 3.47 0.019 0.019 0.019 0.019 0.001 0.001 0.001 0.001 0.013 0.013 0.013 0.013 0.052 0.052 0.052 0.052 0.016 0.016 0.016 0.016 0.009 0.009 0.009 0.009 0.009 0.009 0.009 0.009 Table 5. The resulting popularity bias and accuracy of different mitigation approaches on MoviesLens-1M dataset. Algorithm MostPop RandomG UserKNN ItemKNN BPR BiasedMF SVD++ g1 g2 g3 Total BS NDCG baseL. MFAIR baseL. MFAIR baseL. MFAIR baseL. MFAIR baseL. MFAIR VBI EBI 34.43 34.48 34.4 -28.6 -28.57 34.44 -28.65 -28.61 VBR 34.48 34.4 -28.65 -28.57 EBR 34.53 34.45 -28.7 -28.62 VBI EBI -35.05 -33.21 -35.2 -33.81 VBR -33.78 -31.55 EBR -33.91 -31.29 4.89 5.08 5.71 5.75 4.04 4.46 4.6 4.46 VBI EBI 32.91 33.46 VBR 33.42 EBR 33.82 VBI EBI 34.17 34.28 32.17 -27.09 -26.35 32.9 -27.64 -27.09 32.34 33.03 33.65 33.89 -27.6 -28.0 -26.52 -27.22 -28.35 -27.82 -28.45 -28.06 VBR 33.77 33.42 -27.94 -27.6 EBR 33.96 33.7 -28.13 -27.87 VBI EBI 18.12 20.14 12.23 15.98 -13.52 -8.02 -15.31 -11.44 VBR 19.65 18.83 -14.69 -13.94 EBR 21.16 6.28 8.62 6.98 8.9 8.13 11.4 9.85 VBI EBI VBR EBR VBI EBI VBR EBR 20.6 3.07 5.63 4.32 6.37 6.9 10.16 7.17 -16.08 -15.57 -5.55 -7.55 -6.05 -8.07 -5.29 -8.25 -6.99 -9.57 -2.0 -4.37 -3.04 -4.85 -4.22 -7.15 -4.43 -7.49 12.67 10.65 -5.83 -5.83 -5.83 -5.83 30.16 30.12 28.07 28.16 -5.82 -5.82 -5.82 -5.82 -5.83 -5.83 -5.83 -5.83 -4.6 -4.83 -4.96 -5.08 -0.72 -1.07 -0.94 -0.84 -2.83 -3.15 -2.86 -3.1 -5.83 -5.83 -5.83 -5.83 29.17 29.35 26.95 26.83 -5.81 -5.81 -5.81 -5.82 -5.83 -5.83 -5.83 -5.83 -4.21 -4.53 -4.88 -5.02 -1.07 -1.25 -1.28 -1.52 -2.68 -3.01 -2.74 -3.16 68.85 68.95 68.96 69.06 70.1 70.39 67.57 67.83 65.82 66.91 66.85 67.64 68.35 68.56 67.53 67.91 36.25 40.28 39.29 42.33 12.56 17.25 13.96 17.81 16.25 22.8 19.7 25.34 68.8 0.104 0.104 68.89 68.8 0.106 0.106 68.89 66.42 67.62 0.011 0.011 63.1 0.011 0.12 62.58 64.33 65.8 64.67 66.07 67.29 67.77 66.85 67.4 24.46 31.95 37.65 41.2 6.15 11.26 0.123 0.123 0.125 0.125 0.121 0.121 0.122 0.122 0.137 0.135 0.141 0.14 0.065 0.064 8.65 0.065 0.066 12.74 13.81 20.32 14.34 21.29 0.082 0.081 0.083 0.083 Table 6. The resulting popularity bias and accuracy of different mitigation approaches on Book-Crossing dataset. g1 g2 g3 Total BS NDCG baseL. MFAIR baseL. MFAIR baseL. MFAIR baseL. MFAIR baseL. MFAIR Algorithm MostPop RandomG UserKNN ItemKNN BPR BiasedMF SVD++ VBI EBI VBR EBR VBI EBI 34.1 34.1 34.1 34.1 34.1 34.1 34.1 34.1 -25.01 -25.01 -25.01 -25.01 -25.01 -25.01 -25.01 -25.01 -32.26 -31.64 -32.21 -31.79 VBR -31.6 -28.87 EBR -31.62 -28.67 VBI EBI 11.09 12.51 VBR 10.94 EBR 12.43 VBI EBI 24.06 25.07 6.69 9.54 10.13 11.88 20.99 22.97 8.05 7.9 8.49 8.26 -8.08 -9.6 -7.99 -9.56 7.75 7.69 7.12 6.8 -4.73 -7.34 -7.37 -9.14 -16.12 -13.51 -16.99 -15.21 VBR 24.36 23.18 -16.32 -15.31 EBR 25.26 24.48 -17.12 -16.45 VBI EBI 16.62 17.56 13.67 15.61 VBR 16.68 16.6 -10.09 -10.78 -10.07 -7.53 -9.09 -10.0 EBR 17.59 17.54 -10.76 -10.71 -9.09 -9.09 -9.09 -9.09 24.2 24.31 23.11 23.36 -3.01 -2.92 -2.95 -2.87 -7.94 -8.07 -8.04 -8.14 -6.53 -6.78 -6.61 -6.83 -8.95 VBI EBI 33.94 34.0 33.06 33.42 -24.99 -24.82 -25.0 -24.89 -9.0 VBR 34.05 33.8 -24.97 -24.94 EBR 34.07 33.91 -24.98 -24.97 VBI EBI 33.76 33.78 32.83 33.27 -24.88 -24.58 -24.93 -24.73 VBR 33.89 33.62 -24.82 -24.75 EBR 33.96 33.79 -24.89 -24.84 -9.08 -9.09 -8.88 -8.95 -9.07 -9.07 -9.09 -9.09 -9.09 -9.09 23.89 24.1 21.75 21.88 -1.96 -2.2 -2.76 -2.75 -7.47 -7.75 -7.87 -8.03 -6.13 -6.52 -6.6 -6.83 -8.24 -8.53 -8.86 -8.94 -8.25 -8.54 -8.88 -8.95 68.2 68.2 68.2 68.2 64.52 64.52 63.19 63.24 22.18 25.02 21.87 24.86 48.13 50.13 48.72 50.53 33.24 35.13 33.36 35.19 67.89 67.99 68.1 68.13 67.52 67.75 67.78 67.92 68.2 68.2 68.2 68.2 63.27 63.58 57.74 57.35 13.38 19.08 20.26 23.76 41.98 45.93 46.36 48.96 27.33 31.22 33.19 35.08 66.12 66.84 67.61 67.81 65.66 66.54 67.24 67.57 0.019 0.019 0.019 0.019 0.001 0.001 0.001 0.001 0.013 0.013 0.013 0.013 0.052 0.052 0.052 0.052 0.016 0.016 0.016 0.016 0.009 0.009 0.009 0.009 0.009 0.009 0.009 0.009 5. Conclusions and future work In this study, we addressed two types of bias in CF recommender systems at once: geographic bias and popularity bias. We presented MFAIR, a multi-facet post-processing bias mitigation algorithm that simultaneously manages both biases in recommendations while maintaining accuracy. It considers the distribution of continents and popularity groups in the input data as the target distribution to achieve in the top-k recommendations. We applied MFAIR to the output of state-of-the-art CF recommender algorithms and compared our approach to a well-known post-processing method. The results showed that our approach better managed the trade-off between both types of bias and accuracy. It also performed better in terms of popularity bias in all experiments. Recommender systems are prone to various types of bias depending on the industry in which they are used. When these biases emerge on an intersectional level, they can further harm sensitive groups. To address this problem, other aspects of fairness, such as user fairness based on gender, age, etc., or provider fairness based on providers' demographics, can be included in this study. Future work might involve examining how these different biases can be managed to provide optimal results for more of the involved stakeholders in the system. References [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] F. Ricci, L. Rokach, and B. Shapira, "Recommender systems: introduction and challenges," in Recommender systems handbook: Springer, 2015, pp. 1-34. E. Gómez, C. Shui Zhang, L. Boratto, M. Salamó, and M. Marras, "The winner takes it all: geographic imbalance and provider (un) fairness in educational recommender systems," in Proceedings of the 44th International ACM SIGIR Conference on Research and Development in Information Retrieval, 2021, pp. 1808-1812. E. Gómez, L. Boratto, and M. Salamó, "Provider fairness across continents in collaborative recommender systems," Information Processing & Management, vol. 59, no. 1, p. 102719, 2022. B. Friedman and H. Nissenbaum, "Bias in computer systems," ACM Transactions on information systems (TOIS), vol. 14, no. 3, pp. 330-347, 1996. H. Abdollahpouri et al., "Multistakeholder recommendation: Survey and research directions," User Modeling and User-Adapted Interaction, vol. 30, no. 1, pp. 127-158, 2020. D. Shakespeare, L. Porcaro, E. Gómez, and C. Castillo, "Exploring artist gender bias in music recommendation," arXiv preprint arXiv:2009.01715, 2020. A. Ferraro, X. Serra, and C. Bauer, "Break the loop: Gender imbalance in music recommenders," in Proceedings of the 2021 Conference on Human Information Interaction and Retrieval, 2021, pp. 249-254. M. Malek, "Criminal courts' artificial intelligence: the way it reinforces bias and discrimination," AI and Ethics, vol. 2, no. 1, pp. 233-245, 2022. G. Farnadi, P. Kouki, S. K. Thompson, S. Srinivasan, and L. Getoor, "A fairness-aware hybrid recommender system," arXiv preprint arXiv:1809.09030, 2018. E. Gómez, L. Boratto, and M. Salamó, "Disparate impact in item recommendation: A case of geographic imbalance," in European Conference on Information Retrieval, 2021: Springer, pp. 190- 206. [11] M. Zehlike, K. Yang, and J. Stoyanovich, "Fairness in ranking: A survey," arXiv preprint [12] [13] arXiv:2103.14000, 2021. E. Gómez, C. S. Zhang, L. Boratto, M. Salamó, and G. Ramos, "Enabling cross-continent provider fairness in educational recommender systems," Future Generation Computer Systems, vol. 127, pp. 435-447, 2022. Y. Zhang et al., "Causal intervention for leveraging popularity bias in recommendation," in Proceedings of the 44th International ACM SIGIR Conference on Research and Development in Information Retrieval, 2021, pp. 11-20. [14] M. Zehlike, T. Sühr, R. Baeza-Yates, F. Bonchi, C. Castillo, and S. Hajian, "Fair Top-k Ranking with multiple protected groups," Information Processing & Management, vol. 59, no. 1, p. 102707, 2022. A. B. Ahanger, S. W. Aalam, M. R. Bhat, and A. Assad, "Popularity Bias in Recommender Systems- A Review," in International Conference on Emerging Technologies in Computer Engineering, 2022: Springer, pp. 431-444. [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] N. Ranjbar Kermany, W. Zhao, J. Yang, J. Wu, and L. Pizzato, "A fairness-aware multi-stakeholder recommender system," World Wide Web, vol. 24, no. 6, pp. 1995-2018, 2021. E. Walster, E. Berscheid, and G. W. Walster, "New directions in equity research," Journal of personality and social psychology, vol. 25, no. 2, p. 151, 1973. N. R. Kermany, W. Zhao, J. Yang, and J. Wu, "Reincre: Enhancing collaborative filtering recommendations by incorporating user rating credibility," in International Conference on Web Information Systems Engineering, 2020: Springer, pp. 64-72. J. Lu, D. Wu, M. Mao, W. Wang, and G. Zhang, "Recommender system application developments: a survey," Decision Support Systems, vol. 74, pp. 12-32, 2015. S. Reddy, S. Nalluri, S. Kunisetti, S. Ashok, and B. Venkatesh, "Content-based movie recommendation system using genre correlation," in Smart Intelligent Computing and Applications: Springer, 2019, pp. 391-397. L. Jiang, Y. Cheng, L. Yang, J. Li, H. Yan, and X. Wang, "A trust-based collaborative filtering algorithm for E-commerce recommendation system," Journal of ambient intelligence and humanized computing, vol. 10, no. 8, pp. 3023-3034, 2019. X. Yu, F. Jiang, J. Du, and D. Gong, "A cross-domain collaborative filtering algorithm with expanding user and item features via the latent factor space of auxiliary domains," Pattern Recognition, vol. 94, pp. 96-109, 2019. R. Sujithra Alias Kanmani, B. Surendiran, and S. Ibrahim, "Recency augmented hybrid collaborative movie recommendation system," International Journal of Information Technology, vol. 13, no. 5, pp. 1829-1836, 2021. R. Burke, N. Sonboli, M. Mansoury, and A. Ordoñez-Gauger, "Balanced neighborhoods for fairness-aware collaborative recommendation," 2017. Y. Li, H. Chen, Z. Fu, Y. Ge, and Y. Zhang, "User-oriented fairness in recommendation," in Proceedings of the Web Conference 2021, 2021, pp. 624-632. H. Abdollahpouri, M. Mansoury, R. Burke, and B. Mobasher, "The unfairness of popularity bias in recommendation," arXiv preprint arXiv:1907.13286, 2019. T. Qi et al., "ProFairRec: Provider Fairness-aware News Recommendation," arXiv preprint arXiv:2204.04724, 2022. H. Abdollahpouri, R. Burke, and B. Mobasher, "Controlling popularity bias in learning-to-rank recommendation," in Proceedings of the eleventh ACM conference on recommender systems, 2017, pp. 42-46. S. Lin, J. Wang, Z. Zhu, and J. Caverlee, "Quantifying and Mitigating Popularity Bias in Conversational Recommender Systems," arXiv preprint arXiv:2208.03298, 2022. H. Wu, C. Ma, B. Mitra, F. Diaz, and X. Liu, "Multi-FR: A Multi-Objective Optimization Method for Achieving Two-sided Fairness in E-commerce Recommendation," arXiv preprint arXiv:2105.02951, 2021. G. K. Patro, A. Biswas, N. Ganguly, K. P. Gummadi, and A. Chakraborty, "Fairrec: Two-sided fairness for personalized recommendations in two-sided platforms," in Proceedings of The Web Conference 2020, 2020, pp. 1194-1204. H. Abdollahpouri, M. Mansoury, R. Burke, B. Mobasher, and E. Malthouse, "User-centered evaluation of popularity bias in recommender systems," in Proceedings of the 29th ACM Conference on User Modeling, Adaptation and Personalization, 2021, pp. 119-129. [33] M. Zehlike and C. Castillo, "Reducing disparate exposure in ranking: A learning to rank approach," [34] in Proceedings of The Web Conference 2020, 2020, pp. 2849-2855. C.-N. Ziegler, S. M. McNee, J. A. Konstan, and G. Lausen, "Improving recommendation lists through topic diversification," in Proceedings of the 14th international conference on World Wide Web, 2005, pp. 22-32. [35] K. Järvelin and J. Kekäläinen, "Cumulated gain-based evaluation of IR techniques," ACM Transactions on Information Systems (TOIS), vol. 20, no. 4, pp. 422-446, 2002.
http://arxiv.org/abs/2302.12006v1
2023-02-21T09:55:19
2023-02-21T09:55:19
Does the evaluation stand up to evaluation? A first-principle approach to the evaluation of classifiers
How can one meaningfully make a measurement, if the meter does not conform to any standard and its scale expands or shrinks depending on what is measured? In the present work it is argued that current evaluation practices for machine-learning classifiers are affected by this kind of problem, leading to negative consequences when classifiers are put to real use; consequences that could have been avoided. It is proposed that evaluation be grounded on Decision Theory, and the implications of such foundation are explored. The main result is that every evaluation metric must be a linear combination of confusion-matrix elements, with coefficients - "utilities" - that depend on the specific classification problem. For binary classification, the space of such possible metrics is effectively two-dimensional. It is shown that popular metrics such as precision, balanced accuracy, Matthews Correlation Coefficient, Fowlkes-Mallows index, F1-measure, and Area Under the Curve are never optimal: they always give rise to an in-principle avoidable fraction of incorrect evaluations. This fraction is even larger than would be caused by the use of a decision-theoretic metric with moderately wrong coefficients.
[ "K. Dyrland", "A. S. Lundervold", "P. G. L. Porta Mana" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.12006v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.12006v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "physics.data-an", "62Cxx, 68Txx", "I.6.4; D.2.4; D.2.8" ]
Does the evaluation stand up to evaluation? A first-principle approach to the evaluation of classifiers K. Dyrland <kjetil.dyrland gmail.com> A. S. Lundervold † <alexander.selvikvag.lundervold hvl.no> P.G.L. Porta Mana <pgl portamana.org> (listed alphabetically) Dept of Computer science, Electrical Engineering and Mathematical Sciences, Western Norway University of Applied Sciences, Bergen, Norway †& Mohn Medical Imaging and Visualization Centre, Dept of Radiology, Haukeland University Hospital, Bergen, Norway 27 May 2022; updated 21 February 2023 How can one meaningfully make a measurement, if the meter does not conform to any standard and its scale expands or shrinks depending on what is measured? In the present work it is argued that current evaluation practices for machine-learning classifiers are affected by this kind of problem, leading to negative consequences when classifiers are put to real use; consequences that could have been avoided. It is proposed that evaluation be grounded on Decision Theory, and the implications of such foundation are explored. The main result is that every evaluation metric must be a linear combination of confusion-matrix elements, with coefficients – 'utilities' – that depend on the specific classification problem. For binary classification, the space of such possible metrics is effectively two-dimensional. It is shown that popular metrics such as precision, balanced accuracy, Matthews Correlation Coefficient, Fowlkes-Mallows index, F1-measure, and Area Under the Curve are never optimal: they always give rise to an in-principle avoidable fraction of incorrect evaluations. This fraction is even larger than would be caused by the use of a decision-theoretic metric with moderately wrong coefficients. 0 Prologue: a short story The manager of a factory which produces a sort of electronic component wishes to employ a machine-learning classifier to assess the durability of each produced component. The durability determines whether the component will be used in one of two possible kinds of device. The 1 3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 6 0 0 2 1 . 2 0 3 2 : v i X r a r e p a p r e t t e L r o 4 A n o g n i t n i r p p u o w - t d n a i g n d a e r n e e r c s r o f d e n g i s e d s i t n e m u c o d s i h T Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? classifier should take some complex features of the component as input, and output one of the two labels '0' for 'long durability', or '1' for 'short durability', depending on the component type. Two candidate classifiers, let us call them A and B, are trained on available training data. When employed on a separate evaluation set, they yield the following confusion matrices, written in the format true class 0 1 (cid:20) True 0 False 1 False 0 (cid:21) True 1 r e fi i s s a l c t u p t u o 0 1 and normalized over the total number of evaluation data: classifier A: classifier B: (cid:20)0.27 0.15 0.23 0.35 (cid:20)0.43 0.18 0.07 0.32 (cid:21) (cid:21) , . (1) (2) These matrices show that the factory produces, on average, 50% short- and 50% long-durability components. The confusion matrices above lead to the following values of com- mon evaluation metrics1 for the two classifiers. Class 0 is 'positive', 1 'negative'. Blue bold indicates the classifier favoured by the metric, red the disfavoured: Table 1 Metric Accuracy (also balanced accuracy) Precision F1 measure Matthews Correlation Coefficient Fowlkes-Mallows index True-positive rate (recall) True-negative rate (specificity) classifier A classifier B 0.62 0.64 0.59 0.24 0.59 0.54 0.70 0.75 0.70 0.77 0.51 0.78 0.86 0.64 The majority of these metrics favour classifier B, some of them by quite a wide relative difference. Only the true-negative rate favours classifier A, but only by a relative difference of 9%. 1 Balanced accuracy: Brodersen et al. 2010; F1 measure: van Rijsbergen 1974; Matthews correlation coefficient: Matthews 1975; Fowlkes-Mallows index: Fowlkes & Mallows 1983. 2 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? The developers of the classifiers therefore recommend the employ- ment of classifier B. The factory manager does not fully trust these metrics, asking, "how do I know they are appropriate?". The developers assure that these metrics are widely used. The manager (of engineering background) comments, "I don't remember 'widely used' being a criterion of scientific correctness – not after Galileo at least", and decides to employ both classifiers for a trial period, to see which factually leads to the best revenue. The two classifiers are integrated into two separate but otherwise identical parallel production lines. During the trial period, the classifiers perform according to the classification statistics of the confusion matrices (1) and (2) above. At the end of this period the factory manager finds that the average net gains per assessed component yielded by the two classifiers are2 classifier A classifier B 3.5 $ −3.5 $ (3) That is, classifier B actually led to a loss of revenue. The manager therefore decides to employ classifier A, commenting with a smug smile that it is always unwise to trust the recommendations of developers, unacquainted with the nitty-gritty reality of a business. The average gains above are easy to calculate from some additional information. The final net gains caused by the correct or incorrect classification of one electronic component are as follows: true class 1 0 (cid:20) 15 $ −335 $ 165 $ −35 $ (cid:21) (4) r e fi i s s a l c t u p t u o 0 1 The reason behind these values is that short-durability components (class 1) provide more power and are used in high-end, costly devices; but they cause extreme damage and consequent repair costs and refunds if used in devices that require long-durability components (class 0). Long-durability components provide less power and are used in low- end, cheaper devices; they cause some damage if used in devices that require short-durability components, but with lower consequent costs. 2 '$' represents a generic currency or value unit; this is why it is not written in front of the gains. 3 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? Taking the sum of the products of the gains above by the respective percentages of occurrence – that is, the elements of the confusion matrix – yields the final average gain. The final average gain returned by the use of classifier A, for example, is 15 $ × 0.27 − 335 $ × 0.15 − 35 $ × 0.23 + 165 $ × 0.35 = 3.5 $ . In the present case, the confusion matrices (1) and (2) lead to the amounts (3) found by the manager. 1 Issues in the evaluation of classifiers The story above illustrates several well-known issues of currently popular evaluation procedures for machine-learning classifiers: (a) We are swept by an avalanche of possible evaluation metrics. Often it is not clear which is the most compelling. In the story above, for example, one could argue that the true-negative rate was the appropriate metric, in view of the great difference in gains between correct and wrong classification for class 1, compared with that for class 0. But at which point does this qualitative reasoning fail? Imagine that the net gains had been as follows instead: true class 0 1 (cid:20) 45 $ −335 $ 165 $ −65 $ (cid:21) . (5) r e fi i s s a l c t u p t u o 0 1 Also in this case one could argue that there is a greater economic difference between correct and wrong classification for class 1 than for class 0. The true-negative rate should, therefore, again be the appropriate metric. Yet a simple calculation analogous to the one of § 0 shows that classifier B actually leads to the best average revenue: 7.3 $/component, vs 4.7 $/component for classifier A. Hence the true-negative rate is not the appropriate metric in this case: our qualitative reasoning failed us. (b) A classifier favoured by the majority of available metrics can still turn out not to be the best one in practice. (c) Most popular metrics are introduced by intuitive reasoning, ad hoc mathematical operations, special assumptions (such as Gaussianity3 3 e.g. Fisher 1963 § 31 p. 183 for the Matthews correlation coefficient. 4 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? or other statistical assumptions), and an analysis of special cases only. Unfortunately this kind of derivations does not guarantee generalization to all cases, nor that the proposed metric is uniquely determined by the chosen assumptions, nor that it satisfies more general consistency requirements. By contrast, consider the kind of derivation that starts from specific qualitative requirements and mathematically proves the uniqueness of a particular formula satisfying them. Examples are the derivation of the Shannon entropy as the unique metric universally satisfying a set of basic requirements for the amount of information4. Or the derivation of the probability calculus as the unique set of rules satisfying general rational requirements for inductive reasoning, learning, and prediction5. Or the derivation of decision theory as the unique framework guaranteeing a rational and optimal decision under uncertainty6. (d) Let us assume that some of the popular metrics identify the best algorithm 'in the majority of cases' – although it is difficult to statistically define such a majority, and no real surveys have ever been conducted to back up this assumption. Yet, do we expect the end-user to simply hope not to belong to the unlucky minority? Is such uncertainty inevitable? We cannot have a cavalier attitude towards this problem: life and death can depend on it in some machine-learning applications7. Imagine a story analogous to the factory one, but in a medical setting instead. The classifiers should distinguish between two tumour types, requiring two different types of medical intervention. The confusion matrices are the same (1) and (2). Correct and incorrect classification lead to the following expected remaining life lengths for patients in a specific age range:8 true class 1 0 (cid:20)350 months 0 months 300 months 500 months (cid:21) . (6) r e fi i s s a l c t u p t u o 0 1 4 Shannon 1948; Woodward 1964 § 3.2; also Good & Toulmin 1968. 5 Cox 1946; Fine 1973; Halpern 1999; Snow 1998; 2001; Jaynes 2003 chs 1–2; see also Self & Cheeseman 6 Russell & Norvig 2022 § 15.2; 1987; Cheeseman 1988; Russell & Norvig 2022 ch. 12. 8 cf. the discussion in von Neumann & Morgenstern 1955 chs 2–3. Sox et al. 2013 § 11.2.9. 7 cf. Howard 1980. 5 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? These values might arise in several scenarios. For example, tumours of class 0 and 1 may require very different kinds of treatment. If a class 0 tumour is misdiagnosed and not properly treated, it leads to immediate death (0 months); if correctly diagnosed, its treatment is usually successful, leading to high life expectancy (500 months). Class 0 tumours can be treated, but they lead to a shorter life expectancy (350 months). If they are misdiagnosed as class 1, however, the damage caused by class 1 treatment shortens this life expectancy even further (300 months). This matrix above is numerically equivalent to (4) up to a common additive constant of 335, so the final net gains are also shifted by this amount. It is easy to see that the metrics are exactly as in Table 1, the majority favouring classifier B. And yet the use of classifier A leads to a more than six-month longer expected remaining life than classifier B. (e) Often it is not possible to temporarily deploy all candidate classifiers, as our fictitious manager did, in order to observe which factually leads to the best results. Or it may even be unethical: consider a situation like the medical one above, where a classifier may lead to a larger number of immediate deaths than another. (f) Finally, all issues listed above are not caused by class imbalance (the occurrence of one class with a higher frequency than another). In our story, for example, the two classes were perfectly balanced. Class imbalance can make all these issues worse9. But our story also points to a possible solution for all these issues. The 'metric' that ultimately proved to be relevant to the manager was the average net monetary gain obtained by using a candidate classifier. In the medical variation discussed in issue (d) above, it was the average life expectancy. In either case, such metric could have been easily calculated beforehand, upon gathering information about the average gains and losses of correct and incorrect classification, collected in the matrix (4) or (6), and combining these with statistics collected in the confusion matrix associated with the classifier. Denoting the former kind of matrix by (Uij) and the confusion matrix by (Cij), where i indexes the classifier 9 Jeni et al. 2013; Zhu 2020. 6 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? outputs (rows) and j the true classes (columns), such a metric would have the formula (cid:88) Uij Cij (7) the sum extending to all matrix elements. i,j In the present work, we argue that formula (7) is indeed the only acceptable metric for evaluating and comparing the performance of two or more classifiers, each with its own confusion matrix (Cij) collected on relevant test data. The coefficients Uij, called utilities, are problem- dependent. This formula is the utility yield of a classifier having confusion matrix (Cij). Our argument is based on Decision Theory, an overview of which is given in § 2. The utility yield (7) is a linear combination of the confusion-matrix elements, with coefficients independent of the elements themselves. In § 3 we explore some properties of this formula and of the space of such metrics for binary classification. We also show that some common metrics such as precision, F1-measure, Matthews correlation coefficient, balanced accuracy, and Fowlkes-Mallows index cannot be written as a linear combination of this kind (or a one-one function thereof). This impossibility has two consequences. First, it means that these metrics are likely affected by some kind of cognitive bias. Second, there exists no classification problem for which these metrics can correctly rank the performance of all pairs of classifiers. Using any one of these metrics leaves open the possibility that the evaluation is incorrect a priori. In § 5 we show that this is also true for the Area Under the Curve of the Receiver Operating Characteristic, and we offer some additional remarks about it from the standpoint of decision theory. On the other hand, metrics such as accuracy, true-positive rate, true- negative rate can be written in the form (7). Consequently, each one has a set of classification problems in which it correctly ranks the performance of all pairs of classifiers. What happens if we are uncertain about the utilities appropriate to a classification problem? And what happens if the utilities are incorrectly assessed? We show in § 4 that uncertainty about utilities still leads to a metric of the form (7). We also show that an evaluation using incorrect utilities, even with relative errors as large as 20% of the maximal utility, 7 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? still leads to a higher amount of correctly ranked classifiers than the use of any of the popular metrics mentioned above. We summarize and discuss our results in the final § 6. 2 Brief overview of decision theory 2.1 References Here we give a brief overview of decision theory. We only focus on the notions relevant to the problem of evaluating classifiers, and simply state the rules of the theory. These rules are quite intuitive, but it must be remarked that they are constructed in order to be logically and mathematically self-consistent: see the following references. For a presentation of decision theory from the point of view of artificial intelligence and machine learning, see Russell & Norvig 2022 ch. 15. Simple introductions are given by North 1968; Raiffa 1970; Lindley 1988; Tribus 1969 ch. 8; Jeffrey 1965; and a discussion of its foundations and history by Steele & Stefánsson 2020. For more thorough expositions see Raiffa & Schlaifer 2000; Fenton & Neil 2019; Berger 1985; Savage 1972; and Sox et al. 2013; Hunink et al. 2014 for a medical perspective. See also Ramsey's 1926 insightful and charming pioneering discussion. 2.2 Decisions and classes Decision theory makes a distinction between • the possible situations we are uncertain about: in our case, the possible classes; • the possible decisions we can make. This distinction is important because it prevents the appearance of various cognitive biases10 in evaluating the probabilities and frequencies of the possible situations on the one hand, and the values of our decisions on the other. Examples are the scarcity bias11 "this class is rare, therefore its correct classification must lead to high gains", and plain wishful thinking: "this event leads to high gains, therefore it is more probable". Often even the number of classes and the number of decisions differ. But in using machine-learning classifiers, one typically considers 10 Kahneman et al. 2008; Gilovich et al. 2009; Kahneman 2011. 1989; Kim & Markus 1999; Mittone & Savadori 2009. 11 Camerer & Kunreuther 8 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? situations where the set of available decisions and the set of possible classes have some kind of natural correspondence and equal cardinality. In a 'cat vs dog' image classification, for example, the classes are 'cat' and 'dog', and the decisions could be 'put into folder Cats' vs 'put into folder Dogs'. In a medical application the classes could be 'ill' and 'healthy' and the decisions 'treat' vs 'dismiss'. As already mentioned, most of our discussions and examples focus for simplicity on binary classification. 2.3 Utilities and maximization of expected utility To each decision we associate several utilities, depending on which of the possible classes is actually true. A utility may, for instance, equal a gain or loss in money, energy, number of customers, life expectancy, or quality of life, measured in appropriate units; or it may equal a combination of such quantities. These utilities are collected into a utility matrix (Uij), like the ones shown in formulae (4), (5), (6). The component Uij is the utility of the decision corresponding to class i if class j is true, or simply the utility of class i conditional on class j. In an individual classification instance, if we know which class is true, then the optimal decision is the one having maximal utility among those conditional on the true class. If, on the other hand, we are uncertain about j p j = 1, which class is true, with probability p j for class j such that then decision theory states that the optimal decision is the one having maximal expected utility ̄Ui, defined as the expected value of the utility of decision i with respect to the probabilities of the various classes: (cid:80) ̄Ui := (cid:88) j Uij p j . In formulae, this principle of maximization of expected utility is (cid:27) (cid:26)(cid:88) choose class i∗ = arg max { ̄Ui } ≡ arg max Uij p j (8) . (9) i i j A very important result in decision theory is that basic requirements of rational decision-making imply that there must be a set of utilities underlying the decisions of a rational agent, and the decisions must obey the principle of maximization of expected utility12. 12 Russell & Norvig 2022 § 15.2; von Neumann & Morgenstern 1955 chs 2–3. 9 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? How are utilities determined? They are obviously problem-specific and cannot be given by the theory (which would otherwise be a model rather than a theory). Utilities can be obvious in decision problems involving gains or losses of measurable quantities such as money or energy (the utility of money is usually not equal to the amount of money, the relationship between the two being somewhat logarithmic13). In medical problems they can correspond to life expectancy and quality of life; see for example Sox et al. 2013 esp. ch. 8 and § 11.2.9 and Hunink et al. 2014 esp. ch. 4 on how such health factors are transformed into utilities. The final utility of a single classification instance may depend, in some cases, on a sequence of further uncertain events and further decisions. In the story of § 0, for instance, the misclassification of a short-durability component as a long-durability one leads the final device to break only in a high fraction of cases, and in such cases the end customer requires a refund in a high fraction of subcases; the refunded amount may even depend on further circumstances. The negative utility U01 = −335 $ in table (4) comes from a statistical average of the losses in all these possible end results. This is the topic of so-called decision networks or influence diagrams14. The decision-theory subfield of utility theory gives rules that guarantee the mutual consistency of a set of utilities in single decisions or decision networks. For simple introductions to utility theory see Russell & Norvig 2022 § 15.2, North 1968 pp. 201–205, and the references given at the beginning of the present section. In the present work, we do not worry about such rules in order not to complicate the discussion: they should be approximately satisfied if the utilities of a problem have been carefully assessed. 3 Evaluation of classifiers from a decision-theoretic perspective 3.1 Admissible evaluation metrics for classification problems Maximization of expected utility is the ground rule for rational decision making15. In the present work we focus on the stage where a large number of classifications have already been made by a classifier on a test 13 e.g. North 1968 pp. 203–204; Raiffa 1970 ch. 4. 14 Besides the general references already given: Russell & Norvig 2022 § 15.5; Howard & Matheson 2005; for a step-by-step tutorial: Raiffa 1970. 15 We discuss and use it in our companion work Dyrland et al. 2022. 10 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? dataset with N data. Denote by Fij the number of instances in which the classifier chose class i and the true class was j. Then (Fij) is the confusion matrix of the classifier on this particular test set. For all instances in which the classifier chose class i and the true class was j, a utility Uij is eventually gained. The total utility yielded by the classifier on the test set is therefore ij Uij Fij. Dividing by N we obtain the average utility per datum, which we call the utility yield; it can be written as (cid:80) (cid:88) ij Uij Cij (10) where Cij := Fij/N is the relative frequency of choice i and true class j, and (Cij) is the normalized confusion matrix. The utility yield, formula (10), is therefore the natural metric to evaluate and compare the performance of classifiers on a test set for a classification problem characterized by the utility matrix (Uij). Note how the utilities Uij do depend on the frequencies Fij or Cij. If they did, it would mean that we had waited until all classification instances had been made in order to assess the value of each single instance. In virtually all classification problem we can think of, this would be a source of evaluation bias, such as the scarcity bias mentioned in § 2.2. It would, moreover, be an impossible procedure in contexts where the consequence of a single classification is manifest before the next classification is made. If we modify the elements of a utility matrix by a common additive constant or by a common positive multiplicative constant, Uij ↦→ a Uij + b a > 0 , (11) then the final utilities yielded by a classifier with a particular confusion matrix are modified by the same constants. The ranking of any set of classifiers will therefore be the same. After all, an additive constant or a positive factor represent only changes in the zero or the measurement unit of our utility scale16. Such changes should not affect a decision problem. Indeed, the fact that they do not is another example of the logical consistency of decision theory. 16 cf. Russell & Norvig 2022 § 15.2.2. 11 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? Figure 1 Space of utility matrices for binary classification. 3.2 Space of utility matrices for binary classification Let us consider a problem of binary classification. It is characterized by a matrix of 2 × 2 utilities. We suppose that they are not all equal; the choice of class would be immaterial otherwise, and the classification problem trivial. We can use the freedom of choosing a zero and measurement unit to bring the utility matrix to a standard form. Let us choose them such that the maximum utility is 1 and the minimum utility is 0 (note that this value may still correspond to an actual monetary loss, for example). That is, we are effecting the transformation Uij ↦→ Uij − min(Uij) max(Uij) − min(Uij) . (12) With this convention, it is clear that we only have two degrees of freedom in choosing the utility matrix of a binary-classification problem. As a consequence, the space (more precisely: manifold) of possible evaluation metrics for binary classifications is two-dimensional. In order to evaluate candidate classifiers for a binary-classification problem, we must choose a point from this space. 12 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? We can represent this space as in fig. 1. The centre is the utility matrix with equal maximum utilities for correct classification and equal minimum utilities for incorrect classification; we shall see later that it corresponds to the use of accuracy as the evaluation metric. Moving to the left from the centre, the utility for correct classification of class 1 decreases with respect to class 0; vice versa moving to the right. Moving upwards from the centre, the utility for misclassification of class 1 increases; moving downwards, the utility for misclassification of class 0 increases. We have excluded utility matrices in which misclassification has a higher utility than correct classification (although they may occur in some situations); they would appear in the missing upper-left and lower-right corners. Fixing (x, y) axes through the centre of the set, a utility matrix has coordinates (cid:20)1 − x δ(x > 0) −y δ(y < 0) y δ(y > 0) 1 + x δ(x < 0) (cid:21) , |x|, |y| ⩽ 1 . (13) Note that this representation is not meant to reflect any convex or metric properties, however. No metric or distance is defined in the space of utility matrices. Convex combination is defined if we drop the normalization (12) but it is not correctly reflected in the representation of fig. 1. 3.3 Relationship with common metrics In § 3.1 we found that the most general evaluation metric according to decision theory must be a linear combination of the confusion-matrix elements. The coefficients of this linear combination do not depend on the confusion-matrix elements themselves; such a dependence usually reflects some sort of cognitive bias. Which common popular metrics adhere to this mathematical form? We want to answer this question in the binary-classification case while giving as much allowance as possible in the typical context in which popular metrics are used. Consider the case in which we are comparing several classifiers on the same test set. The number of data N and the relative frequencies f0, f1 with which the two classes '0', '1' occur in the test set are fixed and constant for all classifiers under evaluation. 13 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? A classifier yields a normalized confusion matrix (Cij) which we write in the format . 0 1 (cid:21) t u p t u o r e fi i s s a l c true class 1 0 (cid:20)C00 C01 C10 C11 Owing to the constraints C00 + C10 ≡ f0 and C01 + C11 ≡ f1 we can always make two elements of the confusion matrix appear or disappear from any formula, replacing them with expressions involving the re- maining two elements and the class frequencies. To avoid ambiguities in interpreting the functional form of mathematical formulae, let us agree to always express them in terms of C00 and C11 only, making the replacements C10 = f0 − C00, C01 = f1 − C11 wherever necessary. Recall that, given a utility matrix, we can always modify its elements by a common positive multiplicative constant a and by a common additive constant b, eq. (11), because such a modification corresponds to a change of unit and zero of the utility scale. With such a modification the evaluation metric (10) takes the equivalent form a (cid:88) ij Uij Cij + b (14) (cid:80) because ij Cij ≡ 1. Writing the sum explicitly and rewriting the ele- ments C10, C01 in terms of C00, C11 as discussed above, this formula becomes a (U00 − U10) C00 + a (U11 − U01) C11 + a f0 U10 + a f1 U01 + b . (15) Since in the present context N , f0, f1 are constants, we are free to construct the arbitrary constants a > 0 and b from them in any way we please: a = a(N , f0, f1) > 0 , b = b(N , f0, f1) . (16) We can also use this freedom to include the term a f0 U10 + a f1 U01 into b in the formula above. We conclude that an evaluation metric for binary classification complies with decision theory if and only if it can be written in the general form a(N , f0, f1) X C00 + a(N , f0, f1) Y C11 + b(N , f0, f1) (17) where X , Y are real constants that do not depend on C00, C11, N , f0, f1; and a( * ) > 0, b( * ) are arbitrary functions of N , f0, f1 only. 14 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? A monotonic function (such as an exponential) of the expression above is also admissible if we only require a comparison score to rank several classifiers from best to worst. Let us examine some common evaluation metrics for binary classi- fication from this point of view. We write their formulae in terms of C00, C11. The following metrics are particular instances of formula (17): ✓ Accuracy: C00 + C11. We have a = 1, X = Y = 1, b = 0. Indeed it corresponds to the utility yield based on the identity utility matrix (Uij) = (cid:2) 1 0 (cid:3) (or equivalently a utility matrix that assigns the same 0 1 utility to the correct classification of any class, and the same, lower utility to the misclassification of any class). ✓ True-positive rate (recall): C00/ f0. Here a = 1/ f0, X = 1, Y = 0, b = 0. It corresponds to using the utility matrix (cid:2) 1 0 0 0 (cid:3). ✓ True-negative rate (specificity): C11/ f1. Here a = 1/ f1, X = 0, Y = 1, b = 0. It corresponds to using the utility matrix (cid:2) 0 0 0 1 (cid:3). The following metrics instead cannot be written in the form (17), nor as monotonic functions of that form: ✗ Precision: C00/(C00 − C11 + f1). Non-linear in C00, C11. ✗ F1-measure: 2C00/(C00 − C11 + 1). Non-linear in C00, C11. The same is true for the more general Fβ -measures. ✗ Matthews correlation coefficient: √ f1 C00+ f0 C11 f0 f1 ( f1+C00−C11) ( f0+C11−C00) . Non- linear in C00, C11. ✗ Fowlkes-Mallows index: C00/(cid:112) f0 ( f1 + C00 − C11). Non-linear in C00, C11. ✗ Balanced accuracy: C00/(2 f0) + C11/(2 f1). Despite being linear in C00, C11 and an average of two metrics (true-positive and true- negative rate) that are instances of formula (17), it is not an instance of that formula, because the two averaged metrics involve different a( * ) functions. We see that many popular evaluation metrics do not comply with the principles of decision theory. Any such metric suffers from two problems. 15 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? First, as discussed in § 2, the metric involves an interdependence of utilities and classification frequencies, which typically implies some form of cognitive bias17. Second, the ranking of confusion matrices yielded by the metric does not fully agree with that yielded by any utility matrix – a full agreement would otherwise imply that the metric could be written in the form (17). Some confusion matrices must therefore be incorrectly ranked. Since any rational classification problem is characterized by some underlying utility matrix, this means that the non-compliant metric will always lead to some wrong evaluations. By contrast, compliant metrics such as the accuracy give completely correct rankings for all pairs of confusion matrices in specific sets of classification problems. The second phenomenon is illustrated in the plots of figs 2–3. Each blue dot in a plot represents a hypothetical confusion matrix obtained from a test dataset in a binary classification. The dot's coordinates are the utility yield of that confusion matrix according to a particular utility matrix underlying the classification problem, and the score of the confusion matrix according to another metric. The underlying utility (cid:3) for all plots in the left column, and (cid:2) 1 0 matrix is (cid:2) 1 0 (cid:3) for all plots 0 0 0 1 in the right column. The other metrics considered, one for each row of plots, are accuracy, true-positive rate (recall, class 0 being 'positive'), F1-measure, Matthews correlation coefficient. The confusion matrices are selected by first fixing a proportion of classes in the dataset, which is 50%/50% (balanced dataset) for all plots in fig. 2 and 90%/10% (imbalanced dataset) for all plots in fig. 3. Then a true-positive rate and a true-negative rate are independently selected from the range [1/2, 1], with a probability lin- early increasing in the rate (median of 0.85, lower and upper quartiles at 0.75 and 0.93; see side plot). These confusion matrices therefore rep- resent the classification statistics produced by classifiers that tend to have high true-negative and true-positive rates – as is clear from the fact that the points tend to accumulate on the upper-right corners of the plots. 17 Hand & Christen 2018 discuss such biases regarding the F1-measure. 16 0.500.550.600.650.700.750.800.850.900.951.000.00.51.01.52.02.53.03.54.0true−positive/negative rateprobability density Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? Figure 2 Relationship between various evaluation metrics and actual utility yields for two (cid:3) (left column) different binary-classification problems with underlying utility matrices (cid:2) 1 0 0 1 and (cid:2) 1 0 (cid:3) (right column). All confusion matrices (blue dots) are obtained from a dataset 0 0 with 50%/50% class balance. Pairs of red triangles in a plot show two confusion matrices that are wrongly ranked by the metric (y-axis) with respect to the actual utility yield (x-axis). Clearly, there can even be three or more confusion matrices ranked in completely reverse order by the metric. The accuracy gives correct evaluations for the classification problem on the left column; and the true-positive rate, for the one on the right. 17 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? Figure 3 As for fig. 2 but for confusion matrices obtained from an imbalanced dataset with 90% occurrence of class 0 ('positive') and 10% of class 1 ('negative'). 18 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? We see that the accuracy (first-row plots) always gives correct relative evaluations of all confusion matrices when the underlying utility matrix (cid:3) (left column): the y-coordinate is a monotonically is equivalent to (cid:2) 1 0 0 1 increasing function – in fact a linear function – of the x-coordinate. Accur- acy is indeed the utility yield corresponding to the identity utility matrix. The true-positive rate (second-row plots) always gives correct relative evaluations (provided the test set is the same) when the underlying utility matrix is equivalent to (cid:2) 1 0 0 0 (cid:3) (right column). On the other hand, if any of these two metrics is used for a problem having a different underlying utility matrix, then there is no deterministic relationship between the metric's score and the actual utility yield. In this case it is always possible to find two or more confusion matrices for which the metric gives completely reversed evaluations with respect to the actual utility yield. In other words, the confusion matrix – and associated algorithm – which is worst according to the true utility, is ranked best by the metric; and vice versa. Pairs of red triangular shapes in a plot are examples of such confusion matrices wrongly ranked by the y-axis metric. Metrics such as accuracy and true-positive rate, complying with formula (17), thus require us to rely on evaluation luck only when they are used in the wrong classification problem. The plots for the F1-measure (third-row plots) and Matthews correla- tion coefficient (fourth-row plots) show that these two metrics do not have any functional relationship with the actual utility yield. It is again always possible to find two or more confusion matrices for which either metric gives completely reversed evaluations with respect to the actual utility yield. But for these two metrics, unlike accuracy and true-positive rate, cases of incorrect evaluation will always occur in every classification problem. Metrics such as F1-measure and Matthews correlation coefficient, not complying with formula (17), thus always require us to rely on luck in our evaluations. There are no classification problems for which these metrics lead to always correct evaluations. A metric non-compliant with decision theory can lead to a large number of correct results for some classification problems and test sets. The bottom-left plot of fig. 2, for instance, shows that the Matthews correlation coefficient is almost a monotonically increasing deterministic 19 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? function of the utility yield when the underlying utility matrix is the iden- tity and the dataset is balanced (but it is not when the underlying utility (cid:3) or the dataset is imbalanced; see corresponding plots). matrix is (cid:2) 1 0 0 0 Such an occasional partial agreement is useless, however. Knowledge of the utility matrix is a prerequisite for relying on such partial agreement– but given such knowledge we can directly use the actual utility yield instead, which has an exact agreement and is easier to compute. 4 Unknown or incorrect utilities So far, we have argued that the natural evaluation metric for a classifier is the utility yield of its confusion matrix, according to the utilities underlying the classification problem of interest. We have also argued that many popular metrics, those not complying with formula (17), must always a priori lead to instances of incorrect evaluation. Our arguments are based on the principles of decision theory. Several interrelated questions spring from our arguments, though: • What to do when we are uncertain about the utilities underlying a classification problem? • What happens if the utilities we use are actually wrong, that is, not the true ones underlying the problem? • How often do uncompliant metrics such as F1-measure or Matthews correlation coefficient lead to incorrect results, on average? In fact, if a small error in the assessment of the utilities led to a large number of wrong evaluations, while non-compliant metrics led to a small number of wrong evaluations on average, then all the rigorousness of decision-theoretic metrics would be useless in practice, and non- compliant metrics would be best for real applications. This is not the case, however. We now discuss how to deal with uncertainty about the utilities and present an important result: Using wrong utilities, even with relative errors almost as large as 20% of the maximum utility, still leads to fewer incorrect relative evaluations on average than using many currently popular metrics. 20 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? 4.1 Unknown utilities; average performance on several classification problems Dealing with unknown utilities is straightforward. Suppose we are uncertain whether the utility matrix appropriate to a classification problem is U(1) ≡ (cid:0)U (1) (cid:1), or U(2), or U(3), and so on, where the number of ij alternatives can even be infinite or continuous. Each alternative U(a) has a probability qa, or probability density q(a) da in the continuous case. Then for this classification problem, we should use the expected utility matrix ˆU := q1 U(1) + q2 U(2) + q3 U(3) + * * * (18) or ˆU := ∫ q(a) U(a) da in the continuous case. We only give a sketch of the proof of this intuitive result18. If we are uncertain about the utility matrix, then we have a double decision problem: choosing the optimal utility and choosing the optimal class. If the true utility matrix is, for instance, U(2) ≡ (cid:0)U (2) (cid:1), and the true class is ij class 0, then choosing class 1 would yield a utility U (2) 10 would yield a utility U (2) , and so on. Our double decision problem is thus 00 characterized by a rectangular utility matrix that is the row-concatenation of the utility matrices U(a). We make the realistic judgement that the probabilities qa of the utility matrices and the probabilities p j of the classes are independent, so that qa * p j is the probability that the true utility matrix is U(a) and the true class is j. The principle of maximum expected utility, § 2.3 eq. (9), then leads to the maximization of the expected utilities , choosing class 0 ̄Ui := (cid:88) j,a U (a) ij qa * p j ≡ (cid:88) (cid:20)(cid:88) j a (cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32) (cid:124) qa U (a) ij (cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32) (cid:125) (cid:123)(cid:122) ˆU (cid:21) p j (19) in which the expected utility matrix (18) appears as an 'effective' utility matrix to be used for the class-decision problem alone. If our uncertainty is symmetric with respect to the utilities conditional on the different classes – for instance, our uncertainty about the utilities conditional on class 0 is the same as on class 1 – then the expected utility matrix is equivalent to the identity matrix. The utility yield is 18 see e.g. Raiffa 1970 esp. ch. 3. 21 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? in this case equal to the accuracy. The accuracy is therefore the natural evaluation metric to use if we are in a complete state of uncertainty regarding the underlying utilities. This fact is indeed reflected in some results discussed in § 4.2. For binary classification the set of possible utility matrices can be represented as in fig. 1, as discussed in § 3.2. Our uncertainty about the true underlying utility matrix corresponds to a discrete or continuous distribution of probability over this set. Note, however, that the expected utility matrix (18) does not correspond to the mass-centre of the distribu- tion, because of the peculiar coordinate system used in that figure. The actual mass-centre is obtained by representing the set of utility matrices as a two-dimensional surface (a tetrahedron) in three-dimensional space. For brevity we do not discuss this representation in the present work. The procedure of averaging utilities, formula (18), also applies if we want to evaluate how a classifier performs on average on several classification problems, which differ in their utility matrices. Again, what we need to use is the average of their utility matrices. 4.2 Consequences of wrong utility assessments and comparison with common metrics It may happen that our assessment of the utility matrix of a classification problem is incorrect, especially if it has been made on semi-quantitative grounds owing to a lack of information. Then our comparative eval- uations of classifiers may also end up being incorrect. What is the probability of an incorrect comparative evaluation, on average, in such cases? and how does it depend on the amount of error in the utilities? Is it higher than the probability of incorrect evaluation by other metrics? A precise answer to these questions is extremely difficult if not impossible because to define 'on average' we would need to conduct a survey of classification problems of any kind, collecting statistics about their underlying utility matrices, about the confusion matrices of candidate classification algorithms for their solution, and about the errors committed in assessing utilities. We try to give a cursory answer to the questions above for the binary-classification case, based on the following assumptions and judgements: (i) Two possible distributions of true utility matrices on the set of fig. 1 (in that coordinate system): 1. a uniform distribution; 2. a bivariate 22 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? Figure 4 Truncated gaussian distribu- tion in the space of utility matrices of fig. 1, described in item (i). Figure 5 Extents of errors having stand- ard deviations 0.1 (blue triangles) and 0.2 (red squares), around the utility matrices (cid:2) 0.5 0.5 (cid:3) (black diamonds). 1 0 1 0 0.5 0.5 (cid:3) and (cid:2) (truncated) gaussian distribution centred on the identity matrix (cid:2) 1 0 (cid:3) and with standard deviation 1/3 in the x and y coordinates 0 1 of eq. (13), illustrated in fig. 4. (ii) A distribution of confusion matrices for which the fraction of one class is uniformly distributed in [0, 1], and the true-positive and true-negative rates are independently distributed in [0.5, 1] with linearly increasing probabilities (median of 0.85, lower and upper quartiles at 0.75 and 0.93; see side plot on p. 16). This means that we consider problems with highly imbalanced data to be as common as problems with balanced data (a realistic assumption, according to our experience), and candidate classifiers to be generally good. (iii) A truncated gaussian distribution of error around each true utility- matrix element, centred on the true utility value. We consider standard deviations ranging from 0 to 0.3. The gaussian must be truncated because each true utility has a value between 0 and 1, and because we require the utilities of correct classifications to be larger than those of incorrect ones. Figure 5 illustrates the extent of such an error in the space of utility matrices, for standard deviations equal to 0.1 (blue triangles) and 0.2 (red squares). Under these assumptions, we calculate how often a pair of classifiers, having two confusion matrices with the same class proportions, is 23 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? evaluated in reverse order, with respect to their true utility yield, when an incorrect utility matrix or another metric is used for the evaluation. This calculation is an integration problem that we solve by Monte Carlo sampling. The procedure is intuitive: 1. Select a 'true' utility matrix according to the distribution (i). 2. Select errors around the elements of the true utility matrix, accord- ing to the distribution (iii), and add them to it. 3. Select a class proportion and then two confusion matrices having that class proportion (the class proportion must be the same since the matrices are obtained from the same data), according to the distributions (ii). 4. Calculate the signed difference between the true utility yield of the second confusion matrix and that of the first confusion matrix, using the true utility from step 1. If this difference is positive, then the second confusion matrix has higher utility than the first; if negative, then the first confusion matrix has higher utility than the second. 5. a. Consider several metrics (precision, Matthews correlation coefficient, and so on). For each, calculate the signed difference between the score it gives to the second confusion matrix, and the score it gives to the first. b. Consider the erroneous utility matrix from step 2. Calculate the signed difference between the utility yield of the second confusion matrix and that of the first confusion matrix, using this erroneous utility matrix. In either case, a positive difference means that the second confusion matrix is ranked 'best' and the second 'worst', and vice versa for a negative difference. 6. Now go through the signed differences obtained in step 5, and compare them, in turn, with the signed difference obtained in step 4. If the difference from step 5 has opposite sign to that of step 4, then the two confusion matrices are oppositely and incorrectly ranked by the corresponding metric or by the erroneous utility matrix. The results of this sampling procedure for the case of uniform distribution of true utility matrices, several metrics, and utilities affected by errors with 0.1 standard deviation, are shown in fig. 6. Each point 24 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? Figure 6 Relationship between difference in utility yields according to a 'true' utility matrix, and difference in scores according to other metrics including an incorrectly assessed utility matrix (error with 0.1 standard deviation). Points landing in the II or IV quadrants represent pairs of confusion matrices that were wrongly compared. 25 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? Figure 7 Dependence of the proportion of incorrectly ranked pairs of confusion matrices, on the standard deviation of the assessment error on the utilities. Top plot: case with uniform distribution of true utility matrices. Bottom plot: case with gaussian distribution of true utility matrices, as in fig. 4. 26 0.000.050.100.150.200.250.3002468101214161820222426standard deviation of error in utilitiesincorrectly ranked pairs/% True−positive rate Precision Balanced accuracy Matthews Corr. Coeff. Fowlkes−Mallows index F1−measure Accuracy(with uniform distribution of true utility matrices)0.000.050.100.150.200.250.3002468101214161820222426standard deviation of error in utilitiesincorrectly ranked pairs/% True−positive rate Precision Balanced accuracy Matthews Corr. Coeff. Fowlkes−Mallows index F1−measure Accuracy(with gaussian distribution of true utility matrices) Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? represents a pair of confusion matrices (step 3); its coordinates are the true utility yield and either the score given by a metric or (last plot) the yield according to the incorrect utility matrix. The red or yellow triangular points in the II and IV quadrants (discordant signs) are incorrectly ranked pairs. The percentages of incorrect rankings are calculated from 106 samples, giving slightly more than one decimal significant digit; fewer samples are shown in the plots. The plots are displayed in order (left-right, top-bottom) of decreasing percentages of incorrect rankings. The accuracy metric proves to be the best among the ones considered, leading to 8.7% incorrect pairwise rankings. But we see that a utility matrix affected by gaussian errors with 0.1 standard deviation is even better, yielding 4% incorrect pairwise rankings. The dependence of the fraction of incorrect rankings on the standard deviation of the error affecting the utilities is shown in the plots of fig. 7, for the case of uniform distribution (top plot) and gaussian distribution (bottom plot) of true utility matrices. It is approximately linear. The plots also report the fractions of incorrect rankings for the other metrics. We see that evaluations based on a utility matrix affected by errors with standard deviation up to 0.15 or even 0.25 are still more reliable than evaluations based on the other reported metrics. This is a remarkable fact, considering that errors with such standard deviations are quite large, as was shown in fig. 5. A utility error with standard deviations around 0.25 covers the whole space of utility matrices almost uniformly (cf fig. 5). Such a large error means that we are almost completely uncertain about the utilities to start with. It therefore makes sense that the accuracy, equivalent to using the identity utility matrix, becomes a more reliable metric when this error level is reached: as we saw in § 4.1, the identity utility matrix is the natural one to use in a state of complete uncertainty about the utilities. This result is just another example of the internal consistency of Decision Theory. 5 What about the area under the curve of the receiver operating characteristic? Another very common metric for evaluating binary classifiers is the Area Under the Curve of the Receiver Operating Characteristic, or 'area 27 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? under the curve' for short. This metric can only be used for particular classifying algorithms, and its meaning is different from that of the metrics reviewed so far. For these reasons, we leave a full discussion of it to future works and only offer a couple of remarks here. The area under the curve can only be computed for classifiers that output a continuous variable rather than a class. A threshold for this variable determines whether its value predicts one class or the other. Different choices of threshold lead to different pairs of false-positive rate f (which is 1 − true-negative rate) and true-positive rate t in a given test set. These pairs can be plotted as a curve f ↦→ t( f ) on a graph with corresponding axes. Given the proportion of classes in the test set, every point on the curve corresponds to a possible confusion matrix Cij( f ) that the classifier can produce depending on the threshold chosen. The area subtended by the curve is a weighted average of true-positive rates with a peculiar choice of weights; the weights are uniform as a function of the false-positive rate, but generally not uniform as a function of the threshold, for example. The meaning and proper use of the receiver operating characteristic are discussed in a classic by Metz 1978, see especially p. 290. From the standpoint of decision theory, two remarks can be made19. First, according to the principle of maximum expected utility, § 2.3, we should choose a threshold and corresponding false-positive rate f ∗ such as to maximize the utility yield, given by eq. (10): choose f ∗ = arg max (cid:26) 1(cid:88) Uij Cij( f ) (cid:27) . (20) f i,j=0 Any other values of f and of the threshold are irrelevant. Averages over f values are therefore irrelevant as well. Second, suppose our goal is to evaluate the average performance over several possible classification problems. In that case, the quantities to be averaged are the utility matrices of those classification problems, as discussed in § 4.1, yielding a unique expected utility matrix. Once this is computed, we go back to a single choice of f according to our first remark. Owing to these issues, the area under the curve suffers from the same problems as the non-compliant metrics discussed in § 3.3: in every classification problem, it always leads to cases of incorrect evaluation. 19 similar points are made by Baker & Pinsky 2001; Lobo et al. 2008. 28 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? A correct use of the receiver-operating-characteristic curve t( f ) can be made, however. It is explained in Metz 1978 section Cost/Benefit Analysis p. 295, and in Sox et al. 2013 § 5.7.4 (curiously Sox et al. also mention the generally erroneous criterion of the area under the curve). Denote the proportion of class 0 (positive) in the test set by B. The confusion matrix as a function of f is then (cid:20)C00( f ) C01( f ) C10( f ) C11( f ) (cid:21) (cid:20) B t( f ) B [1 − t( f )] = (1 − B) f (1 − B) (1 − f ) (cid:21) . (21) The sum in formula (20) above can then be explicitly written, rearranging some terms, 1(cid:88) i,j=0 Uij Cij( f ) ≡ (U00 − U10) B t( f ) − (U11 − U01) (1 − B) f + U10 B + U11 (1 − B) . (22) The principle of maximum expected utility (20) is then equivalent to the following condition, obtained using the explicit sum above but dropping the constant term on the second line for simplicity: choose f ∗ = arg max (cid:8)(U00 − U10) B t( f ) − (U11 − U01) (1 − B) f (cid:9) . (23) f The function in braces is monotonically increasing because t( f ) is (we assume, as always, that the utility of correct classification of a class is higher than that of misclassification, so U00 − U10 ⩾ 0 and U11 − U01 ⩾ 0). Its maximum can thus be found by setting its derivative to zero: choose f ∗ such that t′( f ∗) = (U11 − U01) (1 − B) (U00 − U10) B . (24) If we have several classifiers, each with its own curve t( f ), then the best is the one tangent to the line t = (U11 − U01) (1 − B) (U00 − U10) B f + const. (25) that has the highest intercept. From this criterion it can be seen geometrically that if a classifier has its curve t( f ) completely above the curve of another classifier, then it must have a higher utility yield. But nothing, in general, can be said if the curves of the two classifiers cross. It is the tangent of a receiver-operating- characteristic curve that matters, not its subtended area. Figure 8 shows an example of this. 29 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? Figure 8 Receiver-operating-characteristic curves of two classifiers. The red dashed curve clearly subtends a larger area than the blue solid curve. Yet the classifier with the latter curve yields a higher utility, because it touches the family of parallel lines, eq. (25), at a higher point. This example arises for a utility matrix equal to (cid:2) 4 0 (cid:3) and a test set with 0 1 B = 0.5 (balanced), or for a utility matrix equal to (cid:2) 1 0 0 1 (cid:3) and a test set with B = 0.8. 6 Summary and discussion The evaluation and ranking of classification algorithms is a critical stage in their development and deployment. Without such evaluation we cannot even say whether an algorithm is better than another, or whether a set of parameter values for a specific algorithm is better than another set. And yet, at present, we have not an evaluation theory but only an evaluation folklore: different procedures, proposed only out of intuition and of analysis of special cases, with fuzzy criteria to decide which should be used, and without rigorous theoretical foundations that should guarantee uniqueness, universality properties, and absence of biases. We believe that some of the surprising failures of machine learning in actual applications20 come not only from biases in the choice of test datasets and 20 see e.g. Varoquaux & Cheplygina 2022. 30 0.00.10.20.30.40.50.60.70.80.91.00.00.10.20.30.40.50.60.70.80.91.0false−positive rate ftrue−positive rate t Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? other similar biases, but also from the use of wrong evaluation metrics in the development stage. In the present work, we have argued that theoretical foundations for the evaluation process are available in Decision Theory. Its main notions and principle – utilities and their maximization – are very intuitive, as shown (we hope) by the introductory story. These are the main results of the application of decision theory to the evaluation of classifiers: • The evaluation metric must depend on the specific classification problem. • Such metric is completely defined by n2 parameters, called utilities, collected in a utility matrix; n is the number of classes. Two parameters are arbitrary and represent a zero and measurement unit of the utility scale. In the binary-classification case, this means that we have a two- dimensional set of possible metrics. • The score of a classifier on a test set is simply given by its utility yield: the grand sum of the products of the elements of the utility matrix and the confusion matrix of the classifier. It is a simple linear expression in the confusion-matrix elements. • A utility matrix, obtained from an average, is also used when we are uncertain about the utilities underlying a classification problem or when we want to consider the average performance over several classification problems. • Some popular metrics such as precision, balanced accuracy, Mat- thews correlation coefficient, Fowlkes-Mallows index, F1-measure, and area under the receiver-operating-characteristic curve do not comply with decision theory. As a consequence, they always lead to some er- roneous comparative evaluations of classifiers in every classification problem, even when all utilities and frequencies are correctly assessed; are they are likely affected by cognitive biases. • Using a utility matrix with incorrectly assessed utilities still leads, on average, to fewer wrong comparative evaluations than using other popular metrics. We believe that the decision-theoretic evaluation of classifiers also has remarkable advantages: 31 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? First, it translates the fuzzy problem "which of the numerous scores should I rely on?" into a more structured, thus easier to confront, one: to assess, at least semi-quantitatively, how many times more valuable, desirable, or useful is the correct classification of a class than its incorrect classification, than the correct classification of another class, and so on. Such utilities usually have a more immediate, problem-dependent interpretation than other metrics. Second, it leads to a mathematically simple, computationally con- venient metric: a linear combination of confusion-matrix elements – no need for non-linear functions or integration of curves. Third, the principles of the underlying theory guide us if we have to face new peculiar problems. Imagine, for instance, a classification problem where we cannot say, in general, whether true positives are more important than true negatives and so on, because such valuation can vary from one tested item to another. Decision theory, in this case, requires an item-wise assessment of utilities, and still provides an item-wise score, which can be accumulated across items to obtain a total evaluation score for the performance of candidate classifiers. The theory, remarks, and results of the present work generalize beyond classification: to regression and more complex classification-like problems such as image segmentation, with important applications in medicine21. It would be interesting to examine whether popular metrics in the latter field, such as Dice score22 and Hausdorff distance23, comply with decision-theoretic principles, and which alternatives could be used otherwise. In a companion work24 we apply the general ideas presented here to improve the performance of machine-learning classifiers. Author contributions All authors have contributed equally to the present work. 21 Lundervold & Lundervold 2019. 23 Alt & Guibas 2000. 24 Dyrland et al. 2022. 22 Dice 1945; Fleiss 1975; Zijdenbos et al. 1994. 32 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? Thanks KD and ASL acknowledge support from the Trond Mohn Research Foundation, grant number BFS2018TMT07, and PGLPM from The Re- search Council of Norway, grant number 294594. KD would like to thank family for endless support; partner Synne for constant love, support, and encouragement; and the developers and maintainers of Python, FastAi, PyTorch, scikit-learn, NumPy and RDKit for free open source software and for making the experiments possible. PGLPM thanks Iván Davidovich for useful comments on previous drafts of this work; Maja, Mari, Miri, Emma for continuous encourage- ment and affection; Buster Keaton and Saitama for filling life with awe and inspiration; and the developers and maintainers of LATEX, Emacs, AUCTEX, Open Science Framework, R, Python, Inkscape, LibreOffice, Sci-Hub for making a free and impartial scientific exchange possible. Bibliography ('de X' is listed under D, 'van X' under V, and so on, regardless of national conventions.) Alt, H., Guibas, L. J. (2000): Discrete geometric shapes: matching, interpolation, and approximation. In: Sack, Urrutia (2000): ch. 3:121–153. doi:10.1016/B978-044482537-7/50004-8. Baker, S. G., Pinsky, P. F. (2001): A proposed design and analysis for comparing digital and analog mammography special receiver operating characteristic methods for cancer screening. J. Am. Stat. Assoc. 96 454, 421–428. doi:10.1198/016214501753168136. Berger, J. O. (1985): Statistical Decision Theory and Bayesian Analysis, 2nd ed. (Springer, New York). doi:10.1007/978-1-4757-4286-2. First publ. 1980. Brodersen, K. H., Ong, C. S., Stephan, K. E., Buhmann, J. M. (2010): The balanced accuracy and its posterior distribution. Proc. Int. Conf. Pattern Recognit. 20, 3121–3124. doi: 10.1109/ICPR.2010.764. Camerer, C. F., Kunreuther, H. (1989): Decision processes for low probability events: policy implications. J. Policy Anal. Manag. 8 4, 565–592. doi:10.2307/3325045. Cheeseman, P. (1988): An inquiry into computer understanding. Comput. Intell. 4 2, 58–66. doi:10.1111/j.1467-8640.1988.tb00091.x. Cox, R. T. (1946): Probability, frequency, and reasonable expectation. Am. J. Phys. 14 doi:10.1119/1.1990764. Dice, L. R. (1945): Measures of the amount of ecologic association between species. Ecology 26 3, 1, 1–13. 297–302. doi:10.2307/1932409. Dyrland, K., Lundervold, A. S., Porta Mana, P. G. L. (2022): A probability transducer and decision-theoretic augmentation for machine-learning classifiers. Open Science Framework doi:10.31219/osf.io/vct9y. Fenton, N., Neil, M. (2019): Risk Assessment and Decision Analysis with Bayesian Networks, 2nd ed. (CRC Press, Boca Raton, USA). doi:10.1201/b21982. First publ. 2013. 33 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? Fine, T. L. (1973): Theories of Probability: An Examination of Foundations. (Academic Press, New York). doi:10.1016/C2013-0-10655-1. Fisher, R. A. (1963): Statistical Methods for Research Workers, rev. 13th ed. (Hafner, New York). First publ. 1925. Fleiss, J. L. (1975): Measuring agreement between two judges on the presence or absence of a trait. Biometrics 31 3, 651–659. doi:10.2307/2529549. Fowlkes, E. B., Mallows, C. L. (1983): A method for comparing two hierarchical clusterings. J. Am. Stat. Assoc. 78 383, 553–569. doi:10.1080/01621459.1983.10478008. Gilovich, T., Griffin, D., Kahneman, D., eds. (2009): Heuristics and Biases: The Psychology of Intuitive Judgment, 8th pr. (Cambridge University Press, Cambridge, USA). doi: 10.1017/CBO9780511808098. First publ. 2002. Good, I. J., Toulmin, G. H. (1968): Coding theorems and weight of evidence. IMA J. Appl. Math. 1, 94–105. doi:10.1093/imamat/4.1.94. 4 Halpern, J. Y. (1999): Cox's theorem revisited. 10.1613/jair.644. See also Snow (1998). J. Artif. Intell. Res. 11, 429–435. doi: Hand, D., Christen, P. (2018): A note on using the F-measure for evaluating record linkage algorithms. Stat. Comput. 28 3, 539–547. doi:10.1007/s11222-017-9746-6. Howard, R. A. (1980): On making life and death decisions. In: Schwing, Albers (1980): 89–113. With discussion. doi:10.1007/978- 1- 4899- 0445- 4_5. Repr. in Howard, Matheson (1984) pp. 481–506. Howard, R. A., Matheson, J. E., eds. (1984): Readings on the Principles and Applications of Decision Analysis. Vol. II: Professional Collection. (Strategic Decisions Group, Menlo Park, USA). - (2005): Influence diagrams. Decis. Anal. 2 3, 127–143. doi:10.1287/deca.1050.0020. First publ. 1984 in Howard, Matheson (1984) pp. 719–762. Hunink, M. G. M., Weinstein, M. C., Wittenberg, E., Drummond, M. F., Pliskin, J. S., Wong, J. B., Glasziou, P. P. (2014): Decision Making in Health and Medicine: Integrating Evidence and Values, 2nd ed. (Cambridge University Press, Cambridge). doi:10.1017/ CBO9781139506779. First publ. 2001. Jaynes, E. T. (2003): Probability Theory: The Logic of Science. (Cambridge University Press, Cambridge). Ed. by G. Larry Bretthorst. First publ. 1994. doi:10 . 1017 / CBO9780511790423, https : / / archive . org / details / XQUHIUXHIQUHIQXUIHX2, http : //www-biba.inrialpes.fr/Jaynes/prob.html. Jeffrey, R. C. (1965): The Logic of Decision. (McGraw-Hill, New York). Jeni, L. A., Cohn, J. F., De La Torre, F. (2013): Facing imbalanced data: recommendations for the use of performance metrics. Proc. Int. Conf. Affect. Comput. Intell. Interact. 2013, 245–251. doi:10.1109/ACII.2013.47. Kahneman, D. (2011): Thinking, Fast and Slow. (Farrar, Straus and Giroux, New York). Kahneman, D., Slovic, P., Tversky, A., eds. (2008): Judgment under uncertainty: Heurist- ics and biases, 24th pr. (Cambridge University Press, Cambridge). doi:10 . 1017 / CBO9780511809477. First publ. 1982. Kim, H., Markus, H. R. (1999): Deviance or uniqueness, harmony or conformity? A cultural analysis. J. Pers. Soc. Psychol. 77 4, 785–800. doi:10.1037/0022-3514.77.4.785. Kyburg Jr., H. E., Smokler, H. E., eds. (1980): Studies in Subjective Probability, 2nd ed. (Robert E. Krieger, Huntington, USA). First publ. 1964. Lindley, D. V. (1988): Making Decisions, 2nd ed. (Wiley, London). First publ. 1971. Lobo, J. M., Jiménez-Valverde, A., Real, R. (2008): AUC: a misleading measure of the 2, 145–151. doi: performance of predictive distribution models. Glob. Ecol. Biogeogr. 17 34 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? 10.1111/j.1466-8238.2007.00358.x, https://www2.unil.ch/biomapper/Download/ Lobo-GloEcoBioGeo-2007.pdf. Lundervold, A. S., Lundervold, A. (2019): An overview of deep learning in medical imaging focusing on MRI. Z. Med. Phys. 29 2, 102–127. doi:10.1016/j.zemedi.2018.11.002. Matthews, B. W. (1975): Comparison of the predicted and observed secondary structure of T4 phage 2, 442–451. doi:10.1016/0005-2795(75)90109-9. 4, 283–298. doi: Metz, C. E. (1978): Basic principles of ROC analysis. Semin. Nucl. Med. VIII lysozyme. Biochim. Biophys. Acta 405 10.1016/S0001-2998(78)80014-2. Mittone, L., Savadori, L. (2009): The scarcity bias. Appl. Psychol. 58 3, 453–468. doi: 10.1111/j.1464-0597.2009.00401.x. North, D. W. (1968): A tutorial introduction to decision theory. IEEE Trans. Syst. Sci. Cybern. 4 3, 200–210. doi:10.1109/TSSC.1968.300114, https://stat.duke.edu/~scs/Courses/ STAT102/DecisionTheoryTutorial.pdf. Raiffa, H. (1970): Decision Analysis: Introductory Lectures on Choices under Uncertainty, 2nd pr. (Addison-Wesley, Reading, USA). First publ. 1968. Raiffa, H., Schlaifer, R. (2000): Applied Statistical Decision Theory, repr. (Wiley, New York). First publ. 1961. Ramsey, F. P. (1926): Truth and probability. In: Ramsey (1950): ch.VII:156–198. Repr. in Kyburg, Smokler (1980), pp. 23–52. Written 1926. - (1950): The Foundations of Mathematics: and other Logical Essays. (Routledge & Kegan Paul, London). doi:10 . 4324 / 9781315887814, https : / / archive . org / details / in . ernet.dli.2015.46352. Ed. by R. B. Braithwaite. First publ. 1931. Russell, S. J., Norvig, P. (2022): Artificial Intelligence: A Modern Approach, Fourth Global ed. (Pearson, Harlow, UK). http://aima.cs.berkeley.edu/global- index.html, https : / / archive . org / details / artificial - intelligence - a - modern - approach - 4th-edition. First publ. 1995. Sack, J.-R., Urrutia, J., eds. (2000): Handbook of Computational Geometry. (Elsevier, Amster- dam). doi:10.1016/B978-0-444-82537-7.X5000-1. Savage, L. J. (1972): The Foundations of Statistics, 2nd rev. and enl. ed. (Dover, New York). First publ. 1954. Schwing, R. C., Albers Jr., W. A., eds. (1980): Societal Risk Assessment: How Safe is Safe Enough? (Springer, New York). doi:10.1007/978-1-4899-0445-4. Self, M., Cheeseman, P. C. (1987): Bayesian prediction for artificial intelligence. In: Proceedings of the third conference on uncertainty in artificial intelligence (uai'87), ed. by J. Lemmer, T. Levitt, L. Kanal (AUAI Press, Arlington, USA): 61–69. Repr. in arXiv doi:10.48550/ arXiv.1304.2717. Shannon, C. E. (1948): A mathematical theory of communication. Bell Syst. Tech. J. 27 3, 4, 379–423, 623–656. https://archive.org/details/bstj27-3-379, https://archive. org/details/bstj27- 4- 623, http://math.harvard.edu/~ctm/home/text/others/ shannon/entropy/entropy.pdf. Snow, P. (1998): On the correctness and reasonableness of Cox's theorem for finite domains. 3, 452–459. doi:10.1111/0824-7935.00070. - (2001): The reasonableness of possibility from the perspective of Cox. Comput. Intell. 17 Comput. Intell. 14 1, 178–192. doi:10.1111/0824-7935.00138. Sox, H. C., Higgins, M. C., Owens, D. K. (2013): Medical Decision Making, 2nd ed. (Wiley, New York). doi:10.1002/9781118341544. First publ. 1988. 35 Dyrland, Lundervold, Porta Mana Does the evaluation stand up to evaluation? Steele, K., Stefánsson, H. O. (2020): Decision theory. In: Stanford encyclopedia of philosophy, ed. by E. N. Zalta (The Metaphysics Research Lab, Stanford). https://plato.stanford. edu/archives/win2020/entries/decision-theory. First publ. 2015. Tribus, M. (1969): Rational Descriptions, Decisions and Designs. (Pergamon, New York). doi: 10.1016/C2013-0-01558-7. van Rijsbergen, C. J. (1974): Foundation of evaluation. J. Doc. 30 4, 365–373. doi:10.1108/ eb026584. Varoquaux, G., Cheplygina, V. (2022): Machine learning for medical imaging: methodological 1, 48. doi:10.1038/s41746- failures and recommendations for the future. npj Digit. Med. 5 022-00592-y. von Neumann, J., Morgenstern, O. (1955): Theory of Games and Economic Behavior, 3rd ed., 6th pr. (Princeton University Press, Princeton). https://archive.org/details/in. ernet.dli.2015.215284. First publ. 1944. Woodward, P. M. (1964): Probability and Information Theory, with Applications to Radar, 2nd ed. (Pergamon, Oxford). doi:10.1016/C2013-0-05390-X. First publ. 1953. Zhu, Q. (2020): On the performance of Matthews correlation coefficient (MCC) for imbalanced dataset. Pattern Recognit. Lett. 136, 71–80. doi:10.1016/j.patrec.2020.03.030. Zijdenbos, A. P., Dawant, B. M., Margolin, R. A., Palmer, A. C. (1994): Morphometric analysis of white matter lesions in MR images: method and validation. IEEE Trans. Med. Imaging 13 4, 716–724. doi:10.1109/42.363096. 36
http://arxiv.org/abs/2302.10571v2
2023-03-17T21:41:38
2023-02-21T09:54:32
SurvLIMEpy: A Python package implementing SurvLIME
In this paper we present SurvLIMEpy, an open-source Python package that implements the SurvLIME algorithm. This method allows to compute local feature importance for machine learning algorithms designed for modelling Survival Analysis data. Our implementation takes advantage of the parallelisation paradigm as all computations are performed in a matrix-wise fashion which speeds up execution time. Additionally, SurvLIMEpy assists the user with visualization tools to better understand the result of the algorithm. The package supports a wide variety of survival models, from the Cox Proportional Hazards Model to deep learning models such as DeepHit or DeepSurv. Two types of experiments are presented in this paper. First, by means of simulated data, we study the ability of the algorithm to capture the importance of the features. Second, we use three open source survival datasets together with a set of survival algorithms in order to demonstrate how SurvLIMEpy behaves when applied to different models.
[ "Cristian Pachón-García", "Carlos Hernández-Pérez", "Pedro Delicado", "Verónica Vilaplana" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10571v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10571v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "stat.ML", "@scheme": "http://arxiv.org/schemas/atom" }
[ "stat.ML", "cs.AI", "cs.LG", "cs.MS" ]
3 2 0 2 r a M 7 1 ] L M . t a t s [ 2 v 1 7 5 0 1 . 2 0 3 2 : v i X r a SurvLIMEpy: A Python package implementing SurvLIME Cristian Pachón-García† Universitat Politècnica de Catalunya Carlos Hernández-Pérez† Universitat Politècnica de Catalunya Pedro Delicado Universitat Politècnica de Catalunya Verónica Vilaplana* Universitat Politècnica de Catalunya March 21, 2023 Abstract In this paper we present SurvLIMEpy, an open-source Python pack- age that implements the SurvLIME algorithm. This method allows to compute local feature importance for machine learning algorithms de- signed for modelling Survival Analysis data. Our implementation takes advantage of the parallelisation paradigm as all computations are per- formed in a matrix-wise fashion which speeds up execution time. Addi- tionally, SurvLIMEpy assists the user with visualization tools to better understand the result of the algorithm. The package supports a wide variety of survival models, from the Cox Proportional Hazards Model to deep learning models such as DeepHit or DeepSurv. Two types of experiments are presented in this paper. First, by means of simulated data, we study the ability of the algorithm to capture the importance of the features. Second, we use three open source survival datasets together with a set of survival algorithms in order to demonstrate how SurvLIMEpy behaves when applied to different models. Keywords: Interpretable Machine Learning; eXplainalble Artificial Intelligence,; Survival Analysis; Machine Learning; Python. 1 Introduction Survival Analysis, also known as time-to-event analysis, is a field of Statistics that aims to study the time until a certain event of interest occurs. The reference approach for modelling the survival time is the Cox Proportional Hazards Model [Cox, 1972]. †These authors contributed equally to this work. *Corresponding author. 1 A survival study follows up a set of individuals among whom some will eventually experience the event of interest. Due to the nature of these studies, it is common to find the problem of censorship. An event may not be observed in all individuals due to lost to follow-up, dropping from the study or finishing the study without the event occurring. The Cox Proportional Hazards Model takes into account the phenomenon of censorship, since the estimation of the parameters is done through a likelihood function that deals with censorship. Nowadays, a wide set of machine learning models are able to tackle Survival Analysis problems. Among them, it is worth highlighting Random Survival Forest [Ishwaran et al., 2008], survival regression with accelerated failure time model in XGBoost [Barnwal et al., 2022] or adaptations of deep learning algorithms for Survival Analysis such as DeepHit [Lee et al., 2018] or DeepSurv [Katzman et al., 2018]. These models have proven to have good prediction capacity, as reported in Wang et al. [2019], Spooner et al. [2020], Hao et al. [2021]. Despite the continuous advances in the development of machine learning algorithms for healthcare applications, their adoption by medical practi- tioners and policy makers in public health is still limited. One of the main reasons is the black-box nature of most of the models, in the sense that the reasoning behind their predictions is often hidden from the user. Interpretable Machine Learning (or, equivalently, eXplainable Artificial Intelligence, XAI for short) is a recent field born out of the need to derive explanations from machine learning models [Barredo Arrieta et al., 2020]. Two popular interpretability methods are LIME [Ribeiro et al., 2016] and SHAP [Lundberg and Lee, 2017], which provide explanations locally around a test example. Although they are extensively used [Barr Kumarakulasinghe et al., 2020], these algorithms are not designed to deal with time-to-event data, which invalidates their use in survival applications. The SurvLIME algorithm [Kovalev et al., 2020], inspired by LIME, was the first method presented in order to interpret black box survival models. This method aims to compute local interpretability by means of providing a ranking among the set of features for a given individual x∗, but unlike the methods mentioned previously, it considers the time space to provide explanations. First, it generates a set of neighbours, then it obtains a set of predictions for the neighbours and, finally, a Cox Proportional Hazards Model (local explainer) is fitted, minimising the distance between the predic- tions provided by the black box model and the predictions provided by the local explainer. The coefficients of the local model serve as an explanation for the survival machine learning model. In a recent work, it was presented SurvSHAP(t) [Krzyziński et al., 2023], an interpretability method inspired by SHAP algorithm designed to ex- plain time-to-event machine learning models. In short, the explanation is provided by means of a time-dependent function. The time space is in- 2 cluded in the explanation with the goal of detecting possible dependencies between the features and the time. Alongside this method, implementations of SurvLIME and SurvSHAP(t) algorithms were presented in the R package survexp [Spytek et al., 2022]. In this work we present an open-sourced Python package, SurvLIMEpy, which implements the SurvLIME algorithm. The package offers some de- grees of freedom to the users. For instance, they can choose how to obtain the neighbours of the test individual, the distance metric to be minimised or to carry out a Monte-Carlo simulation. Furthermore, we provide details on how to use it, illustrated with some open source survival datasets as well as a simulation study, aiming to analyse the performance of the SurvLIME algorithm. As far as we know, this is the first Python implementation of this method. The rest of the paper is organised as follows: in Section 2, the most relevant parts of the SurvLIME algorithm are presented. In Section 3, we introduce the package implementation. Additionally, a use case is provided. In Section 4, we present some experiments conducted with both simulated and real datasets. In this section, we use some of the state-of-the-art ma- chine learning and deep learning algorithms for Survival Analysis in order to show how SurvLIMEpy is used with those models. Finally, conclusions are presented in Section 5. 2 SurvLIME algorithm In this section we summarise the SurvLIME algorithm, which was pre- sented in Kovalev et al. [2020]. We first introduce some notation. Let D = {(xj, τj, δj)} j ∈ {1, . . . , n} be a dataset of triplets that represent indi- viduals, where xj ∈ Rp is a p-dimensional feature vector, τj is the time to event or lost to follow-up time, and δj is the event indicator (1 means the event occurs and 0 otherwise). Let t1 < * * * < tm+1 be the distinct times from {τ1, . . . , τn}. Let ˆH : Rp × R>0 → R>0 (x, t) 7→ ˆH(x, t) be the already trained machine learning model that predicts the Cumulative Hazard Function (CHF; see Appendix A for more details) of an individual In SurvLIME [Kovalev et al., 2020], the authors prove that x at time t. ˆH(x, t) can be written as ˆH(x, t) = m+1 X ˆHi(x)1Ωi (t), (1) i=1 where Ωi = [ti, ti+1), being tm+2 = tm+1 +γ (γ a small positive number) and (t) the indicator function (1 if t ∈ Ωi and 0 otherwise). In the original 1Ωi 3 paper, the authors did not specify any value for γ. In our implementation, we use 10−6. It is important to note that the function ˆHi(x) is constant in Ωi. There- Ωj and g : Ω → R is a monotone function, then fore, if Ω = ∪m+1 i=1 g( ˆH(x, t)) = m+1 X i=1 h ˆHi(x)i 1Ωi g (t). (2) Given the prediction provided by the black-box model ˆH(x∗, t) for an in- dividual x∗, SurvLIME finds the importance of each feature by means of ap- proximating ˆH(x∗, t) by the Cox Proportional Hazards Model, ˆHcox(x∗, t) = H0(t) exp(ˆβ x∗) (see Appendix A for more details). T Applying Expression (1) to the Cox Proportional Hazards Model, a new expression for this model is obtained: ˆHcox(x∗, t) = m+1 X i=1 h ˆH0(ti) exp(ˆβ T x∗)i 1Ωi (t). (3) After fixing the individual x∗, both functions, ˆH(x∗, t) and ˆHcox(x∗, t), only depend on t. Taking the logarithms φ(t) = ln[ ˆH(x∗, t)] and φcox(t) = ln[ ˆHcox(x∗, t)] and taking into account Expression (2), the following can be derived: φ(t) = m+1 X i=1 ln h ˆHi(x∗)i 1Ωi (t), φcox(t) = m+1 X i=1 (cid:16)ln h ˆH0(ti)i + ˆβ T x∗ (cid:17) 1Ωi (t). (4) (5) T Let us consider α(t) = φ(t) − φcox(t) = Pm+1 i=1 x∗)1Ωi (ln[ ˆHi(x∗)] − ln[ ˆH0(ti)] − ˆβ (t). Since α(t) is a piecewise constant function and s(t) = t2 is a monotone function for t ≥ 0, we can use Expression (2) to write (φ − φcox)2 as a piecewise constant function, s(α(t)) = (φ(t) − φcox(t))2 = m+1 X i=1 (cid:16)ln h ˆHi(x∗)i − ln h ˆH0(ti)i T − ˆβ x∗ (cid:17)2 1Ωi (t). (6) 4 The next step is to find a vector ˆβ that minimises the '2 distance between φ and φcox. Taking into account that both functions are considered in Ω, d2(φ, φcox) = kφ − φcoxk2 2 [φ(t) − φcox(t)]2 dt = Z Ω Z = m+1 X Ω i=1 (cid:16)ln h ˆHi(x∗)i − ln h ˆH0(ti)i T − ˆβ x∗ (cid:17)2 1Ωi (t) dt (7) m+1 X = i=1 (cid:16)ln h ˆHi(x∗)i − ln h ˆH0(ti)i T − ˆβ x∗ (cid:17)2 ∆ti, T where ∆ti = (ti+1 − ti). We have used Expression (6) and that ln[ ˆHi(x∗)] − ln[ ˆH0(ti)] − ˆβ x∗ does not depend on t to derive the previous expression. Since SurvLIME is inspired by LIME, a set of N points {e1, . . . , eN } are generated in a neighbourhood of x∗, and the objective function is expressed in terms of these points and their corresponding weights, that depend on the distance between the N points and the individual x∗. Applying Expression (7) for all the neighbours ek, the following objective is obtained: min ˆβ N X wk m+1 X k=1 i=1 (cid:16)ln h ˆHi(ek)i − ln h ˆH0(ti)i T − ˆβ ek (cid:17)2 ∆ti. (8) For each point ek a weight is computed using a kernel function, wk = K(x∗, ek); the closer ek is to x∗, the higher the value of wk is. Finally, the authors introduce weights uki = ˆHi(ek)/ ln( ˆHi(ek)) in Ex- pression (8), as the difference between ˆH(x, t) and ˆHcox(x, t) could be sig- nificantly different from the distance between their logarithms. Therefore, the goal is to minimise the following expression: min ˆβ N X wk m+1 X k=1 i=1 u2 ki (cid:16)ln h ˆHi(ek)i − ln h ˆH0(ti)i T − ˆβ ek (cid:17)2 ∆ti. (9) Note that the first two factors in Expression (9) are quadratic and the last one is positive. Thus, the product is a convex function. Since we are considering a weighted sum of convex functions, the resulting expression is also convex. Therefore, there exists a solution for this problem. Algorithm 1 summarises how to proceed in order to obtain the coeffi- cients ˆβ for the local Cox Proportional Hazards Model approximation. In case all the features are standardised, feature i is more important than fea- ture j if | ˆβi| > | ˆβj|. If they are not standardised, x∗ must be taken into account to perform the comparison: feature i is more important than fea- ture j if | ˆβix∗i| > | ˆβjx∗j|. 5 Algorithm 1 SurvLIME algorithm. Require: Input variables: • Training dataset D = {(xj, τj, δj)}, j ∈ {1, . . . , n}. • Individual of interest x∗. • Number of neighbours to generate N . • Black-box model for the Cumulative Hazard Function ˆH : Rp × R>0 → R>0. • Kernel function K : Rp×Rp → R>0 to compute the weights according to the distance to x∗. Ensure: Obtain vector ˆβ for the local Cox Proportional Hazards Model approximation. 1. Obtain the distinct times ti, i ∈ {1, . . . , m + 1} from D. 2. Estimate the baseline Cumulative Hazard Function ˆH0(t) using D and the Nelson-Aalen estimator. 3. Generate N neighbours of x∗: {e1, . . . , eN }. 4. For each time step ti and for each ek, obtain the prediction ˆHi(ek). 5. Obtain ln (cid:16) ˆHi(ek)(cid:17). 6. For each ek, obtain the weight wk = K(x∗, ek). step ti 7. For obtain uki = each ek, and for each time ˆHi(ek)/ ln (cid:16) ˆHi(ek)(cid:17). 8. Solve the convex optimisation problem stated in Expression (9). 3 Package implementation In this section, we introduce SurvLIMEpy, an open-source Python package that implements the SurvLIME algorithm. It is stored in the Python Package Index (PyPI)1 and the source code is available at GitHub2. Additionally, we present a detailed explanation of the implementation as well as some additional flexibility provided to the package. Section 3.1 introduces a matrix-wise formulation for Expression (9). Sec- tions 3.2 to 3.4 describe the parts of the package that the user can adjust. Sections 3.5 and 3.6 describe how to use the package and some code examples are given. 1https://pypi.org/project/survlimepy/ 2https://github.com/imatge-upc/SurvLIMEpy 6 3.1 Matrix-wise formulation In order to apply a parallelism paradigm, and thus reduce the total execu- tion time, the optimisation problem can be formulated matrix-wise. Before developing it, we introduce some notation. Let 1d be the vector of ones of size d, i.e., 1d = (1, . . . , 1)T. Let A = (aij) and C = (cij) be two matrices of the same size. By (cid:11) we denote the element-wise division between A and C. Likewise, (cid:12) denotes the element-wise product. The first step is to find the matrix expression for ln[ ˆH0(ti)]. Let v0 be the component-wise logarithm of the baseline Cumulative Hazard function evaluated at each distinct time, i.e., v0 = (ln[ ˆH0(t1)], . . . , ln[ ˆH0(tm+1)])T. To produce a matrix, let us consider the product between 1N and vT , L0 = 0 . L0 is a matrix of size N × (m + 1). Note that all the rows contain 1N vT 0 exactly the same vector v0. After that, a matrix E containing N neighbours is obtained. The size of E is N × p. Each row in E, denoted by ek, is a neighbour of x∗. To find the matrix expression for ln[ ˆHi(ek)], let V = (vki) be the matrix that contains the values of the Cumulative Hazard Function for the neighbours evaluated at each distinct time, i.e., vki = ˆHi(ek). Let us consider the component-wise logarithm of V, L = (ln[vki]). V and L are of size N × (m + 1). Next, we find the matrix-wise expression for [ ˆHi(ek)/ ln( ˆHi(ek)]2. Let M be the resulting matrix of the element-wise division between V and L, i.e., M = V (cid:11) L and let M2 = M (cid:12) M, which is of size N × (m + 1). The next step is to find the matrix expression for ˆβ ek. Let ˆβ be the unknown vector (of size p) we are looking for. Let us consider the product between E and ˆβ, ̃p = Eˆβ, which is a vector of size N and whose k − th component is ˆβ ek. To obtain a matrix of size N × (m + 1), let us consider the product between ̃p and 1m+1, Λ = ̃p1T . All the columns in Λ contain the same vector ̃p. Let us obtain the matrix-wise expression of (ln[ ˆHi(ek)] − ln[ ˆH0(ti)] − ˆβ ek)2. First, let us consider Θ = L − L0 − Λ. Note that the size of the matrix Θ is N × (m + 1). Second, let us consider the element-wise square of the previous matrix, denoted by Θ2, i.e., Θ2 = Θ(cid:12)Θ. The component (k, i) of the previous matrix contains the desired expression, where k ∈ {1, . . . , N } and i ∈ {1, . . . , m + 1}. (ln[ ˆHi(ek)] − ln[ ˆH0(ti)] − Now, we obtain the matrix expression for u2 ki ˆβ ek)2. To do that, let Π be the matrix obtained by the element-wise multiplication between M2 and Θ2, Π = M2 (cid:12) Θ2. Π is of size N × (m + 1). Let t be the vector of size m + 2 containing the distinct times (we apply the same consideration as in Section 2, i.e., tm+2 = tm+1 + γ). Let ψt be the vector of time differences between two consecutive distinct times, i.e., ψt = (t2 − t1, . . . , tm+2 − tm+1)T, which is a vector of size m + 1. To obtain Pm+1 (ln[ ˆHi(ek)] − ln[ ˆH0(ti)] − ˆβ ek)2∆ti matrix-wise, let m+1 T T T T T i=1 u2 ki 7 π be the resulting vector of multiplying the matrix Π and the vector ψt, i.e., π = Πψt . The vector π is of size N and the k − th component of it contains the desired expression. Finally, let w be the vector of weights for the neighbours, which is of size N . This vector is obtained by applying the kernel function over all the neighbours, i.e., wk = K(x∗, ek). Then, Expression (9) can be formulated as wTπ, min ˆβ (10) where the vector π depends on the vector ˆβ. Algorithm 2 summarises this matrix-wise implementation. In order to find a numerical solution for Expression (10), we use the cvxpy package [Diamond and Boyd, 2016]. This library contains function- alities that allow to perform matrix-wise operations as well as element-wise operations. Moreover, cvxpy library allows the user to choose the solver applied to the optimisation algorithm. In our implementation, we use the default option, which is the Operator Splitting Quadratic Program solver, OSQP for short [Stellato et al., 2020]. 3.2 Neighbour generation and kernel function The neighbour generating process is not specified in the original LIME paper nor in the SurvLIME publication. As reported in Molnar [2022], this issue requires great care since explanations provided by the algorithm may vary depending on how the neighbours are generated. In our implementation, we use a non-parametric kernel density estima- tion approach. Let x1, . . . , xn, a p dimensional sample drawn from a random variable X with density function f . Let ˆσj be the sampling standard devi- ation of the the j − th component of X . For a point x ∈ Rp, a kernel-type estimator of f (x) is ˆf (x) = 1 nbp Qp j=1 ˆσj n X i=1 exp (cid:18) − 1 2b2 kx − xik2 s (cid:19) , j=1 (xj − xij)2/ˆσ2 j where kx − xiks = qPp is the Euclidean distance between the standardised versions of x and xi, and b is the bandwidth, a tuning parameter which, by default, we fix as b = [4/(n[p + 2])]1/(p+4), following the Normal reference rule [Silverman, 1986, page 87]. Observe that ˆf (x) is a mixture of n multivariate Normal density functions, each with weight 1/n, mean value xi and common covariance matrix ˆΣ = b2 * diag(ˆσ2 ). We consider such a Normal distribution centering it at a point of interest x∗: N (x∗, ˆΣ). 1, . . . , ˆσ2 p First, a matrix containing a set of N neighbours, denoted by E, is gener- ated, each row ek coming from a N (x∗, ˆΣ), k ∈ {1, . . . , N }. Afterwards, the 8 Algorithm 2 Matrix-wise SurvLIME algorithm. Require: Input variables: • Training dataset D = {(xj, τj, δj)}, j ∈ {1, . . . , n}. • Individual of interest x∗. • Number of neighbours to generate N . • Black-box model for the Cumulative Hazard Function ˆH : Rp × R>0 → R>0. • Kernel function K : Rp×Rp → R>0 to compute the weights according to the distance to x∗. Ensure: Obtain vector ˆβ for the local Cox Proportional Hazards Model approximation. 1. Obtain the vector of distinct times t from D. 2. Obtain the vector v0, the component-wise logarithm of baseline Cu- mulative Hazard Function evaluated at each distinct time ti using D and the Nelson-Aalen estimator. 3. Generate matrix of neighbours E. 4. Obtain matrix V = ˆH(E, t). 5. Calculate component-wise logarithm of V, L = ln(V). 6. Obtain the vector of weights, w = K(x∗, E). 7. Obtain the matrix of weights M2. 8. Solve the convex optimisation problem stated in Expression (10). weight wk of neighbour ek is computed as the value of the density function of the N (x∗, ˆΣ) evaluated at ek. 3.3 Functional norm While the original publication uses the '2 functional norm to measure the distance between φ and φcox in Expression (7), other works such as SurvLIME- Inf [Utkin et al., 2020] use '∞. The authors of SurvLIME-Inf claim that this norm speeds up the execution time when solving the optimisation problem. In our implementation, the computational gain of using the infinity norm was negligible when solving the problem in a matrix-wise formulation as explained in Section 3.1. The '2 is set as the default distance in our imple- mentation. However, the user can choose other norms. 9 3.4 Supported survival models Throughout this work, we represent a survival model as a function ˆH : Rp × R>0 → R>0. However, the packages that implement the different models do not work in the same way, since their implementations employ a function that takes as input a vector of size p and outputs a vector of size m + 1, where m + 1 is the number of distinct times (see Section 2 for more details). Therefore, the output is a vector containing the Cumulative Hazard Function evaluated at each distinct time, i.e., ˆH : Rp → Rm+1 >0 Our package can manage multiple types of survival models. In addition to the Cox Proportional Hazards Model [Cox, 1972], which is implemented in the sksurv library [Pölsterl, 2020], SurvLIMEpy also manages other al- gorithms: Random Survival Forest [Ishwaran et al., 2008], implemented in the sksurv library, Survival regression with accelerated failure time model in XGBoost [Barnwal et al., 2022], implemented in the xgbse library [Vieira et al., 2020], DeepHit [Lee et al., 2018] and DeepSurv [Katzman et al., 2018], both implemented in the pycox library [Kvamme et al., 2019]. . The set of times for which the models compute a prediction can differ across models and their implementations. Whereas Cox Proportional Haz- ards Model, Random Survival Forest and DeepSurv offer a prediction for each distinct time, {t1, . . . , tm+1}, the other models work differently: for a given integer q + 1, they estimate the q + 1 quantiles { ̃t1, . . . , ̃tq+1} and then, they offer a prediction for each ̃tj. The first models output a vector of size m + 1, ( ˆH(t1), . . . , ˆH(tm+1))T. The second models output a vector of size q + 1, ( ˆH( ̃t1), . . . , ˆH( ̃tq+1))T. Since SurvLIME requires the output of the model to be a vector of length m + 1, we use linear interpolation in order to fulfill this condition. All of the machine learning packages provide a variable specifying the set of times for which the model provides a prediction. We use this variable to perform the interpolation. We choose to ensure the integration of the aforementioned machine learn- ing algorithms with SurvLIMEpy as they are the most predominant in the field [Wang et al., 2019, Spooner et al., 2020, Hao et al., 2021]. In Sec- tions 3.5 and 3.6 there are more details on how to provide the prediction function to the package. Note that if a new survival package is developed, SurvLIMEpy will support it as long as the output provided by the predict function is a vector of length q + 1, 0 < q ≤ m. Usually, the libraries designed to create machine learning algorithms for survival analysis make available two functions to create predictions, one for the Cumulative Hazard Function (CHF) and another one for the Sur- vival Function (SF). For example, for the sksurv package this functions are predict_cumulative_hazard_function and predict_survival_function, respectively. SurvLIMEpy has been developed to work with both of them. The user should specify which prediction function is using. By default, the 10 package assumes that the prediction function is for the CHF. In case of working with the SF, a set of transformations is performed in order to work with CHF (see Appendix A, where the relationship between the CHF and the SF is explained). 3.5 Package structure The class 'SurvLimeExplainer' is used as the main object of the package to computes feature importance. SurvLimeExplainer( training_features, training_events, training_times, model_output_times, H0, kernel_width, functional_norm, random_state ) • training_features: Matrix of features of size n × p, where n is the number of individuals and p is the size of the feature space. It can be either a pandas data frame or a numpy array. • training_events: Vector of event indicators, of size n. It corresponds to the vector (δ1, . . . , δn)T and it must be a Python list, a pandas series or a numpy array. • training_times: Vector of event times, of size n. It corresponds to the vector (τ1, . . . , τn)T and this must be a Python list, a pandas series or a numpy array. • model_output_times (optional): Vector of times for which the model provides a prediction, as explained is Section 3.4. By default, the vec- tor of distinct times (t1, . . . , tm+1)T, obtained from training_times, is used. If provided, it must be a numpy array. • H0 (optional): Vector of baseline cumulative hazard values, of size m + 1, used by the local Cox Proportional Hazards Model. If the user provides it, then a numpy array, a Python list or a StepFunction (from sksurv package) must be used. If the user does not provide it, the package uses the non-parametric algorithm of Nelson-Aalen [Aalen, 1978]. It is computed using the events δi (training_events) and times τi (training_times). • kernel_width (optional): Bandwidth of the kernel (b parameter de- fined in Section 3.2) used in the neighbours generating process as well as to compute the vector of weights w. A float must be used. The default value for this parameter is equal to 4/(n[p + 2])]1/(p+4). See Section 3.2 for more details. 11 • functional_norm (optional): Norm used in order to calculate the dis- tance between the logarithm of the Cox Proportional Hazards Model, φcox(t), and the logarithm of the black box model, φ(t). If provided, it must be either a float k ≥ 1, in order to use 'k, or the string "inf", in order to use '∞. The default value is set to 2. See Section 3.3 for more details. • random_state (optional): Number to be used for the random seed. The user must provide a value if the results obtained must be repro- ducible every time the code is executed. The default is set to empty (no reproducibility needed). In order to obtain the coefficients of the local Cox Proportional Hazards Model, the aforementioned class has a specific method: explain_instance( data_row, predict_fn, type_fn, num_samples, verbose ) • data_row: Instance to be explained, i.e., x∗. It must be a Python list, a numpy array or a pandas series. The length of this array must be equal to the number of columns of the training_features matrix, i.e., p. • predict_fn: Prediction function, i.e., ˆH : Rp → Rq+1 . It must be a callable (i.e., a Python function). See Section 3.4 for more details. >0 • type_fn (optional): String indicating whether the prediction function, predict_fn, is for the Cumulative Hazard Function or for the Survival Function. The default value is set to "cumulative". The other option is "survival". • num_samples (optional): Number of neighbours N to be generated. The default value is set to 1000. See Section 3.2 for more details. • verbose (optional): Boolean indicating whether to show the cvxpy messages. Default is set to false. In addition to the main functions, there are three additional function- alities provided by the package. The first one, plot_weights(), allows to visualise the SurvLIME coefficients. This function returns a bar plot of the computed values. The function has two optional input parameters. The first one, with_colour, is a boolean parameter indicating whether to use a red colour palette for the features that increase the Cumulative Hazard Function and a blue palette for those that decrease it. If it is set to false, 12 the grey colour is used for all the bars. The default value is true. The other input parameter is figure_path. In case the user provides a value, it must be a path where the plot is stored as a .png file. The second functionality is devoted to perform a Monte-Carlo simula- tion. When using the explain_instance() method, the optimisation prob- lem is solved once: a single set of neighbours is generated and, therefore, a single vector of coefficients is obtained. For a given individual x∗, the method montecarlo_explanation() allows to obtain a set of vectors (of coefficients) { ˆβ1, . . . , ˆβb} each corresponding to a different random set of neighbours. In order to use it, the number of simulations, b, must be provided. Once all the simulations are performed, the mean value, ̄β = 1/b Pb , is calculated to obtain a single vector of feature importance for the individual x∗. This method allows to use a matrix X∗ (of size h × p, where h is the number of individuals to be explained) as input, instead of a single individual x∗. Therefore, a matrix B (of size h × p) is obtained: a row i of B is a vector containing the feature importance of the individual i of X∗. The function montecarlo_explanation() is part of the 'SurvLimeExplainer' class. ˆβj j=1 montecarlo_explanation( data, predict_fn, type_fn, num_samples, num_repetitions, verbose ) Note that all the input parameters are the same as the input parameters of explain_instance() except for two of them: • data: Instances to be explained, i.e., X∗. It must be a pandas data frame, a pandas series, a numpy array or a Python list. • num_repetitions (optional): Integer indication the number of simu- lations, b. The default value is set to 10. Finally, plot_montecarlo_weights() is the last functionality we have developed and it allows to create a boxen plot from the values obtained by montecarlo_explanation() method. plot_montecarlo_weights() has two optional input parameters: with_colour and figure_path. These pa- rameters behave in the same way as the input parameters of the function plot_weights(). 3.6 Code example The following code fragment shows how to use the package to compute the importance vector for the features for a single individual. In order to run it, let us suppose we have a machine learning model already trained, denoted by model, which has a method that obtains a prediction for the Cumula- tive Hazard Function, model.predict_cumulative_hazard_function and 13 it has an attribute containing the times for which the previous method pro- vides a prediction, model.event_times_ (we are adopting the notation of sksurv package). The individual to be explained is denoted by individual, the dataset containing the features is denoted by features, the vector containing the event indicators is denoted by events and the vector containing the times is denoted by times. from survlimepy import SurvLimeExplainer explainer = SurvLimeExplainer( training_features=features, training_events=events, training_times=times, model_output_times=model.event_times_ ) explanation = explainer.explain_instance( data_row=individual, predict_fn=model.predict_cumulative_hazard_function, num_samples=1000 ) explainer.plot_weights() The last line displays the importance of each feature. The result is shown in Figure 1. The computed coefficients are displayed in descending order, with a red colour palette for the features that increase the Cumu- lative Hazard Function and a blue palette for those that decrease it. The remaining input parameters in 'SurvLimeExplainer' as well as in function explain_instance() use their corresponding default values. The next code block exemplifies how to use montecarlo_explanation() to obtain a set of SurvLIME values as well as the plot_montecarlo_weights() method to display them. We make use of the same notation as before, i.e., model.predict_cumulative_hazard_function, model.event_times_, features, events and times. Instead of explaining a single individual, we explain a set of h individuals. Let, X_ind be a numpy array of size h × p. For each individual, we perform 100 repetitions and, for each repetition, 1000 neighbours are generated. The code needed to obtain the results is very similar to the previous one. The last line of the code example is responsible for displaying Figure 2. Note that the variable mc_explanation is a numpy array of size h × p, where the row i contains the feature importance for individual i in X_ind. 14 Figure 1: SurvLIME values obtained with explainer.plot_weights() method. The input parameter with_colour is set to true. from survlimepy import SurvLimeExplainer explainer = SurvLimeExplainer( training_features=features, training_events=events, training_times=times, model_output_times=model.event_times_ ) mc_explanation = explainer.montecarlo_explanation( data=X_ind, predict_fn=model.predict_cumulative_hazard_function, num_repetitions=100, num_samples=1000 ) explainer.plot_montecarlo_weights() 4 Experiments In this section, we present the experiments performed to test the imple- mentation of our package SurvLIMEpy. In order to ensure reproducibility we have created a separate repository3 in which we share the code used throughout this section. 3https://github.com/imatge-upc/SurvLIME-experiments 15 2: SurvLIME values Figure the method explainer.plot_montecarlo_weights(). The input parameter with_colour is set to true. obtained by means of using We conduct two types of experiments. The first is by means of simulated data, as the authors of the original paper of SurvLIME. Given that they describe in detail how their data was generated, we are able to follow the same procedure. As we use simulated data we can compare the results of the SurvLIME algorithm with the data generating process. Therefore, we can measure how much the coefficients provided by the algorithm deviate from the real coefficients (i.e. the simulated ones). The second set of experiments is with real survival datasets. In this part, we use machine learning as well as deep learning algorithms. Our goal is to show how SurvLIMEpy can be used with the state-of-the-art machine learning models. For those experiments, we do not have results to compare with, unlike what happens in the case of simulated data. Therefore, just qualitative insights are provided. 4.1 Simulated data First, two sets of data are generated randomly and uniformly in the p- dimensional sphere, where p = 5. Each set is configured as follows: • Set 1: Center, c1 = (0, 0, 0, 0, 0), radius, r1 = 8, number of individuals, n1 = 1000. • Set 2: Center, c2 = (4, −8, 2, 4, 2), radius, r2 = 8, number of individu- als, n2 = 1000. 16 Using these parameters, two datasets represented by the matrices Xr of size nr × p are generated (r ∈ {1, 2}). A row from these datasets represents an individual and a column represents a feature. Therefore, xij represents the value of feature j for the individual i. The Weibull distribution is used to generate time data [Bender et al., 2005]. This distribution respects the assumption of proportional hazards, the same as the Cox Proportional Hazards Model does. The Weibull dis- tribution is determined by two parameters: the scale, λ, and the shape, ν. Given the set of data r, a vector of time to events (of size nr) is generated as (cid:19)1/νr τ r = (cid:18) − ln(ur) λr exp(Xrβr where ur is a vector of nr independent and identically uniform distributions in the interval (0, 1). Both functions, the logarithm and the exponential, are applied component-wise. As done in Kovalev et al. [2020], all times greater than 2000 are constrained to 2000. Each set r has the following set of parameters: (11) ) , • Set 1: λ1 = 10−5, ν1 = 2, βT 1 = (10−6, 0.1, −0.15, 10−6, 10−6). • Set 2: λ2 = 10−5, ν2 = 2, βT 2 = (10−6, −0.15, 10−6, 10−6, −0.1). Note that for the first set, the second and the third features are the most important ones. On the other hand, for the second set, the second and the fifth features are the most relevant. In order to generate the event indicator, a Bernoulli distribution, with a probability of success equal to 0.9, is used. For each set a vector (of size nr) of independent and identically distributed random variables is obtained. Let δr be the vector of such realisations. The random survival data of each set r is represented by a triplet Dr = (Xr, τ r, δr). Even though the authors of the original SurvLIME paper simulated data this way, it is worth mentioning that this is not the standard procedure in Survival Analysis. The usual way to generate data consists of using two different distributions of times, τ 0 and τ 1: τ 0 is the censoring time and τ 1 is the time-to-event. Then, the vector of observed times τ = (τi) is obtained as τi = min(τ0i, τ1i). In order to generate the event indicator vector δ = (δi), it is taken into account both vectors τ 0 and τ 1: δi = 1{τ1i≤τ0i}. In this way, it is obtained that P(δi = 1) = P(τ1i ≤ τ0i). Nonetheless, we proceed in the same way as in the original paper so that the results can be compared. SurvLIMEpy allows to create a random survival dataset according to the criteria described previously. The class 'RandomSurvivalData' manages this part. 17 RandomSurvivalData( center, radius, coefficients, prob_event, lambda_weibull, v_weibull, time_cap, random_seed ) • center: The center of the set. It must be a Python list of length p. • radius: The radius of the set. It must be a float. • coefficients: The βr must be a Python list of length p. vector that is involved in Expression (11). It • prob_event: The probability for the Bernoulli distribution. It must be a float in (0, 1). • lambda_weibull: The λr parameter that is involved in Expression (11). It must be a float positive number. • v_weibull: The νr parameter that is involved in Expression (11). It must be a float positive number. • time_cap (optional): If the time obtained is greater than time_cap, then time_cap is used. It must be a float positive number. • random_seed (optional): Number to be used for the random seed. The user must provide a value if the results obtained must be reproducible every time the code is executed. The default is set to empty (no reproducibility needed). This class contains the method random_survival_data(num_points) that returns the dataset. The input parameter, num_points, is an integer indicating the number of individuals, nr, to generate. The output of this function is a tuple of three objects: (1) Xr the matrix containing the features (of size nr × p); (2) τ r the vector of times to event (of size nr); (3) δr the vector of event indicators (of size nr). and a test dataset, Dtest After obtaining both datasets, they are split randomly into two parts, a training dataset, Dtrain . The training dataset con- sists of 900 individuals, whereas the test dataset consists of 100 individuals. For each training dataset, a Cox Proportional Hazards Model is fitted. Let ˆHr(x, t), r ∈ {1, 2}, be the resulting models. The next step is to use SurvLIMEpy to obtain the importance of each feature. The test datasets, still unexploited, are used to rank the relevance of each feature. For a given test individual from set r, the set up for SurvLIMEpy is: r r • Training dataset, D = Dtrain r . • Number of neighbours, Nr = 1000. 18 • Black-box model for the Cumulative Hazard Function: ˆHr(x, t). • Kernel function, K(*, *) = Gaussian Radial Basis function. In green, the vector of real coefficients, βr Figure 3 shows the results obtained using SurvLIMEpy package to com- pute the coefficients. , is de- picted. In blue, the estimated parameters according to Cox Proportional Hazards Model, ˆβ . In orange, the coefficients obtained by SurvLIMEpy, ˆβ s , r ∈ {1, 2}. The individual to be explained is the center of the set. Note r that the results we have obtained are similar to the ones obtained in the original paper of SurvLIME. c r Figure 3: Real coefficients for parameters (green), estimated coefficients by CoxPH (blue) and SurvLIME coefficients (orange). Results for set 1 (left). Results for set 2 (right). The individual to be explained is the center of the set. s r Given that the real coefficients, βr and ˆβ , are known, the '2 distance between can be computed. In order to study the variance of SurvLIME βr algorithm, the previous experiment is repeated 100 times, i.e, a Monte-Carlo simulation is performed. Throughout all the simulations, the individual to be explained is the same, the center of the set. , ˆβ s min s max s mean and ˆβ Thus, a set of 100 distances are obtained, {d1, . . . , d100}. From this set, the mean, the minimum and the maximum distance can be calculated. Let ˆβ be the SurvLIME coefficients related to those distances. Doing such a Monte-Carlo simulation for all the individuals in , leads to obtain 3 different samples of the test datasets, Dtest SurvLIME coefficients: {ˆβ s min,100} and {ˆβ max,1, . . . , ˆβ Figure 4 shows the boxen plots for the three previous sets of coefficients. The left plots depict the boxen plot for the mean coefficient; the middle plots are for the minimum coefficient; the right ones correspond to the maximum coefficient. The results show that the coefficients of SurvLIME were close to the real coefficients for both sets of data. Furthermore, the mean values of and Dtest mean,1, . . . , ˆβ mean,100}, {ˆβ min,1, . . . , ˆβ s max,100}. 1 2 s s s s 19 the computed coefficients behave similarly to the best approximations and they show a low variance. In the worst case scenario, SurvLIME does not behave as well as in the other two scenarios. The variance of the SurvLIME coefficients is much higher, especially for the second set of data. However, the bias is as good as the bias of the other two scenarios. Figure 4: Boxen plot for the mean (left) minimum (middle) and maximum (right) distance. Results are shown for individuals of the first set (top) and the second set (bottom). 4.2 Real data Now, we test our implementation on three open-access datasets. Each dataset is presented together with a bivariate analysis. For categorical fea- tures, the percentage of individuals that experienced the event is computed for each category. Continuous features are categorised according to their quartiles, and the resulting categorical features are described as before. The first dataset is the UDCA dataset [Lindor et al., 1994]. It contains individuals with primary biliary cirrhosis (PBC) that were randomised for treatment with ursodeoxycholic acid (UDCA). A total of 9.46% of the indi- viduals experienced the event. The features of this dataset are: • trt (categorical): Treatment received. 0 is for placebo and 1 is for UDCA. • stage (categorical): Stage of disease. 0 is for better and 1 is for worse. • bili (continuous): Bilirubin value at entry. • riskscore (continuous): The Mayo PBC risk score at entry. 20 Note that the UDCA dataset contains an individual whose riskscore is miss- ing. We drop this individual from the dataset. The bivariate descriptive analysis is displayed in Table 1. trt feature Category percentage_cat stage feature Category percentage_cat 0 1 11.90 7.06 0 1 3.85 12.00 bili feature Category percentage_cat riskscore feature Category percentage_cat ≤ 0.6 (0.6, 1] (1, 1.9] > 1.9 2.17 2.56 14.30 19.00 ≤ 4.3 (4.3, 5] (5, 5.8] > 5.8 0.00 0.00 9.52 30.80 Table 1: Percentage of individuals that have experienced the event according to each category for all the features in the UDCA dataset. The second dataset is the LUNG dataset [Loprinzi et al., 1994]. It con- tains individuals with advanced lung cancer from the North Central Cancer Treatment Group. A total of 70.33% of the individuals experienced the event. The features of this dataset are: • inst (categorical): Institution code. The institutions are coded with numbers between 1 and 33. • sex (categorical): Gender. 1 is for male and 2 is for female. • ph.ecog (categorical): ECOG performance score as rated by the physi- cian. The categories are: – 0: Asymptomatic. – 1: Symptomatic but completely ambulatory. – 2: In bed <50% of the day. – 3: In bed > 50% of the day but not bedbound. • age (continuous): Age of the individual. • ph.karno (continuous): Karnofsky performance score rated by physi- cian. • pat.karno (continuous): Karnofsky performance score as rated by the individual. 21 • meal.cal (continuous): Calories consumed at meals. • wt.loss (continuous): Weight loss in last six months. We drop some information regarding LUNG dataset. First, we do not use the feature inst because it does not provide any further information allowing institutions identification. Second, we remove the meal.cal feature, since it contains a total of 20.6% of missing values. Third, 18 individuals have at least one feature with missing information. We drop those individuals from the dataset. Finally, with regards the feature ph.ecog, just a single individual is in the category 3. We do not consider this individual, therefore we drop it. After this preprocessing, we are left with 209 individuals. As for the UDCA dataset, a bivariate descriptive analysis is performed in LUNG dataset. Table 2 contains the results. Those features dropped from the dataset are not included in that table. sex feature Category percentage_cat ph.ecog feature Category percentage_cat 1 2 79.80 56.50 0 1 2 56.70 71.70 86.00 age feature Category percentage_cat ph.karno feature Category percentage_cat ≤ 56 (56, 63] (63, 69] > 69 64.80 65.40 70.60 80.80 ≤ 80 (80, 90] > 90 77.00 62.70 62.10 pat.karno feature wt.loss feature Category percentage_cat Category percentage_cat ≤ 70 (70, 80] (80, 90] > 90 80.00 75.00 62.70 56.20 ≤ 0 (0, 6] (6, 15] > 15 68.90 59.10 79.20 72.50 Table 2: Percentage of individuals that have experienced the event according to each category for all the features in the LUNG dataset. The last dataset is the Veteran dataset [Kalbfleisch and Prentice, 2002] which consists of individuals with advanced inoperable Lung cancer. The individuals were part of a randomised trial of two treatment regimens. The event of interest for the three datasets is the individual's death. A total of 22 93.43% of the individuals experienced the event. The features of this dataset are: • trt (categorical): Treatment received. 1 is for standard and 2 is for test. • prior (categorical): It indicates if the patient has received another therapy before the current one. 0 means no and 10 means yes. • celltype(categorical): Histological type of the tumor. The categories are: squamous, smallcell, adeno and large. • karno (continuous): Karnofsky performance score. • age (continuous): Age of the individual. • diagtime (continuous): Months from diagnosis to randomisation. Note that the Veteran dataset does not contain any missing value. The results of the bivariate descriptive analysis for the Veteran dataset are dis- played in Table 3. trt feature prior feature Category percentage_cat Category percentage_cat 1 2 92.80 94.10 0 10 93.80 92.50 celltype feature karno feature Category percentage_cat Category percentage_cat squamous smallcell adeno large 88.60 93.80 96.30 96.30 ≤ 40 (40, 60] (60, 75] > 75 97.40 95.10 92.00 87.90 age feature diagtime feature Category percentage_cat Category percentage_cat ≤ 51 (51, 62] (62, 66] > 66 94.30 87.20 100.00 93.30 ≤ 3 (3, 5] (5, 11] > 11 90.50 97.00 90.00 96.9 Table 3: Percentage of individuals that have experienced the event according to each category for all the features in the Veteran dataset. 23 Table 4 shows a brief summary of each dataset: p corresponds to the number of features, while p∗ is the number of features after pre-processing (dropping and doing one-hot-encoding), n denotes the number of individuals of the dataset, and nf ull is the number of individuals once the missing values are dropped. Dataset Trial of Usrodeoxycholic Acid NCCTG Lung Cancer Veterans' Administration Lung Cancer Study Acronym UDCA LUNG Veteran p 4 8 6 p∗ 4 7 8 n 170 228 137 nf ull 169 209 137 Table 4: Summary of the open access datasets used, where p is number of features for the corresponding dataset, p∗ is the number of features after pre-processing (dropping and doing one-hot-encoding), n denotes the total number of individuals in the dataset, and nf ull is the number of individuals after dropping missing values. We model the event of interest by means of machine learning algorithms. Given a dataset D, it is divided randomly into two sets: a training dataset, Dtrain, and a test dataset, Dtest, using 90% of individuals for training and 10% for testing. Once the data is split, we preprocess Dtrain. We apply one-hot-encoding to categorical features. If a categorical feature has k categories, then we create k − 1 binary features. The category without a binary feature is the reference category. After that, the original feature is deleted from the dataset since we use the k − 1 new features treated as continuous ones. Continuous features are also preprocessed. Given ̃xj, we first estimate the mean, ˆμj . Then, the standarisation train performed is ( ̃xj − ˆμj . This new feature is used instead of ̃xj. , and the standard deviation, ˆσj )/ˆσj The same preprocess is applied on Dtest. Note that the parameters that involve the preprocess (for both, categorical and continuous features) are taken from the preprocess performed on Dtrain, i.e., nothing is estimated in the test set. Let ̃Dtrain and ̃Dtest be the datasets obtained after preprocess- ing them. train train train Afterwards, a model is trained in ̃Dtrain and ̃Dtest is used to obtain the c-index value, a goodness-of-fit measure for survival models (see Appendix A for more details about c-index and Survival Analysis). In this section, we use five distinct machine learning algorithms: the Cox Proportional Hazards Model (CoxPH), Random Survival Forest (RSF) (both from sksurv package), eXtreme Gradient Boosted Survival Trees (XGB) (from xgbse package) as well as continuous and time-discrete deep learn- ing models, DeepSurv and DeepHit (both from pycox package). We have 24 performed an hyperparameter tuning strategy for each model and dataset. Having trained a model, SurvLIMEpy is applied to obtain feature im- portance. For a given individual i of ̃Dtest, SurvLIME algorithm is used 100 times, which produces a set of 100 coefficients: {ˆβ s i,100}. Then, the mean value across all the simulation is calculated, ̄β s . i,j That vector, ̄β , is used as the feature importance for the individual i. This process is applied to all the individuals in the test dataset. Therefore, a set of coefficients { ̄β s nt} is obtained, where nt is the total number of individuals in the test dataset. This set of coefficients is used in this study. Note that for UDCA nt is equal to 17, for LUNG it is equal to 21, and for Veteran it is equal to 14. = (1/100) P100 j=1 i,1, . . . , ˆβ 1, . . . , ̄β ˆβ s i s i s s Table 5 shows the value of the c-index for the different models. It can be seen that for all the datasets, the c-index related to deep learning models (i.e., DeepSurv and DeepHit) is 0.5 or close to this value, which is the value that one would obtain if a random model were taking decisions. An explanation for such a value is found in the number of individuals: the sample size of the datasets is small relative to the number of parameters of those models. Figures 5 to 7 depict the feature importance for each model and dataset. The number of points used to obtain each of the boxen plots depicted in these figures is equal to the number of individuals in ̃Dtest. For each figure, the set of SurvLIME coefficients used to produce those figures is { ̄β 1, . . . , ̄β As the value of the c-index is so low for DeepSurv and DeepHit, we do not show the feature importance for those models in this section. However, in Section 4.3 we use simulated data in order to train deep learning models with an acceptable c-index and show the feature importance for those models. s nt}. s Model UDCA LUNG Veteran Cox RSF XGB DeepSurv DeepHit 0.83 0.83 0.87 0.50 0.50 0.56 0.67 0.67 0.50 0.50 0.60 0.63 0.75 0.52 0.52 Table 5: c-index index for the models used to obtain the SurvLIME coeffi- cients of Section 4. For the UDCA dataset, Figure 5 contains the feature importance for the models. It can be seen that riskscore is the most important feature. The higher the value, the higher the CHF is for all the models, which is aligned with what is displayed in Table 1. For the Cox Proportional Hazards Model, the behaviour of the feature bili works in the opposite direction as it should be: according to Table 1, the higher the value of bili, the higher the risk of 25 Figure 5: Feature importance for the UDCA dataset. The input parameter with_colour is set to false. 26 Figure 6: Feature importance for the LUNG dataset. The input parameter with_colour is set to false. 27 Figure 7: Feature importance for the Veteran dataset. The input parameter with_colour is set to false. 28 experiencing the event. However, according to Figure 5, the higher the value of bili, the lower the risk of experiencing the event. A possible explanation for this anomaly could be that bili feature correlates with riskscore feature, Pearson correlation coefficient between both of them is equal to 0.69. The Cox Proportional Hazards Model is very sensitive to this phenomenon. Out of all the models, the Cox Proportional Hazards Model is the only one whose coefficients can be directly compared with the SurvLIME's coef- ficients. Table 6 contains both sets of coefficients: the left column is for the coefficients of the Cox Proportional Hazards Model and the right column is for the median values of SurvLIME coefficients when it explains the Cox Proportional Hazards Model. Note that the median values are for the set { ̄β s s nt}. Therefore, they are median values of mean values, since each vector ̄β is the mean vector across all the simulations. It can be seen that both sets of coefficients in Table 6 are close. 1, . . . , ̄β s j Feature Cox SurvLIME riskscore stage trt bili 2.4397 -0.0264 -0.6480 -1.7014 1.6110 -0.0392 -0.3937 -1.0954 Table 6: Coefficients of Cox Proportional Hazards Model (middle column) and median values of SurvLIME coefficients (right column) for UDCA dataset. With regards to LUNG dataset, the feature importance is depicted in Figure 6. For the Cox Proportional Hazards Model, the most important feature is ph.ecog. According to the model, the category that increases the most the CHF is 2 (ph.ecog_2), followed by category 1 (ph.ecog_1) and then by the category 0 (reference category). This is concordant with the values displayed in Table 2. On the other hand, for the other two models, the most important one is age: the older an individual is, the higher the value of the CHF. The results shown in the Table 2 are in the same direction: the older an individual is, the higher the probability of experiencing the event. Table 7 contains the coefficients for the Cox Proportional Hazards Model and the median values of SurvLIME coefficients when it explains the Cox Proportional Hazards Model. The median values are calculated in the same way as they were calculated for the UDCA dataset. Note that both sets of coefficients are close. Finally, Figure 7 shows the feature importance for each model. The three models consider that karno feature is the most important. According to the models, the higher the value of this feature, the lower the CHF is. This is aligned with what is shown in Table 3. Table 8 contains the coefficients for 29 Feature Cox SurvLIME ph.ecog_2 ph.ecog_1 age ph.karno pat.karno wt.loss sex 0.6678 0.4419 0.1551 0.3206 -0.1805 -0.1491 -0.2991 0.6117 0.4049 0.1422 0.2939 -0.1654 -0.1367 -0.2742 Table 7: Coefficients of Cox Proportional Hazards Model (middle col- umn) and median values of SurvLIME coefficients (right column) for LUNG dataset. Feature Cox SurvLIME trt prior diagtime age celltype_squamous celltype_smallcell celltype_large karno 0.0979 -0.0107 -0.0166 -0.0454 -0.5197 -0.0557 -0.3110 -0.7381 0.0569 -0.0138 -0.0088 -0.0253 -0.3690 -0.0461 -0.2278 -0.5251 Table 8: Coefficients of Cox Proportional Hazards Model (middle column) and SurvLIME coefficients (right column) for Veteran dataset. the Cox Proportional Hazards Model and the median values of SurvLIME coefficients when it explains this model. As for the UDCA as well as the LUNG datasets, both sets of coefficients are close. To conclude with this section, we have seen that our implementation captures the value of the coefficients when the machine learning model is the Cox Proportional Hazards Model. 4.3 Simulated data and deep learning models As shown in Table 5, DeepSurv and DeepHit did not perform better than a random model in any of the presented datasets. To show that our imple- mentation of SurvLIME algorithm is able to obtain feature importance for deep learning models, we make use of simulated data. Concretely, the data generating process is the same as the one used for set 1 in Section 4.1. In order to train the deep learning models, we follow the same procedure as in Section 4.2: 90% of the individuals are used to train the models and 10% are used to obtain the c-index as well as to obtain feature importance. 30 Figure 8: Feature importance for the simulated data and DeepSurv model. The input parameter with_colour is set to false. s 1, . . . , ̄β Table 9 shows that both models have an acceptable predictive capacity on the simulated data. Using the same Monte-Carlo strategy, 100 different simulations are computed over the 100 test individuals. The 100 mean val- ues, { ̄β s 100}, computed across all the simulations are shown in Figure 8. It can be seen that the only features which deviate significantly from 0 are the feature two and three. This is aligned with the true coefficients, as shown in Table 10. In order to produce this table, we use the median values of the SurvLIME coefficients, i.e., the median across the set { ̄β s 100}. We omit to provide the SurvLIME coefficients for DeepHit since the values we have obtained are very similar to the values of DeepSurv. 1, . . . , ̄β s Model c-index DeepSurv DeepHit 0.70 0.68 Table 9: c-index for the deep learning models for the simulated data and DeepSurv model. Feature Real coefficient SurvLIME coefficient two four five one three 0.1 10−6 10−6 10−6 -0.15 0.0711 0.0025 -0.0088 -0.0045 -0.1251 Table 10: Real coefficients used to generate the data (middle column) and median values of SurvLIME coefficients for DeepSurv model (right column). 31 5 Conclusions In this paper SurvLIMEpy has been introduced in the form of a Python library. To the extent of our knowledge, this is the first module that tackles the problem of model explainability for time-to-event data in the Python programming language. We have successfully demonstrated the validity of our implementation of the SurvLIME algorithm through a series of experiments with simulated and real datasets. Furthermore, we also grant flexibility to the algorithm by allowing users to adjust some of its internal parameters. Finally, a future research line would take into account how the feature importance evolves over time and incorporate it to SurvLIMEpy. Special care must be taken into account as the computational cost would increase significantly. Acknowledgments This research was supported by the Spanish Research Agency (AEI) un- der projects PID2020-116294GB-I00 and PID2020-116907RB-I00 of the call MCIN/ AEI /10.13039/501100011033, the project 718/C/2019 funded by Fundació la Marato de TV3 and the grant 2020 FI SDUR 306 funded by AGAUR. References David R Cox. Regression models and life-tables. Journal of the Royal Statistical Society: Series B (Methodological), 34(2):187–202, 1972. Hemant Ishwaran, Udaya B. Kogalur, Eugene H. Blackstone, and Michael S. Lauer. Random survival forests. The Annals of Applied Statistics, 2(3): 841 – 860, 2008. doi: 10.1214/08-AOAS169. URL https://doi.org/10. 1214/08-AOAS169. Avinash Barnwal, Hyunsu Cho, and Toby Hocking. Survival regression with accelerated failure time model in xgboost. Journal of Computational and Graphical Statistics, 0(0):1–11, 2022. doi: 10.1080/10618600.2022. 2067548. URL https://doi.org/10.1080/10618600.2022.2067548. Changhee Lee, William Zame, Jinsung Yoon, and Mihaela van der Schaar. Deephit: A deep learning approach to survival analysis with competing risks. Proceedings of the AAAI Conference on Artificial Intelligence, 32 (1):–, Apr. 2018. doi: 10.1609/aaai.v32i1.11842. URL https://ojs. aaai.org/index.php/AAAI/article/view/11842. 32 Jared Katzman, Uri Shaham, Alexander Cloninger, Jonathan Bates, Tingt- ing Jiang, and Yuval Kluger. Deepsurv: Personalized treatment rec- ommender system using a cox proportional hazards deep neural net- work. BMC Medical Research Methodology, 18:–, 02 2018. doi: 10.1186/ s12874-018-0482-1. Ping Wang, Yan Li, and Chandan K Reddy. Machine learning for survival analysis: A survey. ACM Computing Surveys (CSUR), 51(6):1–36, 2019. Annette Spooner, Emily Chen, Arcot Sowmya, Perminder Sachdev, Nicole A Kochan, Julian Trollor, and Henry Brodaty. A comparison of machine learning methods for survival analysis of high-dimensional clinical data for dementia prediction. Scientific reports, 10(1):1–10, 2020. Lin Hao, Juncheol Kim, Sookhee Kwon, and Il Do Ha. Deep learning-based survival analysis for high-dimensional survival data. Mathematics, 9(11): 1244, 2021. Alejandro Barredo Arrieta, Natalia Díaz-Rodríguez, Javier Del Ser, Adrien Bennetot, Siham Tabik, Alberto Barbado, Salvador Garcia, Sergio Gil- Lopez, Daniel Molina, Richard Benjamins, Raja Chatila, and Francisco Herrera. Explainable artificial intelligence (xai): Concepts, taxonomies, opportunities and challenges toward responsible ai. Information Fu- ISSN 1566-2535. doi: https://doi.org/10.1016/ sion, 58:82–115, 2020. j.inffus.2019.12.012. URL https://www.sciencedirect.com/science/ article/pii/S1566253519308103. Marco Tulio Ribeiro, Sameer Singh, and Carlos Guestrin. Why should i trust you? explaining the predictions of any classifier. In Proceedings of the 22nd ACM SIGKDD international conference on knowledge discovery and data mining, pages 1135–1144. ACM, 2016. Scott M Lundberg and Su-In Lee. A unified approach to interpreting model predictions. Advances in neural information processing systems, 30, 2017. Nesaretnam Barr Kumarakulasinghe, Tobias Blomberg, Jintai Liu, Alexan- dra Saraiva Leao, and Panagiotis Papapetrou. Evaluating local inter- pretable model-agnostic explanations on clinical machine learning clas- In 2020 IEEE 33rd International Symposium on sification models. doi: Computer-Based Medical Systems (CBMS), pages 7–12, 2020. 10.1109/CBMS49503.2020.00009. Maxim S. Kovalev, Lev V. Utkin, and Ernest M. Kasimov. Survlime: A method for explaining machine learning survival models. Knowledge- Based Systems, 203:106164, 2020. ISSN 0950-7051. doi: https://doi. org/10.1016/j.knosys.2020.106164. URL https://www.sciencedirect. com/science/article/pii/S0950705120304044. 33 Mateusz Krzyziński, Mikołaj Spytek, Hubert Baniecki, and Przemysław Biecek. Survshap(t): Time-dependent explanations of machine learning survival models. Knowledge-Based Systems, 262:110234, 2023. ISSN 0950- 7051. doi: https://doi.org/10.1016/j.knosys.2022.110234. URL https:// www.sciencedirect.com/science/article/pii/S0950705122013302. Mikołaj Spytek, Mateusz Krzyziński, Hubert Baniecki, and Przemysław Biecek. survex: Explainable Machine Learning in Survival Analysis. R package version 0.2.2, 2022. URL https://github.com/ModelOriented/ survex. Steven Diamond and Stephen Boyd. CVXPY: A Python-embedded mod- eling language for convex optimization. Journal of Machine Learning Research, 17(83):1–5, 2016. B. Stellato, G. Banjac, P. Goulart, A. Bemporad, and S. Boyd. OSQP: an op- erator splitting solver for quadratic programs. Mathematical Programming Computation, 12(4):637–672, 2020. doi: 10.1007/s12532-020-00179-2. URL https://doi.org/10.1007/s12532-020-00179-2. Christoph Molnar. Learning. https://christophm.github.io/interpretable-ml-book/, 2 edition, 2022. URL https://christophm.github.io/interpretable-ml-book. Interpretable Machine B. W. Silverman. Density estimation for statistics and data analysis. Chap- man and Hall London ; New York, 1986. ISBN 0412246201. Lev V Utkin, Maxim S Kovalev, and Ernest M Kasimov. Survlime-inf: A simplified modification of survlime for explanation of machine learning survival models. arXiv preprint arXiv:2005.02387, 2020. Sebastian Pölsterl. scikit-survival: A library for time-to-event analysis built on top of scikit-learn. Journal of Machine Learning Research, 21(212): 1–6, 2020. URL http://jmlr.org/papers/v21/20-729.html. Davi Vieira, Gabriel Gimenez, Guilherme Marmerola, and Vitor Estima. improving statistical properties of xg- Xgboost survival embeddings: boost survival analysis implementation, 2020. URL http://github.com/ loft-br/xgboost-survival-embeddings. Håvard Kvamme, Ørnulf Borgan, and Ida Scheel. Time-to-event pre- arXiv preprint diction with neural networks and cox regression. arXiv:1907.00825, 2019. Odd Aalen. Nonparametric inference for a family of counting processes. The Annals of Statistics, pages 701–726, 1978. 34 Ralf Bender, Thomas Augustin, and Maria Blettner. Generating survival times to simulate cox proportional hazards models. Statistics in medicine, 24(11):1713–1723, 2005. K D Lindor, E R Dickson, W P Baldus, R A Jorgensen, J Ludwig, P A Murtaugh, J M Harrison, R H Wiesner, M L Anderson, and S M Lange. Ursodeoxycholic acid in the treatment of primary biliary cirrhosis. Gas- troenterology, 106(5):1284–1290, May 1994. Charles Lawrence Loprinzi, John A Laurie, H Sam Wieand, James E Krook, Paul J Novotny, John W Kugler, Joan Bartel, Marlys Law, Marilyn Bate- man, and Nancy E Klatt. Prospective evaluation of prognostic variables from patient-completed questionnaires. north central cancer treatment group. Journal of Clinical Oncology, 12(3):601–607, 1994. J. D. Kalbfleisch and Ross L. Prentice. The statistical analysis of failure time data. Wiley series in probability and statistics. J. Wiley, Hoboken, N.J, 2nd ed edition, 2002. ISBN 978-0-471-36357-6. David W Hosmer and Stanley Lemeshow. Applied survival analysis: time- to-event, volume 317. Wiley-Interscience, 1999. Shankar Prinja, Nidhi Gupta, and Ramesh Verma. Censoring in clinical trials: review of survival analysis techniques. Indian journal of community medicine: official publication of Indian Association of Preventive & Social Medicine, 35(2):217, 2010. Frank E. Harrell. Regression Modeling Strategies. Springer-Verlag, Berlin, Heidelberg, 2006. ISBN 0387952322. Frank E. Harrell, Robert M. Califf, David B. Pryor, Kerry L. Lee, and JAMA, 10.1001/jama. URL https://doi.org/10.1001/jama.1982. Robert A. Rosati. Evaluating the Yield of Medical Tests. 247(18):2543–2546, 05 1982. 1982.03320430047030. 03320430047030. ISSN 0098-7484. doi: Frank E. Harrell, Kerry L Lee, and Daniel B Mark. Multivariable prog- nostic models: issues in developing models, evaluating assumptions and adequacy, and measuring and reducing errors. Statistics in medicine, 15 (4):361–387, 1996. 35 A Survival Analysis Survival Analysis, also known as time-to-event analysis, is a branch of Statis- tics that studies the time until a particular event of interest occurs [Hosmer and Lemeshow, 1999, Kalbfleisch and Prentice, 2002]. It was initially de- veloped in biomedical sciences and reliability engineering but, nowadays, it is used in a plethora of fields. A key point of a Survival Analysis ap- proach is that each individual is represented by a triplet (x, δ, τ ), where x = (x1, x2, . . . , xp)T is the vector of features, τ indicates time to event or lost to follow-up time of the individual (it is assumed to be non-negative and continuous) and δ is the event indicator denoting whether the event of interest has been observed or not. Given a dataset D consisting of n triplets (xi, τi, δi), i ∈ {1, . . . , n}, where n is the number of individuals, Survival Analysis aims to build a model ˆH : Rp × R+ → R+, that allows to estimate the risk a certain individual x∗ experiences the event at a certain time t. This risk estimator is given by ˆH(x, t). A.1 Censoring Censoring is a crucial phenomenon of Survival Analysis. It occurs when some information about individual survival time is available, but we do not know the exact survival time. It results in the event of interest not being observed for some individuals. This might happen when the event is not observed during the time window of the study, or the individual dropped out of the study by other uninterested causes. If this takes place, the individual i is considered censored and δi = 0. The three main types of censorship are: • Right-censoring is said to occur when, despite continuous monitoring of the outcome event, the individual is lost to follow-up, or the event does not occur within the study duration [Prinja et al., 2010]. • Left-censoring happens if an individual had been on risk for the event of interest for a period before entering the study. • Interval-censoring applies to individuals when the time until the event of interest is not known precisely (and instead, only is known to fall into a particular interval). From the three of them, right-censoring, followed by interval-censoring, are the two most common types of censoring. Left-censoring is sometimes ignored since the starting point is defined by an event such as the entry of a individual into the study. If the event of interest is observed for individual i, δi = 1 and τi corre- spond to the time from the beginning of the study to the event's occurrence respectively. This is also called an uncensored observation. 36 On the other hand, if the instance event is not observed or its time to event is greater than the observation window, τi corresponds to the time between the beginning of the study and the end of observation. In this case, the event indicator is δi = 0, and the individual is considered to be censored. A.2 Survival Function The Survival Function is one of the main concepts in Survival Analysis, it represents the probability that the time to event is not earlier than time t which is the same as the probability that a individual survives past time t without the event happening. It is expressed as: S(t) = P(T ≥ t). (12) It is a monotonically decreasing function whose initial value is 1 when t = 0, reflecting the fact that at the beginning of the study any observed individual is alive, their event is yet to occur. Its counterpart is the cumulative death distribution function F (t) which states the probability that the event does occur earlier than time t, and it is defined as: F (t) = P(T < t) = 1 − S(t). (13) The death density function, f (t), can also be computed as f (t) = d − d dt F (t) = dt S(t). A.3 Hazard Function and Cumulative Hazard Function The second most common function in Survival Analysis is the Hazard Func- tion or instantaneous death rate [Harrell, 2006, Hosmer and Lemeshow, 1999], denoted as h(t), which indicates the rate of event at time t given that it has not yet occurred before time t. It is also referred as risk score. It is also a non-negative function that can be expressed as: h(t) = lim ∆t→0 = lim ∆t→0 P(t ≤ T ≤ t + ∆t|T ≥ t) ∆t F (t + ∆t) − F (t) ∆t * S(t) = f (t) S(t) = − d dt S(t) S(t) . (14) Similar to S(t), h(t) is a non-negative function but it is not constrained dt S(t), the Hazard Function by monotonicity. Considering that f (t) = − d can also be written as: h(t) = f (t) S(t) = − d dt [S(t)] 1 S(t) = − d dt [ln S(t)]. (15) Integrating in both sides of Expression (15) from 0 to t the Cumulative 0 h(r) dr. It is Hazard Function (CHF) is obtained and denoted as H(t) = R t related to the Survival Function by the following equation: S(t) = exp(−H(t)). (16) 37 A.4 Cox Proportional Hazards Model One of the historically most widely used semi-parametric algorithms for Survival Analysis is the Cox Proportional Hazards Model, published in Cox [1972]. The model assumes a baseline Hazard Function h0(t) which only depends on the time, and a second hazard term h(x) = exp(ˆβ x) which only depends on the features of the individual. Thus, the Hazard Function h(x, t) in the Cox Proportional Hazards Model is given by: T h(x, t) = h0(t) exp(ˆβ where ˆβ = ( ˆβ1, ˆβ2, . . . , ˆβp)T is the coefficient for the feature vector x. x), T (17) The Cox Proportional Hazards Model is a semi-parametric algorithm since the baseline Hazard Function h0(t) is unspecified. For two given indi- viduals, their hazard's ratio is given by: h(x1, t) h(x2, t) = h0(t) exp(ˆβ h0(t) exp(ˆβ T T x1) x2) = exp[ ˆβ T(x1 − x2)]. (18) If it is then This implies that the hazard ratio is independent of h0(t). combined with Expression (16), the Survival Function can be computed as: S(x, t) = exp h −H0(t) exp(ˆβ T x)i = [S0(t)]exp(ˆβ T x) . (19) To estimate the coefficients ˆβ, Cox proposed a likelihood [Cox, 1972] which depends only on the parameter of interest ˆβ. To compute this like- lihood it is necessary to estimate the product of the probability of each individual that the event occurs at τi given their feature vector xi, for i ∈ {1, . . . , n}: n Y (cid:20) L(β) = P exp(βTxi) exp(βTxj) (cid:21)δi , (20) j∈Ri where Ri is the set of individuals being at risk at time τi. Note that ˆβ is the vector that maximises Expression (20), i.e, ˆβ = argmax i=1 βL(β). A.5 c-index The c-index, also known as concordance index [Harrell et al., 1982], is a goodness-of-fit measure for time-dependant models. Given two random in- dividuals, it accounts for the probability that the individual with the lower risk score will outlive the individual with the higher risk score. In practical terms, given individuals i and j (i 6= j) as well as their risk scores, Hi(t) and Hj(t), and their times, τi and τj, this probability is calculated taking into account the following scenarios: 38 • If both are not censored, the pair (i, j) is concordant if τi < τj and If τi > τj and Hi(τj) > Hj(τi), the pair (i, j) is Hi(τi) > Hj(τi). discordant. • If both are censored, the pair (i, j) is not taken into account. • For the remaining scenario, let suppose i is not censored and j is censored, i.e, δi = 1 and δj = 0. To make a decision, two scenarios are considered: – If τj < τi, then the pair (i, j) is not taken into account because j could have experience the event if the experiment had lasted longer. – If τi < τj, i is the first individual whose event happens first (even if the experiment lasts longer). In this scenario, (i, j) is concordant if Hi(τi) > Hj(τi). Otherwise, this pair is discordant. Once all the scenarios are taken into account and considering all pair (i, j) such that i 6= j, the c-index can be expressed as concordant pairs concordant pairs + discordant pairs . (21) The more concordant pairs, the better the model is estimating the risk. Therefore, the higher the c-index, the more accurate the model is. The maximum value for the c-index is 1. A value equal to 0.5 (or lower) means that the models performs as a random model. More details are provided in Harrell et al. [1982] or in Harrell et al. [1996]. 39
http://arxiv.org/abs/2302.10539v1
2023-02-21T09:13:48
2023-02-21T09:13:48
Online Symbolic Regression with Informative Query
Symbolic regression, the task of extracting mathematical expressions from the observed data $\{ \vx_i, y_i \}$, plays a crucial role in scientific discovery. Despite the promising performance of existing methods, most of them conduct symbolic regression in an \textit{offline} setting. That is, they treat the observed data points as given ones that are simply sampled from uniform distributions without exploring the expressive potential of data. However, for real-world scientific problems, the data used for symbolic regression are usually actively obtained by doing experiments, which is an \textit{online} setting. Thus, how to obtain informative data that can facilitate the symbolic regression process is an important problem that remains challenging. In this paper, we propose QUOSR, a \textbf{qu}ery-based framework for \textbf{o}nline \textbf{s}ymbolic \textbf{r}egression that can automatically obtain informative data in an iterative manner. Specifically, at each step, QUOSR receives historical data points, generates new $\vx$, and then queries the symbolic expression to get the corresponding $y$, where the $(\vx, y)$ serves as new data points. This process repeats until the maximum number of query steps is reached. To make the generated data points informative, we implement the framework with a neural network and train it by maximizing the mutual information between generated data points and the target expression. Through comprehensive experiments, we show that QUOSR can facilitate modern symbolic regression methods by generating informative data.
[ "Pengwei Jin", "Di Huang", "Rui Zhang", "Xing Hu", "Ziyuan Nan", "Zidong Du", "Qi Guo", "Yunji Chen" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10539v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10539v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
Online Symbolic Regression with Informative Query Pengwei Jin 1,2,3, Di Huang 1,2,3, Rui Zhang 1, 3, Xing Hu 1, Ziyuan Nan 1,2,3, Zidong Du 1, Qi Guo 1, Yunji Chen 1,2* 1 State Key Lab of Processors, Institute of Computing Technology, CAS 2 University of Chinese Academy of Sciences 3 Cambricon Technologies {jinpengwei20z, huangdi20b, zhangrui, huxing, nanziyuan21s, duzidong, guoqi, cyj}@ict.ac.cn 3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 9 3 5 0 1 . 2 0 3 2 : v i X r a Abstract Symbolic regression, the task of extracting mathematical ex- pressions from the observed data {xi, yi}, plays a crucial role in scientific discovery. Despite the promising performance of existing methods, most of them conduct symbolic regression in an offline setting. That is, they treat the observed data points as given ones that are simply sampled from uniform distri- butions without exploring the expressive potential of data. However, for real-world scientific problems, the data used for symbolic regression are usually actively obtained by doing experiments, which is an online setting. Thus, how to obtain informative data that can facilitate the symbolic regression process is an important problem that remains challenging. In this paper, we propose QUOSR, a query-based framework for online symbolic regression that can automatically obtain informative data in an iterative manner. Specifically, at each step, QUOSR receives historical data points, generates new x, and then queries the symbolic expression to get the corre- sponding y, where the (x, y) serves as new data points. This process repeats until the maximum number of query steps is reached. To make the generated data points informative, we implement the framework with a neural network and train it by maximizing the mutual information between generated data points and the target expression. Through comprehen- sive experiments, we show that QUOSR can facilitate modern symbolic regression methods by generating informative data. Introduction Symbolic regression plays a central role in scientific dis- covery, which extracts the underlying mathematical relation- ship between variables from observed data. Formally, given a physical system f and N data points D = {(xi, yi)}N i=1, where xi ∈ Rm and yi = f (xi) ∈ R, symbolic regression tries to find a mathematical expression ˆf : Rm → R that best fits the physical system f . Conventional symbolic regression methods include ge- netic evolution algorithms (Augusto and Barbosa 2000; Schmidt and Lipson 2009; Chen, Luo, and Jiang 2017), and neural network methods (Udrescu and Tegmark 2020; Petersen et al. 2020; Valipour et al. 2021). Despite their promising performance, most of them perform symbolic re- gression in an offline setting. That is, they take the data *Yunji Chen ([email protected]) is the corresponding author. Copyright © 2023, Association for the Advancement of Artificial Intelligence (www.aaai.org). All rights reserved. points D = {(xi, yi)}N i=1 as given ones and simply sam- ple them from uniform distributions without exploring the expressive potential of data. In real-world scientific discov- ery, however, data can be collected actively by doing spe- cific experiments (Hernandez et al. 2019; Weng et al. 2020), which is an online setting. Overall, online symbolic regres- sion is a worth-studying and challenging problem that un- derexplored. The unique problem introduced by online symbolic re- gression is how to actively collect informative data that best distinguish the target expression from other similar expres- sions. Specifically, this process aims to actively collect data by generating informative input data x (i.e. queries) and then querying f to get the output data y = f (x). Considering the regression process to use data D = {(xi, yi)}N i=1 for find- ing the mathematical expression ˆf that best fits the physical system can be borrowed directly from offline symbolic re- gression, we mainly focus on the key problem of how to get the informative data for symbolic regression. In this paper, we propose QUOSR, a query-based frame- work that can acquire informative data for online symbolic regression. QUOSR works in an iterative manner: at each query step, it receives historical data points, generates new x, and then queries the target f to get the corresponding y, where the (x, y) serves as new data points. This process re- peats until the maximum number of query steps is reached. Our contribution is twofold: giving theoretical guidance on the learning of the query process and implementing QUOSR for online symbolic regression. Specifically, we theoretically show the relationship be- tween informative data and mutual information, which can guide the generation of queries. This relationship can be proved by modeling the query process as the expansion of a decision tree, where the nodes correspond to the query se- lections x, the edges correspond to the responses y, and the leaves correspond to the physical systems f Although the computation of mutual information is intractable, we can in- stead optimize QUOSR by minimizing the InfoNCE loss in contrastive learning (van den Oord, Li, and Vinyals 2018) which is the lower bound of mutual information. However, it is still difficult to practically implement QU- OSR for online symbolic regression for two reasons. (1) The amount of information contained in each data point is so small that, to obtain enough information, the number of query steps becomes extremely large, which makes the query process not only time-consuming but also hard to op- timize. (2) The InfoNCE loss needs to calculate the similar- ity between queries and the target system f in a latent space, but f is hard to represent. Conventionally, f would be rep- resented by expression strings, which is sub-optimal. First, the same function f can be expressed by different symbolic forms. For example, f (x) = cos(x) can also be written as f (x) = cos(x + 2kπ) or f (x) = sin(x + 4k+1 2 π), where k ∈ N, with exactly the same functionality. Second, a small change to the expression can make a huge difference in func- tionality. To tackle these challenges, we propose the query-by- distribution strategy and the modified InfoNCE loss. First, to increase the amount of information obtained in each query step, the query-by-distribution strategy aims to find infor- mative function features, which can be represented by a set of data instead of a single data point. Second, to eliminate the influence of the expression representation problem, we remove the requirement of the calculation of similarity be- tween data and expressions in the InfoNCE loss. Instead, we show that mutual information between data and expressions can be estimated by simply measuring the similarity among different sets of queries. Through comprehensive experiments, QUOSR shows its advantage in exploring informative data for online symbolic regression. We combine QUOSR with a transformer-based method called SymbolicGPT (Valipour et al. 2021) and find an over 11% improvement in average R2. Related Work Symbolic regression. Symbolic regression in an offline setting has been studied for years (Koza 1994; Martius and Lampert 2016; Sahoo, Lampert, and Martius 2018; Lam- ple and Charton 2019; La Cava et al. 2021; Xing, Salleb- Aouissi, and Verma 2021; Zheng et al. 2022). Traditionally, methods based on genetic evolution algorithms have been utilized to tackle offline symbolic regression (Augusto and Barbosa 2000; Schmidt and Lipson 2009; Arnaldo, Kraw- iec, and O'Reilly 2014; La Cava et al. 2018; Virgolin et al. 2021; Mundhenk et al. 2021). Many recent methods leverage neural networks with the development of deep learning. AI Feynman (Udrescu and Tegmark 2020) recursively decom- poses an expression with physics-inspired techniques and trains a neural network to fit complex parts. Petersen et al. (2020) proposes a reinforcement learning based method, where expressions are generated by an LSTM. Recently, some transformer-based methods are proposed (Biggio et al. 2021; Kamienny et al. 2022). SymbolicGPT (Valipour et al. 2021) generates a large amount of expressions and pretrains a transformer-based model to predict expressions. Similar to QUOSR, Ansari et al. (2022) and Haut, Banzhaf, and Punch (2022) also get data points from a physical system. However, there are still two main differences. For purpose, they focus on training efficiency which is an active learning style, while we focus both on the training and inference. For method, theirs are strongly correlated with the SR process, while QUOSR is a general framework since its query pro- cess is decomposed from SR. Active learning. Active learning is a subfield of machine learning in which learners ask the oracle to label some rep- resentative examples (Settles 2009). Three main scenarios in which learners can ask queries are considered in active learn- ing: (1) pool-based sampling (Lewis and Gale 1994) which evaluates all examples in the dataset and samples some of them, (2) stream-based selective sampling (Cohn, Atlas, and Ladner 1994; Angluin 2001) in which each example in the dataset is independently assessed for the amount of infor- mation, and (3) membership query synthesis (Angluin 1988; King et al. 2004) in which examples for query can be gen- erated by learners. Notice that active learning assumes only one oracle to give labels thus learners just need to model one, but each expression is an oracle in QUOSR which makes se- lecting examples much more difficult. Also, in active learn- ing, examples are only sampled in the training process to make use of abundant unlabeled data but QUOSR aims to find informative examples both in the training and inference process to assist the following expression generation stage. Learning to acquire information. Pu, Kaelbling, and Solar-Lezama (2017) and Pu et al. (2018) study the query problem in a finite space aiming to select representative ones from a set of examples. Huang et al. (2021) propose an iter- ative query-based framework in program synthesis and gen- eralize the query problem to a nearly infinite space. They take the symbolic representation of programs as reference substances during optimization and adopt a query-by-point strategy, where the framework iterates for several steps and only one data point is generated at each step, which fails on symbolic regression. Problem statement In this section, we make a formal statement for online sym- bolic regression to make our problem clear. Definition 1 (The physical system f ) The physical system f is a function f : RM → R. Given an input data x ∈ RM , f can respond with y = f (x). Intuitively, f can be seen as scientific rules, and the input data x and the response y can be seen as experimental re- sults. Definition 2 (Online symbolic regression) Given a physi- cal system f ∈ F, where F denotes the set of all possible systems, the online symbolic regression aims to find a math- ematical expression ˆf that best fits f by interacting with f , i.e. ∀x ∈ RM , | ˆf (x) − f (x)| < τ , where τ is the error tolerance. Unlike conventional symbolic regression tasks, online sym- bolic regression allows interactions with the physical system f , which is a more common setting in scientific discovery. Methods In this section, first, we make a detailed description of the query-based framework, including the working process of the framework, what is "informative", and how to obtain Algorithm 1: The query-based framework Query 1: physical system f , max query steps K, query module Q, initial data points D. 2: for k ∈ {1 . . . K} do x ← Q(D) 3: y ← f (x) 4: 5: D ← D ∪ {(x, y)} 6: end for 7: return D Regression 1: data points D, regression algorithm R 2: ˆf ← R(D) 3: return ˆf informative data theoretically. Then, we point out the dif- ficulties of applying the query-based framework and give out corresponding solutions. At the end of this section, we present the architecture details and the training algorithm of the query-based framework. The Query-based Framework We propose the query-based framework which aims to gen- erate informative data by querying the target physical sys- tem. The query-based framework works in an iterative man- ner that it queries the target system for several steps with a data point generated at each step. This process is shown in Algorithm 1. Specifically, at each step, the query-based framework receives the historical data points D and gener- ates the next query x with a trained query module Q accord- ing to D. Then, x is used to query the target system f and get the corresponding output y = f (x). Finally, the newly queried data point (x, y) is added to D, and the next query step begins. This process repeats until the maximum number of query steps is reached. After collecting the data points D, the regression process begins to fit the symbolic expression ˆf , which can be done by conventional symbolic regression algorithms. Obviously, the design of the query module Q is the central problem of the query process. To make the design principle clear, two questions need to be answered. That is, what is informative data, and how can we get it? What is informative data? Intuitively, if data DB can lead us to the target f but DA cannot, then we would say DB is more informative than DA. Further on, if data DC can also lead us to the target f and it contains fewer data points than DB, then we would say DC is even more informative than DB. Based on this observation, we can conclude that informative means to find the target f with as few data points as possible. Formally, we give the following definitions. Definition 3 (Distinguish) Given the target physical system f ∈ F, and a set of input data Q = {x|x ∈ Rm}, we say that f is distinguished from F by Q if and only if ∀fi ∈ F, ∃x ∈ Q, f (x) (cid:54)= fi(x). Definition 4 (Informative queries) Given the target physi- cal system f ∈ F, and two sets of queries Qi and Qj, we say Qi is more informative than Qj if and only if Qi can distin- guish f from F but Qj cannot, or they can both distinguish f from F but |Qi| < |Qj|. How can we obtain informative data? From the perspec- tive of the decision process, we can model the query process as the expansion of a decision tree. Specifically, the nodes correspond to the query selections x, the edges correspond to the responses y, and the leaves correspond to the physi- cal systems f . Then, the problem of obtaining informative data can be reinterpreted as the minimization of the average length of decision paths. Definition 5 (Average decision path) Given a decision tree with a leaf denoted as f ∈ F, the decision path can be denoted as L(f ), and the probability of arriving at f can be denoted as P (f ). Then, the average decision path can be defined as ̄L = (cid:80) f P (f )L(f ). Obviously, the average decision path here is equivalent to the average number of query steps. Traditionally, the prob- lem of finding the average decision path can be solved by maximizing the information gain in decision node expan- sion, which is the same as maximizing mutual informa- tion (Gallager 1968). Thus, with the help of decision trees, we conclude that informative data is the data that can max- imize the mutual information with the target functions. For- mally, we give such claim: Claim 1 (Mutual information guides the query) The col- lection of informative data can be guided by mutual infor- mation: D∗ = arg max I(F ; D). D (1) Here F denotes the variable that represents functions. The detailed proof is shown in Appendix A. The Modified InfoNCE InfoNCE Although Equation 1 has shown the optimiza- tion direction of the query process, I(F ; D) is impossible to compute due to the large space of data and expressions. Fortunately, recent works in contrastive learning show that the InfoNCE loss estimates the lower bound of mutual in- formation (van den Oord, Li, and Vinyals 2018; Poole et al. 2019). LN CE = −E[log( exp(sim(di, fi)) j=1 exp(sim(di, fj)) (cid:80)N )], (2) and I(F ; D) ≥ log(B) − LN CE (3) where d denotes the data points, f denotes the physical sys- tem, B denotes the batch size, i, j denotes the sample index, and sim denotes a similarity function. Thus, we can imple- ment the query process as a query network, and then opti- mize it with InfoNCE to obtain informative queries. Specif- ically, in contrastive learning, we can construct several posi- tive and negative pairs, and the InfoNCE loss guides the net- work to maximize the similarity of positive pairs and mini- mize the similarity of negative pairs. For the query network, we can construct positive pairs as queried data points and corresponding physical system (di, fi) and negative pairs as others (di, fj(cid:54)=i). Figure 1: Overview of QUOSR. The Modified InfoNCE According to Equation 2, we can simply design the query network with a data encoder to ex- tract the embedding of di and an expression encoder to ex- tract the embedding of fi, and then compute their similarity to get the InfoNCE loss. However, the expression encoder is hard to optimize due to several reasons. First, the same func- tion f can be expressed by different symbolic forms, which improves the difficulty of learning. For example, f (x) = cos(x) can also be written as f (x) = cos(x + 2kπ) or 2 π), where k ∈ N, with exactly the f (x) = sin(x + 4k+1 same functionality. Second, a small change to the expression can make a huge difference in functionality, like the negative sign −. To solve this problem, we propose a modified InfoNCE loss that guides the learning process without the requirement for a good expression encoder: N CE = − E(di,d(cid:48) L(cid:48) i)∼E[Pd|f Pd(cid:48) |f ] exp(sim(di, d(cid:48) j=1 exp(sim(di, d(cid:48) i)) (cid:80)N j)) [log( 1 N (4) )], where d(cid:48) denotes another set of queried data points with dif- ferent initial conditions from d. Specifically, we first sam- ple physical system f from space F, sample two different groups of data points di and d(cid:48) i from a Uniform distribu- tion as the initial condition and then get two different data points by querying f and modifying di and d(cid:48) i (adding the corresponding data point to di and another to d(cid:48) i), and this process repeats for N times to get N different (di, d(cid:48) i) pairs to calculate the loss. Intuitively, the main difference between Equation 4 and Equation 2 is that the former replaces the expression f with another set of queried points d(cid:48), which avoids the expres- sion representation problems mentioned above. In practice, we share parameters between the data encoders for d and d(cid:48), which is the classical siamese architecture used in con- trastive learning (Chen et al. 2020). We prove that optimizing L(cid:48) N CE can also achieve the pur- pose of maximizing mutual information I(F ; D): Claim 2 (L(cid:48) −L(cid:48) N CE bounds mutual information) N CE ≤ KL(E[PD|F PD(cid:48)|F ]||PDPD(cid:48)) ≤ min{I(F ; D), I(F ; D(cid:48))}, (5) where KL denotes the Kullback–Leibler divergence. A sim- ilar proof is given by (Tsai et al. 2021), and we modify it to fit this paper in Appendix A. We use LN CE to denote L(cid:48) for simplicity in the rest of our paper. N CE Physical systemxii=1mQueryxi′i=1m(xi,yi)i=1m(xi′,yi′)i=1m(xi,yi)i=1m(xi,yi)i=m+12m(xi′,yi′)i=1m(xi′,yi′)i=m+12m......InfoNCELossInfoNCELossMLPqueryvii=1mMLPinversionsamplexii=1mPhysical systemUniform sampling(μ,log(σ2))(μ′,log(σ′2))(μ,log(σ2))(μ′,log(σ′2))(μ,log(σ2))(μd,log(σd2))QueryQueryQueryPhysical systemPhysical systemxii=m+12mxi′i=m+12mDecoderQUOSR(x1,y1)(x2,y2)(xm,ym)...Attention...(μ,log(σ2))MLPdataQueryEncoderEncoderDecoder(xi,yi)i=1m(xi,yi)i=1m(xi,yi)i=m+12m(μ,log(σ2)) Query-by-distribution Another problem is that the amount of information con- tained in each data point is extremely small, which increases the number of query steps and makes the query network hard to optimize. To alleviate this problem, we compress the num- ber of query steps by querying a set of m data points at each query step instead of only one single data point. However, simply increasing the output dimension of the query network to get m data points is sub-optimal because the number of data points needed in symbolic regression changes depending on the specific problem (i.e. m changes), which means that the output dimension should be changed accordingly. Since a set can be presented by exponential family distributions (Sun and Nielsen 2019), we represent the query result as a Normal distribution, from which we can flexibly sample any amount of latent vectors and use them to generate the final queries. Also, the training pro- cess benefits from the diversity caused by sampling which can help it avoid the local minima. We choose the Normal distribution due to its good properties: (1) It has a differen- tiable closed form KL divergence which is convenient for optimization. (2) The product of two Normal distributions (i.e. the intersection of two sets) is still a scaled Normal dis- tribution (Huang et al. 2021). Details are shown in the next subsection. QUOSR Next, we will introduce the architecture and training details. Architecture details are shown in Figure 1. As mentioned be- fore, QUOSR adopts a siamese architecture where the two branches share parameters. Each branch mainly contains two parts: a physical system f which is used to be queried by generated x, and a query network which receives histori- cal data points {(xi, yi)}i and generates the next queries x. The query network consists of an encoder that embeds the historical data points, and a decoder that receives the data embedding and generates the next queries. Details are de- scribed in the following. Encoder. The design of the encoder follows Ren and Leskovec (2020) and Huang et al. (2021). First, given a set of data points D = {(xi, yi)}N i=1, each data point is projected into a Normal distribution in latent space. This distribution can be seen as the representation of the set of candidate ex- pressions that satisfy the given data point: where M LP means multi-layer perceptron. The further il- lustration of the intersection is beyond the scope of this pa- per and please refer to their original papers. Decoder. The decoder consists of two parts: generating a Normal distribution and sampling m points from it. Differ- ent from the distribution produced by the encoder which rep- resents the set of candidate expressions, this distribution rep- resents the set of possible queries as mentioned in the last subsection. [μq, log(σq 2)] = M LPquery[μ, log(σ2)], (9) where the subscript q denotes "query". Then, we sample m points from the Normal distribution N (μ, σ) and project them back to RM with an MLP. xi = M LPinversion(vi), (10) Training. At the beginning of the query process, we sam- ple two groups of data points uniformly as the initial condi- tion of the query process (the number of initial data points equals the number of data points queried in each step). Since LN CE is calculated by measuring the similarity between two different sets of data points d and d(cid:48), we maintain two query processes with different initial conditions simultane- ously. Specifically, in each step of query, QUOSR receives N historical data points {(xi, yi)}N i=1 as input, generates m new data {xi}N +m i=N +1, and then gets the corresponding {yi}N +m i=N +1 from f. These N + m data points {(xi, yi)}N +m are taken as the next step input of QUOSR, and this pro- cess repeats. As mentioned in Equation 7, the data embed- ding represents Normal distributions, so the similarity of two sets of data points is measured with Kullback-Leibler diver- gence: i=1 sim(d, d(cid:48)) = KL(N (ud, σd)||N (u(cid:48) d, σ(cid:48) d)) (11) We merge d' into d in Equation 4 by crossing their elements, thus the loss function in Equation 4 is finally rewritten as LN CE = 1 2N N (cid:88) [l(d2i−1, d2i) + l(d2i, d2i−1)], (12) i=1 [μi, log(σi 2)] = M LPdata((xi, yi)), (6) l(di, dj) = − log exp(sim(di, dj)/τ ) k=1 1[k(cid:54)=i]exp(sim(di, dk)/τ ) (cid:80)2N (13) where [] denotes concatenation, and μi and σi represents Normal distribution N (μ, σ). Then, for the N distributions, we take them as independent ones (i.e. input order irrele- vant) and calculate their intersection as the final embedding of data points D: [μ, log(σ2)] = N (cid:88) i=1 wi[μi, log(σi 2)], (7) wi = exp(M LPattention([μi, log(σ2 i )])) j=1 exp(M LPattention(μj, log(σ2 j ))) (cid:80)N , (8) where d2i−1 denotes d, d2i denotes d(cid:48) and τ denotes a tem- perature parameter. See Figure 1 and Algorithm 2 in Ap- pendix C for details. Experiments We study the ability of QUOSR to find informative points in experiments. First, we combine QUOSR with a symbolic regression method and present the main results. Then some cases are given to visualize the strategy learned by QUOSR. And at last, we do the ablation experiments. Settings We combine QUOSR with a transformer-based method named SymbolicGPT (Valipour et al. 2021) which achieves competent performance in symbolic regression. Symbol- icGPT uses PointNet (Qi et al. 2017) to encode any num- ber of data points and then generates the skeleton of an ex- pression character by character using GPT where constants are represented by a < C > token. To learn these con- stants in the skeleton, SymbolicGPT employs BFGS opti- mization (Fletcher 2013). The training process is split into three stages: training QUOSR, generating a new dataset and finetuning Symbol- icGPT. We train QUOSR using expressions in the dataset of Valipour et al. (2021) which contains about 500k one- variable expressions. The data points used for generat- ing expressions are uniformly sampled from the range of [−3.0, 3.0]. The max query times K is set to 9, thus we first uniformly sample 3 points and then generate the other 27 data points in the following 9 query steps. We limit QU- OSR to generate values of x ∈ [−3.0, 3.0] to fit the range of the original dataset. Then we generate a new dataset named Query for all expressions. For comparison, we also sam- ple x from U(−3.0, 3.0) and N (0, 1) and generate another two datasets, U nif orm and N ormal. We finetune the pre- trained model of SymbolicGPT on these three datasets. The original test set of SymbolicGPT contains 966 ex- pressions. For each expression, 30 data points sampled uni- formly in the range of [−3.0, 3.0] are used to generate ex- pressions, and another 30 data points sampled uniformly in the range of [−5.0, −3.0] ∪ [3.0, 5.0] are used to evaluate the accuracy of the predicted expression. We replace data points used for generating expressions with the ones sam- pled with three methods: QUOSR, uniform sampling, and normal sampling, and use original test data points to evalu- ate two metrics with three models respectively: the propor- tion of log M SEN < −10 and the average R2 (Kamienny et al. 2022): M SEN = Ntest(cid:88) i=1 (yi − ˆyi)2 ||y + (cid:15)||2 R2 = max(0, 1 − (cid:80)Ntest i (cid:80)Ntest i (yi − ˆyi)2 (yi − y)2 ), (14) (15) (cid:80)Ntest where (cid:15) is set to 0.00001 to avoid division by zero and y = 1 i=0 yi. We set the lower bound of R2 to 0 since a Ntest bad prediction can lead R2 to be an extremely large negative number. Results Figure 2 shows the proportion of predicted expressions whose log M SEN < −10 and the average of R2. Though results of uniform sampling improve after finetuning, QU- OSR performs the best in both metrics, which indicates that in the online setting of symbolic regression, QUOSR can explore more informative data points than uniform sampling and thus helps SymbolicGPT achieve a better result. Figure 2: The performance of the origin SymbolicGPT model and another three models finetuned on U nif orm, N ormal and Query. Figure 3: Results for different amount of data points. We also evaluate the performance of QUOSR by each query steps, shown in Figure 3. Since the more information a data point contains, the sooner it will be queried, the perfor- mance of QUOSR is significantly improved in the first four steps and grows steadily in the next five. Case Study Figure 4 gives a visualization of the latent space using t- SNE (Van der Maaten and Hinton 2008). We cluster data points embeddings (Figure 4 Left), symbolic forms embed- dings (Figure 4 Mid), and functions (into 9 classes, Figure 4 Right). To see which embedding method matches the func- tionality better, we label 9 classes in Figure 4 Right with 9 different colors and color Figure 4 Left and Mid with corre- sponding colors. Graphs of expressions in the same cluster are close, but their symbolic form embeddings are chaotic. Figure 5 presents graphs of two expressions in which QU- OSR outperforms uniform sampling. Data points sampled uniformly are marked with blue dots and the ones generated by QUOSR are marked in red. We observe two interesting phenomena: (1) QUOSR pays more attention to the neigh- borhood of extreme points and discontinuity points. (2) For periodic functions, QUOSR samples multiple points in one cycle, and only a few points in other cycles which might be 0.460.480.50.520.540.560.580.60.620.6440424446485052OriginUniformNormalQUOSRR2Proportion36912151821242730Amount of data used for generating expressions0.250.300.350.400.450.50ProportionQUOSRuniformnormalorigin Figure 4: The clustering results of different embedding methods (Left and Mid). Different colors represent different sets of expressions that have similar functionality (Right). Proportion R2 Sim Rep Intersect KL mean KL max cos attention attention KL attention KL attention KL attention KL attention KL Stra data QBD 41.20 data QBD 45.65 data QBD 41.72 expr QBD 44.20 40.89 expr QBS data QBS 41.61 data QBP N/A data QBD 50.41 0.5370 0.5774 0.5380 0.5721 0.5290 0.5388 N/A 0.6177 Figure 5: Graphs of two expressions in which QUOSR out- performs uniform sampling. The blue points are sampled uniformly and the red ones are generated by QUOSR. used to judge their periodicity. Ablation Study Table 1 presents results for the ablation study over the fol- lowing four variants: (1) Methods of intersection: attention in Equation 7, mean in Equation 16 or max in Equation 17: [μ, log(σ2)] = [ 1 n N (cid:88) i=1 μi, log( 1 n N (cid:88) i=1 σ2 i )], (16) [μ, log(σ2)] = [max μi, log(max σ2 i )], (17) (2) The similarity function: KL divergence in Equation 11 or cosine similarity (cos) in Equation 18: sim(d, d(cid:48)) = [ud, σd] * [u(cid:48) (cid:107)[ud, σd](cid:107)(cid:107)[u(cid:48) d]T d, σ(cid:48) d, σ(cid:48) d](cid:107) , (18) (3) Representation methods of physical system f : data points (data) or symbolic forms (expr). Table 1: Ablation over interaction methods (Intersect), the similarity function (Sim), expression representation (Rep) and query strategies (Stra). N/A means the out of memory error code occurs when training. (4) Query strategies: query-by-distribution (QBD), query- by-set (QBS) in Equation 19 or query-by-point (QBP) Equation 20. [{xi}m i=1] = M LPQBS([μ, log(σ2)]), (19) xi = M LPQBP ([μ, log(σ2)]), (20) The results are presented in table 1. We can conclude that: (1) Experiments with the KL similarity and attention inter- section get a better result than others, suggesting the advan- tage of projecting data points to a Normal distribution (2) The performance drops when using symbolic forms of ex- pressions, which indicates that representing an expression with its data points is more appropriate than with its sym- bolic forms. (3) Among all query strategies, our query-by- distribution strategy performs the best. The query-by-point strategy does not give out useful results due to its optimiza- tion difficulty. The query-by-set strategy performs worse than ours probably because sampling from distribution re- sults in more diversity which helps the query network avoid local minima in training. 32101231.21.41.61.82.02.22.42.63210123201001020 Conclusion In this work, we propose a query-based framework QUOSR to tackle online symbolic regression. To maximize the mu- tual information between data points and expressions, we modify InfoNCE loss and thus a good expression encoder is unnecessary. Furthermore, we use the query-by-distribution strategy instead of query-by-point, and thus the amount of information obtained in each query step increases. Com- bining with modern offline symbolic regression methods, QUOSR achieves a better performance. We take the query- based framework for multi-variable expressions as our fu- ture work for its challenge in spurious multi-variable expres- sions. 61925208, Acknowledgments This work is partially supported by the NSF of China(under Grants 62002338, U22A2028, U19B2019), Beijing Academy of Artificial Intelligence (BAAI), CAS Project for Young Scientists in Basic Research(YSBR-029), Youth Innovation Promotion Association CAS and Xplore Prize. 62222214, 62102399, References Angluin, D. 1988. Queries and concept learning. Machine learning, 2(4): 319–342. Angluin, D. 2001. Queries revisited. In International Con- ference on Algorithmic Learning Theory, 12–31. Springer. Ansari, M.; Gandhi, H. A.; Foster, D. G.; and White, A. D. 2022. Iterative symbolic regression for learning transport equations. AIChE Journal, e17695. Arnaldo, I.; Krawiec, K.; and O'Reilly, U.-M. 2014. Multi- ple regression genetic programming. In Proceedings of the 2014 Annual Conference on Genetic and Evolutionary Com- putation, 879–886. Augusto, D. A.; and Barbosa, H. J. 2000. Symbolic regres- sion via genetic programming. In Proceedings. Vol. 1. Sixth Brazilian Symposium on Neural Networks, 173–178. IEEE. Biggio, L.; Bendinelli, T.; Neitz, A.; Lucchi, A.; and Paras- candolo, G. 2021. Neural symbolic regression that scales. In International Conference on Machine Learning, 936–945. PMLR. Chen, C.; Luo, C.; and Jiang, Z. 2017. Elite bases regres- sion: A real-time algorithm for symbolic regression. In 2017 13th International conference on natural computation, fuzzy systems and knowledge discovery (ICNC-FSKD), 529–535. IEEE. Chen, T.; Kornblith, S.; Norouzi, M.; and Hinton, G. 2020. A simple framework for contrastive learning of visual repre- sentations. In International conference on machine learning, 1597–1607. PMLR. Cohn, D.; Atlas, L.; and Ladner, R. 1994. Improving gen- eralization with active learning. Machine learning, 15(2): 201–221. Fletcher, R. 2013. Practical methods of optimization. John Wiley & Sons. Gallager, R. G. 1968. Information theory and reliable com- munication, volume 588. Springer. Haut, N.; Banzhaf, W.; and Punch, B. 2022. Active Learn- ing Improves Performance on Symbolic RegressionTasks in StackGP. arXiv preprint arXiv:2202.04708. Hernandez, A.; Balasubramanian, A.; Yuan, F.; Mason, S. A.; and Mueller, T. 2019. Fast, accurate, and transferable many-body interatomic potentials by symbolic regression. npj Computational Materials, 5(1): 1–11. Huang, D.; Zhang, R.; Hu, X.; Zhang, X.; Jin, P.; Li, N.; Du, Z.; Guo, Q.; and Chen, Y. 2021. Neural Program Synthesis with Query. In International Conference on Learning Rep- resentations. Kamienny, P.-A.; d'Ascoli, S.; Lample, G.; and Charton, F. 2022. End-to-end symbolic regression with transformers. ArXiv, abs/2204.10532. King, R. D.; Whelan, K. E.; Jones, F. M.; Reiser, P. G.; Bryant, C. H.; Muggleton, S. H.; Kell, D. B.; and Oliver, S. G. 2004. Functional genomic hypothesis generation and experimentation by a robot scientist. Nature, 427(6971): 247–252. Koza, J. R. 1994. Genetic programming as a means for programming computers by natural selection. Statistics and computing, 4(2): 87–112. La Cava, W.; Orzechowski, P.; Burlacu, B.; de Franc ̧a, F. O.; Virgolin, M.; Jin, Y.; Kommenda, M.; and Moore, J. H. 2021. Contemporary symbolic regression methods and their rela- tive performance. arXiv preprint arXiv:2107.14351. La Cava, W.; Singh, T. R.; Taggart, J.; Suri, S.; and Moore, J. H. 2018. Learning concise representations for regression by evolving networks of trees. In International Conference on Learning Representations. Lample, G.; and Charton, F. 2019. Deep learning for sym- bolic mathematics. arXiv preprint arXiv:1912.01412. Lewis, D. D.; and Gale, W. A. 1994. A sequential algorithm for training text classifiers. In SIGIR'94, 3–12. Springer. Martius, G.; and Lampert, C. H. 2016. Extrapolation and learning equations. arXiv preprint arXiv:1610.02995. Mundhenk, T. N.; Landajuela, M.; Glatt, R.; Santiago, C. P.; Faissol, D. M.; and Petersen, B. K. 2021. Symbolic re- gression via neural-guided genetic programming population seeding. arXiv preprint arXiv:2111.00053. Petersen, B. K.; Larma, M. L.; Mundhenk, T. N.; Santiago, C. P.; Kim, S. K.; and Kim, J. T. 2020. Deep symbolic regression: Recovering mathematical expressions from data via risk-seeking policy gradients. In International Confer- ence on Learning Representations. Poole, B.; Ozair, S.; Van Den Oord, A.; Alemi, A.; and Tucker, G. 2019. On variational bounds of mutual infor- mation. In International Conference on Machine Learning, 5171–5180. PMLR. Pu, Y.; Kaelbling, L. P.; and Solar-Lezama, A. 2017. Learn- ing to Acquire Information. In UAI. AUAI Press. Pu, Y.; Miranda, Z.; Solar-Lezama, A.; and Kaelbling, L. 2018. Selecting representative examples for program syn- thesis. In International Conference on Machine Learning, 4161–4170. PMLR. Qi, C. R.; Su, H.; Mo, K.; and Guibas, L. J. 2017. Pointnet: Deep learning on point sets for 3d classification and segmen- tation. In Proceedings of the IEEE conference on computer vision and pattern recognition, 652–660. Ren, H.; and Leskovec, J. 2020. Beta Embeddings for Multi- Hop Logical Reasoning in Knowledge Graphs. In NeurIPS. Sahoo, S.; Lampert, C.; and Martius, G. 2018. Learning In International equations for extrapolation and control. Conference on Machine Learning, 4442–4450. PMLR. Schmidt, M.; and Lipson, H. 2009. Distilling free-form natu- ral laws from experimental data. science, 324(5923): 81–85. Settles, B. 2009. Active learning literature survey. Song, J.; and Ermon, S. 2020. Multi-label contrastive pre- dictive coding. Advances in Neural Information Processing Systems, 33: 8161–8173. Sun, K.; and Nielsen, F. 2019. Information-Geometric Set Embeddings (IGSE): From Sets to Probability Distributions. ArXiv, abs/1911.12463. Tsai, Y.-H. H.; Li, T.; Liu, W.; Liao, P.; Salakhutdi- Integrating auxiliary nov, R.; and Morency, L.-P. 2021. arXiv preprint information in self-supervised learning. arXiv:2106.02869. Udrescu, S.-M.; and Tegmark, M. 2020. AI Feynman: A physics-inspired method for symbolic regression. Science Advances, 6(16): eaay2631. Valipour, M.; You, B.; Panju, M.; and Ghodsi, A. 2021. SymbolicGPT: A Generative Transformer Model for Sym- bolic Regression. ArXiv, abs/2106.14131. van den Oord, A.; Li, Y.; and Vinyals, O. 2018. Represen- tation Learning with Contrastive Predictive Coding. ArXiv, abs/1807.03748. Van der Maaten, L.; and Hinton, G. 2008. Visualizing data using t-SNE. Journal of machine learning research, 9(11). Virgolin, M.; Alderliesten, T.; Witteveen, C.; and Bosman, P. A. 2021. Improving model-based genetic programming for symbolic regression of small expressions. Evolutionary computation, 29(2): 211–237. Weng, B.; Song, Z.; Zhu, R.; Yan, Q.; Sun, Q.; Grice, C. G.; Yan, Y.; and Yin, W.-J. 2020. Simple descriptor derived from symbolic regression accelerating the discovery of new per- ovskite catalysts. Nature communications, 11(1): 1–8. Xing, H.; Salleb-Aouissi, A.; and Verma, N. 2021. Auto- mated symbolic law discovery: A computer vision approach. In Proceedings of the AAAI Conference on Artificial Intelli- gence, volume 35, 660–668. Zheng, W.; Chen, T.; Hu, T.-K.; and Wang, Z. 2022. Sym- bolic Learning to Optimize: Towards Interpretability and Scalability. arXiv preprint arXiv:2203.06578. A Theoretical Analysis Proof of Claim 1 As the average number of query steps is equivalent to the average decision path, we intent to minimize the latter. This optimization problem has been solved by Huffman (Gallager 1968). cH(F ) ≤ ̄Lh < cH(F ) + 1, (21) where H(F ) denotes the entropy of F , ̄Lh denotes the min- imum of the average decision path and c is a constant. Sup- pose several data points D = {xi, yi}m i=1 have been queried which means the length of the previous path ̄Lh1 = m, the rest part ̄Lh2 can be bound with cH(F |D) ≤ ̄Lh2 < cH(F |D) + 1. (22) Thus the minimum length of average decision path after queries satisfies m + cH(F |D) ≤ ̄Lh1 + ̄Lh2 < m + cH(F |D) + 1. (23) The gap between ideal minimum length and minimum length after queries is | ̄Lh1 + ̄Lh2 − ̄Lh| < m + cH(F |D) + 1 − cH(F ) = m + 1 − cI(F ; D). Thus the optimal queries are D∗ = arg min D | ̄Lh1 + ̄Lh2 − ̄Lh| = arg max D I(F ; D). (24) (25) Proof of Claim 2 We define X = PD|F PD(cid:48)|F and Y = PDPD(cid:48), thus accord- ing to Tsai et al. (2021); Song and Ermon (2020): −L(cid:48) N CE = E(di,d(cid:48) i)∼E[Pd|f Pd(cid:48) |f ][log( 1 N = E(d,d(cid:48) 1)∼X,(d,d(cid:48) 2:n)∼Y [log( 1 N (cid:80)N i)) exp(sim(di, d(cid:48) j=1 exp(sim(di, d(cid:48) exp(sim(d, d(cid:48) j=1 exp(sim(d, d(cid:48) 1)) (cid:80)N j)) j)) I(F ; D) − KL(E[PD|F PD(cid:48)|F ]||PDPD(cid:48)) (cid:90) (cid:90) = p(F, D) log dF dD− p(F, D) p(F )p(D) F (cid:90) D p(F ) F (cid:82) log (cid:90) D p(D|F ) (cid:90) D(cid:48) p(D(cid:48)|F ) F (cid:48) p(F (cid:48))p(D|F (cid:48))p(D(cid:48)|F (cid:48))dF (cid:48) p(D)p(D(cid:48)) dDdD(cid:48)dF (cid:90) = F (cid:90) p(F ) p(F ) (cid:90) D (cid:90) D p(D|F ) log p(D|F ) (cid:90) D(cid:48) p(D|F ) p(D) dDdF − p(D(cid:48)|F ) F (cid:48) p(F (cid:48)|D(cid:48))p(D|F (cid:48))dF (cid:48) p(D) dDdD(cid:48)dF F (cid:82) log (cid:90) = (cid:90) p(F ) (cid:90) p(D|F ) F (cid:90) ≥ − D (cid:90) p(F ) D(cid:48) (cid:90) p(D|F ) log (cid:82) p(D|F ) F (cid:48) p(F (cid:48)|D(cid:48))p(D|F (cid:48))dF (cid:48) dDdD(cid:48)dF F D D(cid:48) (cid:82) F (cid:48) p(F (cid:48)|D(cid:48))p(D|F (cid:48))dF (cid:48) p(D|F ) − 1)dDdD(cid:48)dF ( =0 Similarly KL(E[PD|F PD(cid:48)|F ]||PDPD(cid:48)) ≤ I(F ; D(cid:48)), thus KL(E[PD|F PD(cid:48)|F ]||PDPD(cid:48)) ≤ min{I(F ; D), I(F ; D(cid:48))}. (29) (28) B Experimental Details We set the max query steps K to 9. The dimension of u and σ is set to 256. We use a three-layer transformer to encode symbolic forms of expressions whose hidden state is a 512 vector. For training, we use the SGD optimizer with a learn- ing rate 1e-3. The batch size is set to 256. )] )] ≤ KL(EX ||Y ) = KL(E[PD|F PD(cid:48)|F ]||PDPD(cid:48)) Then we give proof of (26) Figure 6: The performance of the origin SymbolicGPT model and another three models finetuned on U nif orm, N ormal and Query. KL(E[PD|F PD(cid:48)|F ]||PDPD(cid:48)) ≤ min{I(F ; D), I(F ; D(cid:48))}. (27) Since SymbolicGPT outputs the skeleton of expressions, we also measure skeleton match in the test set which means expressions with constant replaced with a < C > token are 353841444750OriginUniformNormalQUOSRSkeleton Figure 7: Variance of the Normal distribution in the latent space. Metric Proportion R2 Isclose Origin Uniform Normal QUOSR 67.35 0.80 0.76 61.22 0.80 0.72 44.90 0.75 0.60 63.27 0.86 0.79 Table 2: The performance of QUOSR combined with Nesymres. correct. Skeleton match is a meaningful metric. It describes whether the SR method correctly judges the relationship be- tween the variables, which is what experimenters care about. Figure 6 shows the results. QUOSR obviously outperforms, probably because QUOSR samples data points at different intervals and focuses on extreme points. Figure 7 shows the variance log(σ2) of the Normal dis- tributions in the latent space which represents the entropy of the Normal distribution. As the amount of data points in- creases, the size of possible expression set becomes small, and the entropy of the normal distribution gradually de- creases. It becomes stable from step four, which leads to our performance improving at a slower rate. We combine QUOSR with another SR method named Nesymres (Biggio et al. 2021) and present the results in table 2. The test set contains 150 expressions. The metric Isclose is the proportion of expressions for over 95% of points of which numpy.isclose(y, ˆ(y)) returns True. Re- sults show that QUOSR is a general framework that can be aggregated to different SR approaches. C Training Algorithm Algorithm 2 describes the training process of QUOSR. Algorithm 2: Training process Train 1: Initialize max iterations M , max query times K and sample amount m for one query. 2: for i ∈ {1 . . . M } do 3: uniformly sample d ← {xi, yi}m and d(cid:48) ← {xj, yj}m from the physical system L ← 0 for i ∈ {1 . . . K} do μ, σ ← Encoder(d) μ(cid:48), σ(cid:48) ← Encoder(d(cid:48)) L ← L + LN CE([μ, σ], [μ(cid:48), σ(cid:48)]) p ← Decoder([μ, σ]) p(cid:48) ← Decoder([μ(cid:48), σ(cid:48)]) d ← d ∪ p d(cid:48) ← d(cid:48) ∪ p(cid:48) end for Update parameters w.r.t. L 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: end for Encoder({xi, yi}N ) 1: for i ∈ {1 . . . N } do [μi, log(σ2 2: 3: end for 4: for i ∈ {1 . . . N } do i )] ← M LPdata({xi, yi}) 5: wi ← exp(M LPattention([μi,log(σ2 i )])) j=1 exp(M LPattention(μj ,log(σ2 (cid:80)N j ))) i=1 wi[μi, log(σ2 i )] q )] ← M LPquery([μ, log(σ2)]) i=0 from N (μq, σq) 6: end for 7: [μ, log(σ2)] = (cid:80)N 8: return μ, log(σ2) Decoder([μ, σ]) 1: [μq, log(σ2 2: sample m vectors {vi}m 3: p ← ∅ 4: for i ∈ {1 . . . m} do 5: 6: 7: 8: end for 9: return p xi = M LPinversion(vi) interact with the physical system f , and get corre- sponding response yi = f (xi) p ← p ∪ {xi, yi} 123456789Query steps1.5721.5741.5761.5781.5801.5821.584Var
http://arxiv.org/abs/2302.10530v1
2023-02-21T08:55:31
2023-02-21T08:55:31
Reentry Risk and Safety Assessment of Spacecraft Debris Based on Machine Learning
Uncontrolled spacecraft will disintegrate and generate a large amount of debris in the reentry process, and ablative debris may cause potential risks to the safety of human life and property on the ground. Therefore, predicting the landing points of spacecraft debris and forecasting the degree of risk of debris to human life and property is very important. In view that it is difficult to predict the process of reentry process and the reentry point in advance, and the debris generated from reentry disintegration may cause ground damage for the uncontrolled space vehicle on expiration of service. In this paper, we adopt the object-oriented approach to consider the spacecraft and its disintegrated components as consisting of simple basic geometric models, and introduce three machine learning models: the support vector regression (SVR), decision tree regression (DTR) and multilayer perceptron (MLP) to predict the velocity, longitude and latitude of spacecraft debris landing points for the first time. Then, we compare the prediction accuracy of the three models. Furthermore, we define the reentry risk and the degree of danger, and we calculate the risk level for each spacecraft debris and make warnings accordingly. The experimental results show that the proposed method can obtain high accuracy prediction results in at least 15 seconds and make safety level warning more real-time.
[ "Hu Gao", "Zhihui Li", "Depeng Dang", "Jingfan Yang", "Ning Wang" ]
10.1007/s42405-023-00652-x
[ { "@title": "doi", "@href": "http://dx.doi.org/10.1007/s42405-023-00652-x", "@rel": "related", "@type": null }, { "@title": null, "@href": "http://arxiv.org/abs/2302.10530v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10530v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
Noname manuscript No. (will be inserted by the editor) Reentry Risk and Safety Assessment of Spacecraft Debris Based on Machine Learning Hu Gaoa * Zhihui Lib,c * Depeng Danga,∗ * Jingfan Yanga * Ning Wanga 3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 0 3 5 0 1 . 2 0 3 2 : v i X r a Received: date / Accepted: date Abstract Uncontrolled spacecraft will disintegrate and generate a large amount of debris in the reentry process, and ablative debris may cause potential risks to the safety of human life and property on the ground. Therefore, predicting the landing points of spacecraft debris and forecasting the degree of risk of debris to human life and property is very important. In view that it is difficult to predict the process of reentry process and the reentry point in advance, and the debris generated from reentry disintegration may cause ground damage for the uncontrolled space vehicle on expiration of service. In this paper, we adopt the object-oriented approach to consider the spacecraft and its disintegrated components as consisting of simple basic geometric models, and introduce three machine learning models: the support vector regression (SVR), decision tree regression (DTR) and multilayer perceptron (MLP) to predict the velocity, longitude and latitude of spacecraft debris landing points for the first time. Then, we compare the prediction accuracy of the three models. Furthermore, we define the reentry risk and the degree of danger, and we calculate the risk level for each spacecraft debris and make warnings accordingly. The experimental results show that the proposed method can obtain high accuracy prediction results in at least 15 seconds and make safety level warning more real-time. Keywords Debris distribution * Reentry disintegration * Machine learning * Risk assessment 1 Introduction In the process of uncontrolled atmospheric reentry, spacecraft disintegrate under a variety of forces, such as gravity and aerodynamics; and produce a large amount of debris [1, 2]. Most debris is destroyed by thermal ablation with the atmosphere, but some debris may survive and impact the ground, posing a threat to the safety of people. If debris crashes into buildings or in densely populated areas, unimaginable grave consequences will occur [2, 3]. Therefore, improving the precision and efficiency of spacecraft debris risk assessment and accurately predicting the landing time, location and risk level of debris is very important [4]. a School of Artificial Intelligence, Beijing Normal University, Beijing 100000, China b China Aerodynamics Research and Development Centre, Mianyang 621000, China c National Laboratory for Computational Fluid Dynamics, BUAA, Beijing 100191, China *Corresponding Author Hu Gao E-mail: [email protected] Zhihui Li E-mail: [email protected] Depeng Dang E-mail: [email protected] Jingfan Yang E-mail: [email protected] Ning Wang E-mail: [email protected] 2 Hu Gaoa et al. The traditional spacecraft debris reentry risk assessment approach is based on physical modelling and involves different modules, such as the trajectory, aerodynamic/aerothermal characteristics, ablation, disintegration, ground risk assessment, and their coupling. In order to predict the reentry trajectory of dismantled spacecraft fragments, aerospace professionals need to use orbital dynamics and hydrodynamics to model and analyse multiscale complex flow problems and then obtain landing points by solving the reentry trajectory [5]. The above approach requires the Monte Carlo method, Gas-Kinetic Unified Algorithm (GKUA) for solving the Boltzmann model equations and other probabilistic methods to simulate molecular collisions in the atmosphere. Due to the high complexity and limitation of computing power and energy consumption, the traditional approach takes too much time, and the accuracy is insufficient. In the past 20 years, advances in machine learning have driven the development of many disciplines. Machine learning is used in many fields, such as medicine and finance, to predict the probability of events or future trends. Researchers in some safety-critical fields, such as aerospace, have also started to use machine learning to solve problems. For example, [6] use an recurrent neural network (RNN) to predict re-entry trajectories of uncontrolled space objects. [7] use a machine learning approach for spacecraft break-up predictions. However, due to the rapid development of machine learning, many new machine learning approaches are not used in aerospace. Therefore, the prediction of spacecraft reentry debris landing points based on machine learning has important scientific and engineering value. In this paper, we propose a risk safety assessment approach for spacecraft debris based on machine learning. We adopt the object-oriented approach to consider the spacecraft and its disintegrated components as consisting of simple basic geometric models, and introduce three machine learning algorithms to predict the velocity, longitude and latitude of spacecraft debris landing points for the first time. Then, we define the reentry risk and the degree of danger. Furthermore, we calculate the risk level for each spacecraft debris and make warnings accordingly. Compared with those existing works, our main contributions are as follows: 1. By using machine learning, there is no need to consider the physical process of spacecraft debris reentry. From the input of raw data to the output of task results, the whole training and prediction process is completed in the model. Our approach is also the only approach based on machine learning for spacecraft debris risk safety assessment. 2. We compares the accuracy of three machine learning regression algorithms, support vector machine, decision tree and multi-layer perceptron, to predict the landing location of spacecraft debris, and analyzes the reasons for such results. 3. We redifine the reentry risk and the economy, population and kinetic energy of the debris landing points are taken as risk factors. Then, according to the law of Bradford, we divided the debris risk into 5 equal parts with a step size of 0.2, and formulated the degree of debris risk. 4. The experimental results show that the proposed method in our paper can obtain high acccuracy prediction results in at least 10 seconds. Among them, by using decision trees, the average longitude prediction error is 0.96◦ , the average latitude prediction error is 0.53◦, and the average velocity prediction error is 0.008m/s. 2 Related Work 2.1 Space debris reentry risk assessment The research on space debris reentry prediction and ground risk assessment started ten years ago, and mature software systems have been developed. The common approaches for spacecraft debris reentry prediction, which can be divided into object oriented and spacecraft oriented, require a strong simulated physical model to determine the trajectory. The object-oriented method first reduces the shape of the spacecraft and its components to basic geometries and then simulates the reentry process by modelling aerodynamic, aerothermal and ablation processes. The spacecraft- oriented method directly models the real shape of spacecraft and calculates the aerodynamic and aerothermal proper- ties. The main space reentry prediction software includes DAS, ORSAT, SCARAB, ORSAT, DRAMA/SESAM and DEBRISK [2, 3, 8–15]. DAS and ORSAT are based on object-oriented methods, and SCARAB is based on a spacecraft- [5] used the Monte Carlo method to simulate aerodynamic and aerothermal characteristics and then oriented method. analysed the spacecraft disintegration process. On the basis of the dynamics model, [1] propose a spacecraft landing [11] use space debris considering byproduct point prediction approach based on upper wind real-time correction. generation, analyse the surviving space fragments and then assess ground risk. However, the above approach need to simulate molecular collisions in the atmosphere. Due to the high complexity and limitation of computing power and energy consumption, this methods take too much time, and the accuracy is insufficient. Reentry Risk and Safety Assessment of Spacecraft Debris Based on Machine Learning 3 2.2 Machine learning: Machine learning is a type of approach that enables computer to "learn" by simulating the human brain. Machine learning can acquire the potential laws from data and use the laws to predict unknown data. The application of machine learning in aerospace can be traced back to the 1970s. Voyager I, which was launched by NASA in 1977, applies expert systems containing command decoding, fault detection and correction. In the 21st century, deep learning, a branch of machine learning, has made breakthroughs; therefore, in many fields, work based on machine learning has [16] use machine learning approaches such as Tar3 and the naive Bayes classifier to attracted researchers again. predict possible influencing factors in the spacecraft reentry process. [17] use deep learning to establish an adaptive [7] apply a machine learning method to spacecraft fracture prediction and use spacecraft situation analysis system. a random forest regression algorithm and the data simulated by SCARAB as the dataset. However, for the data with different value attributes, the attributes with more value have a greater impact on the random forest, and the generated attribute weights are not credible. Furthermore, the random forest has been proven to be overfitted in some high noise level regression problems. In this paper, We compares the accuracy of three machine learning regression algorithms, support vector machine, decision tree and multi-layer perceptron, to predict the landing location of spacecraft debris, and analyzes the reasons for such results. And then we calculate the risk level for each spacecraft debris and make warnings accordingly. 2.3 Definition of the degree of reentry risk: [18] define the degree of reentry risk as the number of people on the ground who may be affected by spacecraft debris, and the formula is the following: E = (cid:80)n i=1 ρiAi, where ρi is the population density of the landing point, Ai is the cross-sectional area of debris, i is the ith piece of debris, and n is the number of pieces of spacecraft debris. On this basis, our paper considers the economy where debris falls and the kinetic energy when debris falls. 3 Methodology In this section, we introduce the following contents: (1) The velocity, longitude and latitude prediction of spacecraft debris landing points based on a machine learning regression; and (2) Risk assessment and the degree of dangerous based on the economy, population and debris kinetic energy of landing points. 3.1 Landing point velocity, longitude and latitude prediction The velocity, longitude and latitude prediction of spacecraft debris landing points can be considered a regression problem, and we use three machine learning algorithms to solve the problem: the support-vector regression, decision tree and multilayer perceptron. The machine learning training process is shown in Fig. 1. First, we preprocessed the data to make a dataset, the dataset is D = {(X1, Y1), (X2, Y2), ..., (Xn, Yn)}, where X is the input variable, Xi = (x(1) ) is the feature vector, Y is the output variable; n is the number of features, i = 1, 2, ..., N , and N is the sample size. And next divided it into a training set and a test set. Then, we put the training dataset into the machine learning model for training, and calculate the loss of the predicted value and the target value of the model according to the loss function. Next, we judge whether the error meets the requirements, if "N", we continue training the model. Otherwise, we test the predictive power of the model on the test dataset. If the requirements are met, the model training completed. If not, we modify the model parameters and retrain it. , ..., x(n) , x(2) i i i 3.1.1 Support Vector Regression A support vector machine (SVM) is a method originally used for classification problems and can be used for regression problems after improvement, namely, the support vector regression (SVR) [19]. The goal of an SVR is to find a regression plane so that the predicted value is as close to the regression plane as possible. The approximate continuous valued function of an SVR from a geometric view is as follows: ˆy = f (x) =< w, x > +b = M (cid:88) j=1 wjxj + b, y, b ∈ R, x, w ∈ RM (1) 4 Hu Gaoa et al. Fig. 1: The machine learning training process f (x) = (cid:20)w b (cid:21) (cid:21)T (cid:20)x 1 = wT x + b, x, w ∈ Rm+1 (2) An SVR reduces the above function approximation problem to an optimisation problem, then finds a hyperplane- centric interval zone, and finally minimises the prediction error (the distance between the predicted value and the target value). The interval zone is defined as: min w = ||w||2 1 2 (3) where ||w|| is the size of the approximation plane normal vector. An SVR has two main advantages: one advantage is that the computational complexity no longer depends on the input space dimension, and the other is that the model quality depends on the correct setting of parameters such as the kernel function. In this paper, we select the nonlinear SVR and use a radial basis kernel function as the Eq. 4 to put the data into a high-dimensional feature space, then fit the optimal linear plane. As shown in Fig. 2. K(x, x(cid:48)) = exp(− ||x − x(cid:48)||2 2σ2 ) (4) Finally, the objective function of our model is defined as Eq. 5. The smoothest plane is sought by minimizing the square of the vector norm w, and the error of the predicted value for each training data is at most equal to (cid:15). To allow for outliers, data with prediction errors greater than (cid:15) are penalized using an (cid:15)− sensitive loss function. The constrained optimization problem is then reformulated into a dual problem form using lagrange multipliers, and for each constraint, quadratic programming is used to determine, after which the deviation of the best weight is calculated, and then the predicted value ˆy is given. ˆy = N (cid:88) i=1 wiK(x, x(cid:48)) + b (5) Reentry Risk and Safety Assessment of Spacecraft Debris Based on Machine Learning 5 Fig. 2: The Nonlinear SVR. The original space of the input data is mapped to a higher dimensional feature space 3.1.2 Decision Tree Regression The decision tree regression (DTR) is a prediction model based on a set of binary rules, it divides the regions, and each region corresponds to a uniform predicted value. Each individual decision tree is a simple model with branches, nodes and leaves. A decision tree uses a heuristic method to divide the feature space. In each division, the possible values of all features in the current dataset are examined, and the best feature according to the lowest mean square error is selected as the splitting criterion [20–23]. The decision tree algorithm 1 is described in detail below. As algorithm 1 shows, the jth feature variable x(j) and its value s in the training set are taken as the splitting variable and splitting point, respectively. Then, two regions R1(j, s) = {x|x(j) ≤ s} and R2(j, s) = {x|x(j) > s} are defined. Finally, j and s are searched, which can minimize the square sum of errors of two regions according to the Eq 6, and each region corresponds to a uniform predicted value. min[min c1 (cid:88) (yi − c1)2) +min c2 (cid:88) (yi − c2)2)] xi∈R1(j,s) xi∈R2(j,s) (6) After splitting, c1 and c2 are fixed output values, which are the averages of Y in their regions. Therefore, Eq. 6 can be rewritten as: where min[ (cid:88) (yi − ˆc1)2) + (cid:88) (yi − ˆc2)2)] xi∈R1(j,s) xi∈R2(j,s) ˆc1 = ˆc2 = 1 N1 1 N2 (cid:88) xi∈R1(j,s) (cid:88) xi∈R2(j,s) yi yi (7) (8) The generation of the decision tree completely depends on the training sample, and the decision tree can fit the training samples perfectly. However, such a decision tree is too large and complex for the test sample and may produce a high classification error rate, namely, overfitting. Therefore, it is necessary to simplify a complex decision tree and remove some nodes to solve overfitting, which is called pruning. Pruning has two components: prepruning and postpruning. Prepruning terminates the growth of decision trees early in the decision tree generation process to avoid the presence of too many nodes. Prepruning is simple but not practical because it is difficult to determine when an algorithm should stop. Postpruning replaces a low-confidence node subtree with a leaf node after decision tree construction, and the leaf node is labelled with the highest frequency class in the subtree. There are two postpruning methods: one method divides the training dataset into a growth set and a pruning set, and the other method uses the same dataset for growth and pruning. Common postpruning methods are cost complexity pruning (CCP), reduced error pruning (REP), pessimistic error pruning (PEP) and minimum error pruning (MEP) [24]. The pruning process is shown in the Fig. 3. All the subtrees are traversed from bottom to top.For a leaf node that covers n samples with e errors, the error rate is (e + 0.5)/n, where 0.5 is the penalty factor. For a subtree with L leaf 6 Hu Gaoa et al. (cid:80) while s (cid:54)= null do if Eq. 6 then ˆcm = 1 Nm Algorithm 1 Decision Tree Regression Input: Training dataset D Output: Decision tree f(x) 1: f (x) = null 2: while j (cid:54)= null do 3: 4: 5: 6: 7: 8: end while 9: Pruning 10: Divide dataset D into M regions R1, R2, ..., RM 11: for m=1;m¡M;m++ do 12: 13: 14: 15: end for 16: return f(x) end if end while f (x) = f (x) + ˆcm xi∈Rm(j,s) yi if x ∈ Rm then end if nodes, the misjudgement rate is defined as: ErrorRatio = (cid:80)L i=1 ei + 0.5L (cid:80)L i=1 ni (9) where ei is the number of samples of the ith leaf node misclassification, and ni is the total number of samples of the ith leaf node. If a subtree is misclassified with a sample value of 1 and correctly classified with a sample value of 0, the number of subtree misjudgements obeys a Bernoulli distribution. Therefore, the mean value and standard deviation of the number of subtree misjudgements can be obtained as follows: ErrorM ean = ErrorRatio ∗ L (cid:88) i=1 ni ErrorST D = (cid:118) (cid:117) (cid:117) (cid:116)ErrorRatio ∗ L (cid:88) i=1 ni ∗ (1 − ErrorRatio) After replacing the subtree with a leaf node, the misjudgement rate of the leaf node is: ErrorRatio(cid:48) = e(cid:48) + 0.5 n(cid:48) (10) (11) (12) where e(cid:48) = (cid:80)L i=1 ei , and n(cid:48) = (cid:80)L i=1 ni . Furthermore, the number of misjudgements of this leaf node also obeys a Bernoulli distribution, so the mean number of misjudgements of this leaf node is: ErrorM ean(cid:48) = ErrorRatio(cid:48) ∗ n(cid:48) (13) The pruning condition is given as Eq. 14. When the pruning condition is satisfied, the subtree will be replaced by a leaf node. ErrorM ean + ErrorST D ≥ ErrorM ean(cid:48) (14) Finally, the data is input into the constructed decision regression, and the optimal region is selected according to the rules of the decision regression tree, and the final predicted value is obtained. Reentry Risk and Safety Assessment of Spacecraft Debris Based on Machine Learning 7 (a) (b) Fig. 3: The decision regression tree. Figure (b) shows the figure (a) after pruning. 8 Hu Gaoa et al. Fig. 4: The network structure of MLP. On this figure, we take three input variables as examples and output the final predicted value ˆy through a layer of perceptron 3.1.3 Multilayer Perceptron Neural networks were originally developed by researchers to imitate the neurophysiology of the human brain. As shown in Fig. 4, a multilayer perceptron (MLP) is an artificial neural network model that is composed of at least three layers: an input layer, a hidden layer and an output layer. In addition to the input layer nodes, each node is a neuron activated by a nonlinear activation function [25, 26]. In the MLP learning process, the feature vector X is input into the model for forward propagation to obtain the predicted value ˆy. This process can be defined as Eq. 15, where W1 and W2 are the weight matrices of the first and second layers, respectively; f (•) is the ReLU activation function and f (H) = max(0, H) [27]. Then, the difference between the prediction value and target value is calculated, as shown in Eq. 16. H = XW1 + B1 ˆy = f (H)W2 + B2 ej = yj − ˆyj (15) (16) where yj and ˆyj are the target value and prediction value of node j, respectively. In backpropagation, the weights matrices W1 and W2 are updated to minimize the overall output error, and the partial derivative of the objective function with respect to each neuron weight is calculated layer by layer. This results in the gradient of the objective function with respect to the weight vector, which is used as the basis for updating the weights, as shown in Eq. 17, and the α is the momentum factor. The learning is completed in the process of updating the weights to make the error reach the expected value. The MLP flowchart is shown in Fig. 5. ξ = 1 2 (cid:88) e2 j j ∂ξ ∂W1 = ∂ξ ∂ ˆy ∂f (H) ∂H ∂H ∂W1 (17) ∂ ˆy ∂f (H) ∂ξ ∂Wi Wi = Wi − α Reentry Risk and Safety Assessment of Spacecraft Debris Based on Machine Learning 9 Fig. 5: The flowchart of an MLP 3.1.4 Loss function In order to train the model proposed in this paper, we use the mean square error (MSE) as the loss function. MSE is the most commonly used regression loss function, which refers to the sum of the squared distance between the target value and the predicted value, as shown in Eq. 18, where yi is the target value, ˆyi is the predicted value by the machine learning algorithm, and n is the sample size. M SE = (cid:80)n i=1(yi − ˆyi)2 n (18) 3.2 Risk assessment 3.2.1 Calculation of the Economy, Population and Debris Kinetic Energy of Landing Points The object oriented method can be used to abstract the fragments into finite groups with simple geometric shapes, and ballistic simulation can be carried out for each group of fragments. Groups with similar landing points can be integrated. Meanwhile, it is noted that the ratio of surface to mass of fragments has a great influence on the ballistic characteristics, so the influence of fragment size should be considered after the geometric grouping scheme is determined. The final fragment grouping scheme is shown in Table 1. The smaller the single mass of a certain kind of fragment is, the larger the quantity of this kind of fragment is, and the relationship between the mass and the quantity is linear after taking logarithms [28]. Therefore, we set up: Where C is determined based on quality constraints, k varies according to disassembly type and is chosen as 0.553 in this paper. Then, combined with Table. 1 and Eq. 19, the weight of each fragment can be determined. For example: Assuming that the total mass of debris is 200kg and the three scales are 0.1m, 0.01m and 0.001m, the relationship between the n = C * m−k (19) 10 Hu Gaoa et al. Table 1: Fragment quality scheme. Pieces of type Scale of 1 Scale of 2 Scale of 3 A (Block: Round ball) B (Block: cuboid) C (Flake) D (Rhabditiform: l = 5a) E (Rhabditiform: l = 10a) WA1 WB1 WC1 WD1 WE1 WA2 WB2 WC2 WD2 WE2 WA3 WB3 WC3 WD3 WE3 quantity and mass of each group of debris is shown in Fig. 6. Finally, the spacecraft was determined to disintegrate into seven fragments, and the mass scheme is shown in Table. 2. Fig. 6: Relationship between quantity and mass for debris groups The NASA Socioeconomic Data and Applications Centre releases the Gridded Population of World (GPW) that provides a spatial grid population distribution layer that is compatible with social or economic datasets. The population grid layer is the administrative divisions worldwide, and the vector dataset and national digital identifier grid for each input administrative region centre point are also included in the population layer [29]. We use the velocity, longitude and latitude predicted by machine learning in the first part to calculate the economy, population and kinetic energy of spacecraft debris landing points. The calculation steps are given as follows: 1. Calculate and match the longitude and latitude of a landing point predicted in the first part with the central point position of each administrative region in the GPW, find the nearest administrative region to the landing point, and obtain the population density of the spacecraft debris landing area. 2. Gather the GDP of all regions worldwide, and find the regional GDP of the administrative region obtained in step 1 from the GDP dataset to measure the economic level of the spacecraft debris landing area. 3. Using the debris landing velocity and mass predicted in the first part, the kinetic energy of spacecraft debris landing is calculated according to the kinetic energy formula KE = 1 2 mv2. Reentry Risk and Safety Assessment of Spacecraft Debris Based on Machine Learning 11 Table 2: Finite grouping scheme for debris. Debris number Quality(kg) 1 2 3 4 5 6 7 16.0 72.7 65 225.5 8.0 20.7 108.5 3.2.2 Definition of Reentry Risk The casualty area is used to assess the ground risk caused by spacecraft debris during reentry. The total casualty area is calculated as the sum of the casualty areas of all n pieces of debris reentering as follows: Ac = n (cid:88) i=1 (cid:112) ( Ah + √ Ai)2 (20) where Ah is the human ground projected cross-sectional area Ai is the ith landing fragment cross-sectional area. In NASA safety standard NSS 1740.14, the human ground projected cross-sectional area is 0.36m2. The debris landing points in our work are not the same; therefore, we discuss a single degree of debris reentry risk based on the damage of human life and property, which is defined as follows: E = Ai ∗ ρi ∗ ui ∗ KEi (21) where ρi is the population density of the landing point of the ith fragment, ui is the economic situation of the landing point of the ith fragment, KEi is the landing kinetic energy of the ith fragment, and Ai is the cross-sectional area of the landing of the ith fragment. The degree of reentry risk is the quantitative basis for risk grading, risk grading is the theoretical basis of the degree of danger, and the degree of danger is the result of risk safety assessment. Because there is a large magnitude difference between fragment reentry risk, it is necessary to normalise the reentry risk data to the [0, 1] interval. The minimum value of sample data Y is min, the maximum value is max, and the calculation coefficient k is: k = 1 max − min Then, the data are normalised to the [0, 1] interval: norY = k ∗ (Y − min) The normalisation operation is expressed as nor, and the debris risk is defined as: W = norE (22) (23) (24) Finally, according to the law of Bradford, the debris risk is divided into 5 equal parts with a step size of 0.2 [30]. In the range of 0 1, the value of spacecraft debris reentry risk is divided into 5 intervals: 0 ∼ 0.04, 0.04 ∼ 0.16, 0.16 ∼ 0.36, 0.36 ∼ 0.64, and 0.64 ∼ 1.0 and named negligible risk, low risk, medium risk, high risk and very high risk, respectively. The flowchart of risk assessment as shown in Fig. 7. 12 Hu Gaoa et al. Fig. 7: The flowchart of risk assessment 4 Experiment 4.1 Dataset The dataset in our paper consists of 1489 sample data points of spacecraft debris landings simulated by aerodynamic fusion trajectory. Of these data, 70% is used as the training set and 30% as the test set. In this paper, through statistical analysis and calculation of sample data, there are no obvious discrete points in the data set, as shown in Fig. 9. Each sample consists of two parts: 1. Data features. The ideal goal of machine learning is to generate the most efficient model with the fewest features. In complex data, there may be interactions between data features, and the value of one variable may seriously affect the importance of other variables. Therefore, the more features the model contains, the more complex the influence relationship between features is, the more sparse the data will be, thus making the model more sensitive to errors caused by variance. In this paper, Yellowbrick is used to analyze the importance of features on disintegrated data. Firstly, the recursive feature elimination method is used to select the number of features with the best score, as shown in Fig. 8a. Then, the importance of features is sorted and the parameters are selected as data features input into the machine learning model, as shown in Fig. 8b. Finally, six parameters were obtained as data features input into the machine learning model, as shown in Table. 3. 2. Data labels. In this paper, firstly, the fragments are divided into several groups with simple geometric shapes by adopting a strategy similar to object-oriented method, and the mass distribution model of fragments is established. Then, the mass and number of each group after fragmentation generation are determined according to the fragment Reentry Risk and Safety Assessment of Spacecraft Debris Based on Machine Learning 13 (a) (b) Fig. 8: The parameters are selected as data features. Figure (a) shows therecursive feature elimination method is used to select the number of features with the best score. Figure (b) shows the importance of features is sorted and parameters are selected as data features input into the machine learning model. distribution model. Finally, the longitude, latitude and landing speed of the seven spacecraft during reentry were decomposed as data labels of the training model, as shown in Table. 4. Fig. 9: The data distribution of dataset in our paper 4.2 Model Settings Our experiment uses the functions in scikit-learn and adjusts the parameters to obtain the highest accuracy [31]. All regression algorithms use the MSE loss function, and the multilayer perceptron uses the Adam optimisation algorithm. The parameters of each algorithm are as follows: 1. There are 2 parameters in the SVR: C and epsilon. C is the regularization parameter, and the regularization intensity is inversely proportional to C. Epsilon is the epsilon tube, which is defined as the tolerance without any loss to the error. When we set C = 6.13 and epsilon = 5, the model has the highest accuracy score. 14 Hu Gaoa et al. Table 3: The table of data features Longitude of ground coordinate system origin (deg) Latitude of ground coordinate system origin (deg) Azimuth of ground coordinate system (deg) Initial altitude (m) Initial velocity (m/s) Initial trajectory inclination (deg) Table 4: The table of data labels Longitude of debris landing point (deg) Latitude of debris landing point (deg) Velocity of debris landing point (m/s) 2. In the decision tree model, the maximum depth of the tree is max depth = 5. 3. In the MLP model, the solution function of weight optimisation is lbf gs, the penalty parameter α = 1e − 5, and the maximum number of iterations max iter = 500. 4.3 Evaluation metric The performance evaluation metric of regression model mainly includes RMSE (square root error), MAE (mean absolute error), MSE (mean square error) and R2 score. Noteworthy, when the dimensions are different, RMSE, MAE and MSE are difficult to measure the effect of the model. With that in mind, we use the R2 score as the accuracy evaluation metric in this paper. The R2 score reflects the proportion of the total variation of the dependent variable that can be explained by the independent variable through regression. A higher score represents a more accurate prediction result. When the score is negative, it means that the model prediction result is very bad or even worse than using the mean directly. The R2 score is calculated as follows: R2 = 1 − SSres SStot (25) Where SStot is the square sum of the difference between the target value and the mean of the data, and SSres is the residual square sum of the difference between the target value and the prediction value. The calculation formula is shown in Eq. 26 27. Where yi and ˆyi are the target value and prediction value respectively, y is the mean of all the target values. SStot = SSres = = (cid:88) (yi − y)2 i (cid:88) i (cid:88) i (yi − ˆyi)2 e2 i (26) (27) 4.4 Results We calculate the R2 scores of the accuracy of three regression algorithms for the landing velocity, longitude and latitude of seven spacecraft fragments, as shown in Table. 5 6 7. The results show that the decision tree regression algorithm is more accurate than most other regression algorithms in predicting the velocity, longitude and latitude of spacecraft debris landing points. The average longitude prediction accuracy of the seven fragments is 99.53%, and the highest is 99.68%. The average latitude prediction accuracy of the seven fragments is 99.32%, and the highest is 99.49%. The average velocity prediction accuracy of the seven fragments is 65.88%, and the highest is 72.53%. From the accuracy charts of different regression models, we find that the accuracy of the latitude model trained by the SVR and MLP is generally higher than that of the longitude model, but the accuracy of the latitude model trained by DTR is almost the same as that of the longitude model. According to the data distribution in our dataset, the reason is that the latitude range of the debris landing points is limited by orbital inclination. However, the longitude range is not limited. As shown in Fig. 10, for the dataset in our paper, the orbital inclination is 42◦, and the spacecraft can only reenter at latitude between 42◦S and 42◦N . Therefore, the latitude ranges from 42◦S to 42◦N , the longitude ranges from 180◦W to 180◦E, and the value range of the latitude is smaller than that of the longitude. Therefore, the accuracy Reentry Risk and Safety Assessment of Spacecraft Debris Based on Machine Learning 15 Table 5: The prediction accuracy of the longitude model. The best results are highlighted. Debris number SVR MLP DTR 1 2 3 4 5 6 7 81.54% 92.22% 99.58% 81.92% 91.28% 99.62% 81.49% 94.72% 99.47% 82.03% 93.32% 99.68% 81.42% 91.30% 99.09% 81.78% 91.01% 99.65% 81.99% 94.22% 99.65% Table 6: The prediction accuracy of the latitude model. The best results are highlighted. Debris number SVR MLP DTR 1 2 3 4 5 6 7 96.23% 98.32% 99.49% 96.97% 98.24% 99.39% 96.05% 98.52% 99.47% 96.99% 97.29% 99.06% 96.01% 98.62% 99.17% 96.97% 98.35% 99.36% 96.99% 97.82% 99.32% Table 7: The prediction accuracy of the velocity model. The best results are highlighted. Debris number SVR MLP DTR 1 2 3 4 5 6 7 -0.38% -10.99% 63.81% -24.09% -33.95% 65.90% -43.05% -11.94% -64.68% -50.83% -9.64% -7.43% -9.11% -9.78% 72.53% 60.94% 66.42% 65.23% -35.99% -19.64% 66.32% of the latitude is generally higher than longitude with the same amount of training. But the DTR divides the feature space into several units, and each unit has a specific output, which is not affected by the data distribution range. In addition to evaluating the model with the R2 score. In our paper, we calculate the difference between the prediction and the true value of the proposed three regression algorithms as the error, and the results are shown in Fig. 11. The results show that the decision tree regression has the best performance among the three regression algorithms. The average longitude error of the seven spacecraft debris landing points is approximately 0.96◦, the average latitude error is approximately 0.53◦, and the average velocity error is 0.008m/s. For all machine learning 16 Hu Gaoa et al. (a) (b) Fig. 10: Latitude and longitude distribution of samples in the dataset. Figures (a) show the distribution of longitude. Figure (b) the distribution of latitude. regression algorithms, because the range of longitude data in the dataset is larger than the range of latitude data, the longitude error of the spacecraft debris impact points is generally higher than the latitude error. Due to the small range of spacecraft debris landing velocities in the dataset, although the accuracy of the model is not high, the prediction error is still small. Taking the velocity prediction models of debris numbers 1 and 5 as examples, although the prediction accuracy of the landing velocity of debris number 1 is higher than 5 when using the SVR model, in our dataset, the landing speed scope of debris 5 is more concentrated, and the range is not large. Therefore, the model prediction results are also relatively concentrated in a small scope, and the prediction error is smaller for debris 5 than for debris 1. On the basis of the reentry risk defined in our paper, the final degree of danger is calculated. According to the law of Bradford, the debris danger is divided into five degrees from low to high with a step size of 0.2, which are named negligible risk, low risk, medium risk, high risk and very high risk, respectively. We use the five colours of green, blue, yellow, orange and red to respectively represent the five degrees of danger and then plot colour gradient concentric circles on the map with the spacecraft debris landing points as the centre points. The higher the degree of danger is, the larger the circle, which means a larger area of risk on the ground. The results are shown in Fig. 12. Finally, we calculate the running times of the three machine learning regression algorithms, including the training time required by the longitude and latitude prediction model of spacecraft debris landing points, the training time required by the velocity model and the total running time required by the program. In this paper, we calculate the means and standard deviations of the three regression algorithms after five trials each. Table 8 shows that the model training time and the total running time of the program using the decision tree regression algorithm have the lowest standard deviation, and the mean training time of the longitude and latitude prediction model is lower for the decision tree regression algorithm than the other two regression algorithms; furthermore, the mean velocity model training time and the mean total running time of the program using the SVR are the lowest. 5 Conclusion In this paper, we present a reetry risk and safety assessment of spacecraft debris based on machine learning. Compared with traditional physical modelling methods, the introduction of machine learning algorithms does not need to consider the re-entry process of intermediate spacecraft debris. And many experiments prove that the proposed method can obtain high accuracy prediction results in at least 15 seconds and make safety level warning more real-time. We compare the support vector regression model, the decision tree regression model and the multilayer perceptron regression model with three machine learning regression algorithms used to predict the spacecraft debris landing points according to the accuracy of the longitude, latitude and velocity. And we found that the decision regression tree had the highest prediction accuracy Reentry Risk and Safety Assessment of Spacecraft Debris Based on Machine Learning 17 What's more, we redefined the degrees of spacecraft reentry risk and the economy, population and kinetic energy of the debris landing points are taken as risk factors. Then, according to the law of Bradford, we divided the debris risk into 5 equal parts with a step size of 0.2, and formulated the degree of debris risk. In future work, we will expand the dataset size and then introduce deep learning methods to the prediction of the spacecraft reentry process. Declarations Funding This research is supported by the National Key Research and Development Program of China under Grant No.2020YFC1523303?the National Natural Science Foundation of China under Grant No. 61672102, No.61073034, No. 61370064 and No. 60940032; the National Social Science Foundation of China under Grant No.BCA150050; the Program for New Century Excellent Talents in the University of Ministry of Education of China under Grant No. NCET-10-0239; the Open Project Sponsor of Beijing Key Laboratory of Intelligent Communication Software and Multimedia under Grant No. ITSM201493. (a) (b) (c) (d) Fig. 11: The prediction error. Figures (a), (b), and (c) show the longitude and latitude errors predicted by the SVR, MLP and DTR machine learning regression algorithms, respectively. Figure (d) shows the comparison of the speed errors predicted by the SVR, MLP and DTR. 18 Hu Gaoa et al. (a) (b) Fig. 12: The landing points of spacecraft debris. Figure (a) shows the landing map of the seven pieces of spacecraft debris. Figure (b) shows the degrees of danger of the spacecraft debris. Table 8: The mean and standard deviation of the model training time and total program running time (seconds). The best results are highlighted. Longitude and latitude prediction model training time mean std SVR 0.8481 0.0156 Velocity prediction model training time mean 0.0197 std 0.0107 MLP DTR 15.0535 0.0146 1.2231 9.5358 0.8293 0.003 0.0295 0.0069 Total program run time mean 9.8294 35.5315 10.5027 std 1.2868 1.2103 0.5207 Conflicts of interest Not applicable References 1. Tang Xuehai, Wang Jun, and Xiao Zhiming. Landing point prediction ballistic reetry spacecraft. Journal of Nanjing University of Aeronautics and Astronautics, 51(S1):145–148, 2019. 2. Seong-Hyeon Park, Hae-Dong Kim, and Gisu Park. Orbit, orbital lifetime, and reentry survivability estimation for orbiting objects. Advances in Space Research, 62:3012–3032, 2018. 3. Tobias Lips and Bent Fritsche. A comparison of commonly used re-entry analysis tools. Acta Astronautica, 57:312–323, 2005. 4. Hu Cuijuan, Ding Feng, Zuo Shilei, Liu Xiaozhong, and Xiong Qian. Research on integated environmental risk assessment methodology based on vulnerability analysis. Environmental Engineering, 34(01):112–116, 2016. 5. Liang Jie, Li Zhihui, Li Xuguo, and Du Boqiang. Dsmc approach for simulating aerodynamic thermal characteristics during large-scale spacecraft reetry. Manned Spaceflight, 26(05):537–542, 2020. 6. Okchul Jung, Jaedong Seong, Youyeun Jung, and Hyochoong Bang. Recurrent neural network model to predict re-entry trajectories of uncontrolled space objects. Advances in Space Research, 68:2515–2529, 2021. 7. S Sanvido and S Lemmens. A machine learning approach for heo break-up predictions and it impact on observations thereof. In ESA 1st NEO and Debris Detection Conference, 2019. 8. J N Opiela, E Hillary, and D O Whitlock. Das user's guide,version 2. 0. In Orbital Debris Program Office, NASA Johnson Space Center, 2007. Reentry Risk and Safety Assessment of Spacecraft Debris Based on Machine Learning 19 9. S A Bouslog, B P Rose, and C B Madden. Space debris reentry risk analysis. In 32nd Aerospace Sciences Meeting and Exhibit, 1994. 10. B Fritsche, H Klinkrad, and A Kashkovsky. Spacecraft dis- integration during uncontrolled atmospheric re-entry. Acta Astronautics, 47:513–522, 2000. 11. Seong-Hyeon Park, Javier Navarro Laboulais, P ́en ́elope Leyland, and Stefano Mischler. Re-entry survival analysis and ground risk assessment of space debris considering by-products generation. Acta Astronautica, 179:604–618, 2021. 12. Tobias Lips, Bent Fritsche, G Koppenwallner, and H Klinkrad. Spacecraft destruction during re-entry – latest results and development of the scarab software system. Advances in Space Research, 34:1055–1060, 2004. 13. Bent Fritsche, Tobias Lips, and G Koppenwallner. Analytical and numerical re-entry analysis of simple-shaped objects. Acta Astronautica, 60:737–751, 2007. 14. J Annaloro, S Galera, C Thiebaut, M Spel, P Van Hauwaert, G Grossir, S Paris, O Chazot, and P Omaly. Aerothermodynamics modelling of complex shapes in the debrisk atmospheric reentry tool: Methodology and validation. Acta Astronautica, 171:388–402, 2020. 15. I P Fuentes, D Bonetti, F Letterio, G V de Miguel, G B Arnao, P Palomo, C Parigini, S Lemmens, T Lips, and R Kanzler. Upgrade of esa's debris risk assessment and mitigation analysis (drama) tool: Spacecraft entry survival analysis module. Acta Astronautica, 158:148–160, 2019. 16. Karen Gundy-Burlet, Johann Schumann, Tim Menzies, and Tony Barrett. Parametric analysis of antares re-entry In In 9th International Symposium on guidance algorithms using advanced test generation and data analysis. Artifical Intelligence, Robotics and Automation in Space, 2007. 17. Lei Yutian, Yang Jiachen, Man Jiabao, and Xi Meng. Adaptive spacecraft situation analysis system. Astronautical Systems Engineering Technology, 4(01):56–62, 2020. 18. Hu Ruifeng, Wu Ziniu, Qu Xi, and Wang Xiang. Debris reentry and ablation prediction and ground risk assessment software system. Acta Aeronautica et Astronautica Sinica, 32(03):390–399, 2011. 19. Liai Wang, Xudong Zhou, Xinkai Zhu, Zhaodi Dong, and Wenshan Guo. Estimation of biomass in wheat using random forest regression algorithm and remote sensing data. The Crop Journal, 4(3):212–219, 2016. 20. Marcin Czajkowski and Marek Kretowski. The role of decision tree representation in regression problems – an evolutionary perspective. Applied Soft Computing, 48:458–475, 2016. 21. Xu Min, Watanachaturaporn Pakorn, Pramod K.Varshney, and Manoj K.Arorab. Decision tree regression for soft classification of remote sensing data. Remote Sensing of Environment, 97:322–336, 2005. 22. Santosh Singh Rathore and Sandeep Kumar. A decision tree regression based approach for the number of software faults prediction. ACM SIGSOFT Software Engineering Notes, 41:1–6, 2016. 23. Geoffrey K.F.Tso and Kelvin K.W.Yau. Predicting electricity energy consumption: A comparison of regression analysis, decision tree and neural networks. Energy, 32:1761–1768, 2007. 24. Wei Hongning. Comparison among methods of decision tree pruning. Journal of southwest jiaotong university, 40(01):44–48, 2005. 25. I ̧sık Yilmaz and Oguz Kaynar. Multiple regression, ann (rbf, mlp) and anfis models for prediction of swell potential of clayey soils. Expert Systems with Applications, 38:5958–5966, 2011. 26. Jung-Guk Park and Sungho Jo. Approximate bayesian mlp regularization for regression in the presence of noise. Neural Networks, 83:75–85, 2016. 27. Bekir Karlik and A. Vehbi Olgac. Performance analysis of various activation functions ingeneralized mlp architec- tures of neural networks. In International Journal of Artificial Intelligence And Expert Systems (IJAE), volume 1, 2011. 28. LAN Shengwei, LIU Sen, REN Leisheng, LI Yi, and HUANG Jie. Spacecraft collision fragmentation analysis software sfa 2.0 and its applications. Spacecraft Environment Engineering, 33(5):463–469, 2016. 29. Center for International Earth Science Information Network (CIESIN). Documentation for the gridded population of the world, version 4 (gpwv4), revision 11 data sets. https://doi.org/10.7927/H45Q4T5F, 2018. 30. B.C. BROOKES. Theory of the bradford law. https://doi.org/10.1108/eb026641, 33, 1977. 31. Fabian Pedregosa, Ga ̈el Varoquaux, Alexandre Gramfort, Vincent Michel, Bertrand Thirion, Olivier Grisel, Math- ieu Blondel, Peter Prettenhofer, Ron Weiss, Vincent Dubourg, Jake Vanderplas, Alexandre Passos, David Cour- napeau, Matthieu Brucher, Matthieu Perrot, and ́Edouard Duchesnay. Scikit-learn: Machine learning in python. Journal of Machine Learning Research, 12:2825–2830, 2011.
http://arxiv.org/abs/2302.10527v2
2023-02-22T01:20:07
2023-02-21T08:53:56
HierCat: Hierarchical Query Categorization from Weakly Supervised Data at Facebook Marketplace
Query categorization at customer-to-customer e-commerce platforms like Facebook Marketplace is challenging due to the vagueness of search intent, noise in real-world data, and imbalanced training data across languages. Its deployment also needs to consider challenges in scalability and downstream integration in order to translate modeling advances into better search result relevance. In this paper we present HierCat, the query categorization system at Facebook Marketplace. HierCat addresses these challenges by leveraging multi-task pre-training of dual-encoder architectures with a hierarchical inference step to effectively learn from weakly supervised training data mined from searcher engagement. We show that HierCat not only outperforms popular methods in offline experiments, but also leads to 1.4% improvement in NDCG and 4.3% increase in searcher engagement at Facebook Marketplace Search in online A/B testing.
[ "Yunzhong He", "Cong Zhang", "Ruoyan Kong", "Chaitanya Kulkarni", "Qing Liu", "Ashish Gandhe", "Amit Nithianandan", "Arul Prakash" ]
10.1145/3543873.3584622
[ { "@title": "doi", "@href": "http://dx.doi.org/10.1145/3543873.3584622", "@rel": "related", "@type": null }, { "@title": null, "@href": "http://arxiv.org/abs/2302.10527v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10527v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.IR", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.IR", "cs.AI", "cs.LG" ]
HierCat: Hierarchical Query Categorization from Weakly Supervised Data at Facebook Marketplace Yunzhong He1, Cong Zhang1, Ruoyan Kong2, Chaitanya Kulkarni1, Qing Liu1, Ashish Gandhe1, Amit Nithianandan1, Arul Prakash1 1Meta, 2University of Minnesota United States {yunzhong,conzhang,chaitanya2,qingl,ashigan,anithian,arulprakash}@meta.com [email protected] 3 2 0 2 b e F 2 2 ] R I . s c [ 2 v 7 2 5 0 1 . 2 0 3 2 : v i X r a ABSTRACT Query categorization at customer-to-customer e-commerce plat- forms like Facebook Marketplace is challenging due to the vague- ness of search intent, noise in real-world data, and imbalanced training data across languages. Its deployment also needs to con- sider challenges in scalability and downstream integration in order to translate modeling advances into better search result relevance. In this paper we present HierCat, the query categorization system at Facebook Marketplace. HierCat addresses these challenges by leveraging multi-task pre-training of dual-encoder architectures with a hierarchical inference step to effectively learn from weakly supervised training data mined from searcher engagement. We show that HierCat not only outperforms popular methods in offline experiments, but also leads to 1.4% improvement in NDCG and 4.3% increase in searcher engagement at Facebook Marketplace Search in two weeks of online A/B testing. CCS CONCEPTS • Information systems → Query intent; Query representa- tion; • Applied computing → Online shopping. KEYWORDS Query understanding, e-commerce, information retrieval ACM Reference Format: Yunzhong He1, Cong Zhang1, Ruoyan Kong2, Chaitanya Kulkarni1, Qing Liu1, Ashish Gandhe1, Amit Nithianandan1, Arul Prakash1. 2023. HierCat: Hierarchical Query Categorization from Weakly Supervised Data at Face- book Marketplace. In Companion Proceedings of the ACM Web Conference 2023 (WWW '23 Companion), April 30-May 4, 2023, Austin, TX, USA. ACM, New York, NY, USA, 5 pages. https://doi.org/10.1145/3543873.3584622 1 INTRODUCTION Query categorization refers to the task of mapping a search query to a predefined product taxonomy, which usually consists of a Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]. WWW '23 Companion, April 30-May 4, 2023, Austin, TX, USA © 2023 Copyright held by the owner/author(s). Publication rights licensed to ACM. ACM ISBN 978-1-4503-9419-2/23/04. . . $15.00 https://doi.org/10.1145/3543873.3584622 Query Category path iPhone cases 2019 brz black 1b1b for rent Electronics//Cell Phones//Accessories//Cases Vehicles//Cars & Trucks//Coupes Housing//Property Rentals Table 1: Popular queries on Marketplace and their categories large label space organized in a hierarchical structure. It helps e- commerce search engines to understand users' shopping intents in a structured way to provide high quality search experiences. On customer-to-customer (C2C) shopping platforms like Facebook Marketplace1, query categorization can be particularly challenging due to the following observations: Noisy training data: Training query categorization models based on <query, product> engagement is a common approach to avoid needing massive amount of labeled data [1, 10, 14, 15]. However, due to how product categories are labeled and the browsy behav- ior of user, training data mined from search engagement can be heterogeneous and noisy. Vague search intent: Unlike a product listing, whose category is usually well-defined and precise, a search query's category can be vague. For example, query "used electronics" refers to a high- level category "Electronics" which is rarely predicated alone for a product listing. Internationalization: Facebook Marketplace is a global platform and aims to offer consistent search experiences across languages. However, training data mined from search engagement are natu- rally skewed towards popular languages like English. In this paper, we present HierCat, a query categorization system designed to learn from weakly supervised training data mined from search engagement. Unlike popular query categorization methods based on text classification approach [1, 3, 10, 13, 15], we introduce a dual-encoder architecture with a hierarchical inference step to leverage both the textual information of category labels and the hierarchical structure of product taxonomy. The encoder also in- corporates state-of-the-art transformer architecture pre-trained on cross-language data as well as a downstream product retrieval task. We show that this simple and effective approach can substantially reduce the noise in training data, and generalizes to unseen queries better than many popular approaches. We also share our inference- time optimizations like category embedding caching and beam search to speed up inference, and our deployment story around 1http://www.facebook.com/marketplace WWW '23 Companion, April 30-May 4, 2023, Austin, TX, USA Yunzhong He translating modeling advances to better search experiences. Hier- Cat is now powering hundreds of millions of search queries on Facebook Marketplace per day, helping users find relevant product listings of their interests. neural classification model Φ that predicts a node on the taxonomy tree given a query without considering the taxonomy structure. Formally, for a query and category node pair (q, c), and the space of categories C, we minimize the cross-entropy loss defined as 2 METHODOLOGY 2.1 Problem formulation Facebook Marketplace uses a product taxonomy system called Face- book Product Taxonomy (FPT) to categorize product items. The taxonomy consists of around six thousand categories organized in a tree structure, with maximum depth equals to six. The problem of query categorization is thus mapping a search query to the best category path on the taxonomy tree. Since a search query can be vague, a category path can end anywhere on the taxonomy tree and not necessarily on a leaf node. Formally, we model the condi- tional probability of a category path given a query P (path|query), where path is a sequence of category nodes on a taxonomy tree indexed by its level of the form {cate_Lk, cate_Lk−1, ..., cate_L1}, and cate_Lk is a category node at level k of the taxonomy tree. To avoid modeling combinatorial number of taxonomy paths, we leverage the structure of the taxonomy tree and only model the con- ditional probability of a node given its ancestors using the following factorization P ({cate_Lk, ..., cate_L1} | query) = P (cate_Lk | {cate_Lk−1, ..., cate_L1}, query) * P ({cate_Lk−1, ..., cate_L1} | query) (1) In the following sections, we will use path and category inter- changeably, both referring to the final category prediction like "Home//Furniture//Sofa". Sometimes we will use node to refer to a node on the taxonomy tree (e.g. "Sofa"). 2.2 Weakly supervised training We adopt a weakly supervised approach based on logged search engagement to train our classifiers. Specifically, we sample <query, product> pairs from 14 days of Facebook Marketplace's search en- gagement log on public content. All of the data are de-identified and aggregated, and are translated into 24 million <query, cate- gory> pairs based on a product item's category. <query, category> pairs with very low aggregation frequency are filtered out to reduce noise. Different predictions for the same search query are permit- ted because we hope to benefit from the richness of unfiltered information, especially since those labels may share some parent nodes (e.g. ,"Home//Furniture//Chair" v.s. "Home//Furniture//Sofa"). Note that at Facebook Marketplace, a product item's category label can come from the seller, model prediction, or both. Labels from seller selection have limited coverage and are not very granular, but are accurate. Model predicted labels have better coverage but lim- ited precision, especially at deeper levels. Note that this poses the challenge of heterogeneous training data for query categorization models. 2.3 Pre-trained dual-encoder classification Instead of predicting query category as conditional probabilities as in section 2.1, we first treat categorization as a classic query classification problem for simplicity. In other words, we train a L(q, ci ) = − log exp(Φ(q, ci )) (cid:205)c j ∈C exp(Φ(q, c j )) (2) For better generalization to different languages, we use a 2-layer XLM-encoder, a transformer-based language model pre-trained on large multilingual data [4] to process query text. We also repre- sent query text using character trigrams and encode it using an EmbeddingBag encoder [12], as we find that multi-granular text representation with simple trigrams helps with short head queries. The two text representations are merged via a simple attention fusion layer as illustrated in figure 1. An interesting property of the query categorization problem is that the input query often shares the same text as its desired label. For example, query "electric boat" and category "Vehicle//Boat" both contain the word "boat". Motivated by this observation, we borrow the two-tower architecture commonly used in retrieval models [11] to allow for an extra text encoder on the category labels and replace the final predication layer with the cosine similarities between query and category embeddings of dimension 128. Given that category text always come from a fixed set of six thousand categories, we only use EmbeddingBag encoder for the category tower to prevent over-fitting. 2.4 Product retrieval pre-training For the query embedding tower, we introduce an optional pre- training task based on embedding-based retrieval (EBR) of Mar- ketplace products given search queries, because empirically, we discover that EBR model training generates nicely clustered search queries [11]. For this work we adopt the Que2Search model [11] which shares a very similar text encoder architecture and is trained to minimize the cosine similarities between engaged query and product pairs. We retrain the EBR model to ensure that there is no architectural difference. 2.5 Hierarchical inference So far we treat query categorization as a flat classification problem. We discover this approach to be problematic due to the noise in user engagement data. For example, both "Cell Phones//Accessories//Cases" and "Cell Phones" are popular labels mined for query "iPhone 12", because a user could be browsing iPhone cases while shopping for an iPhone. Intuitively, both labels are useful to infer the query being a "Electronics" and "Cell Phones", but in the eyes of a normal multi-class classifier, they are just inconsistent labels. To address this problem, we introduce a hierarchical inference algorithm to re-normalize the probability mass over a taxonomy tree. As illustrated in algorithm 1, for all of the nodes on the tax- onomy tree, we assign the cosine similarity generated from the dual-encoder model to p_cate [node]. We then apply softmax over all of the leaf nodes to ensure they sum up to one. For any of the nodes at leaf-1 level, we propagate the probabilities of its chil- dren back to itself, and then apply softmax at the leaf-1 layer. We repeat this iteratively at each layer until all of the levels are HierCat: Hierarchical Query Categorization from Weakly Supervised Data at Facebook Marketplace WWW '23 Companion, April 30-May 4, 2023, Austin, TX, USA Figure 1: Model architecture up-propagated and normalized. This ensures that the joint prob- ability of all the nodes on a category path satisfies the condi- tional probability factorization we introduced in section 2.1. One caveat is that p_cate [node] still contains its original cosine sim- ilarity before probabilities from its children are added, and we believe that line 6 in algorithm 1 can be further generalized to be α ∗ p_cate [n] + SU M (p_cate [CHILDREN (p_cate [n]) to control the impact of hierarchical inference vs. the original prediction. For simplicity of evaluation, we leave α = 1 and did not tune the value in this paper. Algorithm 1: Hierarchical inference 1 Function hier_infer(nodes, p_cate): 2 Let p_cate [node] = cosine_similarity (query, node) Let levels = L[MAX _LEV ELS − 1, . . . , 0] for l ∈ levels do for n ∈ nodes [l] do p_cate [n] += SU M (p_cate [CHILDREN (p_cate [n])]) end p_cate [nodes [l]] = SOFT MAX (p_cate [[nodes [l]]) end 3 4 5 6 7 8 9 3 OFFLINE EXPERIMENTS 3.1 Experimental setup Baseline models and ablation studies. We perform ablation studies to evaluate each of our modeling choices and compare against alternative query classification methods commonly used across the industry. We compare our results against FastText multi- label classifier [2, 8] that assigns one class per-level as an hierar- chical classifier. FastText is commonly used at Meta for short text classification and the multi-label approach also achieves good per- formance in recent query classification work [1, 14]. We also test directly fine-tuning an XLM model [4], a state-of-the-art pre-trained transformer model for classification. Since the XLM-classification model is used as part of our dual-encoder architecture, it also serves as an ablation study on the new architecture we propose. In addi- tion, we experiment with combining the XLM-classification model with the multi-label approach as an alternative way to encode label hierarchy. Data and evaluation metrics. We train all of the models with the 24 million weakly supervised data described in section 2.2. For evaluation, we use a stratified sample of 173 thousand queries across different regions and languages (which were de-identified from any personal information of the users inputting the queries), and ask raters to map them to the right categories. We report micro-F1 and top five accuracy (true category matches with any one of the top five predictions) at different levels to access the model performances. Product retrieval pre-training. We run separate experiments for adding product retrieval pre-training and report the relative improvement, because it is an optional step in our system that can work with any baseline architecture. For this ablation study we use the XLM + trigram query encoder. 3.2 Ablation results As illustrated in table 2, dual-encoder architecture with hierarchical inference achieves the best performance across all levels, while hierarchical inference itself improves the performance on higher levels independent of the classification algorithm, because of its consolidation effect on higher categories by leveraging probabili- ties from their children. XLM classification model also outperforms FastText classifier possibly because of better generalization across languages [4]. In addition, pre-training on product retrieval task, as shown in table 3, significantly improves leaf-level performance but does not help with L1. Our hypothesis is that leaf-level classifica- tion requires more granular embedding representations, and thus benefits from pre-trained embeddings more. 4 ONLINE EXPERIMENTS 4.1 Serving-time optimizations We deployed HierCat on Meta's dedicated inference cloud [7] and implemented several additional optimizations in the model's pro- duction path to improve latency and quality. Embedding caching: to speed up model inference, we only de- ployed the query encoder, and the category embeddings are pre- computed and cached. During inference, we first compute the query embedding, and then loop through the cached category embeddings to obtain the logits. Finally, hierarchical inference is performed to obtain the correct probability distribution over a taxonomy tree. A query level cache is also implemented to avoid duplicate inference calls for popular queries. WWW '23 Companion, April 30-May 4, 2023, Austin, TX, USA Yunzhong He Technique L1 F1 L1 acc@5 L3 F1 L3 acc@5 L6 F1 L6 acc@5 FastText multi-label XLM classification XLM multi-label XLM classification + hierInfer Dual-encoder XLM + hierInfer 0.582 0.762 0.661 0.765 0.767 Dual-encoder XLM + hierInfer + trigram 0.774 0.866 0.869 0.874 0.907 0.907 0.913 0.176 0.339 0.241 0.344 0.388 0.363 0.389 0.416 0.376 0.426 0.516 0.514 0.165 0.233 0.195 0.233 0.259 0.237 0.357 0.315 0.303 0.315 0.369 0.366 Table 2: Results for baseline comparisons and ablation studies L1 F1 L1 acc@5 L3 F1 L3 acc@5 L6 F1 L6 acc@5 neutral neutral +3% neutral +16% +4% Table 3: Improvements from product retrieval pre-training Technique Engagement NDCG L1 & L2 category boost L3 category boost neutral +4.3% +1.4% neutral Table 4: Online A/B testing results for structured retrieval Beam search: to further speed up inference and obtain a con- sistent taxonomy path, a beam search is performed by iteratively selecting the best children for each parent nodes. In production we simply use a beam size of one for simplicity. Beam search is terminated early if the score is lower than a threshold tuned from percentile method. 4.2 Structured retrieval We leveraged HierCat in Facebook Marketplace Search to reduce the category mismatched results by emitting the per-level cate- gories as optional retrieval terms, and boosting retrieval scores upon category matches. This is done with Meta's Unicorn system [5] but can also be achieved with open-source solutions like Elas- ticsearch [6]. The term weights are tuned by applying a linear regression to predict downstream ranking scores, and boosts are given to category matches up to level three. Two weeks of online A/B testing shows that such retrieval boost significantly improves both NDCG and online user engagement, as illustrated in table 4 (metric improvements in table 4 are all relative and incremental, and L3 category boost was launched after L1 & L2 boost). Interest- ingly, we found that NDCG improved when L1 & L2 boosts were added, while engagement stayed neutral until L3 boost was added. We discovered that this is due to discrepancies between the NDCG rating guideline and user behavior - while former focused more on top level category matches, it is the L3 match, which is the median of level distributions that is driving user engagement. 4.3 Level distributions To understand the level of noise in the weakly supervised data mined from search engagement and how well our method is able to counter such noise, we examine the level distribution of query categories from logged online predictions, ground truth labels and training data as shown in figure 2. We can indeed observe a better overlay with the ground truth distribution from our production model, indicating that our method is able to de-bias its training data to be closer to ground truth. Figure 2: Level distribution comparisons 5 RELATED WORK Query classification aims to classify search queries into a set of topical space to better understand users' intents. This is gener- ally treated as a text classification problem where the input texts are short and the class space is large. For example, Liu et al. [10] proposed an extreme classification approach using a mixture of CNN and Naive Bayes classifier based on such characteristics. In e-commerce, the label space is often a product taxonomy that pos- sesses a tree structure, yet regular multi-class classification ap- proach would either treat each node as a class, or only consider the the leaf categories [1, 10, 13, 15]. Liu et al. [14] explored using multi-label FastText as a hierarchical classifier, and a back-off strat- egy to optimize the granularity-precision trade-off. Techniques to incorporate different dimensions of signals like contextual infor- mation [3, 15] and search engine feedback [1] are also explored to disambiguate search intent and augment training data. In terms of the classification algorithm, popular text classification methods like XML-CNN [9] or FastText [2, 8] are often used as a component in a query classification system [10, 14]. Weakly supervised labels mined from search logs are also explored as a data augmentation technique [1, 10, 15], while the characteristics of such data espe- cially its implication to hierarchical classification is rarely discussed to the best of our knowledge. 6 CONCLUSION In this paper we demonstrate HierCat, a query categorization sys- tem that learns from weakly supervised data by leveraging trans- former encoders pre-trained on downstream product retrieval tasks, and the hierarchical structure of an e-commerce product catalog. We show the effectiveness of each modeling choice we made through ablation studies and comparing against popular baseline methods. To the best of our knowledge, HierCat is also the first to demonstrate the effectiveness of transformer-based dual-encoder architecture in e-commerce query categorization despite that it is a rather popular architecture in information retrieval tasks [11]. We deploy HierCat on Facebook Marketplace Search, share our inference-time opti- mizations, and show through online A/B testing that it significantly improves NDCG and searcher engagement. HierCat: Hierarchical Query Categorization from Weakly Supervised Data at Facebook Marketplace WWW '23 Companion, April 30-May 4, 2023, Austin, TX, USA REFERENCES [1] Ali Ahmadvand, Sayyed M. Zahiri, Simon Hughes, Khalifa Al Jadda, Surya Kallumadi, and Eugene Agichtein. 2021. APRF-Net: Attentive Pseudo-Relevance Feedback Network for Query Categorization. CoRR abs/2104.11384 (2021). arXiv:2104.11384 https://arxiv.org/abs/2104.11384 [2] Piotr Bojanowski, Edouard Grave, Armand Joulin, and Tomás Mikolov. 2016. Enriching Word Vectors with Subword Information. CoRR abs/1607.04606 (2016). arXiv:1607.04606 http://arxiv.org/abs/1607.04606 [3] Huanhuan Cao, Derek Hao Hu, Dou Shen, Daxin Jiang, Jian-Tao Sun, Enhong Chen, and Qiang Yang. 2009. Context-Aware Query Classification. In Proceedings of the 32nd International ACM SIGIR Conference on Research and Development in Information Retrieval (Boston, MA, USA) (SIGIR '09). Association for Computing Machinery, New York, NY, USA, 3–10. https://doi.org/10.1145/1571941.1571945 [4] Alexis Conneau, Kartikay Khandelwal, Naman Goyal, Vishrav Chaudhary, Guil- laume Wenzek, Francisco Guzmán, Edouard Grave, Myle Ott, Luke Zettle- moyer, and Veselin Stoyanov. 2019. Unsupervised Cross-lingual Representa- tion Learning at Scale. CoRR abs/1911.02116 (2019). arXiv:1911.02116 http: //arxiv.org/abs/1911.02116 [5] Michael Curtiss, Iain Becker, Tudor Bosman, Sergey Doroshenko, Lucian Grijincu, Tom Jackson, Sandhya Kunnatur, Soren Lassen, Philip Pronin, Sriram Sankar, Guanghao Shen, Gintaras Woss, Chao Yang, and Ning Zhang. 2013. Unicorn: A System for Searching the Social Graph. Proc. VLDB Endow. 6, 11 (Aug. 2013), 1150–1161. https://doi.org/10.14778/2536222.2536239 [6] Clinton Gormley and Zachary Tong. 2015. Elasticsearch: The Definitive Guide (1st ed.). O'Reilly Media, Inc. [7] Kim Hazelwood, Sarah Bird, David Brooks, Soumith Chintala, Utku Diril, Dmytro Dzhulgakov, Mohamed Fawzy, Bill Jia, Yangqing Jia, Aditya Kalro, James Law, Kevin Lee, Jason Lu, Pieter Noordhuis, Misha Smelyanskiy, Liang Xiong, and Xiaodong Wang. 2018. Applied Machine Learning at Facebook: A Datacenter Infrastructure Perspective. In 2018 IEEE International Symposium on High Perfor- mance Computer Architecture (HPCA). 620–629. https://doi.org/10.1109/HPCA. 2018.00059 [8] Armand Joulin, Edouard Grave, Piotr Bojanowski, and Tomas Mikolov. 2017. Bag of Tricks for Efficient Text Classification. In Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 2, Short Papers. Association for Computational Linguistics, Valencia, Spain, 427–431. https://www.aclweb.org/anthology/E17-2068 [9] Jingzhou Liu, Wei-Cheng Chang, Yuexin Wu, and Yiming Yang. 2017. Deep Learning for Extreme Multi-Label Text Classification. In Proceedings of the 40th International ACM SIGIR Conference on Research and Development in Information Retrieval (Shinjuku, Tokyo, Japan) (SIGIR '17). Association for Computing Ma- chinery, New York, NY, USA, 115–124. https://doi.org/10.1145/3077136.3080834 [10] Xianjing Liu, H. Zhang, Mingkuan Liu, and Alan Lu. 2019. System Design of Extreme Multi-label Query Classification using a Hybrid Model. In eCOM@SIGIR. [11] Yiqun Liu, Kaushik Rangadurai, Yunzhong He, Siddarth Malreddy, Xunlong Gui, Xiaoyi Liu, and Fedor Borisyuk. 2021. Que2Search: Fast and Accurate Query and Document Understanding for Search at Facebook. In Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery and Data Mining (Virtual Event, Singapore) (KDD '21). Association for Computing Machinery, New York, NY, USA, 3376–3384. https://doi.org/10.1145/3447548.3467127 [12] Adam Paszke, S. Gross, Soumith Chintala, Gregory Chanan, E. Yang, Zach DeVito, Zeming Lin, Alban Desmaison, L. Antiga, and Adam Lerer. 2017. Automatic differentiation in PyTorch. [13] Michael Skinner and Surya Kallumadi. 2019. E-commerce Query Classifica- tion Using Product Taxonomy Mapping: A Transfer Learning Approach. In eCOM@SIGIR. [14] Hang Yu and Lester Litchfield. 2020. Query Classification with Multi-Objective Backoff Optimization. In Proceedings of the 43rd International ACM SIGIR Con- ference on Research and Development in Information Retrieval (Virtual Event, China) (SIGIR '20). Association for Computing Machinery, New York, NY, USA, 1925–1928. https://doi.org/10.1145/3397271.3401320 [15] Jiashu Zhao, Hongshen Chen, and Dawei Yin. 2019. A Dynamic Product-Aware Learning Model for E-Commerce Query Intent Understanding. In Proceedings of the 28th ACM International Conference on Information and Knowledge Management (Beijing, China) (CIKM '19). Association for Computing Machinery, New York, NY, USA, 1843–1852. https://doi.org/10.1145/3357384.3358055
http://arxiv.org/abs/2302.10524v1
2023-02-21T08:52:36
2023-02-21T08:52:36
LU-Net: Invertible Neural Networks Based on Matrix Factorization
LU-Net is a simple and fast architecture for invertible neural networks (INN) that is based on the factorization of quadratic weight matrices $\mathsf{A=LU}$, where $\mathsf{L}$ is a lower triangular matrix with ones on the diagonal and $\mathsf{U}$ an upper triangular matrix. Instead of learning a fully occupied matrix $\mathsf{A}$, we learn $\mathsf{L}$ and $\mathsf{U}$ separately. If combined with an invertible activation function, such layers can easily be inverted whenever the diagonal entries of $\mathsf{U}$ are different from zero. Also, the computation of the determinant of the Jacobian matrix of such layers is cheap. Consequently, the LU architecture allows for cheap computation of the likelihood via the change of variables formula and can be trained according to the maximum likelihood principle. In our numerical experiments, we test the LU-net architecture as generative model on several academic datasets. We also provide a detailed comparison with conventional invertible neural networks in terms of performance, training as well as run time.
[ "Robin Chan", "Sarina Penquitt", "Hanno Gottschalk" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10524v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10524v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.NE" ]
LU-Net: Invertible Neural Networks Based on Matrix Factorization 1st Robin Chan∗ Machine Learning Group Bielefeld University Bielefeld, Germany [email protected] 1st Sarina Penquitt∗ IZMD University of Wuppertal Wuppertal, Germany [email protected] 3rd Hanno Gottschalk IZMD University of Wuppertal Wuppertal, Germany [email protected] 3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 4 2 5 0 1 . 2 0 3 2 : v i X r a Abstract-LU-Net is a simple and fast architecture for invert- ible neural networks (INN) that is based on the factorization of quadratic weight matrices A = LU, where L is a lower triangular matrix with ones on the diagonal and U an upper triangular matrix. Instead of learning a fully occupied matrix A, we learn L and U separately. If combined with an invertible activation function, such layers can easily be inverted whenever the diagonal entries of U are different from zero. Also, the computation of the determinant of the Jacobian matrix of such layers is cheap. Consequently, the LU architecture allows for cheap computation of the likelihood via the change of variables formula and can be trained according to the maximum likelihood principle. In our numerical experiments, we test the LU-net architecture as generative model on several academic datasets. We also provide a detailed comparison with conventional invertible neural networks in terms of performance, training as well as run time. Index Terms-generative models • invertible neural networks • normalizing flows • LU matrix factorization • LU-Net I. INTRODUCTION In recent years, learning generative models has emerged as a major field of AI research [1]–[3]. In brief, given N i.i.d. j=1 of a RQ-valued random variable X ∼ PX, examples {Xj}N the goal of a generative model is to learn the data distribution PX while having only access to the sample {Xj}N j=1. Having knowledge about the underlying distribution of observed data allows for e.g. identifying correlations between observations. Common downstream tasks of generative models then include 1) density estimation, i.e. what is the probability of an ob- servation x under the distribution PX, and 2) sampling, i.e. generating novel data points xnew approximately following data distribution PX. Early approaches include deep Boltzmann machines [4], [5], which are energy-based models motivated from statisti- cal mechanics and which learn unnormalized densities. The expressive power of such models is however limited and sampling from the learned distributions becomes intractable even in moderate dimensions due to the computation of a normalization constant, for which the (slow) Markov chain Monte Carlo method is often used instead. On the contrary, autoregressive models [6]–[8] learn tractable distributions by relying on the chain rule of proba- bility, which allows for factorizing the density of X over its Q ∗ equal contribution dimensions. In this way, the likelihood of data can be evaluated easily, yielding promising results for density estimation and sampling by training via maximum likelihood. Nonetheless, sampling using autoregressive models still remains computa- tionally inefficient given the sequential nature of the inference step over the dimensions. Generative adversarial networks (GANs) avoid the just mentioned drawback by learning a generator in a minimax game against a discriminator [1], [9]. Here, both the generator and discriminator are represented by deep neural networks. In this way, the learning process can be conducted without an explicit formulation of the density of the distribution PX and therefore can be considered as likelihood-free approach. While GANs have shown successful results on generating novel data points even in high dimensions, the absence of an expression for the density makes them unsuitable for density estimation. Also variational autoencoders (VAEs) have shown fast and successful sampling results [2], [10], [11]. These models consist of an encoder and a decoder part, which are both based on deep neural network architectures. The encoder maps data points {Xj}N j=1 to lower dimensional latent representations, which define variational distributions. The decoder subse- quently maps samples from these variational distributions back to input space. Both parts are trained jointly by maximizing the evidence lower bound (ELBO), i.e. providing a lower bound for the density. More recently, diffusion models have gained increased popularity [12]–[15] given their spectacular results. In the forward pass, this type of model gradually adds Gaussian noise to data points. Then, in the backward pass the original input data is recovered from noise using deep neural networks, i.e. representing the sampling direction of diffusion models. However, sampling requires the simulation of a multi stage stochastic process, which is computationally slow compared to simply applying a map. Moreover, just like VAEs, diffu- sion models do not provide a tractable computation of the likelihood. By training using ELBO, they at least provide a lower bound for the density. Another type of generative models are Normalizing flows [3], [16]–[22], which allow for efficient and exact density estimation as well as sampling of high dimensional data. These models learn an invertible transformation f : RQ → RQ 1 for X ∼ PX such that the distribution f−1(Z) is as close as possible to the target distribution PX. Here, Z follows a simple prior distribution PZ that is easy to evaluate densities with and easy to sample from, such as e.g. multivariate standard normal distribution. Hence, f−1 represents the generator for the unknown (and oftentimes complicated) distribution PX. As normalizing flows are naturally based on the change of variables formula pX(x) = pZ(f(x)) * (cid:12) (cid:12) det (Jf(x)) (cid:12) (cid:12), (1) with X = f−1(Z), this expression can also be used for exact probability density evaluation and likelihood based learning. In this way, normalizing flows offer impressive generative performance along with an explicit and tractable expression of the density. Despite the coupling layers in normalizing flows being rather specific, it has been shown recently that their expressive power is universal for target measures having a density on the target space RD [21]. Note however that multi- ple such coupling layers are usually chained for an expressive generative model. These layers are typically parameterized by the outputs of neural networks and therefore normalizing flows can require considerable computational resources. In this work, we propose LU-Net: an alternative to existing invertible neural network (INN) architectures motivated by the positive properties of normalizing flows. The major advantage of LU-Net is based on is the simplicity of its design. It the elementary insight that a fully connected layer of a feed forward neural network is a bijective map from RQ → RD, if and only if (a) the weight matrix is quadratic, i.e. Q = D, (b) the weight matrix is of full rank and (c) the employed activation function maps R to itself bijectively. A straight forward idea is then to fully compose a neural network of such invertible layers and learn a transformation f as in Eq. (1). However, it can be computationally expensive to actually invert the just described INN, especially if required during training. Due to the size of weight matrices and the fact that they can be fully occupied, the computational complexity for the inversion scales as O(M × D3), where M is the depth and D the width of the proposed INN. The same complexity also holds for the computation of the determinant, which occurs in the computation of the likelihood. Both tasks, inversion and computation of the determinant, can be based on the LU-decomposition, where a quadratic matrix is factorized in a lower triangular matrix with ones on the diagonal and an upper triangular matrix with nonzero diagonal entries. Using this factorization inversion becomes of order O(M × D2) and computation of the determinant of O(M × D). In the LU- Net architecture, we therefore enforce the weight matrices to be of lower or upper triangular shape and keep this shape fixed during the entire training process. Consequently, a single fully connected layer x (cid:55)→ Ax + b is decomposed into two layers x (cid:55)→ Ux (cid:55)→ LUx + b, where the weight matrices L and U are "masked" on the upper and lower triangular positions, respectively. This simple architecture of LU-Net however comes with a limitation, that is universal approximation. The classical type of universal approximation theorems deal with a fixed depth and an arbitrary width of neural networks [23]–[25]. Obviously, these theorems cannot be applied to LU-Net due its bijectivity constraint. More recent universal approximation theorems deal with a fixed width and an arbitrary depth [26]– [29]. But even in the weak sense of Lp-distances, a network requires a width of at least D + 1 [29] to be a universal approximator. Thus, the LU-Net just misses the property by one dimension. One could imagine that the missing dimension in the width of LU-Net becomes less relevant the higher dimensional the problem is, so that the difference between width D and D + 1 becomes marginal. Nevertheless, also for dimensions as low as D = 2, we provide numerical evidence that the expressivity of LU-Net still achieves reasonable quality in density estimation. Moreover, we also present reasonable results using LU-Net for the popular task of generative modeling of images, which includes density estimation and sampling. In a quantitative comparison as suggested by [30], LU-Net achieves a consistent advantage in terms of the negative log likelihood metric when compared to the widely used RealNVP INN architecture [3] with about the same number of parameters. In our experiments we further observe that training LU-Net is computationally considerably cheaper than training the just mentioned coupling layer based normalizing flow. This also points to the particular suitability of LU-Net as base model for rapid prototyping. Overall, LU-Net provides a simple and efficient framework of an INN. Due to its simplicity, this model is applicable to a variety of problems with data of different forms. This is in contrast to other generative models, e.g. normalizing flows, which are often particularly designed for a specific application such as image generation. The content of this paper is structured as follows: in Sec. II we describe the LU-Net architecture with details on computing the density and likelihood. Numerical results including experiments on the image datasets MNIST [31] and Fashion-MNIST [32] follow in Sec. III. Finally, in Sec. IV we conclude our article and give recommendations for future research directions. Additionally, we report evaluations on condition num- bers of the LU-layers and on the closeness of the distri- bution in the normalizing direction of LU-Net to a mul- tivariate standard normal distribution in Appendix A and Appendix B, the nu- is publicly merical experiments presented in this paper available on GitHub: https://github.com/spenquitt/LU-Net- Invertible-Neural-Networks. respectively. The entire code for II. LU-NET ARCHITECTURE AND THE LIKELIHOOD Fully connected neural networks are the most basic models for deep learning, which can be applied to various applications. This generality property is what we also aim for invertible neural networks in the context of probabilistic generative modeling. To this end, we have to ensure that the model is bijective and that the inversion as well as computation of the likelihood are both tractable. 2 U L b Φ Φ−1 −b L−1 U−1 (a) normalizing sequence: x (cid:55)→ Ux (cid:55)→ LUx (cid:55)→ LUx + b (cid:55)→ Φ(LUx + b) = f(x) =: z (b) generating sequence: z (cid:55)→ Φ−1(z) (cid:55)→ Φ−1(z) − b (cid:55)→ L−1(Φ−1(z) − b) (cid:55)→ U−1L−1(Φ−1(z) − b) = f −1(z) = x Fig. 1: Illustration of the LU-Net design with one LU layer. Here, (a) represents the forward or "normalizing" direction and (b) the reversed or "generating" direction. Note that the weights are shared and that (cid:0)f−1 ◦ f(cid:1) (x) = x. The bijectivity constraint in fully connected neural networks can easily be fulfilled by using a bijective activation function and restricting the weight matrices to be quadratic and of full rank. However, the inversion and computation of the determinant for the computation of the likelihood, cf. Eq. (1), of fully occupied matrices remain computationally expensive with a cubic complexity. To address this problem, we propose to directly learn the LU factorization replacing the weight matrices in fully connected layers without a loss in model capacity. This forms the building block of our proposed LU- Net, which we explain in more details in what follows. A. LU Factorization The LU factorization is a common method to decompose any square matrix A ∈ RD×D into a lower triangular matrix L ∈ RD×D with ones on the diagonal and in an upper triangular matrix U ∈ RD×D with non-zero diagonal entries. Then, the matrix A can be rewritten as 0 u1,1     1 A = LU =   . . .     1 0 . . .   (2) uD,D with ui,i (cid:54)= 0 ∀ i = 1, . . . , D. One popular application of this factorization is e.g. solving linear equation systems. We use this factorization to replace fully occupied weight matrices in fully connected layers of neural networks. Given Eq. (2) the computation of A−1 and det(A) become notably more efficient with time complexities of order O(D2) and O(D), respectively, instead of O(D3) without the LU decomposition. B. LU-Net Architecture In the following, let x ∈ RD denote some D-dimensional input, i.e. each layer of LU-Net will be a map RD → RD. Further, let M ≥ 2 specify the number of LU layers. In each layer we apply two linear transformations to some input x, which is then followed by a (non-linear) transfor- 3 (a) leaky softplus function with varying slopes α (b) leaky softplus (α = 0.1), its derivative and inverse Fig. 2: Illustration of (a) different variants of the leaky softplus function as well as (b) its derivative and inverse. We refer to Eq. (4) for the formula of the leaky softplus function. mation. More precisely, in one LU-Net layer we apply the sequence x (cid:55)→ Ux (cid:55)→ LUx + b (cid:55)→ Φ(LUx + b), yielding f(m)(x) = Φ(m) (cid:16) L(m)U(m)x + b(m)(cid:17)      = φ(m) (cid:16) (L(m)U(m)x)1 + b(m) 1 ... (L(m)U(m)x)D + b(m) D φ(m) (cid:16) (cid:17)      (cid:17) as the output of the m-th LU layer for all m = 1, . . . , M, see also Fig. 1a. Here, L and U contain learnable weights and have a fixed shape as in Eq. (2). b ∈ RD is the learnable bias and Φ (x) = (φ(x1), . . . , φ(xD)) (cid:124) , φ : R → R (3) the real-valued activation function that is applied element- wise. Chaining multiple such LU layers together, we obtain f(x) = (cid:16) f(M) ◦ f(M−1) ◦ * * * ◦ f(1)(cid:17) (x), f : RD → RD as overall expression for the forward direction of LU-Net, i.e. the "normalizing'' direction, cf. Eq. (1). C. Activation Functions The choice of activation function φ is crucial for the invertibility but also flexibility of our model f. In LU-Net we employ a ReLU-like non-linear activation function, which we term leaky softplus and define as LeakySoftplus(x) := αx + (1 − α) ln(1 + exp(x)) (4) with α ∈ (0, 1), see also Fig. 2. As the name suggests, this is a combination of the leaky ReLU and softplus function. Although these two latter functions are both invertible, they have practical drawbacks. Equipped with leaky ReLU the LU- Net would suffer from a vanishing gradient in the backprop- gation step during training (as the second derivative will be needed when maximizing the likelihood, cf. Eq. (1)). This is not the case for the softplus function, however the domain of its inverse only contains R+, the positive real values, thus clearly restricting the possible outputs of LU layers. The leaky softplus function circumvents those aforemen- tioned limitations, which is why we choose this activa- tion function for all hidden layers in our proposed LU- i.e. φ(m)(x) = LeakySoftplus(x) with α = 0.1 for all Net, m = 1, . . . , M − 1. As we will deal with regression problems, we employ no activation in the final layer, i.e. φ(M)(x) = x is the identity map. D. Inverse LU-Net If all previously described requirements for the inversion of LU-Net are fulfilled, each layer can be reversed as f(m)−1 (z) = U(m)−1 L(m)−1 (cid:16) Φ−1(z) − b(m)(cid:17) with φ(cid:48)(m) being the derivative of the m-th LU layer's activa- tion function φ(m). Considering now again the chain rule of calculus and taking into account Eq. (6), Eq. (7) as well as Eq. (8), we obtain the following final expression for the negative log likelihood as training loss function: − ln L (θ|D) = 1 2 * N * D * ln(2π) + 1 2 N (cid:88) D (cid:88) n=1 d=1 fd(x(n)|θ)2 N (cid:88) M (cid:88) D (cid:88) − ln φ(cid:48)(m) (cid:16) (L(m)U(m)x(n))d + b(m) d (cid:17) (9) for some input z ∈ RD and for all LU layers m = 1, . . . , M. the reversed LU-Net the overall expression for Then, f−1 : RD → RD is given by f−1(z) = (cid:16) f(1)−1 ◦ * * * ◦ f(M−1)−1 ◦ f(M)−1(cid:17) (z) and represents the "generating direction", see also Fig. 1b. Note that both f and f−1 share their weights and it holds (cid:0)f−1 ◦ f(cid:1) (x) = x for any input x ∈ RD even without any training. E. Training via Maximum Likelihood Given a dataset D = {x(n)}N n=1, containing N independently drawn examples of some random variable X ∼ PX, our training objective is then to maximize the likelihood L (θ|D) = N (cid:89) pX(x(n)) (5) n=1 where pX : RD → R denotes the (unknown) probability den- sity function corresponding to the target distribution PX and θ = {U(m), L(m), b(m)}M m=1 the set of model parameters of LU- Net. By defining the model function f(*|θ) of LU-Net to be the invertible transform such that X = f−1(Z|θ) ⇔ Z = f(X|θ), where Z ∼ PZ is another random variable following a simple prior distribution, we can use the change of variables formula to rewrite the expression in Eq. (5) to L (θ|D) = N (cid:89) n=1 (cid:16) pZ f(x(n)|θ) (cid:17) (cid:12) (cid:12) det (cid:16) Jf(x(n)|θ) (cid:17) (cid:12) (cid:12) . (6) As in normalizing flows, we choose PZ to be a D- multivariate standard normal distribution with probability den- sity function n=1 m=1 M (cid:88) d=1 D (cid:88) −N * ln (cid:12) (cid:12)u(m) d,d (cid:12) (cid:12) → min . m=1 d=1 Note that for each hidden LU layer m = 1, . . . , M − 1 in LU- Net φ(cid:48)(m)(x) = α + 1 − α 1 + exp(−x) = α + (1 − α) σ(x) with σ : R → R being the logistic sigmoid function. For the final layer the derivative is constant with φ(cid:48)(M) = 1. III. LU-NET EXPERIMENTS In this section we present extensive experiments with LU- Net, which were conducted in different settings. As a toy ex- ample, we apply LU-Net to learn a two-dimensional Gaussian mixture. Next, we apply LU-Net to the image datasets MNIST [31] as well as the more challenging Fashion-MNIST [32]. We evaluate LU-Net as density estimator and also have look at the sampling quality as generator. A. Training goal and evaluation In general, our goal is to learn a target distribution PX given only samples which are produced by its data generating process. To this end, we attempt to train our model distribution given by LU-Net to be as close as possible to the data dis- tribution, i.e. the empirical distribution provided by examples D = {x(n)}N n=1 of the random variable X ∼ PX. One common way then to quantify the closeness between two distributions P and Q with probability density functions p and q, respectively, is via the Kullback-Leibler divergence p(z) = 1 (cid:112)(2π)D (cid:18) exp − (cid:19) z(cid:124)z 1 2 , z ∈ RD. (7) DKL(P||Q) = EX∼P (cid:20) ln p(X) q(X) (cid:21) (cid:90) = R p(x) ln p(x) q(x) dx. Further, given the fact that the determinant of a triangular matrix is the product of its diagonal entries and given the chain rule of calculus, for each LU layer m = 1, . . . , M of LU-Net it applies (cid:12) (cid:12) det Jf(m)(x) (cid:17) (cid:12) (cid:12) (cid:16) M (cid:89) D (cid:89) φ(cid:48)(m) (cid:16) =(cid:12) (cid:12) (L(m)U(m)x)d + b(m) d (cid:17) * u(m) d,d (cid:12) (cid:12) (8) m=1 d=1 4 It is well known that maximizing the likelihood on the dataset D, as presented in Eq. (9), asymptotically amounts to minimizing the Kullback-Leibler divergence between the target distribution and model distribution [9], [33], which in our case are defined by PX and LU-Net, respectively. For this reason, the negative log likelihood (NLL) is not only used as loss function for training, but also as the standard metric to measure the density estimation capabilities of probabilistic generative models [30]. Gaussian mixture negative log likelihood MNIST Test NLL # LU Layers Test NLL ↓ # LU Layers Test NLL ↓ 2 3.4024 ± 0.3403 8 1.4633 ± 0.2132 3 2.6765 ± 0.3607 12 1.0848 ± 0.3239 5 1.8665 ± 0.2875 TABLE I: Test results of LU-Net on the two-dimensional Gaussian mixture toy problem. Class Number 0 Number 1 Number 2 Number 3 Number 4 Number 5 Number 6 Number 7 Number 8 Number 9 Average Bits / Pixel ↓ 2.7180 ± 0.0284 2.4795 ± 0.0125 2.9395 ± 0.0997 2.7465 ± 0.0062 2.7760 ± 0.0114 2.7489 ± 0.0175 2.8591 ± 0.8279 2.7930 ± 0.0511 2.7916 ± 0.0081 2.6576 ± 0.0187 2.7480 ± 0.2931 Fashion-MNIST Test NLL Bits / Pixel ↓ Class 3.7726 ± 3.1228 T-Shirt 7.2577 ± 4.9085 Trousers 2.4018 ± 0.1091 Pullover 2.5337 ± 0.0127 Dress 3.3492 ± 1.6847 Coat 2.8861 ± 0.0173 Sandal 2.7209 ± 1.1560 Shirt 3.6077 ± 0.0071 Sneaker 4.3983 ± 2.0313 Bag 4.4405 ± 0.1762 Ankle Boot 3.7368 ± 2.4632 Average (a) Training data (b) 2 LU layers (c) 3 LU layers (d) 5 LU layers (e) 8 LU layers (f) 12 LU layers Fig. 3: The LU-Net with different numbers of LU layers applied to a two-dimensional Gaussian mixture. The heatmaps indicate the ground truth densities and the level curves the learned densities given by training LU-Net. B. Gaussian mixture 1) Experimental setup: To begin, we create a dataset consisting of 10,000 sampled two-dimensional Gaussian data points at four different centers with a standard deviation of 0.2 of which we use 9,000 for training LU-Net in different configurations, see Fig. 3a. More precisely, we train five LU- Nets in total comprising 2, 3, 5, 8, and 12 hidden LU layers with a final LU output layer eac for 10, 20, 30, 35, and 40 epochs, respectively. As optimization algorithm we use stochastic gradient descent with a momentum term of 0.9. We start with a learning rate of 1.0 that decays by 0.9 in each training epoch. Further, we clip the gradient to a maximal length of 1 w.r.t. the absolute-value norm, which empirically have shown to stabilize the training process. 2) Results: In Tab. I we report the negative log likelihood of LU-Net on the 1,000 holdout test data points. In Fig. 3b – Fig. 3f we provide visualizations of the learned and ground truth density. Generally, we observe that by stacking more LU layers the model function becomes more flexible, which is in line with [29] stating that deeper neural network have increased capacity. In our toy experiments the LU-Net with 12 layers achieves the best result with an averaged NLL of 1.0848. This is visible in the visualization in Fig. 3f, clearly showing having learned modes in proximity of the true centers of the target Gaussian mixture. We conclude that in practice depth can increase the expressive power of LU-Net. TABLE II: Class-wise negative log likelihood (NLL) when applying LU-Net to MNIST and Fashion-MNIST test dataset. The results are averaged over 30 runs. Note that the NLL is reported in bits per pixel (sometimes also called bits per dimension or simply bpd), which is the NLL with logarithm base 2 averaged over all pixels. C. MNIST and Fashion-MNIST 1) Data preprocessing: The two publicly available datasets MNIST [31] and Fashion-MNIST [32] consist of gray-scaled images of resolution 28 × 28 pixels. These images are stored in 8-bit integers, i.e. each pixel can take on a brightness value from {0, 1 . . . , 255}. Modeling such a discrete data distribution with a continuous model distribution (as we do with LU-Net by choosing a Gaussian prior, cf. Eq. (7)), could lead to arbitrarily high likelihood values, since arbitrarily narrow and high densities could be placed as spikes on each of the discrete brightness values. This practice would make the evaluation via the NLL not comparable and thus meaningless. Therefore, it is best practice in generative modeling to add real-valued uniform noise u ∼ U(0, 1), u ∈ [0, 1) to each pixel of the images in order to dequantize the discrete data [30], [34]. It turns out that the likelihood of the continuous model on the dequantized data is upper bounded by the likelihood on the original image data [30], [35]. Consequently, maximizing the likelihood on x + u will also maximize the likelihood on the original input x. This also makes the NLL on the dequantized data a comparable performance measure with NLL > 0 for any probabilistic generative model dealing with images. Note that the just described non-deterministic preprocessing step can easily be reverted by simply rounding off. As additional preprocessing steps we normalize the dequan- tized pixel values to the unit interval [0, 1] by dividing by 256, and apply the logit function to transform the data distribution to a Gaussian-like shape. This output then represents the input to LU-Net. Again, these preprocessing steps can easily be reversed by applying the inverse of logit, i.e. the logistic sigmoid function, and by multiplying by 256, respectively. 2) Experimental setup: We conduct the experiments on MNIST and Fashion-MNIST with an LU-Net consisting of three hidden LU layers and a final LU output layer. The model is trained for a maximum of 40 epochs and conditioned on each class of MNIST and Fashion-MNIST. As optimization algorithm, we stick to gradient descent with a momentum 5 (a) MNIST (b) Fashion MNIST (a) MNIST (b) Fashion MNIST Fig. 4: Unseen original test samples of (a) MNIST and (b) Fashion MNIST. These images are ordered class-wise and in decreasing likelihood from left to right as estimated by LU- Net. See also Tab. II for the class names. parameter of 0.9. We start with a learning rate of 0.6 that decays by 0.5 every three epochs. Further, we clip the gradi- ents to a maximal length of 1 w.r.t. Euclidean norm, which empirically have shown to stabilize the training process as well as regularizing the weights. As extra loss weighting, we add a factor of γ = 100 to the sum of the diagonal entries in the NLL loss function, see Eq. (9), which has considerably improved the convergence speed of the training process. 3) Results: In Tab. II we report the negative log likelihood computed by LU-Net on the MNIST and Fashion-MNIST test datasets. In Fig. 4 we provide qualitative examples of LU-Net as density estimator and in Fig. 5 as well as Fig. 6 as generator of new samples. In terms of numerical results, we achieve adequate density estimation scores with an average NLL of 2.75±0.29 bits/pixel and 3.74 ± 2.46 bits/pixel over all classes on MNIST and Fashion-MNIST, respectively. In general, the results can be considered as robust for each class of both datasets. The only major deviations are related to the classes T-Shirt and Trousers of Fashion-MNIST, which can be explained by the large variety of patterns in different examples and hence the increased difficulty in generative modeling, cf. also Tab. II right and Fig. 4b. Furthermore, we notice that LU-Net is capable of assigning meaningful likelihoods, i.e. images that are more characteristic for the associated class are assigned higher likelihoods, see again Fig. 4 in particular. With regard to LU-Net as generator, we obtain reasonable quality of the sampled images. The random samples can clearly be recognized as subset of MNIST or Fashion-MNIST and moreover, they can also be assigned easily to the cor- responding classes. However, we notice that many generated examples contain noise, most visible for class 7 in MNIST or class sandal and bag in Fasion-MNIST, cf. Fig. 5a and Fig. 5b, respectively. This shortcoming is not surprising since the fully connected layers of LU-Net capture less spatial correlations as other filter based architectures commonly used on image data. Another noteworthy observation refers to the learned latent space of LU-Net, i.e. the space after applying the normalizing sequence. Given its invertibility property, each latent variable represents exactly one image, which allows for traveling though the latent space and thus also interpretation of it. By interpolating between two latent representations, we generally observe a smooth transition between the two corresponding Fig. 5: LU-Net: Randomly generated samples of (a) MNIST and (b) Fashion MNIST. These examples are generated by sampling random numbers from a multivariate normal distri- bution and passing them through the inverse of LU-Net. More- over, these images are ordered class-wise and in decreasing likelihood from left to right as estimated by LU-Net. (a) MNIST (b) Fashion MNIST Fig. 6: LU-Net: Samples of (a) MNIST and (b) Fashion MNIST generated by interpolating in latent space of LU-Net. The examples in the red boxes are reconstructions from latent representations of original test data. Note that the examples are ordered randomly. images when transforming back to original input space, see Fig. 6a for MNIST and Fig. 6b for Fashion-MNIST. This also enables the visual inspection of relevant features or parts of the content associated with certain images or classes. To conclude, we have seen that LU-Net even with a shallow architecture can be applied as probabilistic generative model to images. The numerical results on these higher dimensional data indicate that the bijectivity constraint is not a significant limitation regarding the expressive power. Although not specif- ically designed to model image data, LU-Net is still capable of generating sufficiently clear images, which highlights its general purpose property as generative model. MNIST Test NLL Class Number 0 Number 1 Number 2 Number 3 Number 4 Number 5 Number 6 Number 7 Number 8 Number 9 Average Bits / Pixel ↓ 5.2647 ± 0.0189 5.0888 ± 0.1320 6.0798 ± 0.0249 5.0174 ± 1.0864 5.0952 ± 0.0278 5.4285 ± 0.0742 5.4642 ± 0.0393 5.7739 ± 0.0040 5.4086 ± 0.0555 5.0607 ± 0.0012 5.3682 ± 0.1464 Fashion-MNIST Test NLL Bits / Pixel ↓ Class 6.0803 ± 0.0321 T-Shirt 5.5130 ± 0.0778 Trousers 6.1770 ± 0.0043 Pullover 6.0273 ± 0.1005 Dress 6.1355 ± 0.0515 Coat 5.9324 ± 0.0449 Sandal 6.2517 ± 0.0437 Shirt 5.6603 ± 0.0007 Sneaker 6.3035 ± 0.0478 Bag 5.8741 ± 0.0314 Ankle Boot 5.9956 ± 0.0386 Average TABLE III: Class-wise negative log likelihood in bits per pixel when applying RealNVP to MNIST and Fashion-MNIST test dataset. The results are averaged over 30 runs. 6 model LU-Net RealNVP num weight GPU memory usage in MiB parameters 1,127 4.92M 3,725 5.39M num epochs training 40 100 test NLL in bits/pixel 3.2424 5.6819 model LU-Net RealNVP train epoch in sec 7.32 99.88 optimization step in ms 1.2 56.0 density per image in ms 37.10 259.15 sampling per image in ms 45.15 1.03 TABLE IV: Model size and run time comparisons between LU-Net and RealNVP. Note that the time results are averages over 100 runs on MNIST and Fashion-MNIST. Moreover, all these tests were conducted on the same machine using an NVIDIA Quadro RTX 8000 GPU and a batch size of 128. D. Comparison with RealNVP In these final experiments we want to compare LU-Net with the popular and widely used normalizing flow architecture RealNVP [3]. To make the models better comparable, we design them to be of similar size in terms of model parameters. In more detail, we employ a RealNVP normalizing flow with 9 affine coupling layers with checkerboard mask mixing. For the coupling layers two small ResNets [36] are used to compute the scale and translation parameter, respectively. Here, every ResNet backbone consists of two residual blocks, each applying two 3 × 3 convolutions with 64 kernels and ReLU activations. In total this amounts to a normalizing flow with 5,388,264 weight parameters compared to 4,920,384 weight parameters with LU-Net. Finally, we conducted the same experiments as presented in Sec. III-C for RealNVP. In Tab. III we report the negative log likelihood scores of our implemented RealNVP on the test splits of MNIST as well as Fashion-MNIST. In comparison to LU-Net, we observe more robust results but overall significantly worse performance in density estimation for each class of both datasets with RealNVP. During the experiments with RealNVP, we realized that the model needs to treated carefully as slight modifications in the hyper parameters could quickly lead to unstable training. We ended up training the flows for 100 epoch using a small learning rate of 1e-4 that decays by 0.2 every 10 epochs. Besides the worse performance on learning the data distri- bution of MNIST and Fashion-MNIST, RealNVP further is computationally more expensive than LU-Net, which can be seen in Tab. IV showing a comparison of the computational budget. RealNVP not only requires more GPU memory than LU-Net but also considerably more time to train. The latter point can be explained by backpropagation not working as efficiently due to the deep neural networks employed in coupling layers, which adversely affects propagating the errors from layer to layer. Moreover, RealNVP is notably slower at density evaluation, with LU-Net being 7 times faster. With regard to sampling, RealNVP is however significantly faster by nearly 50 times. Here, we want to note that at run time linear equation systems are solved in inverse LU-Net instead of inverting the weight matrices, cf. Sec. II-D and Appendix C, respectively. Although the inversion could be performed offline (a) MNIST (b) Fashion MNIST Fig. 7: Unseen original test samples of (a) MNIST and (b) Fashion MNIST. These images are ordered class-wise and in decreasing likelihood from left to right as estimated by Real- NVP. Note that RealNVP incorrectly assigns high likelihoods to some unclear examples, and vice versa. (a) MNIST (b) Fashion MNIST Fig. 8: RealNVP: Randomly generated samples of (a) MNIST and (b) Fashion MNIST. These images are ordered class-wise and in decreasing estimated likelihood from left to right. saving a considerable amount of operations, the computation of big inverse matrices is often numerically unstable, which is highly undesirable in particular in the context of invertible neural networks and therefore omitted. Lastly, we present qualitative examples of RealNVP as den- sity estimator in Fig. 7 and as generator in Fig. 8 for MNIST and Fashion-MNIST. At first glance, it is directly notable that the generated images are less noisy in comparison to the images generated by LU-Net. This might be an consequence of the extensive use of convolution operations in RealNVP that helps the model to better capture local correlations of features in images. However, the shapes of the digits and clothing articles in the images generated by our implemented slim RealNVP are still rather unnatural, which can be solved by deeper RealNVP models [3]. IV. CONCLUSION AND OUTLOOK We introduced LU-Net, which is a simple architecture for an invertible neural network based on the LU-factorization of weight matrices and invertible as well as two times dif- ferentiable activation functions. LU-Net provides an explicit likelihood evaluation and reasonable sampling quality. The execution of both tasks is computationally cheap and fast, which we tested in several experiments on academic data sets. In the future, we intend to investigate more closely the effects of the choice of the activation function. LU-net would become even simpler if leaky ReLu activation functions could be used, which can be achieved by training adversarily. Also, we intend to revisit the universal approximation properties for LU-Nets using artificial widening via zero padding. 7 ACKNOWLEDGMENT This work has been funded by the German Federal Ministry for Economic Affairs and Climate Action (BMWK) via the research consortium AI Delta Learning (grant no. 19A19013Q) and the Ministry of Culture and Science of the German state of North Rhine-Westphalia as part of the KI-Starter research funding program (grant no. 005-2204-0023). Moreover, this work has been supported by the German Federal Ministry of Education and Research (grant no. 01IS22069). REFERENCES [1] I. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. Courville, and Y. Bengio, "Generative adversarial nets," in Advances in Neural Information Processing Systems (Z. Ghahramani, M. Welling, C. Cortes, N. Lawrence, and K. Weinberger, eds.), vol. 27, Curran Associates, Inc., 2014. [2] D. P. Kingma and M. Welling, "Auto-encoding variational bayes," in International Conference on Learning Representations, 2014. [3] L. Dinh, J. Sohl-Dickstein, and S. Bengio, "Density estimation using real NVP," in International Conference on Learning Representations (ICLR), 2017. [4] G. E. Hinton, S. Osindero, and Y.-W. Teh, "A fast learning algorithm for deep belief nets," Neural computation, vol. 18, no. 7, pp. 1527–1554, 2006. [5] R. Salakhutdinov and G. Hinton, "Deep boltzmann machines," in Pro- ceedings of the Twelth International Conference on Artificial Intelligence and Statistics (D. van Dyk and M. Welling, eds.), vol. 5 of Proceed- ings of Machine Learning Research, (Hilton Clearwater Beach Resort, Clearwater Beach, Florida USA), pp. 448–455, PMLR, 16–18 Apr 2009. [6] H. Larochelle and I. Murray, "The neural autoregressive distribution estimator," in Proceedings of the fourteenth international conference on artificial intelligence and statistics, pp. 29–37, JMLR Workshop and Conference Proceedings, 2011. [7] A. Van Den Oord, N. Kalchbrenner, and K. Kavukcuoglu, "Pixel recurrent neural networks," in International conference on machine learning, pp. 1747–1756, PMLR, 2016. [8] G. Papamakarios, T. Pavlakou, and I. Murray, "Masked autoregressive flow for density estimation," Advances in neural information processing systems, vol. 30, 2017. [9] M. Arjovsky, S. Chintala, and L. Bottou, "Wasserstein generative adver- sarial networks," in Proceedings of the 34th International Conference on Machine Learning (D. Precup and Y. W. Teh, eds.), vol. 70 of Proceedings of Machine Learning Research, pp. 214–223, PMLR, 06–11 Aug 2017. [10] D. J. Rezende, S. Mohamed, and D. Wierstra, "Stochastic backprop- agation and approximate inference in deep generative models," in International conference on machine learning, pp. 1278–1286, PMLR, 2014. [11] D. P. Kingma, T. Salimans, R. Jozefowicz, X. Chen, I. Sutskever, and M. Welling, "Improved variational inference with inverse autoregressive flow," Advances in neural information processing systems, vol. 29, 2016. [12] M. Welling and Y. W. Teh, "Bayesian learning via stochastic gradient langevin dynamics," in Proceedings of the 28th international conference on machine learning (ICML-11), pp. 681–688, 2011. [13] J. Sohl-Dickstein, E. Weiss, N. Maheswaranathan, and S. Ganguli, "Deep unsupervised learning using nonequilibrium thermodynamics," in International Conference on Machine Learning, pp. 2256–2265, PMLR, 2015. [14] J. Ho, A. Jain, and P. Abbeel, "Denoising diffusion probabilistic models," Advances in Neural Information Processing Systems, vol. 33, pp. 6840– 6851, 2020. [15] L. Yang, Z. Zhang, Y. Song, S. Hong, R. Xu, Y. Zhao, Y. Shao, W. Zhang, B. Cui, and M.-H. Yang, "Diffusion models: A comprehensive survey of methods and applications," arXiv preprint arXiv:2209.00796, 2022. [16] D. Rezende and S. Mohamed, "Variational inference with normalizing flows," in International conference on machine learning, pp. 1530–1538, PMLR, 2015. [17] L. Dinh, D. Krueger, and Y. Bengio, "NICE: non-linear independent components estimation," in 3rd International Conference on Learning Representations ICLR 2015 Workshop Track Proceedings (Y. Bengio and Y. LeCun, eds.), 2015. [18] L. Ardizzone, J. Kruse, S. Wirkert, D. Rahner, E. W. Pellegrini, R. S. Klessen, L. Maier-Hein, C. Rother, and U. K ̈othe, "Analyz- ing inverse problems with invertible neural networks," arXiv preprint arXiv:1808.04730, 2018. [19] D. P. Kingma and P. Dhariwal, "Glow: Generative flow with invert- ible 1x1 convolutions," in Advances in Neural Information Processing Systems (S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa- Bianchi, and R. Garnett, eds.), vol. 31, Curran Associates, Inc., 2018. [20] I. Kobyzev, S. J. Prince, and M. A. Brubaker, "Normalizing flows: An introduction and review of current methods," IEEE transactions on pattern analysis and machine intelligence, vol. 43, no. 11, pp. 3964– 3979, 2020. [21] T. Teshima, I. Ishikawa, K. Tojo, K. Oono, M. Ikeda, and M. Sugiyama, "Coupling-based invertible neural networks are universal diffeomor- phism approximators," Advances in Neural Information Processing Systems, vol. 33, pp. 3362–3373, 2020. [22] M. Grci ́c, I. Grubiˇsi ́c, and S. ˇSegvi ́c, "Densely connected normalizing flows," in Advances in Neural Information Processing Systems (M. Ran- zato, A. Beygelzimer, Y. Dauphin, P. Liang, and J. W. Vaughan, eds.), vol. 34, pp. 23968–23982, Curran Associates, Inc., 2021. [23] G. Cybenko, "Approximation by superpositions of a sigmoidal function," Mathematics of Control, Signals and Systems, vol. 2, pp. 303–314, 12 1989. [24] K. Hornik, "Approximation capabilities of multilayer feedforward net- works," Neural Netwworks, vol. 4, pp. 251–257, Mar. 1991. [25] M. Leshno, V. Y. Lin, A. Pinkus, and S. Schocken, "Multilayer feedforward networks with a nonpolynomial activation function can approximate any function," Neural Networks, vol. 6, no. 6, pp. 861– 867, 1993. [26] D. Yarotsky, "Error bounds for approximations with deep relu networks," Neural Networks, vol. 94, pp. 103–114, 2017. [27] Z. Lu, H. Pu, F. Wang, Z. Hu, and L. Wang, "The expressive power of neural networks: A view from the width," in Advances in Neural Information Processing Systems (I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, eds.), vol. 30, Curran Associates, Inc., 2017. [28] P. Kidger and T. Lyons, "Universal approximation with deep narrow networks," in Conference on learning theory, pp. 2306–2327, PMLR, 2020. [29] S. Park, C. Yun, J. Lee, and J. Shin, "Minimum width for universal ap- proximation," in International Conference on Learning Representations, 2021. [30] L. Theis, A. van den Oord, and M. Bethge, "A note on the evaluation of generative models," in International Conference on Learning Repre- sentations, Apr 2016. [31] Y. LeCun, C. Cortes, and C. Burges, "Mnist handwritten digit database," ATT Labs [Online]. Available: http://yann.lecun.com/exdb/mnist, vol. 2, 2010. [32] H. Xiao, K. Rasul, and R. Vollgraf, "Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms," arXiv preprint arXiv:1708.07747, 2017. [33] R. Chan, Detecting Anything Overlooked in Semantic Segmentation. PhD thesis, Universit ̈at Wuppertal, Fakult ̈at f ̈ur Mathematik und Naturwis- senschaften, 2022. [34] B. Uria, I. Murray, and H. Larochelle, "Rnade: The real-valued neural autoregressive density-estimator," in Advances in Neural Information Processing Systems, vol. 26, 2013. [35] J. Ho, X. Chen, A. Srinivas, Y. Duan, and P. Abbeel, "Flow++: Improv- ing flow-based generative models with variational dequantization and architecture design," in Proceedings of the 36th International Conference on Machine Learning (K. Chaudhuri and R. Salakhutdinov, eds.), vol. 97 of Proceedings of Machine Learning Research, pp. 2722–2730, PMLR, 09–15 Jun 2019. [36] K. He, X. Zhang, S. Ren, and J. Sun, "Deep residual learning for image recognition," in Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016. 8 A. Condition numbers APPENDIX To make the inversion of the LU network possible, it is necessary, that the L and U weight matrices are well conditioned. The condition number κ of a matrix A ∈ RD×D is defined as κ(A) = ||A||2 * ||A−1||2 and it is a measure for the numeric stability of a linear equation system A * x = b for any vector b ∈ RD. That is why we use the condition numbers of the weight matrices as a measure for the success of the inversion of the LU network. The results for the MNIST and FashionMNIST datasets are reported in Tables V and VI. Untrained weights Number 0 Number 1 Number 2 Number 3 Number 4 Number 5 Number 6 Number 7 Number 8 Number 9 κ(U(1)) 6.94e + 18 2.13 2.39 2.14 2.13 2.16 2.07 2.11 2.45 2.16 2.19 κ(L(1)) 3.18 690.39 456.42 321.54 318.00 618.06 177.44 300.60 431.88 433.54 743.07 Condition numbers κ(L(2)) 3.19 138.01 195.82 199.98 184.68 298.37 131.62 179.20 312.08 340.09 149.99 κ(U(2)) 2.55e + 18 3.04 3.01 3.51 3.35 2.86 2.95 3.10 3.50 2.94 3.15 κ(U(3)) 8.44e + 17 2.66 2.70 2.69 2.77 2.59 2.51 2.49 2.87 2.64 2.53 κ(L(3)) 3.18 50.59 51.40 54.75 61.91 41.72 40.94 43.89 80.46 43.51 50.74 κ(U(4)) 1.89e + 18 2.40 2.53 2.43 2.61 2.39 2.43 2.39 2.52 2.51 2.40 κ(L(4)) 3.16 271.66 216.44 190.21 161.94 255.30 248.46 236.14 188.26 184.29 205.62 TABLE V: MNIST: Condition numbers of weight matrices before and after the training Untrained weights T-Shirt Trouser Pullover Dress Coat Sandal Shirt Sneaker Bag Ankle Boot κ(U(1)) 6.94e + 18 2.38 2.51 2.26 2.34 2.25 2.23 2.41 1.68 2.71 1.78 κ(L(1)) 3.18 177.70 727.66 202.77 621.33 244.03 521.50 168.12 9.26 238.70 9.53 Condition numbers κ(L(2)) 3.19 146.45 224.79 105.24 165.46 149.92 208.06 104.54 3.88 109.81 4.06 κ(U(2)) 2.55e + 18 3.26 2.96 2.94 3.14 3.06 3.12 2.94 1.42 3.26 1.46 κ(U(3)) 8.44e + 17 2.85 2.63 2.75 2.80 2.73 3.01 2.93 1.51 2.78 1.51 κ(L(3)) 3.18 52.19 48.70 49.84 56.55 57.00 52.25 52.73 4.07 58.26 4.32 κ(U(4)) 1.89e + 18 2.56 2.46 2.54 2.57 2.57 2.55 2.55 1.61 2.64 1.66 κ(L(4)) 3.16 214.36 191.40 217.66 263.57 275.77 150.41 235.12 59.43 210.89 58.18 TABLE VI: Fashion-MNIST: Condition numbers of weight matrices before and after the training B. Test for normality INNs are trained to map the data distribution onto a multivariate standard normal distribution in the normalizing direction. We therefore inspect the success of the normalizing direction by visual comparison while (Fig. 9) and after training. It is well known that Z ∼ N(0, 1) in D dimensions, if and only if c(cid:62)Z ∼ N(0, 1) for all c ∈ RD with (cid:107)c(cid:107) = 1. We thus test normality by sampling random directions c, normalize c (cid:55)→ c/(cid:107)c(cid:107) and collect values z(n) = c(cid:62)f(x(n)), n=1. We thereafter display a histogram n = 1, . . . , N where f is the trained LU-Net trained evaluated on the test data set {xn}N of the z(n)-values and compare it to the density of the standard normal distribution. Figures 10 and 11 display the result for one independently sampled direction c of projection for each of the classes of MNIST and Fashion-MNIST, respectively. 9 (a) MNIST: Number 3 (b) Fashion MNIST: Bag Fig. 9: Distribution of 1200 test data while training after epoch 1, 3, 6, 8, 15 and 30 (from left to right) with the negative log likelihood in bits per pixel as title of each plot. Fig. 10: MNIST: Randomly chosen projection for number 0, 1, 2, 3 and 4 in the first row (from left to right) and number 5, 6, 7, 8 and 9 in the second row (from left to right). In total 2000 test data were used for each projection. Fig. 11: FashionMNIST: Randomly chosen projection for T-Shirt, Trouser, Pullover, Dress and Coat in the first row (from left to right) and Sandal, Skirt, Sneaker, Bag and Ankle Boot in the second row (from left to right). In total 2000 test data were used for each projection. 10 C. Inverted forward function For the numerical stability, it is not beneficial, when we invert the weight matrices of the L and U layer in the forward function of an inverted LU layer. Firstly, we solve the linear equation system Ly = (cid:0)Φ−1(z) − b(cid:1)(cid:124) in the inverted L layer. Secondly in the inverted U layer, we calculate the solution of following linear system which is computationally more expensive than x = R−1y but numerically more stable. Rx = y, 11
http://arxiv.org/abs/2302.10506v5
2023-06-19T03:49:15
2023-02-21T08:11:38
Diffusion Probabilistic Models for Structured Node Classification
This paper studies structured node classification on graphs, where the predictions should consider dependencies between the node labels. In particular, we focus on solving the problem for partially labeled graphs where it is essential to incorporate the information in the known label for predicting the unknown labels. To address this issue, we propose a novel framework leveraging the diffusion probabilistic model for structured node classification (DPM-SNC). At the heart of our framework is the extraordinary capability of DPM-SNC to (a) learn a joint distribution over the labels with an expressive reverse diffusion process and (b) make predictions conditioned on the known labels utilizing manifold-constrained sampling. Since the DPMs lack training algorithms for partially labeled data, we design a novel training algorithm to apply DPMs, maximizing a new variational lower bound. We also theoretically analyze how DPMs benefit node classification by enhancing the expressive power of GNNs based on proposing AGG-WL, which is strictly more powerful than the classic 1-WL test. We extensively verify the superiority of our DPM-SNC in diverse scenarios, which include not only the transductive setting on partially labeled graphs but also the inductive setting and unlabeled graphs.
[ "Hyosoon Jang", "Seonghyun Park", "Sangwoo Mo", "Sungsoo Ahn" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10506v5", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10506v5", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
3 2 0 2 n u J 9 1 ] G L . s c [ 5 v 6 0 5 0 1 . 2 0 3 2 : v i X r a Diffusion Probabilistic Models for Structured Node Classification Hyosoon Jang1, Seonghyun Park1, Sangwoo Mo2, Sungsoo Ahn1 1POSTECH 2KAIST {hsjang1205,shpark26,sungsoo.ahn}@postech.ac.kr, [email protected] Abstract This paper studies structured node classification on graphs, where the predictions should consider dependencies between the node labels. In particular, we focus on solving the problem for partially labeled graphs where it is essential to incorporate the information in the known label for predicting the unknown labels. To address this issue, we propose a novel framework leveraging the diffusion probabilistic model for structured node classification (DPM-SNC). At the heart of our framework is the extraordinary capability of DPM-SNC to (a) learn a joint distribution over the labels with an expressive reverse diffusion process and (b) make predictions conditioned on the known labels utilizing manifold-constrained sampling. Since the DPMs lack training algorithms for partially labeled data, we design a novel training algorithm to apply DPMs, maximizing a new variational lower bound. We also theoretically analyze how DPMs benefit node classification by enhancing the expressive power of GNNs based on proposing AGG-WL, which is strictly more powerful than the classic 1-WL test. We extensively verify the superiority of our DPM-SNC in diverse scenarios, which include not only the transductive setting on partially labeled graphs but also the inductive setting and unlabeled graphs. 1 Introduction In this paper, we address the node classification problem, which is a fundamental problem in machine learning on graphs with various applications, such as social networks [1] and citation networks [2]. One representative example is a transductive problem to classify documents from a partially labeled citation graph. Recently, graph neural networks (GNNs) [3, 4] have shown great success in this problem over their predecessors [5, 6]. Their success stems from the high capacity of non-linear neural architectures combined with message passing. However, the conventional GNNs are incapable of structured node classification: predicting node labels while considering the node-wise label dependencies [7–9]. That is, given a graph G with vertices V and node labels {yi : i ∈ V}, a GNN with parameter θ outputs an unstructured prediction, i.e., pθ(yi, yj|G) = pθ(yi|G)pθ(yj|G) for i, j ∈ V. Especially, this limitation becomes problematic in a transductive setting where the prediction can be improved by incorporating the known labels, e.g., output pθ(yi|G, yj) for known yj. In Figures 1(a) and 1(b), we elaborate on this issue with an example where the conventional GNN fails to make the correct prediction. To resolve this issue, recent studies have investigated combining GNNs with classical structured prediction algorithms, i.e., schemes that consider dependencies between the node labels [8–13]. They combine GNNs with conditional random fields [14], label propagation [15], or iterative classification algorithm [2]. Despite the promising outcomes demonstrated by these studies, their approach relies on the classical algorithms to express joint dependencies between node labels and may lack sufficient expressive power or consistency in incorporating known labels. Preprint. Under review. (a) Input (b) GCN [3] (c) GMNN [7] (d) CLGNN [13] (e) DPM-SNC (ours) Figure 1: Results of various methods to solve node classification on a non-attributed and partially labeled cyclic grid. (a) The task is to estimate p(yU |yL, G) where the known labels yL are highlighted in green and the unknown labels yU are colored in gray. (b)-(e) Red highlights the incorrect predictions made by the corresponding algorithm. Conventional GNN (GCN) fails to make an informative prediction while our DPM-SNC is the only method to perfectly predict all the labels. Contribution. We propose a novel framework for structured node classification called DPM-SNC. Our key idea is to leverage the diffusion probabilistic model (DPM) [16], motivated by two significant advantages of DPM for structured node classification: (a) it can effectively learn a joint distribution over both the unknown and the known labels, and (b) it can easily incorporate conditions during inference via posterior sampling. Figure 1 highlights that DPM significantly outperforms previous methods when the prediction problem requires a complete understanding of label dependencies. However, DPM cannot be directly applied to the transductive scenario, where the model needs to maximize its log-likelihood for partially labeled graphs. We propose a novel training algorithm to address this challenge. Our method maximizes a new variational lower bound of the marginal likelihood of the graph over the unlabeled nodes, involving the alternative optimization of DPM and a variational distribution. In this process, we estimate the variational distribution from the current DPM using a similar approach to fixed-point iteration [17]. After training, DPM can predict the remaining node labels by constraining its predictions with the given labeled nodes, utilizing the manifold-constrained sampling technique [18]. In addition, we provide a theoretical analysis that supports the benefits of DPM-SNC for node classification by enhancing the expressive power of GNNs. To this end, we derive an analog of our DPM-SNC based on the Weisfeiler-Lehman (WL) [19] test, evaluating the ability to distinguish non-isomorphic graphs. Specifically, we prove that DPM-SNC is as powerful as our newly derived aggregated Weisfeiler-Lehman (AGG-WL) test, which is strictly more powerful than the 1-WL test, a known analog to standard GNN architectures [20] such as GCN [3] and GAT [21]. We demonstrate the effectiveness of DPM-SNC on various datasets, covering both transductive and inductive settings. In the transductive setting, we conduct experiments on seven benchmarks: Pubmed, Cora, and Citeseer [22]; Photo and Computer [23]; and Empire and Ratings [24]. Additionally, we introduce a synthetic benchmark to evaluate the ability to capture both short and long-range dependencies. DPM-SNC outperforms the baselines, including both homophilic and heterophilic graphs. In the inductive setting, we conduct experiments on four benchmarks: Pubmed, Cora, Citeseer, and PPI [25]. Furthermore, we evaluate DPM-SNC on the algorithmic reasoning benchmark [26], which requires a higher-level understanding of node relations. DPM-SNC also outperforms previous algorithms for these tasks. To summarize, our contribution can be listed as follows: • We explore DPM as an effective solution for structured node classification due to its inherent capability in (a) learning the joint node-wise label dependency in data and (b) making predictions conditioned on partially known data (Section 3). • We propose a novel method for training a DPM on partially labeled graphs that leverages the probabilistic formulation of DPM to maximize the variational lower bound (Section 4). • We provide a theoretical analysis of how DPM enhances the expressive power of graph neural networks, strictly improving its capability over the 1-WL test (Section 5). • Our experiments demonstrate the superiority over the baselines in both transductive and inductive settings. We additionally consider heterophilic graphs and algorithmic reasoning benchmarks to extensively evaluate the capability of DPMs in understanding the label dependencies (Section 6). 2 2 Related Work Graph neural networks (GNNs). Graph neural networks (GNNs) are neural networks specifically designed to handle graph-structured data. Over the past years, GNNs have shown promising outcomes in various tasks related to graph representation learning [3, 4, 27, 28]. In the case of node classification, GNNs aggregate neighboring node information and generate node representations for label predictions. Their expressive power has been analyzed through the lens of the Weisfeiler-Lehman (WL) test [19], a classical algorithm to distinguish non-isomorphic graphs. For example, Xu et al. [20] proved how the expressive power of conventional GNNs is bounded by the 1-dimensional WL (1-WL) test. Structured node classification with GNNs. Apart from investigating the power of GNNs to discriminate isomorphic graphs, several studies focused on improving the ability of GNNs to learn the joint dependencies [7, 9, 13, 26, 29–31]. In particular, researchers have considered GNN-based structured node classification [7, 9, 13]. First, Qu et al., [7] parameterize the potential functions of conditional random fields using a GNN and train it using pseudo-likelihood maximization [32]. Next, Qu et al., [9] proposed a training scheme with a GNN-based proxy for the conditional random field. Hang et al., [13] proposed an iterative classification algorithm-based learning framework of GNNs that updates each node-wise prediction by aggregating previous predictions on neighboring nodes. Diffusion probabilistic models (DPMs). Inspired by non-equilibrium thermodynamics, DPMs are latent variable models (LVMs) that learn to reverse a diffusion process and construct data from a noise distribution. Recent studies demonstrated great success of DPMs in various domains, e.g., generating images [33], text [34], and molecules [35]. An important advantage of diffusion models is their ability to incorporate additional constraints. This allows DPM to solve the posterior inference problems, e.g., conditioning on the partially observed data to recover the original data [18, 36, 37]. 3 Diffusion Probabilistic Models for Structured Node Classification In this section, we introduce the problem of structured node classification and discuss the limitations of graph neural networks (GNNs) in addressing this problem (Section 3.1). We then explain how the diffusion probabilistic models (DPMs) offer a promising solution for this problem (Section 3.2). 3.1 Structured node classification We address structured node classification, which involves predicting node labels while consider- ing their joint dependencies. Specifically, we focus on the task of predicting labels in par- tially labeled graphs, where some true labels are known before the prediction.1 Our goal is to devise an algorithm that considers the dependen- cies with known labels to enhance predictions for unknown labels. To be specific, our problem involves a graph G = (V, E, x) consisting of nodes V, edges E, and node attributes x = {xi : i ∈ V}. We also denote the node labels by y = {yi : i ∈ V}. We let VL and VU denote the set of labeled and unlabeled nodes, while yL and yU de- note the corresponding labels for each set, e.g., yL = {yi : i ∈ VL}. Our objective is to pre- dict the unknown labels yU by training on the partially labeled graph, aiming to infer the true conditional distribution p(yU |G, yL). Figure 2: DPM makes predictions with label de- pendencies. The node color indicates the label value, and opacity reflects the likelihood. We point out that the conventional GNNs [3, 4, 27, 28] are suboptimal for estimating p(yU |G, yL) since their predictions on the node labels are independently conditioned on the input, i.e., their predictions are factorized by pθ(yU |G, yL) = (cid:81) pθ(yi|G). Namely, conventional GNNs cannot i∈VU 1We also show structured node classification to be important for unlabeled graphs in Section 5. 3 diffusion and projectionreverse processstep 1step 50step 100node-wise predictionsknownlabels Algorithm 1 DPM-SNC 1: Train a mean-field GNN pφ(y|G). 2: Initialize the buffer B by pφ(yU |G). 3: repeat 4: 5: for i = 1, . . . , N1 do Get yU ∼ pθ(yU |G, yL) using manifold-constrained sampling. Update B ← B ∪ {yU }. If |B| > K, remove oldest one in B. end for for i = 1, . . . , N2 do Sample yU ∼ B. Update θ to maximize LVLB with G, and y = yL ∪ yU . end for 12: 13: until converged (a) Update the buffer with samples from pθ(yU |G, yL). (b) Update the DPM parameter to maximize LVLB. Figure 3: Illustration of DPM-SNC training on par- tially labeled graphs, repeating steps (a) and (b). 6: 7: 8: 9: 10: 11: incorporate the information of the known labels yL into a prediction of the unknown labels yU . Structured prediction algorithms [2, 14] overcome this issue by solving two tasks: (a) learning a joint distribution pθ(yU , yL|G) to maximize the likelihood of labeled data pθ(yL|G) and (b) inferring from the distribution pθ(yU |G, yL) conditioned on known labels. 3.2 Diffusion probabilistic models for structured node classification In this work, we consider diffusion probabilistic models for structured node classification (DPM- SNC) motivated by how their strengths align with the essential tasks for solving structured node classification, outlined in Section 3.1. In particular, DPMs are equipped with (a) high expressivity in learning a joint distribution over data and (b) the ability to easily infer from a posterior distribution conditioned on partially observed data. To this end, we formally describe DPMs for a graph G associated with node-wise labels y. At a high level, DPMs consist of two parts: forward and reverse processes. Given the number of diffusion steps T , the forward process constructs a sequence of noisy labels y(1:T ) = [y(1), . . . , y(T )] using a fixed distribution q(y(1:T )|y(0)) starting from the true label y(0) = y. Next, given an initial sample y(T ) sampled from p(y(T )), the reverse process pθ(y(0:T −1)|y(T ), G) aims to recover the forward process. To be specific, the forward and the reverse process are factorized as follows: q(y(1:T )|y(0)) = T (cid:89) t=1 q(y(t)|y(t−1)), pθ(y(0:T −1)|y(T ), G) = T (cid:89) t=1 pθ(y(t−1)|y(t), G). By leveraging shared latent variables y(t) across multiple steps in the reverse process, the reverse process effectively considers the dependencies in the output. Next, DPMs can easily infer from a posterior distribution conditioned on partially observed data. Specifically, the incremental updating of y(t) for t = 1, . . . , T allows the DPM to incorporate the known label yL, e.g., applying iterative projection with manifold-based correction [18]. This enables inference from the distribution pθ(yU |G, yL) conditioned on the known labels yL. See Figure 2 for an illustration of DPM for structured node classification with known labels. 4 Training Diffusion Probabilistic Models on Partially Labeled Graphs Despite the potential of DPMs for structured node classification, they lack the algorithms to learn from partially labeled graphs, i.e., maximize the likelihood of known labels. To resolve this issue, we introduce a novel training algorithm for DPM-SNC, based on maximizing a variational lower bound for the log-likelihood of known labels. 4 (G,y)(G,yL)posteriorunlabeled nodebufferBinserts samplingyUlowerbound(G,y("))maximize(G,y)buffer BdiffusionsamplesyU Variational lower bound. At a high-level, our algorithm trains the DPM to maximize the log- likelihood of training data log pθ(yL|G), which is defined as follows: L = log pθ(yL|G) = log (cid:88) (cid:88) yU y(1:T ) pθ(yL, yU , y(1:T )|G). However, this likelihood is intractable due to the exponentially large number of possible combinations for the unknown labels yU and the noisy sequence of labels y(1:T ). To address this issue, we train the DPM based on a new variational lower bound L ≥ LVLB, expressed as follows: LVLB = Eq(yU |yL) (cid:20) E q(y(1:T )|y) (cid:20) (cid:21) log pθ(y, y(1:T )|G) − log q(y(1:T )|y) (cid:21) . − log q(yU |yL) (1) Here, q(*) is a variational distribution factorized by q(yU , y(1:T )|yL) = q(y(1:T )|y)q(yU |yL), where y = yU ∪ yL. We provide detailed derivation in Appendix A.1. Parameterization. We define the reverse process pθ(y(t−1)|y(t), G) with a Gaussian distribution, where the mean value parameterized by a graph neural network (GNN) and the variance set to be a hyper-parameter. Following the prior work [16], we also employ a Gaussian diffusion to parameterize the forward process q(y(1:T )|y) as follows: q(y(1), . . . , y(T )|y(0)) = N (y(t); (cid:112)1 − βty(t−1), βtI), T (cid:89) t=1 where I is an identity matrix, β1, . . . , βT are fixed variance schedules. We set the variance schedule to promote q(y(T )|y(0)) ≈ N (y(T ); 0, I) by setting βt < βt+1 for t = 0, . . . , T − 1 and βT = 1. Finally, we describe the variational distribution q(yU |yL) as an empirical distribution over a fixed-size buffer B containing multiple estimates of the unknown labels yU . This buffer is updated throughout the training. We provide more details on our parameterization in Appendix A.2. Training algorithm. To maximize the variational lower bound, we alternatively update the re- verse process pθ(y, y(1:T )|G) and the variational distribution q(yU |yL). In particular, we train pθ(y, y(1:T )|G) to maximize the Monte Carlo approximation of LLVB by applying ancestral sampling to the variational distribution q(y(1:T )|y)q(yU |yL), i.e., sampling yU from the buffer B and applying the diffusion process to y. The detailed training objective is described in Appendix A.3. Next, we update the variational distribution q(yU |yL) by inserting samples from the distribu- tion pθ(yU |G, yL) into the buffer B.2 This update is derived from the condition q(yU |yL) = pθ(yU |G, yL) being necessary to maximize LVLB, similar to the derivation of fixed-point iteration for optimization [17]. We describe the overall optimization procedure in Algorithm 1.3 Finally, we emphasize that our training algorithm is specialized for DPMs. Previous studies in- troducing variational lower bounds for structured node classifications [7, 38] face intractability in maximizing log pθ(y|G) or sampling from pθ(yU |G, yL). They require defining the pseudo- likelihood for the former [32], or parameterizing variational distribution for the latter. However, in our case, the formal simply requires maximizing the lower bound LVLB, and the latter is easily solved by manifold-constrained sampling [18]. 5 Theoretical Analysis In this section, we present a secondary motivation for using DPMs in node classification, distinct from the one given in Section 3 and Section 4. Specifically, we demonstrate that DPMs provably enhance the expressive power of conventional GNNs for solving the graph isomorphism test, implying improved expressive power for node classification problems as well. To this end, we assess the expressive power of our DPM-SNC by its analog for discriminating isomorphic graphs, which we call the aggregated Weisfeiler-Lehman (AGG-WL) test. Then, we show 2We use manifold-constrained sampling of DPM to infer from the distribution pθ(yU |G, yL) [18]. The detailed sampling procedure is described in Appendix A.4. 3In practice, we initialize the buffer B with samples from a mean-field GNN pφ(y|G), which outputs an independent joint distribution over node labels, i.e., pθ(yU |G, yL) = (cid:81) pθ(yi|G). i∈VU 5 that AGG-WL is strictly more powerful than the 1-dimensional WL (1-WL) test [19], which is an analog of GNNs [20]. We formalize our results in the following theorem. Theorem 1. Let 1-WL-GNN be a GNN as powerful as the 1-WL test. Then, DPM-SNC using a 1-WL-GNN is strictly more powerful than the 1-WL-GNN in distinguishing non-isomorphic graphs. We provide the formal proof in Appendix B. At a high level, both the 1-WL test and the AGG-WL test assign colors to nodes and iteratively refine them based on the colors of neighboring nodes, enabling the comparison of graph structures. The key difference is that 1-WL initializes the color assignments for each node to be uniform, while AGG-WL adds perturbations at initial color assignments. Then AGG-WL additionally aggregates over graphs with all possible kinds of perturbations. Hence, any graph pair distinguishable by the 1-WL test is also distinguishable by our AGG-WL test, and there exist pairs of graphs indistinguishable by the WL test but distinguishable by our variant. We remark that our analysis can be easily extended to applying other latent variable models, e.g., variational auto-encoders [39] or normalizing flows [40], for node classification. In this analysis, sampling a latent variable corresponds to fixing a perturbation for color assignments at initialization, and aggregating over the perturbed graphs corresponds to computing the prediction over the true labels with marginalization over the latent variables. Our theory is based on that of Bevilaqua et al. [41] which was originally developed for analyzing a particular GNN architecture; our key contribution lies in extending this analysis to the latent variable models. 6 Experiments 6.1 Transductive setting We first evaluate the performance of our algorithm in the transductive setting. Specifically, we conduct an evaluation of DPM-SNC on synthetic data, as well as real-world node classification problems. We consider different types of label dependencies by considering both homophilic and heterophilic graphs. We provide the details of our implementation in Appendix C.1. Synthetic data. In this experiment, we create a 2 × n non-attributed cyclic grid. Each node is assigned either a binary label, with neighboring nodes having different labels. We consider two scenarios: one where the known labels are randomly scattered throughout the graph, and another where they are clustered in a local region. Examples of both scenarios are illustrated in Figures 4(a) and 4(b). These two scenarios verify the capability for capturing both short and long-range dependencies between node labels. The data statistics are described in Appendix D. We compare DPM-SNC with conventional GNN that ignores the label dependencies and other structured node classification methods: GMNN [7], G3NN [8], and CLGNN [13]. We describe the detailed experimen- tal setup in Appendix E.1. We report the performance using five different random seeds. The results, presented in Table 1, demonstrate that our method significantly improves accuracy compared to the baselines when labeled nodes are scattered. This highlights the superiority of DPM-SNC in considering label dependencies. Furthermore, our method also ex- cels in the localized labeled nodes scenario, while the other baselines fail. These results can be attributed to the capabilities of DPMs, which effectively captures long-range dependencies through iterative reverse dif- fusion steps. 6 (a) Scattered (b) Localized Figure 4: Green highlights known labels. Illustration of two scenarios. Table 1: The transductive node classifica- tion accuracy on synthetic data. Bold num- bers indicate the best performance. Method Scattered Localized GCN [3] + GMNN [7] + G3NN [8] + CLGNN [13] + DPM-SNC (ours) 50.1±0.6 64.2±3.2 50.1±0.6 87.0±2.4 98.5±0.7 51.3±1.4 48.2±4.8 51.3±1.4 53.4±2.1 90.9±3.4 Table 2: The transductive node classification performance. N-Acc. and Sub-Acc. denote the node- level and subgraph-level accuracy, respectively. Bold numbers indicate the best performance among the structured prediction methods using the same GNN. Pubmed Computer Citeseer Photo Cora Method LP [42] PTA [43] N-Acc. Sub-Acc. N-Acc. Sub-Acc. N-Acc. Sub-Acc. N-Acc. Sub-Acc. N-Acc. Sub-Acc. 69.1±0.0 45.7±0.0 80.1±0.2 55.2±0.4 68.1±0.0 46.9±0.0 82.9±0.4 62.6±0.8 46.1±0.0 29.8±0.0 71.3±0.4 51.4±0.7 81.0±2.0 37.2±1.7 91.1±1.5 51.0±1.5 69.9±2.9 15.1±1.1 81.6±1.7 26.3±1.0 79.7±0.3 55.8±0.6 GCN [3] +LPA [12] 79.6±0.6 53.5±0.9 +GMNN [7] 82.6±1.0 58.1±1.4 +G3NN [8] 80.9±0.7 56.9±1.1 +CLGNN [13] 81.7±0.5 57.8±0.7 +DPM-SNC (ours) 83.0±0.9 59.2±1.2 79.1±0.5 55.8±0.5 GAT [21] +LPA [12] 78.7±1.1 56.0±1.2 +GMNN [7] 79.6±0.8 57.0±0.7 +G3NN [8] 77.9±0.4 55.9±0.5 +CLGNN [13] 80.0±0.6 57.5±1.2 +DPM-SNC (ours) 81.7±0.8 59.0±1.1 81.4±0.8 59.3±1.1 81.7±0.7 60.3±1.5 82.6±0.9 61.8±1.3 82.5±0.4 62.3±0.8 81.9±0.5 61.8±0.8 83.2±0.5 63.1±0.9 81.5±0.6 61.3±0.9 81.5±0.9 60.7±0.8 82.3±0.7 62.2±0.8 82.7±1.3 62.7±1.3 81.8±0.6 61.5±0.9 83.8±0.7 63.8±0.7 70.9±0.8 49.8±0.6 71.0±0.6 50.2±1.0 72.8±0.7 52.0±0.8 73.9±0.7 53.1±1.0 72.0±0.7 51.6±0.9 74.4±0.5 53.6±0.6 71.0±0.8 50.8±1.0 71.3±0.9 50.1±0.9 71.7±0.9 51.4±0.9 74.0±0.8 53.7±0.5 72.1±0.8 52.1±0.8 74.3±0.7 54.0±0.9 91.0±1.2 52.0±1.0 91.3±1.2 52.9±2.0 91.2±1.2 54.3±1.4 90.7±1.1 53.0±2.0 91.1±1.0 53.4±1.8 92.2±0.8 55.3±2.1 90.8±1.0 50.8±1.9 91.3±0.8 52.7±2.1 91.4±1.0 53.1±1.6 91.5±0.9 52.6±2.2 90.6±0.8 51.9±1.8 92.0±0.8 54.0±2.4 82.4±1.5 27.0±1.5 83.7±1.4 28.5±2.4 82.0±1.0 28.0±1.6 82.1±1.2 28.1±2.1 83.3±1.2 28.5±1.4 84.1±1.3 29.7±1.8 83.1±1.6 27.8±2.2 84.4±1.0 29.4±2.6 83.3±2.0 29.1±1.8 83.1±1.7 28.8±2.4 82.6±1.2 28.4±1.8 84.2±1.2 30.0±2.0 82.0±0.8 57.2±1.1 GCNII [44] +DPM-SNC (ours) 83.8±0.7 61.6±0.9 84.0±0.6 63.4±0.8 85.3±0.6 65.8±0.7 72.9±0.5 52.1±0.7 74.1±0.5 54.1±0.9 91.2±1.2 53.2±1.5 92.8±1.1 54.2±1.2 82.5±1.4 26.6±1.3 84.4±1.8 29.2±1.1 Homophilic graph. In this experiment, we consider five datasets: Pubmed, Cora, and Citeseer [22]; Photo and Computer [23]. For all datasets, 20 nodes per class are used for training, and the remaining nodes are used for validation and testing. Detailed data statistics are in Appendix D. We compare DPM-SNC with conventional GNN, and structured prediction baselines. We compare with label propagation-based methods: LP [42], GCN-LPA [12], and PTA [43]. We also consider G3NN, GMNN, and CLGNN. We describe the detailed experimental setup in Appendix E.2. As the backbone network, we consider GCN and GAT [21]. We further evaluate our algorithm with the recently developed GCNII [44]. For all the datasets, we evaluate the node-level accuracy. We also report the subgraph-level accuracy, which measures the ratio of nodes with all neighboring nodes being correctly classified. The performance is measured using ten different random seeds. The results are presented in Table 2. Our method outperforms the structured prediction-specialized baselines in both node-label accuracy and subgraph-level accuracy. These results highlight the superiority of DPM-SNC in solving real-world node classification problems. Furthermore, even when we combine our method with GCNII [44], our method achieves performance improvements. As can be observed, DPM-SNC consistently improves performance regardless of the backbone network. Heterophilic graph. To validate whether our frame- work can also consider heterophily dependencies, we consider recently proposed heterophilic graph datasets: Empire and Ratings [24], where most heterophily- specific GNNs fail to solve. In Table 3, we compare our method with six GNNs: GCN, SAGE [4], GAT, GAT- sep [24], GT [53], and GT-sep [24]. We also compare with eight heterophily-specific GNNs: H2GCN [45], CPGNN [46], GPR-GNN [47], FSGNN [48], GloGNN [49], FAGCN [50], GBK-GNN [51], and JacobiConv [52]. We employ GAT-sep as a backbone network of DPM-SNC. For all the baselines, we use the numbers reported by Platonov et al. [24]. Table 3 shows that our method again achieves compet- itive performance on heterophilic graphs. While ex- isting heterophily-specific GNNs do not perform well on these datasets [24], our method shows improved performance stems from the extraordinary ability for considering label dependencies involving heterophily label dependencies. 7 Table 3: The transductive node classifica- tion accuracy on heterophilic graphs. Bold numbers indicate the best score. H2GCN [45] CPGNN [46] GPR-GNN [47] FSGNN [48] GloGNN [49] FAGCN [50] GBK-GNN [51] JacobiConv [52] GCN [3] SAGE [4] GAT [21] GAT-sep [24] GT [53] GT-sep [24] Empire Rating 60.11±0.52 63.96±0.62 64.85±0.27 79.92±0.56 59.63±0.69 65.22±0.56 74.57±0.47 71.14±0.42 73.69±0.74 85.74±0.67 80.87±0.30 88.75±0.41 86.51±0.73 87.32±0.39 36.47±0.23 39.79±0.77 44.88±0.34 52.74±0.83 36.89±0.14 44.12±0.30 45.98±0.71 43.55±0.48 48.70±0.63 53.63±0.39 49.09±0.63 52.70±0.62 51.17±0.66 52.18±0.80 DPM-SNC (ours) 89.52±0.46 54.66±0.39 Table 4: The inductive node classification performance. N-Acc., G-Acc., and F1 denote the node-level accuracy, graph-level accuracy, and micro-F1 score, respectively. Bold numbers indicate the best performance among the structured prediction methods using the same GNN. Pubmed Cora Citeseer Method N-Acc. G-Acc. N-Acc. G-Acc. N-Acc. G-Acc. GCN [3] +G3NN [8] +CLGNN [13] +SPN [9] +DPM-SNC (ours) GAT [21] +G3NN [8] +CLGNN [13] +SPN [9] +DPM-SNC (ours) 80.25±0.42 80.32±0.30 80.22±0.45 80.78±0.34 80.58±0.41 80.10±0.45 79.88±0.62 80.23±0.40 79.95±0.34 80.26±0.37 54.58±0.51 53.93±0.71 53.98±0.54 54.91±0.40 55.16±0.43 54.38±0.54 54.66±0.29 54.51±0.36 54.82±0.33 54.26±0.47 83.36±0.43 83.60±0.25 83.45±0.34 83.85±0.60 84.09±0.27 79.71±1.41 81.19±0.45 81.38±0.55 81.61±0.31 81.79±0.46 59.67±0.51 59.78±0.47 60.24±0.38 60.35±0.57 60.88±0.36 56.66±1.40 58.68±0.38 58.81±0.61 59.17±0.31 59.55±0.49 76.37±0.35 76.34±0.37 75.71±0.40 76.25±0.48 77.01±0.49 74.91±0.22 75.45±0.26 75.45±0.36 75.41±0.35 76.46±0.60 49.84±0.47 50.76±0.47 50.51±0.38 51.02±1.06 51.44±0.56 49.87±0.44 50.86±0.46 50.66±0.45 51.04±0.53 52.05±0.71 PPI F1 99.15±0.03 99.33±0.02 99.22±0.04 99.35±0.02 99.46±0.02 99.54±0.01 99.56±0.01 99.55±0.01 99.46±0.02 99.63±0.01 Table 5: Performance on graph algorithmic reasoning tasks. Bold numbers indicate the best perfor- mance. Same-MSE and Large-MSE indicate the performance on ten, and 15 nodes, respectively. Edge copy Connected components Shortest path Method Same-MSE Large-MSE Same-MSE Large-MSE Same-MSE Large-MSE Feedforward Recurrent [54] Programmatic [55] Iterative feedforward [56] IREM [26] DPM-SNC (ours) 0.3016 0.3015 0.3053 0.6163 0.0019 0.0011 0.3124 0.3113 0.4409 0.6498 0.0019 0.0038 0.1796 0.1794 0.2338 0.4908 0.1424 0.0724 0.3460 0.2766 3.1381 1.2064 0.2171 0.1884 0.1233 0.1259 0.1375 0.4588 0.0274 0.0138 1.4089 0.1083 0.1290 0.7688 0.0464 0.0286 6.2 Inductive setting We further show that our DPM-SNC works well not only in transductive settings but also in inductive settings which involve inductive node classification and graph algorithmic reasoning. We provide the details of our implementation in Appendix C.2. Inductive node classification. Following Qu et al. [9], we conduct experiments on both small-scale and large-scale graphs. We construct small-scale graphs from Pubmed, Cora, and Citeseer, and construct large-scale graphs from PPI [25]. The detailed data statistics are described in Appendix D. We compare our DPM-SNC with the conventional GNN and three structured node classification methods: G3NN, CLGNN, and SPN [9]. As the backbone network of each method, we consider GCN and GAT. We evaluate node-level accuracy across all datasets and supplement it with additional metrics: graph-level accuracy for small-scale graphs and micro-F1 score for large-scale graphs. The graph-level accuracy measures the ratio of graphs with where all the predictions are correct. We report the performance measured using ten and five different random seeds for small-scale and large-scale graphs, respectively. The detailed experimental setup is described in Appendix E.3. We report the results in Table 4. Here, DPM-SNC shows competitive results compared to all the baselines except for Pubmed. These results suggest that the DPM-SNC also solves inductive node classification effectively, thanks to their capability for learning joint dependencies between node labels. Algorithmic reasoning. We also evaluate our DPM-SNC to predict the outcomes of graph algorithms, e.g., computing the shortest path between two nodes. Solving such tasks using GNNs has gained much attention since it builds connections between deep learning and classical computer science algorithms. Here, we show that the capability of DPM-SNC to make a structured prediction even brings benefits to solving the reasoning tasks by a deep understanding between algorithmic elements. We evaluate the performance of our DPM-SNC on three graph algorithmic reasoning benchmarks proposed by Du et al. [26]: edge copy, connected component, and shortest path. The detailed data statistics are described in Appendix D. Here, we evaluate performance on graphs with ten nodes. Furthermore, we also use graphs with 15 nodes to evaluate generalization capabilities. We report the performance using element-wise mean square error. 8 Figure 5: Accuracy with varying GNN layers and diffusion steps. Figure 6: Accuracy for changes in diffusion steps. Figure 7: Accuracy with varying inference time. We compare our method with five methods reported by Du et al. [26], including a feedforward neural network, recurrent neural network [54], Pondernet [55], iterative feedforward [56], and IREM [26]. For all the baselines, we use the numbers reported by Du et al. [26]. As these tasks are defined on edge-wise targets, we modify DPM-SNC to make edge-wise predictions. We describe the detailed experimental setup in Appendix E.4. We report the results in Table 5. Our DPM-SNC outperforms the considered baselines for five out of the six tasks. These results suggest that the diffusion model can easily solve algorithmic reasoning tasks thanks to its superior ability to make structured predictions. 6.3 Ablation studies Here, we conduct ablation studies to empirically analyze our framework. All the results are measured over ten different random seeds. Diffusion steps vs. number of GNN layers. We first verify that the performance gains in DPM-SNC mainly stem from the reverse diffusion process which learns the joint dependency between labels. To this end, we vary the number of diffusion steps along with the number of GNN layers. We report the corresponding results in Figure 5. One can observe that increasing the number of diffusion steps provides a non-trivial improvement in performance, which cannot be achieved by just increasing the number of GNN layers. Accuracy over diffusion steps. We investigate whether the iteration in the reverse process progres- sively improves the quality of predictions. In Figure 6, we plot the changes in node-level accuracy in the reverse process as the number of iterations increases. The results confirm that the iterative inference process gradually increases accuracy, eventually reaching convergence. Running time vs. performance. Here, we investigate whether the DPM-SNC can make a good trade-off between running time and performance. In Figure 7, we compare the change in accuracy of DPM-SNC with GCNII over the inference time on Citeseer by changing the number of layers and diffusion steps for DPM-SNC and GCNII, respectively. The backbone network of DPM-SNC is a two-layer GCN. One can observe that our DPM-SNC shows competitive performances compared to the GCNII at a similar time. Also, while increasing the inference times of the GCNII does not enhance performance, DPM-SNC shows further performance improvement. 7 Conclusion and Discussion In this paper, we propose diffusion probabilistic models for solving structured node classification (DPM-SNC). Extensive experiments on both transductive and inductive settings show that DPM-SNC outperforms existing structured node classification methods. An interesting avenue for future work is the study of characterizing the expressive power of GNNs to make structured predictions, i.e., the ability to learn complex dependencies between node-wise labels. Limitations. Our DPM-SCN makes a trade-off between accuracy and inference time through the number of diffusion steps. Therefore, we believe accelerating our framework with faster diffusion- based models, e.g., denoising diffusion implicit models (DDIM) [57] is an interesting future work. 9 510204080Diffusion steps54321Number of layers65.767.168.467.368.069.670.471.170.771.070.971.371.371.571.972.673.374.074.374.471.472.172.472.472.9020406080Step6570758085AccuracyPubmedCoraCiteseer0.020.040.060.08Time (s)7172737475AccuracyGCNIIDPM-SNC References [1] Wenqi Fan, Yao Ma, Qing Li, Yuan He, Eric Zhao, Jiliang Tang, and Dawei Yin. Graph neural networks for social recommendation. In The world wide web conference, pages 417–426, 2019. 1 [2] Prithviraj Sen, Galileo Namata, Mustafa Bilgic, Lise Getoor, Brian Galligher, and Tina Eliassi- Rad. Collective classification in network data. AI magazine, 29(3):93–93, 2008. 1, 4 [3] Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016. 1, 2, 3, 6, 7, 8 [4] Will Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. NeurIPS, 30, 2017. 1, 3, 7 [5] Karsten M Borgwardt and Hans-Peter Kriegel. Shortest-path kernels on graphs. In Fifth IEEE international conference on data mining (ICDM'05), pages 8–pp. IEEE, 2005. 1 [6] Aditya Grover and Jure Leskovec. node2vec: Scalable feature learning for networks. In Proceedings of the 22nd ACM SIGKDD international conference on Knowledge discovery and data mining, pages 855–864, 2016. 1 [7] Meng Qu, Yoshua Bengio, and Jian Tang. Gmnn: Graph markov neural networks. In Inter- national conference on machine learning, pages 5241–5250. PMLR, 2019. 1, 2, 3, 5, 6, 7, 22 [8] Jiaqi Ma, Weijing Tang, Ji Zhu, and Qiaozhu Mei. A flexible generative framework for graph- based semi-supervised learning. Advances in Neural Information Processing Systems, 32, 2019. 1, 6, 7, 8 [9] Meng Qu, Huiyu Cai, and Jian Tang. Neural structured prediction for inductive node classifica- tion. arXiv preprint arXiv:2204.07524, 2022. 1, 3, 8, 23 [10] Tengfei Ma, Cao Xiao, Junyuan Shang, and Jimeng Sun. CGNF: Conditional graph neural fields, 2019. [11] Colin Graber and Alexander Schwing. Graph structured prediction energy networks. Advances in Neural Information Processing Systems, 32, 2019. [12] Hongwei Wang and Jure Leskovec. Unifying graph convolutional neural networks and label propagation. arXiv preprint arXiv:2002.06755, 2020. 7 [13] Mengyue Hang, Jennifer Neville, and Bruno Ribeiro. A collective learning framework to boost gnn expressiveness for node classification. In International Conference on Machine Learning, pages 4040–4050. PMLR, 2021. 1, 2, 3, 6, 7, 8, 17 [14] John Lafferty, Andrew McCallum, and Fernando CN Pereira. Conditional random fields: Probabilistic models for segmenting and labeling sequence data. 2001. 1, 4 [15] Xiaojin Zhu and Zoubin Ghahramani. Learning from labeled and unlabeled data with label propagation. 2002. 1 [16] Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 2020. 2, 5, 14 [17] BE Rhoades. Some fixed point iteration procedures. International Journal of Mathematics and Mathematical Sciences, 14(1):1–16, 1991. 2, 5 [18] Hyungjin Chung, Byeongsu Sim, Dohoon Ryu, and Jong Chul Ye. Improving diffusion models for inverse problems using manifold constraints. arXiv preprint arXiv:2206.00941, 2022. 2, 3, 4, 5, 15 [19] Boris Weisfeiler and Andrei Leman. The reduction of a graph to canonical form and the algebra which appears therein. nti, Series, 2(9):12–16, 1968. 2, 3, 6, 16 10 [20] Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? arXiv preprint arXiv:1810.00826, 2018. 2, 3, 6, 21 [21] Petar Veliˇckovi ́c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Liò, and Yoshua Bengio. Graph attention networks. In International Conference on Learning Representations, 2018. 2, 7, 8 [22] Zhilin Yang, William Cohen, and Ruslan Salakhudinov. Revisiting semi-supervised learning with graph embeddings. In International conference on machine learning, pages 40–48. PMLR, 2016. 2, 7, 23 [23] Oleksandr Shchur, Maximilian Mumme, Aleksandar Bojchevski, and Stephan Günnemann. Pitfalls of graph neural network evaluation. arXiv preprint arXiv:1811.05868, 2018. 2, 7, 23 [24] Oleg Platonov, Denis Kuznedelev, Michael Diskin, Artem Babenko, and Liudmila Prokhorenkova. A critical look at the evaluation of gnns under heterophily: Are we really making progress? In The Eleventh International Conference on Learning Representations. 2, 7, 23, 25 [25] Marinka Zitnik and Jure Leskovec. Predicting multicellular function through multi-layer tissue networks. Bioinformatics, 33(14):i190–i198, 2017. 2, 8, 23 [26] Yilun Du, Shuang Li, Joshua Tenenbaum, and Igor Mordatch. Learning iterative reasoning through energy minimization. In International Conference on Machine Learning, pages 5570– 5582. PMLR, 2022. 2, 3, 8, 9, 22, 24, 26 [27] Petar Veliˇckovi ́c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua Bengio. Graph attention networks. arXiv preprint arXiv:1710.10903, 2017. 3 [28] Ben Chamberlain, James Rowbottom, Maria I Gorinova, Michael Bronstein, Stefan Webb, and Emanuele Rossi. Grand: Graph neural diffusion. In International Conference on Machine Learning, pages 1407–1418. PMLR, 2021. 3 [29] David Belanger and Andrew McCallum. Structured prediction energy networks. In International Conference on Machine Learning, pages 983–992. PMLR, 2016. 3 [30] Colin Graber, Ofer Meshi, and Alexander Schwing. Deep structured prediction with nonlinear output transformations. Advances in Neural Information Processing Systems, 31, 2018. [31] Victor Garcia Satorras, Zeynep Akata, and Max Welling. Combining generative and discrimi- native models for hybrid inference. Advances in Neural Information Processing Systems, 32, 2019. 3 [32] Julian Besag. Statistical analysis of non-lattice data. Journal of the Royal Statistical Society: Series D (The Statistician), 24(3):179–195, 1975. 3, 5 [33] Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. Advances in Neural Information Processing Systems, 34:8780–8794, 2021. 3 [34] Xiang Lisa Li, John Thickstun, Ishaan Gulrajani, Percy Liang, and Tatsunori B Hashimoto. Diffusion-LM improves controllable text generation. arXiv preprint arXiv:2205.14217, 2022. 3 [35] Emiel Hoogeboom, Vıctor Garcia Satorras, Clément Vignac, and Max Welling. Equivariant diffusion for molecule generation in 3d. In International Conference on Machine Learning, pages 8867–8887. PMLR, 2022. 3 [36] Hyungjin Chung, Jeongsol Kim, Michael T Mccann, Marc L Klasky, and Jong Chul Ye. Diffu- sion posterior sampling for general noisy inverse problems. arXiv preprint arXiv:2209.14687, 2022. 3 [37] Jiaming Song, Arash Vahdat, Morteza Mardani, and Jan Kautz. Pseudoinverse-guided diffusion models for inverse problems. In International Conference on Learning Representations, 2023. 3 11 [38] Joseph J Pfeiffer III, Jennifer Neville, and Paul N Bennett. Overcoming relational learning biases to accurately predict preferences in large scale networks. In Proceedings of the 24th International Conference on World Wide Web, pages 853–863, 2015. 5 [39] Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013. 6 [40] Danilo Rezende and Shakir Mohamed. Variational inference with normalizing flows. In International conference on machine learning, pages 1530–1538. PMLR, 2015. 6 [41] Beatrice Bevilacqua, Fabrizio Frasca, Derek Lim, Balasubramaniam Srinivasan, Chen Cai, Gopinath Balamurugan, Michael M Bronstein, and Haggai Maron. Equivariant subgraph aggregation networks. arXiv preprint arXiv:2110.02910, 2021. 6, 17 [42] Fei Wang and Changshui Zhang. Label propagation through linear neighborhoods. In Pro- ceedings of the 23rd international conference on Machine learning, pages 985–992, 2006. 7 [43] Hande Dong, Jiawei Chen, Fuli Feng, Xiangnan He, Shuxian Bi, Zhaolin Ding, and Peng Cui. On the equivalence of decoupled graph convolution network and label propagation. In Proceedings of the Web Conference 2021, pages 3651–3662, 2021. 7 [44] Ming Chen, Zhewei Wei, Zengfeng Huang, Bolin Ding, and Yaliang Li. Simple and deep graph convolutional networks. In International conference on machine learning, pages 1725–1735. PMLR, 2020. 7 [45] Jiong Zhu, Yujun Yan, Lingxiao Zhao, Mark Heimann, Leman Akoglu, and Danai Koutra. Be- yond homophily in graph neural networks: Current limitations and effective designs. Advances in Neural Information Processing Systems, 33:7793–7804, 2020. 7 [46] Jiong Zhu, Ryan A Rossi, Anup Rao, Tung Mai, Nedim Lipka, Nesreen K Ahmed, and Danai Koutra. Graph neural networks with heterophily. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 11168–11176, 2021. 7 [47] Eli Chien, Jianhao Peng, Pan Li, and Olgica Milenkovic. Adaptive universal generalized pagerank graph neural network. In International Conference on Learning Representations, 2021. 7 [48] Sunil Kumar Maurya, Xin Liu, and Tsuyoshi Murata. Improving graph neural networks with simple architecture design. arXiv preprint arXiv:2105.07634, 2021. 7 [49] Xiang Li, Renyu Zhu, Yao Cheng, Caihua Shan, Siqiang Luo, Dongsheng Li, and Weining Qian. Finding global homophily in graph neural networks when meeting heterophily. arXiv preprint arXiv:2205.07308, 2022. 7 [50] Deyu Bo, Xiao Wang, Chuan Shi, and Huawei Shen. Beyond low-frequency information in graph convolutional networks. In AAAI. AAAI Press, 2021. 7 [51] Lun Du, Xiaozhou Shi, Qiang Fu, Xiaojun Ma, Hengyu Liu, Shi Han, and Dongmei Zhang. Gbk-gnn: Gated bi-kernel graph neural networks for modeling both homophily and heterophily, 2022. 7 [52] Xiyuan Wang and Muhan Zhang. How powerful are spectral graph neural networks. International Conference on Machine Learning, pages 23341–23362. PMLR, 2022. 7 In [53] Yunsheng Shi, Zhengjie Huang, Shikun Feng, Hui Zhong, Wenjin Wang, and Yu Sun. Masked label prediction: Unified message passing model for semi-supervised classification. arXiv preprint arXiv:2009.03509, 2020. 7 [54] Avi Schwarzschild, Eitan Borgnia, Arjun Gupta, Furong Huang, Uzi Vishkin, Micah Goldblum, and Tom Goldstein. Can you learn an algorithm? generalizing from easy to hard problems with recurrent networks. Advances in Neural Information Processing Systems, 34:6695–6706, 2021. 8, 9 12 [55] Andrea Banino, Jan Balaguer, and Charles Blundell. Pondernet: Learning to ponder. In 8th ICML Workshop on Automated Machine Learning (AutoML). 8, 9 [56] Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsuper- vised learning using nonequilibrium thermodynamics. In International Conference on Machine Learning, pages 2256–2265. PMLR, 2015. 8, 9 [57] Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. In International Conference on Learning Representations. 9 [58] Muhan Zhang, Pan Li, Yinglong Xia, Kai Wang, and Long Jin. Labeling trick: A theory of using graph neural networks for multi-node representation learning. Advances in Neural Information Processing Systems, 34:9061–9073, 2021. 17 [59] Ryan Murphy, Balasubramaniam Srinivasan, Vinayak Rao, and Bruno Ribeiro. Relational pooling for graph representations. In International Conference on Machine Learning, pages 4663–4673. PMLR, 2019. 18 [60] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017. 22 [61] Weihua Hu, Bowen Liu, Joseph Gomes, Marinka Zitnik, Percy Liang, Vijay Pande, and Jure Leskovec. Strategies for pre-training graph neural networks. arXiv preprint arXiv:1905.12265, 2019. 26 13 A Details of DPM on partially labeled graphs A.1 Derivation of variational lower bound In this section, we provide a detailed derivation of the variational lower bound in Equation (1). log pθ(yL|G) = log E pθ (yU ,y(1:T )|G) = log E q(yU ,y(1:T )|yL) (cid:104) (cid:105) pθ(yL|G, yU , y(1:T )) (cid:20) pθ(y, y(1:T )|G) q(yU , y(1:T )|yL) (cid:21) ≥ E q(yU ,y(1:T )|yL) = E q(yU ,y(1:T )|yL) (cid:104) (cid:104) log pθ(y, y(1:T )|G) − q(yU , y(1:T )|yL) (cid:105) log pθ(y, y(1:T )|G) − q(y(1:T )|y) − log q(yU |yL) (cid:105) = Eq(yU |yL) (cid:104) (cid:105) E q(y(1:T )|y)[log pθ(y, y(1:T )|G) − q(y(1:T )|y)] − log q(yU |yL) . A.2 Parameterization Here, we provide more detailed parameterization for DPM-SNC. Following the Gaussian diffusion, we parameterize p(yT ) and pθ(y(t−1)|G, y(t)) as N (y(T ); 0, I) and N (y(t−1); μθ(y(t), G, t), σ2 t ), respectively. Here, we set σ2 t to βt. We also define μθ(y(t), G, t) as follows: (cid:19) (cid:18) μθ(y(t), G, t) = 1 √ αt y(t) − βt√ 1 − ̄αt εθ(y(t), G, t) , (2) where αt = 1 − βt and ̄αt = (cid:81)t GNN. The implementation details are described in Appendix C. i=1 αi. We implement the residual function εθ(y(t), G, t) through a A.3 Detailed training objective We describe the detailed training objective of LVLB for optimization. We first rewrite LVLB as follows: LVLB (cid:20) E q(y(1:T )|y) (cid:20) log pθ(y, y(1:T )|G) − log q(y(1:T )|y) (cid:21) (cid:21) − log q(yU |yL) (cid:20) E q(y(1:T )|y) (cid:20) E q(y(1:T )|y) (cid:20) E q(y(1:T )|y) (cid:20) T (cid:88) t=1 (cid:20) T (cid:88) t=1 (cid:20) T (cid:88) t=1 (cid:20) E q(y(1:T )|y) = Eq(yU |yL) = Eq(yU |yL) = Eq(yU |yL) = Eq(yU |yL) = Eq(yU |yL) = Eq(yU |yL) (cid:20) T (cid:88) t=1 (cid:20) T (cid:88) t=1 L(t) DPM + C − log q(yU |yL) (cid:21) , log pθ(y(t−1)|G, y(t)) q(y(t)|y(t−1)) + log p(y(T )) (cid:21) (cid:21) − log q(yU |yL) log pθ(y(t−1)|G, y(t)) q(y(t−1)|y(t), y) q(y(t−1)|y) q(y(t)|y) (cid:21) + log p(y(T )) (cid:21) − log q(yU |yL) log pθ(y(t−1)|G, y(t)) q(y(t−1)|y(t), y) + log p(y(T )) q(y(T )|y) (cid:21) (cid:21) − log q(yU |yL) log pθ(y(t−1)|G, y(t)) q(y(t−1)|y(t), y) (cid:21) + E q(y(T )|y) (cid:20) log (cid:21) p(y(T )) q(y(T )|y) − log q(yU |yL) (cid:21) where L(t) Following Ho et al. [16], we simplify L(t) DPM is a training objective for a t step, and C is a constant with respect to the parameters θ. DPM with a residual function εθ(y(t), G, t) in Equation (2). √ (cid:20) (cid:21) √ L(t) DPM = C − Eε∼N (0,I) β2 t t αt(1 − ̄αt) 2σ2 (cid:13) (cid:13)ε − εθ( ̄αty + 1 − ̄αtε, G, t)(cid:13) 2 (cid:13) 2 , where C is a constant with respect to the parameters θ. An additional suggestion from Ho et al. [16] is to set all weights of the mean squared error to one instead of β2 t αt(1 − ̄αt), and we follow this suggestion in this paper. t /2σ2 14 A.4 Manifold-constrained sampling Algorithm 2 Manifold-constrained sampling 1: Input: Graph G, node attributes x, labels yL, and temperature of randomness τ 2. 2: Get y(T ) ∼ N (y(T ); 0, τ 2I) 3: for t = T − 1, . . . , 0 do Get z ∼ N (z; 0, τ 2I) 4: ▷ Initial sampling (cid:18) Set ̃y(t) ← 1√ αt y(t+1) − βt+1√ 1− ̄αt+1 εθ(y(t+1), G, t + 1) Set ˆy(t+1) ← 1√ ̄αt+1 (cid:18) y(t+1) − 1− ̄αt+1 1− ̄αt+1 √ εθ(y(t+1), G, t + 1) (cid:19) + σt+1z (cid:19) (cid:18) Set ̄y(t) ← ̃y(t) − γ ∂ ∂y(t+1) (cid:13) (cid:13)yL − ˆy(t+1) (cid:13) L (cid:13) 2 (cid:13) (cid:13) 2 (cid:19) ▷ Manifold-constrained gradient 5: 6: 7: 8: 9: 10: U Set y(t) U ← ̄y(t) Get z ∼ N (z; 0, τ 2I) √ Set y(t) L ← ̄αtyL + L ∪ y(t) Set y(t) ← y(t) U √ 11: 12: end for 13: return y(0) U 1 − ̄αtz ▷ Projection step To sample yU from pθ(yU |G, yL), we use a manifold-constrained sampling proposed by Chung et al. [18]. Here, the update rule of the reverse process for t = 0, . . . , T − 1 is defined as follows: ̃y(t) = 1 √ αt U = ̄y(t) y(t) U , √ y(t) L = (cid:18) y(t+1) − √ βt+1 1 − ̄αt+1 εθ(y(t+1), G, t + 1) (cid:19) + σt+1z, ∂ ∂y(t+1) (cid:13) (cid:13)yL − ˆy(t+1) (cid:13) L (cid:13) 2 (cid:13) (cid:13) 2 , ̄y(t) = ̃y(t) − γ √ 1 − ̄αtz, ̄αtyL + (3) (4) (5) where z is sampled from N (z; 0, τ 2I). The Equation (3) is a temporal reverse diffusion step before applying the manifold-constrained samplings. The Equation (4) applies the manifold-constrained 2. Here, ˆy(t+1) is the label estimate in t + 1 steps defined as follows: ∥2 gradient γ ∂ L ∂y(t+1) ∥yL − ˆy(t+1) 1 ̄αt+1 ˆy(t+1) = √ (cid:18) y(t+1) − 1 − ̄αt+1 √ 1 − ̄αt+1 εθ(y(t+1), G, t + 1) (cid:19) , where γ is a hyper-parameter. We set γ to 1/∥yL − ˆy(t+1) ∥2 2. The Equation (5) is a projection step. Additionally, we introduce a parameter τ to control the randomness; when we set τ to zero, the modified reverse step becomes deterministic. This allows us to control the randomness in obtaining samples. We describe the detailed sampling algorithm in Algorithm 2. L 15 B WL test and GNN's expressiveness In this section, we provide the proof of Theorem 1 in detail. B.1 Preliminaries G(v) ← hash(xv) for v ∈ V G. Algorithm 3 1-dimensional Weisfeiler-Lehman algorithm 1: Input: Graph G = (V G, E G, xG) and the number of iterations T . 2: Output: Color mapping χG : V G → C. 3: Initialize: Let χ0 4: for t = 1, . . . , T do 5: 6: 7: 8: end for 9: Return: χT G G (u) : u ∈ NG(v)}}) G(v) ← hash(χt−1 for each v ∈ V G do G (v), {{χt−1 Set χt end for We denote set as {}, and multiset as {{}}, which is a set allowing duplicate elements. We represent the cardinality of set or multiset S as |S|. A graph is denoted as G = (V G, E G, xG), where V G stands v : v ∈ V G} for the node-wise attributes. for the set of nodes, E G for the set of edges, and xG = {xG We also use NG(v) := {u ∈ V G : {v, u} ∈ E G} to denote the set of neighbor nodes of node v in graph G. We abbreviate a set of integers using the notation [m] := {0, . . . , m}. We also assume the hash functions are all injective and denote them by hash(*). Definition 1 (Vertex coloring). Vertex coloring χG(v) is an injective hash function that maps a vertex v in graph G to a color c from an abstract color set C. Next, with a slight abuse of notation, we let the graph color χG indicate the multiset of node colors in graph G, i.e., χG := {{χG(v) : v ∈ V G}}. Now we explain the 1-dimensional Weisfeiler-Lehman (1-WL) algorithm [19], a classical algorithm to distinguish non-isomorphic graphs. At a high level, the 1-WL test iteratively updates node colors based on their neighbors until a stable coloring is reached. To be specific, given a vertex v, the initial node color χ0 G(v) is set using an injective hash function on the node attribute xv. At each iteration, each node color is refined based on the aggregation of neighbor node colors, e.g., {{χt−1 G (u) : u ∈ NG(v)}}. At the final T -th iteration, the algorithm returns the graph color χT G. We provide a detailed description in Algorithm 3. The 1-WL test allows to compare a pair of graphs G, H using the refined graph colors χT H . If the two graph colors χT H are not equivalent, two graphs G, H are guaranteed to be non- isomorphic. Otherwise, the test is inconclusive, i.e., the two graphs G, H are possibly isomorphic. We provide an example run of the 1-WL test in Figure 8(a), where the test is inconclusive. G and χT G, χT Related to the 1-WL algorithm, we first prove a characteristic of it that will be later used in our proof. Lemma 1. Consider running 1-WL on two graphs G = (V G, E G, xG) and H = (V H , E H , xH ). If the initial graph colors of two graphs are distinct, i.e., χ0 H , the respective outputs of the 1-WL G ̸= χT are also distinct, i.e., χT H . G ̸= χ0 Proof. We first prove that χt G ̸= χt straightforward by induction on t. To be specific, the 1-WL updates χt H is satisfied when χt−1 G ̸= χt−1 G = {{hash(χt−1 χt H = {{hash(χt−1 χt Since hash(*) is an injective function, χt G (v), {{χt−1 H (v), {{χt−1 G and χt H . The rest of the proof is G and χt H as follows: G (u) : u ∈ NG(v)}}) : v ∈ V G}} H (u) : u ∈ NH (v)}}) : v ∈ V H }}. G ̸= χt−1 H . H are distinct for χt−1 B.2 AGG-WL test Next, we describe the newly proposed AGG-WL test, which is an analog of our DPM-SNC. Similar to the 1-WL test, our AGG-WL test assigns node colors and iteratively refines them based on the 16 neighbor node colors. However, AGG-WL generates augmented graphs at initialization, creating multiple "views" on the graph with diverse initial vertex coloring. Then it applies 1-WL on each of the augmented graphs to obtain the augmented graph colors. Finally, AGG-WL aggregates the augmented graphs colors. The complete algorithm is described in Algorithm 4. Given a graph G = (V G, E G, xG) and the set of possible node-wise augmentations Z G, the algorithm generates augmented graph Gm. In particular, the augmented graph Gm is defined as follows: Gm = (V G, E G, ̃xGm ), ̃xGm = {(xG v ∥ zm v ) : v ∈ V}, zm = {zm v : v ∈ V}, zm ∈ Z G where zm is an augmentation method in Z G. The algorithm creates an augmented graph Gm by node-wise concatenation of zm to its node attributes xG, where ̃xGm denotes the node-wise attribute augmented by zm. The symbol *∥* denotes the concatenation of two elements. Furthermore, z0 is a unique token, where G0 has the same information as G. Also, with a slight abuse of notation, we let the graph color returned by the AGG-WL χAGG G indicate the multiset of augmented graph colors, i.e., G := {{χT χAGG Gm : m ∈ [|Z G|]}}. Here, |Z G| denotes the cardinality of set Z G. Algorithm 4 Aggregation Weisfeiler-Lehman algorithm 1: Input: Graph G = (V G, E G, xG), the number of iterations T , and the augmentation set Z G. 2: Output: Color mapping χG : V G → C. 3: Initialize: Generate |Z G| augmented graphs Gm = (V G, E G, xGm = {(xG v ∥ zm v ) : Gm(v) ← hash( ̃xGm v ) where ̃xGm ) for v ∈ V G, m ∈ [|Z G|]. v ∈ V G} for zm ∈ Z G. Let χ0 for m ∈ [|Z G|] do Gm(v) ← hash(χt−1 χt end for 4: for t = 1, . . . , T do for each v ∈ V do 5: 6: 7: 8: 9: 10: end for G ← {{χT 11: χAGG 12: Return: χAGG G end for Gm : m ∈ [|Z G|]}} Gm (v), {{χt−1 Gm (u) : u ∈ NGm(v)}}) Our contribution is establishing the connection between the AGG-WL and the DPM-SNC: aggregation of refined graph colors for augmented graphs and marginalization over latent variables. More detail between DPM-SNC and the AGG-WL test is described in Appendix B.3.2. We note that our algorithm bears some similarities with several previous studies. The DS-WL and DSS-WL test [41] defined a modified WL-test based on the set of subgraphs (instead of augmented graphs) with a modified edge set E ′. Hang et al. [13] uses a collective algorithm to consider pseudo- labels as additional inputs to boost GNN expressiveness. However, they rely on the assumption that one can find an "optimal" pseudo-label to discriminate a pair of graphs, which may be hard to realize in practice. Zhange et al. [58] proposed labeling tricks that learns to capture dependence between nodes also by adding additional features, but mainly focus on link prediction in inductive settings. B.3 Proof of Theorem 1 Let us start by restating Theorem 1. Theorem 1. Let 1-WL-GNN be a GNN as powerful as the 1-WL test. Then, DPM-SNC using a 1-WL-GNN is strictly more powerful than the 1-WL-GNN in distinguishing non-isomorphic graphs. Proof. We divide the proof into two parts, Appendices B.3.1 and B.3.2. In Appendix B.3.1, we show that the AGG-WL test is strictly more powerful than the 1-WL test. In Appendix B.3.2, we show that DPM-SNC using a 1-WL-GNN is as powerful as the AGG-WL test. From these two proofs, one can conclude that DPM-SNC using a 1-WL-GNN is strictly more powerful than 1-WL-GNNs in distinguishing non-isomorphic graphs. 17 B.3.1 Expressiveness of AGG-WL test In this subsection, we prove that the AGG-WL test is strictly more powerful that the 1-WL test. The high-level idea is showing that (i) the AGG-WL test is at least as powerful as the 1-WL test, i.e., any two graphs distinguishable by the 1-WL test is also distinguishable by the AGG-WL test, and (ii) there exist two non-isomorphic graphs that are indistinguishable by the 1-WL test, but distinguishable by our AGG-WL test. Lemma 2. AGG-WL is at least as powerful as WL in distinguishing non-isomorphic graphs, i.e., any two non-isomorphic graphs G, H distinguishable by WL are also distinguishable by AGG-WL. Proof. We first note that both 1-WL and AGG-WL can discriminate two non-isomorphic graphs with distinct sizes in a straightforward way. Therefore, we focus on non-trivial cases for two graphs G = (V G, E G, xG), H = (V H , E H , xH ) where the number of nodes and edges are same, i.e., |V G| = |V H |, |E G| = |E H |. The cardinality of the augmentation sets are also the same, |Z G| = |Z H |. We prove if these two graphs G, H are distinguishable by the 1-WL, two graphs G, H are also distinguishable by the AGG-WL, i.e., if χT First, since χT of graph augmented by the unique token and any other augmentations are distinct, i.e., χ0 H = {χT H 1, . . . , χ0 χ0 G0 ̸∈ χAGG shows distinct initial graph colors produce the distinct outputs of 1-WL. Since χT see that χAGG G ̸= χAGG H . H 0 is trivial. Additionally, the initial graphs colors G0 ̸= H |ZH |} according to Lemma 1 which G , one can H |ZH |. This implies χT H is satisfied, χT H , then χAGG H 0, . . . , χT G0 ∈ χAGG G0 ̸= χT G ̸= χT G ̸= χT G ̸= χAGG H . Next, we show that there exist two graphs G, H indistinguishable by the 1-WL test, but distinguishable by the AGG-WL test. We first show a simple example from Figure 8(a), then for a family of circular skip link (CSL) graphs [59]. Lemma 3. Two graphs A, B are indistinguishable by the 1-WL, but distinguishable by the AGG-WL. Proof. In Figure 8(a), two graphs A, B with 6 nodes are given. Here, the graph color computed by the 1-WL are equivalent, i.e., χT H (two light blue nodes and four gray nodes). Therefore, two graphs A, B are indistinguishable by the 1-WL. G = χT Next, we prove that two graphs A, B are distinguishable by the AGG-WL. Since Lemma 1 shows 1-WL always computes a distinct graph color from distinct initial graph colors, we only need to show that there exists augmented graphs Am, Bm with the same initial color has distinct graph colors computed by the 1-WL. Then, for two augmented graph sets {Am : m ∈ [|Z V A |]} and {Bm : m ∈ [|Z V B |]}, we can show that the graph colors computed by AGG-WL are always distinct. We show a simple case, where augmented graphs with non-zero augmentation on one node results dis- tinct graph colors computed by the AGG-WL. We denote "single binary node feature augmentation", zi as the case where node i is non-zero augmented and other nodes are augmented with zero, e.g., z3 = {0, 0, 1, 0, 0, 0}. In Figure 8(b) the non-zero augmented node i is colored in blue, and others are colored transparent. After applying the 1-WL algorithm on each graph, we obtain the graph color χT Ai and χT Bi : i ∈ {1, . . . , 6}}}, thereby two graphs A, B are distinguishable by AGG-WL. Bi for i ∈ {1, . . . , 6}. It is clear that {{χT Ai : i ∈ {1, . . . , 6}}} ̸= {{χT Circular skip link graphs. CSL graph is denoted as CSL(n, r), where n is the number of nodes, .i.e., V = {0, . . . , n − 1} and r is the skip connection length. For n and r, r < n − 1 must hold. There exists 2n edges, between node i and (i + 1) mod n forming a cycle, and between nodes i and (i + r) mod n forming a skip link for i ∈ {0, . . . , n − 1}. Lemma 4. For n ≥ 8, r ∈ [3, n/2 − 1], two graphs CSL(n, 2) and CSL(n, r) are indistinguishable by the 1-WL, but distinguishable by the AGG-WL. Proof. We first give a brief proof of why CSL(n, 2) and CSL(n, r) are indistinguishable by the 1-WL, then prove they are distinguishable by AGG-WL. We consider a non-trivial case where the node attributes are all same, i.e., χ0 Let the initial color be c0 for all the nodes for graphs CSL(n, 2) and CSL(n, r), χ0 G(v) = c0 ∀v ∈ V G, G ∈ {CSL(n, 2), CSL(n, r)}. Then, for all nodes v ∈ V G, the color refinement process can G(u) for v, u ∈ V G. G(v) = χ0 18 (a) 1-WL (b) AGG-WL Figure 8: An example of two non-isomorphic graphs A, B indistinguishable by 1-WL, but dis- tinguishable by the AGG-WL. (a) Two graphs A, B are associated with nodes sharing the same attribute. The 1-WL computes the same graph color for A, B, i.e., χT B. (b) Applying AGG- WL with "single binary node feature augmentation" to the graphs A and B. This results in six cases for each graph. One can see that the multiset of augmented graph colors are different, i.e., {{χT Bi : i ∈ {1, . . . , 6}}}, thereby two graphs A, B are distinguishable by the AGG-WL. Ai : i ∈ {1, . . . , 6}}} ̸= {{χT A = χT than be written as χ1 G(v) = hash(c0, {{c0, c0, c0, c0}}). All nodes have identical colors c1 for both graphs CSL(n, 2), CSL(n, r), refining the initial graph color. Therefore CSL(n, 2) and CSL(n, r) are indistinguishable by the 1-WL. Now we consider the AGG-WL. Again, we only need to show that there exists augmented graphs Ai, Bj with the same initial color but having distinct graph colors refined by the 1-WL. Given symmetry, there is only one case of an augmented graph that adds a non-zero augmentation to one node. We use vi to denote the i-th node in graph and denote the augmented node as v0. We denote each augmented graph as CSL(n, 2)1, CSL(n, r)1, and let the initial color χ0 G(v0) = c1, and ∀i ∈ {1, . . . , n − 1}, ∀G ∈ {CSL(n, 2)1, CSL(n, r)1} χ0 G(vi) = c0. Iteration 1. We focus on the four nodes connected to v0. Since r ∈ [3, n/2 − 1], two node vn−r, vr are distinct. The color refinement can be written as following: • For v ∈ {v1, v2, vn−1, vn−2}, χ1 CSL(n,2)1(v) = hash(c0, {{c1, c0, c0, c0}}) = c2. • For v /∈ {v1, v2, vn−1, vn−2}, χ1 CSL(n,2)1(v) = hash(c0, {{c0, c0, c0, c0}}) = c3. • For v ∈ {v1, vr, vn−1, vn−r}, χ1 CSL(n,r)1(v) = hash(c0, {{c1, c0, c0, c0}}) = c2. • For v /∈ {v1, vr, vn−1, vn−r}, χ1 CSL(n,r)1(v) = hash(c0, {{c0, c0, c0, c0}}) = c3. 19 (a) Original graph and 1-WL coloring (b) AGG-WL coloring on CSL(8, 2)1, CSL(8, 3)1 Figure 9: Example on two non-attribute CSL(8, 2), CSL(8, 3) graph. (a) 1-WL returns same graph color for two graphs, i.e., χT CSL(8,3). (b) Considering symmetry, there is only one type of augmented graph that with non-zero augmentation on one node, we denoted the augmented graph as CSL(8, 2)1 and CSL(8, 3)1. In the process of 1-WL assigning colors to augmented graph, they result different graph color from the second iteration, and one can conclude χT CSL(8,3)1 . Therefore CSL(8, 2), CSL(8, 3) are distinguishable by the AGG-WL. CSL(8,2)1 ̸= χT CSL(8,2) = χT Since 1-WL showed χ1 two graphs are indistinguishable. CSL(n,2) = χ1 CSL(n,r) and augmented graphs showed χ1 CSL(n,2)1 = χ1 CSL(n,r)1 , Iteration 2. Again, we focus on four nodes connected to v0. Here, we describe color refinement for nodes v1, vn−1, v2, vn−2, since the following is enough to prove two graph colors are distinct. • For v ∈ {v1, vn−1}, χ2 CSL(n,2)1(v) = hash(c2, {{c1, c2, c2, c3}}) = c4. • For v ∈ {v2, vn−2}, χ2 CSL(n,2)1(u) = hash(c2, {{c1, c2, c3, c3}}) = c5. • For v ∈ {v1, vn−1}, χ2 CSL(n,r)1 (v) = hash(c2, {{c1, c3, c3, c3}}) = c6. Since c6 /∈ χ2 CSL(n,2)1, two graphs are distinguishable, i.e., χt CSL(n,2)1 ̸= χt CSL(n,r)1. CSL(n,2)1 ̸= χT Then χT CSL(n, r) are distinguishable by the AGG-WL. CSL(n,r)1 is satisfied as proved in Lemma 1, thereby two graphs CSL(n, 2) and In Figure 9, we provide an example with CSL(8, 2) and CSL(8, 3), indistinguishable by the 1-WL but distinguishable the AGG-WL. B.3.2 Correspondence between DPM-SNC and AGG-WL Now, we explain the connection between the DPM-SNC and the AGG-WL test. At a high-level, we show how DPM-SNC simulates the color refinement process of the AGG-WL. Our main idea stems from the marginalization in DPM-SNC, which can define the probability of the graph color χ with the marginalization over augmented graphs, i.e., pθ(χ|G) = (cid:82) pθ(χ|G, z)p(z|G)dz.4 Specifically, DPM-SNC considers sample space of graph colors, where each member χ is obtained from pθ(χ|G, z) with an augmented graph Gm represented by (G, zm). By construction, DPM-SNC considers graph colors refinements for multiple augmented graphs, similar to how AGG-WL works. Lemma 5. DPM-SNC using a 1-WL-GNN is as powerful as the AGG-WL test in distinguishing non-isomorphic graphs. 4The node labels y is replaced to the graph color χ, and applying a latent variable is interpreted as applying an augmentation to the given graph. 20 Proof. We show that if two graphs G, H are distinguishable by AGG-WL test, it is also distinguish- able by the DPM-SNC. Assume that the two graphs G, H are distinguishable by the AGG-WL. Then, the following condition is satisfied. G = {{χT χAGG Gm : m ∈ [|Z G|]}} ̸= χAGG H = {{χT Hm : m ∈ [|Z H |]}}, where the AGG-WL produces distinct sets of refined graph colors for G, H. Next, we discuss how the DPM-SNC can distinguish G, H. To this end, we first assume a GNN which is as powerful as the 1-WL test [20], denoted as 1-WL-GNN. Specifically, we denote χGNN G as a graph color refined by the 1-WL-GNN, where χT H n for any augmented graph pair Gm, H n. Then, under the χAGG Gm ̸= χGNN H n implies χGNN Gm ̸= χT H , the following condition is also satisfied. Gm : m ∈ [|Z G|]}} ̸= {{χGNN Hm : m ∈ [|Z H |]}}. G ̸= χAGG {{χGNN Here, we assume that DPM-SNC utilizes this 1-WL-GNN to output a graph color conditioned on an augmented graph, i.e., pθ(χ|G, z). Then, we can connect pθ(χ|G, zm) with χGNN Gm as follows: pθ(χ|G, zm) = I[χ = χGNN Gm ]. where I[a = b] is an indicator function whose value is 1 if a = b and 0 otherwise. Next, we also assume that p(z|G) is a uniform distribution over Z G. Then one can show that: pθ(χ|G) = 1 |Z G| (cid:88) I[χ = χGNN Gm ]. m∈[|Z G|] Then it follows that pθ(χ|G) ̸= pθ(χ|H) since {{χGNN Therefore, G, H are distinguishable by DPM-SNC. Gm : m ∈ [|Z G|]}} ̸= {{χGNN Hm : m ∈ [|Z H |]}}. Our proof is valid when considering the multiple outputs. However, our practical implementation of DPM-SNC does not use multiple outputs at inference time since the DPM only considers the multiple random variables in the training objective.5 To this end, in Appendix F, we also investigate the inference scheme which aggregates multiple outputs to make final predictions.6 5Our inference method is described in Appendix C.1 6In practice, we also use a Gaussian diffusion for defining p(z|G), which still allows the GNN to consider infinite augmentations. 21 C Implementation In this section, we provide more details on how we implement the DPM-SNC for experiments. C.1 Transductive settings Here, we provide the detailed implementation of DPM-SNC for transductive node classification. Model architecture. We parameterize the residual function εθ(y(t), G, t) of reverse diffusion step using a L-layer message-passing GNN as follows: εθ(y(t), G, t) = g(h(L)), h(l) , a(l) i = (COMBINE(l)(h(l−1) i = AGGREGATE(l)({h(l−1) a(l) j i i ) + f (t))∥y(t) i ), |(i, j) ∈ E}), where g(h(L)) is a multi-layer perceptron that estimates the residual using the final node represen- tation. AGGREGATE(*) and COMBINE(*) functions are identical to the backbone GNN, and *∥* indicates the concatenation. Here, h0 . The f (*) is a sinusoidal positional embedding function [60]. We fix the dimension of sinusoidal positional embedding to 128. i is xi∥y(t) i Buffer construction. Following the temperature annealing approach of Qu et al. [7] in sampling pseudo-labels for optimization, we also control the temperature of randomness in obtaining yU from pθ(yU |G, yL) for buffer construction. To be specific, we use the variance multiplied by the temperature τ ∈ [0, 1], instead of the original variance in the reverse diffusion step, e.g., setting τ to zero makes the deterministic sampling. Inference. To make final predictions yU from pθ(yU |G, yL) for evaluation, we eliminate the randomness in inference time, i.e., set temperature τ to zero.7 If the target is one-hot relaxation of discrete labels, we also discretize the final prediction by choosing a dimension with maximum value. C.2 Inductive setting Here, we provide the details of DPM-SNC for inductive node classification and graph algorithmic reasoning. For the inductive node classification, we use the same model architecture as in the transductive setting and use the deterministic inference strategy. For the graph algorithmic, we modify DPM-SNC to perform edge-wise prediction. Graph algorithmic reasoning. Since the targets of the graph algorithmic reasoning task are defined on the edge-level, we apply a diffusion process to the edge labels. We then recover the edge-level noisy labels through the reverse process. The denoising model architecture in the reverse process has a similar architecture to the model architecture of IREM [26]. Specifically, the noisy edge target y(t) is updated as follows. First, the noisy edge labels y(t) and edge features are concatenated and passed through to the GNN layer, which aggregates them to obtain the node representation. Next, we apply element-wise addition of the time embedding vector to the node representation. Then, we concatenate a pair of node representations and noisy targets for the given edges and then apply a two-layer MLP to update edge labels. In contrast to the node classification, we maintain randomness at inference time, i.e., we use the stochastic reverse process for obtaining edge labels. This approach is consistent with the IREM, which also includes randomness at inference time. 7We also investigate various stochastic inference strategies in Appendix F 22 D Data statistics D.1 Synthetic data We generate 1000 × 2 non-attributed cyclic grid and 100 × 2 non-attributed cyclic grid for scattered and localized training nodes scenarios, respectively. Then, we split 30%, 30%, and 40% of the entire nodes into training, validation, and test nodes. • Scattered training nodes: We randomly sample nodes in the graph to split them into training, validation, and test nodes.8 • Localized training nodes: We select the nodes in the region within the 30 × 2 grid as training nodes. Then, we randomly sample the remaining nodes in the graph to split them into validation and test nodes. For illustrative purposes, we also describe both scenarios in Figure 10 with smaller graphs. (a) Scatter-training (b) Scatter-test/validation (c) Local-training (d) Local-test/validation Figure 10: Illustration of two scenarios. The non-gray nodes represent nodes in each split. D.2 Transductive node classification datasets Table 6: The data statistics of transductive node classification datasets. Dataset ♯ nodes ♯ edges ♯ features ♯ classes ♯ (training/validation/test) nodes Pubmed [22] Cora [22] Citeseer [22] Photo [23] Computers [23] Roman [24] Ratings [24] 19717 2708 3327 7487 13381 22662 24492 44338 5429 4732 119043 34493 32927 93050 500 1433 3703 745 767 300 300 3 7 6 8 10 18 5 (60/500/1000) (140/500/1000) (120/500/1000) (160/240/7087) (200/300/12881) (11331/5665/5666) (12246/6123/6123) Here, we consider a graph with partially labeled nodes. We describe the data statistics in Table 6. D.3 Inductive node classification datasets Table 7: The data statistics of inductive node classification datasets. (training/validation/test) data Dataset ♯ features ♯ classes ♯ graphs Avg. ♯ nodes Avg. ♯ edges Pubmed [9] Cora [9] Citeseer [9] PPI [25] 500 1433 3703 500 3 7 6 3 (60/500/1000) (140/500/1000) (120/500/1000) (20/2/2) (6.0/5.4/5.6) (5.6/4.9/4.7) (4.0/3.8/3.8) (2245.3/3257.0/2762.0) (6.7/5.8/6.7) (7.0/5.8/5.3) (4.3/4.0, 3/8) (61318.4/99460.0/80988.0) Here, we consider datasets consists of a set of graphs. We describe the data statistics in Table 7. 8Additionally, we also consider training with an additional 2 × 20 cyclic grid for visualization in Figure 1. 23 D.4 Graph algorithmic reasoning datasets Following Du et al. [26], we generate training graphs in each training step. Here, the training graphs are composed of graphs of varying sizes, ranging from two to ten nodes. The node features are initialized to zero, and the labels are defined on the edges, e.g., the shortest distance between two nodes. Then, we evaluate performance on graphs with ten nodes. Furthermore, we also use graphs with 15 nodes to evaluate generalization capabilities. 24 E Experiments setup In this section, we describe the detailed experimental setup. For all experiments, we use a single GPU of NVIDIA GeForce RTX 3090. The hyper-parameters for each experiment are described in the following subsections. E.1 Synthetic dataset In this experiment, we implement each method with a one-layer GCN with 16 hidden dimensions. We search the learning rate within {1e−3, 5e−3, 1e−2} for all methods. Other hyper-parameters of each method follow their default settings. For DPM-SNC, we fix the diffusion step to 100. We also set the size of the buffer to 50 and insert five samples into the buffer for every 30 training step. We use a pre-trained mean-field GNN until the buffer is updated 10 times. E.2 Transductive node classification Table 8: The hyper-parameter search ranges for the homophilic graph. For hyper-parameters without a specific method in parentheses, it applies to all methods in the respective category. Method All methods Hyper-parameters learning rate weight decay GNN-based methods (LPA, GMNN, G3NN, CLGNN, DPM-SNC) number of layers hidden dimension weight of constraints for structured-prediction (LPA, G3NN) pseudo-labels sampling temperature (GMNN, CLGNN, DPM-SNC) Non-GNN methods (LP, PTA) number of label propagation hidden dimension (PTA) damping factor Search range {1e−3, 5e−3, 1e−2} {1e−3, 5e−3, 1e−2} {2, 4} {64, 128} {0.1, 1.0, 10.0} {0.1, 0.3, 1.0} {10, 100} {64, 128} {0.1, 0.3, 0.5} Homophilc graph. We describe the hyper-parameter search ranges in Table 8. Additionally, we apply dropout with p = 0.5 except for LP. Other hyper-parameters of each method follow their default settings. For DPM-SNC, we fix the diffusion step to 80. We also set the size of the buffer to 50 and insert five samples into the buffer for every 100 training step. We use a pre-trained mean-field GNN until the buffer is updated 20 times. Heterophilic graph. Here, we describe the hyper- parameter settings for DPM-SNC as we use the num- bers reported by Plantov et al. [24] for baselines. We describe the hyper-parameter search ranges in Table 9. Additionally, we apply dropout with p = 0.5, and we fix the diffusion step to 80. We also set the size of the buffer to 50 and insert five samples into the buffer for every 100 training step. We use a pre-trained mean- field GNN until the buffer is updated 100 times. Table 9: The hyper-parameter search ranges of DPM-SNC for the heterophilic graph. Hyper-parameters Search range learning rate weight decay number of layers hidden dimension sampling temperature {3e−5, 1e−4, 3e−4} {0, 1e−5, 1e−4} {2, 4} {256, 512} {0.1, 0.3, 1.0} E.3 Inductive node classification Table 10: The hyper-parameter search ranges of all methods for the inductive node classificaiton. Hyper-parameters Search range learning rate weight decay number of layers hidden dimension {1e−3, 5e−3, 1e−2} for small-scale graphs and {3e−5, 1e−4, 3e−4} for huge-scale graphs {1e−3, 5e−3, 1e−2} for small-scale graphs and {0, 1e−5, 1e−4} for huge-scale graphs {2, 4} {64, 128} for small-scale graphs and {512, 1024} for huge-scale graphs We describe the hyper-parameter search ranges in Table 10. For the small-scale graph datasets, i.e., Pubmed, Cora, and Citeseer, we apply dropout with p = 0.5. For the huge-scale graph datasets, i.e., PPI, we include the linear skip connection between each GNN layer. Other hyper-parameters of each method follow their default settings. For DPM-SNC, we fix the diffusion step to 80. 25 E.4 Algorithmic reasoning Here, we describe the hyper-parameter settings for DPM-SNC as we use the numbers reported by Du et al. [26] for baselines. We search the learning rate and weight decay within {1e−4, 3e−4, 1e−3} and {0, 1e−5, 1e−4}, respectively. The hyper-parameters of the model are the same as the model implementation of IREM, using a three-layer GINEConv [61] with a 128 hidden dimension. We fix the diffusion step to 80. 26 F Additional experiments Ablations on various inference schemes. We also study various inference strategies for our DPM-SNC. We first investigate how temperature control affects label inference in real-world node classification tasks. In Figure 11(a), we plot the changes in accuracy for various temperatures τ . One can see that reducing the randomness of DPM-SNC gives a better prediction in real-world node classification tasks. We also consider sampling various numbers of predictions for node-wise aggregation to improve performance. In Figure 11(b), even the number of samples is increased to 210, the deterministic and the node-wise aggregation inference schemes show similar accuracy, and there are only minor performance improvements on Citeseer. In practice, we use deterministic inference in the node classification tasks since the node-wise aggregation requires a relatively long time. (a) (b) Figure 11: (a) Accuracy with varying temperature. (b) Accuracy with the varying number of samples. The dashed line represents the accuracy of the deterministic inference scheme. 27 0.000.250.500.751.00Temperature50607080AccuracyPubmedCoraCiteseer2022242628210Number of samples50607080AccuracyPubmedCoraCiteseer
http://arxiv.org/abs/2302.10505v1
2023-02-21T08:08:18
2023-02-21T08:08:18
Higher-order Sparse Convolutions in Graph Neural Networks
Graph Neural Networks (GNNs) have been applied to many problems in computer sciences. Capturing higher-order relationships between nodes is crucial to increase the expressive power of GNNs. However, existing methods to capture these relationships could be infeasible for large-scale graphs. In this work, we introduce a new higher-order sparse convolution based on the Sobolev norm of graph signals. Our Sparse Sobolev GNN (S-SobGNN) computes a cascade of filters on each layer with increasing Hadamard powers to get a more diverse set of functions, and then a linear combination layer weights the embeddings of each filter. We evaluate S-SobGNN in several applications of semi-supervised learning. S-SobGNN shows competitive performance in all applications as compared to several state-of-the-art methods.
[ "Jhony H. Giraldo", "Sajid Javed", "Arif Mahmood", "Fragkiskos D. Malliaros", "Thierry Bouwmans" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10505v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10505v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "eess.SP" ]
3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 5 0 5 0 1 . 2 0 3 2 : v i X r a HIGHER-ORDER SPARSE CONVOLUTIONS IN GRAPH NEURAL NETWORKS Jhony H. Giraldo⋆+, Sajid Javed‡, Arif Mahmood⊛, Fragkiskos D. Malliaros†, Thierry Bouwmans§ ⋆LTCI, T ́el ́ecom Paris - Institut Polytechnique de Paris, France; ‡Khalifa University, United Arab Emirates; ⊛Information Technology University, Pakistan; †Universit ́e Paris-Saclay, CentraleSup ́elec, Inria, Centre for Visual Computing (CVN), France; §Laboratoire MIA, La Rochelle Universit ́e, France ABSTRACT Graph Neural Networks (GNNs) have been applied to many problems in computer sciences. Capturing higher-order re- lationships between nodes is crucial to increase the expres- sive power of GNNs. However, existing methods to capture these relationships could be infeasible for large-scale graphs. In this work, we introduce a new higher-order sparse con- volution based on the Sobolev norm of graph signals. Our Sparse Sobolev GNN (S-SobGNN) computes a cascade of fil- ters on each layer with increasing Hadamard powers to get a more diverse set of functions, and then a linear combina- tion layer weights the embeddings of each filter. We evaluate S-SobGNN in several applications of semi-supervised learn- ing. S-SobGNN shows competitive performance in all appli- cations as compared to several state-of-the-art methods. Index Terms- Graph neural networks, sparse convolu- tions, Sobolev norm 1. INTRODUCTION Graph representation learning and its applications have gained significant attention in recent years. Notably, Graph Neural Networks (GNNs) have been extensively studied [1–6]. GNNs extend the concepts of Convolutional Neu- ral Networks (CNNs) [7] to non-Euclidean data modeled as graphs. GNNs have numerous applications like semi- supervised learning [2], graph clustering [8], point cloud semantic segmentation [9], misinformation detection [10], and protein modeling [11]. Similarly, other graph learning techniques have been recently applied to image and video processing applications [12, 13]. Most GNNs update their node embeddings by computing specific operations in the neighborhood of each node. This updating is limited when we want to capture higher-order ver- tex relationships between nodes. Previous methods in GNNs have tried to capture these higher-order connections by tak- ing powers of the sparse adjacency matrix [14], quickly con- verting this sparse representation into a dense matrix. The +Corresponding author: [email protected] densification of the adjacency matrix results in memory and scalability problems in GNNs. Therefore, the use of these higher-order methods is limited for large-scale graphs. In this work, we propose a new sparse GNN model that computes a cascade of higher-order filtering operations. Our model is inspired by the Sobolev norm in Graph Signal Pro- cessing (GSP) [15, 16]. We modify the Sobolev norm using concepts of the Hadamard product between matrices to main- tain the sparsity of the adjacency matrix. We rely on spec- tral graph theory [17] and the Schur product theorem [18] to explain some mathematical properties of our filtering opera- tion. Our Sparse Sobolev GNN (S-SobGNN) employs a lin- ear combination layer at the end of each cascade of filters to select the best power functions. Thus, we improve expres- siveness by computing a more diverse set of sparse graph- convolutional operations. We evaluate S-SobGNN in semi- supervised learning tasks in several domains like tissue phe- notyping in colon cancer histology images [19], text classi- fication of news [20], activity recognition with sensors [21], and recognition of spoken letters [22]. The main contributions of the current work are summa- rized as follows: 1) we propose a new GNN architecture that computes a cascade of higher-order filters inspired by the Sobolev norm in GSP, 2) some mathematical insights of S- SobGNN are introduced based on spectral graph theory [17] and the Schur product theorem [18], and 3) we perform ex- perimental evaluations on four publicly available benchmark datasets and compared S-SobGNN to seven GNN architec- tures. Our algorithm shows the best performance against previous methods. The rest of the paper is organized as fol- lows. Section 2 introduces the proposed GNN model. Section 3 presents the experimental framework and results. Finally, Section 4 shows the conclusions. 2. SPARSE SOBOLEV GRAPH NEURAL NETWORKS 2.1. Preliminaries A graph is represented as G = (V, E), where V = {1, . . . , N } is the set of N nodes and E = {(i, j)} is the set of edges between nodes i and j. A ∈ RN ×N is the weighted adja- cency matrix of the graph such that A(i, j) = ai,j ∈ R+ is the weight of the edge (i, j), and A(i, j) = 0 ∀ (i, j) /∈ E. As a result, A is symmetric for undirected graphs. A graph signal is a function x : V → R and is represented as x ∈ RN . The degree matrix of G is a diagonal matrix given by D = diag(A1). L = D − A is the combinatorial Lapla- cian matrix, and ∆ = I − D− 1 2 is the symmetric nor- malized Laplacian [23]. The Laplacian matrix is a positive semi-definite matrix for undirected graphs with eigenvalues1 0 = λ1 ≤ λ2 ≤ * * * ≤ λN and corresponding eigenvec- tors {u1, u2, . . . , uN }. In GSP, the Graph Fourier Transform (GFT) of x is given by ˆx = UTx, and the inverse GFT is x = Uˆx [23]. In this work, we use the spectral definitions of graphs to analyze our filtering operation. However, the spec- trum is not required for the implementation of S-SobGNN. 2 AD− 1 2.2. Sobolev Norm The Sobolev norm in GSP has been used as a regularization term to solve problems in 1) video processing [13, 24], 2) modeling of infectious diseases [25], and 3) interpolation of graph signals [15, 16]. Definition 1. For fixed parameters ε ≥ 0, ρ ∈ R, the Sobolev norm is given by ∥x∥ρ,ε ≜ ∥(L + εI)ρ/2x∥ [15]. |λmin(L)| ≈ λmax(L) we know that κ(L) = |λmax(L)| 0 → ∞, where κ(L) is the condition number of L, λmax(L) is the maximum eigen- value, and λmin(L) is the minimum eigenvalue of L. Since κ(L) → ∞, we have an ill-conditioned problem when rely- ing on the Laplacian matrix alone. On the other hand, for the Sobolev term, we have that L + εI = UΛUT + εI = U(Λ + εI)UT. Therefore, λmin(L + εI) = ε, i.e., L + εI is positive definite (L + εI ≻ 0) for ε > 0, and: κ(L+εI) = |λmax(L + εI)| |λmin(L + εI)| = λmax(L) + ε ε < κ(L) ∀ ε > 0. (3) Namely, L+εI has a better condition number than L. It might not be evident why a better condition number could help in GNNs, where the inverses of the Laplacian or adjacency ma- trices are not required to perform the propagation rules. How- ever, some studies have indicated the adverse effects of bad- behaved matrices. For example, Kipf and Welling [2] used a renormalization trick (A + I) in their filtering operation to avoid exploding/vanishing gradients. Similarly, Wu et al. [26] showed that adding the identity matrix to A shrinks the graph spectral domain, resulting in a low-pass-type filter. The previous theoretical analysis shows the benefits of the Sobolev norm about 1) the diverse frequencies computation in (2), and 2) the better condition number in (3). When L is symmetric, we have that ∥x∥2 ρ,ε is given by: 2.3. Sparse Sobolev Norm ∥x∥2 ρ,ε = xT(L + εI)ρx. (1) We divide the analysis of (1) into two parts: 1) when ε = 0, and 2) when ρ = 1. For ε = 0 in (1) we have: xTLρx = xTUΛρUTx = ˆxTΛρ ˆx = N (cid:88) i=1 ˆx2(i)λρ i . (2) Notice that the spectral components ˆx(i) are penalized with powers of the eigenvalues λρ i of L. Since the eigenvalues are ordered in increasing order, the higher frequencies of ˆx are penalized more than the lower frequencies when ρ = 1, lead- ing to a smooth function in G. For ρ > 1, the GFT ˆx is pe- nalized with a more diverse set of eigenvalues. We can have a similar analysis for the adjacency matrix A using the eigen- value decomposition Aρ = (VΣVH)ρ = VΣρVH, where V is the matrix of eigenvectors, and Σ is the matrix of eigen- values of A. In the case of A, the GFT ˆx = VHx. For ρ = 1 in (1) we have ∥x∥2 ρ,ε = xT(L + εI)x. The term (L + εI) is associated with a better condition number2 than using L alone. For example, better condition numbers are associated with faster convergence rates in gradient de- scent methods as shown in [16]. For the Laplacian matrix L, 1λN ≤ 2 in the case of the symmetric normalized Laplacian ∆. 2The condition number κ(L) associated with the square matrix L is a The use of L or A in GNNs is computationally efficient be- cause these matrices are usually sparse. Therefore, we can perform a small number of sparse matrix operations. For the Sobolev norm, the term (L+εI)ρ can quickly become a dense matrix for large values of ρ, leading to scalability and mem- ory problems. To mitigate this limitation, we use a sparse Sobolev norm to keep the same sparsity level. Definition 2. Let L ∈ RN ×N be the Laplacian matrix of G. For fixed parameters ε ≥ 0 and ρ ∈ N, the sparse Sobolev term for GNNs is introduced as the ρ Hadamard multiplica- tions of (L + εI) (the Hadamard power) such that: (L + εI)(ρ) = (L + εI) ◦ (L + εI) ◦ * * * ◦ (L + εI). (4) For example, (L + εI)(2) = (L + εI) ◦ (L + εI). Thus, the sparse Sobolev norm is given by: ∥x∥(ρ),ε ≜ ∥(L + εI)(ρ/2)x∥. (5) Let ⟨x, y⟩(ρ),ε = xT(L + εI)(ρ)y be the inner product between two graph signals x and y that induces the associated sparse Sobolev norm. We can easily prove that the sparse Sobolev norm ∥x∥(ρ),ε ≜ ∥(L + εI)(ρ/2)x∥ satisfies the basic properties of vector norms3 for ε > 0 (for ε = 0 we have a semi-norm). For the positive definiteness property, we need the Schur product theorem [18]. measure of how well or ill-conditioned is the inversion of L. 3We omit the proof due to space limitation. Fig. 1. Eigenvalues penalization for the non-sparse and sparse matrix multiplications of the combinatorial Laplacian matrix. The sparse Sobolev term in (4) has the property of keep- ing the same sparsity level for any ρ. Notice that (L + εI)ρ is equal to the sparse Sobolev term if 1) we restrict ρ to be in N, and 2) we replace the matrix multiplication by the Hadamard product. The theoretical properties of the Sobolev norm in (2) and (3) do not extend trivially to its sparse counterpart. How- ever, we can develop some theoretical insights using concepts of Kronecker products and the Schur product theorem [18]. Theorem 1. Let L be any Laplacian matrix of a graph with eigenvalue decomposition L = UΛUT, we have that: L ◦ L = L(2) = PT N (U ⊗ U)(Λ ⊗ Λ)(UT ⊗ UT)PN , (6) where PN ∈ {0, 1}N 2×N is a partial permutation matrix. Proof. For the spectral decomposition, we have that: L ⊗ L = (U ⊗ U)(Λ ⊗ Λ)(UT ⊗ UT), (7) where we used the property of Kronecker products (A ⊗ B)(C ⊗ D) = AC ⊗ BD [18]. Similarly, we know n(S ⊗ T)Pm, where S, T ∈ Rn×m, and that S ◦ T = PT Pn ∈ {0, 1}n2×n, Pm ∈ {0, 1}m2×m are partial permutation matrices. If S, T ∈ Rn×n are square matrices, we have that S ◦ T = PT n(S ⊗ T)Pn (Theorem 1 in [27]). We can then get a general form of the spectrum of the Hadamard prod- uct for ρ = 2 using (7) and Theorem 1 in [27] as follows: L ◦ L = L(2) = PT N (U ⊗ U)(Λ ⊗ Λ)(UT ⊗ UT)PN . Eq. (6) is a closed-form solution regarding the spectrum of the Hadamard power for ρ = 2. Thus, the spectrum of the Hadamard multiplication is a compressed form of the Kronecker product of its spectral components. The sparse Sobolev term we use in our S-SobGNN is given by (L+εI)(ρ) so that the spectral components of the graph are changing for each value of ρ as shown in (6). For the condition number of the Hadamard powers, we can use the Schur product theorem [18]. We know that (L + εI)(ρ) ≻ 0 ∀ ε > 0 since (L + εI) ≻ 0 ∀ ε > 0, and therefore κ((L + εI)(ρ)) < ∞. For the adjacency matrix, the eigen- values of A lie into [−d, d], where d is the maximal degree of G [28]. Therefore, we can bound the eigenvalues of A 2 AD− 1 into [−1, 1] by normalizing A such that AN = D− 1 2 . As a result, we know that AN + εI ≻ 0 ∀ ε > 1, and (AN + εI)(ρ) ≻ 0 ∀ ε > 1. We can say that the theoret- ical developments of the sparse Sobolev norm hold to some extent the same developments of Section 2.2, i.e., a more di- verse set of frequencies and a better condition number. Fig- ure 1 shows five normalized eigenvalue penalizations for Lρ (non-sparse) and L(ρ) (sparse). We notice that the normalized spectrum of Lρ and L(ρ) are very similar. Finally, we should work with weighted graphs when using the adjacency matrix since A(ρ) = A ∀ ρ ∈ N for unweighted graphs. 2.4. Graph Neural Network Architecture Kipf and Welling [2] proposed one of the most successful yet simple GNN, called Graph Convolutional Networks (GCNs): 2 ̃A ̃D− 1 2 H(l)W(l)), H(l+1) = σ( ̃D− 1 (8) where ̃A = A + I, ̃D is the degree matrix of ̃A, H(l) is the matrix of activations in layer l such that H(1) = X (data matrix), W(l) is the matrix of trainable weights in layer l, and σ(*) is an activation function. The motiva- tion of the propagation rule in (8) comes from the first- order approximation of localized spectral filters on graphs [1]. Kipf and Welling [2] used (8) to propose the vanilla GCN, which is composed of two graph convolutional lay- ers as in (8). The first activation function is a Rectified Linear Unit (ReLU(*) = max(0, *)), and the final acti- vation function is a softmax applied row-wise such that Q exp (xi) where Q = (cid:80) softmax(xi) = 1 i exp (xi). Fi- nally, the vanilla GCN uses cross-entropy as a loss function. We introduce a new filtering operation based on the sparse Sobolev term where our propagation rule is such that: B(l+1) ρ = σ( ̄D− 1 2 ρ ̄Aρ ̄D− 1 ρ 2 ̄H(l)W(l) ρ ), (9) where ̄Aρ = (A + εI)(ρ) is the ρth sparse Sobolev term of A, ̄Dρ is the degree matrix of ̄Aρ, and ̄H(1) = X. Notice that ̄Aρ = ̃A when ε = 1, and ρ = 1, i.e., our propaga- tion rule is a generalization of the GCN model. S-SobGNN computes a cascade of propagation rules as in (9) with sev- eral values of ρ in the set {1, 2, . . . , α}, and therefore a linear Fig. 2. Basic configuration of our S-SobGNN architecture with n layers and α filters per layer. 2 2 ρ ̄Aρ ̄D− 1 combination layer weights the outputs of each filter. Figure 2 shows the basic configuration of S-SobGNN. Notice that our graph convolution is efficiently computed since the term ̄D− 1 ρ ∀ ρ ∈ {1, 2, . . . , α} is the same in all layers (so we can compute it offline), and also, these terms are sparse for any value of ρ (given that A is also sparse). S-SobGNN uses ReLU as the activation function for each filter, softmax at the end of the network, and the cross-entropy loss function. The basic configuration of S-SobGNN is defined by the number of filters α in each layer, the parameter ε, the number of hidden units of each W(l) ρ , and the number of layers n. When we construct weighted graphs with Gaussian kernels, the weights of the edges are in the interval [0, 1]. As a consequence, large values of ρ could make ̄Aρ = 0, and the diagonal elements of ̄D− 1 could become ∞. Similarly, large values of α make very wide architectures with a high parameter budget, so it is desirable to maintain a reasonable value for α. The computa- tional complexity of S-SobGNN is O(nα|E| + nα). For com- parison, the computational complexity of a n-layers GCN is O(n|E|). The exact complexity of both methods also depends on the feature dimension, the hidden units, and the number of nodes in the graph, which we omit for simplicity. ρ 2 Table 1. Accuracy (in %) for the baseline methods and our S-SobGNN algorithm in four datasets for semi-supervised learning, inferring the graphs with a k-NN method. Model Cancer 20News HAR Isolet Cheby [1] GCN [2] GAT [3] SIGN [14] SGC [26] ClusterGCN [29] SuperGAT [30] Transformer [31] 87.55 ± 3.91 76.71 ± 4.47 73.51 ± 4.87 89.55 ± 0.38 72.80 ± 4.71 74.45 ± 5.37 70.56 ± 5.14 71.10 ± 5.45 70.36 ± 1.14 51.76 ± 2.11 48.72 ± 2.21 71.79 ± 0.25 54.68 ± 1.99 60.56 ± 2.18 57.52 ± 1.93 57.48 ± 2.29 73.14 ± 7.01 66.26 ± 4.91 59.13 ± 6.30 90.98 ± 0.25 42.19 ± 3.44 57.70 ± 5.48 56.04 ± 5.32 66.01 ± 6.10 69.70 ± 1.47 55.55 ± 2.72 60.00 ± 2.21 84.02 ± 0.30 41.55 ± 1.91 63.99 ± 2.24 58.49 ± 2.27 66.24 ± 2.39 S-SobGNN (ours) 93.11 ± 0.45 72.18 ± 0.32 92.85 ± 0.58 86.17 ± 0.34 The best and second-best performing methods on each dataset are shown in red and blue, respectively. timization. We tune the hyperparameters of each GNN with a random search with 100 repetitions and five different seeds for the validation set. We report average accuracies on the test set using 50 different seeds with 95% confidence inter- vals calculated by bootstrapping with 1, 000 samples. Table 1 shows the experimental results. S-SobGNN shows the best performance against state-of-the-art methods. 3. EXPERIMENTS AND RESULTS 4. CONCLUSIONS S-SobGNN is compared to eight GNN architectures: Cheby- shev filters (Cheby) [1], GCN [2], GAT [3], SIGN [14], SGC [26], ClusterGCN [29], SuperGAT [30], and Transformers [31]. We test S-SobGNN in several semi-supervised learning tasks including, cancer detection in images [20], text classifi- cation of news (20News) [20], Human Activity Recognition using sensors (HAR) [21], and recognition of isolated spoken letters (Isolet) [22]. We frame the semi-supervised learning problem as a node classification task in graphs, where we con- struct the graphs with a k-Nearest Neighbors (k-NN) method and a Gaussian kernel with k = 30. We split the data into train/validation/test sets with 10%/45%/45%, where we first divide the data into a development set and a test set. This is done once to avoid using the test set in the hyperparameter op- In this work, we extended the concept of Sobolev norms using the Hadamard product between matrices to keep the sparsity level of the graph representations. We introduced a new Sparse GNN architecture using the proposed sparse Sobolev norm. Similarly, certain theoretical notions of our filtering operation were provided in Sections 2.2 and 2.3. Finally, S-SobGNN outperformed several methods of the literature in four semi-supervised learning tasks. Acknowledgments: This work was supported by the DATAIA Institute as part of the "Programme d'Investissement d'Avenir", (ANR-17-CONV-0003) operated by CentraleSup ́elec, and by ANR (French National Research Agency) under the JCJC project GraphIA (ANR-20-CE23-0009-01). LinearCombinationLinearCombination...............Softmax...Sparse Sobolev TermLearneableParameters 5. REFERENCES [1] M. Defferrard, X. Bresson, and P. Vandergheynst, "Con- volutional neural networks on graphs with fast localized spectral filtering," in NeurIPS, 2016. 1, 3, 4 [2] T. N. Kipf and M. Welling, "Semi-supervised classifica- tion with graph convolutional networks," in ICLR, 2017. 1, 2, 3, 4 [3] P. Veliˇckovi ́c et al., ICLR, 2018. 1, 4 "Graph attention networks," in [4] V. N. Ioannidis, A. G. Marques, and G. B. Giannakis, "A recurrent graph neural network for multi-relational data," in IEEE ICASSP, 2019. 1 [5] Z. Zhao et al., "Distributed scheduling using graph neu- ral networks," in IEEE ICASSP, 2021. 1 [6] S. Pfrommer, A. Ribeiro, and F. Gama, "Discriminabil- in IEEE ity of single-layer graph neural networks," ICASSP, 2021. 1 [7] Y. LeCun, Y. Bengio, and G. Hinton, "Deep learning," Nature, vol. 521, no. 7553, pp. 436–444, 2015. 1 [8] A. Duval and F. D. Malliaros, "Higher-order clustering and pooling for graph neural networks," in ACM CIKM, 2022. 1 [9] G. Li et al., "DeepGCNs: Can GCNs go as deep as CNNs?," in IEEE ICCV, 2019. 1 [10] A. Benamira et al., "Semi-supervised learning and graph neural networks for fake news detection," in IEEE/ACM ASONAM, 2019. 1 [16] J. H. Giraldo et al., "Reconstruction of time-varying graph signals via Sobolev smoothness," IEEE T-SIPN, vol. 8, pp. 201–214, 2022. 1, 2 [17] F. R. K. Chung, Spectral graph theory, Number 92. American Mathematical Society, 1997. 1 [18] R. A. Horn and C. R. Johnson, Matrix analysis, Cam- bridge university press, 2012. 1, 2, 3 [19] J. N. Kather et al., "Multi-class texture analysis in col- orectal cancer histology," Scientific Reports, vol. 6, pp. 27988, 2016. 1 [20] K. Lang, "NewsWeeder: Learning to filter netnews," in JMLR, 1995. 1, 4 [21] D. Anguita et al., "A public domain dataset for human in ESANN, activity recognition using smartphones," 2013. 1, 4 [22] M. Fanty and R. Cole, "Spoken letter recognition," in NeurIPS, 1991. 1, 4 [23] A. Ortega et al., "Graph signal processing: Overview, challenges, and applications," Proc. IEEE, vol. 106, no. 5, pp. 808–828, 2018. 2 [24] J. H Giraldo and T. Bouwmans, "GraphBGS: Back- ground subtraction via recovery of graph signals," in ICPR, 2020. 2 [25] J. H. Giraldo and T. Bouwmans, "On the minimization of Sobolev norms of time-varying graph signals: Es- timation of new Coronavirus disease 2019 cases," in IEEE MLSP, 2020. 2 [26] F. Wu et al., "Simplifying graph convolutional net- works," in ICML, 2019. 2, 4 [11] P. Gainza et al., "Deciphering interaction fingerprints from protein molecular surfaces using geometric deep learning," Nat. Methods, vol. 17, no. 2, pp. 184–192, 2020. 1 [27] G. Visick, "A quantitative version of the observation that the Hadamard product is a principal submatrix of the Kronecker product," LAA, vol. 304, no. 1-3, pp. 45– 68, 2000. 3 [12] H. E. Egilmez, Y. H. Chao, and A. Ortega, "Graph- based transforms for video coding," IEEE T-IP, vol. 29, pp. 9330–9344, 2020. 1 [13] J. H. Giraldo, S. Javed, and T. Bouwmans, "Graph mov- ing object segmentation," IEEE T-PAMI, vol. 44, no. 5, pp. 2485–2503, 2022. 1, 2 [14] F. Frasca et al., "SIGN: Scalable inception graph neural networks," in ICML-W, 2020. 1, 4 [15] I. Pesenson, "Variational splines and Paley–Wiener spaces on combinatorial graphs," Constructive Approx- imation, vol. 29, no. 1, pp. 1–21, 2009. 1, 2 [28] B. Nica, A brief introduction to spectral graph theory, European Mathematical Society, 2018. 3 [29] W.L. Chiang et al., "Cluster-GCN: An efficient algo- rithm for training deep and large graph convolutional networks," in ACM SIGKDD, 2019. 4 [30] D. Kim and A. Oh, "How to find your friendly neigh- borhood: Graph attention design with self-supervision," in ICLR, 2021. 4 [31] Y. Shi et al., "Masked label prediction: Unified mes- sage passing model for semi-supervised classification," in IJCAI, 2021. 4
http://arxiv.org/abs/2302.10502v1
2023-02-21T08:02:03
2023-02-21T08:02:03
Learning Gradually Non-convex Image Priors Using Score Matching
In this paper, we propose a unified framework of denoising score-based models in the context of graduated non-convex energy minimization. We show that for sufficiently large noise variance, the associated negative log density -- the energy -- becomes convex. Consequently, denoising score-based models essentially follow a graduated non-convexity heuristic. We apply this framework to learning generalized Fields of Experts image priors that approximate the joint density of noisy images and their associated variances. These priors can be easily incorporated into existing optimization algorithms for solving inverse problems and naturally implement a fast and robust graduated non-convexity mechanism.
[ "Erich Kobler", "Thomas Pock" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10502v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10502v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.CV", "I.2.6; I.4.10" ]
Learning Gradually Non-convex Image Priors Using Score Matching Erich Kobler 1 Thomas Pock 2 Abstract noise level. 3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 2 0 5 0 1 . 2 0 3 2 : v i X r a In this paper, we propose a unified framework of denoising score-based models in the context of graduated non-convex energy minimization. We show that for sufficiently large noise variance, the associated negative log density – the energy – becomes convex. Consequently, denoising score- based models essentially follow a graduated non- convexity heuristic. We apply this framework to learning generalized Fields of Experts image pri- ors that approximate the joint density of noisy im- ages and their associated variances. These priors can be easily incorporated into existing optimiza- tion algorithms for solving inverse problems and naturally implement a fast and robust graduated non-convexity mechanism. 1. Introduction Score matching (SM, Hyv ̈arinen, 2005) has recently seen a renewed interest in computer vision and machine learning as it allows to fit a high-dimensional parametric distribution to a given data distribution while avoiding computing the often intractable normalization constant. The basic idea is to match (in a log domain) the gradients of the parametric distribution with the gradients of the data distribution, by minimizing a least squares loss function. Interestingly, the problem of computing the gradients of the log-data distribu- tion can be avoided by implicit SM, which results in a loss function merely depending on the gradient and Laplacian of the parametric model. In subsequent work, Vincent (2011) showed equivalence of these SM techniques to denoising autoencoders by introducing denoising SM, where the gradients of a slightly smoothed data distributions are computed based on Tweedie's formula (Efron, 2011). Song & Ermon (2019; 2020) introduced noise conditional score networks (NC- SNs) by conditioning a score predicting network on the 1Department of Neuroradiology, University Hospital Bonn, Bonn, Germany 2Institue of Computer Graphics and Vision, Graz University of Technology, Graz, Austria. Correspondence to: Erich Kobler <[email protected]>. In parallel, diffusion probabilistic models (Sohl-Dickstein et al., 2015) motivated by nonequilibrium thermodynam- ics evolved, which are learned to revert a diffusion pro- cess – a Markov chain transforming a data distribution to a prior distribution by gradually adding noise. Later, Ho et al. (2020) introduced denoising diffusion probabilistic models (DDPM) that explicitly connect diffusion proba- bilistic models to denoising SM in the sense that the noise level is encoded by a schedule in the diffusion time steps. Their image-generation results were remarkable and ignited further research in the field of score-based generative mod- els (Rombach et al., 2022; Dieleman et al., 2022; Yang et al., 2022; Ho et al., 2022). Still, the underlying learn- ing technique of all the previously introduced score-based generative models remains denoising SM. Typically, the transition from the data distribution to the prior distribution is discretized (Ho et al., 2020; Song & Ermon, 2019; 2020). During inference samples are gener- ated by traversing the reverted discrete process by means of a stochastic sampling heuristic. In contrast, numerical stochastic differential equation (SDE) solvers can be used for sampling if the score models are learned to continuously depend on diffusion time (Song et al., 2021). These solvers can further be used to solve inverse problems by considering a stochastic gradient flow of the associated posterior distri- bution (Song et al., 2021, Eq. (14)). Moreover, this gradient flow perspective and its approximation by a score network lead to denoising diffusion implicit models (DDIM) (Song et al., 2022), which allow for a significant speed up in sam- pling while maintaining image quality to a large extent. In contrast to the main body of recent works that focus on the score – the gradient of the log density, we focus in this work on the respective negative log density – the energy. We consider the problem of learning energies of corresponding image priors on gradually noisier images, where the variance t of the noise is equal to a smoothing parameter. Indeed adding noise to images is equivalent to sampling images from the true image distribution smoothed by a Gaussian with variance t. Moreover, we show that under mild assumptions, there always exists a sufficiently large smoothing parameter (cid:101)t for which the corresponding negative log density (the energy) becomes a convex function. Learning Gradually Non-convex Image Priors Using Score Matching Thus, denoising score-based generative models learn to ap- proximate gradients of energies that become gradually more convex for increasing noise and recent inference techniques such as DDIM (Song et al., 2022) follow the graduated non-convexity (GNC) principle (Blake & Zisserman, 1987), which is a widely used heuristic for avoiding local minima. Inspired by these observations, we propose a unified energy- based perspective of denoising score-based models through learning a one-parameter family of energies continuously parametrized by t to approximate the smoothed negative log density of the data. This enables easy integration of the learned prior energy into the variational approach to in- verse problems by choosing sequences for t, i.e., smoothing schedules. In particular, we compare the following options: 1. A joint minimization in both the image and the smooth- ing parameter. 2. A predefined schedule such that the subsequent infer- ence becomes equivalent to GNC. 3. A task-specific schedule learned by unrolling a certain number of proximal gradient steps. Interestingly, the last option allows drawing connections to variational networks (Chen & Pock, 2016; Kobler et al., 2017). 2. A Graduated Non-convexity View of Score-based Generative Models Let (X , F, P) be a complete probability space on a com- pact set X ⊂ Rd with sigma algebra F and probability measure P. We further assume an absolutely continuous probability measure with corresponding probability den- sity function px ∈ C0(X , [0, ∞)). Later, we will also con- sider a discrete probability measure defined by the empir- ical distribution of a dataset {xi}n i=1 ⊂ X with cardinal- ity n ∈ N. In addition, we consider smoothing parame- ters t ∈ T = [tmin, tmax], where 0 < tmin < tmax < ∞. In this setting, we show that score-based generative mod- els (Song & Ermon, 2019; Ho et al., 2020) actually learn a graduated non-convexity (GNC) scheme (Blake & Zis- serman, 1987). In detail, score-based generative models train a neural network to approximate the conditional score, i.e., the gradient of the log density of the data degraded by additive Gaussian noise s(y, t) ≈ ∇y log py|t(y, t) where y = x + tn, n ∼ N (0, Id). The key observation is that although the data becomes noisier with increasing t, the corresponding probability density √ py|t(y|t) = (px ∗ G(0, tId)) (y) − log py|t(y, t) gets more convex (in fact more quadratic), see the left plot in Figure 2. Next, we prove that there indeed exists a lower bound on the variance (cid:101)t such that the energy of the conditional density is convex for t ≥ (cid:101)t. Let G(μ, Σ) denote a multivariate Gaussian probability den- sity with mean μ ∈ Rd and symmetric positive definite covariance matrix Σ ∈ Rd×d, which reads as G(μ, Σ)(x) = |2πΣ|− 1 2 exp (cid:16) − (cid:107)x − μ(cid:107)2 Σ−1 (cid:17) . Definition 2.1 (GMM). Let n ∈ N. A Gaussian mixture model (GMM) consisting of n components is defined as p = n (cid:88) i=1 wiG(xi, Σi) i=1 ⊂ Rd×d, with means {xi}n and weights on the unit simplex w = (w1 . . . wn)(cid:62) ∈ ∆n. i=1 ⊂ Rd, covariances {Σi}n Recall that for n → ∞ a GMM can uniformly approxi- mate any function in C0 (Nguyen et al., 2020). Note that an approximation w.r.t. Lp also holds for any px ∈ Lp for p ∈ [1.∞). Consequently, our setting and most practi- cally encountered probability density functions can be well approximated by GMMs. Thus, we focus in the following on probability density functions induced by GMMs. Theorem 2.2. Let X ⊂ Rd and diam(X ) < ∞. Consider a GMM of the form p(x) = n (cid:88) i=1 wiG(xi, Σi)(x), where (w1 * * * wn)(cid:62) ∈ ∆n. Assume {xi}n i=1 ⊂ X . Then there exists a smoothing parameter (cid:101)t ∈ (0, ∞) such that the smoothed energy F (x, t) := − log (cid:0)(p ∗ G(0, tId))(x)(cid:1) is convex w.r.t. x for all t ≥ (cid:101)t. Corollary 2.3. Theorem 2.2 also holds if an empirical dis- crete probability measure of a dataset {xi}n i=1 ⊂ X , i.e. p = 1 n n (cid:88) i=1 δxi, is considered. Here, δx denotes the Dirac delta measure located at x. The proofs can be found in Appendix A. Note that in this paper we only consider the variance exploding setting, how- ever, similar results hold for variance preserving schemes. gets smoother due to the convolution with a Gaussian density G(0, tId) and its associated energy F (y, t) = The underlying idea of the GNC is to speed up the estima- tion of the global minimum of a non-convex energy. First, Learning Gradually Non-convex Image Priors Using Score Matching Algorithm 1 Graduated non-convexity flow for minimizing a smoothed family of energies F (x, t) Step 0: Take I ∈ N, choose sequence {ti}I i=0 ⊂ [tmin, tmax] s.t. ti > ti+1 and F (x, t0) convex, x0 ∈ X , η > 0 Step i: (0 ≤ i < I) Approximately minimize current en- ergy F (*, ti) using single step xi+1 = xi − ηti∇xF (xi, ti) this energy is approximated by a one-parameter family of en- ergies that become more convex for increasing t. Second, an initial smoothing parameter is selected such that the energy is convex. Third, the initial problem is efficiently solved due to increased smoothness and convexity. Then, the pa- rameter is reduced such that the energy becomes gradually more non-convex and is in turn minimized starting from the previous solution. The process is repeated until t → 0. Comparing denoising score-based models to GNC, we ob- serve the following similarities. First, the score networks also approximate a one-parameter family of the gradient of associated energies. Second, the schedule of the smoothing parameter is frequently a priori fixed. Finally, as we proved above, there exists a smoothing parameter such that the associated energy becomes convex in most practical cases. Combining both approaches results in the GNC flow de- scribed in Algorithm 1, which is a discretization of a con- tinuous gradient flow starting from a convex approximation. In detail, first a decreasing sequence of smoothing param- eters {ti}I i=0 is fixed such that F (x, t0) is convex. Then, we estimate the minimum by a single gradient step using the variance ti as preconditioning, which is motivated by Tweedie's identity (Robbins, 1956; Efron, 2011) and the fact that for a smooth and convex function the minimal means squared error (MMSE) estimator is close to its minimum. Then this estimator is gradually refined by reducing the smoothing ti > ti+1 and updating the MMSE estimator conditioned on the previous result. Next, we consider a simple 1D example to illustrate the In particular, we use a effectiveness of the GNC flow. smoothed GMM corresponding to the energy F (x, t) = − log wiG (cid:0)μi, σ2 (cid:33) i + t(cid:1) (x) (1) (cid:32) 5 (cid:88) i=1 consisting of five components over the domain x ∈ [−3, 3] and t ∈ [10−4, 1]. The detailed parameters are w = 100 (5 15 15 60 5), μ = (−1 − 1 1 2 1), and σ2 = 1 100 (10 1 5 1 10). Note that the addition of t at the variances in (1) originates from the convolution of the data density with a Gaussian as considered in Theorem 2.2. This energy 2 0 1 is illustrated by the black lines at the left in Figure 2 for vari- ous t. As can be seen, increasing the smoothing parameter t results in smoother and more convex energies. The plot in the center of Figure 2 visualizes the rate of trajectories converging to the global minimum at x = 1 2 as a function of the initial smoothing t0 and the number of steps I. For each t0 all trajectories start from N = 1 000 equally spaced initial positions x0 on [−3, 3] and are defined by performing I GNC flow steps using a logarithmic smoothing schedule. By comparing the different contour lines we observe that for larger initial smoothing fewer steps are required such that all trajectories converge to the global minimum. This highlights the effectiveness of GNC. Finally, the right plot in Figure 2 depicts the smallest ∂2 ∂x2 F (x, t0) and thereby highlights convexity of F as a function of t0. 3. Learning Gradually Non-convex Image Priors In this section, we transfer the insights gained from relations of GNC and score-based generative models to learn priors for natural images. 3.1. FoE-like Prior Models Let x ∈ X ⊂ Rd be an image of size d = m × n × c, where m represents its height, n its width, and c is the number of feature channels. Roth & Black (2009) introduced a simple and versatile prior operating on images called fields of experts (FoE). This prior has been successfully applied to various inverse problems in imaging sciences and its essential building blocks are (local) convolutions that extract lower-level features as well as non-linear potential functions. In particular, we consider the FoE model RFoE(x) = (cid:104)1, (Φ ◦ K) (x)(cid:105) , where the linear operator K : Rd → Rd1 extracts N1 fea- tures using 2D convolution kernels ki with d1 = m×n×N1. The operator Φ : Rd1 → Rd1 applies to every feature chan- nel ki(x) a corresponding pixel-wise parametric non-linear potential φi : R → R, and the scalar product denotes the sum over all pixels and channels. The underlying idea is that every convolution kernel ki specializes on a certain pattern and the associated potential φi describes the corresponding energy, i.e., the negative logarithm of the density. The non- linear functions φi are typically learnable and implemented by simple parametric functions (Roth & Black, 2009; Chen et al., 2014) or weighted radial basis functions (Chen & Pock, 2016; Kobler et al., 2017). 3.1.1. EXTENDING THE FIELDS OF EXPERTS Due to the simplicity of the FoE prior a natural approach to include the conditioning concept of SBGMs is by affecting Learning Gradually Non-convex Image Priors Using Score Matching convex non-convex Figure 1. Left: Illustration of the 1D example energy (1) using gray lines for different t ∈ [10−4, 1]. Center: Visualization of the rate of trajectories attaining the global minimum at x = 1 2 using N = 1 000 equally spaced initial points for different t0 and I. The larger the initial smoothing t0, the fewer steps are required to obtain the perfect rate. Right: Smallest second derivative of F w.r.t. x for different t0. the potential functions to learn joint prior models. In detail, the extended FoE reads as R1(x, t) = (cid:104)1, (Φ1(*, t) ◦ K1) (x)(cid:105) , (2) where the non-linear function depends on t, i.e., Φ1 ∈ C3(Rd1 × T , Rd1 ). Consequently, also the pixel-wise non- linear functions of every feature channel φ1j ∈ C3(R × T , R), j = 1, . . . , N1 depend on t. Further, all φ1j are constructed using weighted 2D quartic spline basis func- tions, which are equally distributed over the input domain to ensure sufficient smoothness for gradient-based learning. We refer to Appendix B for further details regarding the spline-based non-linear functions. 3.1.2. INCREASING DEPTH Since the prior (2) essentially consists of a single layer, its expressiveness is limited to simple image features. To increase capacity, we propose to stack multiple convolutions and parametric non-linear layers. Then, an FoE-type prior facilitating L-layers reads as RL(x, t) = (cid:104)1, (ΦL(*, t) ◦ KL ◦ * * * ◦ Φ1(*, t) ◦ K1) (x)(cid:105) . (3) Each convolution Ki : Rdi−1 → Rdi, i = 1, . . . , L per- forms a linear combination of all input features, thereby enabling the mixing of features as typically performed in convolutional neural networks (CNNs). In contrast to typi- cal CNNs, we use parametric activation Φi, . . . , ΦL−1 and potential ΦL functions that adapt to the corresponding fea- ture channels. At every layer i ∈ {1, . . . , L} and for any feature channel j ∈ {1, . . . , Ni}, we employ a 2D paramet- ric point-wise function φij ∈ C3(R × T , R) to non-linearly process the features. This idea follows recent suggestions to facilitate spline-based parametric activation functions in deep CNNs (Ochs et al., 2018; Aziznejad et al., 2020). Fur- ther details on the parametric functions are in Appendix B. 3.2. Joint Learning using Score Matching Here, we elaborate on how to fit the parameters of the pre- viously defined regularizers RL : X , T , Θ → R to the neg- ative score of the joint density py,t : X × T → R+ of the data. For our previously defined degradation model, the joint density function reads as py,t(y, t) = (px ∗ G(0, tId)) (y)pt(t) (cid:34) (cid:32) ∝ Ex∼Px exp − (cid:33)(cid:35) (cid:107)y − x(cid:107)2 2 2t pt(t), where pt is the prior of the smoothing parameter. Then, the objective function of (explicit) score matching is given by JSM(θ) = Ey,t∼Py,t (cid:104) 1 2 (cid:107)∇RL(y, t; θ) − (−∇ log py,t(y, t))(cid:107)2 M (4) (cid:105) , where ∇ denotes the full gradient of a function and an additional index denotes the gradient w.r.t. only this variable and M ∈ Rd+1×d+1 is a positive definite block-diagonal matrix, i.e., M = (cid:18)tId 0 0T mt (cid:19) . x−3−2−10123t10−410−310−210−1100F(x,t)−202468101214100101102103I10−310−210−1100t00.10.50.9−102−101−1000minx∂2∂x2F(x,t0) Learning Gradually Non-convex Image Priors Using Score Matching By applying the metric, we obtain halfspace and the loss (6) changes to JSM(θ) = Ey,t∼Py,t (cid:104) t 2 (cid:107)∇yRL(y, t; θ) − (−∇y log py,t(y, t))(cid:107)2 2 (cid:105) ∂t RL(y, t; θ) − (cid:0)− ∂ (cid:0) ∂ . ∂t log py,t(y, t)(cid:1)(cid:1)2 mt + 1 2 (5) (cid:98)J(θ) = E x,n,(cid:98)t∼Px,n,(cid:98)t (cid:13) (cid:13) 2 (cid:13)e(cid:98)t/2∇yRL(y, (cid:98)t; θ) − n (cid:13) (cid:13) (cid:13) 2 + mt RL(y, (cid:98)t; θ) (cid:17)2 − 2 ∂2 ∂(cid:98)t2 RL(y, (cid:98)t; θ) (cid:34) 1 2 (cid:18)(cid:16) ∂ ∂(cid:98)t (7) (cid:19) (cid:35) . Note that JSM decouples into a score matching objective on noisy images y and the smoothing parameter t; the metric (in particular mt > 0) enables balancing of both terms. The scaling of the first term by t is a common variance reduction technique in denoising SM (Song & Ermon, 2019; Huang et al., 2021). To avoid the computation of the expectation over the true data in the gradient of the joint distribution, we apply denois- ing score matching to the noisy image term. In addition, we replace the score matching objective w.r.t. t by its implicit pendant and get JSM(θ) = Ex,y,t∼Px,y,t (cid:104) t 2 (cid:16)(cid:0) ∂ (cid:13) (cid:13)∇yRL(y, t; θ) − 1 ∂t RL(y, t; θ)(cid:1)2 − 2 ∂2 + mt 2 t (y − x)(cid:13) 2 (cid:13) 2 ∂t2 RL(y, t; θ) + C, (cid:17)(cid:105) where C is an additive constant. The proof can be obtained by combining the equivalence proofs of Hyv ̈arinen (2005) and Vincent (2011). To further simply the objective, we perform the change of variables y = x + tn, where n ∼ N (0, Id). Then, we get the equivalent loss function √ J(θ) = Ex,n,t∼Px,n,t 1 2 +mt √ (cid:20)(cid:13) (cid:13) (cid:13) (cid:16)(cid:0) ∂ t∇yRL(y, t; θ) − n (cid:13) 2 (cid:13) (cid:13) 2 (6) ∂t RL(y, t; θ)(cid:1)2 − 2 ∂2 ∂t2 RL(y, t; θ) (cid:17)(cid:105) . In contrast to typical denoising score matching-based loss functions (Song & Ermon, 2019; Ho et al., 2020), this loss introduces a regularization along the smoothing direction t. In particular, the loss favors energies RL that slowly change in this direction and are preferably convex. Note that these properties are desirable for any gradient-based optimization scheme operating on the joint energy F . 3.2.1. LOGARITHMIC REPARAMETRIZATION The score-matching-based training ensures that the non- linear functions better approximate the score of the true data of the features as t → tmin. Thus, it is reason- able to distribute the learnable weights of φi toward this regime to account for the increasing complexity. Therefore, we facilitate the logarithmic reparametrization (cid:98)t = log(t), (cid:98)tmin = log(tmin), and (cid:98)tmax = log(tmax), in analogy to Kar- ras et al. (2022). Then, the domain (cid:98)T is on the negative We highlight that the gradient and the Hessian are measured on the logarithmic domain to avoid intensive regularization toward tmin. 4. Solving Inverse Problems using Gradually Non-convex Image Priors In various imaging applications, the task is to determine an underlying image x given observations z. The observations are related to the target through the forward problem z = Ax + ζ, where ζ represents additive noise and A describes the mea- surement process. The simplest example is image denoising, where A = Id and the distribution of ζ describe the noise type. In the case of image inpainting, A applies a binary mask to every image element, which is 1 if the associated pixel is observed and 0 otherwise, and ζ ≡ 0. Frequently, the maximum a posteriori estimator is computed to approximate the target, which amounts to (cid:8)px|z(x|z) ∝ pz|x(z|x)px(x)(cid:9) max x∈X due to Bayes. In the negative log domain, we get (cid:8)− log px(x) − log pz|x(z|x) = R(x) + D(z, x)(cid:9) , min x∈X which is also known as the variational approach. Here, the negative log-prior is equivalent to the regularizer R : X → R and the negative log-likelihood equals the data fidelity term D : Z × X → R. The data fidelity models the for- ward problem and ensures consistency to the observations, whereas, the regularizer incorporates prior knowledge of the solution. Throughout this section, we assume that the data fidelity term has a simple proximal mapping, which is the case for many inverse problems in imaging. In the case of image denoising with additive Gaussian noise of vari- ance σ2, the data fidelity and the corresponding proximal map read as D(z, x) = 1 2σ2 (cid:107)x − z(cid:107)2 2 , proxτ D(x) = σ2 z x + τ 1 + τ σ2 and for image inpainting we have D(z, x) = δ(Ax − z), proxτ D(x)i = (cid:40) xi zi if Aii = 1 else , Learning Gradually Non-convex Image Priors Using Score Matching where δ is the indicator function of {0}. To utilize the statis- tical knowledge of our learned prior RL, we next describe suitable ways to handle the additional smoothing parame- ter (cid:98)t. To do so, we propose to "unroll" the optimization scheme (9) for I ∈ N steps and learn all {(cid:98)ti}I i=1 and individual step sizes {ηi}I i=1 such that the final output xI is close to its corresponding ground truth, i.e., 4.1. Joint Optimization As presented in section 2, decreasing the smoothing parame- ter (cid:98)t results in peakier and more non-convex energies. Thus, there are pronounced local minima at (cid:98)tmin and ∂ RL is ∂(cid:98)t likely to point toward (cid:98)tmin. Consequently, it is reasonable to minimize the joint energy also w.r.t. the smoothing pa- rameter (cid:98)t. Thus, we seek to solve the optimization problem min x∈X , (cid:98)t∈[(cid:98)tmin,(cid:98)tmax] (cid:8)E(x, (cid:98)t) := RL(x, (cid:98)t) + D(z, x)(cid:9) . (8) A straightforward approach, requiring little knowledge of the objective, is adapting an alternating proximal gradient scheme (Bolte et al., 2014). Further, even a Lipschitz back- tracking (Beck & Teboulle, 2009) could be used because the energy can be easily evaluated. However, we instead exploit the fact that ∇xRL(*, (cid:98)t) is approximate exp(−(cid:98)t)-Lipschitz and propose the preconditioned proximal gradient algorithm listed in Algorithm 2. Note that the projected gradient step w.r.t. (cid:98)t is preconditioned by d−1 to account for the number of summands of (3). Algorithm 2 Preconditioned proximal gradient for joint optimization Step 0: Take x0 ∈ X ⊂ Rd, and sufficiently large (cid:98)t0 ∈ [(cid:98)tmin, (cid:98)tmax]. Choose η > 0 Step i: (i ≥ 0) iterate xi+1 = proxηe(cid:98)ti D(z,*)(xi − ηe(cid:98)ti∇xRL(xi, (cid:98)ti)) (cid:16) (cid:98)ti − (cid:98)ti+1 = proj[(cid:98)tmin,(cid:98)tmax] (cid:98)tRL(xi, (cid:98)ti) ∇ (cid:17) η d 4.2. Predefined Smoothing Schedule The second approach is motivated by SBGMs (Song & Ermon, 2019; Ho et al., 2020). It is equivalent to the GNC flow presented in Algorithm 1. However, the update step is replaced by the proximal gradient step xi+1 = proxηe(cid:98)ti D(z,*)(xi − ηe(cid:98)ti∇xRL(xi, (cid:98)ti)) to account for the additional data fidelity. Further, we use a fixed linear schedule from the initial (cid:98)t0 to (cid:98)tmin. (9) 4.3. Task-specific Learning of Smoothing Schedule Since it is not clear how to choose the smoothing sched- uler {(cid:98)ti}I i=1, why not learn it from data for a specific task? min {(cid:98)ti}I i=1⊂[(cid:98)tmin,(cid:98)tmax],{ηi}I i=1⊂R+ E (cid:98)x,z∼Px,z (cid:110) (cid:107)xI − (cid:98)x(cid:107)2 2 (cid:111) subject to xi+1 = proxηiD(z,*)(xi − ηi∇xRL(xi, (cid:98)ti)) for i = 1, . . . , I − 1 and x0 = z. Since the gradient w.r.t. (cid:98)t of ∇xRL is smooth due to the quartic spline interpolation, any gradient-based optimization algorithm can be used for learning. Interestingly, this observation relates the successful train- able non-linear reaction-diffusion (TNRD) models of Chen & Pock (2016) and variational networks (VNs) (Kobler et al., 2017; Hammernik et al., 2018; Effland et al., 2020) to SBGMs. Thus, VNs – with temporally changing pa- rameters across the steps – can be interpreted as a learned proximal-gradient scheme on gradually more non-convex energies. This relation enables an unsupervised pretraining of the prior advocated in TNRDs or VNs, followed by a task- specific fine-tuning of either just the smoothing schedule or the entire model. In contrast to the two previous approaches, here the only hyperparameter is the number of steps I, which is typically constrained by the time budget in applications. Moreover, if only the smoothing schedule and the step sizes are learned, just a few paired training samples are required for supervised learning due to the small parameter space. 5. Experimental Results In this section, we first visually analyze the learned reg- ularizers and then compare the three previous inference techniques for image denoising and inpainting. 5.1. Visual Analysis of Learned Priors Since the extended FoE priors are rather simple, a visual inspection of the parameters is still feasible. Figure 2 illus- trates a subset of the parameters of R1, R2, and R3, where the gray-scale images show the learned convolution kernels and the plots below the corresponding 2D non-linear func- tions. The blue and red colors correspond to (cid:98)tmin and (cid:98)tmax, respectively. We use the effective range of the data defined by the .01 and .99-quantiles to show the effective domain of every activation function for various (cid:98)t. This domain in- creases along (cid:98)t due to the variance exploding setup. The layers of the regularizers are visualized from top to bottom. The potential functions φL (bottom of each box) nicely il- lustrate the GNC effect and the red functions ((cid:98)tmax) become more quadratic. Comparing the potential functions of the different priors at (cid:98)tmin (blue lines), we observe that with an Learning Gradually Non-convex Image Priors Using Score Matching R1 R2 R3 Figure 2. Visualization of the learned parameters of RL for L ∈ {1, 2, 3}. The columns show the first ten parameter sets of each layer. The gray-scale images depict the convolution kernels of each input channel, while the plots below illustrate the corresponding activation functions and warmer colors indicate larger (cid:98)t ∈ [(cid:98)tmin, (cid:98)tmax]. increasing number of layers L, they become simpler in the sense that the number of local minima gets smaller and the support regions of each minimum are increased. This proba- bly originates from the fact that the complexity is distributed over multiple layers for L > 2. Moreover, we see the GNC effect also for R2 and R3 not only since the potential func- tions become quadratic toward (cid:98)tmax but also because the activation functions of the hidden layers get linear. 5.2. Ablation of Smoothing Schedule Selection Next, we compare the different inference techniques for solving inverse problems using the learned RL. In Figure 3, the behavior of the GNC flow (Section 4.2) and the joint optimization (Section 4.1) is compared for image denoising (top, σ = 0.1) and inpainting (bottom, 80% missing pixels). In analogy to the 1D introductory example, the attainment rate of the global minimal energy is presented in the top row of each block to show the effectiveness of the GNC principle. In detail, it is the average across the BSDS68 (Martin et al., 2001) test set for a broad range of initial smoothing t0 −202−4−20246−202−202−202−202−202−202−202−202−202−202−202−202−202−202−202−202−202−202−202−202−202−202−202−202−2.50.02.505−2.50.02.5−2.50.02.5−2.50.02.5−2.50.02.5−2.50.02.5−2.50.02.5−2.50.02.5−2.50.02.5−2.50.02.5−2.50.02.5−2.50.02.5−202−202−202−202−202−202−202−202−202−202−202−202−202−202−202−202−202−202−202−202−202−202−202−202−202−202−2.50.02.5−2.50.02.55.0−2.50.02.5−2.50.02.5−2.50.02.5−2.50.02.5−2.50.02.5−2.50.02.5−2.50.02.5−2.50.02.5−2.50.02.5−2.50.02.5−2.50.02.5 Learning Gradually Non-convex Image Priors Using Score Matching Denoising Figure 4. Comparison of the considered solution techniques for image denoising using I = 30 steps for the three priors RL, L ∈ {1, 2, 3}. The left plot depicts the average energy for each step of the BSDS68 dataset, while on the right the corresponding PSNR scores are visualized. This originates from a modeling and optimization trade-off described by Effland et al. (2020), where similar models have been learned in a discriminative way. Interestingly, this effect also arises in our generatively trained models. The effect is not as pronounced for image inpainting since the problem is harder because the initial image x0 = z has many missing pixels set to 0. Thus, the initial smoothing (cid:98)t0 and the number of steps I need to be properly selected to maximize the PSNR score. As outlined in Section 4.3, a suitable way of determining the hyperparameters of a GNC flow is by learning them from data for a specific task. Here, only the number of steps I is fixed a priori and the corresponding step sizes and smoothing schedule are learned to maximize performance in analogy to VNs. Figure 4 illustrates the energy and PSNR curves of all three schemes for an image denoising problem (σ = 0.1). While GNC flow and the joint optimiza- tion almost attain the global minimum after 30 steps, the learned VN does not. However, in terms of PSNR score, the learned VN outperforms the other approaches and reaches the maximum exactly at 30 steps and requires only training of 2I = 60 parameters. 6. Conclusion In this work, we established connections between denoising score-based models and the GNC principle in optimization. We found that a perturbation of the data by additive Gaus- sian noise leads to smoother densities respectively more convex energies with increasing variance. We demonstrated this effect by learning a one-parameter family of FoE priors, where the smoothing parameter can be naturally incorpo- rated into the potential functions. We showed that these priors indeed become convex for sufficiently large smooth- ing and can be easily incorporated into existing approaches for solving inverse problems such as MAP estimation. In future work, we will extend our work to more expressive priors and more challenging inverse problems. Inpainting Figure 3. Visualization of the average global minimum attainment rate and the PSNR over the BSDS68 test set for the GNC flow (left, (9)) and the proposed joint optimization (right, Algorithm 2) for image denoising (top) and inpainting (bottom) using η = 1. and number of steps I. Comparing both algorithms, we observe only minor differences and the optimal attainment rate is obtained for sufficiently large initial smoothing t0 and number of steps I. In contrast, the average PSNR scores w.r.t. the ground truth (second row in every box) behave differently. In particular for image denoising, the maximum PSNR score is obtained before the global minimum energy is attained, as can be seen by comparing the plots in the first and second rows. 10−410−310−210−1100t0GNCflow0.10.50.9AtainmentRateJointOptimization0.10.50.910−410−310−210−1100t02022242628PSNR202224262810−410−310−210−1100t00.10.50.9AtainmentRate0.10.50.9100101102103I10−410−310−210−1100t0101520222426100101102103IPSNR101520222426051015202530−2−1012RL(xi,(cid:98)ti)+D(z,xi)R1R2R30510152025302022242628PSNRjointoptimizationGNCflowlearnedVN Learning Gradually Non-convex Image Priors Using Score Matching References Aziznejad, S., Gupta, H., Campos, J., and Unser, M. Deep neural networks with trainable activations and controlled lipschitz constant. IEEE Transactions on Signal Process- ing, 68:4688–4699, 2020. Beck, A. and Teboulle, M. A fast iterative shrinkage- thresholding algorithm for linear inverse problems. SIAM journal on imaging sciences, 2(1):183–202, 2009. Blake, A. and Zisserman, A. Visual reconstruction. MIT Press, Cambridge, MA, 1987. Bolte, J., Sabach, S., and Teboulle, M. Proximal alternating linearized minimization for nonconvex and nonsmooth problems. Mathematical Programming, 146(1):459–494, 2014. Chen, Y. and Pock, T. Trainable nonlinear reaction diffu- sion: A flexible framework for fast and effective image restoration. IEEE Transactions on Pattern Analysis and Machine Intelligence, 39(6):1256–1272, 2016. Chen, Y., Ranftl, R., and Pock, T. Insights into analysis oper- ator learning: From patch-based sparse models to higher order MRFs. IEEE Transactions on Image Processing, 23(3):1060–1072, 2014. Dieleman, S., Sartran, L., Roshannai, A., Savinov, N., Ganin, Y., Richemond, P. H., Doucet, A., Strudel, R., Dyer, C., Durkan, C., et al. Continuous diffusion for categorical data. arXiv preprint arXiv:2211.15089, 2022. Durrett, R. Probability: Theory and Examples, volume 49. Cambridge university press, 2019. Effland, A., Kobler, E., Kunisch, K., and Pock, T. Varia- tional networks: An optimal control approach to early stopping variational methods for image restoration. Jour- nal of mathematical imaging and vision, 62(3):396–416, 2020. Efron, B. Tweedie's formula and selection bias. J. Amer. Statist. Assoc., 106(496):1602–1614, 2011. Hammernik, K., Klatzer, T., Kobler, E., Recht, M. P., Sod- ickson, D. K., Pock, T., and Knoll, F. Learning a varia- tional network for reconstruction of accelerated mri data. Magnetic resonance in medicine, 79(6):3055–3071, 2018. Ho, J., Jain, A., and Abbeel, P. Denoising diffusion proba- bilistic models. Advances in Neural Information Process- ing Systems, 33:6840–6851, 2020. Ho, J., Chan, W., Saharia, C., Whang, J., Gao, R., Gritsenko, A., Kingma, D. P., Poole, B., Norouzi, M., Fleet, D. J., et al. Imagen video: High definition video generation with diffusion models. arXiv preprint arXiv:2210.02303, 2022. Huang, C.-W., Lim, J. H., and Courville, A. C. A varia- tional perspective on diffusion-based generative models and score matching. Advances in Neural Information Processing Systems, 34, 2021. Hyv ̈arinen, A. Estimation of non-normalized statistical models by score matching. Journal of Machine Learning Research, 6(4), 2005. Karras, T., Aittala, M., Aila, T., and Laine, S. Elucidating the design space of diffusion-based generative models. In Advances in Neural Information Processing Systems, 2022. Kobler, E., Klatzer, T., Hammernik, K., and Pock, T. Varia- tional networks: connecting variational methods and deep learning. In German Conference on Pattern Recognition, pp. 281–293, 2017. Martin, D., Fowlkes, C., Tal, D., and Malik, J. A database of human segmented natural images and its application to evaluating segmentation algorithms and measuring ecological statistics. In Proc. 8th Int'l Conf. Computer Vision, volume 2, pp. 416–423, July 2001. Nguyen, T. T., Nguyen, H. D., Chamroukhi, F., and McLach- lan, G. J. Approximation by finite mixtures of continuous density functions that vanish at infinity. Cogent Mathe- matics & Statistics, 7(1):1750861, 2020. Ochs, P., Meinhardt, T., Leal-Taixe, L., and Moeller, M. Lifting layers: Analysis and applications. In ECCV, pp. 52–67, 2018. Robbins, H. An empirical Bayes approach to statistics. In Proceedings of the Third Berkeley Symposium on Mathe- matical Statistics and Probability, 1954–1955, vol. I, pp. 157–163, 1956. Rombach, R., Blattmann, A., Lorenz, D., Esser, P., and Ommer, B. High-resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Con- ference on Computer Vision and Pattern Recognition, pp. 10684–10695, 2022. Roth, S. and Black, M. J. Fields of Experts. Int. J. Comput. Vis., 82(2):205–229, 2009. Sohl-Dickstein, J., Weiss, E., Maheswaranathan, N., and Ganguli, S. Deep unsupervised learning using nonequi- librium thermodynamics. In International Conference on Machine Learning, pp. 2256–2265, 2015. Song, J., Meng, C., and Ermon, S. Denoising diffusion implicit models. In International Conference on Learning Representations, 2022. Learning Gradually Non-convex Image Priors Using Score Matching Song, Y. and Ermon, S. Generative modeling by estimating gradients of the data distribution. In Advances in Neural Information Processing Systems, volume 32, 2019. Song, Y. and Ermon, S. Improved techniques for training score-based generative models. In Advances in Neural Information Processing Systems, 2020. Song, Y., Sohl-Dickstein, J., Kingma, D. P., Kumar, A., Er- mon, S., and Poole, B. Score-based generative modeling through stochastic differential equations. In International Conference on Learning Representations, 2021. Vincent, P. A connection between score matching and de- noising autoencoders. Neural Comput., 23(7):1661–1674, 2011. Yang, L., Zhang, Z., Song, Y., Hong, S., Xu, R., Zhao, Y., Shao, Y., Zhang, W., Cui, B., and Yang, M.-H. Diffu- sion models: A comprehensive survey of methods and applications. arXiv preprint arXiv:2209.00796, 2022. Zhuang, J., Tang, T., Ding, Y., Tatikonda, S. C., Dvornek, N., Papademetris, X., and Duncan, J. Adabelief optimizer: Adapting stepsizes by the belief in observed gradients. Advances in neural information processing systems, 33: 18795–18806, 2020. Learning Gradually Non-convex Image Priors Using Score Matching A. Proofs of Theorem 2.2 and Corollary 2.3 Theorem A.1. Let X ⊂ Rd be a bounded set such that diameter diam(X ) < ∞ and consider a GMM of the form p(x) = n (cid:88) i=1 wiG(xi, Σi)(x), where (w1 * * * wn)(cid:62) ∈ ∆n. Assume {xi}n smoothed energy i=1 ⊂ X . Then there exists a smoothing parameter (cid:101)t ∈ (0, ∞) such that the F (x, t) := − log (cid:0)(p ∗ G(0, tId))(x)(cid:1) is convex w.r.t. x for all t ≥ (cid:101)t. Proof. The smoothed energy is defined as a convolution of Gaussians (Durrett, 2019), hence its explicit form reads as F (x, t) = − log n (cid:88) i=1 (cid:124) wiG(xi, Σi + tId)(x) = − log f (x, t). (10) (cid:123)(cid:122) =:f (x,t) (cid:125) Since F ∈ C∞(X × R++, R), the proof relies on showing positive definiteness of the Hessian ∇2 Let us first compute the gradient f xF (x, t) for any x ∈ X . ∇xf (x, t) = − = − n (cid:88) i=1 n (cid:88) i=1 wi |2π (cid:101)Σi| 1 2 (cid:16) exp − (cid:107)x − μ(cid:107)2 (cid:101)Σ−1 i (cid:17) (cid:101)Σ−1 i (x − xi) wiG(xi, (cid:101)Σi) (cid:101)Σ−1 i (cid:124) (x − xi) (cid:123)(cid:122) (cid:125) ri using (cid:101)Σi = Σi + tId. Similarly, the Hessian of f is given by ∇2 xf (x, t) = − n (cid:88) i=1 wiG(xi, (cid:101)Σi) (cid:16) (cid:101)Σ−1 i − rir(cid:62) i (cid:17) . Then the gradient of the energy reads as and its Hessian is defined as ∇xF (x, t) = − 1 f (x, t) ∇xf (x, t) ∇2 xF (x, t) = − 1 f (x, t) ∇2 xf (x, t) + 1 f (x, t)2 ∇xf (x, t) (∇xf (x, t))(cid:62) . By plugging in the Hessian of f , we get ∇2 xF (x, t) = (cid:40) n (cid:88) i=1 1 f (x, t) (cid:124) (cid:123)(cid:122) (cid:125) ≥0 wiG(xi, (cid:101)Σi)(x) (cid:123)(cid:122) (cid:125) (cid:124) ≥0 (cid:16) (cid:101)Σ−1 i − rir(cid:62) i (cid:17) + 1 f (x, t) (cid:124) ∇xf (x, t) (∇xf (x, t))(cid:62) (cid:125) (cid:123)(cid:122) (cid:23)0 (cid:41) . For any t ∈ (0, ∞), the energy F is convex if ∇2 positive, we only need to ensure that xF (x, t) (cid:23) 0 for all x ∈ X . Since almost all parts of ∇2 xF (x, t) are (cid:101)Σ−1 i − rir(cid:62) i = (cid:101)Σ−1 i − (cid:101)Σ−1 i (x − xi)(x − xi)(cid:62) (cid:101)Σ−1 i (cid:23) 0 for all i = 1, . . . , n. By multiplying (cid:101)Σi from both sides, we get (cid:101)Σi − (x − xi)(x − xi)(cid:62) (cid:23) 0 ⇐⇒ Σi + tId (cid:23) (x − xi)(x − xi)(cid:62). Learning Gradually Non-convex Image Priors Using Score Matching Computing the minimal Eigenvalue on the left-hand-side and the maximal Eigenvalue on the right-hand-side, we obtain (cid:18) (cid:107)x − xi(cid:107)2 x − xi (cid:107)x − xi(cid:107) (x − xi)(cid:62) (cid:107)x − xi(cid:107) λmin(Σi) + t ≥ λmax = (cid:107)x − xi(cid:107)2 . (cid:19) Since λmin(Σi) ≥ 0 for any i = 1, . . . , n, it is sufficient to show that t ≥ (cid:107)x − xi(cid:107)2 , which is the case if max i=1,...,n holds true. Note that we can estimate the right-hand-side from above by the domain's diameter diam(X ) = supx,y∈X (cid:107)x − y(cid:107). As a result, we conclude the proof by t ≥ max x∈X (cid:107)x − xi(cid:107)2 t ≥ diam(X )2. Corollary A.2. Theorem 2.2 also holds if an empirical discrete probability measure of a dataset {xi}n i=1 ⊂ X , i.e. is considered. Here, δx denotes the Dirac delta measure located at x. p = 1 n n (cid:88) i=1 δxi, Proof. Since the convolution of the empirical probability measure p with a zero-mean Gaussian results in a GMM due to the translation property of the Dirac delta function, we get F (x, t) = − log f (x, t) for i=1 Note that this results is identical to the definition of f in (10) if Σi = 0 for i = 1, . . . , n. Consequently, the proof of this corollary follows the same line of arguments as in Theorem 2.2. f (x, t) = n (cid:88) G(xi, tId). 1 n B. Implementation Details To extract and combine features, we use the following convolution operators. The first convolution operator K1 facili- tates N1 = 48 kernels of size 7 × 7, which are initialized by the 2D discrete cosine transform basis filers as in Chen & Pock (2016); Kobler et al. (2017). All subsequent operators Ki, i = 2, . . . , L implement 2-dimensional convolutions using Ni = 48 kernels of size 3 × 3. Those filters are initialized using "Kaiming"-normal initialization. Neither of the convolution operators facilitates bias terms since each subsequent non-linear parametric function may adapt to its input features. Throughout the prior models, every non-linear function is implemented using weighted spline basis functions. In addition, each non-linearity is a function in two variables – an input feature x ∈ R and the (logarithmic) smoothing parameter (cid:98)t ∈ [(cid:98)tmin, (cid:98)tmax]. For the ith layer and the jth feature channel, the output of the corresponding activation function φij is computed as φij(x, (cid:98)t) = Nx(cid:88) Nt(cid:88) l=1 o=1 wlo ij φ (cid:18) x − μl x γx (cid:19) φ (cid:32) (cid:33) , (cid:98)t − μo x γt where Nx, Nt ∈ N define the number of basis functions and the weights wlo functions, we place the means μl equally distributed on the interval [(cid:98)tmin, (cid:98)tmax] and γt = (cid:98)tmax−(cid:98)tmin ij ∈ R are learned during optimization. For all t are . The kernel φ : R → R is given by the quartic spline, i.e., Nx−1 . Likewise, the means μo x on an equidistant grid on [−3.5, 3.5] and set γx = 7 Nt−1 φ(x) = 1 24    11 + 12(|x| + 1 1 + 4( 3 ( 5 2 − |x|)4 0 2 ) − 6(|x| + 1 2 )2 − 12(|x| + 1 2 − |x|) + 6( 3 2 − |x|)2 + 4( 3 2 − |x|)3 − 4( 3 2 )3 + 6(|x| + 1 2 − |x|)4 2 )4 if 0 ≤ |x| < 1 2 2 ≤ |x| < 3 if 1 if 3 2 ≤ |x| < 5 else 2 2 . Learning Gradually Non-convex Image Priors Using Score Matching These activation functions are computationally much more expensive than simple ReLU-activations. However, the spline- based activation functions are much more expressive and several implementation tricks can be used to compute these activation functions efficiently. The non-linear functions of the intermediate layers φi, i = 1, . . . , L − 1 are initialized to the identity function, while the last non-linear function φL is initialized to the quadratic function. As a source of natural image patches, we consider the BSDS500 dataset (Martin et al., 2001) and randomly extract 96 × 96 image patches to define the empirical distribution PX . In the implementation, we sample the smoothing parameter from a uniform distribution, i.e., (cid:98)t ∼ U((cid:98)tmin, (cid:98)tmax). To minimize the training loss (7) with the scaling factor mt = 1 d , the AdaBelief (Zhuang et al., 2020) optimizer is used for 100 000 iterations using a mini-batch size of 128 along with an initial learning rate of 10−3. The learning rate is annealed to 5 * 10−5 using a cosine scheme. We utilize the AdaBelief optimizer since it performs preconditioning based on local curvature information. Thus, it is well suited to learn parameters that lie in different intervals.
http://arxiv.org/abs/2302.10494v2
2023-05-31T04:50:46
2023-02-21T07:48:34
MaskedKD: Efficient Distillation of Vision Transformers with Masked Images
Knowledge distillation is an effective method for training lightweight models, but it introduces a significant amount of computational overhead to the training cost, as the method requires acquiring teacher supervisions on training samples. This additional cost -- called distillation cost -- is most pronounced when we employ large-scale teacher models such as vision transformers (ViTs). We present MaskedKD, a simple yet effective strategy that can significantly reduce the cost of distilling ViTs without sacrificing the prediction accuracy of the student model. Specifically, MaskedKD diminishes the cost of running teacher at inference by masking a fraction of image patch tokens fed to the teacher, and therefore skipping the computations required to process those patches. The mask locations are selected to prevent masking away the core features of an image that the student model uses for prediction. This mask selection mechanism operates based on some attention score of the student model, which is already computed during the student forward pass, and thus incurs almost no additional computation. Without sacrificing the final student accuracy, MaskedKD dramatically reduces the amount of computations required for distilling ViTs. We demonstrate that MaskedKD can save up the distillation cost by $50\%$ without any student performance drop, leading to approximately $28\%$ drop in the overall training FLOPs.
[ "Seungwoo Son", "Namhoon Lee", "Jaeho Lee" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10494v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10494v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.CV" ]
3 2 0 2 y a M 1 3 ] G L . s c [ 2 v 4 9 4 0 1 . 2 0 3 2 : v i X r a MaskedKD: Efficient Distillation of Vision Transformers with Masked Images Seungwoo Son, Namhoon Lee, Jaeho Lee Pohang University of Science and Technology (POSTECH) {swson,namhoonlee,jaeho.lee}@postech.ac.kr Abstract Knowledge distillation is an effective method for training lightweight models, but it introduces a significant amount of computational overhead to the training cost, as the method requires acquiring teacher supervisions on training samples. This additional cost-called distillation cost-is most pronounced when we em- ploy large-scale teacher models such as vision transformers (ViTs). We present MaskedKD, a simple yet effective strategy that can significantly reduce the cost of distilling ViTs without sacrificing the prediction accuracy of the student model. Specifically, MaskedKD diminishes the cost of running teacher at inference by masking a fraction of image patch tokens fed to the teacher, and therefore skip- ping the computations required to process those patches. The mask locations are selected to prevent masking away the core features of an image that the student model uses for prediction. This mask selection mechanism operates based on some attention score of the student model, which is already computed during the student forward pass, and thus incurs almost no additional computation. Without sacrificing the final student accuracy, MaskedKD dramatically reduces the amount of computations required for distilling ViTs. We demonstrate that MaskedKD can save up the distillation cost by 50% without any student performance drop, leading to approximately 28% drop in the overall training FLOPs. 1 Introduction We develop a simple technique that can save tremendous amounts of computations required to distill vision transformers (ViTs) [7]. The fact that ViTs tend to scale better than convolutional networks has given rise to billion-parameter-scale models (e.g., ViT-22B [5]), leading to an increased need for an effective way to compress these models. The classic idea of knowledge distillation (KD) [13] has been found very useful for this purpose; distilling the knowledge of large teacher ViTs into small students can improve the prediction accuracy of the students significantly [34, 35, 11]. Furthermore, KD can also be used to enhance the performance of ViTs that are compressed already (e.g., via pruning/quantization), by distilling the knowledge from the original uncompressed model [38, 18]. However, the computational cost of distilling ViTs can be prohibitively expensive. To acquire teacher's supervision and distill its knowledge, one needs to make multiple predictions for training samples on the teacher model, which could amount to an order of magnitude larger than the computations required to process the student model (see left of Fig. 1). The total computational overhead (i.e., the distillation cost) translates into approximately 104 TPUv3-days for ViT-G scale teacher models [40]. Existing works attempt to relieve the situation by pre-computing the teacher's predictions for all training data and re-using them at the distillation phase [39, 28]. However, these methods not only require a memory storage to save the prediction results, but also tend to degrade student accuracy, due to their somewhat limited ability to account for various data augmentations, e.g., mixup or Preprint. Under review. Figure 1: (Left) Knowledge distillation is computation-heavy. We break down the per-step training cost of DeiT distillation, using either the vanilla KD (left) or the proposed MaskedKD (right). For MaskedKD, we mask 50% of all input image patches, which does not degrade the performance of the student model. (Right) MaskedKD Illustrated. MaskedKD works in four steps: (1) Student ViT predicts on the full image. (2) Mask the image with the student attention score. (3) Teacher ViT predicts for the masked image. (4) Match the teacher and student logits. RandAugment; distilling with teacher's predictions on unaugmented sample to the student seeing augmented data is detrimental to performance [1, 28]. In this paper, we develop a simple strategy called MaskedKD (Masked Knowledge Distillation) to cut down the ViT distillation cost quite dramatically without degrading the student accuracy. Precisely, MaskedKD masks out a fraction of image patch tokens given as the teacher input and thus skips the computations therein (see right of Fig. 1). This reduces the teacher forward cost without requiring any architectural change or retraining of the teacher. The patches to mask are determined by the patch saliency metric, computed based on the student model attention, which is designed to prevent masking away the core features that the student uses for prediction. This mechanism re-uses the attention scores obtained during the student forward process, and thus adds almost no extra computation. Empirically, we find that MaskedKD can decrease the number of input patches given to the teacher models by 25–50% without degrading the student accuracy, under diverse choices of the teacher/stu- dent architectures and the base ViT distillation algorithms. This decrease in the number of patches translates into a proportional reduction in the computational cost; when distilling DeiT-S to DeiT-Ti, we can save over 50% of the distillation cost (i.e., total teacher FLOPs), leading to over 25% reduction in total training computation. We observe a similar increase in throughput, varying from ×2.0 to ×3.7 depending on the settings. We also find that MaskedKD can be applied to transformers processing audio data [8] and self-supervised learning scenarios, such as DINO [3]. 2 Related Work Here, we discuss existing works on the ViT distillation, token pruning and merging techniques for ViTs, and the methods for saving the computational costs of knowledge distillation. Distilling ViTs. ViTs became popular soon after its introduction, and much efforts have followed to design algorithms to distill the knowledge to and from the model. An early work by Touvron et al. [30] considers distilling the architectural inductive bias of convolutional neural networks to ViT, for enhancing the data-efficiency of the model. More recent works consider distilling from a large ViT teacher to a smaller ViT student. In such cases, additionally transferring patch-level information has been observed to be beneficial for the student performance. Wang et al. [34] transfers the teacher attention score between class and patch tokens to the student ViT. Wu et al. [35] propose to match the attention score distribution of the student to the self-supervised and supervised teachers. Zhang et al. [41] transfers the weight information between the self-attention modules of the teacher and the student. Hao et al. [11] regularize the student ViT to match the teacher ViT in the patch-level manifold space, unlike for convolutional neural networks where we match at the image level. Wu et al. [36] asks a slightly different question of "when should we distill" and finds that distillation during the pre-training phase is beneficial for the performance. The present paper also considers a 2 Figure 2: Latency and computational benefits of MaskedKD. (Left plot) Per-iteration time required for each steps of KD, before and after applying the MaskedKD. (Right plot) Per-iteration computations required for MLP, projection, and attention module of the teacher ViT. For both plots, black dashed lines denote the sum of three components. The teacher is DeiT-S, and the student is DeiT-Ti. The latency is measured on a single NVIDIA A6000 GPU with the batch size of 128. distillation of a ViT to another ViT. Unlike prior work, however, we mainly focus on reducing the distillation cost of the model, rather than the student inference cost. Reducing input tokens of ViTs. The initial use of ViT token removal methods, i.e., masking a fraction of input tokens, was for the self-supervised learning. As in language models [6], the masked pre-training of ViTs gives significant performance boosts to downstream tasks [7, 12]. The use of token removal for reducing the computational burden of transformers has been pioneered by [9] for language models, and much efforts have followed to design a similar method for ViTs. DynamicViT [26], A-ViT [37], and AdaViT [21] give algorithms to train a model that gradually removes intermediate tokens as the layer goes deeper, dramatically reducing the inference cost of the model. Instead of completely discarding tokens, Kong et al. [16], Liang et al. [19], and Marin et al. [20] propose to combine intermediate tokens into another, instead of removing them. Bolya et al. [2] introduce a drop-in token merging module that can be used to enhance the inference efficiency without any additional training steps. These works focus on reducing the ViT inference cost by reducing the number of intermediate tokens used. Our paper, in contrast, reduces the training cost for distillation by masking the input tokens for the teacher. The inference efficiency is achieved by selecting a student model that is smaller than the teacher model, and not by pruning or merging the intermediate layer tokens of the student model. Saving the distillation cost. A recent line of work attempts to reduce the distillation cost by re-using teacher supervisions. In particular, Shen and Xing [28] draw inspirations from ImageNet re-labeling technique [39] to pre-compute teacher model's predictions on multiple random crops of training samples; the crop information and the pseudo-labels (teacher predictions) are stored as additional attributes of the sample. Then, the student model is trained by drawing randomly cropped training images and corresponding pseudo-labels (along with the original label), and using the cross-entropy and distillation loss on these samples to update the model. However, this approach (called FastKD) has a limited applicability for the cases where more diverse data augmentations are used. Pre-computing the predictions on all possible augmentations may be prohibitively expensive, while not apply diverse augmentations or having teacher and student predict on inconsistent augmentations lead to a degraded student accuracy [1, 28]. On the other hand, the proposed MaskedKD saves the distillation cost by reducing the teacher inference cost directly, applicable to the standard on-the-fly distillation scenario. 3 Method: Masked Knowledge Distillation We present masked knowledge distillation (MaskedKD), a simple yet effective approach for reducing the ViT distillation cost. In a nutshell, MaskedKD masks off a fixed fraction of input image patches, and feeds the masked image through the teacher model; the masks are located in a way that the teacher can provide supervisions on the patch which the student utilizes the most to make its own predictions; we provide more details about the masking mechanism in Section 3.1. More concretely, let fS and fT be the student and teacher ViTs, respectively. Given an input image- label pair (x, y), MaskedKD generates a masked version of the image xmask and train the student 3 Figure 3: (Left) Performance vs. #Patches. By masking more teacher input tokens, the teacher accuracy continuously decreases. In contrast, the student accuracy slightly increases first, and then starts to decrease. (Right) Top-3 predictions of the (masked) teacher and the student. Predictions in blue correspond to the foreground objects in the image, and predictions in red correspond to the context attributes. The masked teacher tends to make more similar predictions to the student. model with the combined loss of the cross-entropy and distillation loss. In other words, we minimize L = LCE(fS(x), y) + λ * LKD(fS(x), fT (xmask)), where LCE denotes the cross-entropy loss, LKD denotes the distillation loss, and λ ≥ 0 is a hyperpa- rameter for balancing two losses. The distillation loss LKD can be chosen flexibly depending on the base distillation algorithm we want to use, e.g., the KL-divergence for the classic logit distillation [13] or the l2 distance between intermediate activations for the feature distillation [35]. (1) The key difference between standard knowledge distillation and the MaskedKD (Eq. (1)) is that the latter uses the masked teacher input fT (xmask) instead of fT (x). This change has following effects: • Lowering the computational cost. By masking the input image, the computations associated with the masked tokens can be skipped (even without specialized kernels). As the amount of computation grows linearly (for MLP layers) or quadratically (for multi-head attention layers) with respect to the number of tokens used, masking the tokens can lead to a significant reduction in computation and time for the teacher forward step (Fig. 2). • Guiding student learning. We find that, with the proposed masking strategy, the final classification accuracy of the student ViT does not degrade even when we mask 25–50% of all tokens. In fact, we find that the student performance sometimes slightly increases when we remove only a small fraction of tokens; we give a more detailed description in Section 3.1. 3.1 Mask Selection Strategy The primary aim of our mask selection strategy is enabling the teacher to provide a supervision that is more relevant and informative to the student's decision-making process. In other words, we want to prevent the teacher from providing a misleading supervision by making a prediction on an image where all the core features-that the student uses for the prediction-have been masked. To achieve this goal, we propose to measure the patch saliency based on the attention score of the student ViT. More precisely, we inspect the last multi-head attention layer of the student ViT (similarly to [3, 4]), and add the attention scores from the class token query vector to image patch key vectors over all heads to compute the patch saliency. We then mask a fixed fraction of image patches with the smallest patch saliency. More formally, suppose that the input image is divided into N non-overlapping patches for both student and the teacher ViT.1 Total N + 1 tokens, including the class token, is given as an input to 1In case where patch sizes differ, we compute the patch saliency score for the student ViT first and perform bilinear interpolation to get the score for each patch of the teacher. 4 the last multi-head attention layer of the student model. For the h-th attention head (among H heads), the attention score from the class token to the image patch tokens are given as a(h) = Softmax (cid:18) 1 √ d * (cid:0)q⊤ clsk1, q⊤ clsk2, * * * , q⊤ clskN (cid:19) (cid:1) , h ∈ {1, 2, . . . , H} (2) where qcls is the query of the class token, ki is the key of the i-th image patch token, and d is the length of query and key vectors. Given this attention score, we compute the patch saliency metric as ̄a = (cid:80)H h=1 a(h). We use this score to select and mask n patches with the smallest scores. Computational efficiency. The proposed patch saliency score introduces almost no computational overhead, as we can re-use the attention scores computed during the student forward step. The only added computation is adding the attention scores, which takes N * (H − 1) FLOPs. For ViTs, typically the number of patches is at most 576 (typically 196 or 256) and the number of heads is at most 48 (typically 16), requiring less than 28k FLOPs to compute the patch saliency score. Training duration. The patch saliency score based on the student attention requires one to perform student forward strictly before the teacher forward, which makes it tricky to accelerate the distillation by running teacher/student models on two separate GPUs. However, this difficulty can be resolved by adopting a fine-grained pipelining strategy; see Appendix F for details. Student performance. We find that, when using the proposed patch saliency criterion, the final student model accuracy does not degrade even when we remove substantial amount of the image patch tokens from the teacher input (left of Fig. 3 and Section 4). Indeed we observe that the student performance sometimes increases when we remove only a small fraction of patches. We hypothesize that this performance boost comes from the fact that masking the teacher input often makes the teacher and student predictions more similar (right of Fig. 3), with predictions focused more on the core attributes instead of the context (e.g., background features). In other words, student-guided masking can help the teacher provide a better-tailored supervision to the student. 4 Experiments The experimental section is organized as follows: • Section 4.1 describes the experimental setup for the main results (Tables 1 and 2). • Section 4.2 reports the performance of MaskedKD applied on popular ViT distillation algorithms [13, 11, 34, 14] over various choices of the teacher and student models. • Section 4.3 discusses the performance of MaskedKD over the boundary of supervised ViT distilla- tion; in particular, we consider distilling the audio spectrogram transformer [8] and the distillation for the self-supervised training [3]. • Section 4.4 compares the performance of the proposed masking strategy against various alternatives. In the supplementary materials, we provide additional experimental results, including the application of MaskedKD to the distillation of larger ViTs (Appendix B), using MaskedKD to distill from teachers trained with higher-resolution images (Appendix C), the performance of MaskedKD when distilling only the linear classifiers (Appendix D). 4.1 Experimental Setup Dataset. We train our models in a supervised manner on the ImageNet-1k classification dataset [27] from scratch, where we crop each image to 224 × 224 resolution. Each image is divided into total 196 patches of size 16 × 16 pixels. Models. As the student, we mainly use DeiTs of various sizes, ranging from "Tiny" to "Base" [30]; we additionally provide results on larger-scale student models in (Appendix B). As the teacher, we additionally consider DeiT3 [32] and CaiT [31] of various sizes. We use publicly released checkpoints of the teacher models without any additional training. Base distillation algorithms. We apply MaskedKD on the following distillation algorithms: • Logit [13]: Logit distillation is our main base distillation; this method encourages the student model logits to be similar to the teacher model logits via KL-divergence loss. 5 Table 1: Masking the logit distillation. We apply MaskedKD to the logit distillation [13]. Here, "MaskedKDκ%" means that we keep only κ% of tokens from the teacher input (total 196 patches). "Acc." denotes the ImageNet top-1 accuracy of the student model. "Throughput" denotes the teacher model throughput, measured in wall-clock time (averaged over 50 batches). "Distill. Cost" denotes the total teacher FLOPs spent throughout the whole distillation process. Student Teacher Method Acc. (%) Throughput (img/s) Distill. Cost (GFLOPs) - No distillation DeiT-S DeiT-Ti DeiT3-S DeiT3-B CaiT-S24 Logit +MaskedKD 50% +MaskedKD 40% Logit +MaskedKD 50% +MaskedKD 25% Logit +MaskedKD 50% +MaskedKD 25% Logit +MaskedKD 75% +MaskedKD 50% - No distillation DeiT-S DeiT-B DeiT3-B Logit +MaskedKD 75% +MaskedKD 50% Logit +MaskedKD 75% +MaskedKD 50% - No distillation DeiT-B DeiT3-L Logit +MaskedKD 75% +MaskedKD 50% 72.2 74.9 75.1 74.9 75.0 75.1 74.8 74.2 74.8 74.5 75.3 75.4 75.3 79.9 80.8 81.0 80.9 81.3 81.4 81.3 81.8 83.5 83.5 83.5 - 1790 3700 (x2.1) 4640 (x2.6) 1790 3612 (x2.0) 6894 (x3.9) 750 1536 (x2.0) 2882 (x3.8) 528 807 (x1.5) 1018 (x1.9) - 744 1038 (x1.4) 1519 (x2.0) 750 1017 (x1.4) 1536 (x2.0) - 248 337 (x1.4) 512 (x2.1) - 1382 676 (-51%) 552 (-60%) 1382 676 (-51%) 343 (-75%) 5274 2614 (-50%) 1324 (-75%) 2803 2016 (-28%) 1349 (-52%) - 5274 3850 (-27%) 2614 (-50%) 5274 3850 (-27%) 2614 (-50%) 18481 13504 (-27%) 9167 (-50%) • Manifold [11]: The manifold distillation regularizes the student features to share the same patch- level manifold structure with the teacher model features. • Attention (adapted from [34]): Attention distillation transfers the teacher's layer layer attention scores between the class and patch tokens to the student. Unlike [34], we apply this technique to the supervised distillation. In the supervised setup, we find that distilling attention scores of all layers perform better than distilling only the last layer; we distill all layers in this paper. • G2SD [14]: G2SD is a two-stage distillation algorithm which first distills from a self-supervised teacher (trained via MAE [12]) and then from a supervised teacher obtained by fine-tuning the self-supervised teacher on the target task. We apply MaskedKD during the fine-tuning stage only. Hardware. All throughputs and latencies reported are measured on a single NVIDIA RTX A6000 graphic card using FP32 and the batch size 128. Other details. Other details are given in Appendix A. 4.2 Main Results Logit distillation. Table 1 compares the performances of the vanilla logit-based KD algorithm that uses the full image for the teacher input, against the proposed MaskedKD. From the table, we observe that we can safely remove 50% of the patches from the teacher input image, without sacrificing the student accuracy; in some cases, we can remove 60–75% of the patches. We also observe that, 6 Table 2: Masking ViT distillation algorithms. We apply MaskedKD to the manifold distillation [11], attention distillation [34], and G2SD [14]. Here, the symbol denotes that the model has the distillation token an additional distilltion token as the input; for this model, we do not report the performance of a model trained without distillation. Student Teacher Method Acc. (%) Throughput (img/s) Distill. Cost (GFLOPs) - No distillation DeiT-S DeiT-Ti CaiT-S24 DeiT-S MAE-ViT-B Logit [13] +MaskedKD 50% Manifold [11] +MaskedKD 75% Attention [34] +MaskedKD 50% Logit [13] +MaskedKD 75% Manifold [11] +MaskedKD 75% G2SD [14] +MaskedKD 75% +MaskedKD 50% 72.2 74.9 75.1 75.1 75.2 75.3 75.3 75.3 75.4 75.8 75.8 81.5 81.6 81.5 - 1790 3700 (x2.1) 1790 2520 (x1.4) 1790 3700 (x2.1) 528 807 (x1.5) 528 807 (x1.5) 750 1038 (x1.4) 1536 (x2.0) - 1382 676 (-51%) 1382 1001 (-28%) 1382 676 (-50%) 2803 2016 (-28%) 2803 2016 (-26%) 3516 2566 (-27%) 1743 (-50%) in most cases, masking a small fraction of patches is beneficial for the performance of the trained student (although with a very small boost). Such performance gain from masking is most pronounced when the size gap between the teacher and the student is large (DeiT3-B → DeiT-Ti). From this observation, we hypothesize that the masking may have an effect similar to making a (low-capacity) teaching assistant model [22], which can teach the student better than an overly large teacher. Other ViT distillation algorithms. Table 2 compares the performance of the student models distilled with more recent ViT-specialized algorithms against the version with MaskedKD applied. Again, we observe that masking the teacher input by 25–50% does not degrade the student model accuracy.2 Here, we note that the fraction of patches that we can safely mask is slightly lower than for logit distillation; this observation suggests that there may be some room to design a better patch saliency metric that helps better preserve the ViT-specific features after masking (e.g., patch manifold information or attention scores). 4.3 Applying MaskedKD to Audio Datasets and Self-supervised Learning Here, we test the performance of the MaskedKD for the tasks other than the supervised ViT distillation. In particular, we apply MaskedKD to (1) the distillation of audio spectrogram transformers, and (2) the self-supervised learning algorithms that utilize some form of self-distillation. Distilling audio transformers. Here, we check whether the MaskedKD can also be applied for an efficient distillation of the transformer that processes data from other domains. To this end, we consider distilling an audio spectrogram transformer (AST) [8] on the ESC-50 audio classification dataset [25]. AST has an identical architecture to DeiT, but uses a modified training recipe and hyperparameters tailored for processing the spectrograms of the speech data. We give a more detailed description of the experimental setups in Appendix A. Table 3 compares the performance of the vanilla logit distillation algorithm against the distillation with MaskedKD. We observe that the MaskedKD can indeed reduce the number of patches used by 17% without sacrificing the performance (masking 100 patches out of 600). The distillation cost reduction, however, is not as much as in the vision domain. The performance drops by 0.6% if we use only 50% of the patches, unlike most vision transformers. 2For G2SD, the student accuracy we obtained for the baseline (81.5%) is slightly lower than the figure reported in the original paper. We could not reproduce the reported accuracy although we used the official code. 7 ⚗⚗ Table 3: Masking Audio classification. We apply MaskedKD on distilling the audio spec- trogram transformer [8] for the audio classifi- cation task on the ESC-50 dataset [25]. Table 4: Masking DINO. We apply MaskedKD on the self-supervised training procedure of DINO [3]. "Linear" denotes the linear probing accuracy and "Compute" denotes the total teacher FLOPs. Student Teacher Method Acc. (%) - No distillation 85.1 AST-S AST-B Logit 86.3 +MaskedKD 83% 86.4 +MaskedKD 50% 85.7 Model Method Linear (%) Compute DINO 73.7 460 (GFLOPs) DeiT-S +MaskedKD 87% 73.9 +MaskedKD 77% 74.0 +MaskedKD 66% 74.2 +MaskedKD 61% 73.6 396 348 300 276 Self-distillation for self-supervised learning. Here, we apply MaskedKD to reduce the computations of a distillation-based self-supervised learning algorithm, DINO [3]. A line of self-supervised learning literature aims to train useful image representations by distilling the knowledge from a teacher model- generated as a moving average of the student-that sees a differently augmented version from the student [10]. Since its advent, such self-training algorithms for self-supervised learning has been one of the major use cases of the knowledge distillation. In the context of ViT, DINO [3] is one of the most prominent algorithms in the direction. DINO employs a teacher that sees the full image, a student that sees the full image as well, and additional students having smaller field of views (FOVs); then, DINO performs the self-distillation to regularize the teacher and students to give similar outputs. We apply MaskedKD to DINO as follows: We use only the attention scores of a student that sees the full image to compute the patch saliency, and mask the teacher input. As the student models with smaller FOVs have a much smaller computational cost for inference, masking the teacher can save a substantial portion of the whole training cost. Table 4 compares the performance of the vanilla DINO against MaskedKD, where we use ImageNet- 1k dataset for both the pre-training phase (100 epochs) and fine-tuning phase. We observe that we can mask away more than 30% of the patches from the teacher input without a degradation in the quality of the learned representation; the quality of representation is measured by the accuracy achievable by linear probing, i.e., only the linear classifier is fine-tuned for the task. We can save the teacher computation accordingly, cutting down the total teacher FLOPs from 460GFLOPs to 300GFLOPs when we use 66% of the patches. 4.4 Comparison with Alternative Masking Strategies Here, we compare the performance of the student-attention-based masking strategy of the MaskedKD (described in Section 3.1) with potential alternatives masking mechanisms and give sanity checks. More specifically, we compare against four types of competitors. • DINO: A recent work by Caron et al. [3] shows that a self-supervised model gives an attention map that is particularly well-aligned with the human perception. Inspired by this observation, we test whether a self-supervised ViT can give a better guidance for the token selection than the student model. We note that, in practice, this is in fact a computationally impractical option per se, as it requires an additional forward step through the DINO-trained ViT (other than the student ViT). • Mask Consistency: Beyer et al. [1] observes that the consistency between the teacher and the student is critical for a successful distillation. From this observation, we ask whether computing the student prediction based on the image masked by itself (thus requiring two forward passes through the student; one full and one masked) leads to a better-performing student model. • Sanity check: Random & Bottom-k patch saliency: Recall that MaskedKD keeps the tokens with the largest patch saliency. As a sanity check that the proposed patch saliency is working as intended, we compare the MaskedKD against two masking mechanisms: random masking, and keeping the tokens with the smallest patch saliency (instead of largest). • Class vs. Patch attention: Recall that the proposed patch saliency only uses the attention score between the class token and patch tokens, and not the scores between patch tokens. We ask whether we can improve the performance by further utilizing inter-patch attentions. To this end, we design an alternative score that takes an average of all inter-patch attention scores (except the class token). 8 Table 5: MaskedKD vs. Alternative masking strategies. We compare the masking criterion of the MaskedKD against four alternative strategies: DINO, Mask Consistency, Random & Bottom-k, and Inter-patch Attention Scores. We use DeiT-S as a teacher and DeiT-Ti as a student, and mask away 50% of all input image patches. The default MaskedKD setting is marked in purple . (a) vs. DINO attention (b) Mask consistency (c) Random & Bottom-k (d) Inter-patch attention select None DINO Student top-1 flops 4.6 74.9 6.9 75.0 2.3 75.1 method Consistent MaskedKD top-1 73.2 75.1 function random top-k bottom-k top-1 74.6 75.1 71.7 top-5 91.3 92.1 80.0 method [cls]-tokens tokens-tokens top-1 75.1 74.6 top-5 92.1 91.9 Table 5 gives the performance of the MaskedKD and the competitors. As shown in Table 5a, DINO- based patch saliency fails to outperform the MaskedKD, despite the fact that it uses extra compute and time to forward the full image through the self-supervised ViT. Table 5b shows that masking the student input image brings a severe degradation in student model accuracy, suggesting that having the student utilizing the full input image is essential. In Table 5c, we find that keeping the patches with the largest patch saliency comfortably outperforms the other two options, with min-k (keeping the patches with smallest saliency) performing the worst. In other words, the proposed patch saliency is well correlated with the performance of the distilled student. In Table 5d, we observe that utilizing the inter-patch attention scores degrades the student performance. 5 Discussion In this work, we highlight the computational overhead of the knowledge distillation procedure, and propose an algorithm that can reduce the computational burden of ViT distillation. In particular, we have introduced MaskedKD, a method that masks out a fraction of input patches given to the teacher ViT model; this cuts down the teacher forward cost dramatically, by allowing us to skip the computations associated with the masked patches. To select the patches to discard, we devise a patch saliency measure which is designed to prevent the teacher from giving supervisions on the image where all the core features (that the student uses for prediction) have been masked away. The proposed patch saliency is computed by re-using the attention score from the student ViT's last multi-head attention module, and thus introduces only a minimal computational overhead. In our experiments, we have applied the proposed MaskedKD to many ViT distillation scenarios, showing that we can reduce the number of patches the teacher sees by 25–50% without any student performance drop. Limitations and future directions. A major limitation of the present work is that the proposed MaskedKD is specialized to the transformer-based models. The main mechanism behind the computa- tion and latency savings is the token reduction, which can only be applied to transformer-like models which process the input as a sequence of tokens. Our masking strategy also exploits the information that have been generated by the attention mechanism of the transformer architecture. Generalizing the current framework to cover a broader range of networks including, e.g., convolutional networks or recurrent neural networks, is an important future research direction. Another big limitation of the current work is that we put our focus on distillation of models trained by supervised learning. Modern large-scale models are typically trained via self-supervised learning, and the knowledge distillation often takes place at this stage. While the core underlying idea of the MaskedKD can be applied to the models trained with self-supervised learning, and MaskedKD can be used to make some distillation-based self-supervised learning algorithms more efficient (as demonstrated in Section 4.3), it is in general unclear how one can combine it with other self- supervision strategies that utilize masking, e.g., masked autoencoders [12]. Lastly, we note that MaskedKD is in need of a mechanism to efficiently find the optimal number of tokens to use for the teacher input. The goal of MaskedKD is to reduce the training computation; if one can reduce the training compute only after multiple trial runs, the advantage of the method becomes unclear. While we empirically find that "50%" may be a working rule-of-thumb for the tasks in the vision domain, the empirical results on the audio data suggest that the optimal fraction may differ from a domain to domain. 9 References [1] L. Beyer, X. Zhai, A. Royer, L. Markeeva, R. Anil, and A. Kolesnikov. Knowledge distillation: A good teacher is patient and consistent. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2022. [2] D. Bolya, C.-Y. Fu, X. Dai, P. Zhang, C. Feichtenhofer, and J. Hoffman. Token merging: Your ViT but faster. arXiv preprint arXiv:2210.09461, 2022. [3] M. Caron, H. Touvron, I. Misra, H. Jégou, J. Mairal, P. Bojanowski, and A. Joulin. Emerging properties in self-supervised vision transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 9650–9660, 2021. [4] H. Chefer, I. Schwartz, and L. Wolf. Optimizing relevance maps of vision transformers improves robustness. In Advances in Neural Information Processing Systems, 2022. [5] M. Dehghani, J. Djolonga, B. Mustafa, P. Padlewski, J. Heek, J. Gilmer, A. Steiner, M. Caron, R. Geirhos, I. Alabdulmohsin, et al. Scaling vision transformers to 22 billion parameters. arXiv preprint arXiv:2302.05442, 2023. [6] J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the Conference of the North Ameri- can Chapter of the Association for Computational Linguistics: Human Language Technologies, 2019. [7] A. Dosovitskiy, L. Beyer, A. Kolesnikov, D. Weissenborn, X. Zhai, T. Unterthiner, M. Dehghani, M. Minderer, G. Heigold, S. Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representations, 2020. [8] Y. Gong, Y.-A. Chung, and J. Glass. AST: Audio spectrogram transformer. In Interspeech, 2021. [9] S. Goyal, A. R. Choudhury, S. M. Raje, V. T. Chakaravarthy, Y. Sabharwal, and A. Verma. PoWER-BERT: Accelerating BERT inference via progressive word-vector elimination. In Proceedings of the International Conference on Machine Learning, 2020. [10] J.-B. Grill, F. Strub, F. Altché, C. Tallec, P. H. Richemond, E. Buchatskaya, C. Doersch, B. A. Pires, Z. D. Guo, M. G. Azar, B. Piot, K. Kavukcuoglu, R. Munos, and M. Valko. Bootstrap your own latent: A new approach to self-supervised learning. In Advances in Neural Information Processing Systems, 2020. [11] Z. Hao, J. Guo, D. Jia, K. Han, Y. Tang, C. Zhang, H. Hu, and Y. Wang. Learning efficient vision transformers via fine-grained manifold distillation. In Advances in Neural Information Processing Systems, 2022. [12] K. He, X. Chen, S. Xie, Y. Li, P. Dollár, and R. Girshick. Masked autoencoders are scalable vision learners. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2022. [13] G. Hinton, O. Vinyals, J. Dean, et al. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015. [14] W. Huang, Z. Peng, L. Dong, F. Wei, J. Jiao, and Q. Ye. Generic-to-specific distillation of masked autoencoders. arXiv preprint arXiv:2302.14771, 2023. [15] Y. Huang, Y. Cheng, A. Bapna, O. Firat, M. X. Chen, D. Chen, H. Lee, J. Ngiam, Q. V. Le, Y. Wu, and Z. Chen. GPipe: Efficient training of giant neural networks using pipeline parallelism. In Advances in Neural Information Processing Systems, 2019. [16] Z. Kong, P. Dong, X. Ma, X. Meng, W. Niu, M. Sun, B. Ren, M. Qin, H. Tang, and Y. Wang. SPViT: Enabling faster vision transformers via soft token pruning. In European Conference on Computer Vision, 2021. [17] Y. Lee, A. S. Chen, F. Tajwar, A. Kumar, H. Yao, P. Liang, and C. Finn. Surgical fine-tuning improves adaptation to distribution shifts. arXiv preprint arXiv:2210.11466, 2022. 10 [18] Y. Li, S. Xu, B. Zhang, X. Cao, P. Gao, and G. Guo. Q-ViT: Accurate and fully quantized low-bit vision transformer. In Advances in Neural Information Processing Systems, 2022. [19] Y. Liang, C. Ge, Z. Tong, Y. Song, J. Wang, and P. Xie. Not all patches are what you need: In International Conference on Expediting vision transformers via token reorganizations. Learning Representations, 2022. [20] D. Marin, J.-H. R. Chang, A. Ranjan, A. Prabhu, M. Rastegari, and O. Tuzel. Token pooling in vision transformers for image classification. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, 2023. [21] L. Meng, H. Li, B.-C. Chen, S. Lan, Z. Wu, Y.-G. Jiang, and S.-N. Lim. AdaViT: Adaptive vision transformers for efficient image recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2022. [22] S.-I. Mirzadeh, M. Farajtabar, A. Li, N. Levine, A. Matsukawa, and H. Ghasemzadeh. Improved knowledge distillation via teacher assistant. In Proceedings of the AAAI Conference on Artificial Intelligence, 2020. [23] N. Park, W. Kim, B. Heo, T. Kim, and S. Yun. What do self-supervised vision transformers learn? arXiv preprint arXiv:2305.00729, 2023. [24] A. Paszke, S. Gross, F. Massa, A. Lerer, J. Bradbury, G. Chanan, T. Killeen, Z. Lin, N. Gimelshein, L. Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. In Advances in Neural Information Processing Systems, 2019. [25] K. J. Piczak. ESC: Dataset for environmental sound classification. In Proceedings of the ACM International Conference on Multimedia, 2015. [26] Y. Rao, W. Zhao, B. Liu, J. Lu, J. Zhou, and C.-J. Hsieh. DynamicViT: Efficient vision transformers with dynamic token sparsification. In Advances in Neural Information Processing Systems, 2021. [27] O. Russakovsky, J. Deng, H. Su, J. Krause, S. Satheesh, S. Ma, Z. Huang, A. Karpathy, A. Khosla, M. Bernstein, A. C. Berg, and F.-F. Li. ImageNet large scale visual recognition challenge. International Journal of Computer Vision, 2015. [28] Z. Shen and E. P. Xing. A fast knowledge distillation framework for visual recognition. In Proceedings of the European Conference on Computer Vision, 2022. [29] A. Steiner, A. Kolesnikov, X. Zhai, R. Wightman, J. Uszkoreit, and L. Beyer. How to train your ViT? data, augmentation, and regularization in vision transformers. Transactions on Machine Learning Research, 2022. [30] H. Touvron, M. Cord, M. Douze, F. Massa, A. Sablayrolles, and H. Jégou. Training data- efficient image transformers & distillation through attention. In Proceedings of the International Conference on Machine Learning, 2021. [31] H. Touvron, M. Cord, A. Sablayrolles, G. Synnaeve, and H. Jégou. Going deeper with image transformers. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2021. [32] H. Touvron, M. Cord, and H. Jégou. Deit III: Revenge of the ViT. In Proceedings of the European Conference on Computer Vision, 2022. [33] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems, 2017. [34] K. Wang, F. Yang, and J. van de Weijer. Attention distillation: Self-supervised vision transformer students need more guidance. In British Machine Vision Conference, 2022. [35] H. Wu, Y. Gao, Y. Zhang, S. Lin, Y. Xie, X. Sun, and K. Li. Self-supervised models are good teaching assistants for vision transformers. In Proceedings of the International Conference on Machine Learning, 2022. 11 [36] K. Wu, J. Zhang, H. Peng, M. Liu, B. Xiao, J. Fu, and L. Yuan. TinyViT: Fast pretraining distillation for small vision transformers. In European Conference on Computer Vision, 2022. [37] H. Yin, A. Vahdat, J. M. Alvarez, A. Mallya, J. Kautz, and P. Molchanov. A-ViT: Adaptive tokens for efficient vision transformer. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2022. [38] S. Yu, T. Chen, J. Shen, H. Yuan, J. Tan, S. Yang, J. Liu, and Z. Wang. Unified visual transformer compression. In International Conference on Learning Representations, 2022. [39] S. Yun, S. J. Oh, B. Heo, D. Han, J. Choe, and S. Chun. Re-labeling ImageNet: From single to multi-labels, from global to localized labels. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2021. [40] X. Zhai, A. Kolesnikov, N. Houlsby, and L. Beyer. Scaling vision transformers. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2022. [41] J. Zhang, H. Peng, K. Wu, M. Liu, B. Xiao, J. Fu, and L. Yuan. MiniViT: Compressing vision transformers with weight multiplexing. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 12145–12154, 2022. 12 A Further Details on the Experimental Setup A.1 Logit Distillation (Table 1) Optimizer and data augmentations. For training student ViTs, we follow the settings of DeiT [30], except for the tiny model; we find that Tiny ViT tends to achieve better accuracy with less data augmentations, similar to [29]. In particular, we only use random resized crops and horizontal flips for tiny model, without RandAugment, mixup and cutmix. For more discussions, see Appendix E. Distillation hyperparameters. For the balancing hyperparameter λ and the temperature scale τ (for logits), we use (1.0, 1) unless other noted otherwise; we have tuned the hyperparameters over the search space {0.1, 1.0, 9.0} × {1, 2, 3, 4}, and observe that (1.0, 1) works well throughout all setups. Similar observations about the hyperparameters have been made in [41, 35, 11]. A.2 ViT Distillation Algorithms (Table 2) For applying MaskedKD on other ViT distillation algorithms (Table 2), we follow the training setups of the original papers. For each method, we additionally note the following details: • Manifold Distillation [11]: While the original paper only uses CaiT as the teacher model, we also experiment with DeiT teachers; we use the same hyperparameters for training with DeiT teachers. • Attention Distillation [34]: As briefly discussed in the main text, we adapt the attention distillation to the supervised learning setup by distilling the attention from all layers (with the same scaling factors), rather than distilling only the last layer. • G2SD [14]: We apply MaskedKD only during the supervised distillation stage of the G2SD. A.3 Audio Experiments (Table 3) We use the official code of AST3 and follow the same training procedure; the model's performance is evaluated by averaging 5 seed validation results. A.4 Self-supervised Training (Table 4) We follow the smaller-scale experimental setup for DINO, available at the official code repository4, where we train for 100 epochs. We also halved the number of GPUs (from 8 to 4) and the per-GPU batch size (from 256 to 128), due to the limitations in the computing resource available. 3https://github.com/YuanGongND/ast 4The "vanilla DINO training" in https://github.com/facebookresearch/dino/ 13 Table 6: Larger-scale experiment with MaskedKD. We distill the knowledge to large-scale students, pre-trained in a self-supervised manner via MAE. Student Teacher Method Acc. (%) Throughput (img/s) Distill. Cost (GFLOPs) - No distillation 85.9 - MAE-ViT-Large Deit3-Huge-1k Deit3-Huge-21k 86.2 Logit +MaskedKD 75% 86.2 +MaskedKD 50% 86.1 Logit 86.5 +MaskedKD 75% 86.5 +MaskedKD 50% 86.3 133 179 (x1.3) 271 (x2.0) 133 179 (x1.3) 271 (x2.0) - No distillation 86.9 - MAE-ViT-Huge Deit3-Huge-21k Logit 87.2 +MaskedKD 75% 87.2 +MaskedKD 50% 87.1 133 179 (x1.3) 271 (x2.0) - 8370 6237 (-25%) 4138 (-51%) 8370 6237 (-25%) 4138 (-51%) - 8370 6237 (-25%) 4138 (-51%) B Large Scale Experiments We additionally validate the performance of MaskedKD on large-scale teacher and student models. Unlike the main experiments, we make the following changes: (1) Due to the limited computing resource, we fine-tune the student model for 50 epochs from a self-supervised checkpoint (trained with MAE [12]), instead of training from scratch. (2) "Huge"-scale model uses 256 image patches of size 14 × 14, unlike the smaller models using 196 patches of size 16 × 16.5 Table 6 gives the experimental results. From the table, we observe that the efficiency benefits of the MaskedKD also take place in large-scale setups. However, we cannot reduce the masking ratio as much as in the smaller-scale models; masking 50% of the patches usually result in a slight performance degradation. We hypothesize that this is because the student model have sufficient capacity to learn utilizing all patches of the image (including context/background information), unlike smaller models. 5We use the interpolated patch saliency for mask selection. See Appendix C for more details. 14 Table 7: MaskedKD with teachers that take higher-resolution images. We validate the effective- ness of MaskedKD with the teacher model that takes in higher-resolution images as inputs. Teacher models are trained with 384 × 384 resolution images. Student Teacher Method Acc. (%) Distill. Cost (GFLOPs) DeiT3-S @ 384 DeiT-Ti DeiT3-S @ 224 74.9 Logit +MaskedKD 75% 75.3 +MaskedKD 50% 74.9 +MaskedKD 34% 74.6 74.9 Logit +MaskedKD 50% 75.1 +MaskedKD 25% 74.8 4655 3333 (-28%) 2127 (-54%) 1416 (-70%) 1382 676 (-51%) 343 (-75%) C Teachers trained with Higher-Resolution Images One of the key factors that govern the inference compute of a model is the input resolution. While the models that are trained on higher-resolution images tend to work better [32], the models tend to require much higher computational cost. We ask whether the proposed MaskedKD can be used to distill the knowledge from the teachers that are trained on higher-resolution images, without inducing an excessive overhead in the training cost. To this end, we consider the following MaskedKD pipeline for distilling from the ViT teachers that takes a higher-dimensional input.6 More specifically, we consider distilling ViTs trained with 384 × 384 images, which are processed by dividing into total 576 patches of size 16 × 16. (1) Given a low-resolution image, forward the image through the student model to get the predictions and the mean attention scores for the patches; here, if we use 224 × 224 input image, then we get 196 scores. (2) Interpolate the mean attention scores to generate the scores for larger number of patches (e.g., 576 patches). We use bilinear interpolation for our experiment. (3) Interpolate the input image to generate a high-resolution image, and mask the image with the interpolated mean attention scores computed in the previous step. (4) Forward the masked image through the teacher model and use the prediction to regularize the student training. We give the experimental results in Table 7. Here, we observe that one can successfully distill the knowledge from a teacher trained with higher-resolution images. Also, we observe that MaskedKD successfully reduces the computational burden for distillation, without any performance drop. We note, however, that we did not count the FLOPs that are required for the interpolation procedures in step (2,3). Also, the forward FLOPs for the teacher trained with higher resolution images are too big, so that the performance of the MaskedKD-distilled model does not match the performance of the model distilled using vanilla KD + low-resolution teacher that has a similar training FLOPs. 6We note that, up to our knowledge, this is the first attempt distilling a high-resolution teacher to a low- resolution student. 15 Table 8: MaskedKD for distilling only the linear classifiers. We apply MaskedKD to a scenario where we only fine-tune the linear classifier of the student, whose (frozen) feature map has been pre-trained with self-supervision. Student Teacher Method Acc. (%) Distill. Cost (GFLOPs) - No distillation DINO-ViT-S DeiT-B DeiT3-L Logit +MaskedKD 75% +MaskedKD 50% Logit +MaskedKD 75% +MaskedKD 50% - No distillation DINO-ViT-B DeiT-B DeiT3-L Logit +MaskedKD 75% +MaskedKD 50% Logit +MaskedKD 75% +MaskedKD 50% 76.9 77.5 77.5 77.5 77.5 77.6 77.5 77.9 78.1 78.1 78.1 78.2 78.3 78.2 - 1758 1283 (-27%) 871 (-49%) 6160 4501 (-27%) 3055 (-50%) - 1758 1283 (-27%) 871 (-49%) 6160 4501 (-27%) 3055 (-50%) D MaskedKD for distilling linear classifiers of self-supervised models We also consider the scenario where we distill the knowledge of a supervisedly trained teacher to a student whose feature map has been pre-trained with a self-supervised learning scheme and frozen; during the distillation, we only fine-tune the linear classifier of the student. In such scenario, reducing the teacher computation gains even greater importance, as the computational cost for the student backward is greatly diminished. Previous studies on knowledge distillation primarily focuses on cases where the entire model is fine-tuned. However, several recent studies show that fine-tuning the entire model may be suboptimal in some cases [17, 23]. Table 8 provides the experimental results. We observe that KD still provides performance boost under this setup, and the efficiency gain of MaskedKD takes place again. One interesting observation is that using a large teacher (DeiT3-L) for a relatively much smaller student (ViT-S) does not degrade the performance in this case, unlike in the typical case where we fine-tune all layers of the student model. 16 Table 9: Flexibility in data augmentation. Our method overcomes FastKD's limitation, i.e., being restricted to simple data augmentations, resulting in an improved student model performance. "Simple" refers to applying basic augmentations: random resized crop and horizontal flip. "Hard" means additionally performing RandAugment, mixup and cutmix. Student Augmentation Teacher Method Acc. (%) Distill. Cost (GFLOPs) DeiT-S Simple Hard - No distillation 71.3 - DeiT-B Logit 79.7 +MaskedKD 50% 80.2 5274 2614 (-50%) - No distillation 79.9 - DeiT-B Logit 80.8 +MaskedKD 50% 80.9 5274 2614 (-50%) E MaskedKD and Data Augmentations One of the key advantages of the MaskedKD comparing with the FastKD [28] is that MaskedKD can be applied to distillation scenarios where we use heavy data augmentation schemes. As FastKD requires pre-computing and storing the teacher predictions for all augmented samples, computational benefits of the FastKD may be greatly undermined by considering heavier and more diverse augmen- tations. In this section, we perform a basic sanity check that (1) such heavy data augmentations are indeed useful in KD scenarios,7 and (2) MaskedKD works well with heavy augmentations. Table 9 gives the experimental results. We find that, even for relatively small-scale student models such as DeiT-S, the data augmentation greatly boost the model performance. For undistilled students, the gain can be as large as 8.6%p. For the models trained with basic logit distillation, the gain is 1.1%p. We also observe that MaskedKD preserves the student model accuracy with both light and heavy data augmentations. 7Under non-KD contexts, Steiner et al. [29] makes a similar observation. 17 Figure 4: Right : Training time breakdown of MaskedKD. (Top): In vanilla KD, the student and teacher forwards can be processed in parallel. (Middle): In MaskedKD, the teacher forward may wait until the student forward ends, and yet, the teacher forward can be reduced a lot. (Bottom): Pipeline parallelism allows MaskedKD to efficiently utilize multiple GPUs. F Pipelining MaskedKD To apply the MaskedKD, we need to compute the patch saliency before the teacher inference stage. As the saliency score is computed at the last layer of the student, the teacher forward cannot begin until the student forward is completed. Thus, a naïve parallelization strategy of running the teacher and the student model on two seperate GPUs may be somewhat less effective than in the vanilla knowledge distillation (Fig. 4, top). However, this does not imply that (1) there is no speedup, or (2) there is no effective parallelization strategy. First, we note that the teacher forward is usually the key bottleneck in knowledge distillation, often taking much longer than the student forward. MaskedKD dramatically reduces the time for teacher forward, so that the MaskedKD running the student and teacher forward in series can be faster than the teacher forward of the vanilla KD in some cases (Fig. 4, middle). Second, when using multiple GPUs, we can use pipelining to fill up the bubbles, as in GPipe [15]. More specifically, one can divide each training data batch into smaller mini-batches and make forward inferences on them sequentially. This division allows the teacher GPU to access the data before the student forward completes on all mini-batches (Fig. 4, bottom). 18 G Large Teacher with More Masking vs. Small Teacher with Less Masking Figure 5: Differences of the MaskedKD results by Model Size. We compare two teachers: DeiT-S and DeiT3-B. The colored dashed lines denote the accuracy of the teacher model. The performance of the teacher model is depicted by the dashed line, indicating its level of performance (Right). The line with dots represents the performance of the distilled student model performance (Left). Masking the teacher input gives a new way to trade the student performance for the training efficiency, in addition to changing the model size. In this section, we compare the performance-efficiency tradeoff curve of two different-sized teacher models. In particular, we examine whether a larger teacher that uses less patch can give a more cost-efficient guidance than a smaller teacher that uses more patches. For this purpose, we compare the performance of the DeiT-Tiny students trained with DeiT-S and DeiT3-B teachers that use varying fraction of patches (Fig. 5). We observe that masking does not give a dramatic change to the answer to the question "which teacher is most cost-efficient?" DeiT-S teacher dominates DeiT3-B teacher at all per-iteration FLOPs level. 19 DeiT-SDeiT3-BStudent Accuracy (%)72.573.073.574.074.575.0Teacher Accuracy (%)8081828384FLOPs (G)02468101214161820 H Implementation The following is the pseudo code of our "MaskedKD Engine" in PyTorch [24]: def maskedkd_engine ( image , labels , student , teacher , num_keep ) : ''' num_keep : the int number of patches to keep . ''' output , attn = student ( image ) len_keep = torch . topk ( attn . mean ( dim = 1 ) [ : ,0 , 1 : ] , num_keep ) . indices def teacher_inference ( image , teacher , len_keep ) : x = teacher . patch_embed ( image ) B , _ , D = x . shape # batch , length , dim cls_tokens = teacher . cls_token . expand (B , -1 , - 1 ) x = torch . cat (( cls_tokens , x ) , dim = 1 ) x = x + teacher . pos_embed cls_save = x [ : , 0 , : ] . unsqueeze ( dim = 1 ) x = x [ : , 1 : , : ] index = len_keep . unsqueeze ( - 1 ) . repeat (1 , 1 , D ) x = torch . gather (x , dim =1 , index = index ) x = torch . cat (( cls_save , x ) , dim = 1 ) for blk in teacher . blocks : x = blk ( x ) x = teacher . norm ( x ) output = teacher . head ( x ) return output t_output = teac her_infer ence ( image , teacher , len_keep ) loss = CE ( output , labels ) + KL_DIV ( output , t_output ) return loss This returns the loss. By simply adding the patch selection stage, we can greatly improve efficiency and achieve substantial gains. 20 I FLOPs of a Transformer Block Table 10: Analyzing Computational Cost. We examine how the computational cost varies when ap- plying MaskedKD. The arrow symbol represents the difference in FLOPs when utilizing MaskedKD. Layer Complexity Softmax-Attention Projections MLP Total O(LN 2M ) O(LN M 2) O(LN M 2) Computation (GFLOPs) DeiT-S @ 384 DeiT-B DeiT-S 3.1 → 0.8 0.7 → 0.2 0.4 → 0.1 4.1 → 2.0 5.6 → 2.8 1.4 → 0.7 8.2 → 4.1 11.2 → 5.6 2.8 → 1.4 O(LN M (M + N )) 15.3 → 6.9 17.5 → 8.6 4.5 → 2.2 We analyze the FLOPs of Vision Transformer (ViT) in this section. ViT is encoder-only transformer [33], which is mainly consisted of a multi-head self-attention layers and a multi-layer perceptron layers. There are also many details which takes very tiny portion in terms of calculation, such as the embedding layer, residual connection, bias, GeLU, or layer normalization and we will ignore it in this section. We denote φ(n, d) as a function of FLOPs with respect to the number of tokens n and the embedding dimension d. For example, in case of DeiT-B, n is 197 and d is 768. For self-attention layer, the FLOPs mainly comes from two parts: (1) The projection of Q,K,V matrices and the self-attention outputs φproj(n, d) = 4nd2, (2) The calculation of the softmax-attention φSA(n, d) = 2n2d. The FLOPs of MLP layers comes from two fully-connected (FC) layers. Two FC layers have a difference of four times in dimension. Therefore, the FLOPs for MLP layer is φFC(n, d) = 8nd2. By combining the self-attention layer and the MLP layer, we can get the total FLOPs of one ViT block. φBLK(n, d) = φproj(n, d) + φFC(n, d) + φSA(n, d) = 4nd2 + 2n2d + 8nd2 = 12nd2. (3) Since there is 12 layers in case of DeiT-Base, the total FLOPs is 12 ∗ φBLK(n, d) = 12 ∗ (12nd2 + 2n2d) = 144nd2 + 24n2d. (4) 21
http://arxiv.org/abs/2302.10493v1
2023-02-21T07:46:08
2023-02-21T07:46:08
Weather2K: A Multivariate Spatio-Temporal Benchmark Dataset for Meteorological Forecasting Based on Real-Time Observation Data from Ground Weather Stations
Weather forecasting is one of the cornerstones of meteorological work. In this paper, we present a new benchmark dataset named Weather2K, which aims to make up for the deficiencies of existing weather forecasting datasets in terms of real-time, reliability, and diversity, as well as the key bottleneck of data quality. To be specific, our Weather2K is featured from the following aspects: 1) Reliable and real-time data. The data is hourly collected from 2,130 ground weather stations covering an area of 6 million square kilometers. 2) Multivariate meteorological variables. 20 meteorological factors and 3 constants for position information are provided with a length of 40,896 time steps. 3) Applicable to diverse tasks. We conduct a set of baseline tests on time series forecasting and spatio-temporal forecasting. To the best of our knowledge, our Weather2K is the first attempt to tackle weather forecasting task by taking full advantage of the strengths of observation data from ground weather stations. Based on Weather2K, we further propose Meteorological Factors based Multi-Graph Convolution Network (MFMGCN), which can effectively construct the intrinsic correlation among geographic locations based on meteorological factors. Sufficient experiments show that MFMGCN improves both the forecasting performance and temporal robustness. We hope our Weather2K can significantly motivate researchers to develop efficient and accurate algorithms to advance the task of weather forecasting. The dataset can be available at https://github.com/bycnfz/weather2k/.
[ "Xun Zhu", "Yutong Xiong", "Ming Wu", "Gaozhen Nie", "Bin Zhang", "Ziheng Yang" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10493v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10493v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.NA", "math.NA", "physics.ao-ph" ]
Weather2K: A Multivariate Spatio-Temporal Benchmark Dataset for Meteorological Forecasting Based on Real-Time Observation Data from Ground Weather Stations 3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 3 9 4 0 1 . 2 0 3 2 : v i X r a Xun Zhu1, † Yutong Xiong1, † Ming Wu1, ‡ Gaozhen Nie2 Bin Zhang1 Ziheng Yang1 1Beijing University of Posts and Telecommunications, China 2National Meteorological Center, China Meteorological Administration, China Abstract 1 INTRODUCTION Weather forecasting is one of the cornerstones of meteorological work. In this paper, we present a new benchmark dataset named Weather2K, which aims to make up for the deficiencies of existing weather forecasting datasets in terms of real-time, reliability, and diversity, as well as the key bottleneck of data quality. To be specific, our Weather2K is featured from the following as- pects: 1) Reliable and real-time data. The data is hourly collected from 2,130 ground weather sta- tions covering an area of 6 million square kilo- meters. 2) Multivariate meteorological variables. 20 meteorological factors and 3 constants for po- sition information are provided with a length of 40,896 time steps. 3) Applicable to diverse tasks. We conduct a set of baseline tests on time series forecasting and spatio-temporal forecasting. To the best of our knowledge, our Weather2K is the first attempt to tackle weather forecasting task by taking full advantage of the strengths of observa- tion data from ground weather stations. Based on Weather2K, we further propose Meteorological Factors based Multi-Graph Convolution Network (MFMGCN), which can effectively construct the intrinsic correlation among geographic locations based on meteorological factors. Sufficient ex- periments show that MFMGCN improves both the forecasting performance and temporal ro- bustness. We hope our Weather2K can signifi- cantly motivate researchers to develop efficient and accurate algorithms to advance the task of weather forecasting. The dataset can be available at https://github.com/bycnfz/weather2k/. Proceedings of the 26th International Conference on Artificial Intelligence and Statistics (AISTATS) 2023, Valencia, Spain. PMLR: Volume 206. Copyright 2023 by the author(s). † Equal contribution. ‡ Corresponding author: [email protected] The changing weather has been profoundly affecting peo- ple's lives since the beginning of mankind. Weather con- ditions play a crucial role in production and economic in- dustries such as transportation, tourism, agriculture and en- ergy. Therefore, reliable and efficient weather forecasting is of great economic, scientific and social significance. The weather forecasting task deserves extensive attention. Meteorological factors, such as temperature, humidity, vis- ibility, and precipitation, can provide strong support and historical information for researchers to analyze the vari- ation tendency of weather. For the past few decades, Nu- merical Weather Prediction (NWP) is the widely used tra- ditional method, which utilizes physical models to simulate and predict meteorological dynamics in the atmosphere or on the Earth's surface (M ̈uller and Scheichl, 2014). How- ever, the prediction of NWP may not be accurate enough due to the uncertainty of the initial conditions of the dif- ferential equation (Tolstykh and Frolov, 2005), especially in complex atmospheric processes. In addition, NWP has high requirements on computing power. In recent years, meteorological researchers have achieved considerable breakthroughs and successes in introducing data-driven approaches, most prominently deep learning methods, to the task of weather forecasting. Data-driven approaches exploit the historical meteorological observa- tion data aggregated over years to model patterns to learn the input-output mapping. In the task of time series fore- casting, Transformers have shown great modeling ability for long-term dependencies and interactions in sequential data benefiting from the self-attention mechanism. In the more challenging task of spatio-temporal forecasting, the classical Convolutional Neural Networks (CNNs) which work well on regular grid data in Euclidean domain have been greatly challenged to handle this problem due to the ir- regular sampling of most spatio-temporal data. The Graph Neural Networks (GNNs), which have already been exten- sively applied to traffic forecasting, yield effective and ef- ficient performance by properly treating the variables and Weather2K: A Multivariate Spatio-Temporal Benchmark Dataset for Meteorological Forecasting the connections among them as graph nodes and edges, re- spectively. However, studies focusing on the field of mete- orology are relatively scarce, while the demand for weather forecasting is increasing dramatically. For data-centric deep learning method, the performance of the model heavily depends on the quality of the avail- able training data. High-quality benchmark datasets can serve as "catalysts" for quantitative comparison between different algorithms and promote constructive competition (Ebert-Uphoff et al., 2017). In the field of meteorologi- cal science, reanalysis dataset cannot ensure the authentic- ity of the data. Remote sensing dataset cannot reliably re- flect complexities of near-surface weather conditions. Fu- sion dataset cannot guarantee real-time performance. In- adequacies of existing datasets also include diversity of meteorological factors and applicable tasks. In this work, we present a new benchmark dataset named Weather2K, aiming at advancing the progress on weather forecasting tasks based on deep learning methods. As far as we know, our Weather2K is the first attempt to tackle the challeng- ing weather forecasting task by entirely using the observa- tion data from the ground weather stations. Concretely, our Weather2K has the following characteristics: Reliable and Real-time Data The raw data is built on the one-hourly observation data of 2,130 ground weather stations from the China Meteorological Administration (CMA), which can be updated hourly in real-time. We have spent considerable time on data processing to ensure con- tinuous temporal coverage and consistent data quality. Multivariate Meteorological Variables Based on meteo- rological consideration, 20 important near-surface meteo- rological factors and 3 time-invariant constants for position information are provided in the Weather2K. Applicable to Diverse Tasks We provide two versions of Weather2K for different application directions: time series forecasting and spatio-temporal forecasting. Well-arranged spatio-temporal sequences can be easily selected and ac- cessed for different tasks of weather forecasting. As a benchmark, we conduct a set of baseline tests on two application directions to validate the performance of our Weather2K. 4 representative transformer-based mod- els and 8 state-of-the-art spatio-temporal GNN models are set up for comparison in time series forecasting and spatio- temporal forecasting, respectively. We further propose Me- teorological Factors based Multi-Graph Convolution Net- work (MFMGCN). Considering utilizing multivariate me- teorological information, MFMGCN fuses 4 static graphs representing different types of spatio-temporal informa- tion and 1 dynamic graph to model correlations among geographic locations, and also uses a complete convolu- tional structure followed time-space consistency. We val- idate both the improvement and temporal robustness of MFMGCN on Weather2K through extensive experiments. We hope our Weather2K can significantly motivate more researchers to develop efficient and accurate algorithms and help ease future research in weather forecasting task. 2 PREVIOUS WORK 2.1 Meteorological Science Datasets There are many types and sources of data commonly used in the meteorological science community. Tropical Rain- fall Measuring Mission (TRMM) precipitation rate dataset (Kummerow et al., 2000) and the Integrated Multi-satellite Retrievals for GPM (IMERG) (Huffman et al., 2015) are developed on remote sensing data from satellites. Multi- Source Weighted-Ensemble Precipitation (MSWEP) (Beck et al., 2017) merges satellite and reanalysis data. The ERA5 (Hersbach et al., 2020) is the most advanced global reanal- ysis product created by the European Center for Medium Weather Forecasting (ECMWF). The Global Land Data Assimilation System (GLDAS) (Rodell et al., 2004) and the Canadian Land Data Assimilation System (CaLDAS) (Carrera et al., 2015) are well-known gridded datasets at global and regional scales, respectively. It is worth not- ing that the China Meteorological Forcing Dataset (CMFD) (He et al., 2020) is the first gridded near-surface meteoro- logical dataset with high spatio-temporal resolution. Dif- ferently, our Weather2K is the first truly meaningful mete- orological science dataset entirely based on the observation data from ground weather stations in China. 2.2 Weather Forecasting Datasets In the task of weather forecasting, different datasets are constructed in various ways. And the number of involved meteorological factors varies widely. ExtremeWeather (Racah et al., 2017) is an image dataset for detection, lo- calization, and understanding of extreme weather events. CloudCast (Nielsen et al., 2021) is a satellite-based im- age dataset for forecasting 10 different cloud types. Jena Climate (https://www.bgc-jena.mpg.de/wetter/) is made up of 14 meteorological factors recorded over several years at the weather station of the Max Planck Institute for Biogeo- chemistry. Climate Change (http://berkeleyearth.org/data/) provided by the Berkeley Earth focuses on global land and ocean temperature data. WeatherBench (Rasp et al., 2020) is a benchmark dataset for data-driven medium- range weather forecasting, specifically 3–5 days. Notably, our Weather2K is a spatio-temporal dataset with 20 op- tional multivariate meteorological factors, which can be ap- plied to different directions of weather forecasting. 2.3 Transformers in Time Series Forecasting Due to the special characteristics of time series forecast- ing task, the innovation of Transformer (Vaswani et al., Xun Zhu1, † Yutong Xiong1, † Ming Wu1, ‡ Gaozhen Nie2 Bin Zhang1 Ziheng Yang1 Table 1: Definitions and physical descriptions of the variables in the Weather2K dataset. Long Name Latitude Longitude Altitude Air pressure Water vapor pressure Air Temperature Maximum / Minimum temperature Dewpoint temperature Land surface temperature Relative humidity Wind speed Maximum wind speed Wind direction Maximum wind direction Vertical visibility Horizontal visibility in 1 min / 10 min Precipitation in 1h / 3h / 6h / 12h / 24h Short Name Unit Physical Description lat lon alt ap wvp t mxt / mnt dt st rh ws mws wd mwd vv hv1 / hv2 p1 / p2 / p3 / p4 / p5 (°) (°) (m) hpa hpa (°C) (°C) (°C) (°C) (%) (ms−1) (ms−1) (°) (°) (m) (m) (mm) The latitude of the ground observation station The longitude of the ground observation station The altitude of the air pressure sensor Instantaneous atmospheric pressure at 2 meters above the ground Instantaneous partial pressure of water vapor in the air Instantaneous temperature of the air at 2.5 meters above the ground where sheltered from direct solar radiation Maximum / Minimum air temperature in the last one hour Instantaneous temperature at which the water vapor saturates and begins to condense Instantaneous temperature of bare soil at the ground surface Instantaneous humidity relative to saturation at 2.5 meters above the ground The average speed of the wind at 10 meters above the ground in a 10-minute period Maximum wind speed in the last one hour The direction of the wind speed. (Wind direction is 0 if wind speed is less than or equal to 0.2) Maximum wind speed's direction in the last one hour Instantaneous vertical visibility 1 / 10 minute(s) mean horizontal visibility at 2.8 meters above the ground Cumulative precipitation in the last 1 / 3 / 6 / 12 / 24 hour(s) 2017) and its variants based on the self-attention mecha- nism shows great capability in sequential data. MetNet (Sønderby et al., 2020) uses axial self-attention to aggre- gate the global context from radar and satellite data for pre- cipitation forecasting. LogTrans (Li et al., 2019b) and Re- former (Kitaev et al., 2020) propose the LogSparse atten- tion and the local-sensitive hashing attention to reduce the complexity of both memory and time, respectively. AST (Wu et al., 2020a) utilizes a generative adversarial encoder- decoder pipeline. Autoformer (Wu et al., 2021) proposes a seasonal-trend decomposition architecture with an auto- correlation mechanism. Informer (Zhou et al., 2021) uti- lizes Kullback-Leibler divergence based the ProbSparse attention. Pyraformer (Liu et al., 2021) captures differ- ent ranges of temporal dependencies in a compact, multi- resolution fashion. FEDformer (Zhou et al., 2022) uses Fourier transform and wavelet transform to consider the characteristics of time series in the frequency domain. 2.4 Spatio-temporal Graph Neural Networks. Spatio-temporal forecasting models are mostly based on GNNs due to their ability to learn representations of spa- tial irregular distributed signals by aggregating or diffus- ing messages from or to neighborhoods. GNNs have al- ready brought a huge boost in traffic forecasting, such as STGCN (Yu et al., 2017), DCRNN (Li et al., 2017), MST- GCN (Guo et al., 2019), ASTGCN (Guo et al., 2019), TGCN (Zhao et al., 2019), AGCRN (Bai et al., 2020), and GMAN (Zheng et al., 2020). Moreover, LRGCN (Li et al., 2019a), 2s-AGCN (Shi et al., 2019) and MPNN (Panagopoulos et al., 2021) highlight the usefulness of GNNs in path failure in a telecommunication network, skeleton-based action recognition and epidemiological pre- diction, respectively. In the field of meteorological science, DeepSphere(Defferrard et al., 2020) introduces a method based on a graph representation of the sampled spheri- cal meteorological data. PM2.5-GNN (Wang et al., 2020) and CLCRN (Lin et al., 2022) are used to predict PM2.5 concentrations and meteorological factors including tem- perature, cloud cover, humidity, and surface wind compo- nent. In general, researches on the application of GNNs to weather forecasting are relatively scarce. 3 THE DATASET OF WEATHER2K The raw data comes from CMA's observation data of China's ground weather stations. Observation instruments and sensors of different weather stations all follow the stan- dard of Specifications for surface meteorological observa- tion-General (GB/T 35221-2017) and Quality control of surface meteorological observation data (QX/T 118-2010). While collecting the original data, basic quality control (QC) technologies are first used for different meteorolog- ical factors to correct for sensor noise, bias, and external factors. Focusing on missing values, defaults, outliers, we performed rigorous filtering and processing to ensure the quality of our dataset. The main steps of our data process- ing procedure are provided in Supplementary Material C.1. 3.1 Dataset Statistics Weather2K contains the observation data from 2,130 ground weather stations throughout China, covering an area of more than 6 million square kilometers. The data are available from January 2017 to August 2021 with a tem- poral resolution of 1 hour, in which we can ensure the use of unified meteorological observation instruments and sen- sors for data collection. All stations use CST time (UTC + 8h). Based on the consideration of building a representative and comprehensive dataset for meteorological forecasting, Weather2K contains 3 time-invariant constants: latitude, longitude, and altitude to provide position information and 20 important meteorological factors with a length of 40,896 time steps. The definitions and physical descriptions of the chosen variables are listed in Table 1. The current Weather2K: A Multivariate Spatio-Temporal Benchmark Dataset for Meteorological Forecasting In terms of meteorological factors, our Weather2K pro- vides a total number of 20 optional variables. By contrast, Climate Change (http://berkeleyearth.org/data/) focuses on meteorological factors related to temperature. CMFD (He et al., 2020) provides 7 near-surface meteorological fac- tors. WeatherBench (Rasp et al., 2020) contains 14 me- teorological factors, 8 of which have multiple vertical lev- els. Moreover, our Weather2K can be applied to weather forecasting tasks in different directions. Weather2K-S and Weather2K-R are designed for the task of time series fore- casting and spatio-temporal forecasting, respectively, while existing datasets mainly focus on solving a single task. Figure 1: The distribution of the 2,130 ground weather sta- tions that supply observation data for Weather2K. 4 APPLICATIONS version of our open source Weather2K is Weather2K-R, which contains 1866 ground weather stations and is stored in Numpy format. Weather2K-N, which contains the rest of the stations, is temporarily reserved for confidentiality reasons. In addition, we further provide a special version of the Weather2K (Weather2K-S), which contains 15 rep- resentative ground weather stations distributed in different regions and is stored in CSV format files. As shown in Fig- ure 1, the red stars, blue squares, and black squares repre- sent the stations that make up Weather2K-S, Weather2K-R, and Weather2K-N, respectively. See more detailed statis- tics on Weather2K in Supplementary Material C.2. 3.2 Comparison with Other Datasets Our Weather2K is a novel attempt to solve the task of weather forecasting by entirely using the observation data from the ground weather stations. Although CMFD (He et al., 2020) also uses approximately 700 stations of CMA as its primary data source, it must incorporate several grid- ded datasets from remote sensing and reanalysis. Jena Cli- mate (https://www.bgc-jena.mpg.de/wetter/) only records the data of 1 weather station in Jena, Germany. Most of the existing multivariate datasets cover a long time range. For example, CMFD (He et al., 2020) and Weath- erBench (Rasp et al., 2020) are both from 1979 to 2018. Limited by the purpose of data collection using unified meteorological observation instruments and sensors, our Weather2K begins in January 2017 and is ongoing. The most attractive advantage of our Weather2K is the real- time and reliability of the data. The combination of high precision sensor and high-quality data control ensures the accuracy of the data to the greatest extent. The efficient and practical data processing can obtain hourly real-time data. In comparison, CMFD (He et al., 2020), ERA5 (Hersbach et al., 2020), and WeatherBench (Rasp et al., 2020) have a latency of at least 3 months because they are limited by the release time of the raw data. In this section, we mainly introduce the application of the Weather2K in two important directions of weather fore- casting, namely time series forecasting and spatio-temporal forecasting. For the convenience of expression, the temper- ature, visibility, and humidity mentioned in section 4 and section 5 refer to air temperature, horizontal visibility in 10 min, and relative humidity, respectively. These 3 meteoro- logical factors are also selected as our forecasting targets. See more details about baseline models and implementa- tion in Supplementary Material D.1 and D.2, respectively. 4.1 Time Series Forecasting Weather2K-S is the special version of Weather2K designed for the task of time series forecasting, which contains 15 representative and geographically diverse ground weather stations distributed throughout China. We conduct three types of experiments on Weather2K-S: univariate forecast- ing, multivariate forecasting, and multivariate to univariate forecasting. 4 representative transformer-based baselines are set up for comparison, i.e., Transformer (Vaswani et al., 2017), Reformer (Kitaev et al., 2020), Informer (Zhou et al., 2021), and Autoformer (Wu et al., 2021). In meteo- rological science, short-term, medium-term, and long-term forecasting can be divided into 0-3 days, 3-15 days, and more than 15 days, respectively. For better comparison, we set the prediction time lengths for both training and evalua- tion to 24 (1 day), 72 (3 days), 168 (7 days), 336 (14 days), and 720 (30 days) steps, while the input time length is fixed to 72 (3 days) steps. We evaluate the performance of pre- dictive models by two widely used metrics, including Mean Square Error (MSE) and Mean Absolute Error (MAE). Table 2 shows the forecasting performance of temperature, visibility, and humidity under different baselines and pre- diction lengths. In univariate forecasting and multivariate forecasting, both the input and output are the single and multiple meteorological factors we specify, respectively. By comparison, we can intuitively find that multivariate forecasting is more complex than univariate forecasting. Meteorological forecasting becomes more challenging as 55°N50°N45°N40°N35°N30°N25°N20°N80°E90°E100°E110°E120°E130°EWeather2K-SWeather2K-RWeather2K-N Xun Zhu1, † Yutong Xiong1, † Ming Wu1, ‡ Gaozhen Nie2 Bin Zhang1 Ziheng Yang1 Table 2: Univariate results and multivariate results under different baselines with different prediction lengths of 24, 72, 168, 336, and 720 steps. The input time length is 72 steps. The reported results of mean and standard deviation are obtained through experiments under 15 different ground weather stations in Weather2K-S. Results with bold and underlines are the best and worst performance achieved by baselines, respectively. Models Transformer Reformer Informer Autoformer Factors Metrics MSE MAE MSE MAE MSE MAE MSE MAE Temperature Visibility Humidity Multivariate 24 72 168 336 720 24 72 168 336 720 24 72 168 336 720 24 72 168 336 720 0.0740±0.0214 0.1246±0.0396 0.1560±0.0513 0.1709±0.0635 0.1603±0.0671 0.7105±0.1155 0.8722±0.1945 0.9153±0.1969 0.9952±0.2766 0.9963±0.2570 0.3746±0.0820 0.5228±0.1310 0.5935±0.1533 0.6107±0.1643 0.6177±0.1638 0.7134±0.1796 0.8143±0.2071 0.8462±0.2076 0.8507±0.2044 0.8967±0.2308 0.2000±0.0284 0.2656±0.0440 0.2999±0.0502 0.3148±0.0587 0.3058±0.0630 0.6536±0.1151 0.7475±0.1487 0.7802±0.1439 0.8059±0.1855 0.8090±0.1755 0.4607±0.0548 0.5603±0.0782 0.6004±0.0814 0.6142±0.0815 0.6146±0.0833 0.4597±0.0418 0.5179±0.0469 0.5261±0.0430 0.5450±0.0396 0.5543±0.0446 0.0897±0.0241 0.1294±0.0393 0.1431±0.0528 0.1451±0.0562 0.1481±0.0532 0.6623±0.1108 0.8304±0.1843 0.9083±0.2380 0.9219±0.2713 0.9506±0.2853 0.3618±0.0725 0.4932±0.1074 0.5421±0.1254 0.5761±0.1456 0.5864±0.1399 0.6342±0.1700 0.7616±0.1877 0.8029±0.1979 0.8251±0.2057 0.8501±0.2279 0.2306±0.0289 0.2797±0.0400 0.2926±0.0529 0.2947±0.0576 0.2968±0.0544 0.6288±0.1175 0.7440±0.1526 0.7795±0.1441 0.7810±0.1706 0.7946±0.1763 0.4529±0.0438 0.5455±0.0621 0.5759±0.0688 0.5938±0.0749 0.6009±0.0737 0.4177±0.0178 0.4914±0.0330 0.5075±0.0339 0.5173±0.0337 0.5240±0.0335 0.0758±0.0229 0.1272±0.0355 0.1699±0.0529 0.2118±0.0660 0.2119±0.0665 0.7007±0.1198 0.8847±0.2079 0.9428±0.1942 1.0232±0.2336 1.0235±0.2618 0.3749±0.0848 0.5232±0.1234 0.6221±0.1567 0.6965±0.1845 0.7979±0.1538 0.6838±0.1777 0.8142±0.1967 0.8641±0.2004 0.9040±0.2129 0.9242±0.2241 0.2031±0.0299 0.2711±0.0386 0.3162±0.0660 0.3586±0.0508 0.3637±0.0536 0.6390±0.1218 0.7503±0.1400 0.7943±0.1523 0.8388±0.1720 0.8438±0.0789 0.4563±0.0529 0.5619±0.0769 0.6163±0.0884 0.6653±0.1051 0.7285±0.0789 0.4381±0.0338 0.5128±0.0391 0.5543±0.0311 0.5750±0.0307 0.5833±0.0329 0.0978±0.0290 0.1384±0.0474 0.1574±0.0583 0.1655±0.0630 0.2011±0.0602 0.8014±0.1589 0.9350±0.2215 0.9911±0.2273 0.9919±0.2311 1.0651±0.2591 0.4291±0.1058 0.5511±0.1209 0.6111±0.1304 0.6514±0.1567 0.7145±0.1631 0.7525±0.1968 0.8585±0.2132 0.8945±0.2160 0.9298±0.2222 0.9379±0.2553 0.2367±0.0342 0.2832±0.0464 0.3002±0.0544 0.3092±0.0575 0.3453±0.0510 0.6929±0.1013 0.7585±0.1336 0.7834±0.1289 0.7832±0.1415 0.8145±0.1553 0.4941±0.0625 0.5721±0.0651 0.6042±0.0651 0.6258±0.0737 0.6599±0.0741 0.4868±0.0300 0.5390±0.0314 0.5455±0.0390 0.5575±0.0381 0.5731±0.0432 Table 3: Univariate results with 8 spatio-temporal GNN models in prediction time length of 12 steps on Weather2K-R. The input time length is 12 steps. Results with bold and underlines are the best and worst performance, respectively. Factors Metrics STGCN ASTGCN MSTGCN DCRNN GCGRU Temperature Visibility Humidity MAE RMSE MAE RMSE MAE RMSE 3.1297 4.7154 7.7568 9.0896 9.8479 14.5123 2.6942 3.6383 5.7311 7.5523 12.0332 15.9847 3.6827 4.9195 5.9053 7.8016 14.4780 18.7188 5.0457 6.4070 7.6464 9.0035 16.3467 21.2517 1.8823 2.7491 4.4863 6.8236 7.7008 10.9422 TGCN 2.6429 3.6189 6.0115 8.4893 10.7045 14.3170 A3TGCN CLCRN 2.9372 4.0045 5.7731 7.5974 12.1034 15.9838 1.6498 2.4328 4.1252 6.4660 7.8056 11.1326 the length of the predicted time series increases. On Weather2K-S, Reformer (Kitaev et al., 2020) have the best performance most of the time due to its efficient locality- sensitive hashing attention. The poor performance of Auto- former (Wu et al., 2021) may be that it attempts to construct a series-level connection based on the process similarity de- rived by series periodicity, whereas meteorological data in Weather2K-S change dynamically and irregularly. We further explore to use the multivariate data to forecast the target univariate meteorological factor. However, multi- variate information is underutilized in existing transformer- based time series forecasting baselines. The performance of multivariate to univariate forecasting is provided in Sup- plementary Material D.3. To make the evaluation more complete and informative, we also present the univariate forecasting results of the persistent model and some classi- cal nonparametric methods in Supplementary Material D.4. 4.2 Spatio-Temporal Forecasting Unlike time series forecasting that only targets a single selected ground weather station, spatio-temporal forecast- ing that can cover the entire region is more challenging and meaningful in the meteorological domain due to the highly nonlinear temporal dynamics and complex location- characterized patterns. We conduct experiments for uni- variate forecasting on Weather2K-R. We select 8 state-of- the-art spatio-temporal GNN models as baselines: STGCN (Yu et al., 2017), ASTGCN (Guo et al., 2019), MSTGCN (Guo et al., 2019), DCRNN (Li et al., 2017), GCGRU (Seo et al., 2018), TGCN (Zhao et al., 2019), A3TGCN (Bai et al., 2021), and CLCRN (Lin et al., 2022). We construct a neighbor graph based on distance as one of the GNN mod- els' inputs by utilizing three time-invariant constants that provide position information including latitude, longitude, and altitude. We set both the input time length and predic- tion time length as 12 steps. We evaluate the performance by two commonly used metrics in spatio-temporal forecast- ing, including MAE, Root Mean Square Error (RMSE). Table 3 summarizes the univariate forecasting results of 8 spatio-temporal GNN models based on Weather2K-R. Since most of the compared models are established for the task of traffic forecasting, it is not surprising that they show significant degradation in performance for meteorological Weather2K: A Multivariate Spatio-Temporal Benchmark Dataset for Meteorological Forecasting Figure 2: (a) The overview of Meteorological Factors based Multi-Graph Convolution Network (MFMGCN). (b) The architecture of spatio-temporal block (ST-block). (c) The architecture of the multi-branch temporal convolution. forecasting, such as DCRNN (Li et al., 2017) and MST- GCN (Guo et al., 2019). Moreover, the performance of 8 spatio-temporal GNN models in forecasting different mete- orological factors varies widely. For example, STGCN (Yu et al., 2017) ranks third in humidity forecasting, but worst in visibility forecasting. CLCRN (Lin et al., 2022) achieves the best performance because the conditional local kernel is specifically designed to capture the meteorological lo- cal spatial patterns. In addition, the current GNN baselines focus on the univariate forecasting and do not consider cor- related multiple variables as cooperative inputs, which may have important impacts on weather forecasting. Therefore, there are two urgent problems in the applica- tion of spatio-temporal forecasting in the meteorological domain: (1) A novel and general GNN framework designed specifically for the task of weather forecasting. (2) Make effective use of the multivariate meteorological factors. 5 MFMGCN It is insufficient to simply use distance similarity to rep- resent the correlations among observed data with spatio- temporal attributes (Geng et al., 2019). Modeling with a single graph usually brings unexpected bias, while multi- ple graphs can attenuate and offset the bias. To solve the above problems, we introduce MFMGCN, which combines several static graphs with the dynamic graph to effectively construct the intrinsic correlation among geographic loca- tions based on meteorological factors. The framework of MFMGCN is shown in Figure 2. Through extensive ex- periments and ablation studies, we have demonstrated that MFMGCN achieves considerable forecasting performance gain and shows great robustness in the temporal dimension compared with previous methods on Weather2K-R. network can be represented by a graph G = (V , E, A), where V denotes the set of locations, E is a set of edges indicating the connectivity between the nodes and A ∈ RN ×N is the adjacency matrix. Let X(t) ∈ RN ×D rep- resent the value of meteorological factors in all locations at the t-th interval,where N and D is the number of locations and factors, respectively. The spatio-temporal weather forecasting problem is to learn a function P that maps his- torical W observed signals to the future W signals: (cid:48) (cid:104) X(t−W (cid:48)+1), . . . , X(t); G (cid:105) P−→ (cid:2)X(t+1), . . . , X(t+W ); G(cid:3) (1) (cid:48) We set D = 1 for univariate forecasting in this study. We set W = W = 12, which means both the input time length and forecasting time length are 12 steps. 5.2 Static Graph Construction In this section, we describe in detail 4 static graphs used in MFMGCN that represent different types of correlations among geographic locations, including: (1) The distance graph GD = (V , E, AD). (2) The neighbor graph GN = (V , E, AN ). (3) The pattern similarity graph GP = (V , E, AP ). (4) The learnable graph GL = (V , E, AL). 5.2.1 Distance Graph The distance-based graph describes the topological struc- ture of the ground weather station network. Our distance graph GD is constructed based on the spherical distance of stations' spatial location with thresholded Gaussian kernel (Shuman et al., 2013). The element of distance matrix AD is defined as follows: AD,ij = (cid:40) exp (cid:17) (cid:16) − d2 ij σ2 D , for i (cid:54)= j and exp 0 , otherwise (cid:17) (cid:16) − d2 ij σ2 D ≥ ε (2) 5.1 Problem Setting In this section, we describe the problem setting of the spatio-temporal weather forecasting. The meteorological where dij represents the spherical distance between vi and vj. ε and σ2 D are used to control the sparsity and distribu- tion of AD, respectively. NeighborDistancePatternSimilarityLearnableST-BlockST-Block......X!X!"#X!"$%&X!"$%#Dynamic GraphConstructionMulti-graph Fusion "YYLossSpatial ConvolutionTemporal ConvolutionST-BlockConv1×1Conv1×3Conv1×5ConcatenationSpatio-Temporal InputDynamic GraphFused GraphST-Model......Static GraphsInputOutputGInputOutput(a)(b)(c)FCTemporalConvolutionConv1×1 Xun Zhu1, † Yutong Xiong1, † Ming Wu1, ‡ Gaozhen Nie2 Bin Zhang1 Ziheng Yang1 5.2.2 Neighbor Graph We construct the neighbor graph GN by simply connecting a location to its adjacent NA stations. The element of the neighbor matrix AN is defined as follows: (cid:40) 1 0 , vi and vj are adjacent , otherwise AN,ij = (3) The influence of the selection value of NA is discussed in Supplementary Material D.5. 5.2.3 Pattern Similarity Graph Since distant stations may also have highly consistent mete- orological characteristics, it is essential to establish a graph by mining pattern similarity between nodes based on our multivariate dataset. The element of pattern similarity ma- trix AP is defined as follows: Af P,ij = (cid:16) (cid:80)p i=1 tf i,p−T f i (cid:16) (cid:80)P p=1 (cid:17)(cid:16) tf i,p−T f (cid:17)2(cid:114) i tf j,p−T f (cid:16) j (cid:17) (cid:80)p j=1 tf j,p−T f j   (cid:114)  0 , if i (cid:54)= j (cid:17)2 (4) , otherwise (cid:110) Note that the pattern similarity graph can be constructed using Pearson correlation coefficients (Zhang et al., 2020) based on any meteorological factor f ∈ F , where F de- notes the set of all factors in Weather2K. For a specific fea- ture f , T f describe the time-series sequence of vi used for training, where P is the length of the series, and tf i,p is the time-series data value of the vertex vi at time step p. To model the correlation be- tween any geographic location comprehensively, we build pattern graphs on temperature, visibility, and humidity. i,p, * * * , tf i,2, * * * , tf i,1, tf tf i = i,P (cid:111) 5.2.4 Learnable Graph The meteorological data need not only the accumulation of long time series for historical vertical comparative study, but also the horizontal comparative study of global regions. Despite the above graphs can capture spatial dependencies in detail, the information of the node itself is not suffi- ciently utilized due to the lack of historical level and geo- graphic information which is challenging to predefine. In- spired by Wu et al. (2020b), we propose static node embed- ding E ∈ RD which is learnable to encode meteorological statistics for each node and compute: Mi = tanh (αEiΘ1) Mj = tanh (αEjΘ2) AL,ij = ReLU (tanh (α (Mi * Mj − Mj * Mi))) (5) (6) (7) where Ei and Ej represents randomly initialized node em- beddings of node vi and vj, respectively. Θ1,Θ2 are linear layers and α is a hyper-parameter for controlling the sat- uration rate of the activation function. To make GL more applicable to the meteorological field, each node of GL has more connections with other nodes in different geographic locations, rather than selecting only the top-k closest nodes as its connections. And the edges of GL are not limited to uni-directional because the geographical situation has two- way effects under different conditions. 5.3 Dynamic Graph Construction In this section, the construction of the dynamic graph is presented. A node may have different types and degrees of weather, leading to dynamic changes in the relationship with other nodes. However, it is still hard to model such dy- namic characteristics by static adjacency matrix based on distance or neighbor. Attention mechanism methods make computation and memory grow quadratically with the in- crease of graph size while RNN-based methods are lim- ited by the length of the input sequence. Both of them need to be carefully modified to ensure successful train- ing on Weather2K-R. We dynamically construct a graph GK = (V, E, AK) to model nonlinear spatio-temporal correlations in a efficient way. Note that Xt,i = {xt−W +1,i, * * * , xt−1,i, * * * , xt,i} ∈ RW ×D is an input temporal sequence of vertex vi at time t, where W is the sequence length and D is the number of factors. We then simply flatten the vector to Zi ∈ RW D to represent the characteristics on the input temporal scale. Similar to the way of building the learnable graph, the ele- ment of matrix AK is defined as follows: Di = tanh (βZiW1) Dj = tanh (βZjW2) (8) (9) AK,ij = ReLU (tanh (β (Di * Dj − Dj * Di))) (10) where W1 and W2 are linear layers and β is a hyper- parameter for controlling the saturation rate of the activa- tion function. Different from the learnable graph based on static node embedding, GK is generated dynamically both in the training and inference stages. 5.4 Multi-graph Fusion Since different graphs contain specific spatio-temporal in- formation and make unequal contributions to the forecast- ing result of every single node, it is inappropriate to sim- ply merge them using weighted sum or other averaging approaches in a unified way. Therefore, we use learn- able weights Ws ∈ RN ×N to describe the importance of graph s for each node, where N presents the number of nodes and s ∈ S = {D, N, P, L, K} is one of the pro- posed graphs. Finally, the result of multi-graph fusion is Gf used = (V, E, Af used): Af used = (cid:88) s∈S Ws (cid:12) As (11) where (cid:12) indicates the element-wise Hadamard product. Weather2K: A Multivariate Spatio-Temporal Benchmark Dataset for Meteorological Forecasting 5.5 Spatio-Temporal Graph Neural Network Considering the time-space consistency is important in weather forecasting, we build a model by stacking spatio- temporal blocks (ST-block) which are complete convolu- tional structures. As shown in Figure 2 (b), the ST-block adopts a residual learning framework which consists of a spatial convolution and a temporal convolution in order. Then, a fully-connected output layer is used to generate the final prediction ˆY. 5.5.1 Graph Convolution in Spatial Dimension Following Yu et al. (2017), we adopt the spectral graph con- volution to directly process the signals at each time slice. In spectral graph analysis, taking the weather conditions of factor f at time t as an example, the signal all over the graph is x = xf t ∈ RN , then the signal on the graph G is filtered by a kernel gθ: the convolution layer of each branch has different receptive fields for extracting information at different scales. Infor- mation of different scales is then fused through concatena- tion and a 1x1 convolution layer. 5.5.3 Time-space Consistency The time-space consistency in weather forecasting means that the larger the time scale of the data, the wider the spa- tial range that can be predicted. Inspired by this rule, we balance the span of space and time by setting appropri- ate parameters in ST-blocks. The kernel size K of graph convolution and receptive field in temporal convolution are increased linearly with the stacking of blocks. By doing so, our model can integrate spatio-temporal information or- derly and avoid imbalance between both sides. 5.6 Experiments gθ ∗G x = gθ(L)x = gθ (cid:0)UΛUT (cid:1) x = Ugθ(Λ)UT x (12) 5.6.1 Ablation Study 2 AD− 1 where graph Fourier basis U ∈ RN ×N is the matrix of eigenvectors of the normalized graph Laplacian L = IN − D− 1 2 = UΛUT ∈ RN ×N . Note that IN is an identity matrix and D ∈ RN ×N is the diagonal degree matrix with Dii = ΣjAij (A is the adjacent matrix). Λ ∈ RN ×N is the diagonal matrix of eigenvalues of L and filter gθ(Λ) is also a diagonal matrix. The above formula can be understood as Fourier transforming gθ and x respectively into the spectral domain, and multiplying their transformed results, and doing the inverse Fourier transform to get the output of the graph convolution (Shuman et al., 2013). In practice, Chebyshev polynomials are adopted to solve the efficiency problem of performing the eigenvalue de- composition since the scale of our graph is large (Ham- mond et al., 2011): gθ ∗G x = gθ(L)x = K−1 (cid:88) k=0 θkTk( ̃L)x (13) where Tk( ̃L) ∈ RN ×N is the Chebyshev polynomial of order k evaluated at the scaled Laplacian ̃L = 2L/λmax − IN , and λmax denotes the largest eigenvalue of L. Note that K is the kernel size of graph convolution, which determines the maximum radius of the convolution from central nodes. 5.5.2 Convolution in Temporal Dimension Although RNN-based methods have superiority over CNN- based methods in capturing temporal dependency, the time- consuming problem of recurrent networks is nonnegligible, especially in the field of long-term weather forecasting. In MFMGCN, a multi-branch convolution layer on the time axis is further stacked to model the temporal dynamic be- haviors of meteorological data. As shown in Figure 2 (c), In this section, we conduct ablation studies to show the effects of different fusion selections and discuss whether each graph works as intended in forecasting temperature, visibility, and humidity. We first evaluate the performance of each graph separately. Secondly, we set distance graph GD as the base input, which is the same as baseline models, to verify whether the stack of more graphs (i.e. more infor- mation) leads to better performance. And then we compare the performance of all graphs but one (i.e. 4-graph fusion). Finally, we show the performance of 5-graph fusion. From Table 4, we can conclude that: (1) GD and GN is similar in results because they are both constructed based on location relationships, and it's better to combine the two Table 4: The results of ablation studies. GD GN GP GL GK Temperature Visibility Humidity MAE RMSE MAE RMSE MAE RMSE (cid:34) (cid:34) (cid:34) (cid:34) (cid:34) (cid:34) (cid:34) (cid:34) 1.7190 2.5056 4.2625 6.3809 8.1178 11.6013 1.7420 2.5211 4.2724 6.4342 8.0778 11.6008 2.3651 3.1726 4.8104 6.5291 8.6860 12.2008 (cid:34) 1.5842 2.2753 4.1551 6.1609 7.2361 10.4721 (cid:34) 1.8267 2.5691 4.4877 6.3925 7.9877 11.5218 1.7430 2.5342 4.2403 6.3334 7.9565 11.4717 1.6559 2.3834 4.1486 6.1512 7.7309 11.1712 (cid:34) (cid:34) (cid:34) (cid:34) (cid:34) 1.5540 2.2448 3.9409 6.0163 7.1181 10.3577 (cid:34) (cid:34) (cid:34) 1.5266 2.1925 3.9374 6.0278 7.1326 10.4074 (cid:34) (cid:34) 1.5046 2.1769 3.9361 6.0685 7.2506 10.5775 (cid:34) (cid:34) 1.5893 2.2887 4.4932 6.4680 7.4027 10.7293 (cid:34) (cid:34) 1.5053 2.1677 4.0174 6.0701 7.1858 10.4025 (cid:34) (cid:34) (cid:34) 1.4418 2.0574 3.9277 6.0132 7.1125 10.3512 (cid:34) (cid:34) (cid:34) (cid:34) (cid:34) (cid:34) (cid:34) (cid:34) Xun Zhu1, † Yutong Xiong1, † Ming Wu1, ‡ Gaozhen Nie2 Bin Zhang1 Ziheng Yang1 6 CONCLUSION This paper contributes a new benchmark dataset named Weather2K, which aims to make up for the deficiencies of existing weather forecasting datasets in terms of real-time, reliability, and diversity. The data of Weather2K is hourly collected from 2,130 ground weather stations, which con- tain 20 meteorological factors and 3 constants for posi- tion information. Weather2K is applicable to diverse tasks such as time series forecasting and spatio-temporal fore- casting. As far as we know, Weather2K is the first at- tempt to tackle weather forecasting task by taking full ad- vantage of the strengths of observation data from ground weather stations. Besides, we further propose MFMGCN, a novel and general framework designed specifically for the weather forecasting task, to effectively construct the intrin- sic correlation among geographic locations based on me- teorological factors by combining the static graph and the dynamic graph, which significantly outperforms previous spatio-temporal GNN methods on Weather2K. We hope that the release of Weather2K can provide a foundation for accelerated research in this area and foster collaboration between atmospheric and data scientists. Figure 3: Overall method comparison in forecasting (a) temperature, (b) visibility, and (c) humidity. Acknowledgements graphs to make more efficient use of geographical distribu- tion. (2) Using GP separately yields a quite poor result. However, GP brings a positive influence in multi-graph fu- sion. (3) GL is the optimal single graph, and it also brings considerable performance gain in multi-graph fusion. (4) Using GK separately does not work as well because it lacks the stable correlation provided by the static graph. But it can be complementary to the static graph and brings ex- pected gain. (5) Whether forecasting temperature, visibil- ity, or humidity, the effects of different fusion selections have similar trend on performance, which indicates that the multi-graph method is universal to meteorological factors. 5.6.2 Overall Method Comparison To avoid complicated and verbose plots, we give the com- parison of methods with the overall top three performances on MAE and RMSE: GCGRU (Seo et al., 2018), CLCRN (Lin et al., 2022), and our MFMGCN in Figure 3. With the increase of the forecasting horizon from the first time step to 12 time steps, the gap between MFMGCN and other methods gradually widened. It can be concluded that MFMGCN improves both the forecasting performance and temporal robustness, which is of great significance for real-world practical applications. In addition, MFMGCN achieves the state-of-the-art performance in different me- teorological factors, which further verifies it is a general framework for the task of weather forecasting. This work is partially supported by the MoE-CMCC "Artif- ical Intelligence" Project (Grant No. MCM20190701) and the BUPT innovation and entrepreneurship support pro- gram (Grant No. 2023-YC-A177). References Jiandong Bai, Jiawei Zhu, Yujiao Song, Ling Zhao, Zhix- iang Hou, Ronghua Du, and Haifeng Li. A3t-gcn: At- tention temporal graph convolutional network for traf- ISPRS International Journal of Geo- fic forecasting. Information, 10(7):485, 2021. Lei Bai, Lina Yao, Can Li, Xianzhi Wang, and Can Wang. Adaptive graph convolutional recurrent network for traf- fic forecasting. Advances in neural information process- ing systems, 33:17804–17815, 2020. Hylke E Beck, Albert IJM Van Dijk, Vincenzo Levizzani, Jaap Schellekens, Diego G Miralles, Brecht Martens, and Ad De Roo. Mswep: 3-hourly 0.25 global gridded precipitation (1979–2015) by merging gauge, satellite, and reanalysis data. Hydrology and Earth System Sci- ences, 21(1):589–615, 2017. Marco L Carrera, St ́ephane B ́elair, and Bernard Bilodeau. The canadian land data assimilation system (caldas): De- scription and synthetic evaluation study. Journal of Hy- drometeorology, 16(3):1293–1314, 2015. Matteo De Felice, Andrea Alessandri, and Paolo M Ruti. Electricity demand forecasting over italy: Potential ben- 0.400.701.001.301.601.902.202.502.801234567891011121.702.383.053.734.405.085.756.437.101234567891011122.603.704.805.907.008.109.2010.3011.40123456789101112(a) Temperature MAERMSE(b) Visibility (c) HumidityTimeStepsTimeStepsTimeStepsRMSERMSEMAEMAE Weather2K: A Multivariate Spatio-Temporal Benchmark Dataset for Meteorological Forecasting efits using numerical weather prediction models. Elec- tric Power Systems Research, 104:71–79, 2013. Micha ̈el Defferrard, Martino Milani, Fr ́ed ́erick Gusset, and Nathana ̈el Perraudin. Deepsphere: a graph-based spher- ical cnn. arXiv preprint arXiv:2012.15000, 2020. Imme Ebert-Uphoff, David R Thompson, Ibrahim Demir, Yulia R Gel, Anuj Karpatne, Mariana Guereque, Vipin Kumar, Enrique Cabral-Cano, and Padhraic Smyth. A vision for the development of benchmarks to bridge geo- science and data science. In 17th International Workshop on Climate Informatics, 2017. Xu Geng, Yaguang Li, Leye Wang, Lingyu Zhang, Qiang Yang, Jieping Ye, and Yan Liu. Spatiotemporal multi- graph convolution network for ride-hailing demand fore- casting. In Proceedings of the AAAI conference on arti- ficial intelligence, volume 33, pages 3656–3663, 2019. Shengnan Guo, Youfang Lin, Ning Feng, Chao Song, and Huaiyu Wan. Attention based spatial-temporal graph convolutional networks for traffic flow forecasting. In Proceedings of the AAAI conference on artificial intelli- gence, volume 33, pages 922–929, 2019. David K Hammond, Pierre Vandergheynst, and R ́emi Gri- bonval. Wavelets on graphs via spectral graph theory. Applied and Computational Harmonic Analysis, 30(2): 129–150, 2011. Jie He, Kun Yang, Wenjun Tang, Hui Lu, Jun Qin, Yingy- ing Chen, and Xin Li. The first high-resolution mete- orological forcing dataset for land process studies over china. Scientific Data, 7(1):1–11, 2020. Hans Hersbach, Bill Bell, Paul Berrisford, Shoji Hira- hara, Andr ́as Hor ́anyi, Joaqu ́ın Mu ̃noz-Sabater, Julien Nicolas, Carole Peubey, Raluca Radu, Dinand Schepers, et al. The era5 global reanalysis. Quarterly Journal of the Royal Meteorological Society, 146(730):1999–2049, 2020. George J Huffman, David T Bolvin, Dan Braithwaite, Kuolin Hsu, and Robert Joyce. Nasa global precipitation measurement (gpm) integrated multi-satellite retrievals for gpm (imerg). 2015. Diederik P Kingma and Jimmy Ba. method for stochastic optimization. arXiv:1412.6980, 2014. Adam: A arXiv preprint Nikita Kitaev, Łukasz Kaiser, and Anselm Levskaya. Re- arXiv preprint transformer. former: The efficient arXiv:2001.04451, 2020. Christian Kummerow, J Simpson, O Thiele, W Barnes, ATC Chang, E Stocker, RF Adler, A Hou, R Kakar, F Wentz, et al. The status of the tropical rainfall mea- suring mission (trmm) after two years in orbit. Journal of applied meteorology, 39(12):1965–1982, 2000. Jia Li, Zhichao Han, Hong Cheng, Jiao Su, Pengyun Wang, Jianfeng Zhang, and Lujia Pan. Predicting path failure in time-evolving graphs. In Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Dis- covery & Data Mining, pages 1279–1289, 2019a. Shiyang Li, Xiaoyong Jin, Yao Xuan, Xiyou Zhou, Wenhu Chen, Yu-Xiang Wang, and Xifeng Yan. Enhancing the locality and breaking the memory bottleneck of trans- former on time series forecasting. Advances in neural information processing systems, 32, 2019b. Yaguang Li, Rose Yu, Cyrus Shahabi, and Yan Liu. Diffusion convolutional recurrent neural net- work: Data-driven traffic forecasting. arXiv preprint arXiv:1707.01926, 2017. Haitao Lin, Zhangyang Gao, Yongjie Xu, Lirong Wu, Ling Li, and Stan Z Li. Conditional local convolution for spatio-temporal meteorological forecasting. In Proceed- ings of the AAAI Conference on Artificial Intelligence, volume 36, pages 7470–7478, 2022. Shizhan Liu, Hang Yu, Cong Liao, Jianguo Li, Weiyao Lin, Alex X Liu, and Schahram Dustdar. Pyraformer: Low- complexity pyramidal attention for long-range time se- ries modeling and forecasting. In International Confer- ence on Learning Representations, 2021. Gary C McDonald. Ridge regression. Wiley Interdisci- plinary Reviews: Computational Statistics, 1(1):93–100, 2009. Eike H M ̈uller and Robert Scheichl. Massively parallel solvers for elliptic partial differential equations in nu- merical weather and climate prediction. Quarterly Jour- nal of the Royal Meteorological Society, 140(685):2608– 2624, 2014. Andreas Holm Nielsen, Alexandros Iosifidis, and Henrik Karstoft. Cloudcast: A satellite-based dataset and base- IEEE Journal of Selected line for forecasting clouds. Topics in Applied Earth Observations and Remote Sens- ing, 14:3485–3494, 2021. George Panagopoulos, Giannis Nikolentzos, and Michalis Vazirgiannis. Transfer graph neural networks for pan- demic forecasting. In Proceedings of the AAAI Confer- ence on Artificial Intelligence, volume 35, pages 4838– 4845, 2021. Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zem- ing Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning li- brary. Advances in neural information processing sys- tems, 32, 2019. Evan Racah, Christopher Beckham, Tegan Maharaj, Samira Ebrahimi Kahou, Mr Prabhat, and Chris Pal. Ex- tremeweather: A large-scale climate dataset for semi- supervised detection, localization, and understanding of extreme weather events. Advances in neural information processing systems, 30, 2017. Xun Zhu1, † Yutong Xiong1, † Ming Wu1, ‡ Gaozhen Nie2 Bin Zhang1 Ziheng Yang1 Stephan Rasp, Peter D Dueben, Sebastian Scher, Jonathan A Weyn, Soukayna Mouatadid, and Nils Thuerey. Weatherbench: a benchmark data set for data- driven weather forecasting. Journal of Advances in Mod- eling Earth Systems, 12(11):e2020MS002203, 2020. Matthew Rodell, PR Houser, UEA Jambor, J Gottschalck, Kieran Mitchell, C-J Meng, Kristi Arsenault, B Cos- grove, J Radakovich, M Bosilovich, et al. The global land data assimilation system. Bulletin of the American Meteorological society, 85(3):381–394, 2004. Benedek Rozemberczki, Paul Scherer, Yixuan He, George Panagopoulos, Alexander Riedel, Maria Astefanoaei, Oliver Kiss, Ferenc Beres, Guzm ́an L ́opez, Nicolas Col- lignon, et al. Pytorch geometric temporal: Spatiotem- poral signal processing with neural machine learning models. In Proceedings of the 30th ACM International Conference on Information & Knowledge Management, pages 4564–4573, 2021. Youngjoo Seo, Micha ̈el Defferrard, Pierre Vandergheynst, and Xavier Bresson. Structured sequence modeling with graph convolutional recurrent networks. In Inter- national conference on neural information processing, pages 362–373. Springer, 2018. Lei Shi, Yifan Zhang, Jian Cheng, and Hanqing Lu. Two-stream adaptive graph convolutional networks for skeleton-based action recognition. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 12026–12035, 2019. David I Shuman, Sunil K Narang, Pascal Frossard, Anto- nio Ortega, and Pierre Vandergheynst. The emerging field of signal processing on graphs: Extending high- dimensional data analysis to networks and other irreg- ular domains. IEEE signal processing magazine, 30(3): 83–98, 2013. Casper Kaae Sønderby, Lasse Espeholt, Jonathan Heek, Mostafa Dehghani, Avital Oliver, Tim Salimans, Shreya Agrawal, Jason Hickey, and Nal Kalchbrenner. Met- net: A neural weather model for precipitation forecast- ing. arXiv preprint arXiv:2003.12140, 2020. Xiaogang Su, Xin Yan, and Chih-Ling Tsai. Linear regres- sion. Wiley Interdisciplinary Reviews: Computational Statistics, 4(3):275–294, 2012. MA Tolstykh and AV Frolov. Some current problems in nu- merical weather prediction. Izvestiya Atmospheric and Oceanic Physics, 41(3):285–295, 2005. Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017. Vladimir Vovk. Kernel ridge regression. Empirical Infer- ence: Festschrift in Honor of Vladimir N. Vapnik, pages 105–116, 2013. Shuo Wang, Yanran Li, Jiang Zhang, Qingye Meng, Ling- wei Meng, and Fei Gao. Pm2. 5-gnn: A domain knowl- edge enhanced graph neural network for pm2. 5 forecast- ing. In Proceedings of the 28th International Conference on Advances in Geographic Information Systems, pages 163–166, 2020. Haixu Wu, Jiehui Xu, Jianmin Wang, and Mingsheng Long. Autoformer: Decomposition transformers with auto-correlation for long-term series forecasting. Ad- vances in Neural Information Processing Systems, 34: 22419–22430, 2021. Sifan Wu, Xi Xiao, Qianggang Ding, Peilin Zhao, Ying Wei, and Junzhou Huang. Adversarial sparse trans- former for time series forecasting. Advances in neu- ral information processing systems, 33:17105–17115, 2020a. Zonghan Wu, Shirui Pan, Guodong Long, Jing Jiang, Xi- aojun Chang, and Chengqi Zhang. Connecting the dots: Multivariate time series forecasting with graph neural networks. In Proceedings of the 26th ACM SIGKDD in- ternational conference on knowledge discovery & data mining, pages 753–763, 2020b. Bing Yu, Haoteng Yin, and Zhanxing Zhu. Spatio- temporal graph convolutional networks: A deep learn- ing framework for traffic forecasting. arXiv preprint arXiv:1709.04875, 2017. Xu Zhang, Ruixu Cao, Zuyu Zhang, and Ying Xia. Crowd flow forecasting with multi-graph neural networks. In 2020 International Joint Conference on Neural Net- works (IJCNN), pages 1–7. IEEE, 2020. Ling Zhao, Yujiao Song, Chao Zhang, Yu Liu, Pu Wang, Tao Lin, Min Deng, and Haifeng Li. T-gcn: A temporal graph convolutional network for traffic prediction. IEEE Transactions on Intelligent Transportation Systems, 21 (9):3848–3858, 2019. Chuanpan Zheng, Xiaoliang Fan, Cheng Wang, and Jianzhong Qi. Gman: A graph multi-attention network for traffic prediction. In Proceedings of the AAAI confer- ence on artificial intelligence, volume 34, pages 1234– 1241, 2020. Haoyi Zhou, Shanghang Zhang, Jieqi Peng, Shuai Zhang, Jianxin Li, Hui Xiong, and Wancai Zhang. Informer: Be- yond efficient transformer for long sequence time-series forecasting. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 11106–11115, 2021. Tian Zhou, Ziqing Ma, Qingsong Wen, Xue Wang, Liang Sun, and Rong Jin. Fedformer: Frequency enhanced de- composed transformer for long-term series forecasting. arXiv preprint arXiv:2201.12740, 2022. Weather2K: A Multivariate Spatio-Temporal Benchmark Dataset for Meteorological Forecasting Supplementary Materials: Weather2K: A Multivariate Spatio-Temporal Benchmark Dataset for Meteorological Forecasting Based on Real-Time Observation Data from Ground Weather Stations A NOTATION DEFINITION Table 5 shows the glossary of notations used in this paper. Table 5: Glossary of notations. Symbol Meaning G = (V , E, A) Graph represented nodes, edges and adjacency matrix respectively. vi N D X(t) (cid:48) W W F f tf i,p T f i α, β Θ Ei Zi S s Ws Y(t,W ) ˆY(t,W ) xf t gθ L U IN D Λ ̃L Tk( ̃L) The i-th node. The number of geographic locations. The number of used factors. The value of meteorological factors in all locations at the t-th interval. The input time length. The forecasting time length. The set of all factors in Weather2K. A specific factor in F . The time-series data value of the vertex vi at time step p of factor f . The time-series sequence of vi used for training of factor f . A hyper-parameter for controlling the saturation rate of the activation function. The linear layer. The static node embedding of vi. The dynamic node embedding of vi. The set of proposed graphs. A specific graph in S. Learnable weights which describe the importance of graph s for each node. The ground truth at time t. The final prediction at time t. The signal of factor f at time t all over the graph. A kernel to filter the signal. The normalized graph Laplacian. The matrix of eigenvectors of L. An identity matrix. The diagonal degree matrix. The diagonal matrix of eigenvalues of L The scaled Laplacian. The Chebyshev polynomial of order k evaluated at the scaled Laplacian ̃L. Xun Zhu1, † Yutong Xiong1, † Ming Wu1, ‡ Gaozhen Nie2 Bin Zhang1 Ziheng Yang1 B METRICS COMPUTATION For time series forecasting, let Ti ∈ RL×C be the ground truth, and ˆTi be the predictions given by neural networks, where L denotes the forecasting time length and C is the number of forecasting factors. The two metrics including MAE, MSE are calculated as: MAE (cid:16) Ti, ˆTi (cid:17) = 1 LC (cid:12) (cid:12) (cid:12) ˆTi − Ti (cid:12) (cid:12) (cid:12) MSE (cid:16) Ti, ˆTi (cid:17) = (cid:16) ˆTi − Ti (cid:17)2 1 LC (14) (15) For spatio-temporal weather forecasting, let Y(t,W ) = (cid:2)X(t+1), . . . , X(t+W )(cid:3) be the ground truth, and ˆY(t,W ) = (cid:104) ˆX(t+1), . . . , ˆX(t+W )(cid:105) be the predictions given by graph models. The two metrics including MAE, RMSE are calcu- lated as: MAE (cid:16) Y(t,W ), ˆY(t,W )(cid:17) = 1 W N D t+W (cid:88) i=t+1 ˆX(i) − X(i)(cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) RMSE (cid:16) Y(t,W ), ˆY(t,W )(cid:17) = (cid:118) (cid:117) (cid:117) (cid:116) 1 W N D t+W (cid:88) i=t+1 (cid:16) ˆX(i) − X(i) (cid:17)2 (16) (17) where D, N is the number of forecasting factors and geographic locations respectively, W is the forecasting time length. C MORE DETAILS ON THE DATASET OF WEATHER2K C.1 The Data Processing For sensor noise, bias and external effects when collecting data, CMA's QC technologies mainly include numerical range check, climatic range check, main change range check, internal consistency check, temporal consistency check, spatial consistency check. Moreover, there are six main steps in our procedure of data processing, which are listed as follows: (1) Acquisition of the Raw Data The raw data comes from CMA's observation data of China's ground weather stations. The hourly updated data contains a total of 105 variables from approximately 2,500 ground weather stations covering an area of 6 million square kilometers. We select the time period from January 2017 to August 2021, in which we can ensure the use of unified meteorological observation instruments and sensors for data collection. (2) Screening of the Meteorological Factors Based on the consideration of building a representative and comprehensive dataset for meteorological forecasting, we select 3 time-invariant constants: latitude, longitude, and altitude to provide position information and 20 important meteorological factors such as air pressure, air temperature, dewpoint temperature, water vapor pressure, relative humidity, wind speed, wind direction, vertical visibility, horizontal visibility, precipitation, etc. The definitions and physical descriptions of the chosen variables are listed in Table 1. (3) Screening of the Time Series In this step, we mainly ensure the integrity of the time series of each ground weather station. According to the chosen time range, the length of the time series should be 40,896 steps for a single ground weather station. We discard the whole data of a single weather station with a missing proportion above the upper limit, which is set to 1% of the entire time steps. For the remaining data, we use linear interpolation. After this step, the number of eligible ground weather stations drops to 2,373. (4) Screening of the Default Values There are default values for meteorological factors represented by certain numbers, such as 999,999 for visibility. For a single ground weather station, if the default value proportion for any one of the 20 meteorological factors exceeds 1%, we will discard the entire data. We also use linear interpolation for the default values in the remaining data. After this step, the number of eligible ground weather stations falls further to 2,130. Weather2K: A Multivariate Spatio-Temporal Benchmark Dataset for Meteorological Forecasting (5) Manual Tuning of the Outliers Despite CMA's QC technologies for the data, we found some unexpected outliers. We use box plots to make statistics for each meteorological factor. We focus on discrete individual points in the box plot that are above the upper whisker or below the lower whisker. The opinions of 3 experts in the field of meteorological science help us decide whether these points are outliers for recording errors or acceptable extremes. (6) Storage of the Data We use a huge Numpy format file to store the processed data. The historical data of each individual ground weather station constitutes the time series of multivariate meteorological factors. Thousands of stations form the spatial sequences, each of which is assigned a fixed index number based on the original station number. In the release version of the dataset, we give the index correspondence in a text file. C.2 Dataset Statistics C.2.1 Statistics of Meteorological Factors by Box Plot Figure 4: Box plots of 20 meteorological factors in Weather2K-R and Weather2K-S. (m/s) (m/s) (m) (m) (m) (mm) (mm) (mm) (mm) (mm) (%) (hpa) (hpa) (°) (°) (°C)(°C) (°C) Air PressureAir TemperatureMaximum TemperatureMinimum TemperatureDewpoint TemperatureRelative HumidityWater Vapor PressurePrecipitation in 1hPrecipitation in 3hPrecipitation in 6hPrecipitation in 12hPrecipitation in 24hWind DirectionWind SpeedMaximum Wind DirectionMaximum Wind SpeedLand Surface TemperatureHorizontal Visibility in 1 minHorizontal Visibility in 10 minVertical Visibility(°C)(°C)Weather2K-RWeather2K-SWeather2K-RWeather2K-SWeather2K-RWeather2K-SWeather2K-RWeather2K-SWeather2K-RWeather2K-SWeather2K-RWeather2K-SWeather2K-RWeather2K-SWeather2K-RWeather2K-SWeather2K-RWeather2K-SWeather2K-RWeather2K-SWeather2K-RWeather2K-SWeather2K-RWeather2K-SWeather2K-RWeather2K-SWeather2K-RWeather2K-SWeather2K-RWeather2K-SWeather2K-RWeather2K-SWeather2K-RWeather2K-SWeather2K-RWeather2K-SWeather2K-RWeather2K-SWeather2K-RWeather2K-S Xun Zhu1, † Yutong Xiong1, † Ming Wu1, ‡ Gaozhen Nie2 Bin Zhang1 Ziheng Yang1 In descriptive statistics, the box plot is a method for graphically reflecting the overall characteristics of numerical data distribution through their quartiles. Although we cannot apply a simple Gaussian distribution for modelling various weather properties, such as precipitation and wind, it can also play an auxiliary role in outlier processing. Figure 4 shows the box plots of 20 meteorological factors in Weather2K-R and Weather2K-S. The top and bottom boundaries of a box are the upper and lower quartiles of the statistic indices at these stations, while the line and the cross inside the box are the median and the mean value, respectively. The vertical dashed lines extending from the box represent the minimum and maximum of the corresponding indices. "Outliers" (acceptable after expert discussion) are plotted as individual black points. C.2.2 Statistics of Weather2K-S by Cumulative Distribution Function In probability theory and statistics, the Cumulative Distribution Function (CDF) can completely describes the probability distribution of a real-valued variable. Figure 5 shows the CDF of 20 meteorological factors in Weather2K-S. Lines 1-15 denote the different ground weather stations in Weather2K-S, which can be intuitively found that the stations we select are representative and diverse. Figure 5: CDF of 20 meteorological factors in Weather2K-S. (m/s) (m/s) (m) (m) (m) (mm) (mm) (mm) (mm) (mm) (%) (hpa) (hpa) (°) (°) (°C)(°C) (°C) CDFCDFCDFCDFCDFCDFCDFCDFCDFCDFCDFCDFCDFCDFCDFCDFCDFCDFCDFCDFAir PressureAir TemperatureMaximum TemperatureMinimum TemperatureDewpoint TemperatureRelative HumidityWater Vapor PressurePrecipitation in 1hPrecipitation in 3hPrecipitation in 6hPrecipitation in 12hPrecipitation in 24hWind DirectionWind SpeedMaximum Wind DirectionMaximum Wind SpeedLand Surface TemperatureHorizontal Visibility in 1 minHorizontal Visibility in 10 minVertical Visibility(°C)(°C) Weather2K: A Multivariate Spatio-Temporal Benchmark Dataset for Meteorological Forecasting C.2.3 Statistics of Weather2K-R by Administrative Region Figure 6 shows the statistics of ground weather stations of each province in Weather2K-R to facilitate the potential use of specific audiences. Weather2K-R covers 31 provinces in China and contains 1,866 ground weather stations, with an average of more than 60 ground weather stations per province. Among them, Hebei has the largest number of 132 stations, while Shanghai and Tianjin have the smallest number of 10 stations. Figure 6: The statistics of ground weather stations of each province in Weather2K-R. D EXPERIMENT D.1 Baseline Models In the application direction of time series forecasting, four representative transformer-based baselines are set up for com- parison on Weather2K-S. Transformer Vaswani et al. (2017) propose a simple network architecture, the Transformer, based on the self-attention mechanism. Transformers show great modeling ability for long-range dependencies and interactions in sequential data and thus are attractive in time series modeling. However, it is computationally prohibitive to applying self-attention to long-term time series forecasting due to the quadratic complexity of sequence length L in both memory and time. Many Transformer variants have been proposed to adapt to long-term time series forecasting in a efficient way. Reformer Kitaev et al. (2020) introduce two techniques to improve the efficiency of Transformers. For one, Reformer re- places dot-product attention by one that uses locality-sensitive hashing, changing its complexity from O(L2) to O(L log L). Furthermore, Reformer uses reversible residual layers instead of the standard residuals, which allows storing activations only once in the training process instead of N times, where N is the number of layers. Informer Zhou et al. (2021) propose ProbSparse self-attention mechanism to efficiently replace the canonical self- attention, which use the Kullback-Leibler divergence distribution measurement between queries and keys to select O(log L) dominant queries. Informer achieves the O(L log L) time complexity and memory usage on dependency align- ments. It also designs a generative style decoder to produce long sequence output with only one forward step to avoid accumulation error. Autoformer Wu et al. (2021) devise a seasonal-trend decomposition architecture with an auto-correlation mechanism working as an attention module. The auto-correlation block measures the time-delay similarity between inputs signal and aggregate the top-k similar sub-series to produce the output. Autoformer achieves O(L log L) complexity and breaks the information utilization bottleneck by expanding the point-wise representation aggregation to sub-series level. In the application direction of spatio-temporal forecasting, eight state-of-the-art spatio-temporal GNN models are set up for comparison on Weather2K-R. STGCN Yu et al. (2017) propose a deep learning framework for traffic prediction, integrating graph convolution and gated 1321269796938887797671706969686460585755555148423428211818161010020406080100120140HebeiSichuanShanxiShandongYunnanInner MongoliaHenanGuangdongJiangxiHeilongjiangShaanxiGansuHunanZhejiangHubeiJiangsuGuizhouGuangxiAnhuiFujianLiaoningJilinXinjiangQinghaichongqingNingxiaBeijingTibetHainanShanghaiTianjinNumber of Ground Weather StationsThe ProvinceThe Mean Value Xun Zhu1, † Yutong Xiong1, † Ming Wu1, ‡ Gaozhen Nie2 Bin Zhang1 Ziheng Yang1 temporal convolution through spatio-temporal convolutional blocks. The model is entirely composed of convolutional structures and therefore achieves parallelization over input with fewer parameters and faster training speed. DCRNN Li et al. (2017) study the traffic forecasting problem and model the spatial dependency of traffic as a diffusion process on a directed graph. DCRNN captures both spatial and temporal dependencies among time series using diffusion convolution and the sequence to sequence learning framework together with scheduled sampling. GCGRU Seo et al. (2018) combine convolutional neural networks on graphs to identify spatial structures and recur- rent neural networks to find dynamic patterns. GCGRU shows that exploiting simultaneously graph spatial and dynamic information about data can improve both precision and learning speed. ASTGCN Guo et al. (2019) develop a attention mechanism to learn the dynamic spatio-temporal correlations of traffic data. The spatio-temporal convolution module consists of graph convolutions for capturing spatial features from the traffic network structure and convolutions in the temporal dimension for describing dependencies from nearby time slices. MSTGCN Guo et al. (2019) propose a degraded version of ASTGCN, which gets rid of the spatio-temporal attention. TGCN Zhao et al. (2019) propose the TGCN model by combining the graph convolutional network and gated recurrent unit, which are used to capture the topological structure of the road network to model spatial dependence and the dynamic change of traffic data on the roads to model temporal dependence, respectively. A3TGCN Bai et al. (2021) propose the A3TGCN model to simultaneously capture global temporal dynamics and spatial correlations. The attention mechanism was introduced to adjust the importance of different time points and assemble global temporal information to improve prediction accuracy. CLCRN Based on the assumption of smoothness of location-characterized patterns, Lin et al. (2022) propose the con- ditional local kernel and embed it in a graph-convolution-based recurrent network to model the temporal dynamics for spatio-temporal meteorological forecasting. D.2 Implementation Details All the deep learning networks mentioned in this paper are implemented in PyTorch (Paszke et al., 2019) of version 1.8.0 with CUDA version 11.1. For the hyper-parameters that are not specifically mentioned in each model, we use the default settings from their original proposals. Every single experiment is executed on a server with 4 NVIDIA GeForce RTX3090 GPUs with 24GB of video memory. D.2.1 Transformers in Time Series Forecasting Experiments are carried out on Weather2K-S with the temporal scale from January 1, 2019 to December 31, 2020. The data is divided into the training set, validation set, and test set according to the ratio of 3:1:2. The batch size is set to 32. The global seed is set to 2021 for the experiment repeat. The train epoch is set to 30, while the training process is early stopped within 5 epochs if no loss degradation on the validation set is observed. All the models are trained with L2 loss, using the Adam (Kingma and Ba, 2014) optimizer with the learning rate of 1e−4. D.2.2 GNNs in Spatio-Temporal Forecasting We truncate Weather2K-R with the temporal scale from January 1, 2017 to December 31, 2019. The baselines are all implemented according to PyTorch Geometric Temporal (Rozemberczki et al., 2021). We construct a distance graph as one of the GNN models' inputs by utilizing three time-invariant constants in Weather2K-R that provide position information including latitude, longitude, and altitude. The data for training, validation, and testing are all non-overlapping one-year time, while the random seed is set to 2022. The batch size for training is set to 32. All the models are trained with the target function of MAE and optimized by Adam optimizer (Kingma and Ba, 2014) for 100 epochs. Early-stopping epoch is set to 50 according to the validation set. The initial learning rate is set to 1e−2, and it decays with the ratio 5e−2 per 10 epochs in the first 50 epochs. D.3 The Results of Multivariate to Univariate Forecasting with Transformer Baselines To take full advantage of multivariate data in Weather2K-S, we explore and attempt to use the multivariate data to forecast the target univariate meteorological factor. We conduct experiments on the assumption that there are some underlying Weather2K: A Multivariate Spatio-Temporal Benchmark Dataset for Meteorological Forecasting correlations between different meteorological factors. Without any prior knowledge, we use all 20 dimensional meteoro- logical factors as input data. Table 6 shows the performance of multivariate to univariate forecasting. The number in the parenthesis is the difference value from the univariate result, where the better result is highlighted in bold. However, mul- tivariate to univariate forecasting does not result in stable performance gain and even brought performance degradation in most cases compared to univariate forecasting. It can be concluded that multivariate information of meteorological factors is underutilized in existing transformer-based time series forecasting baselines. Table 6: Multivariate to univariate results with different prediction lengths of 24, 72, 168, 336, and 720 on Weather2K-S. The input time length is 72 steps. The better results compared to univariate results are highlighted in bold. Models Transformer Reformer Informer Autoformer Factors Metrics MSE MAE MSE MAE MSE MAE MSE MAE e r u t a r e p m e T y t i l i b i s i V y t i d i m u H 24 72 168 336 720 24 72 168 336 720 24 72 168 336 720 0.0874 (+0.0134) 0.1379 (+0.0133) 0.1624 (+0.0064) 0.1757 (+0.0048) 0.1939 (+0.0336) 0.7300 (+0.0195) 0.8943 (+0.0221) 0.9101 (-0.0052) 0.9883 (-0.0069) 1.0143 (+0.0180) 0.4307 (+0.0561) 0.5741 (+0.0513) 0.6427 (+0.0492) 0.6620 (+0.0513) 0.6668 (+0.0491) 0.2256 (+0.0256) 0.2843 (+0.0187) 0.3090 (+0.0091) 0.3224 (+0.0076) 0.3399 (+0.0341) 0.6696 (+0.0160) 0.7548 (+0.0073) 0.7721 (-0.0081) 0.7989 (-0.0070) 0.8117 (+0.0027) 0.5010 (+0.0403) 0.5863 (+0.0260) 0.6242 (+0.0238) 0.6354 (+0.0212) 0.6359 (+0.0213) 0.0820 (-0.0077) 0.1200 (-0.0094) 0.1354 (-0.0077) 0.1398 (-0.0053) 0.1468 (-0.0013) 0.6355 (-0.0268) 0.8072 (-0.0232) 0.9067 (-0.0016) 0.9203 (-0.0016) 0.9453 (-0.0053) 0.3632 (+0.0014) 0.4941 (+0.0009) 0.5457 (+0.0036) 0.5856 (+0.0095) 0.5819 (-0.0045) 0.2173 (-0.0133) 0.2669 (-0.0128) 0.2841 (-0.0085) 0.2886 (-0.0061) 0.2940 (-0.0028) 0.6101 (-0.0187) 0.7219 (-0.0221) 0.7672 (-0.0123) 0.7787 (-0.0023) 0.7964 (+0.0018) 0.4551 (+0.0022) 0.5454 (-0.0001) 0.5767 (+0.0008) 0.5992 (+0.0054) 0.5963 (-0.0046) 0.0953 (+0.0195) 0.1575 (+0.0303) 0.2002 (+0.0303) 0.2298 (+0.0180) 0.2550 (+0.0431) 0.7316 (+0.0309) 0.9388 (+0.0541) 0.9853 (+0.0425) 1.0229 (-0.0003) 1.0736 (+0.0501) 0.4318 (+0.0569) 0.5989 (+0.0757) 0.7281 (+0.1060) 0.8020 (+0.1055) 0.8803 (+0.0824) 0.2322 (+0.0291) 0.3033 (+0.0322) 0.3450 (+0.0288) 0.3785 (+0.0199) 0.3978 (+0.0341) 0.6555 (+0.0165) 0.7587 (+0.0084) 0.8014 (+0.0071) 0.8304 (-0.0084) 0.8539 (+0.0101) 0.5024 (+0.0461) 0.5985 (+0.0366) 0.6617 (+0.0454) 0.7129 (+0.0476) 0.7711 (+0.0426) 0.1114 (+0.0136) 0.1505 (+0.0121) 0.1642 (+0.0068) 0.1734 (+0.0079) 0.2037 (+0.0026) 0.8596 (+0.0582) 1.0087 (+0.0737) 1.0108 (+0.0197) 1.0135 (+0.0216) 1.0596 (-0.0055) 0.5217 (+0.0926) 0.6215 (+0.0704) 0.6536 (+0.0425) 0.6896 (+0.0382) 0.7358 (+0.0213) 0.2539 (+0.0172) 0.2968 (+0.0136) 0.3078 (+0.0076) 0.3180 (+0.0088) 0.3486 (+0.0033) 0.7188 (+0.0259) 0.7838 (+0.0253) 0.7873 (+0.0039) 0.7907 (+0.0075) 0.8092 (-0.0053) 0.5539 (+0.0598) 0.6140 (+0.0419) 0.6283 (+0.0241) 0.6456 (+0.0198) 0.6719 (+0.0120) D.4 The Univariate Results of the Persistent Model and Classical Nonparametric Methods In order to perform a meaningful comparison for the forecasting results, the persistent model should be introduced to quantify the improvement given by advanced forecasting techniques. The persistent model is the most cost-effective forecasting model (De Felice et al., 2013) which assumes that the conditions will not change, which means "today's weather is tomorrow's forecast". So it is often called the naive forecast. In addition, we present the univariate forecasting results of 3 classical nonparametric methods including linear regression (Su et al., 2012), ridge regression (McDonald, 2009), and kernel ridge regression (Vovk, 2013) on Weather2K-S in Table 7. Different from transformer baselines, we use all the data of Weather2K-S, with a 3:1 ratio of the training set to the test set. Table 7: Univariate results of the persistent model and nonparametric methods with different prediction lengths of 24, 72, 168, 336, and 720 steps. The input time length is 72 steps. The reported results of mean and standard deviation are obtained through experiments on Weather2K-S. Results with bold and underlines are the best and worst performance, respectively. Models Persistent Model Linear Regression Ridge Regression Kernel Ridge Regression Factors Metrics MSE MAE MSE MAE MSE MAE MSE MAE Temperature Visibility Humidity 24 72 168 336 720 24 72 168 336 720 24 72 168 336 720 0.2610±0.1253 0.3219±0.1336 0.3793±0.1501 0.4179±0.1595 0.4951±0.1598 1.0079±0.2200 1.3548±0.3239 1.5628±0.3818 1.6512±0.4031 1.7290±0.4237 1.0022±0.1534 1.2302±0.1741 1.3995±0.2021 1.5181±0.2296 1.6328±0.2538 0.3771±0.0883 0.4285±0.0855 0.4697±0.0892 0.4968±0.0909 0.5463±0.0847 0.6662±0.1353 0.8147±0.1712 0.8998±0.1939 0.9364±0.2027 0.9665±0.2113 0.7505±0.0610 0.8504±0.0608 0.9172±0.0619 0.9608±0.0656 1.0030±0.0707 0.0712±0.0222 0.1237±0.0417 0.1653±0.0608 0.1962±0.0689 0.2632±0.0696 0.6355±0.1253 0.8115±0.1815 0.9038±0.2073 0.9434±0.2298 0.9801±0.2481 0.3548±0.0796 0.4939±0.1060 0.5770±0.1179 0.6281±0.1240 0.6723±0.1316 0.1892±0.0269 0.2548±0.0389 0.3003±0.0510 0.3329±0.0538 0.3931±0.0472 0.6147±0.1007 0.7355±0.1210 0.7948±0.1260 0.8207±0.1317 0.8417±0.1366 0.4378±0.0529 0.5356±0.0625 0.5909±0.0647 0.6233±0.0663 0.6500±0.0693 0.0713±0.0222 0.1237±0.0418 0.1655±0.0608 0.1963±0.0689 0.2634±0.0696 0.6350±0.1261 0.8114±0.1821 0.9037±0.2077 0.9447±0.2312 0.9812±0.2488 0.3547±0.0796 0.4940±0.1060 0.5776±0.1180 0.6285±0.1240 0.6726±0.1316 0.1893±0.0269 0.2549±0.0389 0.3005±0.0510 0.3331±0.0538 0.3932±0.0472 0.6162±0.1009 0.7366±0.1214 0.7954±0.1262 0.8233±0.1323 0.8444±0.1367 0.4380±0.0529 0.5357±0.0625 0.5918±0.0648 0.6239±0.0664 0.6505±0.0693 0.0713±0.0222 0.1237±0.0418 0.1654±0.0609 0.1964±0.0691 0.2635±0.0701 0.6357±0.1255 0.8121±0.1820 0.9047±0.2083 0.9446±0.2308 0.9810±0.2485 0.3547±0.0796 0.4939±0.1060 0.5769±0.1178 0.6278±0.1239 0.6718±0.1316 0.1893±0.0269 0.2550±0.0390 0.3006±0.0514 0.3332±0.0544 0.3943±0.0478 0.6148±0.1009 0.7357±0.1213 0.7950±0.1265 0.8210±0.1322 0.8418±0.1369 0.4378±0.0528 0.5356±0.0625 0.5908±0.0646 0.6231±0.0662 0.6496±0.0691 Xun Zhu1, † Yutong Xiong1, † Ming Wu1, ‡ Gaozhen Nie2 Bin Zhang1 Ziheng Yang1 D.5 Discussion of the value of NA in Neighbor Graph When we use the neighbor graph GN separately, the influence of the selection value of NA should be discussed. In Figure 7, we respectively set NA as 5, 10, 15, 20, and 25 to verify the variation trend of MAE and RMSE when the forecasting time step is 12. The performance will not be significantly improved when the number exceeds 10. Therefore, we consistently set NA to 10 in the following ablation studies. Figure 7: The selection of NA in neighbor graph in forecasting (a) temperature, (b) visibility, and (c) humidity. 2.252.332.412.492.572.655101520251.601.641.681.721.761.80510152025N!RMSE6.056.156.256.356.456.55510152025N!RMSE11.0011.2011.4011.6011.8012.00510152025N!RMSEMAEN!4.154.194.234.274.314.35510152025MAEN!7.607.767.928.088.248.40510152025MAEN!(a) Temperature(a) Temperature(b) Visibility(b) Visibility(c) Humidity(c) Humidity
http://arxiv.org/abs/2302.10490v1
2023-02-21T07:38:46
2023-02-21T07:38:46
Creating Disasters: Recession Forecasting with GAN-Generated Synthetic Time Series Data
A common problem when forecasting rare events, such as recessions, is limited data availability. Recent advancements in deep learning and generative adversarial networks (GANs) make it possible to produce high-fidelity synthetic data in large quantities. This paper uses a model called DoppelGANger, a GAN tailored to producing synthetic time series data, to generate synthetic Treasury yield time series and associated recession indicators. It is then shown that short-range forecasting performance for Treasury yields is improved for models trained on synthetic data relative to models trained only on real data. Finally, synthetic recession conditions are produced and used to train classification models to predict the probability of a future recession. It is shown that training models on synthetic recessions can improve a model's ability to predict future recessions over a model trained only on real data.
[ "Sam Dannels" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10490v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10490v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "econ.GN", "q-fin.EC", "stat.AP" ]
CREATING DISASTERS: RECESSION FORECASTING WITH GAN-GENERATED SYNTHETIC TIME SERIES DATA 3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 0 9 4 0 1 . 2 0 3 2 : v i X r a Sam Dannels ∗ Draft: February 2023 ABSTRACT A common problem when forecasting rare events, such as recessions, is limited data availability. Re- cent advancements in deep learning and generative adversarial networks (GANs) make it possible to produce high-fidelity synthetic data in large quantities. This paper uses a model called Doppel- GANger, a GAN tailored to producing synthetic time series data, to generate synthetic Treasury yield time series and associated recession indicators. It is then shown that short-range forecasting performance for Treasury yields is improved for models trained on synthetic data relative to models trained only on real data. Finally, synthetic recession conditions are produced and used to train clas- sification models to predict the probability of a future recession. It is shown that training models on synthetic recessions can improve a model's ability to predict future recessions over a model trained only on real data. 1 Introduction One of the most difficult tasks in forecasting and predictive analytics is predicting a rare occurrence event. Events that occur with low frequency, and thus have low probability in the sample space, are difficult to adequately measure and incorporate into a model due to a lack of sufficient data. One such event is an economic recession. The National Bureau of Economic Research (NBER) tasks its Business Cycle Dating Committee with classifying business cycle peaks and troughs, which indicate the turning points between economic expansions and contractions. NBER classifies a recession as a time period that "involves a significant decline in economic activity that is spread across the economy and lasts more than a few months" (2023). Between January 1965 and January 2023, NBER lists only eight recessions. Perhaps the most famous leading indicator of a recession is an inversion of the yield curve. The yield curve measures how yields vary for Treasury bills and bonds based on their maturity. Generally, short-term bills will have lower yield than longer-term bonds. Occasionally, the yield curve will "invert", meaning that market forces have driven short-term yields above long-term yields. It has been well documented that this phenomenon can be a useful indicator that a recession is imminent (Bernard & Gerlach, 1998; Estrella & Hardouvelis, 1991; Kessel, 1965), and that utilizing the spread between short and long-term yields can predict recessions better than many other leading indicators (Estrella & Mishkin, 1996). While yield curve inversions may show promise in predicting recessions, difficulty arises in training and testing a model on the few available recessions for which there is adequate data. In order to better train a model to predict recessions, one would need to observe more recessions. Recent advances in the ability of generative adversarial networks (GANs) to create synthetic replicates of time series data may provide a solution to this problem. The goal of this paper is to demonstrate that generating synthetic replicates of Treasury bond yield data shows initial promise in improving short-term forecasts of yield movements, as well as strengthens the signal provided by recession probability models making use of the Treasury yield spread. ∗University of Iowa, Department of Statistics and Actuarial Science. Email: [email protected] Creating Disasters: Recession Forecasting with GAN-generated Synthetic Time Series Data 2 Background 2.1 Synthetic Data Synthetic data is an artificial replicate of a real data example that is ideally drawn from the same distribution as the original example. Synthetic data can be generated manually by experts or through a statistical or machine learning algorithm. The resulting synthetic data should have high fidelity, that is it should maintain the statistical properties of the original example it is based on while not being an exact replicate of the original data (Lin, Jain, Wang, Fanti, & Sekar, 2020; Nikolenko, 2019). Synthetic data is useful for the purpose of sharing data for collaboration across organizations without revealing any proprietary information (Lin et al., 2020), providing more samples or increasing the frequency of novel samples in a sparse data set (Nikolenko, 2019), and in some cases can increase predictive performance over models trained on traditional data (Fawaz, Forestier, Weber, Idoumghar, & Muller, 2018; Frid-Adar, Klang, Amitai, Goldberger, & Greenspan, 2018). There are many means of producing synthetic data, but the recent success of GANs in producing high-fidelity replicates of images (Karras, Laine, & Aila, 2018; Zhu, Park, Isola, & Efros, 2017) has led to their popularity among researchers. One particular GAN that has demonstrated success in producing synthetic samples of multidimensional time series data is called DoppelGANger (Lin et al., 2020). In this paper, DoppelGANger will be the model used to produce high-fidelity replicates of 1-year and 10-year Treasury bond yields. Before moving on to the specific architecture of DoppelGANger, we will review the general structure and training of GANs. 2.2 GANs GANs were first introduced by Goodfellow et al. in the 2014 work "Generative Adversarial Networks". The following section is a summary of the ideas proposed in that paper. The basic idea behind the method they introduced is that there are two models - a generative model, G, and a discriminative model, D - that compete in a minimax game. The generative model (generator) is given latent variables (noise) as inputs and attempts to produce a mapping from the latent space to some desired data space. An example would be a generator that produces realistic images of cats. It would attempt to learn a mapping from the latent space to a complex probability space that represents realistic-looking photos of cats. The discriminative model (discriminator) is given inputs from both the real data and the fake samples produced by the generator and tasked with distinguishing between the two. It produces a single probability that the input came from the data rather than the generator. In our example, the discriminator would provide a probability that the given input is a real image of a cat and thus not a computer-generated image of a cat. The two models are trained in an adversarial way, such that the generator seeks to trick the discriminator with its fake samples while the discriminator seeks to correctly classify each input it is given as real or generated data. The ultimate goal is that this minimax optimization training scheme will result in a generator that is able to produce high-fidelity samples from the same space as the original data. More specifically, allow x to be the data samples for training the GAN and z to be the latent variables provided to the generator. Then the minimax problem can be represented by: min G max D E x∼pdata [logD(x)] + E z∼pz [log(1 − D(G(z)))] While G and D can be a wide variety of differentiable functions, in practice they are most commonly deep neural networks. GANs require few assumptions about the data space and can be trained through common backpropagation algorithms, which avoid the need for difficult parametric likelihood maximization and Markov Chains (Goodfellow et al., 2014; Lin et al., 2020). In practice, G and D are trained iteratively. D is trained for k steps while G is held fixed, and then G is trained for a single step while D is held fixed. When updating G, the gradient is computed for both D and G, because the gradient backpropagation must pass through D, but the weights are only updated for G. k is a hyperparameter whose optimal value can vary based on the task at hand (Glassner, 2021; Goodfellow et al., 2014). When training GANs, there are a few extra considerations to improve the chances of convergence. Dropout, the practice of regularizing a neural network by stochastically dropping nodes throughout the training process, can help avoid overfitting (Goodfellow, Bengio, & Courville, 2016). To avoid overfitting GANs, it is important to include dropout in the training process, especially in the discriminator (Goodfellow et al., 2016). It has also been shown that in practice, training G to maximize logD(G(z)) rather than minimize log(1 − D(G(z))) can improve the efficiency of training (Goodfellow et al., 2014). 2 Creating Disasters: Recession Forecasting with GAN-generated Synthetic Time Series Data GAN training can be very unstable. GANs are especially prone to "mode collapse", where many inputs z produce the same output (Goodfellow et al., 2014). In our cat example, the goal is to train a generator that can create many different images of photorealistic cats. While training, the generator is able to fool the discriminator with an image of a black cat. Rather than move to other areas of the data's probability space, the generator remains in the area that produced the black cat and continues to produce the same image of a black cat over and over. The generator is technically meeting its objective of fooling the discriminator, but there is no diversity in the resulting generated images. For these reasons, training GANs requires a lot of experimentation and experience. While GANs can be tricky to train for the reasons stated above, when they are properly trained, they can produce very useful results. 2.3 DoppelGANger DoppelGANger (Lin et al., 2020) is a GAN designed to generate multivariate time series and corresponding metadata. Metadata are fixed attributes of the data that are not a part of the time series, but still contain relevant information about the series. For example, a data set may contain 4 time series, each corresponding to the change of a certain stock's price over time. Relevant metadata may be a ticker symbol label for each stock, the industry each stock belongs to, or any other fixed attribute. DoppelGANger was designed with the intent of producing synthetic networked systems data for data sharing, but works as a general framework for producing many types of synthetic time series data. The design of DoppelGANger alters the architecture of traditional GANs in a few crucial ways to tackle problems in a time series setting. The first alteration has to do with the type of neural network used in the GAN. DoppelGANger, and other time series GANs (Arnelid, Zec, & Mohammadiha, 2019; Mogren, 2016), rely on recurrent neural networks (RNNs) that are able to capture temporal correlations. More specifically, DoppelGANger uses a popular type of RNN called long short-term memory (LSTM). To illustrate the basic idea of RNN generators, say there is a univariate sequence of length τ . At step i, the RNN will generate a value one step ahead, xi+1, using information from previous values in the sequence and the current state, {x1, x2, . . . , xi}. At each step the RNN keeps an encoded memory that summarizes relevant information about the previous states, f ({x1, x2, . . . , xi−1}; θ), allowing it to track temporal patterns (Goodfellow et al., 2016). The RNN passes over the sequence τ times to produce the entire series. This idea can be extended to multivariate time series. See Appendix A for more details on RNNs and LSTM. A common problem with RNN generators is that long sequences require a very large number of passes of the RNN, which make it difficult to capture longer-term correlations (Lin et al., 2020). To handle this problem, the creators of DoppelGANger use what they call "batch generation". Instead of generating one step ahead in each pass, DoppelGANger generates S steps ahead, which reduces the necessary number of passes. The authors of DoppelGANger suggest a value of S such that τ /S is around 50, but S can be tuned for specific tasks. The next aspect of DoppelGANger is designed to mitigate mode collapse. The model uses a unique kind of normal- ization for time series exhibiting a wide range of values across samples and series. For example, say in a given sample one series has a range of 0 to 100, while another series in the sample has a range of -5 to 5. Rather than normalize by the global minimum and maximum (-5 and 100) for all series, each series is normalized by its individual minimum and maximum in that sample, and these values are stored as metadata for that series in the form min+max . DoppelGANger learns these metadata and generates a new minimum and maximum for rescaling each generated series. Experimenta- tion indicates that this can help reduce mode collapse in many cases where ranges greatly vary between series (Lin et al., 2020). 2 A useful feature of DoppelGANger is that it does not only generate synthetic time series, but also jointly generates synthetic attributes (metadata) for those series. This is accomplished by using multiple generators. The first generates metadata using a standard multilayer perceptron (MLP). These generated metadata are then given as inputs to another MLP that generates the minimum and maximum metadata used for the normalization scheme described in the para- graph above. Then all of the combined metadata are given as inputs to the LSTM that generates the synthetic time series. To account for the different dimensionality and types of data being generated, there is an additional "auxiliary discriminator", Daux, that measures loss on only the metadata. The Wasserstein loss of the two discriminators are combined by the weighting scheme: minG maxD,Daux L(G, D) + αLaux(G, Daux). A diagram of DoppelGANger's architecture can be seen in Figure 1. 3 Synthetic Data Generation 3.1 Data Data were collected from the Federal Reserve Economic Data (FRED) website hosted by the Federal Reserve Bank of St. Louis. Data were collected at a daily frequency for market yield on U.S. Treasuries at both a 1-year and 10-year 3 Creating Disasters: Recession Forecasting with GAN-generated Synthetic Time Series Data Figure 1: DoppelGANger's Architecture Source: "Using GANs for Sharing Networked Time Series Data: Challenges, Initial Promise, and Open Questions" by Lin et al. URL: https://dl.acm.org/doi/pdf/10.1145/3419394.3423643 Copyright Information: Creative Commons Attribution 4.0 International Public License Figure 2: U.S. Treasuries Yield Data Note: Grey areas indicate recession Sources: Board of Governors of the Federal Reserve System, Federal Reserve Bank of St. Louis, NBER constant maturity (Board of Governors of the Federal Reserve System (US), n.d.-a, n.d.-b). There are many possible variations of short and long-term yield spread, but for this study, 1 and 10-year maturities were selected because they have long histories available. An indicator for recession according to NBER was also collected at a daily frequency (Federal Reserve Bank of St. Louis, n.d.). Note that yield data is only collected on weekdays. Figure 2 shows the Treasury yield data. For the first task, DoppelGANger was trained on data ranging from 01-02-1962 to 12-30-2016. The remaining data (from 01-03-2017 to 01-23-2023) was not used in training so that forecasting performance could be evaluated on that time period. 3.2 Training As with all deep learning models, DoppelGANger requires many samples to train on. So the training set was split into samples of 125 day segments to be used as inputs to DoppelGANger. The features used in training were 1-year Treasury Bill yield and 10-year Treasury Bond yield. For metadata, a single attribute was added to each sample indicating whether or not a recession occurred at any point in that particular 125 day span. A PyTorch implementation of DoppelGANger created by Gretel (Boyd, 2022) was used in training. Samples were 125 days in length and after some experimentation, S was set to 5; meaning there were 25 RNN passes over each sample. The normalization scheme using the local minimum and maximum was applied to the yield data. In neural network training, the learning rate is a hyperparameter that regulates the magnitude of updates at each step in the 4 1970198019902000201020200.02.55.07.510.012.515.017.5Percent1-year Treasury Yield10-year Treasury YieldTraining Data Cutoff Creating Disasters: Recession Forecasting with GAN-generated Synthetic Time Series Data Figure 3: Comparison of real samples to synthetic samples Note: The top row contains true data samples from the training set. The bottom row contains generated data from DoppelGANger. The bottom right is an example of a generated yield curve inversion. Sources: Board of Governors of the Federal Reserve System, Federal Reserve Bank of St. Louis, NBER, author training process. Smaller learning rates are recommended for training and ensure that the gradient descent algorithm does not take too large of steps and overshoot minimums (Glassner, 2021). The generator and discriminator learning rates were both set equal to 10−4, and training was run for 2000 epochs. 3.3 Evaluating generated data After training the model, 1000 synthetic samples were generated. These are each 125 days in length and paired with recession indicator metadata. Figure 3 shows three real samples from the training data and three synthetic samples. Evaluating the data qualitatively, the synthetic samples appear quite similar to what one might expect from the true data. The bottom right panel of Figure 3 is an example of a generated yield curve inversion, indicating that DoppelGANger was able to learn from those unique cases as well as the standard cases where the 10-year yield should be significantly higher than the 1-year yield. As far as metadata generation, approximately 18% of training samples contained a positive indicator for recession. While approximately 17% of generated samples contained a positive indicator for recession, meaning the samples containing recession data remained roughly proportional to the true data. The key is that the trained generator now has the ability to produce as many fake recessions as needed. In the training set, the correlation between 1-year and 10-year Treasury bond yields was 0.946. In the generated samples, the correlation was 0.945. Figure 4 shows histograms for the 1-year and 10-year training data against their synthetic counterparts. The synthetic data approximately follows the same distribution as the training data with a bit more noise. In rare cases, the synthetic data may produce a negative yield or an outlier in terms of magnitude. These are not ideal, but given that they are a negligible proportion of the generated samples, they likely do not have much affect on downstream predictive tasks. Given that the training data is split into segments, the model appears to struggle to capture the strength of the long- term autocorrelations. For both 1-year and 10-year yields, the autocorrelation remains high even at a 100 day lag when estimated on the full range of training data. It is difficult to assess autocorrelation for separated samples, however. The 5 0204060801001203.03.23.43.63.84.0Yield (Percent)1-year Treasury Yield10-year Treasury Yield020406080100120Days6.57.07.58.08.59.0Real Samples0204060801001205.05.25.45.65.80204060801001200.000.250.500.751.001.251.501.75Yield (Percent)Synthetic 1-year Treasury YieldSynthetic 10-year Treasury Yield020406080100120Days2.753.003.253.503.754.004.254.50Synthetic Samples0204060801001207.87.98.08.18.28.3 Creating Disasters: Recession Forecasting with GAN-generated Synthetic Time Series Data Figure 4: Distributions of real and generated yields Source: author's calculations Figure 5: Estimated autocorrelations Note: The synthetic and real (training samples) values are estimated as an average of autocorre- lations across many samples. The real (full data) autocorrelation is estimated on the full range of training data before being split into training samples. Source: author's calculations method used was to assess the autocorrelation within each 125 day sample and average the autocorrelations across all samples. This allows for comparison with the generated samples, which are independent 125 day segments. When using this method, the training samples and generated samples show fairly similar patterns in their autocorre- lations; however, they both show more rapid decline in autocorrelation than the estimates from the full training data. You can see these patterns in Figure 5. So it appears that DoppelGANger was able to replicate the autocorrelations from the training samples, but those samples underestimate the extent to which autocorrelation remains high in the yield curve data. It should also be noted that higher lags have fewer data to estimate autocorrelation, and thus had very high variance across samples. It is possible that lengthening the training samples to include more days could help improve replication of long-term autocorrelations, but would come at the cost of fewer training samples. There is a trade-off to consider between length of samples and quantity of samples when preparing training data. This should be considered when deciding the horizon of forecasts that will be produced in downstream tasks. The results shown in this section are an illustrative example of a successful training of DoppelGANger to Treasury data. Not every training attempt was successful, however. Getting useful synthetic data required a bit of experimentation and tuning, and even with the same training scheme, results can vary widely. In several training attempts, mode collapse resulted in nearly all generated samples containing perfectly straight lines. DoppelGANger, like most GANs, can be unstable and difficult to train but produces great results when properly trained. 4 Forecasting Treasury Yields The first task is to evaluate forecasting performance of models trained on synthetic data against those trained on real data. In order to do that, an LSTM model was trained to produce 1-day ahead forecasts of 1-year and 10-year Treasury yields based on the previous 25 days of data. 6 50510152025Yield0.000.020.040.060.080.100.120.14DensityDistribution of 1-year YieldsRealSynthetic50510152025Yield0.000.020.040.060.080.100.120.140.16DensityDistribution of 10-year YieldsRealSynthetic020406080100lag (days)0.20.00.20.40.60.81.0Autocorrelation1-year Yield AutocorrelationsSyntheticReal (training samples)Real (full data)020406080100lag (days)0.00.20.40.60.81.010-year Yield AutocorrelationsSyntheticReal (training samples)Real (full data) Creating Disasters: Recession Forecasting with GAN-generated Synthetic Time Series Data Table 1: Forecasting performance for 1-day ahead forecasts over period January 3, 2017 to January 11, 2023. Real Synthetic Combined 1-year Treasury RMSE 1-year Treasury MAPE 10-year Treasury RMSE 0.077 7.793 0.253 10-year Treasury MAPE 15.903 0.046 9.413 0.062 2.709 0.072 8.368 0.073 3.484 Table 2: Forecasting performance for 15-day ahead forecasts over period January 3, 2017 to January 11, 2023. Real Synthetic Combined 1-year Treasury RMSE 0.244 1-year Treasury MAPE 77.736 10-year Treasury RMSE 0.425 10-year Treasury MAPE 25.075 0.355 84.610 0.543 30.503 0.307 58.448 0.269 13.557 Using actual data for 1-year and 10-year Treasury yields as shown in Figure 2, training samples were created by splitting the data into a rolling window of 25 days. That is, the first 25 days of data make up the first sample, with day 26 being its associated response. Then the window is moved forward by one day. Days 2-26 make up the second sample, with an associated response from day 27, and so on. These samples were created over the time frame 01-02- 1962 to 12-30-2016, the same range of data that trained DoppelGANger. This produced 13,710 samples and associated one-day ahead responses. We will refer to this set of samples as the real data training set. As seen in section 3, DoppelGANger produced 1000 synthetic samples of yield data. These synthetic samples were used to create forecast training data in the same fashion as the real data training set described above. A rolling 25 day window split up training samples and responses within each synthetic sample. Each 125 day segment of synthetic data was able to generate 100 training samples and responses for a total of 100,000 synthetic training samples. We will refer to this as the synthetic data training set. Finally, a training set was created by combining the real data training set and the synthetic data training set. The idea is that the LSTM model will be trained on real data that is augmented by synthetic data in order to allow for more samples. This training set has 113,710 samples and will be referred to as the combined data training set. The model trained for forecasting is a deep neural network with two stacked LSTM layers, each with a hyperbolic tangent (tanh) activation function, followed by a dropout layer and a dense layer with 2 nodes for the 2 features (1- year and 10-year Treasury yield). A diagram of this model can be seen in Figure C.1. The model used a mean-squared error loss function and Adam optimizer (Kingma & Ba, 2014). This model was trained with each of the three training sets - real, synthetic, and combined - each for 50 epochs. Each trained model then produced one-day ahead forecasts for a test set containing real Treasury yield data from 01-03-2017 to 01-11-2023. Forecasting performance over this test set, measured by root mean square error (RMSE) and mean absolute percentage error (MAPE), can be seen in Table 1. The LSTM model trained on synthetic data outperformed the other models in every metric except for the MAPE for 1-year Treasury yield. Interestingly, the model trained on combined data performed much better than the model trained on real data for the 10-year Treasury yield, but still did not match the performance of the model trained on synthetic data only. These results imply that models trained on synthetic data can improve forecasting performance over a model trained on only real data, likely due to the increased availability of training data. The same LSTM model architecture was then used again to test the forecasting performance of longer-range forecasts. This time, rather than providing responses of a single day ahead, the response was a vector of 15 days beyond the end of the training sample. The LSTM was thus trained to take a sample of 25 days and predict yield values for the following 15 days. Again, three models were trained on real data, synthetic data, and combined real and synthetic data. Forecasting performance was evaluated for the 15th day of the generated predictions, and these metrics can be found in Table 2. 7 Creating Disasters: Recession Forecasting with GAN-generated Synthetic Time Series Data Figure 6: 1-day ahead forecasts for each type of training data Sources: Board of Governors of the Federal Reserve System, Federal Reserve Bank of St. Louis, NBER, author Figure 7: 15-day ahead forecasts for each type of training data Sources: Board of Governors of the Federal Reserve System, Federal Reserve Bank of St. Louis, NBER, author 8 2017201820192020202120222023012345Yield (Percent)ActualForecast - Real Data20172018201920202021202220230123451-Year Treasury Yield Forecasts: 1-Day AheadActualForecast - Synthetic Data2017201820192020202120222023012345ActualForecast - Combined Data20172018201920202021202220230.51.01.52.02.53.03.54.04.5Yield (Percent)ActualForecast - Real Data20172018201920202021202220230.51.01.52.02.53.03.54.04.510-Year Treasury Yield Forecasts: 1-Day AheadActualForecast - Synthetic Data20172018201920202021202220230.51.01.52.02.53.03.54.04.5ActualForecast - Combined Data2017201820192020202120222023012345Yield (Percent)ActualForecast - Real Data20172018201920202021202220230123451-Year Treasury Yield Forecasts: 15-Day AheadActualForecast - Synthetic Data2017201820192020202120222023012345ActualForecast - Combined Data20172018201920202021202220230.51.01.52.02.53.03.54.04.5Yield (Percent)ActualForecast - Real Data201720182019202020212022202312345610-Year Treasury Yield Forecasts: 15-Day AheadActualForecast - Synthetic Data20172018201920202021202220230.51.01.52.02.53.03.54.04.5ActualForecast - Combined Data Creating Disasters: Recession Forecasting with GAN-generated Synthetic Time Series Data The longer-range forecasting model trained on only synthetic data consistently had the worst performance. This is not surprising, as it was shown in section 3 that the synthetic data struggled to capture the longer-range autocorrelation of the true data. In longer-range forecasting, the model trained on combined real and synthetic data fared the best. This could potentially be due to the fact that the combined data model benefits from both learning the true structure of the real data and an increased availability of training samples from the synthetic data. Overall, it appears there is a benefit to using synthetic data in forecasting Treasury yields. 5 Predicting Recessions The second task of this study is to test if using synthetic data can improve the prediction of an upcoming recession. The framework for predicting an upcoming recession is to train a classification model to provide a probability that a recession will occur any time in the next 250 days. The challenge for these models is that when using available historic data, there are very few actual recessions for training and testing. In the range of dates for which Treasury yield data is available, there are only 8 recessions that have occurred. One of those recessions (2020) is a result of COVID-19, and could not possibly be predicted by economic factors. That leaves 7 recessions to train and test a model; however, with synthetic data, we are able to produce as many fake recessions as needed. 5.1 Generating data In order to build classification models to predict upcoming recessions, new synthetic data must be generated. The primary changes in this round of synthetic data generation is that a new attribute (metadata) was added to indicate a future recession and DoppelGANger was trained on a smaller set of data. The samples are also only 30 days long, rather than the 125 day samples created before. For this task, DoppelGANger was trained on the time period 01-02-1962 to 12-31-1984. This time period contains 4 recessions, which leaves 3 recessions for testing downstream predictive performance, as seen in Figure B.1. In addition to the indicator for a recession used in the previous training of DoppelGANger, an indicator for a future recession was added. This future recession indicator takes value 1 for samples in which a recession occurred any time in the 250 days following the sample, and 0 otherwise. In other words, this indicator labels each sample by whether or not it precedes a recession by at most 250 days. The features are still 1-year and 10-year Treasury yields, while the metadata now has two dimensions - recession indicator and future recession indicator. The generated samples from this version of DoppelGANger performed equally well in terms of fidelity metrics as the generated samples displayed in section 3. This iteration of DoppelGANger was also able to capture the correlation between features and the overall distributions of both 1-year and 10-year Treasury yields, but similarly struggled to capture the autocorrelation structure. Full metrics can be found in Appendix B. 5.2 Classification models To test if synthetic data can improve a model's ability to predict future recessions, two models were used - logistic regression and an LSTM classifier. The goal is to give these models the previous 30 days of 1-year and 10-year Treasury data as an input and produce a predicted probability that a recession will occur at some point in the following 250 days. Each sample of 30 days in the training data is paired with an indicator for whether or not a recession occurred in the 250 days following that sample, including the synthetic data which generated that future recession indicator as metadata. The logistic regression specification was treated like an autoregressive model in that each day in the 30 day sample was input as its own feature. In other words, each training sample had 60 features - 1-year and 10-year Treasury yields for the most recent day and 29 lags for each variable. In order to control for a large amount of features, the models were fit with an L1 regularization. This means that there was a penalty on the estimated coefficients which shrinks them toward zero and performs an automated form of feature selection to reduce the dimensionality of the model. The optimization problem for logistic regression under L1 regularization is (Lee, Lee, Abbeel, & Ng, 2006): min β M (cid:88) i=1 −log p(y(i)|x(i); β) + λ||β||1 Where β are the estimated coefficients and λ is a hyperparameter that controls the amount of regularization. The logistic regression uses a gradient descent algorithm to minimize the negative log-likelihood of the model with the added constraint that the L1 norm of the model be kept reasonably small. 9 Creating Disasters: Recession Forecasting with GAN-generated Synthetic Time Series Data The second model used was an LSTM-based classification model. It works in much the same way as the LSTM models used in the forecasting task of section 4, with the exception that it produces probabilities of recession rather than forecasting. The architecture of the LSTM classification model contained a single LSTM layer with a hyperbolic tangent activation function followed by a dropout layer, then a dense layer with 100 nodes and a hyperbolic tangent activation function. Finally, there was a dense layer with 2 nodes and a softmax activation to ensure that the model produced probabilities. This model was trained with a categorical cross-entropy loss function and an Adam optimizer for 50 epochs. A diagram of this model can be found in Figure C.2. Both the logistic regression and LSTM-based classifier were trained on samples of real data, synthetic data, and a combination of real and synthetic data. The real data comprised 30 day rolling window samples from 01-02-1962 to 12-31-1984, the same range of dates that trained DoppelGANger to produce synthetic data for the classification task. Thus, there were 5,701 real training samples. The synthetic training data comprised 50,000 30-day samples produced by DoppelGANger and their associated future recession indicator. The combined training data simply combined both the real and synthetic training samples into one training set. The output of each model is a probability of recession in the next 250 days based on the previous 30 days of 1-year and 10-year Treasury yield data. 5.3 Evaluating Recession Predictions The test set to evaluate each model's ability to predict future recessions covered the time period 01-02-1985 to 06-30- 2009. This time period contains 3 recessions, and thus provides the opportunity to see how strong of a signal each model produces leading up to a new set of recessions. This section attempts to evaluate the performance of each model at assigning high probabilities of recession in the days leading up to a recession and low probabilities when a recession is not imminent. It should be noted that performance in this setting is quite difficult to evaluate due to the somewhat subjective nature of the classification labels. It is somewhat arbitrary to say a recession signal is only good if it appears within 250 days of the recession. So while strong recession signals more than 250 days out are considered false positives for this paper's purposes, others may argue those are valid early signals. The other aspect to consider is that policy actions are often taken to prevent recessions that are not considered by these models. So while a high probability of recession may seem like a false positive, it is possible that the model was signaling a recession that may have occurred in the absence of policy action. With these caveats in mind, we will attempt to evaluate each model as objectively as possible. 5.3.1 Logistic Regression Performance The probability of recession predictions produced by each logistic regression model can be found in Figure 8. The model trained on only real data gives very weak signals, never producing a probability above 30 percent. The model trained on synthetic data follows much the same pattern as that of the model trained on real data, but produces much stronger signals, often reaching probabilities above 80 percent. The downside is that this model is much noisier. This is not surprising, as the synthetic data inherently contains more noise than the real data. The model trained on the combined data is similar to the model trained on synthetic data, though with a slightly weaker signal. It should be noted that the models that trained on additional synthetic recessions were better able to recognize upcoming recessions, but were also more sensitive to false positives. This can be seen in the period preceding the 2001 recession. The models trained with synthetic data gave very strong recessionary signals in 1996 and again in 1998-1999. The ROC curves (a graph that plots the true positive rate against the false positive rate) for each logistic regression model can be seen in Figure 10. A useful summary of classification performance is the area under the ROC curve (AUC). The higher the AUC, the better the predictive performance. In the case of logistic regression, the ROC curves are very similar. The model trained on real data has a slight edge over the other two. This follows intuitively from the fact that all three models tend to give the same signal, albeit at very different levels. Rescaling the real data model such that a 25 percent probability of recession is considered a strong indicator of an upcoming recession puts it in line with the other models, with the added benefit of less noise. So while synthetic data does not appear to improve performance for the logistic regression, it at least produces estimates that are comparable to a model trained on real data - a good sign that DoppelGANger has produced high-fidelity synthetic data. 5.3.2 LSTM Classifier Performance The probability of recession predictions produced by each LSTM classifier model can be found in Figure 9. Here, the benefits of synthetic data are much more clear. The model trained on only real data gives short-lived spikes in probability and produces strong false positives in the mid to late 1990s. It also gives no signal at all of the 2008 10 Creating Disasters: Recession Forecasting with GAN-generated Synthetic Time Series Data Figure 8: Probability of Recession as predicted by logistic regression Note: Grey areas indicate recession. Black dashed lines indicate 250 days prior to the start of the next recession. Source: NBER, author's calculations recession. The model trained on synthetic data provides more prolonged signals of recession and produces weaker false positive signals in the mid to late 1990s. Again, the synthetic data produces much noisier estimates. The model trained on the combined data largely follows the same patterns of the model trained on synthetic data with somewhat less noise. Both the synthetic data and combined data models provide weak signals leading up to the 2008 recession. The LSTM models trained with synthetic data appear to perform quite well at providing high probabilities just prior to recessions while not being overly sensitive to minor yield curve inversions. The LSTM models overall did a worse job of predicting the 2008 recession relative to the logistic regression models, but within the class of LSTM models, synthetic data clearly improved the ability to predict the 2008 recession. The ROC curves for the LSTM models can also be found in Figure 10. Here the AUC is clearly much higher for the model trained on synthetic data (0.86) and the model trained on combined data (0.81) than the AUC for the model trained only on real data (0.69). It appears that allowing the LSTM models to train on additional fake recessions does produce a significant improvement in predictive ability. 6 Conclusion GANs have shown great promise in generating synthetic data for a wide range of tasks. This paper serves as a proof of concept, showing that GAN-generated synthetic time series data can be useful in forecasting applications, particularly in economic settings. For US financial and economic data, there is only one history. Previously, economic forecasters had access only to the information provided by the limited recessions that have occurred and the single history of Treasury yields. With GANs, and particularly DoppelGANger, researchers and forecasters can now produce as many synthetic histories as they please. Models can be trained on a much larger number of recessions and learn from a much wider range of samples. This paper shows that although these synthetic recessions are merely replicating the conditions of the true recessions they were trained on, they can actually provide information above and beyond the true recessions when performing downstream predictive tasks. The models used in this paper for economic forecasting and recession prediction are fairly simple models that rely only on 1-year and 10-year Treasury yields. They are not fine-tuned or conditioned on other economic variables. They are merely illustrations of the comparative performance of simple models trained with real and synthetic data. This means that predictive performance could likely be vastly improved in future work by applying the synthetic data framework of this paper to more advanced econometric techniques, though that remains to be seen. Also note that despite the 11 19841988199219962000200420080.00.20.40.60.81.0Probability of RecessionProbability of Recession from Logistic RegressionProb. of Recession (Synthetic Data)Prob. of Recession (Combined Data)Prob. of Recession (Real Data) Creating Disasters: Recession Forecasting with GAN-generated Synthetic Time Series Data Figure 9: Probability of Recession as predicted by LSTM model Note: Grey areas indicate recession. Black dashed lines indicate 250 days prior to the start of the next recession. Source: NBER, author's calculations Figure 10: ROC curves for all probability of recession models Source: author's calculations difficulty in capturing long-term autocorrelations for Treasury yield data, many of the models trained with synthetic data were still able to show improvements over models trained with only real data. Further improving the fidelity of the synthetic data could potentially produce even greater improvements. In future work, this framework could be extended to a wide range of applications in which rare events need to be predicted - such as rare atmospheric events or the occurrence of disease - provided that high-fidelity synthetic data can be produced. This is certainly not the first paper to use synthetic data to improve predictive models, but it shows another useful application of the technique. As GANs and other machine learning techniques advance at a rapid pace, there is great potential for further exploration of how high-fidelity synthetic data can improve time series forecasting. 12 19841988199219962000200420080.00.20.40.60.81.0Probability of RecessionProbability of Recession from LSTMProb. of Recession (Synthetic Data)Prob. of Recession (Combined Data)Prob. of Recession (Real Data)0.00.20.40.60.81.0False Positive Rate0.00.20.40.60.81.0True Positive RateROC Curves for Logistic Regression ModelsLogistic Regression (Real), AUC= 0.9089Logistic Regression (Synthetic), AUC= 0.8983Logistic Regression (Combined), AUC= 0.90560.00.20.40.60.81.0False Positive Rate0.00.20.40.60.81.0True Positive RateROC Curves for LSTM ModelsLSTM (Real), AUC= 0.6871LSTM (Synthetic), AUC= 0.8559LSTM (Combined), AUC= 0.8114 Creating Disasters: Recession Forecasting with GAN-generated Synthetic Time Series Data Appendices A RNNs and LSTM This appendix is adapted from Chapter 10 of Goodfellow et al. (2016). Recurrent neural networks (RNNs) are a form of neural network designed to capture information from sequence data. The input data to RNNs are read sequentially, with information about previous inputs being stored as the RNN works its way through the sequence. The current state, h(t), is a function of all previous states processed before step t and current features, x(t). h(t) = f (h(t−1), x(t); θ) Where θ represents the parameters (weights) that the learning algorithm attempts to optimize. At each time step, the current state summarizes useful information from the current input, as well as all previous inputs, and then uses that summary as an input to the next time step. The advantage of using recurrence in this way is that the model can learn temporal patterns in the sequence of inputs. Using the same f and θ at each time step simplifies the training process to learning a single model for all time steps. An unrolled graph displaying an example RNN can be found in Figure A.1. Figure A.1: An example of an unfolded RNN graph Source: Author, based on Figure 10.3 of (Goodfellow et al., 2016) Note: U , V, W represent weights between layers. Not shown are activation functions that will accompany these weights. In Figure A.1, h(i) represents hidden states that are used as an input to the next time step, x(i) represents the features input at each time step, and o(i) represents the outputs of each time step. W represents the weights that parameterize connections between hidden layers, U represents weights between input layers and hidden layers, and V represents weights between hidden layers and output layers. o(t) will be compared to the target y(t) when computing the loss function for backpropagation. There are many different configurations of RNNS, and this chart represents one of the most simple configurations. Long-term interactions present in sequences can be hard to estimate with a standard RNN. As the gradients are back- propagated through a large number of time steps, they tend to become smaller and smaller until they vanish. It is also possible to create exploding gradients from exponential growth. In the more common case of vanishing gradients, time steps further back in the sequence will have very small gradients, thus making it difficult to learn long-term interactions. A popular way of dealing with the vanishing gradient problem is by using a gated RNN such as "long short-term memory" (LSTM) networks. The name long short-term memory refers to the fact that these networks capture the short-term changes in state from one step to the next (short-term memory), but also sometimes choose to keep past information for many steps (long-term memory) (Glassner, 2021). LSTM networks replace the hidden layers of the common RNN with LSTM "cells". These cells are composed of multiple networks. A network known as the "forget gate" controls how much past information to discard by moving weights on previous units toward zero. Another network known as "input gate" controls whether inputs should be accumulated into the current state. Finally, an "output gate" controls the cell's output. An LSTM cell can be seen in Figure A.2 The diagram of an LSTM cell displays the basic function of gates within the LSTM cell. The inputs (x(t) and h(t−1)) are provided to the input unit and each of the three gates. All of the gates use a sigmoid activation function. The 13 Creating Disasters: Recession Forecasting with GAN-generated Synthetic Time Series Data Figure A.2: A single LSTM cell. Cells replace the traditional hidden units of an RNN. Source: Author, based on Figure 10.16 of (Goodfellow et al., 2016) Note: Gates use a sigmoid activation function. input gate can "shut off" the input through a sigmoid function and thus determines what inputs to store in the current state. The state has a recurrent connection to itself (a self-loop) whose effect is controlled by the output of the forget gate. This effectively decides when it is appropriate to "forget" prior information. The output also has a gate with a sigmoid activation. Each gate is a network with its own input and recurrent weights to train. All of these gates allow for the LSTM network to dynamically control the amount of long-term memory that is relevant. Most importantly, this framework allows the gradients to backpropagate for long durations without vanishing or exploding. B Synthetic Data fidelity metrics for classification models The figures below display the fidelity metrics for the synthetic data generated for the recession classifier task. The correlation between 1-year and 10-year Treasury yields in the training samples was 0.950. The same correlation in the synthetic samples was 0.953. Figure B.1: U.S. Treasuries Yield Data Note: Grey areas indicate recession. The training sample contained 4 recessions, leaving 3 reces- sions for testing the classification models (the 2020 recession is excluded from the test set). Sources: Board of Governors of the Federal Reserve System, Federal Reserve Bank of St. Louis, NBER 14 1970198019902000201020200.02.55.07.510.012.515.017.5Percent1-year Treasury Yield10-year Treasury YieldTraining Data Cutoff Creating Disasters: Recession Forecasting with GAN-generated Synthetic Time Series Data Figure B.2: Comparison of real samples to synthetic samples for classifier Note: The top row contains true data samples from the training set. The bottom row contains generated data from DoppelGANger. Sources: Board of Governors of the Federal Reserve System, Federal Reserve Bank of St. Louis, NBER, author Figure B.3: Distributions of real and generated yields for classifier Source: author's calculations 15 0510152025303.03.23.43.63.84.0Yield (Percent)1-year Treasury Yield10-year Treasury Yield051015202530Days5.55.65.75.85.96.06.16.2Real Samples0510152025303.23.43.63.84.005101520253010.0010.2510.5010.7511.0011.2511.50Yield (Percent)Synthetic 1-year Treasury YieldSynthetic 10-year Treasury Yield051015202530Days6.86.97.07.17.2Synthetic Samples0510152025304.44.64.85.05.25.450510152025Yield0.000.020.040.060.080.100.120.140.16DensityDistribution of 1-year YieldsRealSynthetic50510152025Yield0.0000.0250.0500.0750.1000.1250.1500.1750.200DensityDistribution of 10-year YieldsRealSynthetic Creating Disasters: Recession Forecasting with GAN-generated Synthetic Time Series Data Figure B.4: Estimated autocorrelations for classifier Note: The synthetic and real (training samples) values are estimated as an average of autocorre- lations across many samples. The real (full data) autocorrelation is estimated on the full range of training data before being split into training samples. Source: author's calculations 16 051015202530lag (days)0.20.00.20.40.60.81.0Autocorrelation1-year Yield AutocorrelationsSyntheticReal (training samples)Real (full data)051015202530lag (days)0.20.00.20.40.60.81.010-year Yield AutocorrelationsSyntheticReal (training samples)Real (full data) Creating Disasters: Recession Forecasting with GAN-generated Synthetic Time Series Data C LSTM Model Diagrams Figure C.1: Diagram of network used for forecasting task Note: This diagram represents the LSTM model used for 1-day ahead forecasts. For 15-day ahead forecasts, the model was altered to allow for an output of shape 15x2. Source: Author Figure C.2: Diagram of network used for classification task Source: Author 17 Creating Disasters: Recession Forecasting with GAN-generated Synthetic Time Series Data References Arnelid, H., Zec, E. L., & Mohammadiha, N. (2019). Recurrent conditional generative adversarial networks for autonomous driving sensor modelling. In 2019 ieee intelligent transportation systems conference (itsc) (p. 1613- 1618). doi: doi:10.1109/ITSC.2019.8916999 Bernard, H., & Gerlach, S. (1998). Does the term structure predict recessions? the international evidence. International Journal of Finance and Economics. Board of Governors of the Federal Reserve System (US). (n.d.-a). Market yield on u.s. treasury securities at 10-year constant maturity, quoted on an investment basis [dgs10]. retrieved from FRED, Federal Reserve Bank of St. Louis. Retrieved from https://fred.stlouisfed.org/series/DGS10 (Date accessed: January 12, 2023) Board of Governors of the Federal Reserve System (US). (n.d.-b). Market yield on u.s. treasury securities at 1-year constant maturity, quoted on an investment basis [dgs1]. retrieved from FRED, Federal Reserve Bank of St. Louis. Retrieved from https://fred.stlouisfed.org/series/DGS1 (Date accessed: January 12, 2023) (2022). Create synthetic time-series data with doppelganger and pytorch. Retrieved from https:// Boyd, K. gretel.ai/blog/create-synthetic-time-series-with-doppelganger-and-pytorch Business cycle dating. (2023). Retrieved from https://www.nber.org/research/business-cycle-dating Estrella, A., & Hardouvelis, G. (1991). The term structure as a predictor of real economic activity. Journal of Finance. Estrella, A., & Mishkin, F. S. (1996). The yield curve as a predictor of u.s. recessions. Current Issues in Economics and Finance. Fawaz, H. I., Forestier, G., Weber, J., Idoumghar, L., & Muller, P.-A. (2018). Data augmentation using synthetic data for time series classification with deep residual networks. arXiv. Retrieved from https://arxiv.org/abs/ 1808.02455 doi: doi:10.48550/ARXIV.1808.02455 Federal Reserve Bank of St. Louis. (n.d.). Nber based recession indicators for the united states from the period retrieved from FRED, Federal Reserve Bank of St. Louis. following the peak through the trough [usrecd]. Retrieved from https://fred.stlouisfed.org/series/USRECD (Date accessed: January 12, 2023) Frid-Adar, M., Klang, E., Amitai, M., Goldberger, J., & Greenspan, H. (2018). Synthetic data augmentation using gan for improved liver lesion classification. In 2018 ieee 15th international symposium on biomedical imaging (isbi 2018) (p. 289-293). doi: doi:10.1109/ISBI.2018.8363576 Glassner, A. (2021). Deep learning: A visual approach. No Starch Press. Goodfellow, I., Bengio, Y., & Courville, A. (2016). Deep learning. MIT Press. (http://www.deeplearningbook .org) Goodfellow, I., Pouget-Abadie, J., Mirza, M., Xu, B., Warde-Farley, D., Ozair, S., . . . Bengio, Y. (2014). Gener- ative adversarial nets. In Z. Ghahramani, M. Welling, C. Cortes, N. Lawrence, & K. Weinberger (Eds.), Ad- vances in neural information processing systems (Vol. 27). Curran Associates, Inc. Retrieved from https:// proceedings.neurips.cc/paper/2014/file/5ca3e9b122f61f8f06494c97b1afccf3-Paper.pdf Karras, T., Laine, S., & Aila, T. (2018). A style-based generator architecture for generative adversarial networks. arXiv. Retrieved from https://arxiv.org/abs/1812.04948 doi: doi:10.48550/ARXIV.1812.04948 Kessel, R. A. (1965). The cyclical behavior of the term structure of interest rates. National Bureau of Economic Research Occasional Paper No. 91. Kingma, D. P., & Ba, J. (2014). Adam: A method for stochastic optimization. arXiv. Retrieved from https:// arxiv.org/abs/1412.6980 doi: doi:10.48550/ARXIV.1412.6980 Lee, S.-I., Lee, H., Abbeel, P., & Ng, A. (2006, 01). Efficient l1 regularized logistic regression. In (Vol. 21). Lin, Z., Jain, A., Wang, C., Fanti, G., & Sekar, V. (2020, October). Using GANs for sharing networked time series data. In Proceedings of the ACM internet measurement conference. ACM. Retrieved from https://doi.org/ 10.1145/3419394.3423643 doi: doi:10.1145/3419394.3423643 Mogren, O. (2016). C-rnn-gan: Continuous recurrent neural networks with adversarial training. arXiv. Retrieved from https://arxiv.org/abs/1611.09904 doi: doi:10.48550/ARXIV.1611.09904 Nikolenko, S. I. (2019). Synthetic data for deep learning. arXiv. Retrieved from https://arxiv.org/abs/ 1909.11512 doi: doi:10.48550/ARXIV.1909.11512 Zhu, J.-Y., Park, T., Isola, P., & Efros, A. A. arXiv. Retrieved from https://arxiv.org/abs/1703.10593 (2017). Unpaired image-to-image translation using cycle- doi: consistent adversarial networks. doi:10.48550/ARXIV.1703.10593 18
http://arxiv.org/abs/2302.10487v1
2023-02-21T07:29:43
2023-02-21T07:29:43
Classification with Trust: A Supervised Approach based on Sequential Ellipsoidal Partitioning
Standard metrics of performance of classifiers, such as accuracy and sensitivity, do not reveal the trust or confidence in the predicted labels of data. While other metrics such as the computed probability of a label or the signed distance from a hyperplane can act as a trust measure, these are subjected to heuristic thresholds. This paper presents a convex optimization-based supervised classifier that sequentially partitions a dataset into several ellipsoids, where each ellipsoid contains nearly all points of the same label. By stating classification rules based on this partitioning, Bayes' formula is then applied to calculate a trust score to a label assigned to a test datapoint determined from these rules. The proposed Sequential Ellipsoidal Partitioning Classifier (SEP-C) exposes dataset irregularities, such as degree of overlap, without requiring a separate exploratory data analysis. The rules of classification, which are free of hyperparameters, are also not affected by class-imbalance, the underlying data distribution, or number of features. SEP-C does not require the use of non-linear kernels when the dataset is not linearly separable. The performance, and comparison with other methods, of SEP-C is demonstrated on the XOR-problem, circle dataset, and other open-source datasets.
[ "Ranjani Niranjan", "Sachit Rao" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10487v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10487v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 7 8 4 0 1 . 2 0 3 2 : v i X r a CLASSIFICATION WITH TRUST: A SUPERVISED APPROACH BASED ON SEQUENTIAL ELLIPSOIDAL PARTITIONING A PREPRINT Ranjani Niranjan International Institute of Information Technology Bangalore Bangalore, India [email protected] Sachit Rao International Institute of Information Technology Bangalore Bangalore, India [email protected] February 22, 2023 ABSTRACT Standard metrics of performance of classifiers, such as accuracy and sensitivity, do not reveal the trust or confidence in the predicted labels of data. While other metrics such as the computed prob- ability of a label or the signed distance from a hyperplane can act as a trust measure, these are sub- jected to heuristic thresholds. This paper presents a convex optimization-based supervised classifier that sequentially partitions a dataset into several ellipsoids, where each ellipsoid contains nearly all points of the same label. By stating classification rules based on this partitioning, Bayes' formula is then applied to calculate a trust score to a label assigned to a test datapoint determined from these rules. The proposed Sequential Ellipsoidal Partitioning Classifier (SEP-C) exposes dataset irregu- larities, such as degree of overlap, without requiring a separate exploratory data analysis. The rules of classification, which are free of hyperparameters, are also not affected by class-imbalance, the underlying data distribution, or number of features. SEP-C does not require the use of non-linear kernels when the dataset is not linearly separable. The performance, and comparison with other methods, of SEP-C is demonstrated on the XOR-problem, circle dataset, and other open-source datasets. Keywords Supervised Classification, Prediction with Trust, Ellipsoidal approximation, Convex Optimization 1 Introduction With the availability of labelled data, supervised-learning based classifiers have found applications in many domains. The performance of the classifier is dependent on the characteristics of the dataset itself, such as class imbalance, overlap, and outliers; such characteristics are usually identified by the additional process of Exploratory Data Analysis (EDA). In this paper, we present a classifier that simultaneously reveals the nature of the dataset, without the need of an EDA, and determines the trust, or "confidence measure" as denoted in the literature, in the prediction of a label by the classifier. Generating a trust score enables a user to override/accept the classifier's output, as required in Active Learning applications. In the proposed classifier, which we term as the Sequential Ellipsoidal Partitioning Classifier (SEP-C), we first deter- mine a hyperplane, akin to that in Support Vector Machines (SVMs), to separate datapoints from the training dataset of different labels; second, iteratively determine non-overlapping Minimum Volume Ellipsoids (MVEs), [1, 2, 3], that cover these points, using the Reduced Convex Hull (RCH) Algorithm, [4]; and third, remove the covered points from the dataset. This process is carried out until no points remain uncovered in the dataset or the independence-dimension Classification by Sequential Ellipsoidal Partitioning A PREPRINT inequality is violated, [5]. It is highlighted that in each iteration, the RCHs themselves are found iteratively and is not dependent on a single user-defined choice, as discussed in [4]. The removal of points in each iteration renders this approach as a sequential one and in each iteration, a different hyperplane is found. Once the training dataset is partitioned into several MVEs, the trust in the predicted label of a test datapoint is calculated based on classification rules and Bayes' formula. These rules involve determining in which ellipsoid, or ellipsoids as the case may be, a test points lies; if a test point does not lie in any of the ellipsoids, the ellipsoid closest to it is expanded to contain it and a rule is applied. Consider a binary classification case and let a test point be contained in a single ellipsoid, say ET . Applying Bayes' formula, the resulting trust score, which is a conditional probability, is conditioned on the number of training set points of both labels that are contained in ET . Thus, if ET contains majority of points of one label, then the trust in the prediction of that label is high. On the other hand, if the dataset has significant overlap and a test point lies in ellipsoid(s) that contain nearly equal number of points of both labels, then, clearly the trust in predicting either label is close to 50%; the trust score determined this way can aid the user in abstaining from assigning a label to that point. While SEP-C emphasises the formation of non-overlapping MVEs, if the dataset is heavily overlapped, then, the partitioning algorithm may terminate in the first iteration itself, thus making it similar to the conventional SVM. In such cases, SEP-C allows for a user-defined number of points of one label to be contained in the MVE of points of another label; this number is the lone design parameter of SEP-C. With this approach, as we show, points that are "far" from the overlapping region can be assigned a label with a high trust. Conformal prediction has been suggested as a method to measure the confidence in the output of a classifier, [6, 7]. In this approach, prediction regions that contain the true label of a test data point with probability (1 − (cid:15)) are defined. The generation of such regions is based on calculating a nonconformity measure, which essentially is a measure of how "different" the test data point is when compared with the observed data points. For a binary SVM, the nonconformity measure is calculated using the widest interval that separates the 2 classes with minimum errors. Next, depending on where the test data point lies with respect to this interval, one of the nonconformity measure values is assigned to this data point. A probability value, py, is then calculated using nonconformity measure values calculated for all the observed data points. If py > (cid:15), then, the confidence of the predicted label is assigned as (1 − (cid:15)). This technique can result in regions being empty or containing multiple labels. In both cases, the calculated confidence measure does not yield the desired trust. In [8], an explainer model is demonstrated that can be used to explain the results of any classifier; this method uses a distance-metric and a function that represents the classifier. We now review results in the literature which share similarities with one or more components of SEP-C. In the context of overlapping datasets with/without outliers, hyperplane-based methods are designed under the assumption of linear separability or no-overlap; this approach is prone to classification errors. Although the classical SVM can handle nonlinear structures in the dataset with the use of kernel trick, it is a single hyperplane that is used for classification; our approach, where multiple linear hyperplanes are defined, can be used for datasets that are not linearly separable. A variant of SVMs, denoted as the Ellipsoid SVM, is presented in [9], where MVEs that cover points belonging to the same label are found that are also separated by some margin; the ESVM finds a single ellipsoid per label and requires the kernel trick for certain datasets, while SEP-C finds several MVEs and does not require the use of any kernel. A strategy adopted to minimise the effects of overlap is to remove overlapping features or by merging them, [10]. In [11], it is suggested that more than one hyperplane is required to solve the classification problem when data is not linearly separable, though no mathematical proofs have been presented to support this. Outliers can be removed from datasets using methods suggested in [12, 13, 14]. Distance and density-based methods of outlier detection indicate that a single hyperplane classifier is unable to detect outliers efficiently. Trust in the outputs of SVMs has also been considered in the literature. Trust is computed by converting the SVM output to a posterior probability. In [15], a distance metric, calculated as the output of a sigmoid function, is used to determine the posterior probability; a variant of this method is described in [16]. A modified SVM classifier that can reject its output if the predicted output satisfies some conditions is presented in [17]. For Active Learning, [18], a histogram-based binning technique is suggested that converts the SVM output into a posterior probability; SVM margins and a confidence factor for this application are proposed in [19]. It is again highlighted that all these approaches use a single hyperplane. Sequential ellipsoidal approaches have been presented, mainly for clustering or outlier detection, [20]. A "difference- of-squares" minimisation method is proposed in [21] that performs ellipsoidal fitting to points in n-dimensional space. An algorithm, denoted as the Bubble Clustering algorithm is presented in [22] that aims to cover points as a union of k MVEs; a similar problem is addressed in [23], where a dataset is partitioned into E ellipsoids. It is highlighted that in both these approaches, k and E are user-specified parameters. In SEP-C, there is no need to specify the number of ellipsoids; they are found as a consequence of the algorithm. The only user-defined input is the number of mis- classifications that are permitted while separating points of different labels - the first step of SEP-C. In an application of cell segmentation, [24], an algorithm that approximates any 2-dimensional shape using ellipses is presented. This algorithm does not require the number of ellipses to be specified a priori; they are determined based on the degree of overlap of multiple ellipses - those that have a large overlap and do not contribute to additional information are 2 Classification by Sequential Ellipsoidal Partitioning A PREPRINT removed. Ellipsoidal partitioning is analogous to approximating the distribution of any dataset with the use of finite Gaussian mixture models, [25, 26]. The notable use of Gaussians in classification is in the Bayesian classifier, [27], where each attribute is modeled as a mixture of Gaussians. As SEP-C can be used as a basis to abstain from making predictions, this feature is markedly different than tree-based induction rule techniques, where, if a test point belongs to a leaf that contains equal number of points of both labels, this test point is assigned the majority class label. The use of such inductive algorithms is adopted in [28] to extract rules in SVMs, where, labels of points misclassified by a trained SVM is changed and next, new points are generated in the vicinity of the support vectors; see [28] of other rule-generation based methods for SVMs, such as [29, 30], and their challenges. It is noted that the mere stating of rules does not indicate the trust in prediction of a test datapoint. The motivation with these approaches is to reduce the "black box" characteristics of SVM-type classifiers; we believe that classification from ellipsoidal partitioning can answer the question of "why this label?", as predicted by SEP-C. is free of hyperparameters, say as used in the SVM cost function; iii. The main contributions of SEP-C are that it i. uses convex methods at every step, and hence, the problem of local minima is avoided; ii. implicitly contains multiple hyperplanes, thus allowing for non-linearly separable datasets to be handled; iv. presents a landscape of the dataset, for instance, by determining the degree of overlap of points of more than one label; and v. calculates trust in prediction, that is based on finding points of the same label in the vicinity of the test point. SEP-C can also handle multi-class datasets by adopting the one-vs-all approach. We also believe that SEP-C can be used for data generation and the identification of small disjuncts, but we defer this to future work. As we show in the Results section, ellipsoidal partitioning is quite similar to the regions formed by the rules that lead to leaf nodes, from the root, in Decision Trees (DTs); however, the regions in DTs can be unbounded, while the ellipsoids are not. 2 Preliminaries In this section, the problem statement, ellipsoidal representations, and the key convex optimization problems (CPs) and their solutions that form the main components of SEP-C are briefly described. The conditions that lead to these CPs being feasible are also highlighted. 2.1 Problem Statement The classifier proposed in this paper focuses on developing rules of classification for a dataset with points denoted by the sets X = {xi}, xi ∈ (cid:60)n, i = 1, * * * , N and Y = {yj}, yj ∈ (cid:60)n, j = 1, * * * , M , where N ≥ M > 2, the points in set X have label L+1, and those in Y have label L−1. Note that a multi-label classification problem can be expressed as a binary classification problem using the one-vs-all approach. Similar to most classifiers, a part of the dataset is used to "train" the classifier and the remaining for testing and validation. The sets X and Y can overlap, such as the 2-dimensional (2-D) synthetic dataset shown in Fig. 1a, where the points marked in blue, say belong to X , and the ones in red belong to Y. (a) (b) Figure 1: 1a: 2-D Synthetic Overlapping Dataset; 1b: Ellipsoidal partitioning using SEP-C 2.2 Ellipsoidal Approximation of a Dataset For the sets X and Y shown in Fig. 1a, MVEs, denoted by EX and EY , respectively, can be found such that each ellipsoid contains points of the respective set either in its interior or its boundary; these ellipsoids are also known as the Löwner-John ellipsoids. An ellipsoid can be expressed in the form E = {z | (cid:107)Az + b(cid:107) ≤ 1}, z ∈ (cid:60)n, where A ∈ (cid:60)n×n is a positive-definite matrix and b ∈ (cid:60)n. An alternative representation of this ellipsoid is given by the quadratic form resulting from expanding the 2-norm used in E. 3 Classification by Sequential Ellipsoidal Partitioning A PREPRINT Now, given N such points zi, the MVE that covers these points, which is unique, is found as the solution to the convex optimisation problem (CP) min subject to log det (cid:0)A−1(cid:1) (cid:107)Azi + b(cid:107) ≤ 1, i = 1, * * * , N, (1) with A and b as the variables, [1]. It is highlighted that for the CP (1) to be feasible, the independence-dimension (I-D) inequality has to be satisfied, that is, N > n, [5]. The MVEs EX and EY , found by solving (1) are shown in Fig. 1a by the blue and red lines, respectively. It can be seen that EX and EY intersect since the points of both labels overlap with each other. The region of intersection can be approximated by an outer ellipsoid, denoted by EInt = {v | (cid:107)AIntv + bInt(cid:107) ≤ 1} by solving the CP min subject to (cid:1) log det (cid:0)A−1 Int  AInt bInt bT Int −1 0 0 bT Int bInt −AInt τ1 ≥ 0, * * * , τj ≥ 0,    ≤ (cid:88) τj j=X,Y   Aj bj bT cj j 0 0  0 0  0 (2a) (2b) where, Aj, bj, and cj are given by the quadratic representations of the the ellipsoids Ej, j = X, Y . In (2), the con- straints (2b) are Linear Matrix Inequalities (LMIs). Intersection of ellipsoids can also be determined by the algorithm presented in [31, Sec. 15], where a different representation of an ellipsoid is used. The result in [31] is connected to the Separating Hyperplane Theorem, which states that for two disjoint convex sets, a hyperplane that separates these sets can be found. Thus, if the ellipsoids, which are convex, indeed satisfy the property EX ∩ EY = ∅, then, a hyperplane that strictly separates these ellipsoids exists; this hyperplane now acts as a classifier. The properties of EInt, such as its volume as well as the number of points contained within it, indicate the degree of overlap between the two sets X and Y. If this ellipsoid is dense as well as "large", then, it can be expected that many points that have different labels are close to each other. The ellipsoid EInt is marked in green in Fig. 1a. As can be expected, it is hard to classify the points that lie in the intersection region accurately. The CP (2) is solved using the CVX solver, [32], and the resulting solution is a ball for EInt, which is clearly an over-approximation of the overlapping region. A better approximation can be found by finding the MVE that covers the points that are contained both in EX and EY . It should be noted that the points in the overlapping region should again satisfy the I-D inequality, while the CP (2) can be applied even if the ellipsoids do intersect, but the region of overlap is empty. SEP-C is in fact developed to partition such overlapping datasets into smaller, and possibly non-intersecting, ellipsoids, each of which contain points of the same label. The result of such partitioning using SEP-C is shown in Fig. 1b. 2.3 Reduced Convex Hull Algorithm The RCH algorithm, [4], that forms a primary component of SEP-C is briefly described. The main motivation to apply the RCH algorithm is its ability to minimise the influence of outliers and overlap in classification. By defining the matrices X ∈ (cid:60)N ×n and Y ∈ (cid:60)M ×n, where, each row of these matrices contains the datapoints xi and yj, respectively, the RCHs of the sets X and Y are the set of all convex combinations c = XT u and d = YT v, respectively, where, u = [ui] ∈ (cid:60)n, v = [vi] ∈ (cid:60)n; (cid:80) ui = 1, 0 ≤ ui ≤ D, (cid:80) vi = 1, 0 ≤ vi ≤ D; and the scalar D < 1. If the sets are balanced, that is, N = M , the parameter D is chosen as D = (1/K), where, K ≤ N ; in [4], D is a design parameter. With the assumption that the RCH is non-empty for some D < 1, the RCH algorithm finds the closest points in each RC-Hull by solving the CP min u,v subject to (cid:13) (cid:13)XT u − YT v(cid:13) 2 (cid:13) 1 2 eT u = 1, eT v = 1, 0 ≤ u, v ≤ De. (3) The vector eT = [1 1 * * * ]. Now, if the solution to this CP exists for some D < 1, the RC-Hulls do not intersect and thus, the line normal to the line connecting the closest points is the separating hyperplane. Consider the 2-D synthetic dataset with two labels as shown in Fig. 2a; the convex hull and the MVE of each set are also shown. Solving the CP (3) results in the RCHs for the two sets, as shown in Fig. 2b. As can be seen, the original CHs and MVEs of both sets of points intersect, while the RCHs, found for some value of D, do not. As discussed in [4], the RCH algorithm is the dual of widening the margin in the classical SVM; this widening is performed to permit classification errors. Another similarity of the RCH approach is with the ν-SVM classifier, [33], 4 Classification by Sequential Ellipsoidal Partitioning A PREPRINT (a) (b) Figure 2: 2a: Intersecting CHs, and MVEs, of the two sets; 2b: RCHs, and MVEs, that are non-intersecting (solid lines) where the user-defined parameter ν ∈ [0, 1] influences the cost function that is minimised and also has an upper-bound that is related to number of datapoints and SVs that are misclassified. In SEP-C, the RCH algorithm is implemented differently. In place of the user-defined parameter D = (1/K), begin- ning with K = min(N, M ), the CP (3) is solved iteratively, where K is reduced in each iteration, until such time that the RCHs of both sets do not intersect or the RCH of points of one label contain a few points of the other; the choice of number of such points is clarified in the section on description of SEP-C. We demonstrate that this approach leads to a trust score calculation with better interpretability and leads to some degree of partitioning in heavily overlapping datasets. In addition, experiments on synthetic datasets (not presented in this paper) indicates that this approach al- lows for imbalanced datasets to be handled. Further, to determine that the RCHs indeed do not intersect, the check on intersection is performed on the MVEs that cover them. The RCHs intersect if their respective MVEs intersect. This approach is selected to minimise computational cost, especially for high-dimensional datasets. 3 Main Results: SEP-C As mentioned in the Introduction, SEP-C is based on partitioning the training dataset into ellipsoidal regions, such that, as much as possible, each ellipsoid contains points with the same label. With the identification of such regions, the classification rule for a new test point is simply to identify which ellipsoid it lies in and predict the label of the test point based the number of training points of either label that are contained in that ellipsoid. With this basic idea, first, the method followed to find such ellipsoidal regions is described. Next, the classification rule accompanied by a trust or "odds" measure is presented. 3.1 Ellipsoidal Partitioning The ellipsoidal partitioning component of SEP-C is described in Algorithm 1; the notation |X | denotes the number of points in the set X and X \ Y denotes the difference of sets X , Y. This algorithm invokes the RCH algorithm, which is presented in Algorithm 2. Alg. 1 consists of two user-defined parameters: the integers n > 0, which denotes the dimension of the feature space, and nImp ≥ 0, which denotes the number of permitted misclassifications. The roles of these parameters are clarified in the following sections. 3.1.1 First Partition To find the first ellipsoidal partitions, it is assumed that the sets X , Y satisfy the I-D inequality, that is, they contain more points than the dimension of the feature space. Now, with D = min(N,M ) , where N = |X | and M = |Y|, the RCH algorithm, Alg. 2, finds the SVs c and d (line 12 in Alg. 2) as well as the hyperplanes passing through these SVs; these are of the form z(cid:48)w = α and z(cid:48)w = β, respectively. Consider the simple case when these SVs are some distance apart. Now, the points in X , Y that can be separated using these hyperplanes are identified (lines 13-14 in Alg. 2); these points form the sets X +, Y −, which are covered by the MVEs EX + and EY − , respectively. Note that though the choice of D = min(N,M ) does lead to RCHs of at least one set, say X if N > M , or both X and Y if N = M , the RCHs, and corresponding MVEs, of either set can still contain a few points of the other; this result is dependent on the nature of the dataset. The references [4, 34] only indicate that the CHs reduce for D < 1, but present no results that for a specific value of D, the RCHs contain points of only one label. 1 1 5 Classification by Sequential Ellipsoidal Partitioning A PREPRINT (cid:1) ← RCH (X , Y) i , EX + , EY − i , Y − i = ∅ or Y − Datasets X and Y cannot be separated further break i = ∅ then else (cid:0)X + if X + Algorithm 1 Ellipsoidal Partitioning 1: i ← 1 2: EX , EY ← MVEs of X and Y 3: X +, X −, Y +, Y − ← ∅ 4: E +, E − ← ∅ 5: nImp ≥ 0 6: n > 0 7: while |X | > n and |Y| > n do 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: end while 27: if |X |(or |Y|) ≥ n then 28: 29: else 30: 31: end if while |Y ∈ EX + | ≥ nImp do i ← RCH (cid:0)X + X + end while while |X ∈ EY − | ≥ nImp do i ← RCH (cid:0)Y − Y − end while X + ← {X + i ← MVE (cid:0)X + E + E + ← {E + X ← X \ X + i , Y ← Y \ Y − i EX , EY ← MVEs of X and Y i , X (cid:1) i }, Y − ← {Y − i } E + (E −) ← MVE of X (Y) end if i ← i + 1 i , Y(cid:1) i ← MVE (cid:0)Y − (cid:1) , E − i }, E − ← {E − i } i i Consider points in X (Y) as individual ellipsoids (cid:46) Number of points of one label allowed in the set of another (cid:46) Dimension of the feature space (cid:46) Ensure I-D condition is satisfied (cid:46) RCH Algorithm (cid:46) Subset of X containing no greater than nImp points of Y (cid:46) Subset of Y containing no greater than nImp points of X (cid:1) (cid:46) CP (1) Algorithm 2 RCH Algorithm Datasets X and Y are disjoint sets X + ← X , X − = ∅ Y − ← Y, Y + = ∅ break Input: Two datasets X and Y with different labels Output: X +, Y − and their respective MVEs EX +, EY − 1: D ← 1/ min(|X |, |Y|) 2: X, Y ← Matrices with elements of X and Y, respectively 3: EX , EY ← MVEs of X and Y, respectively 4: if EX ∩ EY = ∅ then 5: 6: 7: 8: 9: else 10: 11: 12: 13: 14: 15: 16: end if u, v ← Solution to CP (3) using D, X, and Y c ← XT u, d ← YT v w = c − d, α = cT w, β = dT w X + ← {xi : x(cid:48) Y − ← {yj : y(cid:48) EX + ← MVE of X +, EY − ← MVE of Y − iw ≥ α}, i = 1, * * * , N jw ≤ β}, j = 1, * * * , M 6 (cid:46) Solve CP (1) (cid:46) Solve CP in [31, Sec. 15] (cid:46) Points in the CHs of X and Y (cid:46) Parameters of hyperplanes through c, d (cid:46) Points of X that lie on one side of the hyperplane (cid:46) Points of Y that lie on the other side of the hyperplane Classification by Sequential Ellipsoidal Partitioning A PREPRINT Suppose EX + and EY − contain fewer than nImp ≥ 0 points of the other label, then, EX + and EY − become the first ellipsoidal partitions. On the other hand, if one of them fails this condition, say EX +, then, the RCH algorithm is min(|X +|,|Y|) (lines 13-15 in Alg. 1). Note that |X +| < |X | reapplied on the sets X + and Y with the choice D = if the dataset is not linearly separable, while |X +| = |X | otherwise. Thus, in the former case, the RCH algorithm min(|X +|,|Y|) in every iteration, such that X + contains a is repeatedly applied on the sets X +, Y, by choosing D = few points of X and no more than nImp points of Y - at the end of these iterations emerges the the reduced CH, and MVE, of X . The same procedure is applied to Y −, if needed. Fig. 2b shows these first partitions of the 2-D synthetic dataset shown in Fig. 2a; the value of nImp = 10 is used. Since the CHs reduce in each iteration, the MVEs in the final iteration are expected to be non-intersecting. 1 1 Remarks: i. The nImp ≥ 0 points that are permitted may be interpreted as being "impure" points, borrowing the terminology of DT classifiers. In the ideal case, nImp = 0 should be the only choice exercised by the user. ii. It can happen, for some value of nImp, that the set X +, or Y −, violates the I-D inequality, for example, (|X +| + nImp) < n. In this case, since an MVE cannot be found that covers these points, these are retained as isolated points. This situation can occur if the dataset has heavy overlap with only a few points of either label that can be "separated". iii. Suppose N = M , that is, the datasets are balanced, then, with this choice of D, the solutions c and d are the centroids of the sets X and Y, respectively; this result is also demonstrated in [34]. On the other hand, when N > M , the solution d is the centroid of Y, while the solution c leads to an RCH of X that has shrunk non-uniformly towards the centroid of X , [34]. iv. The RCH algorithm aims to find c and d that are separated from each other by a non-zero distance. If this fails, as we show for the 2-D XOR problem, then, infinite number of separating hyperplanes that contain c and d can be found. In such cases, alternative interpretations of the partitions are provided. 3.1.2 Further Partitions Having obtained the first partitions, the points contained in X + and Y − are removed from the dataset - lending the sequential component of SEP-C - and the process is continued for the smaller sets X \ X + and Y \ Y − (line 22 in Alg. 1). Note that if the points are linearly separable, then X \ X + = ∅ and Y \ Y − = ∅; now SEP-C terminates since both sets violate the I-D inequality. On the other hand, if the dataset has some overlap, then, partitioning happens for the points that lie within or close to the region of overlap. For example, as shown in Fig. 1b, for the points marked in blue, the first partition is the left-most ellipse and the subsequent elliptical partitions are found from left to right; for the points marked in red, the opposite is true. As is expected, since these ellipses focus on the points in the overlap region, these can be expected to overlap as well. 3.1.3 Terminal Partitions SEP-C is guaranteed to terminate in a finite number of iterations. The conditions for termination are when either all points have been partitioned and the RCH algorithm fails (line 8 in Alg. 1) to find even further RCHs for each set or the points of one set violate the I-D inequality. Since one of these conditions is bound to hold true, simply because the training set starts with a finite size, which keeps reducing in every iteration, SEP-C is bound to terminate as well. The number of iterations is again dependent on the dataset; as we show in the Results section, different training sets require different number of iterations. Note that when SEP-C terminates, there could be a few points of each label that cannot be covered by an MVE, in this case, these "leftover" points are treated individually (line 30 in Alg. 1). In the case of imbalanced datasets, where the datapoints of the minority class are fully partitioned, but some from the majority class remain to be partitioned, lines 27-31 in Alg. 1, ensure that the remainder of the majority class are covered by an MVE. 3.2 Features of the Algorithm The main feature that is immediately evident is that since partitioning happens sequentially - essentially on a different subset of the training set in each iteration - SEP-C finds multiple hyperplanes. This feature is unlike traditional SVM classifiers and their variants, where a single hyperplane is formulated by solving a CP. As will be shown in the Results section, especially for the non-linearly separable datasets, these multiple hyperplanes can be interpreted as being a piece-wise linear approximation of the non-linear separating hyperplane. Further, SEP-C also adopts an iterative approach in implementing the RCH algorithm, rather than a single choice to find these RCHs. Multiple MVEs are found, rather than multiple convex hulls, since, in higher dimensions, computing convex hulls can be computationally expensive, [35]. Each of the MVEs, of the form E = {v | (cid:107)Av + b(cid:107) ≤ 1}, that partition the dataset can be interpreted as one that models the dataset as a local multivariate normal distribution - the centre of the ellipsoid, b, is the mean and the matrix, A, is the covariance matrix. While the GMM approach similarly models a dataset as being composed of several normal distributions, the number of mixtures is a user-defined input in the GMM, while in our approach, the number of such mixtures is a result of the nature of the dataset. 7 Classification by Sequential Ellipsoidal Partitioning A PREPRINT SEP-C uses the user-defined parameter nImp to find the MVEs in each iteration. As we discuss next, this aspect makes the rules of classification more interpretable, in comparison with the use of regularisation parameters in SVMs, where the width of the margin is varied to allow for classification errors. The conscious inclusion of nImp number of misclassifications ensures that the MVEs obtained in any iteration do not become "small" and also limits the number of iterations that the algorithm uses. The nImp > 0 number of "impure" points could be owing to outlier datapoints of one label. As we discuss in the section on classification rules, the inclusion of these "impure" points considers the influence of such points explicitly in predicting the label of a new datapoint. It is highlighted that the algorithm does not need for outliers to be removed prior to its application and further, their locations in one or more MVEs are now known. The ellipsoidal partitions obtained using Alg. 1 are used to state the rules of classification of a new test point. Briefly, the test datapoint is assigned a label based on which ellipsoid contains this point and the number of training datapoints of either label that are also contained within that ellipsoid. This feature of the algorithm is presented next. 3.3 Rules of Classification SEP-C is a type of sequential-covering algorithm, [36]. In such algorithms, a single rule is learnt that can distinguish a subset of positive and negative examples. The datapoints covered by this single rule are then removed from the dataset and new rules are learnt on the remaining data. Each rule is expected to have high accuracy but is not expected to cover all examples from the training set. Accuracy is again measured in terms of some performance measure on the training examples, for example, the number of correct predictions. In SEP-C, the rules of classification are based on the MVEs found by partitioning; we have designed SEP-C for binary classification. Let the partitioned ellipsoids E + k , k = 1, 2, * * * , be those that correspond to points with label L+1 and E − j , j = 1, 2, * * * , correspond to label L−1. The performance measure that forms the basis of partitioning is by determining the MVEs that mostly contain points with the same label and at most nImp number of the other label; thus, high accuracy in partitioning can be expected as each partition correctly classifies those examples contained within it. Note that each of the MVEs, for example, as shown in Fig. 1b, cover only a part of the dataset. With this approach, rules of classification of a new test point are considered for the following cases: When the test point is Case 1 contained within only one of the MVEs E + Case 2 contained in the region of intersection of one or more MVEs E + Case 3 not contained in any of them. k or E − j ; k and E − j ; and As we show, Cases 1 and 2 may be considered when one or more rules covers the test point and Case. 3 for the case when the test point is not covered. In standard sequential-covering algorithms, a test point that is not covered by any of the rules is usually assigned the default class. To avoid resorting to this situation, we propose a rule under Case 3. Case 1: Let z1 denote test datapoint that is contained in only one of the ellipsoids. For this point, its label is assigned according to the rule R1: Label of z1 = (cid:26)L+1 L−1 if z1 ∈ E + k if z1 ∈ E − j (4) This assignment of the label to z1 is natural as the MVEs are partitioned with high accuracy, or its control based on nImp. Suppose z1 ∈ E + k intersects with one or more MVEs from either E + or E −. In such cases, it may happen that z1, now the label L+1, is "close" to points with label L−1 leading to a possible misclassification; proximity between points can be measured, say using Euclidean distance or similar measure. Although misclassification can be identified only a posteriori, we propose a trust-scoring mechanism by which the possibility of misclassification can be highlighted; this is considered explicity in the next section. k , but E + Case 2: Let z2 denote the test datapoint that is contained in the region of intersection of two or more MVEs, Ev, v = k, j; denote RInt = (cid:84) v=k,j Ev as the region of intersection. This case can be further classified into: if RInt contains i. a non-zero number of points with both labels from the training set and ii. only z2. For the first case, the rule of classification is R2a: Label of z2 = (cid:26)L+1 L−1 if |X ∈ RInt| > |Y ∈ RInt| if |X ∈ RInt| < |Y ∈ RInt| , and for the second, R2b: Label of z2 = (cid:26)L+1 L−1 if |X ∈ EU | > |Y ∈ EU | if |X ∈ EU | < |Y ∈ EU |, 8 (5) (6) Classification by Sequential Ellipsoidal Partitioning A PREPRINT where EU = (cid:83) The case when the strict inequality does not hold, either in (5) or (6), is considered in Sec. 3.4. v=k,j Ev. Case 3: Let z3 be the test point that satisfies this case. Now, we find the MVE, say Ew, that is closest to this test, expand Ew to cover this point, and then apply rule R1, or one of rules R2a or R2b, to assign the label to this point. The point z3 now lies on the boundary of Ew. Note that determining the distance between a point and an ellipsoid is also a CP, [31]. It can happen that z3 is equidistant from more than one MVE. Now, each of these MVEs is expanded to cover this point and rules R1 or R2 are applied. It can be observed that the rules proposed are mutually exclusive, for example, a test point cannot lie in a single MVE and simultaneously lie in a region of overlap of several MVEs. The same holds for the other rules as well. As argued in [37], for mutually exclusive rules, they do not need to be ordered in any way or their combination be checked prior to assigning a label to a test point. Since the rules R1 and R2 are based on the partitioned MVEs, we subscribe to the statement in [37] that "each rule in itself represents a part of the input space and can be considered as a nugget of knowledge" and consider each MVE as a "nugget of knowledge". 3.4 Trust in Classification The rules presented do not provide any additional measure of trust or confidence in the prediction; such a trust cal- culation is also missing in the cited references that propose rules for SVMs. For example, let a test point get a label according to Rule R1, (4). In SEP-C, we ask the additional question: "Can this prediction be trusted?" This question is important since, even though the MVEs found in each iteration do not overlap with each other, when all MVEs are considered, some may overlap with each other, such as shown in Fig. 1b. Such overlaps typically occur close to the main region of overlap of the dataset itself; see the MVE marked in green in Fig. 1a. In addition, SEP-C permits the inclusion of nImp ≥ 0 number of "impure" points. Thus, the question posed on trust helps answer if the prediction is possibly "more correct" if an MVE, or the overlapping region of MVEs, contains more points with one label than the other along with impure points. We calculate trust in classification of a test point as a conditional, or posterior, probability determined from Bayes' theorem, in the form P (L+1|Ev) = P (Ev|L+1)P (L+1) P (Ev) = P (Ev|L+1)P (L+1) P (Ev|L+1)P (L+1) + P (Ev|L−1)P (L−1) , (7) where, Ev is the MVE that contains the test point and P (L+1) (or P (L−1)) is the prior probability of the point having label L+1 (or L−1). By considering Ev as either the intersection of two or more MVEs, or even their union, the formula (7) is applicable for all the stated rules. In (7), the prior probabilities P (L+1) and P (L−1) are determined based on the number of occurrences of points of these label in the training set and the predicted label of the test point. Thus, P (L+1) = N + 1 N + M + 1 , P (L−1) = 1 − P (L+1), (8) where, N and M are the number of points in the training dataset with labels L+1 and L−1, respectively. In addition, if n number of points with label L+1 and m number of points with label L−1 are contained within Ev, then, the conditional probabilities P (Ev|L+1) = n + 1 n + m + 1 , P (Ev|L−1) = 1 − P (Ev|L+1). (9) Based on these values, the trust in prediction can be computed as a posterior probability. We demonstrate this calculation for a few simple cases. Let the test point, z, be contained in an MVE, E + let E + now, Rule R1 is triggered and z gets the label L+1. From (7), the trust in this prediction is given by k . Further, k be such that it does not overlap with any other MVE and also contains nImp number of points with label L−1; P (L+1|E + k ) = 1 nImpM (n + 1)(N + 1) . 1 + 9 (10) Classification by Sequential Ellipsoidal Partitioning A PREPRINT We now consider two cases: i. a balanced dataset, where the ratio M M (cid:28) N . Now, in the balanced dataset case, N +1 ≈ 1 and ii. an imbalanced dataset, where P (L+1|E + k ) ≈ 1 nImp (n + 1) . 1 + (11) N (cid:28) 1, again indicating a high trust for label L+1, if z lies in E + Clearly, if nImp (cid:28) (n + 1), the trust in prediction of L+1 (L−1) is high (low) - close to 1 (0). Consider the case of an imbalanced dataset, where points with label L+1 form the majority class; thus, in (10), the ratio M k . This is a natural result, since the dataset is skewed in favour of the majority class. This result may indicate that it may not be possible at all to label a point of the minority class, with label L−1, with high trust. However, since SEP-C tries to find an MVE, say E − j , that contains points of only the minority class, that is n ≈ 0, then (10) leads to the trust P (L+1|E − j ) ≈ 1, indicating a high trust in label L−1. j ) ≈ 0 ⇒ P (L−1|E − k )/P (L−1|E + For datasets with a large region of overlap, SEP-C may find very few ellipsoidal partitions, even for a high value of nImp. In such cases, it is clear, from (10), that the trust will be close to 50% for the prediction, which we recommend as a "low" trust score. Another way to interpret why this may be considered low is by computing the odds ratio P (L+1|E + k ) = 1, that is, the odds are nearly the same that the test point can have either label. For the case when the odds ratio is close to 1, it is evident that the classifier should abstain from assigning a label to the test point and that user intervention is required. This result is equivalent to when the test point lies exactly on the separating hyperplane in classical SVMs. Instead of resorting to applying the label of the default class to such a test point, which may hold in imbalanced datasets, using the language of [38], we prefer that the classifier "rejects" classifying this test point. It should be highlighted that the formulation of the SVM with reject option presented in [38] is based on limiting the values of the coefficients by which the support vectors are found and thus shares a similar idea as that of the RCH, which we adopt. Note that their formulation also does not use a convex function, unlike our approach, where only CPs are solved at every step. Following this approach, a trust score can be calculated if the test point triggers Rules R2a,2b. This approach is also valid if, in (5) and (6), |X ∈ RInt| = |Y ∈ RInt| or |X ∈ EU | = |Y ∈ EU |, respectively. When we apply SEP-C on datasets, we compute trust scores for those regions in which the test points lie. Note that the number of such regions - disjoint MVEs or overlapping MVEs - are finitely many. Interpreting Rules and Trust Scores: In the literature, several metrics have been proposed to analyse the quality of rules extracted from classifiers; see [28] and [39] for a description and the methods of evaluation. A key requirement of a rule is that it is comprehensible. For example, If-Then rules are crisp, but the number of conditions required in such rules may reduce comprehensibility. In SEP-C, the rules of classification and the trust scores rely on the properties of the ellipsoid(s) that contain the test point. Let Rule R1 be triggered and a test point gets the label L+1 as it is contained within the MVE E + k . Let also the trust score formula, (10), yield a high trust for the label L+1. This result can be interpreted as saying that since the test point has characteristics that are similar to a greater number of points with label L+1 in E + k , higher are the odds that the test point too has the label L+1; the converse also holds. A similar interpretation can be made when one of Rules R2a or R2b is triggered, that is, when the test point is contained in the region of overlap or in the union of the intersecting MVEs. These points indicate that the trust score may also be thought of as a nonconformity measure, [6], which is a "real-valued function A(B, z) that measures how different an example z is from the examples in a bag B". The trust score, especially when Rule R2a or R2b is triggered, can also be compared with the concept of the overlapping coefficient (OVL), that is used to measure the similarity between probability distributions, [40, 41, 42]. Given two probability density functions f and g, a test point, z, and the decision rule that z belongs to f , iff f (z) ≥ g(z), and to g, otherwise; in [41], OVL is considered as the sum of two error probabilities. Note that OVL = 1 if f and g match and is 0, if they are disjoint. Thus, by measuring the overlap of the ellipsoids, which are Gaussians, using the formulae presented in [40, 41, 42], a bound on the error probability of assigning a particular label to the test point can be determined. 3.5 Time Complexity Analysis The main components of SEP-C are functions that determine the RCHs and the MVEs. Since the RCH algorithm is a dual of the SVM, [4], its time complexity is the same as that of the SVM, which is O(n3), where n is the training set size, [43]. The solvers in the cvx-opt modules used to find MVEs are based on state-of-the-art Primal-Dual algorithm, which is a type of Interior Point Method (IPM), which in turn is based on Newton's method applied to modified KKT conditions. In [32], Primal-Dual method is shown to be faster than the Barrier method - analysed in detail in [32] - which is another IPM. The complexity of these algorithms depends on the complexity of the Newton steps required to m, where m is find the optimal solution. For a fixed duality gap, in the Barrier method, the Newton steps grow as √ 10 Classification by Sequential Ellipsoidal Partitioning A PREPRINT the number of inequality constraints in the CP, hence, the Barrier method has complexity of order O((cid:112)m). In SEP-C, both n and m reduce in every iteration; note that the number of iterations is dependent on the dataset. 4 Results SEP-C is demonstrated on various types of 2-D synthetic datasets as well as the Adult, Wisconsin Breast Cancer- Diagnostic (WDBC), and Vertebral Column (VC) Datasets, [44]. The CP solver cvx-opt module SDPT3, [32], is used in MATLAB 2021b to obtain all results; other solvers such as MOSEK and SeDuMi yielded similar results. As a first step, in most cases, the overlap between the MVEs of points of both labels is examined. This is performed by computing the overlap ratio (OVR) as the ratio of volume of the MVE of overlapping region to the volume of the MVE of either class; note that the volume of an ellipsoid, E = {z | (cid:107)Az + b(cid:107) ≤ 1}, is proportional to (cid:112)det(A−1), [45, Chap. 3]. Thus, an OVR close to 1 indicates fully overlapping classes, also implying potentially large misclassifications, and a value closer to 0 indicates little or no overlap, implying linear separability. As we show, the selected datasets display different overlapping properties. For example, the WDBC dataset has little overlap; the Adult dataset has significant overlap of points of both labels; and in the VC dataset, nearly all points of one label - the minority class - are in the overlap region, while only a few points of the majority class are in this region. Choosing the MVE approach to cover points of a label, prior to training and classification, allows for such data landscapes to be drawn. 4.1 2-D datasets The results of applying SEP-C on 2-D datasets that cannot be separated by a single linear hyperplane are shown in Fig. 3; these are the Circles1, Moons2, and the dataset formed by the outputs of a 2-D XOR gate. As can be seen in Figs. 3a and 3b, where, the points marked in blue belong to one label and the ones in red have the other label, SEP-C is able to partition points - after 4 iterations for Circles and 3 for Moons - of either label into their respective ellipsoids. To obtain these results, the number of permitted impure points is set to nImp = 5 and nImp = 2 respectively. It is known that the Circles dataset can be partitioned using a linear hyperplane by transforming the features using a non- linear function and both the Circles and the Moons datasets can be partitioned using a single non-linear hyperplane defined, say using Radial Basis Functions. On the other hand, SEP-C can be applied directly without the use of any such transform, non-linear hyperplane, or the "kernel trick". Thus, SEP-C obviates the need of EDA, which becomes essential in determining the transform that aids in obtaining linear separability. The muliple linear hyperplanes found in each iteration of SEP-C are marked in black in Fig. 3b; similarly, multiple such linear hyperplanes are also found in the Circles dataset. (a) (b) (c) Figure 3: 2-D Synthetic Datasets. 3a: Circles; 3b: Moons; and 3c: XOR Consider the XOR dataset shown in Fig. 3c. Following Alg. 1, SEP-C does not perform the first partition (the main while loop in line 7) as the number of points exactly equals the dimension of the feature space. Even if the inequality in line 7 in Alg. 1 is relaxed, that is, |X | ≥ n, the RCH algorithm, which is called in line 8, cannot find non-overlapping MVEs, leading to empty sets X + and Y −, and eventually exiting the while loop (line 9). This result is a consequence of Radon's theorem, [46], as non-intersecting convex hulls cannot be found for these set of points. In either case, in line 1https://scikit-learn.org/stable/modules/generated/sklearn.datasets.make_circles.html 2https://scikit-learn.org/stable/modules/generated/sklearn.datasets.make_moons.html 11 Classification by Sequential Ellipsoidal Partitioning A PREPRINT 27 which is outside the main while loop, SEP-C finds MVEs that cover points of both sets; these MVEs necessarily have to intersect. Remarks: i. Since in 2-D, the convex hulls formed by the points at the diagonally opposite vertices of the square are essentially straight lines, the lengths of the minor axes of the corresponding MVEs are zero, implying that the corresponding eigenvalues of the matrix A in the ellipsoid definition E = {z | (cid:107)Az + b(cid:107) ≤ 1}, have magnitudes equal to infinity. In this case, the chosen solver fails to find this MVE (indeed, it may be true that no solver can find such MVEs). However, by introducing just two points, where one point is "close" to (0, 1) and the other close to (1, 1), the solver can find the MVEs; this procedure is adopted to plot the ellipses shown in Fig. 3c. These new points are generated randomly within a radius of magnitude 0.01 around these points. ii. Analogous to the XOR function being "learnt" by an Artificial Neural Network (ANN) with a hidden layer, the two MVEs found by SEP-C can be interpreted as being the same function; see [47] for challenges faced in the design of ANNs for the XOR problem. 4.2 Adult Dataset The Adult (Census Income) Dataset consists of 30162 records, with 22654 records with one label, say L+1, and 7508 records of the other; as is evident, this dataset is highly imbalanced. Moreover, calculation of the OVRs of the MVEs of the points of both labels indicates that a significant portion of the minority class (OVR = 0.6) lies in the overlapping region, hence, the potential for misclassification is high. Each record is defined by a mix of 14 categorical (8) and continuous (6) features. The 8 categorical features in the dataset have very few but repeated discrete values. Thus, when the entire dataset is considered, SEP-C is unable to find MVEs in many iterations owing to the constant values of a few of the categorical features in some partitions. In addition, for some combinations of the categorical features, there are no datapoints consisting of the continuous features at all, hinting at a sparse dataset with very few informative features. Thus, the dataset is stratified and the most populated stratum is selected as the training set. As discussed in [48], the approach of stratified sampling is a systematic and cost-effective way of shrinking the dataset size while preserving its properties; see also [49, 50] on the use of stratified sampling of features for high-dimensional data. The selected stratum had the following values for the categorical features: workclass = 2, education = 11, education = 11, marital-status = 2, occupation = 2, relationship = 0, race = 4, sex = 1, and native-country = 38. The training set from this stratum has 547 records with label L+1 and 256 with label L−1. Even in this stratum, one of the continuous features has a constant value for all records, thus lending it a categorical nature; this feature too is dropped, thus leading to the training set consisting of only 5 continuous variables. For this reduced dataset, the OVRs of the respective MVEs and the overlapping region is close to 50% for both labels, again indicating the high degree of overlap. In the first iteration of SEP-C, the result of applying the RCH function led to a subset of the training data where 2 continuous features capital-gain and capital-loss have values equal to 0; Fig. 4 shows the values of feature capital-gain for the entire dataset (blue) as well as the values, of magnitude 0, for the datapoints in the RCH found in the 1st iteration (in green). Since the subset of these features at the end of the 1st iteration are constant, the MVE could not be found, again because the corresponding semi-axes lengths of the MVE become zero. Instead of again removing these features and working with a dataset with a reduced dimension, low magnitude uniform random noise was added to these two features in the entire training set; a similar procedure is followed for the XOR problem. Now, with nImp = 10, SEP-C led to 17 ellipsoidal partitions for each label. The performance of SEP-C is compared with the Decision Tree Classifier (DTC) on this reduced dataset; the same 80-20 split is used for training and testing in both cases. DTC was selected to have a depth of 10 and for SEP-C, results with nimp = 10 are presented. The motivations to compare SEP-C and DTC (in addition to DTC being a well-known one) are i. the rules of classification can be inferred and ii. the leaf nodes in DTC are analogous to the regions formed by MVEs in SEP-C. However, differences are notable too: i. In DTC, a test record gets the majority label, if the leaf in which it lies contains equal number of records of both labels, while in SEP-C, a label is assigned on the corresponding MVE in which it lies. Of course, in SEP-C, if the MVE contains equal number of records of both the classes, the trust score is close to 50%; ii. the leaf nodes in DTC are essentially polyhedra in the feature space where an edge of a polyhedron is along the direction of the feature; some of these polyhedra may be unbounded (a leaf being defined by a single inequality for one of the features, for example, capital-gain > 77 for leaf 134), while in SEP-C, the regions are bounded by the MVEs; and iii. overfitting in SEP-C can be controlled by tweaking nImp , while in DTC, overfitting is controlled by pruning, which involves tuning of more than one hyperparameters, such as depth of the tree, number of leaves, or through cost complexity pruning. The results of the performance of both classifiers are shown in Fig. 5. Consider Figs. 5c and 5d. The X−axis in these figures indicate the unique regions in the feature space in which the test points lay. These regions could be single MVEs or an intersection of several MVEs of both labels as well. For example, region 61 is formed by an intersection 12 Classification by Sequential Ellipsoidal Partitioning A PREPRINT 120 100 80 60 40 20 s e u l a V 0 0 200 200 400 400 DataPoints 600 600 810 810 Figure 4: Values of the feature capital-gain for the entire dataset, marked in blue, and in the subset found by the RCH function, marked in green. As all values in green are 0, cvx-opt cannot find the MVE for the reduced CH. of MVEs of both labels and which contains 1 record with label L+1 and 5 records with label L−1. Note that there may be many more such regions formed by the MVEs and their intersections. The points in the test set lie in 66 unique regions; the left Y −axis indicates the number of test points in that region. The dotted lines in these figures show the trust score (marked by the Y −axis on the right) that is computed for each region according to (7). Thus, a test point in region 61 is assigned a trust score of 73.7% for label L−1; the ground truth for this test point is actually label L+1. Similarly, in Figs. 5a and 5b, the X−axis lists the leaves in which the test points are found and the Y −axis on the right shows the ratio of points of one label to the total number of points from the training set found in that leaf; a trust score of 100% shows that that leaf contains points of the same label. From an accuracy point of view - ratio of number of correct classifications to the number of testing records - DTC yielded an accuracy of 69.5%, while SEP-C produced 52.5%. The SVM classifier with linear and RBF kernel pro- vided 71% and 68% accuracy, respectively. While these numbers may indicate that SEP-C performs poorly than these classifiers in terms of accuracy, the role of the Bayesian trust score in accepting the predicted labels should be highlighted. Consider Fig. 5c, which shows the prediction made by SEP-C for test points with ground truth belonging to the majority class, that is, label L+1. Nearly all points whose labels have been predicted correctly also have a high trust score, while those that are misclassified have a low trust score (less than 50%). A similar result can be observed in Fig. 5d as well - most of the misclassified points (minority ground truth label) have a low trust score and the few that are correctly classified have a trust of 100%. These imply that SEP-C is able to find regions in the feature space, however few, that contain points of the same label. The variations in the trust score for the different regions portray the overlapping landscape of the training data - a clean dataset would have few regions with nearly constant trust scores for all regions. If the trust score is viewed as a non-conformity measure, say with threshold (cid:15) = 0.05, then the labels of only those points whose trust score is greater than 95% need be accepted. In this case, nearly all those points that are misclassified will be rejected; thus, if accuracy is measured for only the accepted test points, then naturally this score will be high for SEP-C. SEP-C also leads to misclassifications with high trust of some test points, for example, the red bars in regions 7 and 17 in Fig. 5c. None of these points actually lay in any of the MVEs or their intersection, thus satisfying Case 3, as described in Sec. 3.3. Now, these points are assigned a label by expanding the MVEs closest to them. For these test points, as these MVEs belonged to the points with the minority label, they were also assigned the minority label. 13 Classification by Sequential Ellipsoidal Partitioning A PREPRINT 24 20 16 12 8 4 s t n i o P t s e T f o r e b m u N s t n i o P t s e T f o r e b m u N 9 6 3 1 100 80 60 40 20 0 20 40 60 80 100 120 140 20 40 60 80 100 120 140 Node Numbers (a) 100 80 60 40 20 0 60 60 50 50 10 10 20 20 30 30 Regions 40 40 (c) 24 20 16 12 8 4 9 6 3 1 100 80 60 40 20 ) % ( e r o c S t s u r T 0 20 40 60 80 100 120 140 20 40 60 80 100 120 140 Node Numbers (b) 100 80 60 40 20 ) % ( e r o c S t s u r T 0 10 20 30 40 50 60 70 10 20 30 40 50 60 70 Regions (d) Figure 5: Results of classifying the Adult Dataset: (5a): DT for label L+1; (5b): DT for label L−1; (5c): SEP-C for label L+1; (5d): SEP-C for label L−1. In Figs. 5a and 5c, the blue bars indicate the number of points in the respective regions that match the corresponding ground truth label L+1 and those marked in red are misclassifications, while in Figs. 5b and 5d, red bars match the ground truth label L−1 and blue bars indicate misclassifications. The green lines indicate the trust in classification. These results highlight the "strangeness" of these test points; had they been close to other points of the same label - making them "less strange " - they would have been contained inside one of the MVEs anyway. Thus, the prediction of the label of a test point made by SEP-C can also be rejected if the point in question is not contained within one of the MVEs found by SEP-C. Further, if the number of such misclassifications exceeds nimp in one region, then, these test points, with their correct labels, can be included in the training set and SEP-C can be used to partition the dataset afresh. 4.3 WDBC Dataset This dataset consists of 569 records with 357 label L+1 (Benign) records and 212 records with label L−1 (Malignant); each record is defined by 30 features. One of the earliest works on this dataset, [51], reports 97% accuracy with the application of a classifier based on the Multi-Surface Method (MSM), known as the MSM-Tree (MSM-T) classifier; this accuracy was obtained following ten-fold cross-validation on three of the thirty features, namely, mean texture, worst area, and worst smoothness. MSM-T solves a linear program to split at a node and recursively identifies several regions, based on separating hyperplanes, in the feature space; a DTC-type method is then used to predict a label of a test point. In [52], the authors build classification models using SVM, k-NN, Naive Bayes, J48, Random 14 Classification by Sequential Ellipsoidal Partitioning A PREPRINT Forest, and Multilayer Perceptron methods. The dataset was preprocessed and 10-fold cross validation was applied. The Random Forest classifier is shown as the the most accurate model, with an accuracy of 98.77%. The Linear SVM classifier with preprocessing gave 98.07% accuracy. In [53], a comparison of classification accuracy among Decision Tree, Multi-Layer Perceptron, Naive-Bayes, Se- quential Minimal Optimization (SMO), and Instance-based k-NN methods is presented for WDBC dataset as well as original and Prognostic datasets. The aim is to find the best combination of the algorithms in order to improve accuracy of the model. The proposed SMO uses the PCA and χ-squared test for feature selection and it is observed that this had little effect on performance of the combination of algorithms on the WDBC dataset. The highest accuracy achieved by the SMO is 97.7%, while other ensembles have report lower accuracy. In [54], the use of an ANN, Particle Swarm Optimization and Genetic Algorithm shows a slight improvement in accuracy when 14 out of 32 features were selected during feature selection, with accuracy of 97.3%, 97.2% and 96.6% respectively. 50 40 30 20 10 s t n i o P t s e T f o r e b m u N 100 80 60 40 20 ) % ( e r o c S t s u r T 1 1 2 2 5 5 4 4 3 3 Regions 6 6 7 7 Figure 6: SEP-C Trust scores - WDBC dataset The results of applying SEP-C on this dataset are shown in Fig. 6; prior to its implementation, it is found that the points of the two labels have almost no overlap, thus indicating that a high accuracy in classification is possible. A 4-fold, 90-10 train-test split-cross validation technique was used with all 30 features and nImp = 2. In each fold, SEP-C finds 3 partitions for each class; these are Regions 1-3 for training set points with label L+1 and Regions 4-7 for points with label L−1. Region 7 is formed by the intersection of 1st and 2nd ellipsoids of label L−1. As can be seen in Fig. 6, except for about 10 test points with ground truth label L−1, that lie in Region 3 and marked in red, all other points are correctly classified. The same holds true for test points lying in Region 4-7 - the predictions with trust score of 100% matches the ground truth label. The points in red and lying in Region 3, which are misclassified with high trust, deserve a closer look. During the validation stage of SEP-C, the labels of each of these test points is predicted one-by-one and then removed from the train-test set. Thus, since Region 3 contains points with label L+1, any test point that is contained in this region will also get this label, according to Rule 1 of SEP-C. Now, when all of these test points are considered together, the results show that they form a cluster that can be interpreted as a small disjunct. If the number of permitted misclassfications is chosen as less than 10, the number shown in Fig. 6, partitioning will need to be performed again. Now, SEP-C will find a new partition for these points. 4.4 VC Dataset This dataset consists of 100 records with label L+1 (Normal) and 210 records with label L−1 (Abnormal). The MVEs of the points of individual labels from the entire dataset show OVR values, with the MVE formed in the region of overlap, of 0.67 for label L+1 and 0.006 for label L−1. In fact, it is only 7 out of 100 records of points with label L+1 that lie outside the region of overlap while 157 points with label L−1 lie outside the region of overlap. Such an unequal distribution of points indicate a possibility of misclassification of points with ground truth L+1 - this 15 Classification by Sequential Ellipsoidal Partitioning A PREPRINT observation is also supported when SEP-C is applied on this dataset. By performing a 10-fold cross validation with nImp = 2 led to accuracy values ranging from as low as 64.2% for one fold to as high as 92.8% for another. In [55], a prediction accuracy of 83% with k-NN algorithm is reported for this dataset. A comparative study in [56] gives accuracy as 89.03% for k-NN, 88.06% for ANN, and 86.13% for Naïve Bayes with cross validation, after applying genetic algorithms and bagging technique. When the variation in the accuracy across folds is analysed for SEP-C, it is seen that in the worst performing case, several points with ground truth label L+1 - also the minority class in the region of overlap - lie in MVEs that contain points only with label L−1. On the other hand, the same points form their own MVE in the fold when the accuracy is the highest. Note that with an increase in misclassification in the worst performing fold indicates a need to repartition the dataset with the correct labels. Thus, with this repartitioning, it is likely that these points would have formed their own MVE. A similar result is seen in the WDBC dataset for points that lie in Region 3 that are misclassified, as shown in Fig. 6. 4.5 Multiclass Classification - Iris Dataset SEP-C, when applied to the multi-class Iris dataset, results in the MVEs shown in Fig. 7; the one-vs-all approach is followed and 2 features - sepal length and petal length are selected. The class labels for the 3 classes are assigned as - class 0 (setosa), class 1 (versicolor), and class 2 (verginica). With 2 and all 4 features and nImp = 2, 3 MVEs were obtained for class 0 and 4 MVEs each for classes 1 and 2. The test points of class 0 were classified accurately. As can be seen, there is significant overlap between the points of classes 1 and 2, hence, SEP-C also misclassified points of class 1. Figure 7: SEP-C Classification for Iris Dataset The performance of SEP-C on the Iris dataset is presented as a comparison with the GMMs presented in [25, Sec. 8.4] for this dataset. The MVEs obtained from SEP-C, which are in essence Gaussians, are a natural result of the iterative RCH function that is an integral part of SEP-C. Thus, there is no need to specify the number or type of Gaussian mixtures in SEP-C to cluster the 3 classes. 16 Classification by Sequential Ellipsoidal Partitioning A PREPRINT 5 Conclusions This paper proposes a novel, convex optimization-based, supervised classifier, SEP-C, for binary and multi-class classification. The algorithm does not require prior knowledge about the nature of the dataset and its underlying dis- tribution and in addition, its iterative characteristic lends it the property of being free of hyperparameters, such as used in SVMs. The single user-defined parameter is the number of misclassifications permitted in the partitioning, which we believe has a greater intuitive appeal than hyperparameters defined in the cost functions. Rules of classification can be stated based on the obtained partitions and based on the outputs of these rules, a Bayesian trust score in the prediction can also be calculated. This trust score, which allows for a user to accept or reject the predicted label, lends a degree of explainability to the prediction, as it is based on the strangeness of the test point to other points in a local region of the dataset. While the accuracy comparisons made in this paper are for the entire test set, when the predicted and ground truth labels are compared for individual points and it emerges that a set of points have been misclassified consistently and whose number is greater than the user-defined allowed value, then, this is an indicator that SEP-C should be applied on the updated dataset for fresh partitioning. As we have shown in the results, small disjuncts - which exhibit such properties - can be identified in the retraining of SEP-C. The presented results also highlight that SEP-C can act on datasets of different types - containing only categorical or continuous features or their mix. The multiple hyperplanes that are determined in each iteration of the RCH function make it applicable for datasets that are not linearly separable. Thus, there is no need to search for a suitable kernel or an appropriate transform that would render the data to become linearly separable. SEP-C can be extended to identification of small disjuncts; for datasets subjected to a data shift; as well as for time-series data. Further, the density of points in the determined MVEs can be analysed further to examine the need for cross-fold validations and selecting the fold that best partitions the dataset. Acknowledgments Ranjani Niranjan would like to thank Prateeksha Foundation for providing financial support for her doctoral program at IIIT-Bangalore. References [1] Stephen Boyd and Lieven Vandenberghe. Convex optimization. Cambridge University Press, 2004. [2] Peng Sun and Robert M. Freund. Computation of minimum-volume covering ellipsoids. Operations Research, 52(5):690–706, 2004. [3] Qinglu Kong and Qiuming Zhu. Incremental procedures for partitioning highly intermixed multi-class datasets into hyper-spherical and hyper-ellipsoidal clusters. Data & Knowledge Engineering, 63(2):457–477, 2007. [4] Kristin P. Bennett and Erin J. Bredensteiner. Duality and geometry in SVM classifiers. In Proceedings of the Seventeenth International Conference on Machine Learning, ICML '00, page 57–64, San Francisco, CA, USA, 2000. Morgan Kaufmann Publishers Inc. [5] Stephen Boyd and Lieven Vandenberghe. Introduction to Applied Linear Algebra: Vectors, Matrices, and Least Squares. Cambridge University Press, 2018. [6] Glenn Shafer and Vladimir Vovk. A tutorial on conformal prediction. Journal of Machine Learning Research, 9(Mar):371–421, 2008. [7] Vineeth Balasubramanian, Shen-Shyang Ho, and Vladimir Vovk. Conformal prediction for reliable machine learning: theory, adaptations and applications. Newnes, 2014. [8] Marco Tulio Ribeiro, Sameer Singh, and Carlos Guestrin. Why should I trust you?: Explaining the predictions of any classifier. In Proceedings of the 22nd ACM SIGKDD international conference on knowledge discovery and data mining, pages 1135–1144. ACM, 2016. [9] Chih-Chia Yao. Utilizing ellipsoid on support vector machines. In 2008 International Conference on Machine Learning and Cybernetics, volume 6, pages 3373–3378, 2008. [10] José A Sáez, Mikel Galar, and Bartosz Krawczyk. Addressing the overlapping data problem in classification using the one-vs-one decomposition strategy. IEEE Access, 7:83396–83411, 2019. [11] David A. Elizondo, Ralph Birkenhead, Matias Gamez, Noelia Garcia, and Esteban Alfaro. Linear separability and classification complexity. Expert Systems with Applications, 39(9):7796–7807, 2012. 17 Classification by Sequential Ellipsoidal Partitioning A PREPRINT [12] Hongzhi Wang, Mohamed Jaward Bah, and Mohamed Hammad. Progress in outlier detection techniques: A survey. Ieee Access, 7:107964–108000, 2019. [13] Sarah M. Erfani, Sutharshan Rajasegarar, Shanika Karunasekera, and Christopher Leckie. High-dimensional and large-scale anomaly detection using a linear one-class SVM with deep learning. Pattern Recognition, 58:121– 134, 2016. [14] Guillaume Staerman, Pavlo Mozharovskyi, Stephan Clé mençon, and Florence d'Alché Buc. Functional isolation forest. In Wee Sun Lee and Taiji Suzuki, editors, Proceedings of The Eleventh Asian Conference on Machine Learning, volume 101 of Proceedings of Machine Learning Research, pages 332–347. PMLR, 17–19 Nov 2019. [15] Ana Madevska-Bogdanova, Dragan Nikolik, and Leopold Curfs. Probabilistic svm outputs for pattern recogni- tion using analytical geometry. Neurocomput., 62(C):293–303, December 2004. [16] Tong Luo, Kurt Kramer, Dmitry B Goldgof, Lawrence O Hall, Scott Samson, Andrew Remsen, and Thomas Hopkins. Active learning to recognize multiple types of plankton. Journal of Machine Learning Research, 6(Apr):589–613, 2005. [17] Giorgio Fumera and Fabio Roli. Support vector machines with embedded reject option. In International Work- shop on Support Vector Machines, pages 68–82. Springer, 2002. [18] Mingkun Li and Ishwar K Sethi. Confidence-based active learning. IEEE transactions on pattern analysis and machine intelligence, 28(8):1251–1261, 2006. [19] Pabitra Mitra, CA Murthy, and Sankar K Pal. A probabilistic active support vector learning algorithm. IEEE Transactions on Pattern Analysis and Machine Intelligence, 26(3):413–418, 2004. [20] Victoria Hodge and Jim Austin. A survey of outlier detection methodologies. Artificial intelligence review, 22(2):85–126, 2004. [21] G. Calafiore. Approximation of n-dimensional data using spherical and ellipsoidal primitives. IEEE Transactions on Systems, Man, and Cybernetics - Part A: Systems and Humans, 32(2):269–278, 2002. [22] Matt Kraning, Arezou Keshavarz, and Lei Zhao. Bubble clustering: Set covering via union of ellipses, 2009. http://cs229.stanford.edu/proj2009/KraningKeshavarzZhao.pdf. [23] David Martínez-Rego, Enrique Castillo, Oscar Fontenla-Romero, and Amparo Alonso-Betanzos. A minimum volume covering approach with a set of ellipsoids. IEEE Transactions on Pattern Analysis and Machine Intelli- gence, 35(12):2997–3009, 2013. [24] Costas Panagiotakis and Antonis Argyros. Region-based fitting of overlapping ellipses and its application to cells segmentation. Image and Vision Computing, 93:103810, 2020. [25] Geoffrey J. McLachlan, Sharon X. Lee, and Suren I. Rathnayake. Finite mixture models. Annual Review of Statistics and Its Application, 6(1):355–378, 2019. [26] Benyamin Ghojogh, Aydin Ghojogh, Mark Crowley, and Fakhri Karray. Fitting a mixture distribution to data: Tutorial, 2019. [27] George H. John and Pat Langley. Estimating continuous distributions in bayesian classifiers, 2013. [28] D. Martens, B.B. Baesens, and T. Van Gestel. Decompositional rule extraction from support vector machines by active learning. IEEE Transactions on Knowledge and Data Engineering, 21(2):178–191, 2009. [29] Nahla H. Barakat and Andrew P. Bradley. Rule extraction from support vector machines: A sequential covering approach. IEEE Transactions on Knowledge and Data Engineering, 19(6):729–741, 2007. [30] Glenn Fung, Sathyakama Sandilya, and R. Bharat Rao. Rule Extraction from Linear Support Vector Machines via Mathematical Programming, pages 83–107. Springer Berlin Heidelberg, Berlin, Heidelberg, 2008. [31] Stephen B Pope. Algorithms for ellipsoids, 2008. http://tcg.mae.cornell.edu/pubs/Pope_FDA_08.pdf. [32] CVX Research, Inc. CVX: Matlab Software for Disciplined Convex Programming, version 2.0. http://cvxr. com/cvx, August 2012. [33] Pai-Hsuen Chen, Chih-Jen Lin, and Bernhard Schölkopf. A tutorial on ν-support vector machines. Applied Stochastic Models in Business and Industry, 21(2):111–136, 2005. [34] Ben Goodrich, David Albrecht, and Peter Tischer. Algorithms for the computation of reduced convex hulls. In Ann Nicholson and Xiaodong Li, editors, AI 2009: Advances in Artificial Intelligence, pages 230–239, Berlin, Heidelberg, 2009. Springer Berlin Heidelberg. [35] Bernard Chazelle. An optimal convex hull algorithm in any fixed dimension. Discrete & Computational Geom- etry, 10(4):377–409, 1993. 18 Classification by Sequential Ellipsoidal Partitioning A PREPRINT [36] Tom Mitchell. Machine Learning. McGraw Hill, 1997. ISBN: 0070428077. [37] Johan Huysmans, Rudy Setiono, Bart Baesens, and Jan Vanthienen. Minerva: Sequential covering for rule extraction. IEEE Transactions on Systems, Man, and Cybernetics, Part B (Cybernetics), 38(2):299–309, 2008. [38] Giorgio Fumera and Fabio Roli. Support vector machines with embedded reject option. In Seong-Whan Lee and Alessandro Verri, editors, Pattern Recognition with Support Vector Machines, pages 68–82, Berlin, Heidelberg, 2002. Springer Berlin Heidelberg. [39] Nahla H. Barakat and Andrew P. Bradley. Rule extraction from support vector machines: A sequential covering approach. IEEE Transactions on Knowledge and Data Engineering, 19(6):729–741, 2007. [40] Henry F. Inman and Edwin L. Bradley Jr. The overlapping coefficient as a measure of agreement between prob- ability distributions and point estimation of the overlap of two normal densities. Communications in Statistics - Theory and Methods, 18(10):3851–3874, 1989. [41] Friedrich Schmid and Axel Schmidt. Nonparametric estimation of the coefficient of overlapping-theory and empirical application. Computational Statistics & Data Analysis, 50(6):1583–1596, 2006. [42] Adam Tauman Kalai, Ankur Moitra, and Gregory Valiant. Efficiently learning mixtures of two gaussians. In Proceedings of the Forty-Second ACM Symposium on Theory of Computing, STOC '10, page 553–562, New York, NY, USA, 2010. Association for Computing Machinery. [43] Lin Bottou. Support Vector Machine Solvers. In Large-Scale Kernel Machines. The MIT Press, 08 2007. [44] Dheeru Dua and Casey Graff. UCI machine learning repository, 2017. [45] Stephen Boyd, Laurent El Ghaoui, Eric Feron, and Venkataramanan Balakrishnan. Linear Matrix Inequalities in System and Control Theory. Society for Industrial and Applied Mathematics, 1994. [46] Henry Adams, Elin Farnell, and Brittany Story. Support vector machines and radon's theorem, 2020. [47] Richard Bland. Learning XOR: exploring the space of a classic problem. Technical report, Department of Computing Science and Mathematics, University of Stirling, June 1998. [48] Xingwang Zhao, Jiye Liang, and Chuangyin Dang. A stratified sampling based clustering algorithm for large- scale data. Knowledge-Based Systems, 163:416–428, 2019. [49] Yunming Ye, Qingyao Wu, Joshua Zhexue Huang, Michael K. Ng, and Xutao Li. Stratified sampling for feature subspace selection in random forests for high dimensional data. Pattern Recognition, 46(3):769–787, 2013. [50] Liping Jing, Kuang Tian, and Joshua Z. Huang. Stratified feature sampling method for ensemble clustering of high dimensional data. Pattern Recognition, 48(11):3688–3702, 2015. [51] W. Nick Street, W. H. Wolberg, and O. L. Mangasarian. Nuclear feature extraction for breast tumor diagnosis. In Raj S. Acharya and Dmitry B. Goldgof, editors, Biomedical Image Processing and Biomedical Visualization, volume 1905, pages 861 – 870. International Society for Optics and Photonics, SPIE, 1993. [52] Ahmet Saygili. Classification and diagnostic prediction of breast cancers via different classifiers. International Scientific and Vocational Studies Journal, 2(2):48–56, 2018. [53] Gouda I Salama, M Abdelhalim, and Magdy Abd-elghany Zeid. Breast cancer diagnosis on three different datasets using multi-classifiers. Breast Cancer (WDBC), 32(569):2, 2012. [54] Shokoufeh Aalaei, Hadi Shahraki, Alireza Rowhanimanesh, and Saeid Eslami. Feature selection using genetic algorithm for breast cancer diagnosis: experiment on three different datasets. Iranian journal of basic medical sciences, 19(5):476, 2016. [55] Irma Handayani. Application of k-nearest neighbor algorithm on classification of disk hernia and spondylolis- thesis in vertebral column. Indonesian Journal of Information Systems, 2(1):57–66, Aug. 2019. [56] Rizki Tri Prasetio and Dwiza Riana. A comparison of classification methods in vertebral column disorder with In 2015 4th International Conference on Instrumentation, the application of genetic algorithm and bagging. Communications, Information Technology, and Biomedical Engineering (ICICI-BME), pages 163–168, 2015. 19
http://arxiv.org/abs/2302.10483v1
2023-02-21T07:12:36
2023-02-21T07:12:36
Structured Bayesian Compression for Deep Neural Networks Based on The Turbo-VBI Approach
With the growth of neural network size, model compression has attracted increasing interest in recent research. As one of the most common techniques, pruning has been studied for a long time. By exploiting the structured sparsity of the neural network, existing methods can prune neurons instead of individual weights. However, in most existing pruning methods, surviving neurons are randomly connected in the neural network without any structure, and the non-zero weights within each neuron are also randomly distributed. Such irregular sparse structure can cause very high control overhead and irregular memory access for the hardware and even increase the neural network computational complexity. In this paper, we propose a three-layer hierarchical prior to promote a more regular sparse structure during pruning. The proposed three-layer hierarchical prior can achieve per-neuron weight-level structured sparsity and neuron-level structured sparsity. We derive an efficient Turbo-variational Bayesian inferencing (Turbo-VBI) algorithm to solve the resulting model compression problem with the proposed prior. The proposed Turbo-VBI algorithm has low complexity and can support more general priors than existing model compression algorithms. Simulation results show that our proposed algorithm can promote a more regular structure in the pruned neural networks while achieving even better performance in terms of compression rate and inferencing accuracy compared with the baselines.
[ "Chengyu Xia", "Danny H. K. Tsang", "Vincent K. N. Lau" ]
10.1109/TSP.2023.3252165
[ { "@title": "doi", "@href": "http://dx.doi.org/10.1109/TSP.2023.3252165", "@rel": "related", "@type": null }, { "@title": null, "@href": "http://arxiv.org/abs/2302.10483v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10483v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
JOURNAL OF XXX 1 Structured Bayesian Compression for Deep Neural Networks Based on The Turbo-VBI Approach Chengyu Xia, Danny H. K. Tsang, Fellow, IEEE, and Vincent K. N. Lau∗, Fellow, IEEE 3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 3 8 4 0 1 . 2 0 3 2 : v i X r a Abstract-With the growth of neural network size, model compression has attracted increasing interest in recent research. As one of the most common techniques, pruning has been studied for a long time. By exploiting the structured sparsity of the neural network, existing methods can prune neurons instead of individual weights. However, in most existing pruning methods, surviving neurons are randomly connected in the neural network without any structure, and the non-zero weights within each neuron are also randomly distributed. Such irregular sparse structure can cause very high control overhead and irregular memory access for the hardware and even increase the neural network computational complexity. In this paper, we propose a three-layer hierarchical prior to promote a more regular sparse structure during pruning. The proposed three-layer hierarchical prior can achieve per-neuron weight-level structured sparsity and neuron-level structured sparsity. We derive an efficient Turbo- variational Bayesian inferencing (Turbo-VBI) algorithm to solve the resulting model compression problem with the proposed prior. The proposed Turbo-VBI algorithm has low complexity and can support more general priors than existing model compression algorithms. Simulation results show that our proposed algorithm can promote a more regular structure in the pruned neural networks while achieving even better performance in terms of compression rate and inferencing accuracy compared with the baselines. Index Terms-Deep neural networks, Group sparsity, Model compression, Pruning. I. INTRODUCTION D EEP neural networks (DNNs) have been extremely suc- cessful in a wide range of applications. However, to achieve good performance, state-of-the-art DNNs tend to have huge numbers of parameters. Deployment and transmission of such big models pose significant challenges for computation, memory and communication. This is particularly important for edge devices, which have very restricted resources. For the above reasons, model compression has become a hot topic in deep learning. A variety of research focused on model compression exists. In [1]-[3], the weight pruning approaches are adopted to re- duce the complexity of DNN inferencing. In [1], the threshold is set to be the weight importance, which is measured by introducing an auxiliary importance variable for each weight. With the auxiliary variables, the pruning can be performed in one shot and before the formal training. In [2] and [3], Hessian matrix of the weights are used as a criterion to perform ∗Vincent Lau is the corresponding author. Chengyu Xia, Danny Tsang and Vincent Lau are with the Department of Elec- tronic and Computer Engineering, The Hong Kong University of Science and Technology, Hong Kong, e-mail: [email protected]; [email protected]; [email protected]. pruning. These aforementioned approaches, however, cannot proactively force some of the less important weights to have small values and hence the approaches just passively prune small weights. In [4]-[13], systematic approaches of model compression using optimization of regularized loss functions are adopted. In [11], an (cid:96)2-norm based regularizer is applied to the weights of a DNN and the weights that are close to zero are pruned. In [4], an (cid:96)0-norm regularizer, which forces the weights to be exactly zero, is proposed. The (cid:96)0- norm regularization is proved to be more efficient to enforce sparsity in the weights but the training problem is notoriously difficult to solve due to the discontinuous nature of the (cid:96)0- norm. In these works, the regularization only promotes sparsity in the weights. Yet, sparsity in the weights is not equivalent to sparsity in the neurons. In [9], polarization regularization is proposed, which can push a proportion of weights to zero and others to values larger than zero. Then, all the weights connected to the same neuron are assigned with a common polarization regularizer, such that some neurons can be entirely pruned and some can be pushed to values larger than zero. In this way, the remaining weights do not have to be pushed to small values and hence can improve the expressing ability of the network. In [5], the authors use a group Lasso regularizer to remove entire filters in CNNs and show that their proposed group sparse regularization can even increase the accuracy of a ResNet. However, the resulting neurons are randomly connected in the neural network and the resulting datapath of the pruned neural network is quite irregular, making it difficult to implement in hardware [5], [6]. In addition to the aforementioned deterministic regulariza- tion approaches, we can also impose sparsity in the weights of the neural network using Bayesian approaches. In [14], weight pruning and quantization are realized at the same time by assigning a set of quantizing gates to the weight value. A prior is further designed to force the quantizing gates to "close", such that the weights are forced to zero and the non- zero weights are forced to a low bit precision. By designing an appropriate prior distribution for the weights, one can enforce more refined structures in the weight vector. In [15], a simple sparse prior is proposed to promote weight-level sparsity, and variational Bayesian inference (VBI) is adopted to solve the model compression problem. In [16], group sparsity is investigated from a Bayesian perspective. A two- layer hierarchical sparse prior is proposed where the weights follow Gaussian distributions and all the output weights of a neuron share the same prior variance. Thus, the output weights of a neuron can be pruned at the same time and neuron-level sparsity is achieved. JOURNAL OF XXX 2 In this paper, we consider model compression of DNNs from a Bayesian perspective. Despite various existing works on model compression, there are still several technical issues to be addressed. • Structured datapath in the pruned neural network: In deterministic regularization approaches, we can achieve group sparsity in a weight matrix. For example, under (cid:96)2,1-norm regularization [5], [7], some rows can be zeroed out in the weight matrix after pruning and this results in neuron-level sparsity. However, surviving neurons are randomly connected in the neural network without any structure. Moreover, the non-zero weights within each neuron are also randomly distributed. In the existing Bayesian approaches, both the single-layer priors in [15] and the two-layer hierarchical priors in [16] also cannot promote structured neuron connectivity in the pruned neural network. As such, the random and irregular neuron connectivity in the datapath of the DNN poses challenges in the hardware implementation.1 • Efficiency of weight pruning: With existing model com- pression approaches, the compressed model can still be too large for efficient implementation on mobile devices. Moreover, the existing Bayesian model compression ap- proaches tend to have high complexity and low robustness with respect to different data sets, as they typically adopt Monte Carlo sampling in solving the optimizing problem [15], [16]. Thus, a more efficient model compression solution that can achieve a higher compression rate and lower complexity is required. To overcome the above challenges, we propose a three-layer hierarchical sparse prior that can exploit structured weight- level and neuron-level sparsity during training. To handle the hierarchical sparse prior, we propose a Turbo-VBI [17] algorithm to solve the Bayesian optimization problem in the model compression. The main contributions are summarized below. • Three-layer Hierarchical Prior for Structured Weight- level and Neuron-level Sparsity: The design of an appropriate prior distribution in the weight matrix is critical to achieve more refined structures in the weights and neurons. To exploit more structured weight-level and neuron-level sparsity, we propose a three-layer hi- erarchical prior which embraces both of the traditional two-layer hierarchical prior [16] and support-based prior [18]. The proposed three-layer hierarchical prior has the following advantages compared with existing sparse priors in Bayesian model compression: 1) It promotes ad- vanced weight-level structured sparsity as well as neuron- level structured sparsity, as illustrated in Fig. 1c. Unlike existing sparse priors, our proposed prior not only prunes the neurons, but also promotes regular structures in the unpruned neurons as well as the weights of a neuron. Thus, it can achieve more regular structure in the overall 1When the pruned DNN has randomly connected neurons and irregular weights within each neuron, very high control overhead and irregular memory access will be involved for the datapath to take advantage of the compression in the computation of the output. neural network. 2) It is flexible to promote different sparse structures. The group size as well as the average gap between two groups can be adjusted via tuning the hyper parameters. 3) It is optimizing-friendly. It allows the application of low complexity training algorithms. • Turbo-VBI Algorithm for Bayesian Model Compres- sion: Based on the 3-layer hierarchical prior, the model training and compression is formulated as a Bayesian inference problem. We propose a low complexity Turbo- VBI algorithm with some novel extensions compared to existing approaches: 1) It can support more general priors. Existing Bayesian compression methods [15], [16] cannot handle the three-layer hierarchical prior due to the extra layer in the prior. 2) It has higher robustness and lower complexity compared with existing Bayesian compression methods. Existing Bayesian compression methods use Monte Carlo sampling to approximate the log-likelihood term in the objective function, which has low robustness and high complexity [19]. To overcome this drawback, we propose a deterministic approximation for the log-likelihood term. • Superior Model Compression Performance: The pro- posed solution can achieve a highly compressed neural network compared to the state-of-the-art baselines and achieves a similar inferencing performance. Therefore, the proposed solution can substantially reduce the com- putational complexity in the inferencing of the neural network and the resulting pruned neural networks are hardware friendly. Consequently, it can fully unleash the potential of AI applications over mobile devices. The rest of the paper is organized as follows. In Section II, the existing structures and the desired structure in the weight matrix are elaborated. The three-layer hierarchical prior for the desired structure is also introduced. In Section III, the model compression problem is formulated. In Section IV, the Turbo-VBI algorithm for model compression under the three- layer hierarchical prior is presented. In Section V and Section VI, numerical experiments and conclusions, respectively, are provided. II. STRUCTURES IN THE WEIGHT MATRIX Model compression is realized by enforcing sparsity in the weight matrix. We first review the main existing structured sparsity of the weight matrix in the literature. Based on this, we elaborate the desired structures in the weight matrix that are not yet considered. Finally, we propose a 3-layer hierarchical prior model to enforce such a desired structure in the weight matrix. A. Review of Existing Sparse Structured Weight Matrix There are two major existing sparse structures in the weight matrix, namely random sparsity and group sparsity. We focus on a fully connected layer to elaborate these two sparse structures. 1) Random Sparsity in the Weight Matrix: In ran- dom sparsity, the weights are pruned individually. (cid:96)1-norm JOURNAL OF XXX 3 connected layers, a group is often defined as the outgoing weights of a neuron to promote neuron-level sparsity. To promote group sparsity, sparse group Lasso regularization [7], [21] and two-layer priors are proposed. Generally, such regularization often has two folds: one regularizer for group pruning and one regularizer for individual weight pruning. Thus, the weights can not only be pruned in groups, but can also be pruned individually in case the group cannot be totally removed. However, when a neuron cannot be totally pruned, the weights connected to it are randomly pruned, and the neurons are also pruned in random. In Fig. 1b, we illustrate an example of group sparsity. In the weight matrix, the non- zero elements in a row are randomly distributed and the non- zero rows are also randomly distributed. When translated into neural network topology, this means the unpruned weights connected to a neuron are randomly distributed, and in each layer, the surviving neurons are also randomly distributed. Thus, group sparsity is still not fully structured. On the other hand, recent research has pointed out that the irregular connections in the neural network can bring various disadvantages in reducing the computational complexity or inferencing time [20], [22]-[25]. As discussed above, existing sparsity structures are not regular enough, and the drawbacks of such irregular structures are listed as follows. 1) Low decoding and computing parallelism: Sparse weight matrix are usually stored in a sparse format on the hardware, e.g., compressed sparse row (CSR), com- pressed sparse column (CSC), coordinate format (COO). However, as illustrated in Fig. 2 (a), when decoding from the sparse format, the number of decoding steps for each row (column) can vastly differ due to the irregular structure. This can greatly harm the decoding parallelism [23]. Moreover, the irregular structure also hampers the parallel computation such as matrix tiling [24], [20], as illustrated in Fig. 2 (b). 2) Inefficient pruning of neurons: As illustrated in Fig. 2 (c), the unstructured surviving weights from the previous layer tend to activate random neurons in the next layer, which is not efficient in pruning the neurons in the next layer. This may lead to inefficiency in reducing the floating point operations (FLOPs) of the pruned neural network. 3) Large storage burden: Since the surviving weights of existing model compression methods are unstructured, the exact location for each surviving weight has to be recorded. This leads to a huge storage overhead, which can be even greater than storing the dense matrix [24], [20]. The huge storage overhead can also affect the inferencing time by increasing the memory access and decoding time. B. Multi-level Structures in the Weight Matrix Based on the above discussion, a multi-level structured sparse neural network should meet the following three criteria: 1) Per-neuron weight-level structured sparsity: The surviv- ing weights connected to a neuron should exhibit a regular structure rather than be randomly distributed as in traditional (a) Random sparsity structure. (b) Group sparsity structure. (c) Proposed multi-level structure. Fig. 1: Comparison of different structures in the weight matrix of a fully connected layer with 6 input neurons and 6 output neurons. Each row denotes the weights connected to one input neuron. regularization and one-layer prior [15] are often adopted to regularize individual weights. Such regularization is simple and optimization-friendly; however, both resulting weights and neurons are completely randomly connected since there is no extra constraint on the pruned weights. In the weight matrix, this means that the elements are set to zero without any structure, which results in the remaining elements also having no specific structures. When translated into neural network topology, this means that the surviving weights and neurons are randomly connected, as illustrated in Fig. 1a. Because of the random connections in the pruned network, such a structure is not friendly to practical applications such as storage, computation and transmission [5], [20]. 2) Group Sparsity in the Weight Matrix: In group sparsity, the weights are pruned in groups. Particularly, in fully weight matrix topologyTotally random......neural network topology:Totally randomweight matrix topology1.Simpleweight-levelstructure:Elementscanbeprunedinrow-level,butsurvivingelementsofeachrowarenon-structured.2.Noneuron-levelstructure:Survivingrowsarerandomlydistributed.......neural network topology:1.Simpleweight-levelstructure:Weightscanbeprunedingroups,butsurvivingweightsofunprunedneuronarenon-structured.2.Noneuron-levelstructure:Survivingneuronsarerandomlydistributed.Weight matrix topology1.Per-neuronweight-levelstructure:Survivingelementsofeachrowtendtogatheringroups.2.Neuron-levelstructure:Survivingrowstendtogatheringroups.3.Structureisflexible.......neural network topology:1.Per-neuronweight-levelstructure:Survivingweightsofaneurontendtogatheringroups.2.Neuron-levelstructure:Survivingneuronsineachlayertendtogatheringroups.3.Structureisflexible.weight matrix topologyTotally random......neural network topology:Totally randomweight matrix topology1.Simpleweight-levelstructure:Elementscanbeprunedinrow-level,butsurvivingelementsofeachrowarenon-structured.2.Noneuron-levelstructure:Survivingrowsarerandomlydistributed.......neural network topology:1.Simpleweight-levelstructure:Weightscanbeprunedingroups,butsurvivingweightsofunprunedneuronarenon-structured.2.Noneuron-levelstructure:Survivingneuronsarerandomlydistributed.Weight matrix topology1.Per-neuronweight-levelstructure:Survivingelementsofeachrowtendtogatheringroups.2.Neuron-levelstructure:Survivingrowstendtogatheringroups.3.Structureisflexible.......neural network topology:1.Per-neuronweight-levelstructure:Survivingweightsofaneurontendtogatheringroups.2.Neuron-levelstructure:Survivingneuronsineachlayertendtogatheringroups.3.Structureisflexible.weight matrix topologyTotally random......neural network topology:Totally randomweight matrix topology1.Simpleweight-levelstructure:Elementscanbeprunedinrow-level,butsurvivingelementsofeachrowarenon-structured.2.Noneuron-levelstructure:Survivingrowsarerandomlydistributed.......neural network topology:1.Simpleweight-levelstructure:Weightscanbeprunedingroups,butsurvivingweightsofunprunedneuronarenon-structured.2.Noneuron-levelstructure:Survivingneuronsarerandomlydistributed.Weight matrix topology1.Per-neuronweight-levelstructure:Survivingelementsofeachrowtendtogatheringroups.2.Neuron-levelstructure:Survivingrowstendtogatheringroups.3.Structureisflexible.......neural network topology:1.Per-neuronweight-levelstructure:Survivingweightsofaneurontendtogatheringroups.2.Neuron-levelstructure:Survivingneuronsineachlayertendtogatheringroups.3.Structureisflexible. JOURNAL OF XXX 4 group sparsity. In a weight matrix, this means the non-zero elements of each row should follow some regular structure. 2) Neuron-level structured sparsity: The surviving neurons of each layer should also have some regular structures. In a weight matrix, this means that the non-zero rows should also follow some structure. 3) Flexibility: The structure of the resulting weight matrix should be sufficiently flexible so that we can achieve a trade off between model complexity and predicting accuracy in different scenarios. Fig. 1c illustrates an example of a desired structure in the weight matrix. In each row, the significant values tend to gather in groups. When translated into neural network topology, this enables the advanced weight-level structure: The surviving weights of each neuron tend to gather in groups. In each column, the sig- nificant values also tend to gather in groups. When translated into neural network topology, this enables the neuron-level structure: The surviving neurons in each layer tend to gather in groups. Moreover, the group size in each row and column can be tuned to achieve a trade off between model complexity and predicting accuracy. Such proposed multi-level structures enable the datapath to exploit the compression to simplify the computation with very small control overheads. Specifically, the advantages of our proposed multi-level structure are listed as follows. 1) High decoding and computing parallelism: As illustrated in Fig. 2 (a), with the blocked structure, the decoding can be performed in block wise such that all the weights in the same block can be decoded simultaneously. More- over, the regular structure can bring more parallelism in computation. For example, more efficient matrix tiling can be applied, where the zero blocks can be skipped during matrix multiplication, as illustrated in Fig. 2 (b). Also, the kernels can be compressed into smaller size, such that the inputs corresponding to the zero weights can be skipped [20]. 2) Efficient neuron pruning: As illustrated in Fig. 2 (c), the structured surviving weights from the previous layer can lead to a structured and compact neuron activation in the next layer, which is beneficial for more efficient neuron pruning. 3) More efficient storage: With the blocked structure, we can simply record the location and size for each block rather than recording the exact location for each weight. For a weight matrix with average cluster size of m × m and number of clusters P , the coding gain over tradi- tional COO format is O (cid:0)P m2(cid:1). In this paper, we focus on promoting a multi-level group structure in model compression. In our proposed structure, the surviving weights connected to a neuron tend to gather in groups and the surviving neurons also tend to gather in groups. Additionally, the group size is tunable so that our proposed structure is flexible. C. Three-Layer Hierarchical Prior Model The probability model of the sparse prior provides the foun- dation of specific sparse structures. As previously mentioned, existing sparse priors for model compression cannot promote the multi-level structure in the weight matrix. To capture the multi-level structured sparsity, we propose a three-layer hierarchical prior by combining the two-layer prior and the support based prior [18]. Let w denote a weight in the neural network. For each weight w, we introduce a support s ∈ {0, 1} to indicate whether the weight w is active (s = 1) or inactive (s = 0). Specifically, let ρ denote the precision for the weight w. That is, 1/ρ is the variance of w. When s = 0, the distribution of ρ is chosen to satisfy E [ρ] (cid:29) 1, so that the variance of the corresponding weight w is very small. When s = 1, the distribution of ρ is chosen to satisfy E [ρ] = O (1), so that w has some probability to take significant values. Then, the three-layer hierarchical prior (joint distribution of w, ρ, s) is given by p (w, ρ, s) = p (s) p (ρ|s) p (w|ρ) , (1) where w denotes all the weights in the neural network, ρ denotes the corresponding precisions, and s denotes the corre- sponding supports. The distribution of each layer is elaborated below. Probability Model for p (s): p (s) can be decomposed into each layer by p (s) = (cid:81)L l=1 p (sl), where L is the total layer number of the neural network and sl denotes the supports of the weights in the l-th layer. Now we focus on the l-th layer. Suppose the dimension of the weight matrix is K × M , i.e., the layer has K input neurons and M output neurons. The distribution p (sl) of the supports is used to capture the multi-level structure in this layer. Since we focus on a specific layer now, we use p (s) to replace p (sl) in the following discussion for notation simplicity. In order to promote the aforementioned multi-level structure, the active elements in each row of the weight matrix should gather in clusters and the active elements in each column of the weight matrix should also gather in clusters. Such a block structure can be achieved by modeling the support matrix as a Markov random field (MRF). Specifically, each row of the support matrix is modeled by a Markov chain as p (srow) = p (srow,1) M (cid:89) p (srow,m+1|srow,m) , (2) m=1 where srow denotes the row vector of the support matrix, and srow,m denotes the m-th element in srow. The transition prob- ability is given by p (srow,m+1 = 1|srow,m = 0) = prow and 01 p (srow,m+1 = 0|srow,m = 1) = prow 10 . Generally, a smaller prow leads to a larger average gap between two clusters, and a 01 smaller prow leads to a larger average cluster size. Similarly, 10 each column of the support matrix is also modeled by a Markov chain as p (scol) = p (scol,1) K (cid:89) p (scol,k+1|scol,k) , (3) k=1 where scol denotes the column vector of the support matrix and scol,k denotes the n-th element in scol. The transition probability is given by p (scol,k+1 = 1|scol,k = 0) = pcol 01 and p (scol,k+1 = 0|scol,k = 1) = pcol 10 . Such an MRF model is also JOURNAL OF XXX 5 Fig. 2: (a) Illustration of decoding parallelism. In existing sparse structures, the decoding step for each row can be vastly different because of the irregular structure. In our proposed structure, each block can be decoded simultaneously because each block can be coded as a whole. (b) Illustration of computing parallelism. In existing sparse structures, the matrix-matrix multiplication has to be performed element-wise because each non-zero weight is individually encoded. The processor has to fetch individual weights and multiply them to individual input elements to get the individual output element (green square). In our proposed structure, parallel techinics for dense matrix such as matrix tiling can be applied. Moreover, due to the clustered structure, the zero block (gray block) can be skipped during computing the output (green block). (c) Illustration of efficient neuron pruning. In existing sparse structures, the surviving weights of each neuron are randomly connected to the neurons in the next layer, which will randomly activate neurons in the next layer. In our proposed structure, the surviving weights of each neuron tend to activate the same neurons in the next layer, which can lead to a structured and compact neuron activation in the next layer. active. In this case, the shape parameter an and rate parameter = E [ρn] = O (1) such that the bn should satisfy that an bn variance of wn is O (1). When sn = 0, the corresponding weight wn is inactive. In this case, the shape parameter an and = E [ρn] (cid:29) 1 such rate parameter bn should satisfy that an bn that the variance of wn is very close to zero. The motivation for choosing Gamma distribution is that Gamma distribution is conjugate to Gaussian distribution. Thus, it can leads to a closed form solution in Bayesian inference [17]. Probability Model for p (w|ρ): The conditional probability p (w|ρ) is given by p (w|ρ) = N (cid:89) n=1 p (wn|ρn) , (5) where p (wn|ρn) is assumed to be a Gaussian distribution: p (wn|ρn) = N wn|0, (cid:18) (cid:19) . 1 ρn (6) Although the choice of p (wn|ρn) is not restricted to Gaussian distribution [16], the motivation for choosing Gaussian is still reasonable. First, according to existing simulations, the com- pression performance is not so sensitive to the distribution type of p (wn|ρn) [16], [15]. Moreover, assuming p (wn|ρn) to be a Gaussian distribution also contributes to easier optimization in Bayesian inference, as shown in Section IV. Remark 1. (Comparison with existing sparse priors) One of the main differences between our work and the existing works [15], [16] is the design of the prior. Because of the MRF support layer, our proposed three-layer prior is more general and can capture more regular structures such as the Fig. 3: Illustration of the support prior for a 6 × 6 weight matrix. known as a 2D Ising model. An illustration of the MRF prior is given in Fig. 3. Note that p (s) can also be modeled with other types of priors, such as Markov tree prior and hidden Markov prior, to promote other structures. Probability Model for p (ρ|s): The conditional probability p (ρ|s) is given by p (ρ|s) = N (cid:89) n=1 (Γ (ρn; an, bn))sn (cid:0)Γ (cid:0)ρn; an, bn (cid:1)(cid:1)1−sn , (4) where N is the total number of weights in the neural network. ρn takes two different Gamma distributions according to the value of sn. When sn = 1, the corresponding weight wn is JOURNAL OF XXX 6 desired multi-level structure. Such a multi-level structure in the weight matrix cannot be modeled by the existing priors in [15] and [16] but our proposed prior can easily support the sparse structures in them. In our work, if the prior p (w, ρ, s) reduces to one layer p (w) and takes a Laplace distribution, it is equivalent to a Lasso regularization. In this way, random sparsity can be realized. If the prior p (w, ρ, s) reduces to one layer p (w) and takes an improper log-scale uniform distribution, it is exactly the problem of variational dropout [15]. In this way, random sparsity can be realized. If the prior p (w, ρ, s) reduces to a two-layer p (w|ρ), and takes the group improper log-uniform distribution or the group horseshoe distribution, it is exactly the problem in [16]. In this way, group sparsity can be realized. Moreover, since our proposed prior is more complicated, it also leads to a different algorithm design in Section IV. (a) Illustration of N N (x, w) in MLP. (b) Illustration of N N (x, w) in CNN. III. BAYESIAN MODEL COMPRESSION FORMULATION Fig. 4: Illustration of N N (x, w) in different neural networks. Bayesian model compression handles the model compres- sion problem from a Bayesian perspective. In Bayesian model compression, the weights follow a prior distribution, and our primary goal is to find the posterior distribution conditioned on the dataset. In the following, we elaborate on the neural network model and the Bayesian training of the DNN. where σ2 classification tasks, it can be modeled as d is the noise variance in training data, while in p (yd|xd, w) = exp (−G (yd|xd, w)) , (9) where G (yd|xd, w) is the cross-entropy error function. A. Neural Network Model B. Bayesian Training of DNNs We first introduce the neural network model. Let D = {(x1, y1) , (x2, y2) , ..., (xD, yD)} denote the dataset, which contains D pairs of training input (xd) and training output (yd). Let N N (x, w) denote the output of the neural network with input x and weights w, where N N (*) is the neural network function. Note that N N (x, w) is a generic neural network model, which can embrace various commonly used structures, some examples are listed as follows. • Multi-Layer Perceptron (MLP): MLP is a representa- tive class of feedforward neural network, which consists of an input layer, output layer and hidden layers. As illustrated in Fig. 4a, we can use N N (x, w) to represent the feedforward calculation in an MLP. • Convolutional Neural Network (CNN): A CNN con- sists of convolutional kernels and dense layers. As illus- trated in Fig. 4b, we can use N N (x, w) to represent the complicated calculation in a CNN. Since the data points from the training set are generally assumed to be independent, we can use the following stochas- tic model to describe the observations from a general neural network: y ∼ p (D|w) = D (cid:89) d=1 p (yd|xd, w) , (7) where the likelihood p (yd|xd, w) can be different for regres- sion and classification tasks [26]. In regression tasks, it can be modeled as a Gaussian distribution: Bayesian training of a DNN is actually calculating the pos- terior distribution p (w, ρ, s|D) based on the prior distribution p (w, ρ, s) and the neural network stochastic model (7). In our research, after we obtain the posterior p (w, ρ, s|D), we use the maximum a posteriori (MAP) estimate of w, ρ and s as a deterministic estimate of the weights, precision and support, respectively: (w, ρ, s)∗ = arg max w,ρ,s p (w, ρ, s|D) . (10) According to Bayesian rule, the posterior distribution of w, ρ and s can be derived as p (w, ρ, s|D) = p (D|w, ρ, s) p (w, ρ, s) p (D) , (11) where p (D|w, ρ, s) is the likelihood term. Based on (7) and (8), it is given by: p (D|w, ρ, s) = D (cid:89) d=1 p (yd|xd, w, ρ, s) , p (yd|xd, w, ρ, s) = N (cid:0)N N (xd, w, ρ, s) , σ2 d (cid:1) . (12) (13) Equation (11) mainly contains two terms: 1) Likelihood p (D|w, ρ, s), which is related to the expression of dataset. 2) Prior p (w, ρ, s), which is related to the sparse structure we want to promote. Intuitively, by Bayesian training of the DNN, we are actually simultaneously 1) tuning the weights to express the dataset and 2) tuning the weights to promote the structure captured in the prior. However, directly computing the posterior according to (11) p (yd|xd, w) = N (cid:0)N N (xd, w) , σ2 d (cid:1) , (8) involves several challenges, summarized as follows. JOURNAL OF XXX 7 Fig. 5: Factor graph of the joint distribution p (w, ρ, s, D). • Intractable multidimensional integral: The calculation of the exact posterior p (w, ρ, s|D) involves calculating the so-called evidence term p (D). The calculation of (cid:82) (cid:82) p (D|w, ρ, s) p (w, ρ, s) dwdρ is usu- p (D) = (cid:80) s ally intractable as the likelihood term can be very com- plicated [26]. • Complicated prior term: Since the prior term p (w, ρ, s) contains an extra support layer p (s), the KL-divergence between the approximate distribution and the posterior distribution is difficult to calculate or approximate. Tra- ditional VBI method cannot be directly applied to achieve an approximate posterior distribution. In the next section, we propose a Turbo-VBI based model compression method, which approximately calculates the marginal posterior distribution of w, ρ and s. IV. TURBO-VBI ALGORITHM FOR MODEL COMPRESSION To handle the aforementioned two challenges, we pro- pose a Turbo-VBI [17] based model compression algorithm. The basic idea of the proposed Turbo-VBI algorithm is to approximate the intractable posterior p (w, ρ, s|D) with a variational distribution q (w, ρ, s). The factor graph of the joint distribution p (w, ρ, s, D) is illustrated in Fig. 5, where the variable nodes are denoted by white circles and the factor nodes are denoted by black squares. Specifically, the factor graph is derived based on the factorization Fig. 6: Illustration of the two modules in the Turbo-VBI algorithm. separating the complicated probability model in Fig. 5 into two parts, and perform Bayesian inference respectively, as illustrated in Fig. 6. Specifically, we follow the turbo frame- work and divide the factor graph into two parts. One is the support part (Part B), which contains the prior information. The other one is the remaining part (Part A). Correspondingly, the proposed Turbo-VBI algorithm is also divided into two modules such that each module performs Bayesian inference on its corresponding part respectively. Module A and Module B also need to exchange messages. Specifically, the output message vh→sn of Module B refers to the message from factor node hA,n to variable node sn in Part A, and is equivalent to the message from variable node sn to factor node hB,n in Part B, which refers to the conditional marginal probability p (sn|vη→s). It is calculated by sum-product message passing (SPMP) on part B, and acts as the input of Module A to facilitate the VBI on Part A. The output message vηn→sn of Module A refers to the posterior probability subtracting the output of Module B: q(sn) , and acts as the input of Module vh→sn B to facilitate SPMP on Part B. Specifically, the probability model for the prior distribution p (w, ρ, s, D) = p (D|w) p (w|ρ) p (ρ|s) p (s) . (14) in Part A is assumed as the variable nodes are w, ρ and As illustrated in Fig. 5, s, g denotes the likelihood function, f denotes the prior distribution p (wn|ρn) for weights w, η denotes the prior distribution p (ρn|sn) for precision ρ, and h denotes the joint prior distribution p (s) for support s. The detailed expression of each factor node is listed in Table I. A. Top Level Modules of the Turbo-VBI Based Model Com- pression Algorithm ˆp (w, ρ, s) = ˆp (s) p (ρ|s) p (w|ρ) , (15) where ˆp (s) = N (cid:89) n=1 (πn)sn (1 − πn)1−sn is a new prior for support s. πn is the probability that sn = 1, which is defined as: πn = p (sn = 1) = vh→sn (1) vh→sn (1) + vh→sn (0) . (16) Since the factor graph in Fig. 5 has loops, directly applying the message passing algorithm usually cannot achieve a good performance. In addition, since the probability model is more complicated than the existing ones in [15] and [16], it is difficult to directly apply the VBI algorithm. Thus, we consider Note that the only difference between the new prior in (15) and that in (1) is that the complicated p (s) is replaced by a simpler distribution ˆp (s) with independent entries. The correlations among the supports are separated into Part B. Then, based on the new prior ˆp (w, ρ, s), Module A performs a VBI algorithm. .....................1y2yDy1g2gDg1w2w3w4w2Nw−1Nw−Nw1f2f3f4f2Nf−1Nf−Nf1ρ2ρ3ρ4ρ2Nρ−1Nρ−Nρ1η2η3η4η2Nη−1Nη−Nη1s2s3s4s2Ns−1Ns−Nsh1x2xDx()|pw()|pwρ()|pρs()ps.....................1y2yDy1g2gDg1w2w3w4w2Nw−1Nw−Nw1f2f3f4f2Nf−1Nf−Nf12342N−1N−N12342N−1N−N1s2s3s4s2Ns−1Ns−Nsh1x2xDx...1s2s3s4s2Ns−1Ns−Ns,1Ah,2Ah,3Ah,4Ah,2ANh−,1ANh−,ANh,BNh,1BNh−,2BNh−,4Bh,3Bh,2Bh,1BhPart APart BVariational Bayesian inferenceSupport estimator()qw()qρddsv→extdhsv→Module AModule B JOURNAL OF XXX 8 TABLE I: Detailed expression of each factor node. Factor node gd (xd, yd, w) fn (wn, ρn) Distribution p (yd|xd, w) p (wn|ρn) ηn (ρn, sn) h p (ρn|sn) p (s) Function N (cid:0)N N (xd, w) , σ2 wn|0, 1 ρn (cid:16) N (cid:16) (cid:17) d (cid:1) (Γ (ρn; an, bn))sn (cid:16) Γ MRF prior. p (srow,m+1|srow,m) , p (cid:0)scol,k+1|scol,k ρn; an, bn (cid:17)(cid:17)1−sn (cid:1) In the VBI algorithm, variational distributions q (w), q (ρ) and q (s) are used to approximate the posterior. After that, the approximate posterior q (s) is delivered from Module A back into Module B. The delivered message vηn→sn is defined as minimization of KL divergence is usually transformed into a minimization of the negative evidence lower bound (ELBO), subject to a factorized form constraint [28]. Sparse VBI Problem: vηn→sn = q (sn) vh→sn , (17) according to the sumproduct rule. With the input message vηn→sn , Module B further performs SPMP over Part B to exploit the structured sparsity, which is contained in the prior distribution p (s) . Specifically, in Part B, the factor nodes hB,n = vηn→sn, n = 1, ..., N (18) carry the information of the variational posterior distribution q (s), and the factor node h carries the structured prior information of p (s). By performing SPMP over Part B, the message vh→sn can be calculated and then delivered to Mod- ule A. These two modules exchange messages iteratively until convergence or the maximum iteration number is exceeded. After this, the final outputs q (w), q (ρ) and q (s) of Module A are the approximate posterior distribution for w, ρ, and s, respectively. Note that although the SPMP is not guaranteed to converge on Part B, because our p (s) is an MRF prior, the desired structure is usually well promoted in the final output of Module A, as illustrated in the simulation results. This is because SPMP can achieve good results on 2-D Ising model and there have been many solid works concerning SPMP on loopy graphs [27]. And our proposed VBI compression algorithm in Module A can achieve good enough performance to capture the structure. In addition, since the design of p (s) is flexible, one can model it with Markov chain priors or Markov tree priors. In this case, the convergence is guaranteed. In the following, we elaborate the two modules in details. B. Sparse VBI Estimator (Module A) In Module A, we want to use a tractable variational dis- tribution q (w, ρ, s) to approximate the intractable posterior distribution ˆp (w, ρ, s|D) under the prior ˆp (w, ρ, s). The quality of this approximation is measured by the Kullback- Leibler divergence (KL divergence): DKL (q (w, ρ, s) ||ˆp (w, ρ, s|D)) (cid:90) (cid:90) (cid:88) = s q (w, ρ, s) ln dwdρ. (19) q (w, ρ, s) ˆp (w, ρ, s|D) min q(w,ρ,s) − ELBO, s.t.q (w, ρ, s) = N (cid:89) n=1 q (wn) q (ρn) q (sn) , (20) (cid:82) (cid:82) q (w, ρ, s) ln p (D|w, ρ, s) dwdρ − where ELBO = (cid:80) s DKL (q (w, ρ, s) ||ˆp (w, ρ, s)) . The constraint means all indi- vidual variables w, ρ and s are assumed to be independent. Such an assumption is known as the mean field assumption and is widely used in VBI methods [16], [28]. The problem in (20) is non-convex and generally we can only achieve a stationary solution q∗ (w, ρ, s). A stationary solution can be achieved by applying a block coordinate descent (BCD) algorithm to the problem in (20), as will be proved in Lemma 1. According to the idea of the BCD algorithm, to solve (20) is equivalent to iteratively solving the following three subproblems. Subproblem 1 (update of ρ): min q(ρ) DKL (q (ρ) ||(cid:101)pρ) , s.t.q (ρ) = N (cid:89) n=1 q (ρn) , where ln (cid:101)pρ = (cid:104)ln ˆp (w, ρ, s, D)(cid:105)q(s)q(w) . Subproblem 2 (update of s): min q(s) DKL (q (s) ||(cid:101)ps) , s.t.q (s) = N (cid:89) n=1 q (sn) , where ln (cid:101)ps = (cid:104)ln ˆp (w, ρ, s, D)(cid:105)q(ρ)q(w) . Subproblem 3 (update of w): min q(w) DKL (q (w) ||(cid:101)pw) , s.t.q (w) = N (cid:89) n=1 q (wn) , (21) (22) (23) Thus, the goal is to find the optimal variational distribution q (w, ρ, s) that minimizes this KL divergence. However, the KL divergence still involves calculating the intractable pos- terior ˆp (w, ρ, s|D). In order to overcome this challenge, the where ln (cid:101)pw = (cid:104)ln ˆp (w, ρ, s, D)(cid:105)q(ρ)q(s) and (cid:104)f (x)(cid:105)q(x) = (cid:82) f (x) q (x) dx. The detailed derivations of the three subprob- lems are provided in the Appendix A. In the following, we elaborate on solving the three subproblems respectively. JOURNAL OF XXX 9 1) Update of q (ρ): In subproblem 1, obviously, the optimal solution q(cid:63) (ρ) is achieved when q(cid:63) (ρ) = (cid:101)pρ. In this case, q(cid:63) (ρ) can be derived as q(cid:63) (ρ) = N (cid:89) (cid:16) Γ n=1 ρn; (cid:101)an, (cid:101)bn (cid:17) , where (cid:101)an and (cid:101)bn are given by: (cid:101)an = (cid:104)sn(cid:105) an + (cid:104)1 − sn(cid:105) an + 1 = (cid:101)πnan + (1 − (cid:101)πn) an + 1, (cid:101)bn = (cid:10)|wn|2(cid:11) + (cid:104)sn(cid:105) bn + (cid:104)1 − sn(cid:105) bn (24) (25) (26) = |μn|2 + σ2 n + (cid:101)πnbn + (1 − (cid:101)πn) bn, where μn and σ2 n are the posterior mean and variance of weight wn respectively, and (cid:101)πn is the posterior expectation of sn. 2) Update of q (s): In subproblem 2, we can achieve the optimal solution q(cid:63) (s) by letting q(cid:63) (s) = (cid:101)ps. In this case, q(cid:63) (s) can be derived as q(cid:63) (s) = N (cid:89) n=1 ((cid:101)πn)sn (1 − (cid:101)πn)1−sn , (27) where (cid:101)πn = C1 C1+C2 . C1 and C2 are given by: C1 = πnban n Γ (an) e(an−1)(cid:104)ln ρn(cid:105)−bn(cid:104)ρn(cid:105), (28) C2 = an n (1 − πn) b Γ (an) e(an−1)(cid:104)ln ρn(cid:105)−bn(cid:104)ρn(cid:105), (29) dx ln (Γ (x)) is where (cid:104)ln ρn(cid:105) = ψ ((cid:101)an) − ln the digamma function. The detailed derivation of q(cid:63) (ρ) and q(cid:63) (s) is provided in the Appendix B. , ψ (x) = d (cid:17) (cid:16) (cid:101)bn 3) Update of q (w): Expanding the objective function in subproblem 3, we have DKL (q (w) ||(cid:101)pw) = Eq(w) ln q (w) − Eq(w) (cid:104) (cid:104)ln p (w, ρ, s, D)(cid:105)q(ρ)q(s) (cid:105) (cid:16) = Eq(w) ln q (w) − (cid:104)ln p (w|ρ)(cid:105)q(ρ) (cid:17) − Eq(w) ln p (D|w) + const. (cid:17) (cid:16) (30) Similar to traditional variational Bayesian model compression [16], [15], the objective function (30) contains two parts: the "prior part" Eq(w) ln q (w) − (cid:104)ln p (w|ρ)(cid:105)q(ρ) and the "data part" Eq(w) ln p (D|w). The prior part forces the weights to follow the prior distribution while the data part forces the weights to express the dataset. The only difference from traditional variational Bayesian model compression [16], [15] is that the prior term (cid:104)ln p (w|ρ)(cid:105)q(ρ) is parameterized by ρ and ρ carries the structure captured by the three layer hierarchical prior. Our aim is to find the optimal q (w) that minimizes DKL (q (w) ||(cid:101)pw), subject to the factorized constraint q (w) = (cid:81)N n=1 q (wn). It can be observed that the objective function contains the likelihood term ln p (D|w), which can be very complicated for complex models. Thus, to obtain subproblem 3 is non-convex and it the optimal solution. In the following, we aim at finding a is difficult stationary solution q∗ (w) for subproblem 3. There are several challenges in solving subproblem 3, summarized as follows. . (cid:17) the form for 1: Closed (cid:16) ln q (w) − (cid:104)ln p (w|ρ)(cid:105)q(ρ) part prior Challenge Eq(w) In traditional varia- tional Bayesian model compression, this expectation is usually calculated by approximation [15], which involves approximating error. To calculate the expectation accurately, a closed form for this expectation is required. Challenge 2: Low-complexity deterministic approxima- tion for the data part Eq(w) ln p (D|w). In traditional variational Bayesian model compression [16], [15], this intractable expectation is usually approximated by Monte Carlo sampling. However, Monte Carlo approximation has been pointed out to have high complexity and low robust- ness. In addition, the variance of the Monte Carlo gradient estimates is difficult to control [19]. Thus, a low-complexity deterministic approximation for the likelihood term is re- quired. (cid:16) (cid:17) n Closed form for Eq(w) (cid:1), q (w) = (cid:81)N ln q (w) − (cid:104)ln p (w|ρ)(cid:105)q(ρ) . To overcome Challenge 1, we propose to use a Gaussian dis- is, q (wn) = tribution as the approximate posterior. That N (cid:0)μn, σ2 n are the variational parameters that we want to optimize. Then, since the prior p (w|ρ) is also chosen as a Gaussian distribution, Eq(w) can be written as the KL- divergence between two Gaussian distributions. Thus, the expectation has a closed form and can be calculated up to a constant. Specifically, by expanding p (w|ρ), we have n=1 q (wn), μn and σ2 ln q (w) − (cid:104)ln p (w|ρ)(cid:105)q(ρ) (cid:17) (cid:16) (cid:104)ln p (w|ρ)(cid:105) = N (cid:88) (cid:28) (cid:114) ρn 2π ln (cid:29) w2 n 2 ρn e− n=1 N (cid:88) n=1 N (cid:88) n=1 N (cid:88) n=1 = = = (cid:28) 1 2 (cid:18) 1 2 ln ρn − w2 n 2 (cid:29) ρn + const. (cid:104)ln ρn(cid:105) − w2 n 2 (cid:19) (cid:104)ρn(cid:105) + const. (31) (ln p (wn| (cid:104)ρn(cid:105)) + const.) = ln p (w| (cid:104)ρ(cid:105)) + const., where we use (cid:104)*(cid:105) to replace (cid:104)*(cid:105)q(ρ) or (cid:104)*(cid:105)q(ρ) for simplicity. Thus, we have (cid:16) Eq(w) (cid:17) ln q (w) − (cid:104)ln p (w|ρ)(cid:105)q(ρ) = Eq(w) (ln q (w) − ln p (w|E [ρ])) + const. = DKL (q (w) ||p (w|E [ρ])) + const.. (32) Since q (w) and p (w|E [ρ]) are both Gaussian distributions, the KL-divergence between them has a closed form: DKL (q (w) ||p (w|E [ρ])) = N (cid:88) (cid:18) n=1 ln (cid:101)σn σn + σ2 n + μ2 n 2(cid:101)σ2 n − (cid:19) , 1 2 (33) JOURNAL OF XXX 10 n = 1 is the variance of the prior p (w|E [ρ]). where (cid:101)σ2 Since our aim is to minimize (30), the constant term in (32) can be omitted. E[ρn] Low-complexity for deterministic Eq(w) ln p (D|w). To overcome Challenge 2, we propose a for deterministic Eq(w) ln p (D|w) based on Taylor expansion. approximation low-complexity approximation For simplicity, let g (w) denote the complicated function ln p (D|w). Specifically, we want to construct a deterministic approximation for Ew∼q(w)g (w) with the variational parame- ters μn and σ2 n, n = 1, ..., N . Following the reparameterization trick in [15] and [29], we represent wn by μn + ξnσ2 n, ξn ∼ N (0, 1). In this way, wn is transformed into a determin- istic differentiable function of a non-parametric noise ξn, and Ew∼q(w)g (w) is transformed into Eξ∼N (0,1)g (cid:0)μ + ξσ2(cid:1). in traditional variational Bayesian model com- Note that this expectation is approximated by sampling ξ. pression, However, to construct a deterministic approximation, we take the first-order Taylor approximation of Eξ∼N (0,1)g (cid:0)μ + ξσ2(cid:1) at the point ξ = E [ξ] = 0, and we have Eξg (cid:0)μ + ξσ2(cid:1) ≈ g (cid:0)μ + E [ξ] * σ2(cid:1) = g (μ) . (34) That is, we use the first-order Taylor approximation to replace Eξg (cid:0)μ + ξσ2(cid:1). Simulation results show that our proposed approximation can achieve good performance. Additionally, since our proposed approximation is deterministic, the gradient variance can be eliminated. Based on the aforementioned discussion , subproblem 3 can be solved by solving an approximated problem as follows. Approx. Subproblem 3: N (cid:88) (cid:18) + min μ,σ2 ln (cid:101)σn σn n + μ2 σ2 n 2(cid:101)σ2 This problem is equivalent network with (35) as the loss function. 1 2 n=1 − n (cid:19) − ln p (D|μ) . (35) to training a Bayesian neural 4) Convergence of Sparse VBI: The sparse VBI in Module A is actually a BCD algorithm to solve the problem in (20). By the physical meaning of ELBO and KL divergence, the objective function is continuous on a compact level set. In addition, the objective function has a unique minimum for two coordinate blocks (q (ρ) and q (s)) [17], [28]. Since we can achieve a stationary point for the third coordinate block q (w), the objective function is regular at the cluster points generated by the BCD algorithm. Based on the above discussion, our proposed BCD algorithm satisfies the BCD algorithm convergence requirements in [30]. Thus, we have the following convergence lemma. Lemma 1. (Convergence of Sparse VBI): Every cluster point q∗ (w, ρ, s) = q(cid:63) (ρ) q(cid:63) (s) q∗ (w) generated by the sparse VBI algorithm is a stationary solution of problem (20). C. Message Passing (Module B) In Module B, SPMP is performed on the support factor graph Gs and the normalized message vsn→hB is fed back to Module A as the prior probability ˆp (sn). We focus on one fully connected layer with K input neurons and M output neurons for easy elaboration. The support prior Fig. 7: Illustration of the support factor graph in Module B with K input neurons and M output neurons. Algorithm 1 Turbo-VBI Algorithm for Model Compression Input: training set D, priors p (w), p (ρ), p (s), maximum iteration number Imax. Output: w∗, ρ∗, s∗. 1: Initialize πn. 2: for k = 1, ..., Im do Module A: 3: Initialize the variational distribution q (ρ) and q (s). 4: while not converged do 5: 6: 7: Update q (ρ), q (s) and q (w). end while Calculate vηn→sn based on (17) and send vηn→sn to Module B. Module B: Perform SPMP on Gs, send vh→sn to Module A. if converge then break 8: 9: 10: 11: 12: end if k = k + 1. 13: 14: 15: end for 16: Output w∗ = arg maxw q∗ (w), ρ∗ = arg maxρ q(cid:63) (ρ), s∗ = arg maxs q(cid:63) (s). p (s) for this K × M layer is modeled as an MRF. The factor graph Gs is illustrated in Fig. 7. Here we use si,j to denote the support variable in the i-th row and j-th column. The unary factor node hB,i,j carries the probability given by (18). The pair-wise factor nodes carry the row and column tran- sition probability p (srow,m+1|srow,m) and p (scol,k+1|scol,k), respectively. The parameters prow 10 for the MRF model are given in Section II-C. Let vs→f (s) denote the message from the variable node s to the factor node f , and vf→s (s) denote the message from the factor node f to the variable node s. According to the sum-product law, the 01 , prow 10 01 , pcol and pcol ..................1,1s1,2s1,Ms2,1s2,2s2,Ms,1Ks,2Ks,KMs,1,1Bh,2,1Bh,,1BKh,1,2Bh,2,2Bh,,2BKh,1,BMh,2,BMh,,BKMhSupport factor graph of a layer with K input neuron and M output neuron0110,colcolpp0110,colcolpp0110,rowrowpp0110,rowrowpps JOURNAL OF XXX 11 messages are updated as follows: vs→f (s) = (cid:89) vh→s (s) , (36) h∈n(s)\{f } (cid:40) vf→s (s) = f (s) f (s) * vt→f (t) f is unary f actor node, f is pairwise f actor node, (37) where n (s) \ {f } denotes the neighbour factor nodes of s except node f , and t denotes the other neighbour variable node of f except node s. After the SPMP algorithm is performed, the final message vs→hB from each variable node si,j to the connected unary factor node hB,i,j is sent back to Module A. The overall algorithm is summarized in Algorithm 1. in- Remark 2. (Comparison with traditional variational ference) Traditional variational inference cannot handle the proposed three-layer sparse prior p (w, ρ, s) while our pro- posed Turbo-VBI is specially designed to handle it. In existing Bayesian compression works [14]-[16], the KL-divergence be- tween the true posterior p (w|D) and the variational posterior q (w) is easy to calculate, so that the KL-divergence can be directly optimized. Thus, simple variational inference can be directly applied. The fundamental reason behind this is that the prior p (w) in these works are relatively simple, and they usually only have one layer [14], [15] or two layers [16]. Thus, the KL-divergence between the prior p (w) and the variational posterior q (w) is easy to calculate, which is a must in calculat- ing the KL-divergence between the true posterior p (w|D) and the variational posterior q (w). However, these simple priors cannot promote the desired regular structure in the weight matrix and lack the flexibility to configure the pruned structure. Thus, we introduce the extra support layer s, which leads to the three layer hierarchical prior p (w, ρ, s). With this three- layer prior, traditional variational inference cannot be applied because the KL-divergence between the prior p (w, ρ, s) and the variational posterior q (w, ρ, s) is difficult to calculate. In order to inference the posterior, we propose to separate the factor graph into two parts and iteratively perform Bayesian inference, which leads to our proposed Turbo-VBI algorithm. V. PERFORMANCE ANALYSIS In this section, we evaluate the performance of our proposed Turbo-VBI based model compression method on some stan- dard neural network models and datasets. We also compare with several baselines, including classic and state-of-the-art model compression methods. The baselines considered are listed as follows: 1) Variational dropout (VD): This is a very classic method in the area of Bayesian model compression, which is proposed in [15]. A single-layer improper log-uniform prior is assigned to each weight to induce sparsity during training. 2) Group variational dropout (GVD): This is proposed in [16], which can be regarded as an extension of VD into group pruning. In this algorithm, each weight follows a zero-mean Gaussian prior. The prior scales of the weights in the same group jointly follow an improper log-uniform distribution or a proper half-Cauchy distri- bution to realize group pruning. In this paper, we choose the improper log-uniform prior for comparison. Note that some more recent Bayesian compression methods mainly focus on a quantization perspective [14], [31], which is a different scope from our work. Although our work can be further extended into quantization area, we only focus on structured pruning here. To our best knowledge, GVD is still one of the state-of- the-art Bayesian pruning methods without considering quantization. 3) Polarization regularizer based pruning (polarization): This is proposed in [9]. The algorithm can push some groups of weights to zero while others to larger values by assigning a polarization regularizer to the batch norm scaling factor of each weight group min w 1 D D (cid:88) d=1 L (N N (xd, w) , yd) + R (w) + λ (t (cid:107)γ(cid:107)1 − (cid:107)γ − ̄γ1n(cid:107)1) , where λ (t (cid:107)γ(cid:107)1 − (cid:107)γ − ̄γ1n(cid:107)1) is the proposed polar- ization regularizer and γ is the batch norm scaling factor of each weight. 4) Single-shot network pruning (SNIP): This is proposed in [1]. The algorithm measures the weight importance by introducing an auxiliary variable to each weight. The importance of each weight is achieved before training by calculating the gradient of its "importance variable". After this, the weights with less importance are pruned before the normal training. We perform experiments on LeNet-5, AlexNet, and VGG-11 architectures, and use the following benchmark datasets for the performance comparison. 1) Fashion-MNIST [32]: It consists of a training set of 60000 examples and a test set of 10000 examples. Each example is a 28×28 grayscale image of real life fashion apparel, associated with a label from 10 classes. 2) CIFAR-10 [33]: It is the most widely used dataset to compare neural network pruning methods. It consists of a training set of 50000 examples and a test set of 10000 examples. Each example is a three-channel 32×32 RGB image of real life object, associated with a label from 10 classes. 3) CIFAR-100 [33]: It is considered as a harder version of CIFAR-10 dataset. Instead of 10 classes in CIFAR-10, it consists of 100 classes with each class containing 600 images. There are 500 training images and 100 testing images in each class. We will compare our proposed Turbo-VBI based model com- pression method with the baselines from different dimensions, including 1) an overall performance comparison; 2) visual- ization of the weight matrix structure; 3) CPU and GPU acceleration and 4) robustness of the pruned neural network. We run LeNet-5 on Fashion-MNIST, and AlexNet on CIFAR-10 and VGG on CIFAR-100. Throughout the experi- ments, we set the learning rate as 0.01, and a = b = a = 1, b = 1 × 10−3. For LeNet-5+Fashion-MNIST, we set the batch size JOURNAL OF XXX 12 as 64, and for AlexNet+CIFAR-10 and VGG+CIFAR-100, we set the batchsize as 128 . All the methods except for SNIP go through a fine tuning after pruning. For LeNet, the fine tuning is 15 epochs while for AlexNet and VGG, the fine tuning is 30 epochs. Note that the models and parameter settings may not achieve state-of-the-art accuracy but it is enough for comparison. A. Overall Performance Comparison We first give an overall performance comparison of different methods in terms of accuracy, sparsity rate, pruned structure and FLOPs reduction. The results are summarized in Table II. The structure is measured by output channels for convolutional layers and neurons for fully connected layers. It can be ob- served that our proposed method can achieve an extremely low sparsity rate, which is at the same level (or even lower than) the unstructured pruning methods (VD and SNIP). Moreover, it can also achieve an even more compact pruned structure than the structured pruning methods (polarization and GVD). At the same time, our proposed method can maintain a competitive accuracy. We summarize that the superior performance of our proposed method comes from two aspects: 1) superior individual weight pruning ability, which leads to low sparsity rate, and 2) superior neuron pruning ability, which leads to low FLOPs. Compared to random pruning methods like VD and SNIP which generally can achieve lower sparsity rate than group pruning methods, our proposed method can achieve even lower sparsity rate. This shows that our proposed sparse prior has high efficiency in pruning individual weights. This is because the regularization ability of p (w|ρ) can be configured by setting small b. Compared to group pruning methods like GVD and polarization, our proposed method can achieve a more compact structure. This shows our proposed method is also highly efficient in pruning neurons. The reason is two fold: First, each row in the prior p (s) can be viewed as a Markov chain. When some weights of a neuron are pruned, the other weights will also have a very high probability to be pruned. Second, the surviving weights in a weight matrix tend to gather in clusters, which means the surviving weights of different neurons in one layer tend to activate the same neurons in the next layer. This greatly improves the regularity from the input side, while the existing group pruning methods like GVD and polarization can only regularize the output side of a neuron.Visualization of Pruned Structure In this subsection, we visualize the pruned weight matrix of our proposed method and compare to the baselines to further elaborate the benefits brought by the proposed regular structure. Fig. 8 illustrates the 6 kernels in the first layer of LeNet. We choose GVD and polarization for comparison here because these two are also structured pruning methods. It can be observed that GVD and polarization can both prune the entire kernels but the weights in the remaining kernels cannot be pruned and have no structure at all. However, in our proposed method, the weights in the remaining kernels are clearly pruned in a structured manner. In particular, we find that the three remaining 5 × 5 kernels all fit in smaller kernels Fig. 8: Kernel structures of CONV_1 in LeNet. (a) Avg. inferencing time on CPU. (b) Avg. inferencing time on GPU. Fig. 9: Avg. time costed by one forward pass of a batch on CPU and GPU. For LeNet and AlexNet, the batch size is 10000 examples and each results is averaged on 1000 experiments. For VGG, the batch size is 1000 examples and each result is averaged on 100 experiments. with size 3 × 3. This clearly illustrates the clustered structure promoted by the MRF prior. With the clustered pruning, we can directly replace the original large kernels with smaller kernels, and enjoy the storage and computation benefits of the smaller kernel size. B. Acceleration Performance In this subsection, we compare the acceleration performance of our proposed method to the baselines. Note that the primary goal of the structured pruning is to reduce the computational complexity and accelerate the inference of the neural networks. In the weight matrix of our proposed method, we record the clusters larger than 3 × 3 as an entirety. That is, we record the location and size of the clusters instead of recording the exact location for each element. In Fig. 9, we plot the average time costed by one forward pass of a batch on CPU and GPU respectively. It can be observed that our proposed method JOURNAL OF XXX 13 Network LeNet-5 6-16-120-84 Network AlexNet 6-16-32-64-128-120-84 Network VGG-11 64-128-256-256-512- 512-512-512-100 Method No pruning VD GVD Polarization SNIP Proposed Method No pruning VD GVD Polarization SNIP Proposed Method No pruning VD GVD Polarization SNIP Proposed Accuracy (%) 89.01 88.91 88.13 87.27 82.83 88.77 |w(cid:54)=0| |w| (%) 100 6.16 4.20 17.96 9.68 1.14 Pruned structure 6-16-120-84 6-15-49-51 5-7-21-23 4-8-46-27 5-16-73-57 3-5-16-17 FLOPs reduction (%) 0 11.82 53.89 59.04 19.82 76.03 (a) Results on LeNet+Fashion-MNIST. Accuracy (%) 66.18 64.91 64.82 63.95 63.19 65.57 |w(cid:54)=0| |w| (%) 100 3.17 9.30 25.95 11.75 3.42 Pruned structure 6-16-32-64-128-120-84 6-16-31-61-117-42-74 6-16-27-31-21-17-14 4-15-16-20-19-58-53 6-16-30-57-102-56-68 6-16-25-20-7-7-7 FLOPs reduction (%) 0 6.12 39.29 65.27 12.51 45.94 (b) Results on AlexNet+CIFAR-10. Accuracy (%) 68.28 67.24 66.52 64.41 65.20 67.12 |w(cid:54)=0| |w| (%) 100 5.39 9.05 26.74 17.79 4.68 Pruned structure 64-128-256-256-512- 512-512-512-100 64-128-256-211-447- 411-293-279-44 63-112-204-134-271- 174-91-77-33 62-122-195-148- 291-133-76-74-68 64-128-254-246-441- 479-371-274-69 60-119-191-148- 181-176-44-64-59 FLOPs reduction (%) 0 16.63 60.90 59.54 7.92 63.14 (c) Results on VGG11+CIFAR-100. TABLE II: Overall performance comparisons to the baselines on different network models and datasets. Top-1 accuracy is reported. The best results are bolded. can achieve the best acceleration performance on different models. For LeNet, our proposed method can achieve a 1.50× gain on CPU and 2.85× gain on GPU. For AlexNet, the results are 1.63× and 1.64×. For VGG, the results are 2.19× and 1.88×. Note that the unstructured pruning methods show little acceleration gain because their sparse structure is totally random. We summarize the reason for our acceleration gain from two aspects: 1) More efficient neuron pruning. As shown in subsection V-A, our proposed method can result in a more compact model and thus leading to a larger FLOPs reduction. 2) More efficient decoding of weight matrix. Existing methods require to store the exact location for each unpruned weight, no matter in CSR, CSC or COO format because the sparse structure is irregular. However, in our proposed method, we only need the location and size for each cluster to decode all the unpruned weights in the cluster. Thus, the decoding is much faster. Note that the performance of our proposed method can be further improved if the structure is explored during the matrix-matrix multiplication. For example, the zero blocks can be skipped in matrix tiling, as discussed in subsection V-A. However, this involves modification in lower- level CUDA codes so we do not study it here. C. Insight Into the Proposed Algorithm In this subection, we provide some insight into the proposed method. First, Fig. 10 illustrates the convergence behavior of our proposed method on different tasks. It can be observed that Fig. 10: Convergence of proposed algorithm. The convergence if measured by the change in message vh→sn . generally our proposed method can converge in 15 iterations in all the tasks. Second, we illustrate how the structure is gradually captured by the prior information vh→sn from Module B and how the posterior in Module A is regularized to this structure. As the clustered structure in kernels has been illustrated in Fig. 8, here in Fig. 11, we visualize the message vh→sn and vηn→sn of the FC_3 layer in AlexNet. It can be observed that in iteration 1, the message vηn→sn has no structure because the prior ˆp (s) in Module A is randomly initialized. During the iterations of the algorithm, vηn→sn from Module B gradually captures the structure from the MRF prior and acts as a regularization in Module A, so that structure is gradually promoted in vh→sn . Finally, the support matrix JOURNAL OF XXX 14 Fig. 11: Visualization of the message vh→sn and vηn→sn for the Dense_3 layer of AlexNet. vh→sn carries the prior information of support from Module B and vηn→sn carries the posterior information of support from Module A. It can be clearly observed that the structured prior captured from Module B gradually regularizes the posterior. Eventually both vh→sn and vηn→sn converge to a stable state. the pruned models. In Fig. 12, we plot the model accuracy under different (cid:15). Both the accuracy with and without an adversarial fine tuning is reported. It can be observed that all methods show a rapid drop without fine tuning. Specifically, our proposed method shows an accuracy drop of 72.1% from 89.01% when (cid:15) = 0 to 24.86% when (cid:15) = 0.05, while SNIP reports the largest drop of 73.4%. However, we also observe that the structured pruning methods (proposed and polarization) show stronger robustness than the unstructured ones (VD and SNIP). We think the reasons why our proposed method and polarization perform better may be different. For polarization, the unpruned weights are significantly more than other baselines, which means the remaining important filters have significantly more parameters. This allows the model to have a strong ability to resist the noise. For our proposed method, the possible reason is that it can enforce the weights to gather in groups. Thus, the model can "concentrate" on some specific features even when they are added by noise. It can be observed that after an adversarial fine tuning, all methods show an improvement. VD shows the largest improvement of 77.31% at (cid:15) = 0.1 while our proposed method only shows a moderate improvement of 56.26%. The possible reason behind this is our proposed method is "too" sparse and the remaining weights cannot learn the new features. Note that SNIP shows the smallest in SNIP, the weights are pruned before training and the auxiliary importance variables may not measure the weight importance accurately, which results in some important weights being pruned. Thus, the expressing ability of the model may be harmed. improvement. The possible reason is that VI. CONCLUSIONS AND FUTURE WORK Conclusions We considered the problem of model compression from a Bayesian perspective. We first proposed a three-layer hierar- Fig. 12: Accuracy vs (cid:15) for LeNet model. has a clustered structure and the weight matrix also has a similar structure. D. Robustness of Pruned Model In this subsection, we evaluate the robustness of the pruned model. The robustness of the pruned model is often neglected in model pruning methods while it is of highly importance [34], [35], [36]. We compare the model robustness of our proposed method to the baselines on LeNet and Fashion- MNIST dataset. We generate 10000 adversarial examples by fast gradient sign method (FGSM) and pass them through unprunedprunedIteration=1Iteration=3Iteration=7Iteration=10Final weight matrixIteration=1Iteration=3unprunedprunedIteration=1Iteration=3Iteration=7Iteration=10Final weight matrixIteration=700.050.10.150.20.250.3 0.10.20.30.40.50.60.70.80.9AccuracySNIP (w/o. adv. fine tune)VD (w/o. adv. fine tune)polarization (w/o. adv. fine tune)proposed (w/o. adv. fine tune)SNIP (w/. adv. fine tune)VD (w/. adv. fine tune)polarization (w/. adv. fine tune)proposed (w/. adv. fine tune)Sparsity rate: SNIP: 9.82%, VD: 8.50%, polarization: 18.29%, proposed: 4.75% JOURNAL OF XXX 15 chical sparse prior in which an extra support layer is used to capture the desired structure for the weights. Thus, the proposed sparse prior can promote both per-neuron weight- level structured sparsity and neuron-level structured sparsity. Then, we derived a Turbo-VBI based Bayesian compression algorithm for the resulting model compression problem. Our proposed algorithm has low complexity and high robustness. We further established the convergence of the sparse VBI part in the Turbo-VBI algorithm. Simulation results show that our proposed Turbo-VBI based model compression algorithm can promote a more regular structure in the pruned neural networks while achieving even better performance in terms of compression rate and inferencing accuracy compared to the baselines. Future Work With the proposed Turbo-VBI based structured model com- pression method, we can promote more regular and more flexible structures and achieve superior compressing perfor- mance during neural network pruning. This also opens more possibilities for future research, as listed below: Communication Efficient Federated Learning: Our proposed method shows huge potential in a federated learning scenario. First, it can promote a more regular structure in the weight the weight matrix has a lower entropy. matrix such that Thus, the regular structure can be further leveraged to reduce communication overhead in federated learning. Second, the two-module design of the Turbo-VBI algorithm naturally fits in a federated learning setting. The server can promote a global sparse structure by running Module B while the clients can perform local Bayesian training by running Module A. Joint Design of Quantization and Pruning: Existing works [16], [14] have pointed out that quantization and pruning can be achieved simultaneously by Bayesian model compression. Thus, it is also possible to further compress the model by combining quantization with our proposed method. APPENDIX A. Derivation of Three Subproblems Here, we provide the derivation from the original problem (20) to the three subproblems (21), (22) and (23). For expres- sion simplicity, let z = [z1, z2, z3] denote all the variables w, ρ and s, where z1 = w, z2 = ρ and z3 = s. Then, the original problem (20) can be equivalently written as Sparse VBI Problem: Then, by (15) in [28], we have ELBO (cid:90) (cid:90) = = = = (cid:90) 3 (cid:89) i=1 (cid:90) 3 (cid:89) i=1 3 (cid:88) i=1 − (cid:90) = − (cid:90) − = q (z) ln ˆp (D|z) dz − DKL (q (z) ||ˆp (z)) q (z) ln ˆp (D, z) q (z) (cid:34) dz q (zi) ln ˆp (D, z) − q (zi) ln ˆp (D, z) 3 (cid:89) i=1 (cid:35) ln q (zi) dz 3 (cid:88) i=1 dzi q (zj) ln q (zi) dzi (cid:90) 3 (cid:89) j=1  q (zj) ln ˆp (D, z)  q (zi) dzi  dzj (cid:89) i(cid:54)=j (cid:90) q (zj) ln q (zj) dzj − (cid:90) (cid:88) i(cid:54)=j q (zi) ln q (zi) dzi (cid:90) q (zj) ln q (zj) dzj q (zj) ln (cid:101)pjdzj − (cid:88) (cid:90) q (zi) ln q (zi) dzi i(cid:54)=j = − DKL (q (zj) ||(cid:101)pj) − (cid:90) (cid:88) i(cid:54)=j q (zi) ln q (zi) dzi, where ln (cid:101)pj = (cid:82) ln ˆp (D, z) (cid:81) i(cid:54)=j q (zi) dzi = (cid:104)ˆp (D, z)(cid:105)i(cid:54)=j. It is obvious that −ELBO is minimized when DKL (q (zj) ||(cid:101)pj) is minimized. Thus, the Sparse VBI Problem (38) can be solved by iteratively minimizing DKL (q (zj) ||(cid:101)pj) for j = 1, 2, 3. B. Derivation of (25) - (30) Let q(cid:63) (ρ) = (cid:101)pρ, we have ln q(cid:63) (ρ) ∝ ln (cid:101)pρ ∝ (cid:104)ln p (w, ρ, s, D)(cid:105)q(s)q(w) ∝ (cid:104)ln p (w|ρ)(cid:105)q(w) + (cid:104)ln p (ρ|s)(cid:105)q(s) N (cid:88) ∝ ((cid:104)sn(cid:105) an + (cid:104)1 − sn(cid:105) an) ln ρn n=1 − (cid:0)(cid:10)|wn|2(cid:11) + (cid:104)sn(cid:105) bn + (cid:104)1 − sn(cid:105) bn Thus, we have that q(cid:63) (ρ) follows a Gamma distribution in (25), with parameters in (26) and (27). (cid:1) ρn. Let q(cid:63) (s) = (cid:101)ps, we have ln q(cid:63) (s) ∝ ln (cid:101)ps ∝ (cid:104)ln p (w, ρ, s, D)(cid:105)q(ρ)q(w) ∝ (cid:104)ln p (ρ|s)(cid:105)q(ρ) + ln ˆp (s) − ELBO, min q(z) s.t.q (z) = 3N (cid:89) n=1 q (zn) . (38) ∝ N (cid:88) n=1 sn (ln ban n + (an − 1) (cid:104)ln ρn(cid:105) − bn (cid:104)ρn(cid:105) − ln Γ (an)) 16 [21] J. Friedman, T. Hastie, and R. Tibshirani, "A note on the group lasso and a sparse group lasso," arXiv preprint arXiv:1001.0736, 2010. [22] T.-J. Yang, Y.-H. Chen, and V. Sze, "Designing energy-efficient convo- lutional neural networks using energy-aware pruning," in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017, pp. 5687–5695. [23] S. J. Kwon, D. Lee, B. Kim, P. Kapoor, B. Park, and G.-Y. Wei, "Structured compression by weight encryption for unstructured pruning the IEEE/CVF Conference on and quantization," in Proceedings of Computer Vision and Pattern Recognition (CVPR), 2020, pp. 1909– 1918. [24] J. Yu, A. Lukefahr, D. Palframan, G. Dasika, R. Das, and S. Mahlke, "Scalpel: Customizing dnn pruning to the underlying hardware paral- lelism," in 2017 ACM/IEEE 44th Annual International Symposium on Computer Architecture (ISCA), 2017, pp. 548–560. [25] D. Blalock, J. J. Gonzalez Ortiz, J. Frankle, and J. Guttag, "What is the state of neural network pruning?" Proceedings of Machine Learning and Systems, vol. 2, pp. 129–146, 2020. [26] L. V. Jospin, W. Buntine, F. Boussaid, H. Laga, and M. Bennamoun, "Hands-on Bayesian neural networks–a tutorial for deep learning users," arXiv preprint arXiv:2007.06823, 2020. [27] K. Murphy, Y. Weiss, and M. I. Jordan, "Loopy belief propaga- tion for approximate inference: An empirical study," arXiv preprint arXiv:1301.6725, 2013. [28] D. G. Tzikas, A. C. Likas, and N. P. Galatsanos, "The variational approximation for Bayesian inference," IEEE Signal Processing Mag., vol. 25, no. 6, pp. 131–146, 2008. [29] D. P. Kingma, T. Salimans, and M. Welling, "Variational dropout and the local reparameterization trick," Advances in Neural Information Processing Systems (NeurIPS), vol. 28, pp. 2575–2583, 2015. [30] P. Tseng, "Convergence of a block coordinate descent method for nondifferentiable minimization," J. Optim. Theory Appl., vol. 109, no. 3, pp. 475–494, 2001. [31] X. Yuan, L. Ren, J. Lu, and J. Zhou, "Enhanced bayesian compression the IEEE/CVF via deep reinforcement Conference on Computer Vision and Pattern Recognition (CVPR), 2019, pp. 6946–6955. learning," in Proceedings of [32] H. Xiao, K. Rasul, and R. Vollgraf, "Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms," arXiv preprint arXiv:1708.07747, 2017. [33] A. Krizhevsky, V. Nair, and G. Hinton, "The cifar-10 and cifar-100 dataset." cs.toronto.edu. http://www.cs.toronto.edu/ kriz/cifar.html, (ac- cessed August 21 2022). [34] V. Sehwag, S. Wang, P. Mittal, and S. Jana, "Hydra: Pruning adversari- ally robust neural networks," Advances in Neural Information Processing Systems (NeurIPS), vol. 33, pp. 19 655–19 666, 2020. [35] J. Li, R. Drummond, and S. R. Duncan, "Robust error bounds for quantised and pruned neural networks," in Learning for Dynamics and Control. PMLR, 2021, pp. 361–372. [36] L. Wang, G. W. Ding, R. Huang, Y. Cao, and Y. C. Lui, "Adversarial robustness of pruned neural networks," 2018. JOURNAL OF XXX + (1 − sn) (cid:16) ln b an n + (an − 1) (cid:104)ln ρn(cid:105) − bn (cid:104)ρn(cid:105) − ln Γ (an) (cid:17) + ∝ ln N (cid:88) n=1 N (cid:89) n=1 (sn ln πn + (1 − sn) ln (1 − πn)) ((cid:101)πn)sn (1 − (cid:101)πn)1−sn . Thus, we have that q(cid:63) (s) follows a Bernoulli distribution in (28), with parameters in (29) and (30). REFERENCES [1] N. Lee, T. Ajanthan, and P. H. Torr, "Snip: Single-shot network pruning based on connection sensitivity," International Conference on Learning Representations (ICLR), 2019. [2] Y. LeCun, J. S. Denker, and S. A. Solla, "Optimal brain damage," in Advances in Neural Information Processing Systems (NeurIPS), 1990, pp. 598–605. [3] B. Hassibi and D. G. Stork, Second Order Derivatives for Network Pruning: Optimal Brain Surgeon. Morgan Kaufmann, 1993. [4] C. Louizos, M. Welling, and D. P. Kingma, "Learning sparse neural networks through l_0 regularization," arXiv preprint arXiv:1712.01312, 2017. [5] W. Wen, C. Wu, Y. Wang, Y. Chen, and H. Li, "Learning structured sparsity in deep neural networks," arXiv preprint arXiv:1608.03665, 2016. [6] J. O. Neill, "An overview of neural network compression," arXiv preprint arXiv:2006.03669, 2020. [7] S. Scardapane, D. Comminiello, A. Hussain, and A. Uncini, "Group sparse regularization for deep neural networks," Neurocomputing, vol. 241, pp. 81–89, 2017. [8] A. Howard, M. Sandler, G. Chu, L.-C. Chen, B. Chen, M. Tan, W. Wang, Y. Zhu, R. Pang, V. Vasudevan et al., "Searching for mobilenetv3," in Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), 2019, pp. 1314–1324. [9] T. Zhuang, Z. Zhang, Y. Huang, X. Zeng, K. Shuang, and X. Li, "Neuron-level structured pruning using polarization regularizer," Ad- vances in Neural Information Processing Systems (NeurIPS), vol. 33, pp. 9865–9877, 2020. [10] L. Yang, Z. He, and D. Fan, "Harmonious coexistence of structured weight pruning and ternarization for deep neural networks," in Proceed- ings of the AAAI Conference on Artificial Intelligence, vol. 34, no. 04, 2020, pp. 6623–6630. [11] A. S. Weigend, D. E. Rumelhart, and B. A. Huberman, "Generalization by weight-elimination with application to forecasting," in Advances in Neural Information Processing Systems (NeurIPS), 1991, pp. 875–882. [12] J. Frankle and M. Carbin, "The lottery ticket hypothesis: Finding sparse, trainable neural networks," arXiv preprint arXiv:1803.03635, 2018. [13] J. Frankle, G. K. Dziugaite, D. Roy, and M. Carbin, "Linear mode con- nectivity and the lottery ticket hypothesis," in International Conference on Machine Learning (ICML). PMLR, 2020, pp. 3259–3269. [14] M. Van Baalen, C. Louizos, M. Nagel, R. A. Amjad, Y. Wang, T. Blankevoort, and M. Welling, "Bayesian bits: Unifying quantization and pruning," Advances in Neural Information Processing Systems (NeurIPS), vol. 33, pp. 5741–5752, 2020. [15] D. Molchanov, A. Ashukha, and D. Vetrov, "Variational dropout spar- sifies deep neural networks," in International Conference on Machine Learning (ICML). PMLR, 2017, pp. 2498–2507. [16] C. Louizos, K. Ullrich, and M. Welling, "Bayesian compression for deep learning," arXiv preprint arXiv:1705.08665, 2017. [17] A. Liu, G. Liu, L. Lian, V. K. Lau, and M.-J. Zhao, "Robust recovery of structured sparse signals with uncertain sensing matrix: A turbo-vbi approach," IEEE Trans. Wireless Commun., vol. 19, no. 5, pp. 3185– 3198, 2020. [18] P. Schniter, "Turbo reconstruction of structured sparse signals," in 2010 44th Annual Conference on Information Sciences and Systems (CISS). IEEE, 2010, pp. 1–6. [19] A. Wu, S. Nowozin, E. Meeds, R. E. Turner, J. M. Hernandez- Lobato, and A. L. Gaunt, "Deterministic variational inference for robust Bayesian neural networks," arXiv preprint arXiv:1810.03958, 2018. [20] J. Zhang, X. Chen, M. Song, and T. Li, "Eager pruning: Algorithm and architecture support for fast training of deep neural networks," in 2019 ACM/IEEE 46th Annual International Symposium on Computer Architecture (ISCA). IEEE, 2019, pp. 292–303.
http://arxiv.org/abs/2302.10481v1
2023-02-21T07:07:29
2023-02-21T07:07:29
LMPDNet: TOF-PET list-mode image reconstruction using model-based deep learning method
The integration of Time-of-Flight (TOF) information in the reconstruction process of Positron Emission Tomography (PET) yields improved image properties. However, implementing the cutting-edge model-based deep learning methods for TOF-PET reconstruction is challenging due to the substantial memory requirements. In this study, we present a novel model-based deep learning approach, LMPDNet, for TOF-PET reconstruction from list-mode data. We address the issue of real-time parallel computation of the projection matrix for list-mode data, and propose an iterative model-based module that utilizes a dedicated network model for list-mode data. Our experimental results indicate that the proposed LMPDNet outperforms traditional iteration-based TOF-PET list-mode reconstruction algorithms. Additionally, we compare the spatial and temporal consumption of list-mode data and sinogram data in model-based deep learning methods, demonstrating the superiority of list-mode data in model-based TOF-PET reconstruction.
[ "Chenxu Li", "Rui Hu", "Jianan Cui", "Huafeng Liu" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10481v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10481v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "eess.IV", "@scheme": "http://arxiv.org/schemas/atom" }
[ "eess.IV", "cs.CV", "cs.LG" ]
3 2 0 2 b e F 1 2 ] V I . s s e e [ 1 v 1 8 4 0 1 . 2 0 3 2 : v i X r a LMPDNET: TOF-PET LIST-MODE IMAGE RECONSTRUCTION USING MODEL-BASED DEEP LEARNING METHOD Chenxu Li Rui Hu Jianan Cui Huafeng Liu State Key Lab of Modern Optical Instrumentation Zhejiang University Hangzhou, 310027, China ABSTRACT The integration of Time-of-Flight (TOF) information in the reconstruction process of Positron Emission Tomography (PET) yields improved image properties. However, imple- menting the cutting-edge model-based deep learning methods for TOF-PET reconstruction is challenging due to the sub- stantial memory requirements. In this study, we present a novel model-based deep learning approach, LMPDNet, for TOF-PET reconstruction from list-mode data. We address the issue of real-time parallel computation of the projection matrix for list-mode data, and propose an iterative model- based module that utilizes a dedicated network model for list-mode data. Our experimental results indicate that the proposed LMPDNet outperforms traditional iteration-based TOF-PET list-mode reconstruction algorithms. Additionally, we compare the spatial and temporal consumption of list- mode data and sinogram data in model-based deep learning methods, demonstrating the superiority of list-mode data in model-based TOF-PET reconstruction. Index Terms- TOF-PET reconstruction, list-mode, model-based deep learning 1. INTRODUCTION Incorporating Time-of-Flight (TOF) information in Positron Emission Tomography (PET) imaging enhances image qual- ity and bolsters lesion detectability[7, 14]. The main meth- ods for TOF-PET reconstruction include Ordered Subset Ex- pectation Maximization (OSEM)[13, 10], Maximum A Pos- teriori (MAP)[2], Primal-Dual Hybrid Gradient (PDHG)[12], etc. These algorithms are suitable for both sinogram data and list-mode data. However, these iterative-based algorithms suffer from computational inefficiency and may produce re- constructed images with very poor quality when applied to the data of low counts. In recent times, machine learning has become a widely- utilized technique used in the field of medical image re- construction due to its high computational efficiency and data-driven characteristic. Numerous studies have demon- strated the efficacy of model-based deep learning methods in reconstructing high-quality PET images[9, 11, 8], and the model-based approach also provides interpretability to deep learning[5]. However, there are few model-based deep learn- ing methods for TOF-PET reconstruction. On one hand, the storage requirements of the system matrix corresponding to the sinogram combined with TOF information will be even greater. On the other hand, starting from list-mode data, how to integrate the system matrix of list-mode data into the it- erative framework is a problem worth discussing. For a 2D image with a dimension of 128×128 and sinogram with a dimension of 357×224×17 (rad×view×tofbin), the system matrix occupies ∼83GB of video memory. What's worse, as the increase of axial field of view, its memory usage will also increase dramatically. This severely limits the application of model-based learning methods on TOF-PET reconstruction. The reconstruction algorithm based on list-mode data can dis- card the fixed format like sinogram. It ensures that the data are all valid information, rather than a large number of "empty bins" appearing in the sinogram in TOF-PET, avoiding the waste of memory. The memory occupied by the list-mode data depends on the number of coincident events detected in one scan, regardless of whether there is TOF information or not. For the example mentioned above, if the count of coin- cident events is 1e5, the projection matrix (corresponding to the system matrix) occupies only ∼6GB of video memory. In this work, we proposed the LMPDNet, i.e. List-mode Primal Dual Net, a novel model-based deep learning approach for list-mode data to improve the TOF-PET reconstruction. We first address the issue of real-time calculation of the pro- jection matrix during iterative training. Based on the pro- jection matrix calculation method proposed by Joseph[6], we used CUDA to compute the projection of each response line (LOR) in parallel to achieve acceleration. Then, based on the Learned Primal-Dual method[1, 4], the LMPDNet was pro- posed. Simulation experiments showed that our method was superior to the current mainstream TOF-PET list-mode recon- struction method[10, 12]. To the best of our knowledge, this is the first unrolled model-based deep learning method for TOF- PET list-mode reconstruction. Fig. 1. Overall framework of LMPDNet 2. METHOD 2.1. Learned Primal-Dual Mathematically, the TOF-PET reconstruction problem from list-mode can be formulated as: g = P f + noise (1) where f ∈ X(image domain) and g ∈ Y (measurement do- main), and P is the forward projection matrix that mapping X → Y with TOF information. A general approach to solve (1) is to minimize the sum of the negative log-likelihood function L(P f, g) and penalized regularization term S(f ): min f ∈X [L(P f, g) + λS(f )] (2) where the λ is the regularization parameter. This is a large- scale optimization problem. A general framework called the Learned Primal-Dual[1] combining deep learning with PDHG was proposed for solving optimization problems of the form similar to (2). PDHG is based on the use of forward and back- ward projections, and is capable of solving problems with complex constraints, such as positivity and sparsity. Shown in Algorithm 1, The main idea of Learned Primal-Dual is to unroll the PDHG algorithm, keeping the forward projection operator T and its adjoint projection operator T ∗, and replac- ing the proximal operator in the PDHG algorithm with the pa- rameterized operator Γθd and Λθp , and the parameters θd and θp are learned from the training data. hk and fk represents the data in measurement domain and image domain respectively. For list-mode data, the operator T is the projection matrix P . 2.2. Overall Framework The overall framework of the LMPDNet is shown in Figure 1. Like the Learned Primal-Dual reconstruction method, the Algorithm 1 Learned Primal-Dual 1: Initialize f0(= 0), h0(= 0) 2: for k = 1, . . . , K do 3: (hk−1, T (fk−1), g) (fk−1, T ∗(hk)) k hk ← Γθd fk ← Λθp return fK k 4: 5: 6: end for structure of the proposed method is formed by concatenating multiple identical layers. The inputs are list-mode space input h0 ∈ Rn and image space input f0 ∈ RW ×H initialized to zero, where n is the length of list-mode data, W and H are width and height of the image. Each layer consists of four parts: Forward projection, Dual module, Backward projection and Primal module. Forward/backward projection: For sinogram data, the operator T and T ∗ in Algorithm 1 is the system matrix G and its adjoint matrix G∗, which can be precomputed. Un- like sinogram data, the corresponding projection matrix P of list-mode data is different for each set of detection data and it cannot be precomputed. This is because the sequence of co- incidence events in list-mode data is random and disordered, and its length is not fixed. Therefore, for each set of list-mode data, its projection matrix needs to be calculated in real-time before being input to the neural network. The projection result of a LOR line is the integral of the activity on this line: (cid:90) h(i) = LORi (cid:15)f (x, y)ds (3) where the (cid:15) is the TOF weight, i ∈ [1, n] represents the i- th LOR, f (*) is the activity distribution and x ∈ [1, W ], y ∈ [1, H] represents image coordinates. ds represents the line differentiation of the LOR. The contribution of each pixel to Table 1. PSNR and SSIM (mean ± std) of various methods and counts Methods Counts=3e5 Counts=1e5 PSNR SSIM PSNR SSIM 17.68±1.26 OSEM 18.26±1.25 OSEM+TV SPDHG+TV 18.37±1.17 23.47±0.49 Proposed 0.84±0.03 0.85±0.03 0.85±0.03 0.94±0.01 16.96±1.22 17.81±1.24 15.44±1.10 21.52±0.44 0.82±0.04 0.84±0.03 0.80±0.04 0.92±0.01 GPU, without the need to copy the data from CPU memory to GPU memory. Dual Module: The input of the Dual Module is hk and the forward projection result of fk. Concatenate two input lists and an all-ones list, and get ̃h ∈ Rn∗3. The all-ones list is to serve as the reference, i.e. g in Learned Primal-Dual, for the forward projection result, which is like using the mea- sured original sinogram as the reference during the sinogram projection process. Considering that there is no correlation among the elements of a column in ̃h, we need to pay more attention to the connection between the three values of each row. A fully connected (FC) neural network with three input features and one output feature was used, and the dimension of length n becomes the "channel" dimension. Finally, the output result is used as the residual and the list obtained from the previous iteration hk is summed to obtain the output result of Dual Module. Primal Module: Primal Modules are similar in structure to Dual modules. The difference is that the input and output of this module are not lists, but images. The input of the Primal Module is the concatenation of fk and the backward projec- tion result of hk+1. The Primal module uses Convolutional Neural Networks (CNNs) with PReLU as activation function. 3. EXPERIMENTS 3.1. Datasets The Zubal phantom[15] with size of 128×128×40 was used as a starting point for the simulated data. We inserted sev- eral hot spheres of radius 2mm to 4mm at random positions in phantom to simulate the tumors and obtained 12 different phantoms. Then we got 480 different 2D phantoms of size Table 2. Comparison of video memory occupation and pro- jection time consuming sinogram list-mode Memory Occupation Forward Projection Backward Projection Compute Projection Matrix ∼87GB 364ms 405ms - ∼20GB 256ms 246ms 157ms Fig. 2. Reconstruction result of OSEM, SPDHG+TV and pro- posed method. The 19st, 35th, and 38th slices in phantom are selected for display. the LOR varies linearly with the position, so the result of the line integration can be expressed as the product of the length of the line segment and the midpoint activity value of the line segment: h(i) = H (cid:88) y=1 (cid:15)f (smid) * ∆s (4) where ∆s is the length of line segment. The midpoint activity value can be calculated by linear interpolation between two adjacent pixels, then: f (smid) = ρf (xl, y) + (1 − ρ)f (xr, y) (5) ρ is the coefficient of linear interpolation, xl and xr are the coordinates to the left and right of the midpoint. Recall that a single element Pij in the projection matrix P ∈ [n, W × H] represents the degree of influence caused by the i-th LOR on the j-th pixel. The result of multiplying Pi (the i-th row in P ) with f (:) (the image resized as a column vector) is h(i). That is: Pi * f (:) = H (cid:88) y=1 (cid:15)[ρf (xl, y) + (1 − ρ)f (xr, y)]∆s (6) Dividing the terms relating to f , then the calculation result of the element value in the projection matrix is: Pij = (cid:15) * ρ * ∆s (7) There is no data communication between the calculations of different LOR projections, and the granularity of each LOR projection calculation is relatively fine. Therefore, the projec- tion matrix can be accelerated by CUDA parallel computing. It is worth noting that the projection matrix can be used di- rectly for the subsequent backpropagation of the neural net- work after it has been computed by requesting memory in the 128×128. A three compartment model was used along with the Feng's input function to simulate the activity map[3]. In order to simulate the list-mode data, we first obtained the sys- tem matrix for the specific PET scanner using (6) . The sys- tem matrix was multiplied by the activity map to obtain the original sinograms. Next, the sinograms were scaled down according to the count rate, the total count was set to 3e5 and 1e5 respectively. Then 15% Poisson random noise was added to sinograms. Finally, sinograms were converted to list-mode data by rounding down the value of each bin in the sinograms to the number of events in its corresponding position, and us- ing each event as a row in the list-mode data. At this point, we had 480 pairs of activity map and list-mode data. Among them, 400 pairs of data were selected as the training set, 40 pairs as the validation set, and 40 pairs as the test set. The system we used was a simulated classic cylindrical PET scanner, which included 28 modules with 16 crystals each, having a width of 4 mm in the radial direction. Set 17 TOF-bins on each LOR, each TOF-bin is 15mm long and the time resolution of TOF was set as 400 ps. Thus the dimension of the sinogram was 357×224×17. It is worth noting that ax- ial information in the detection system was not required since the experiment focused on 2D reconstruction of PET images. 3.2. Training Details The number of network iteration layers was set to 7. Each Dual-Net consisted of two hidden layers with 32 features, and Primal-Net consisted of 4 convolutional layers, the number of channels in the first three layers is set to 64, except for the last layer where the number of output channels is 1. The MSE Loss between the output images fn and the ground truth was chosen as the loss function, and the learning rate was set to 1e-5. The training epochs are 500. 3.3. Results To quantitatively evaluate the quality of the reconstruction re- sults, we calculated the Peak Signal-to-Noise Ratio (PSNR) and Structural Similarity Index Measure (SSIM) between the reconstructed images and the ground truth. The comparison methods included the traditional OSEM algorithm, OSEM with TV regularization, and the SPDHG algorithm with TV regularization. The traditional algorithms all had 30 iterations and were divided into 4 subsets. The results are presented in Figure 2 and Table 1. The findings suggest that, for both 3e5 counts and 1e5 counts, the proposed method outperformes the traditional model-based reconstruction algorithm in terms of both quantitative and qualitative analysis. Notably, as no other model-based deep learning method of list-mode recon- struction currently exists, we did not compare our proposed method with other learning-based methods. In Table 2, we conducted a comparison between using sinogram and list-mode data for reconstruction under the ex- Fig. 3. The output of each layer of the proposed method. The first row from left to right represents layers 1 to 5 and the second row from left to right represents layers 6 to 10. perimental settings described above. Specifically, we com- pared the video memory occupation and the time required for each forward/backward projection. The results indicated that using list-mode data as the starting point resulted in lower memory consumption and less projection time compared to using sinogram data. Due to the need of calculating the pro- jection matrix in real-time, the method based on list-mode data consumed a part of the time when each new set of data was fed into the neural network. However, this time consump- tion only occurs before the new set of data enters the over- all reconstruction process, not before each forward/backward projection. And after the acceleration of parallel computing, this time-consuming was small and negligible. 3.4. Ablation Study To balance the effectiveness of the proposed method against its memory usage, we need to investigate the optimal number of iterative layers to be employed. Initially, we set the number of layers to 10, and the output of each layer was examined and compared with the ground truth. The results are presented in Figure 3. Our analysis revealed that the output of each layer became increasingly more accurate as the number of iterative layers increased, eventually stabilizing at around the 7th layer. Based on these findings, we set the number of layers to 7 for our experiments. 4. CONCLUSION This paper proposed a model-based deep learning method for TOF-PET reconstruction from list-mode data called LM- PDNet, which was the first application of model-based deep learning to TOF-PET reconstruction.The results showed that the proposed method outperformed traditional iteration-based algorithms in terms of reconstruction quality and outper- formed reconstruction from sinogram in terms of spatial and temporal consumption. IEEE Transactions on Radiation and Plasma Medical Sciences, 5(1):1–25, 2020. [12] Georg Schramm and Martin Holler. Fast and memory- efficient reconstruction of sparse poisson data in list- mode with non-smooth priors with application to time- of-flight pet. Physics in Medicine & Biology, 2022. [13] Donald L Snyder and David G Politte. Image re- construction from list-mode data in an emission to- mography system having time-of-flight measurements. IEEE Transactions on Nuclear Science, 30(3):1843– 1849, 1983. [14] Suleman Surti and Joel S Karp. Update on latest ad- vances in time-of-flight pet. Physica Medica, 80:251– 258, 2020. [15] I George Zubal, Charles R Harrell, Eileen O Smith, Zachary Rattner, Gene Gindi, and Paul B Hof- fer. Computerized three-dimensional segmented human anatomy. Medical Physics, 21(2):299–302, 1994. 5. REFERENCES [1] Jonas Adler and Ozan ̈Oktem. Learned primal-dual re- construction. IEEE Transactions on Medical Imaging, 37(6):1322–1332, 2018. [2] Bing Bai, Yanguang Lin, Wentao Zhu, Ran Ren, Quanzheng Li, Magnus Dahlbom, Frank DiFilippo, and Richard M Leahy. Map reconstruction for fourier re- binned tof-pet data. Physics in Medicine & Biology, 59(4):925, 2014. [3] Dagan Feng, Sung-Cheng Huang, and Xinmin Wang. Models for computer simulation studies of input func- tions for tracer kinetic modeling with positron emis- sion tomography. International Journal of Bio-Medical Computing, 32(2):95–110, 1993. [4] Alessandro Guazzo and Massimiliano Colarieti-Tosti. Learned primal dual reconstruction for pet. Journal of Imaging, 7(12):248, 2021. [5] Chang Min Hyun, Seong Hyeon Baek, Mingyu Lee, Sung Min Lee, and Jin Keun Seo. Deep learning-based solvability of underdetermined inverse problems in medical imaging. Medical Image Analysis, 69:101967, 2021. [6] Peter M Joseph. An improved algorithm for reproject- IEEE Transactions on ing rays through pixel images. Medical Imaging, 1(3):192–196, 1982. [7] Joel S Karp, Suleman Surti, Margaret E Daube- Witherspoon, and Gerd Muehllehner. Benefit of time- of-flight in pet: experimental and clinical results. Jour- nal of Nuclear Medicine, 49(3):462–470, 2008. [8] Kyungsang Kim, Dufan Wu, Kuang Gong, Joyita Dutta, Jong Hoon Kim, Young Don Son, Hang Keun Kim, Georges El Fakhri, and Quanzheng Li. Penalized pet reconstruction using deep learning prior and local lin- IEEE Transactions on Medical Imaging, ear fitting. 37(6):1478–1487, 2018. [9] Abolfazl Mehranian and Andrew J Reader. Model-based deep learning pet image reconstruction using forward– IEEE backward splitting expectation–maximization. Transactions on Radiation and Plasma Medical Sci- ences, 5(1):54–64, 2020. [10] Guillem Pratx, Suleman Surti, and Craig Levin. Fast list-mode reconstruction for time-of-flight pet using graphics hardware. IEEE Transactions on Nuclear Sci- ence, 58(1):105–109, 2010. [11] Andrew J Reader, Guillaume Corda, Abolfazl Mehra- nian, Casper da Costa-Luis, Sam Ellis, and Julia A Schnabel. Deep learning for pet image reconstruction.
http://arxiv.org/abs/2302.10480v1
2023-02-21T07:00:32
2023-02-21T07:00:32
Climate Model Driven Seasonal Forecasting Approach with Deep Learning
Understanding seasonal climatic conditions is critical for better management of resources such as water, energy and agriculture. Recently, there has been a great interest in utilizing the power of artificial intelligence methods in climate studies. This paper presents a cutting-edge deep learning model (UNet++) trained by state-of-the-art global CMIP6 models to forecast global temperatures a month ahead using the ERA5 reanalysis dataset. ERA5 dataset was also used for finetuning as well performance analysis in the validation dataset. Three different setups (CMIP6; CMIP6 + elevation; CMIP6 + elevation + ERA5 finetuning) were used with both UNet and UNet++ algorithms resulting in six different models. For each model 14 different sequential and non-sequential temporal settings were used. The Mean Absolute Error (MAE) analysis revealed that UNet++ with CMIP6 with elevation and ERA5 finetuning model with "Year 3 Month 2" temporal case provided the best outcome with an MAE of 0.7. Regression analysis over the validation dataset between the ERA5 data values and the corresponding AI model predictions revealed slope and $R^2$ values close to 1 suggesting a very good agreement. The AI model predicts significantly better than the mean CMIP6 ensemble between 2016 and 2021. Both models predict the summer months more accurately than the winter months.
[ "Alper Unal", "Busra Asan", "Ismail Sezen", "Bugra Yesilkaynak", "Yusuf Aydin", "Mehmet Ilicak", "Gozde Unal" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10480v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10480v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI", "cs.CV", "physics.ao-ph" ]
3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 0 8 4 0 1 . 2 0 3 2 : v i X r a Environmental Data Science (2023), 4: 1–12 doi:10.1017/eds.2023.xx RESEARCH ARTICLE Climate Model Driven Seasonal Forecasting Approach with Deep Learning* Alper Unal1 Ilicak1 and Gozde Unal3 *, Busra Asan2 , Ismail Sezen1 , Bugra Yesilkaynak2 , Yusuf Aydin1 , Mehmet 1Eurasia Institute of Earth Sciences, Istanbul Technical University, Istanbul, Turkiye 2Department of Computer Engineering, Istanbul Technical University, Istanbul, Turkiye 3Department of AI and Data Engineering, Istanbul Technical University, Istanbul, Turkiye *Corresponding author. Email: [email protected] Received: ; Revised: ; Accepted: Keywords: climate change, seasonal forecast, machine learning, deep neural networks Abstract Understanding seasonal climatic conditions is critical for better management of resources such as water, energy and agriculture. Recently, there has been a great interest in utilizing the power of artificial intelligence methods in climate studies. This paper presents a cutting-edge deep learning model (UNet++) trained by state-of-the-art global CMIP6 models to forecast global temperatures a month ahead using the ERA5 reanalysis dataset. ERA5 dataset was also used for finetuning as well performance analysis in the validation dataset. Three different setups (CMIP6 ; CMIP6 + elevation; CMIP6 + elevation + ERA5 finetuning) were used with both UNet and UNet++ algorithms resulting in six different models. For each model 14 different sequential and non-sequential temporal settings were used. The Mean Absolute Error (MAE) analysis revealed that UNet++ with CMIP6 with elevation and ERA5 finetuning model with "Year 3 Month 2" temporal case provided the best outcome with an MAE of 0.7. Regression analysis over the validation dataset between the ERA5 data values and the corresponding AI model predictions revealed slope and R2 values close to 1 suggesting a very good agreement. The AI model predicts significantly better than the mean CMIP6 ensemble between 2016 and 2021. Both models predict the summer months more accurately than the winter months. Impact Statement This paper discusses the use of novel developments in machine learning field in seasonal forecasting. Tradi- tionally, climate models are used to simulate physical, chemical, and biological processes in the atmosphere to generate climate projections. Machine learning methods are gaining popularity among different fields. A team of computer scientists and earth scientists worked on this paper that investigates the use of machine learning algorithms along with climate models for seasonal forecasts, which are critical for better resource management. *This article is under consideration for 12th International Conference on Climate Informatics 2023. © The Authors(s) 2020. Published by Cambridge University Press. This is an Open Access article, distributed under the terms of the Creative Commons Attribution licence (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted re-use, distribution, and reproduction in any medium, provided the original work is properly cited. 2 Unal, A. et al. 1. Introduction Seasonal forecast is defined as a variety of potential climate changes that are likely to occur in the coming months and seasons Pan et al. (2022). This is crucial for governments and decision makers to better manage natural resources such as water, energy, agriculture, as well as protect human health Yuan et al. (2019). For example, crop producers use seasonal forecasts to make decisions about the timing of planting and harvesting, field fertilization, and water management Klemm and McPherson. (2017). Weather plays an important role in energy supply and demand Felice et al. (2015), hence an accurate forecast of the future weather conditions could increase the effectiveness and dependability of energy management at the local and national levels given the requirement to maintain the balance between electricity production and demand. Accurate forecasting of extreme events such as storms, heatwaves, droughts, and floods is required to improve disaster preparedness Liu et al. (2022). Weather prediction at shorter time-scales such as daily to monthly depends on understanding of physical processes in the atmosphere as well as interactions between the atmosphere, oceans and land. Scientifically, forecasting for longer time scales is based on the same laws of physics as forecasting for shorter time scales Klemm and McPherson. (2017). An important distinction must be made between dynamical predictions, which use intricate physical numerical models, and statistical predictions, that use regional historical relationships between physical variables like temperature and precipitation Franzke et al. (2022), Klemm and McPherson. (2017), Troccoli. (2010), Roads et al. (2003). Two approaches for constraining climate predictions based on past climate change includes large ensembles of simulations from computationally efficient models and small ensembles of simulations from state-of-the-art coupled ocean-atmosphere General Circulation Models (GCMs) Stott and Forest. (2007). GCMs are frequently used in studies related to the impacts of large-scale climate change Fuji- hara et al. (2008). High-resolution climate data from current global climate models are provided using Regional Climate Downscaling (RCD) techniques Scinocca et al. (2016), Laprise. (2008). Several pro- grams such as THORPEX, DEMETER, and EUPORIAS have been launched in practice to work toward seasonal forecasting Klemm and McPherson. (2017), Toth et al. (2007). In 1995, Coupled Model Intercomparison Projects (CMIP) began as a comparison of a few pioneer- ing global coupled climate models and outputs are used by different organizations around the world such as IPCC to better understand past, present, and future climate change Xu et al. (2021), Wang et al. (2021), Liu et al. (2022). CMIP6 is the most recent phase of the CMIP. The CMIP6 platform began in 2015, offers the most up-to-date multi-model datasets. Simulation outputs from more than 100 dif- ferent climate models produced by more than 50 different modeling groups contributed to CMIP6. In addition to historical studies, seasonal forecast for different emission scenarios are provided Liu et al. (2022), Zhang and Li. (2021), Turnock et al. (2020), Fan et al. (2020). In recent years, big data, effective supercomputers with Graphics Processing Units (GPUs) and sci- entific interest in novel algorithms and optimization techniques proved to be significant turning points in machine learning history. Machine Learning has recently been a hot topic in climate studies. Tyagi et al. (2022) reviewed a number of studies that applied the different Machine Learning/Deep Learning algorithms in Flash Drought (FD) studies. Luo et al. (2022) used a Bayesian Deep Learning approach to near-term climate prediction in the North Atlantic. Bochenek et al. (2022) investigated the top 500 scientific articles about machine learning in the field of climate and numerical weather prediction that have been published since 2018. Anochi et al. (2021) evaluated different Machine Learning methods for precipitation prediction in South America. Zhang and Li. (2021) and Feng et al. (2022) used Deep Learning algorithms to down scale hydro-climatic data of CMIP6 simulations in China. This study aims to improve seasonal temperature forecasts using both atmospheric models and machine learning algorithms. Specifically, the objective is to utilize the power of CMIP6 physical models along with European Centre for Medium-Range Weather Forecasts (ECMWF) Reanalysis 5th Generation (ERA5) dataset (created using data assimilation and model forecasts) while utilizing specif- ically deep neural network learning methods for better global seasonal forecast of 2m temperature. Environmental Data Science 3 2. Materials and Methods 2.1. Training data This study has utilized the 2m temperature outputs from 9 fully coupled Earth System Models (ESM) that participated in the CMIP6 (Eyring et al. 2016). These models are ACCESS-CM2, CNRM-CM6- 1-HR, GISS-E2-1-H, NorESM2-MM, CESM2-WACCM, EC-Earth3-Veg, MPI-ESM1-2-HR, MIROC- ES2L, and IPSL-CM6A-LR. For each ESM model, only one ensemble member was used and the time slice for the coupled models is chosen from the historical period (i.e., from 1850 to 2014). For validation and fine-tuning, 2m temperature data from the ERA5 reanalysis dataset Copernicus Climate Change Service (C3S) have been used. The ERA5 dataset is partitioned into two different time slices: 1973 to 2016 are used for fine-tuning, while 2016 to 2021 are used for evaluation of the trained models. In order to estimate the performance of the deep learning model (which is called as AI model from now on) between 2016 and 2021, we also used the multi-model mean of the CMIP6 models using the IPCC SSP5-8.5 scenario which is selected since there was no significant reduction in carbon emissions after 2014 when the historical simulations ended. 2.2. Model Architecture As this study focuses on spatio-temporally-varying data, an encoder-decoder based architecture UNet++ Zhou et al. (2018), which is based on the original UNet architecture Ronneberger et al. (2015) is adapted. In UNet++, the skip connections of the UNet are re-designed to minimize the semantic gap between the feature maps coming from the sub-networks of the encoder and the decoder, making the learning easier. Our model specifically employs Convolutional Neural Network (CNN) layers due to nature of the input data. We construct the UNet++ in order to perform a prediction task, which is explained below. The architecture includes a contracting path, i.e. an encoder part, which summarizes the information by reducing the size of the input image and increasing the number of channels. This downsampling operation results in spatial information loss due to the compression of the input. The UNet++, as in the original UNet, introduces skip connections that reduce the information loss after the bottleneck layer and recovers fine-grained details. Skip connections aggregate information from differ- ent resolution levels in order to increase accuracy and speed up the convergence. In the expansive path, i.e. the decoder part, skip connections concatenate the outputs of each downsampling layer to corre- sponding upsampling layers, aiming at image reconstruction that is at the same spatial resolution as that of the input. Figure 1a depicts the block diagram of the neural network model that we construct for the seasonal forecast of temperature. In addition to 2m temperature, an elevation map is stacked to the input as ancillary data to investigate whether it can improve the prediction performance. We use two different experimental settings to evaluate the effectiveness of using fully historical input data versus periodic data. The first setting is designed to see the performance of the historical data stacked sequentially in a temporal manner such as from t − 1 to t − 6, t − 12 and up to t − 36. Whereas in the second set, the target month and its neighbours are stacked in a yearly manner from historical data to assess the effect of periodicity. Months before the target prediction, the previous years' target month and months before and after them (e. g. neighboring months) are stacked as the input. The number of previous lag years as well as the number of preceding and succeeding months are selected as hyper-parameters. We have explored lag years 1 to 4 and preceding/succeeding 1 and 2 months. Two examples for these settings are depicted in 1b. The input to the Encoder network consists of the maps (temperature and elevation) corresponding to the month t −1, which is one previous to the target month t, t −12 ±Δt, t −24 ±Δt, and t − 36 ± Δt, where Δt could be either one of {1, 2}. Specifically, we selected Δt = 2 in order to account 4 Unal, A. et al. (a) Network architecture of the proposed model. (b) A sample arrangement of the months for the second experimental setting. Figure 1. a) Depiction of the UNet++ model which we adapted to our seasonal temperature forecast task. Month descriptions in the input of the encoder refer to relative timing of the input channels (e.g. each month used) according to the target month. In addition to input months, an elevation map is added as a separate channel. b) Arrangement of the months for the multi-dimensional input for the experimental settings: a) 2 years 1 months (given in the first row), and b) 2 years 2 months (given in the second row) are shown. for possible seasonal monthly shifts. The overall concatenated input tensor goes through the UNet++ model, and a single prediction map for temperature at the target month t is produced at the output of the network, as visualized in Figure 1a. Investigating the UNet and its successor the UNet++ with ERA5 fine-tuning and including elevation information resulted in 6 different AI Models to train. Considering all hyper-parameters (i.e., sequential and non-sequential), we have designed 14 experimental settings (named as cases from now on) resulting in 84 simulations in total. It should be noted that we also explored going back to lag years from 5 to 10, however as the number of lag years are increased, the amount of validation data is naturally decreased, and as a result, the data size was not adequate for the model optimization process. Therefore, we have stopped at year 4 for model setup. As the spherical earth in 3D (3-Dimensions) is represented over a 2D spatial grid, one has to pay attention to the the spatial information at the edges of images while applying convolutions. Rather than traditional 3x3 spatial convolutions, 3x3 circular convolutions which pad the input with information from the opposite sides of the image are used to preserve the spatial information at the edges of the image. During downsampling, 3 maxpool operations and 8 convolutional layers with batch normaliza- tion are used. Similarly, the upsampling path is designed using 3 upsample and 7 convolutional layers with batch normalization. As UNet++ introduces intermediate feature maps for the skip connections in each level during downsampling and upsampling, 6 convolutional layers are used for constructing all the intermediate feature maps. Moreover, concatenating lower resolution feature maps requires the usage of 3 additional upsample layers. For training the neural network model, as the loss function, the Mean Squared Error (MSE) Loss in (1) is utilized: L(θ) = 1 N N ∑︁ i=1 ( f θ (Xi) − Yi)2, (1) where f θ represents the Neural Network model, Xi is the input multi-channel tensor consisting of stacked monthly data and elevation data, Yi is the target temperature in the grid ("Ground Truth"). Environmental Data Science 5 Table 1. Mean Absolute Error (MAE) values as estimated for the entire domain (lat:192 x lon:288) for each simulation conducted: 6 models x 14 cases = 84 simulations CMIP6 Train CMIP6 Train + ERA5 finetune Temporal Setting 6 months 12 months 18 months 24 months 30 months 36 months 1 year 1 month 1 year 2 months 2 years 1 month 2 years 2 months 3 years 1 month 3 years 2 months 4 years 1 month 4 years 2 months M1 1.136 1.031 1.020 0.998 1.007 0.991 1.024 1.011 0.999 0.996 0.981 0.995 0.982 0.998 M2 1.123 1.024 1.027 0.992 1.006 0.979 1.024 1.008 0.995 0.986 0.977 0.989 0.989 0.984 M3 1.162 1.014 1.013 0.984 0.989 0.984 0.989 1.008 0.996 0.980 0.986 0.978 0.966 0.967 M4 1.030 1.004 0.993 0.981 1.008 0.990 0.999 0.997 0.977 0.973 0.988 0.993 0.982 0.992 M5 1.077 1.028 0.997 0.987 1.002 0.981 0.989 0.986 0.967 0.969 0.973 0.969 0.965 0.965 2Note: M1 and M4 are UNet; M2 and M5 are UNet with elevation; M3 and M6 are UNet++ with elevation. M6 1.046 1.002 0.999 0.983 0.976 1.003 0.983 0.984 0.967 0.979 0.967 0.975 0.962 0.955 N corresponds to the number of target time steps in a given batch of the selected stochastic gradient descent optimizer. 2.3. Training and Evaluation After the neural network model is constructed, it is trained with the MSE loss function in all the exper- iments. A learning rate of 1e − 5 and a weight decay of 1e − 3 is used with a step learning rate scheduler with Adam optimizer Kingma et al. (2015). The model is optimized for 40 epochs and early stopping is used to avoid over-fitting. After each convolutional layer, a batch normalization layer is used. Batch size is chosen as 16. Training process is done on an NVIDIA RTX A5000 GPU, and the results are delivered on average after 3-4 hours of training. During validation, the loss versus iterations are monitored, and the model with the lowest valida- tion error is selected. During inference/test time, the input is formed by the monthly temperature data coming from CMIP6 temperature maps that are stacked and given to the model in a feedforward eval- uation. In each evaluation experiment, the target is defined as the month after the latest month in the input. After the training with CMIP6 data, the selected model is further fine-tuned with ERA5 t2m data in order to increase the capability of the model in real world forecasting scenarios. Fine-tuning process is carried out by following the same process as in the training. Monthly temperature data taken from ERA5 is stacked as a multi-channel input and given to the network. As the evaluation metric, Mean Absolute Error (MAE) (2) is chosen, where each xi j and yi j corre- sponds to the predicted temperature and the ground truth temperature value of the corresponding grid, respectively. D refers to the number of longitudes, and M refers to the number of latitudes in the 2D spatial grid. All MAEs are summed and averaged across the temperature map to measure the overall error: M AE = 1 D D ∑︁ j=1 1 M M ∑︁ i=1 |xi j − yi j |. (2) 3. Results and Discussion Average MAE results over the validation dataset for temporal cases are provided in Table 1. As seen in this table, MAE ranges between 0.955 and 1.162. For comparison purposes, the MAE of the persistence forecast test (over the ERA5 validation dataset by copying the previous month temperature value as the target month's prediction) is estimated as 2.62. This indicates that all models have improved the MAE 6 Unal, A. et al. Figure 2. MAE Ranks of Model 6 for 14 temporal cases over four continents and four seasons. significantly with respect to the persistence forecast baseline. It should be noted that out of six models, for each temporal case, 50 percent (or 7 cases) of the lowest MAEs occur for Model 6 (M6). Three of the minimum MAEs occur for M5, and another three cases occur for M4, whereas only one minimum MAE occurs for M2. It is clear that ERA5 finetune has improved the performance significantly and using UNet++ with elevation is the best available model. Therefore Model 6 was selected for the rest of the analysis. In order to choose the best temporal case for Model 6, we estimate the MAEs and rank them for four main continents (i.e., Africa, North America, Europe, and Asia) as well as their distribution among different seasons (i.e., Winter, Spring, Summer, and Fall). These values along with overall (as estimated over continents and seasons) are given in Figure 2. As seen in this figure, sequential cases (such as month 6, month 12, even month 36) have higher ranks (hence lower performances) as compared to non-sequential cases. This is possibly due to the fact that the latter is able to recognize the strong seasonality in the data while sequential cases lack this ability. Among the non-sequential cases "Year 3 Month 2" case has the best performance as it has the best MAE rank for Fall, Spring, and Summer (and fourth for Winter). This case is the best for Africa and Asia continents, second for Europe and third for North America. Overall rank for this case is estimated to be number one as well. Therefore, "Year 3 Month 2" is selected as the temporal case for Model 6 (CMIP6 with ERA5 finetune with UNet++ with elevation) for the rest of the analysis. We compare the performance of the selected AI model to the ensemble mean of the CMIP6 models. Figure 3 shows the MAE for the AI model and the mean of the CMIP6 ensemble as a function of time for the selected continents during the study period from 2016 to 2022. In Africa, both the AI and the CMIP6 model means have a similar error level (i.e., 0.27 versus 0.34) (Fig. 3-a). This is probably due to the fact that the climate in Africa is fairly uniform as a function of latitude, and both models capture the overall climatology well. The AI model performs better compared to the mean CMIP6 in Asia and Europe. Although the inter-annual variability in the error between two different models overlaps, AI has significantly lower bias values. We believe that since the AI model has been trained by the CMIP6 ensemble, the model might inherit similar inter-annual variability. AI model's MAE value for February 2020 for Europe, Asia, and North America is significantly lower as compared to the CMIP6 model (a difference of 3.2 degrees for Europe, almost 1 degree for Asia, and 0.5 degrees for North America), while they estimate closer values for Africa. The error in North America is the only place where the CMIP6 ensemble (0.7) is slightly better than the AI model (0.71) that needs further investigation. In both models, the error increases in the winter months, indicating that the models do not accurately represent the cold climate in the northern hemisphere. The spatial distributions of the MAE fields for summer and winter for the AI and mean CMIP6 models are shown in Figure 4. Summer time mean absolute error in the AI model is fairly uniform and Environmental Data Science 7 Figure 3. MAE results of AI and CMIP6 models for four different continents as estimated over the validation dataset. approximately 1.5◦C over the continents (Fig. 4-a1). In contrast, the mean CMIP6 shows a relatively larger error (up to 5◦C) in high-topography regions such as the Himalayas in Asia, the Andes in South America, the Rockies in North America, and the Alps in Europe (Fig.4-a2). The MAE pattern in winter of the AI model is similar to the mean CMIP6 in high latitudes in the northern hemisphere (Figs. 4b1- b2). This indicates that large-scale Jetstream bias from the CMIP6 models is responsible for the AI's poor performance over Siberia and northern America. Once again, the error in winter is larger than in summer in both models, as we have shown in Fig. 3. The performance of the AI model in terms of MAE is significantly better than that of the mean CMIP6 in both summer and winter. Next, at every grid point of the global domain (lat: 192, lon: 288), we calculated the temperature anomalies for each month to remove the mean of the month of that grid point. Then we computed the scatter plot of absolute errors of the mean CMIP6 and AI models for all grids as a function of these temperature anomalies (Figure 5-a). The AI model performs better when the temperature anomalies are between −5◦C and 5◦C indicating that if a particular month is around the monthly mean, then the AI model predicts significantly better than the CMIP6 mean. However, if the month is part of an extreme event such as very cold (ΔT ≈ −10◦C) or very hot (ΔT ≈ 10◦C), AI's performance is getting closer to the CMIP6 mean. To better understand the performance of the selected model, the box plots of the calculated AE (Absolute Error) based on temperature anomalies are given in Figure 5-b. In all AI versus CMIP6 error bars for each temperature bin, AI model has significantly lower error values (for the median values and 25t h and 75t h percentiles). This outcome is even more pronounced especially for the bins between -2 and +2 (as shown on the x-axis). In addition to scatter plot and box plots of AE values, other statistical values such as R2 are used for understanding the relationship between observed and predicted temperature for all continents based on the results of the selected scenario. The results indicate that predicted values are well-fitting with the observed values in all continents. The R2 values of all continents are close to 1, which imply the power of the AI model in seasonally predicting temperature around the world (see the supplementary figures). 8 Unal, A. et al. Figure 4. (a) MAE fields of AI model in Summer (a1); CMIP6 model in Summer(a2); AI model in Winter (b1); and CMIP6 model in Winter (b2) for the validation dataset. Figure 5. Absolute Error plots of CMIP6 and AI model results for the validation dataset: (a) Scatter (b) Box plots. 4. Conclusion In summary, we employ an advanced encoder-decoder model (UNet++) trained by state-of-the-art global CMIP6 Earth System models to forecast global temperatures a month ahead using the ERA5 reanalysis dataset. This study is a proof of concept for the use of this model in a complex climate sys- tem. We found that the deep learning model predicts significantly better than the mean CMIP6 ensemble between 2016 and 2021. The AI model predicts the summer months more accurately than the winter months, similar to the mean CMIP6. In the future, we plan to develop this new model using addi- tional atmospheric and oceanic variables such as wind velocities, sea surface temperature, and 500 hPa geopotential height to investigate the effects of additional information on the prediction. We also plan to improve our forecast time to seasonal predictions, that is, three months ahead. Environmental Data Science 9 Author Contributions. Conceptualization: A.U; G.U; M.I. Methodology: A.U.; G.U.; M.I.; Software: B.A.; I.S.; B.Y.; A.U.; Data curation: I.S.; B.Y. Data visualisation: B.A.; I.S.; Y.A.; A.U.; Writing original draft: B.A.; Y.A.; Writing- review and editing: A.U.; M.I.; G.U. All authors approved the final submitted draft. 10 Unal, A. et al. Supplementary Material. Two figures provided below are intended to be included as the supplementary material. (a) Asia, Scenario 4 year 3 month 2 (b) Europe, Scenario 4 year 3 month 2 Figure 6. Comparison between AI model and ERA5 for the validation dataset. Environmental Data Science 11 References Anochi, J.A., de Almeida, V.A. and de Campos Velho, H.F. (2021) Machine Learning for Cli- mate Precipitation Prediction Modeling over South America. Remote Sensing. 2021, 13, 2468. https://doi.org/10.3390/rs13132468 Bochenek, B. and Ustrnul, Z. (2022) Machine Learning in Weather Prediction and Climate Analy- ses- Applications and Perspectives Atmosphere, 13, 180. https:// doi.org/10.3390/atmos13020180 Copernicus Climate Change Service (C3S) (2017) ERA5: Fifth generation of ECMWF atmospheric reanalyses of the global climate. Copernicus Climate Change Service Climate Data Store (CDS) 2022. Available at: https://cds.climate.copernicus.eu/cdsapp#!/home. Diederik P, Kingma. and Jimmy, Ba. (2015) Adam: A Method for Stochastic Optimization, 3rd International Conference for Learning Representations (ICLR). Eyring, V., Bony, S., Meehl, G.A., Senior, C. A., Stevens, B., Stouffer, R. J. and Taylor, K. E. (2016) Overview of the Coupled Model Intercomparison Project Phase 6 (CMIP6) experimental design and organization. Geoscientific Model Development, Volume 9, 2016, 1937-1958, https://doi.org/ 10.5194/gmd-9-1937-2016.. Fan, X., Duan, Q., Shen, C., Wu, Y. and Xing, C. (2020) Global surface air temperatures in CMIP6: historical performance and future changes Environmental Research Letters, Volume 15, Number 10, DOI 10.1088/1748-9326/abb051. Fujihara, Y., Tanaka, K., Watanabe, T., Nagano, T. and Kojiri, T. (2008) Assessing the impacts of climate change on the water resources of the Seyhan River Basin in Turkey: Use of dynamically downscaled data for hydrologic simulations Journal of Hydrology, Volume 353, Issues 1–2, Pages 33-48, ISSN 0022-1694, https://doi.org/10.1016/j.jhydrol.2008.01.024. Felice, M.D., Alessandri, A. and Catalano, F. (2015) Seasonal climate forecasts for medium-term electricity demand forecasting. Applied Energy, Volume 137, 2015, Pages 435-444, ISSN 0306-2619, https://doi.org/10.1016/j.apenergy.2014.10.030.. Feng, D,. Wang, G., Wei, X., Amankwah, S.O.Y., Hu, Y., Luo, Z., Hagan, D.F.T. and Ullah, W. (2022) Merging and Downscaling Soil Moisture Data From CMIP6 Projections Using Deep Learning Method Frontiers in Environmental Science, 10:847475. doi: 10.3389/fenvs.2022.847475 Franzke, C.L.E., Blender, R., O'Kane, T.J. and Lembo, V. (2022) TStochastic Methods and Complexity Science in Climate Research and Modeling. Frontiers in Physics. 10:931596. doi: 10.3389/fphy.2022.931596. Klemm, T. and McPherson, R. A. (2017). The development of seasonal climate forecasting for agri- cultural producers . Agricultural and Forest Meteorology, Volume 232, 2017, Pages 384-399, ISSN 0168-1923, https://doi.org/10.1016/j.agrformet.2016.09.005.. Laprise, R. (2008) Regional climate modelling Journal of Computational Physics, Volume 227, Issue 7, Pages 3641-3666, ISSN 0021-9991, https://doi.org/10.1016/j.jcp.2006.10.024. Liu, Z., Huang, J., Xiao, X. and Tong, X. (2022) The capability of CMIP6 models on seasonal precipitation extremes over Central Asia. Atmospheric Research, Volume 278, 2022, 106364, ISSN 0169-8095, https://doi.org/10.1016/j.atmosres.2022.106364.. Lorenzoni, I. and Pidgeon, N.F. (2006) Public Views on Climate Change: European and USA Perspectives. Climatic Change 77, 73–95. https://doi.org/10.1007/s10584-006-9072-z. Luo, X., Nadiga, B. T., Park, J. H., Ren, Y., Xu, W. and Yoo, S. (2022) A Bayesian deep learn- ing approach to near-term climate prediction. Journal of Advances in Modeling Earth Systems, 14, e2022MS003058. https://doi. org/10.1029/2022MS003058. Pan, B., Anderson, G. J., Goncalves, A., Lucas, D. D., Bonfils, C. J. W. and Lee, J. (2022). Improv- ing seasonal forecast using probabilistic deep learning. . Journal of Advances in Modeling Earth Systems, 14, e2021MS002766. https://doi. org/10.1029/2021MS002766. Ronneberger, O., Fischer, P. and Brox, T. (2015) U-Net: Convolutional Networks for Biomedical Image Segmentation. Medical Image Computing and Computer-Assisted Intervention (MICCAI), 9351. 12 Unal, A. et al. Roads, J., Chen, S.-C. and Kanamitsu, M. regional climate simulations forecasts Journal of Geophysical Research Atmosphere., 108(D16), 8606, (2003) U.S. and seasonal doi:10.1029/2002JD002232. Scinocca, J.F., Kharin, V.V., Jiao, Y., Qian, M.W., Lazare, M., Solheim , L., Flato , G.M. (2016) Coordinated Global and Regional Climate Modeling Journal of Climate,Volume 29: Issue 1, Page(s): 17–35DOI: https://doi.org/10.1175/JCLI-D-15-0161.1 Stott, P.A. and Forest, C. (2007) Ensemble climate predictions using climate models and observational constraintsPhil Philosophical Transactions of the Royal Society A.3652029–2052 http://doi.org/10.1098/rsta.2007.2075 Talukder, B., Ganguli, N., Matthew, R., vanLoon, G.W., Hipel, K.W. and Orbinski, J. (2021) Climate change-triggered land degradation and planetary health: A review . Land Degradation & Development, Pages 4509-4522, https://doi.org/10.1002/ldr.4056. Toth, Z., Pena, M. and Vintzileso, A. (2007) Bridging the gap between weather and climate forecast- ing, research priorities for intraseasonal prediction Bulletin of the American Meteorological Society, Page(s): 1427–1440, https://doi.org/10.1175/BAMS-88-9-1427 Seasonal forecasting. Meteorological Applications Troccoli, climate (2010) A. https://doi.org/10.1002/met.184.. Turnock, S. T., Allen, R. J., Andrews, M., Bauer, S. E., Deushi, M., Emmons, L., Good, P., Horowitz, L., John, J. G., Michou, M., Nabat, P., Naik, V., Neubauer, D., O'Connor, F. M., Olivié, D., Oshima, N., Schulz, M., Sellar, A., Shim, S., Takemura, T., Tilmes, S., Tsigaridis, K., Wu, T. and Zhang, J. (2020) Historical and future changes in air pollutants from CMIP6 models Atmospheric Chemistry and Physics, , 20, 14547–14579, https://doi.org/10.5194/acp-20- 14547-2020 Tyagi, S., Zhang, X., Saraswat, D., Sahany, S., Mishra, S. K. and Niyogi, D. (2022) Flash drought: Review of concept, prediction and the potential for machine learning, deep learning methods Earth's Future, 10, e2022EF002723. https://doi. org/10.1029/2022EF002723 Wang, D., Liu, J., Shao, W., Mei, C., Su, X. and Wang, H. (2021) Comparison of CMIP5 and CMIP6 Multi-Model Ensemble for Precipitation Downscaling Results and Observational Data: The Case of Hanjiang River Basin. Atmosphere 2021,12,867. https://doi.org/ 10.3390/atmos12070867 Xu, Z., Han, Y., Tam, C.Y., Yang., Z.L. and Fu., C. (2021) Bias-corrected CMIP6 global dataset for dynamical downscaling of the historical and future climate (1979–2100) Scientific Data 8, 293 (2021). https://doi.org/10.1038/s41597-021-01079-3 Yuan, N., Huang, Y. and Duan, J. (2019). On climate prediction: how much can we expect from climate memory? . Climate Dynamics 52, 855–864 (2019). https://doi.org/10.1007/s00382-018- 4168-5.. Zhang, S. and Li, X. (2021) Future projections of offshore wind energy resources in China using CMIP6 simulations and a deep learning-based downscaling method Energy, Volume 217, 119321, ISSN 0360-5442, https://doi.org/10.1016/j.energy.2020.119321 Zhou, Z., Md Siddiquee, M. R., Tajbakhsh, N. and Liang, J. (2018) UNet++: A Nested U-Net Architecture for Medical Image Segmentation. Deep Learning in Medical Image Analysis (DLMIA).
http://arxiv.org/abs/2302.10467v1
2023-02-21T06:16:48
2023-02-21T06:16:48
On the Behaviour of Pulsed Qubits and their Application to Feed Forward Networks
In the last two decades, the combination of machine learning and quantum computing has been an ever-growing topic of interest but, to this date, the limitations of quantum computing hardware have somewhat restricted the use of complex multi-qubit operations for machine learning. In this paper, we capitalize on the cyclical nature of quantum state probabilities observed on pulsed qubits to propose a single-qubit feed forward block whose architecture allows for classical parameters to be used in a way similar to classical neural networks. To do this, we modulate the pulses exciting qubits to induce superimposed rotations around the Bloch Sphere. The approach presented here has the advantage of employing a single qubit per block. Thus, it is linear with respect to the number of blocks, not polynomial with respect to the number of neurons as opposed to the majority of methods elsewhere. Further, since it employs classical parameters, a large number of iterations and updates at training can be effected without dwelling on coherence times and the gradients can be reused and stored if necessary. We also show how an analogy can be drawn to neural networks using sine-squared activation functions and illustrate how the feed-forward block presented here may be used and implemented on pulse-enabled quantum computers.
[ "Matheus Moraes Hammes", "Antonio Robles-Kelly" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10467v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10467v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "quant-ph", "@scheme": "http://arxiv.org/schemas/atom" }
[ "quant-ph", "cs.ET", "cs.LG" ]
3 2 0 2 b e F 1 2 ] h p - t n a u q [ 1 v 7 6 4 0 1 . 2 0 3 2 : v i X r a On the Behaviour of Pulsed Qubits and their Application to Feed Forward Networks Matheus Moraes Hammes and Antonio Robles-Kelly Deakin University, Waurn Ponds, VIC 3216, Australia Abstract In the last two decades, the combination of machine learning and quantum computing has been an ever-growing topic of interest but, to this date, the limitations of quantum computing hardware have some- what restricted the use of complex multi-qubit operations for machine learning. In this paper, we capitalize on the cyclical nature of quantum state probabilities observed on pulsed qubits to propose a single-qubit feed forward block whose architecture allows for classical parameters to be used in a way similar to classical neural networks. To do this, we modulate the pulses exciting qubits to induce superimposed rotations around the Bloch Sphere. The approach presented here has the ad- vantage of employing a single qubit per block. Thus, it is linear with respect to the number of blocks, not polynomial with respect to the number of neurons as opposed to the majority of methods elsewhere. Further, since it employs classical parameters, a large number of iter- ations and updates at training can be effected without dwelling on co- herence times and the gradients can be reused and stored if necessary. We also show how an analogy can be drawn to neural networks using sine-squared activation functions and illustrate how the feed-forward block presented here may be used and implemented on pulse-enabled quantum computers. 1 Introduction Quantum computing employs quantum-mechanical phenomena to perform computations. These computing algorithms often exhibit significant increases in efficiency, in some cases exponentially, compared to their classical counter- parts. As a result, since the 1970s, quantum computing has been an active 1 area of research, and, now, as we are approaching the end of Moore's Law [1], the quest for quantum supremacy has intensified. Indeed, the application of quantum-mechanical phenomena to computa- tion often yields significant increases in efficiency on quantum computers as compared to their classical counterparts. Such potential has been proven by the Shor's prime factorization [2] and Grover's algorithms [3]. Recall that Shor's algorithm is used for complex cryptography algorithms such as RSA [4], whereas Grover's method is employed for search on unstructured lists. Although these methods have shown the potential computational advantages of quantum computers over classical ones, the current state of quantum hard- ware is still rather limited, with the largest count of qubits in a single com- puter being of 127 as of 2021 [5]. Moreover, available quantum computers, abiding by the fundamental con- cept of quantum information[6], use reversible gates to measure and change the state of qubits. These qubits are governed by quantum mechanics, thus the effects of entanglement, interference, and superposition are manifested in their spin, polarization and energy levels [6]. Thus, there have been numer- ous research studies aiming to investigate the use of quantum computers for machine learning [7, 8, 9]. Further, in [9], the authors suggest quantum com- puters may be an ideal platform for the implementation of artificial neural networks (ANNs). This stems from the notion that the computational power of quantum computing in terms of efficiency and effectiveness combined with traditional artificial neural networks has the promise to outperform classical neural networks [10]. Nonetheless, the incorporation of quantum computation into ANNs is still an open and challenging research trend [11]. This is compelled by the notion that, even theoretically, most current research in the area is focused on adapting classical neural networks to a quantum system as opposed to developing quantum neural network theory from the ground up [12]. The most prominent attempts to work within the fundamentals of quantum the- ory have been made as related to the quantum perceptron [13] and the qubit neural network [14]. Moreover, Schuld et al. [12] point out how the majority of the existing approaches do not meet the requirements of what can reason- ably be defined as quantum ANNs. In fact, it can be argued that the single biggest challenge for a quantum ANN is that quantum mechanics are linear, but artificial neural networks require non-linearities [15]. This limitation due to the linear nature of quantum mechanics was also pointed out in [16], where the authors propose a quantum neuron to overcome this limitation by making use of a circuit composed of two qubits. Torrontegui et al. [17] propose a quantum perceptron with a sigmoid activation using a In qubit and a single adiabatic passage in a model of interacting spins. 2 [18], the authors present a network that employs circuits in a sequence of two qubits. Beer et al. [19] treat the quantum perceptron as an arbitrary unitary operator with m input and n output qubits. In [20] the authors use the continuous-variable model, where quantum information is encoded not in qubits, but in the quantum states of a field, such as the electromagnetic one. Pechal et al. [21] present a superconducting qubit implementation of an adiabatic controlled gate, which generalizes the action of a classical perceptron. In [22], the authors propose a hybrid quantum-classical neural network architecture making use of several two-qubit entangled gates. Maybe the work that is closer to the one presented here is that in [23], where the authors present a circuit-centric classifier that employs either sin- gle or two-qubit quantum gates. This is a low-depth circuit [24] which can be trained using a hybrid quantum-classical [25] gradient descent scheme. Despite some similarities, there are notable differences with respect to the method presented here. Firstly, while both employ trainable, classical pa- rameters, the method in [23] is such that the number of learnable parameters is poly-logarithmic with respect to the input dimension. In contrast, the cir- cuit presented here does not have such constraint, showing a behaviour much more in-line with classical neural networks. Moreover, the method in [23] en- codes the input feature vectors into the amplitudes of a quantum system. Rather, our approach employs a pulse modulator to excite the qubit. This is important since, as noted in [23], quantum methods that are polynomial in the number n of qubits can perform computations in 2n amplitudes. This does not apply to the circuit presented here. Here, we note that the underlying physics in pulse-enabled quantum com- puters offers the opportunity to exploit the cyclical nature of pulsed qubits to implement feed fodward networks. Thus, we propose a single-qubit feed forward block whose architecture allows for classical parameters to be used in a manner akin to classical neural networks. We do this by using the rota- tions of pulsed qubits on the Bloch sphere to show how such a block would be reminiscent of a single-layer neural network comprised of neurons with sine-squared activation functions. In contrast with other methods elsewhere, the number of qubits is not a function of the number of neurons in the net- work, but rather is linear in the number of blocks in the resulting circuit. Moreover, keeping the parameters classical has the further advantage that a large number of iterations and updates can be effected without dwelling on coherence times, whereby the gradients can be reused and stored if necessary and standard libraries can be used for loss minimization. 3 2 Quantum Pulses As mentioned earlier, quantum computers are an emerging technology. Op- erations in quantum systems arise from precise pulses stimulating qubits to change their state. The importance of pulse-level programming resides in its capacity to allow users full control of the quantum transformation via pro- grammable pulses and their scheduling. To our knowledge, however, pulses have only been used to calibrate quantum gates for better precision and ef- ficiency by changing the qubit states [26]. This improved precision when manipulating qubits is needed to achieve quantum supremacy, as researchers try to control the uncertainty of superposed states to reduce the quantum error. Quantum pulse level programming utilises resonance to modify the state of a qubit. A drive pulse will excite a qubit when it resonates with its natural frequency, rotating it around the Bloch Sphere. This is expected since the qubit frequency is the difference between the ground and excited states, i.e. |0(cid:105) and |1(cid:105) in "Bra-ket" notation. For the purposes of this paper we will focus on Gaussian pulses and, where relevant, will use Bra-Ket notation. This is as Bra-Ket notation captures the pairing of a linear function and complex vector in a Hilbert space. This is done as follows |0(cid:105) = . (cid:21) (cid:20) 1 0 and |1(cid:105) = (cid:21) (cid:20) 0 1 2.1 The Bloch Sphere Recall that a single qubit, much like their classical computing counterparts, is a two-state system. These states are |0(cid:105) and |1(cid:105). The correspondence of quantum states and binary values is the base for quantum information theory, where information is represented by quantum states and, with the use of quantum mechanics, quantum computations can be performed accordingly. Qubits are commonly defined by the following equation: |ψ(cid:105) = α|0(cid:105) + β|1(cid:105), (1) with α, β ∈ C and |0(cid:105), |1(cid:105) in the Hilbert space H 2, where |α| and |β| are probability amplitudes. Thus, measuring a qubit makes |ψ(cid:105) collapse into either |0(cid:105) or |1(cid:105)with probabilities |α|2 or |β|2 such that |α|2 + |β|2 = 1 (2) 4 The Bloch sphere, hence, represents geometrically the state of a quantum system in a two-dimensional Euclidean space. By arbitrarily choosing a pair of antipodal points as the two basis vectors |0(cid:105) and |1(cid:105) of a quantum system, it is possible to visualise the "pure" state of a qubit. The defining equation for representing a state in a Bloch sphere is derived from the general state equation given by |ψ(cid:105) = α|0(cid:105) + β|1(cid:105) (3) where α and β describe the probability of the qubit collapsing into either of its two possible states when measured. After normalising the qubit state, applying the trigonometric identity and removing the global phase term, we note that, for measuring a single qubit, its state |ψ(cid:105) can be expressed as follows 2|1(cid:105)(cid:1) such that θ, φ ∈ R are the angles on the Bloch sphere. 2|0(cid:105) + exp (cid:0)iφ sin θ |ψ(cid:105) = cos θ (4) Thus, the probability of a qubit collapsing into a |0(cid:105) or |1(cid:105) state when measured is indicated by the angle θ. The closer to a pole, the more likely the qubit is to collapse into the state corresponding to that particular pole. A 90o angle thus represents the point where the qubit has an equal probability of collapsing into either state. We illustrate this in the left-hand panel of Figure 1, where we show the representation of a qubit that has equal odds of falling into either state. Futher, the cyclic oscillation of states in the presence of a driving pulse in a quantum system is called a Rabi Cycle. A pulse that drives a qubit from a |0(cid:105) to |1(cid:105) is called a π-pulse, being equivalent to a 180° rotation on the Bloch sphere. It is worth noting in passing that this is analogous to an X180 qubit flipping gate [27]. Recall that defining a π-pulse in the context of a qubit requires two ex- periments to be conducted. Firstly, a frequency sweep. Secondly, a Rabi experiment. The frequency sweep experiment tests the resonance frequency of the qubit by sweeping over a range of pulses with different frequencies, measuring the energy absorption of the system for each of these. The reso- nant frequency of the qubit corresponds to the peak of the absorption curve. Once the resonant frequency of the target qubit is found, the amplitude of the π-pulse can be defined by varying its amplitude α so as to make the qubit oscillate around the Bloch sphere. The amplitude required to shift a qubit from its ground to its excited state is then given by half the period corresponding to the resonant frequency. 5 Figure 1: Left-hand panel: A Bloch sphere where the state of a qubit is such that it has equal probability of falling into either of its two states |0(cid:105) or |1(cid:105); Right-hand panel: A Bloch sphere where superposition has been applied to the qubit in the left-hand panel, rotating the qubit towards the |0(cid:105) state. 2.2 Pulsing Qubits To further understand the qubit behaviour as related to the equations above, consider the case where the amplitude of a pulse is doubled. This will induce Figure 2: Left-hand panel: Half π-pulse measurements; Right-hand panel: Double π-pulse measurements showing the corresponding shift induced by the second pulse with respect to the left-hand panel. 6 the qubit to move 360° around the Bloch sphere, returning it to its original state. On the other hand, halving the amplitude of a pulse drives a qubit to rotate 90° around the Bloch sphere, leaving the qubit in a symmetric superposition state. This is essentially equivalent to a Hadamard gate. This can be appreciated in Figure 2, where we show the qubit measurements over 128 trials as a function of the two components, real (Q) and imaginary (I), in Equation 2 when half and double shifts are applied to the qubits. In the plots, each of the points corresponds to a measurement of the qubit and the black markers correspond to the population mean. In both plots, red denotes ground states and blue excited ones. On the left-hand panel we have also included superimposed states, which we plot in yellow. As mentioned earlier, here we focus on Gaussian pulses. Being more formal, these can be defined as follows (cid:32) Υ (ω) = A exp − (cid:33) (ω − γ)2 2τ 2 (5) where ω is the frequency of the pulse, γ is the duration of the pulse, A is the amplitude and τ governs its width. For Gaussian pulses, the resulting excitation plot is a sinusoid that shows direct correlation to the amplitude A of the pulse. Note that this is consistent with the π-pulse measurments shown in Figure 2 and can be related to the the Bloch Sphere using the real component of the second term on the right- hand side in Equation 4. This can be express the excitation of the qubit as follows g (A) = a sin (ηA) + c (6) (cid:1), η and a are where we have used the the identity sin (ηA) = cos (cid:0) π proportionality constants and c is a constant that captures the vertical shift of the sinusoid. 2 − ηA From the equation above it becomes straightforward to note that the qubit state after being excited by a pulse is determined by the amplitude A. Thus, by using the amplitude, the pulse can be "shifted" around the Bloch sphere, allowing for the control of output signals through superposition. To do this, we set, without any loss of generality, η and a to unity and constrain A ∈ [0, 1]. By using the amplitude A and properties of π rotations on the Bloch sphere, we can write the probability of measuring the qubit in the state |1(cid:105) as follows (cid:19) (cid:18) π 2 A (7) P (|1(cid:105)) = sin2 7 2.3 On Superposition and Feedforward Networks Note that Equation 7 is somewhat reminiscent of a neuron in a network with a squared sinusoidal activation function. To see this more clearly, let f (x) = P (|1(cid:105)) and proceed to rewrite Equation 7 as follows f (x) = sin2 ((cid:104)w, x(cid:105) + b) (8) where (cid:104)*, *(cid:105) denotes, as usual, the dot product, x is the input vector, w is the weight vector, b corresponds to the bias, and sin2(*) is the activation function. Moreover, note that the amplitude of the pulse A can be viewed as the modulator of the rotation in Equation 3 around the Bloch sphere. Thus, it becomes straightforward to note that, by amplitude-modulating the pulses such that A = 2 π ((cid:104)w, x(cid:105) + b) (9) Equations 7 and 8 become equivalent. Making use of Equation 9 and the principles of superposition on the Bloch sphere, we can now explore the use of a train of pulses instead of a single one. Note that, on the Bloch sphere, each subsequent pulse will have the effect of rotating the qubit state towards either pole. From the previous sections, it's straightforward to note that these rotations are governed by the amplitude of the pulses as applied to the qubit excitation in Equation 4. This is an important observation since, by indexing the amplitude to the pulse position on the train, one could explore the use of these amplitudes and their relationship to the weight and bias vectors in Equations 8 and 9 to obtain a behaviour reminiscent of that exhibited by the layers of a neural network with a squared-sine activation function. Thus, let T be a train of n pulses with amplitudes Ai, where i is the index of the pulse in the train. The probability of a qubit being in a state |1(cid:105) for the ith pulse is then given by P (|1(cid:105)) = sin2 (cid:18) π 2 i (cid:88) j=1 (cid:19) Aj (10) 3 Pulsed Qubits for Feed Forward Neural Blocks Note that the equation above is telling. This is since it points to the fact that, as a train of pulses is used to excite the qubit, its probability will rotate on the Bloch sphere such that for n pulses there will be the same number of rotations. Each of these rotations corresponds to the state probabilities If we view Equation 8 as that corresponding to the output of the qubit. 8 Figure 3: Conceptual diagram of the p block presented here. The block takes at input x and, making use of the weight matrix W and bias vector b modulates a train of pulses T so excite the qubit Q to deliver at output the vector z of measured probabilities. of a neuron on a neural network we could then draw an analogy of a qubit excited by a train of pulses to a neurla block comprised by a single-layer of n neurons. These single blocks would then be somewhat reminiscent of layers in classical neural networks. This is important since a block would then be comprised of a single qubit. This is, the number of qubits is linear to the number of blocks, not to the number of neurons. We discuss this further in Section 4. For now, we focus our attention on the pulsed qubits and explore the analogy to a single-layer block of n neurons. To do this, let wi and bi be the weight vector and bias in Equation 8 corresponding to the amplitude in the ith pulse. Under the analogy above, these would also be the weights and bias of the ith neuron in our neural network layer. With this notation, and making use of Equation 9 we can write Equation 10 as follows P (|1(cid:105)) = sin2 (cid:0)(cid:104)wj, x(cid:105) + bj (cid:1) (cid:19) (cid:18) i (cid:88) j=1 = sin2 (cid:0)(cid:104)wi, x(cid:105) + bi + (cid:37)i (cid:1) whereby, in the equation above, we have introduced the term (cid:37)i = i−1 (cid:88) j=1 (cid:0)(cid:104)wj, x(cid:105) + bj (cid:1) 9 (11) (12) which, by definition, is set to zero for i = 1. From Equation 12 it becomes clear that (cid:37)i should be taken into account as a result of the superposition of states in qubits. That said, it can be easily computed if the weights and biases are in hand. In Figure 3, we show the diagram of a quantum block, which we denote p 1, aimed at obtaining a n vector z of measured probabilities corresponding to the train of n pulses T being applied to the qubit Q. In Figure 3, we have denoted W as the matrix of weights whose ith row corresponds to the vector wT j . Similarly, we have used p and b as the vectors whose entry indexed i corresponds to (cid:37)i and bi, respectively. In Figure 3, the block S computes the vector p, which is added to the bias and the product of the input and the weight matrix W. This yields a vector of amplitudes that are passed on to the pulse generator, which applies the train of n pulses T to the qubit. The block P delivers the vector z of measured probabilities at output. This is such that the ith entry of z corresponds to the qubit probability P (|1(cid:105)) corresponding to the pulse indexed i in T . 4 Discussion 4.1 Relation to Neural Blocks Note that the block p n is somewhat reminiscent of a single-layer neural net- work block. Indeed, Artificial Neural Networks rely on activation functions to produce non-linear outputs based upon the inputs of the neuron under consideration. That said, there are notable differences. Firstly, most of the widely used functions, such as ReLU, Sigmoid, Tanh, and Leaky ReLu are monotonic. This often improves convergence, as the output of the neuron can be viewed as being correlated to the input, whereby larger weights im- ply a larger correlation of the input to the output and a weak correlation is reflected by smaller weights. Non-monotonic activation functions behave differently. Moreover, sine activation functions, due to their periodicity, can be viewed as oscillators. This is, for a large correlation of inputs, the activation function oscillates from weaker to stronger activations i.e. outputs may increase or decrease as weights increase. This oscillation is regarded as an inconvenience to general learning tasks, with the widespread belief that sine excitation functions in neural networks are harder to train and slower to converge [28]. 1We have chosen the Perthro rune symbol since it shares its transliteration with π in an analogy to the common notation used for pulsing qubits. 10 As a result, sine neural networks are considerably under-researched and seldom used. Despite the small volume of research concerning neural net- works using sinusoidal activation functions, these functions have been suc- cessfully implemented as hidden layers in neural networks - at times improv- ing accuracy and convergence at training as compared to their sigmoidal counterparts [29]. In addition to performance and accuracy improvements, periodic activation functions can offer larger memory capacity in chaotic neuron models[30]. More importantly, the inclusion of the term (cid:37)i in Equation 11 implies that the ith output of the block would depend not only on the weights and biases indexed i but also on the ones for which j < i. This, as mentioned earlier, is due to the superposition on the Bloch sphere. There are several ways in which (cid:37)i may be interpreted. Maybe the most intuitive of these is as a cumulative phase variable on the pulse modulator. Thus, the longer the train of pulses T , the more terms the right-hand side of Equation 12 will comprise. 4.2 Pulse Programming Despite being fundamental to the calibration of qubits, it was until recently that pulse-level programming was available on an open-source SDK. Indeed, recently, IBM has released Qiskit, an SDK that allows for working with quantum computers at the level of pulses, circuits and application modules. Further, Qiskit is an open-source framework dedicated to creating and ex- perimenting with quantum programs on either simulated or experimental quantum computers, enabling developers to remotely program on quantum devices. Qiskit at first only offered unitary gates that allowed the manipula- tion of the state of qubits but, in a recent update, manipulating the inherent quantum physical dynamics was made possible with the addition of pulse- level programming [26]. Hence, we use it henceforth for the results in this paper, which were carried out on IBM's Armonk quantum computer. As Qiskit pulse-enabled qubits have a target frequency of 5-7GHz, a fre- quency sweep is needed to fine-tune the pulses while accounting for variations in the system or the environment. It is worth noting that Qiskit does not allow in general more than four pulses to be used on a single train. As a result, in the results and experiments shown here, we have accounted for this by allowing the qubits to reset when necessary and accounted for the corresponding amplitude shifts accordingly. Despite these limitations, quan- tum pulse fidelity and qubit calibration are active areas of research. Recent papers reportedly have achieved an accuracy of over 99% [31], considered to be the threshold for fault-tolerant quantum computation [32]. 11 Figure 4: Block diagram of the feed forward circuit used for the XOR simu- lation. The circuit is comprised of a single Perthro block and C, which is a thresholding one. 5 Experiments In this section, we show results on three tasks using the Perthro gate pre- sented earlier. The first of these is the simulation of an XOR gate. The second one pertains to categorical classification and the final one is a regression task. To obtain the results for our approach shown throughout the section, we have made use of Qiskit pulse schedules on IBM's Armonk quantum computer to feed the single qubit in each of the p n blocks with the corresponding pulses of different amplitudes 2. We have also bound the amplitude pulses making use of the drive current obtained after calibration. All the jobs were initialized and sent to the quantum computer using a personal laptop with a 2.7 GHz Dual-Core Intel i5 processor and 8 GB. This laptop was also used to process the results of each job and optimize model parameters accordingly. The use of Qiskit also permits finding the values of the weight matrices and the bias vectors used throughout the section. To this end, we have implemented the Perthro block equations presented earlier in a simulator on a classical computer and trained it using both, the simulator and tensorflow. This hinges in the notion that we can view the Perthro block p n as an n-neuron single layer network, where each neuron output corresponds to Equation 11. This allows for the weights to be found by minimising, via gradient descent, the corresponding loss in a manner akin to that used in the classical training of feedforward networks while performing the forward evaluation of the network using the simulator. Once the parameters are in 2The qubit has also been calibrated using the procedure in https://qiskit.org/ textbook/ch-quantum-hardware/calibrating-qubits-pulse.html 12 hand, these can be used to modulate the pulses using Qiskit and tested on IBM's Armonk quantum computer. 5.1 XOR Computation To illustrate the behaviour of the pn block introduced earlier, we now turn our attention to reproducing an XOR gate. Note this is a classical problem in artificial neural network research. The problem is that, given two binary inputs, predict the output of an exclusive-or gate. An XOR gate returns a false value (a zero) if the inputs are equal and true (unity) if the inputs are not. In this case, we have used this simulation in order to illustrate the behaviour of the block when used in an analogy to a two-neuron perceptron, i.e. single-layer network, with a classification stage. Here, we employ for our experiments a circuit comprised by one Perthro block. In Figure 4, we show the block diagram of our feed forward circuit, where the Perthro block p 2 is such that it takes at input two bits and de- livers, at output two probabilities following Equation 11. The block C is a classification stage, which in this case, is based on two thresholds. To obtain the final XOR outputs, we use the output of the p 2 block, which we denote as z = [P1(|1(cid:105)), P2(|1(cid:105))]T and set the output of C such that the prediction of the circuit becomes y = (cid:40) 0 if P1(|1(cid:105)) ≥ 0.5 ∧ P2(|1(cid:105)) ≤ 0.5 1 Otherwise (13) In Figure 5, we show the scatter plot for the output vector z over 1024 trials for the block p 2, where the x-axis corresponds to the probability P1(|1(cid:105)) and the y-axis to P2(|1(cid:105)). In the figure, we show in blue those trials for which the ground-truth, i.e. the output of an XOR gate for the input vector x, is one. In red, we show those for which the trail should yield a zero. The scatter plot also illustrates the probabilistic nature of quantum physics, whereby the output of the block C when applied to the measured probabilities corresponds to the ground truth 88.77%, i.e. 908 out of 1024 trials correspond to the ground truth after the measured probabilities have been thresholded. The thresholds were chosen to reflect the notion that 0.5 is where the qubit has an equal chance of collapsing into either the |1(cid:105) or |0(cid:105) state. To find the values of the weight matrix W and the bias vector b for the circuit in Figure 5, we have employed the mean squared error (MSE) loss of the predictions with respect to the ground truth in a manner akin to that used in feed forward networks. Note that, despite this minimisation hinges on the equivalent of a two-neuron network, the Perthro blocks p 2 is built 13 Figure 5: Scatter plot for the two qubit probabilites of |1(cid:105) delivered by the block p 2 in the XOR simulation circuit shown in Figure 5. In the scatter plot, we have denoted the variables whose ground-truth values correspond to logical 1 in red and 0 as blue. upon a single qubit, whereby the pulse modulator delivers two pulses to the qubit. These pulses account for each of the two probabilities in z used to produce the scatter plot shown in Figure 5. This is reflected in Table 5.1, where we show the statistics for our XOR circuit. Number of p blocks Number of Pulses Number of Neurons Number of Qubits 1 2 2 1 Table 1: Statistics for the XOR circuit used in our experiments. 14 5.2 Classification Note the XOR experiments above are consistent with the notion that the Perthro blocks can be used as layers in neural networks. As a result, we now turn our attention to a classification task involving longer pulse trains, i.e. pulse schedules. To illustrate this, we now turn our attention to a classification problem using the Iris dataset 3. For our experiments on the Iris dataset, we have used the circuit in Figure 6. In the figure, to avoid confusion, we have indexed the weight matrices and bias vectors to the block number. For the training of these weights and biases, again, we have viewed the blocks p 3 as single layers of 6, 12 and 3 neurons whose activation function corresponds to Equation 11. Note that, viewed in this manner, the circuit is equivalent to a 21 neuron, three- layer, feed forward network whereby the weight matrices and biases can be learnt accordingly. In the circuit, the block C now corresponds to a softmax classification stage and, hence, to train it, we have used the categorical cross- entropy loss. This is telling since the circuit in Figure 6 only employs three qubits in overall. 12 and p 6, p In Figure 7, we show the training loss and categorical accuracy for the training as a function of iteration number. In our classification experiments, we performed both the simulation using Qiskit and the test on IBM's Armonk quantum computer. For these, the test accuracy and standard deviations de- livered by our simulated circuit were 79.29 ± 5.04%, whereas IBM's computer yielded 73.33±10.4%. Note these deliver a margin of improvement over those reported for the quantum-classical neural network architecture in [22]. Fur- 3The Iris dataset can be accessed at https://archive.ics.uci.edu/ml/datasets/ iris Figure 6: Conceptual diagram of the circuit used for our classification exper- iments. Note each of the blocks comprises a qubit, regardless of how many pulses are used. In this case the C block is a classical soft-max classification stage applied after the last Perthro block p 3 delivers its z output vector of measured probabilities. 15 Figure 7: Training accuracy (left-hand panel) and loss (right-hand panel) as a function of iteration number for the classification circuit in Figure 6 used in our experiments on the Iris dataset. ther, note that, in [22], the authors achieved a simulated variational quantum circuit (VQC) accuracy of 81.5 ± 14.37 and a simulated hybrid neural net- work (HNN) accuracy of 89.88 ± 4.24% using 20 trainable parameters. This contrasts with our circuit, which employs 117 trainable parameters. When running their approach on quantum hardware, the authors in [22] obtained a classification accuracy for the approach in [22] drops to 45.0 ± 5.0% for the VQC and 28.12 ± 20.62% for the HNN. Its also worth noting that this comparison should be taken with caution since the authors in [22] used the IBM QASM simulator and the IBM Mumbai and IBM Montreal quantum computers, which differ from those used for our results. Moreover, their results are for binary classification, whereas ours are categorical. That is, they employed only the samples corresponding to the iris versicolor and iris virginica classes, whereas we used the three species in the dataset. 5.3 Regression As mentioned previously, the p block presented here can also be applied to regression problems in a manner akin to feed forward networks. To illustrate the utility of the p block for regression, in this section we use the Airfoil 16 Self-Noise dataset 4. The structure of the circuit used here is very similar to that used in the previous section. Thus the equivalent network is very similar to the one that applies to our classification experiments. The main difference being that, while the structure of the network follows the same three block-layer pattern, the final block is equivalent to a single neuron layer, i.e. we have substituted the p 1 block. Thus, no additional stages are necessary after the last block. Our regression circuit is thus comprised of blocks three blocks p 1. We trained our circuit so as to optimise the Mean Squared Error, with and MSE loss which converged after 600 epochs. In Figure 8, we show the training and validation loss for our circuit. 3 block in Figure 6 for a p 12 and p 6, p When tested on the Armonk, the mean squared error on the testing set is 0.0898. This is as compared to a value of 0.001 on the simulation platform. This is mainly due to the impact of the quantum compounding uncertainty effect in regression problems. It is also worth noting that this effect may be mitigated by using less blocks in the circuit, which would be equivalent to a network with less layers. This is due to the Uncertainty Principle [33], and the consequential fundamental limitation in the accuracy of Quantum Hardware [34], whereby increasing the number of qubits, i.e. layers, would yield more imprecise results. 6 Conclusion In this paper, we have proposed a single-qubit feedforward block whose archi- tecture allows for classical parameters to be used in a manner akin to classical neural networks. To do this, we have departed from the cyclical nature of quantum state probabilities observed on pulsed qubits to show how such a block would be reminiscent of a single-layer neural network comprised of neu- rons with sine-squared activation functions. In this way, we have shown how pulses can be modulated to excite qubits in order to induce superimposed rotations around the Bloch Sphere. The approach presented here has the advantage of employing a single qubit per block. Thus, being linear concern- ing the number of blocks rather than polynomial with respect to the number of neurons in a network. Moreover, the approach presented here employs classical parameters and, hence, allows for a large number of training itera- tions and updates regardless of coherence times. It also has the advantage of allowing for gradients to be reused and stored if necessary. Finally, we have illustrated how the feed forward Pertho block presented here may be 4The Airfoil Self-Noise dataset can be accessed at https://archive.ics.uci.edu/ ml/datasets/Airfoil+Self-Noise 17 Figure 8: Training and validation losses as a function of iteration number for the regression on the Airfoil Self-Noise dataset. used in a manner consistent with neural networks and implemented on an IBM pulse-enabled quantum computer to tackle classification and regression tasks. References [1] T. N. Theis and H.-S. P. Wong, "The end of moore's law: A new begin- ning for information technology," Computing in Science & Engineering, vol. 19, no. 2, pp. 41–50, 2017. [2] P. W. Shor, "Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer," SIAM review, vol. 41, no. 2, pp. 303–332, 1999. 18 [3] L. K. Grover, "A fast quantum mechanical algorithm for database search," in Proceedings of the Twenty-Eighth Annual ACM Symposium on Theory of Computing, STOC '96, (New York, NY, USA), p. 212–219, Association for Computing Machinery, 1996. [4] J. Proos and C. Zalka, "Shor's discrete logarithm quantum algorithm for elliptic curves," arXiv preprint quant-ph/0301141, 2003. [5] S. Yang, W. Zi, B. Wu, C. Guo, J. Zhang, and X. Sun, "Quantum logic synthesis for satisfiability problems," 2021. [6] L. Gyongyosi and S. Imre, "A survey on quantum computing technol- ogy," Computer Science Review, vol. 31, pp. 51–71, 2019. [7] M. Lewenstein, "Quantum perceptrons," Journal of Modern Optics, 1994. [8] S. Lloyd, M. Mohseni, and P. Rebentrost, "Quantum principal compo- nent analysis," Nature Physics, 2014. [9] J. Biamonte, P. Wittek, N. Pancotti, P. Rebentrost, N. Wiebe, and S. Lloyd, "Quantum machine learning," Nature, vol. 13, pp. 195–202, 2017. [10] S. K. Jeswal and S. Chakraverty, "Recent developments and applica- tions in quantum neural network: A review," Archives of Computational Methods in Engineering, vol. 26, pp. 793–807, Sept. 2019. [11] J. Chen, L. Wang, and E. Charbon, "A quantum-implementable neu- ral network model," Quantum Information Processing, vol. 16, no. 10, p. 245, 2017. [12] M. Schuld, I. Sinayskiy, and F. Petruccione, "The quest for a Quan- tum Neural Network," Quantum Information Processing, vol. 13, no. 11, pp. 2567–2586, 2014. [13] M. Siomau, "A quantum model for autonomous learning automata," Quantum Information Processing, vol. 13, p. 1211–1221, Jan 2014. [14] N. Kouda, N. Matsui, H. Nishimura, and F. Peper, "Qubit neural net- work and its learning efficiency," Neural Computing and Applications, vol. 14, no. 2, pp. 114–121, 2005. 19 [15] G. Cybenko, "Approximation by superpositions of a sigmoidal function," Mathematics of Control, Signals and Systems, vol. 2, no. 4, pp. 303–314, 1989. [16] Y. Cao, G. G. Guerreschi, and A. Aspuru-Guzik, "Quantum neuron: an elementary building block for machine learning on quantum computers," 2017. [17] E. Torrontegui and J. J. Garc ́ıa-Ripoll, "Unitary quantum perceptron as efficient universal approximator," EPL (Europhysics Letters), vol. 125, p. 30004, Mar 2019. [18] E. Farhi and H. Neven, "Classification with quantum neural networks on near term processors," 2018. [19] K. Beer, D. Bondarenko, T. Farrelly, T. J. Osborne, R. Salzmann, D. Scheiermann, and R. Wolf, "Training deep quantum neural net- works," Nature communications, vol. 11, no. 1, pp. 1–6, 2020. [20] N. Killoran, T. R. Bromley, J. M. Arrazola, M. Schuld, N. Quesada, and S. Lloyd, "Continuous-variable quantum neural networks," Physical Review Research, vol. 1, Oct 2019. [21] M. Pechal, F. Roy, S. A. Wilkinson, G. Salis, M. Werninghaus, M. J. Hartmann, and S. Filipp, "Direct implementation of a perceptron in superconducting circuit quantum hardware," 2021. [22] D. Arthur and P. Date, "A hybrid quantum-classical neural network architecture for binary classification," 2022. [23] M. Schuld, A. Bocharov, K. M. Svore, and N. Wiebe, "Circuit-centric quantum classifiers," Physical Review A, vol. 101, Mar 2020. [24] G. Verdon, M. Broughton, and J. Biamonte, "A quantum algorithm to train neural networks using low-depth circuits," 2019. [25] J. R. McClean, J. Romero, R. Babbush, and A. Aspuru-Guzik, "The theory of variational hybrid quantum-classical algorithms," New Journal of Physics, vol. 18, no. 2, 2016. [26] T. Alexander, N. Kanazawa, D. J. Egger, L. Capelluto, C. J. Wood, A. Javadi-Abhari, and D. C McKay, "Qiskit pulse: programming quan- tum computers through the cloud with pulses," Quantum Science and Technology, vol. 5, p. 044006, Aug 2020. 20 [27] T. S. Koh, J. K. Gamble, M. Friesen, M. A. Eriksson, and S. N. Copper- smith, "Pulse-gated quantum-dot hybrid qubit," Physical Review Let- ters, vol. 109, Dec 2012. [28] G. Parascandolo, H. Huttunen, and T. Virtanen, "Taming the waves: sine as activation function in deep neural networks," 2016. [29] J. Sopena, E. Romero, and R. Alquezar, "Neural networks with periodic and monotonic activation functions: a comparative study in classifica- tion problems," in 1999 Ninth International Conference on Artificial Neural Networks ICANN 99. (Conf. Publ. No. 470), vol. 1, pp. 323–328 vol.1, 1999. [30] M. Nakagawa, "An Artificial Neuron Model with a Periodic Activation Function," Journal of the Physical Society of Japan, vol. 64, p. 1023, Mar. 1995. [31] C. Ballance, T. Harty, N. Linke, M. Sepiol, and D. Lucas, "High-fidelity quantum logic gates using trapped-ion hyperfine qubits," Physical Re- view Letters, vol. 117, Aug 2016. [32] E. Knill, "Quantum computing with realistically noisy devices," Nature, vol. 434, p. 39–44, Mar 2005. [33] P. Busch, T. Heinonen, and P. Lahti, "Heisenberg's uncertainty princi- ple," Physics Reports, vol. 452, no. 6, pp. 155–176, 2007. [34] V. Giovannetti, S. Lloyd, and L. Maccone, "Advances in quantum metrology," Nature Photonics, vol. 5, pp. 222–229, mar 2011. 21
http://arxiv.org/abs/2302.10463v1
2023-02-21T06:11:08
2023-02-21T06:11:08
Multimodal Trajectory Prediction: A Survey
Trajectory prediction is an important task to support safe and intelligent behaviours in autonomous systems. Many advanced approaches have been proposed over the years with improved spatial and temporal feature extraction. However, human behaviour is naturally multimodal and uncertain: given the past trajectory and surrounding environment information, an agent can have multiple plausible trajectories in the future. To tackle this problem, an essential task named multimodal trajectory prediction (MTP) has recently been studied, which aims to generate a diverse, acceptable and explainable distribution of future predictions for each agent. In this paper, we present the first survey for MTP with our unique taxonomies and comprehensive analysis of frameworks, datasets and evaluation metrics. In addition, we discuss multiple future directions that can help researchers develop novel multimodal trajectory prediction systems.
[ "Renhao Huang", "Hao Xue", "Maurice Pagnucco", "Flora Salim", "Yang Song" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10463v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10463v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.RO", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.RO", "cs.CV", "cs.LG" ]
Multimodal Trajectory Prediction: A Survey Renhao Huang , Hao Xue , Maurice Pagnucco , Flora Salim , Yang Song School of Computer Science and Engineering, University of New South Wales, Sydney, Australia {renhao.huang, hao.xue1, morri, flora.salim, yang.song1}@unsw.edu.au 3 2 0 2 b e F 1 2 ] O R . s c [ 1 v 3 6 4 0 1 . 2 0 3 2 : v i X r a Abstract Trajectory prediction is an important task to sup- port safe and intelligent behaviours in autonomous systems. Many advanced approaches have been proposed over the years with improved spatial and temporal feature extraction. However, human behaviour is naturally multimodal and uncertain: given the past trajectory and surrounding environ- ment information, an agent can have multiple plau- sible trajectories in the future. To tackle this prob- lem, an essential task named multimodal trajec- tory prediction (MTP) has recently been studied, which aims to generate a diverse, acceptable and explainable distribution of future predictions for each agent. In this paper, we present the first survey for MTP with our unique taxonomies and compre- hensive analysis of frameworks, datasets and eval- uation metrics. In addition, we discuss multiple future directions that can help researchers develop novel multimodal trajectory prediction systems. 1 Introduction Trajectory prediction has received great attention over the years for autonomous systems such as social robotics and self-driving cars. It aims to predict the future trajectories for road users such as vehicles, pedestrians and cyclists based on their past trajectories and surrounding environments includ- ing static factors such as terrain and obstacles and dynamic factors such as surrounding moving agents. Traditional trajectory prediction explores physical models to model human behaviours where future motions are pre- dicted using physical models, such as Social Force [Helbing and Moln ́ar, 1995], which describe social behaviours such as clustering and collision avoidance as attractive and repulsive forces. However, such models cannot handle complex inter- actions to propose human-like future predictions. More re- cently, learning-based models have been proposed to learn complex spatial and temporal interactions from datasets us- ing advanced modules such as pooling [Alahi et al., 2016], attention [Gupta et al., 2018] and graph neural networks [Mo- hamed et al., 2020; Huang et al., 2019]. Trajectory prediction is typically formulated as determin- istic trajectory prediction (DTP) tasks where the model is ex- Figure 1: An example of Multimodal Trajectory Prediction. The blue, green and red lines are the observed, the ground truth and other possible paths respectively. The agent can have multiple plausible trajectories including the ground truth given an observed path. pected to provide only one prediction for each agent. How- ever, DTP suffers heavily from the uncertainty from limited social clues and the performance is usually capped. Taking Fig. 1 as an example, assuming that the agent is going to en- ter the building, the observed path indicates that it may also cross the road or follow the sidepath. Since all scenarios are plausible, it is unrealistic for DTP to predict a single trajec- tory without sufficient cues, such as human intentions. Therefore, a recent task named multimodal trajectory pre- diction (MTP) is proposed by Gupta et al. [2018], where the model is expected to provide multiple predictions to cover all modalities, i.e., plausible paths, of future trajectories. MTP is expected to handle the uncertainty of predictions and has become a default setting in almost all recent studies. Some methods have focused on improving the feature extraction modules, while others try to generate more diverse and so- cially acceptable distributions using only one ground truth future trajectory. In this paper, we present the first survey for multimodal trajectory prediction. Existing trajectory prediction surveys for pedestrians [Rudenko et al., 2020] and vehicles [Teeti et al., 2022] all build their taxonomy from the feature extraction perspective and MTP is briefly introduced as auxiliary con- tent. As a more realistic scenario in trajectory prediction, we believe that deeper investigations and analysis are required. We review and provide our taxonomies for the frameworks, GAN GAN: SGAN [Gupta et al., 2018];InfoGAN: S-Ways [Amirian et al., 2019]; BicycleGAN: Social-BiGAT [Kosaraju et al., 2019]; MGAN:MG-GAN [Dendorfer et al., 2021] Noise-based Framework Conditional CVAE Desire [Lee et al., 2017]; AgentFormer [Yuan et al., 2021]; DisDis [Chen et al., 2021]; ABC [Halawa et al., 2022]; SocialVAE [Xu et al., 2022] Normalising Flow HBAFlow [Bhattacharyya et al., 2021]; FloMo [Sch ̈oller and Knoll, 2021]; STGlow [Liang et al., 2022] DDPM MID [Gu et al., 2022] Anchor Conditioned Framework MTP Frameworks Predicted Endpoint Conditioned PECNet [Mangalam et al., 2020]; YNet [Mangalam et al., 2021]; TNT [Zhao et al., 2021]; DenseTNT [Gu et al., 2021] Prototype Trajectory Conditioned CoverNet [Phan-Minh et al., 2020]; MultiPath [Chai et al., 2020]; S-Anchor [Kothari et al., 2021]; SIT [Shi et al., 2022] Grid-based Framework Beam Search: Multiverse[Liang et al., 2020]; ST-MR [Li et al., 2022]; Gumbel Sampling: TDOR [Guo et al., 2022] Bivariate Gaussian Outputs STGCNN [Mohamed et al., 2020]; MultiPath [Chai et al., 2020] Other Techniques for Improved MTP Advanced Discriminators FSGAN [Parth and Alexandre, 2019]; SEGAN [Huang et al., 2020]; SafeCritics [van der Heiden et al., 2019]; SGANv2 [Kothari and Alahi, 2022] Advanced Sampling Tricks TTST [Mangalam et al., 2021]; LDS [Ma et al., 2021]; NPSN [Bae et al., 2022] Figure 2: An overview of the taxonomy of MTP frameworks. datasets and evaluation metrics for MTP and analyse their advantages and issues. Then, we discuss potential directions that should be the focus of future research. i , Y τ i = {X t i }, where X T i contain 2D coordinates. i,K = { ˆY t i , X T 1:N \i, S as inputs: ˆY τ 2 Background Agent An agent in trajectory prediction is a road user with self-cognition such as a pedestrian, a motorist or a cyclist. Trajectory A trajectory of an agent i in trajectory predic- tion is defined as a sequence of 2D real-world or pixel co- ordinates: {X T i |t ∈ [1, Tobs]} is the observed trajectory with Tobs timesteps, Y τ i = {Y t i |t ∈ (Tobs, Tobs + Tpred]} is the ground truth of the future path with Tpred time steps and i is the index among N agents in a i and Y t scene i ∈ [1, N ]. Both X t Trajectory Prediction The goal of trajectory prediction is to optimise a model fT P to predict K future trajecto- ries ˆY τ i,k|k = 1, * * * , K} using observed informa- i,K = fT P (X T tion X T 1:N \i, S), where X T 1:N \i are the set of agents i's neighbours' observed trajectories and S is the scene information which can be the LIDAR data, high-definition (HD) maps, scene images, etc. When K = 1, where only a single prediction is allowed for each agent, the task is deterministic trajectory prediction (DTP) and expects a minimum prediction error compared to Y τ i . Otherwise, it becomes multimodal trajectory prediction (MTP) and aims to predict a distribution of all acceptable fu- ture trajectories. Standard Framework for DTP The framework for DTP usually follows the sequence-to-sequence structure as shown in Fig. 3a, where the past encoder extracts the spatial and temporal information from the observed information and the decoder predicts the future path. To build a DTP model, the past encoder can be (1) the combination of encoding mod- ules for temporal, social and physical features [Xue et al., 2018; Sadeghian et al., 2019; Dendorfer et al., 2021]; (2) a CNN-based encoding module on raster HD maps [Wang et al., 2020] or heatmaps [Mangalam et al., 2021]; or (3) a i , X T graph neural network-based encoding module on vectorised HD maps [Gao et al., 2020]. The decoder can be a recurrent network-based autoregressive module or an MLP-based or a CNN-based non-autoregressive module. The reconstruction loss such as l1 or l2 loss is used to optimise the prediction with the expectation of less error to the ground truth. MTP models can also use these past encoders and decoders in their frameworks, except that their decoders are executed repeat- edly with different feature inputs. Multimodality in Trajectory Prediction Given the ob- served information, there can be multiple plausible and so- cially acceptable future predictions for the agent. Therefore, it is different from the data modality in other multimodal learning tasks. It is unlikely to expect a model to predict only one future trajectory consistently and precisely to match the ground truth due to limited clues that can be obtained from the environment and the inherent randomisation for each move- ment. Therefore, MTP requires the model to provide multiple proposals that are acceptable to humans. 3 Frameworks for MTP A "good" distribution predicted from an MTP model is ex- pected to satisfy the following aspects: (1) Diversity, where the predicted distribution should cover all possible solutions; (2) Social Acceptance, where the predicted paths should be realistic with the past trajectory and follow social norms; (3) Explanablity/Controllability, where each prediction should follow a reasonable intention or be controlled by understand- able conditions. It is challenging because optimal distribu- tions are estimated using only one ground truth which often leads to less diverse and unacceptable predictions. To tackle this problem, many advanced frameworks are proposed. In this section, we review the MTP frameworks with their tax- onomy in Fig. 2 and general pipelines in Fig. 3. 3.1 Noise-based MTP Framework The simplest way to convert DTP to MTP is to inject random noise into the model. In this section, we discuss the Noise- based MTP framework introduced by Gupta et al. [2018] (a) DTP (b) GAN (c) CVAE (d) Normalising Flow (e) PEC (f) PTC (g) Grid-based Figure 3: General Pipelines of DTP and MTP frameworks. The block with multiple layers is executed repeatedly with K different inputs. Dashed blue lines and blocks are executed for training only. where features from the past encoder are concatenated with Gaussian noise vectors and sent together into the decoder for diverse predictions. The prediction is optimised by variety loss using the minimum reconstruction error: Lrec( ˆY τ K,i, Y τ Lvariety( ˆY τ k,i, Y τ i ). (1) i ) = min k<K As mentioned in Gupta et al. [2018], variety loss can suc- cessfully alleviate the mode collapse problem brought from the reconstruction loss. Thiede and Brahma [2019] explain that a learner trained with variety loss can converge to the square root of the ground truth probability density function, which further illustrates the success of this loss function. This framework can be simply integrated into any DTP model and has been widely used in trajectory prediction. However, this framework may generate unrealistic predic- tions and is difficult to control. To tackle this problem, many advanced generative frameworks are proposed. Generative Adversarial Network (GAN) To encourage high-quality predictions, a special loss function is needed to discriminate between bad and good predictions, known as ad- versarial loss. Gupta et al. [2018] introduce the GAN-based MTP framework with its first model S-GAN. The general pipeline is shown in Fig. 3b, where a discriminator is learned to classify whether the future trajectory is the ground truth or the prediction and the adversarial loss is its cross entropy result. Further works aim to improve the performance us- ing more advanced GAN frameworks. For example, Kosaraju et al. [2019] propose Social-BiGAT which follows the Bicy- cleGAN to perform reversible transformations between each generation and its latent noise vector to further alleviate the mode collapse. Concurrently, Amirian et al. [2019] claim that the reconstruction loss is the main factor that causes mode collapse. Hence, their model S-Way depreciates this loss and follows InfoGAN to use latent code to control the prediction. Dendorfer et al. [2021] suggest that the manifold of the dis- tribution of future paths is discontinued and thus cannot be well covered by other GAN-based methods. Therefore, they propose MG-GAN by using multiple decoders, each one han- dling a continuous sub-manifold. Conditional Variational Autoencoder (CVAE) CVAE- based trajectory prediction models [Lee et al., 2017; Yuan et al., 2021; Chen et al., 2021] follow [Sohn et al., 2015] that maximise the evidence lower-bound of feature distribu- tion as shown in Fig. 3c and is an alternative to encourage di- verse predictions. In addition, the latent distribution of CVAE can be better controlled and enhanced. For instance, Dis- Dis [Chen et al., 2021] and ABC [Halawa et al., 2022] pre- dict personalised and action-aware motion patterns by distin- guishing the feature distributions via contrastive learning. A recent model named SocialVAE [Xu et al., 2022] uses a time- wise CVAE by applying CVAE with recurrent networks. We strongly recommend [Ivanovic et al., 2021] for a comprehen- sive review of CVAE in trajectory prediction. Normalising Flow (NF) GAN or CVAE-based models are difficult to train due to the implicit distribution modelling. Therefore, the NF-based MTP framework is proposed to ex- plicitly learn the data distribution through an invertible net- work shown in Fig. 3d, which can convert a complicated distribution into a tractable form via invertible transforma- tions. For example, HBAFlow [Bhattacharyya et al., 2021] uses a Haar wavelets based block autoregressive model that splits couplings to learn distributions for motion prediction while FloMo [Sch ̈oller and Knoll, 2021] utilises monotonic rational-quadratic splines for expressive and fast inversion. STGlow [Liang et al., 2022] proposes the generative flow with pattern normalisation to learn the motion behaviour con- ditioned on the representation of social interactions. How- ever, there is no NF-based model capable of handling discon- tinued manifolds. A plausible solution is to follow MG-GAN to use multiple invertible decoders. Denoise Defusion Probabilistic Model (DDPM) A new and interesting framework, motion indeterminacy diffusion (MID) [Gu et al., 2022] is proposed for predictions with It follows DDPM [Ho et al., 2020] controllable diversity. that the latent vector zK is sampled from Gaussian distribu- tions with controlled stochasticity via parameterised Markov Chain. The limitation is that this framework suffers from sig- nificant time consumption during the reverse diffusion pro- cess due to the required number of steps. 3.2 Anchor Conditioned MTP Framework To effectively guide the model to predict trajectories with controlled behaviours, it has been proposed that each predic- tion should be conditioned on a prior [Chai et al., 2020; Zhao et al., 2021], also named anchors, explicit to each modality. Well-known anchors include endpoints, the final locations the agent may arrive at, or prototype trajectories, the basic mo- tions the agent may follow. Ideally, using anchors can ef- fectively alleviate the mode collapse problem and encourage more robust and explainable predictions. We categorise the framework using anchors as anchor conditioned MTP frame- work. This framework usually contains two sub-tasks: (1) anchor selection, which selects K plausible anchors from an anchor set and; (2) waypoint decoding, which predicts way- points, the final prediction of future trajectory, based on the given anchor. The anchor selection can be performed via ran- dom sampling or top K ranking. Then the "best" anchor is selected to optimise the waypoint decoding during training as teacher force [Williams and Zipser, 1989]. In this section, we discuss two derivative frameworks named the predicted end- point conditioned (PEC) and prototype trajectory conditioned (PTC) framework that use endpoints and prototype trajecto- ries as anchors respectively. Predicted Endpoint Conditioned (PEC) Framework In- tuitively, agents can first decide the location they will arrive and then plan their future trajectories [Rehder and Kloeden, 2015]. This introduces the PEC framework where the end- points can be predicted as an anchor and waypoints are gener- ated to reach those positions. As shown in Fig. 3e, this frame- work firstly predicts the endpoint distribution via an endpoint decoder. Then, the waypoint decoder predicts the middle lo- cations given each selected endpoint. During training, the ground truth endpoint is selected so that the relationship be- tween predicted waypoints and the conditioned endpoint is enhanced. During testing, the endpoint is selected via random or top K sampling from a heatmap. The PEC framework is widely used in current trajectory prediction methods due to its simplicity and effectiveness. Mangalam et al. [2020] first introduced the PEC frame- work and propose PECNet, which uses a CVAE to generate multiple endpoints. Further methods suggest that models can achieve better performance if predictions can be controlled by scene-compliant endpoints. For example, TNT [Zhao et al., 2021] and DenseTNT [Gu et al., 2021] predict vehicles' endpoints by sampling positions on center lanes while YNet [Mangalam et al., 2021] and Goal-GAN [Dendorfer et al., 2020] directly predict an endpoint heatmap by integrating the observed trajectory and the scene segmentation image. Mean- while, ExpertTraj [Zhao and Wildes, 2021] suggests that end- points can be obtained with a training-free process by sam- pling from existing trajectory repositories with minimal dy- namic time-warping differences. Moreover, the PEC frame- work can help the long-term prediction by conditioning on the endpoint and middle waypoints [Mangalam et al., 2021; Wang et al., 2022]. Tran et al. [2021] estimate the destina- tion of the entire journey where the agent leaves the observed region to better control the future trajectory in a dynamic pre- diction horizon. Future PEC models can focus on avoiding unreachable endpoints due to the middle barrier and leverag- ing the multimodality of waypoints to the same endpoint. Prototype Trajectory Conditioned (PTC) Framework The anchor set of the PTC framework are prototype trajecto- ries, each one representing a modality and providing a basic motion that the waypoints should follow with necessary re- finement. As shown in Fig. 3f, the PTC framework learns to select the candidate prototype trajectories from the anchor set and predict their residuals to the ground truth via the resid- ual decoder during the waypoint decoding stage. To build the anchor set with sufficient diversity, prototypes can be col- lected by clustering trajectories in existing datasets using the k-means algorithm in MultiPath [Chai et al., 2020] and bag- ging using a greedy approximation algorithm in CoverNet [Phan-Minh et al., 2020]. Moreover, S-Anchor [Kothari et al., 2021] constructs the set with different levels of speeds and directions via a discrete choice model [Antonini et al., 2006] to integrate social interactions. SIT [Shi et al., 2022] builds a tree-like route map and dynamically selects and re- fines the path segments. Apparently, using prototype trajecto- ries can simplify the training and achieve diversity. However, current prototype trajectories are usually too simple to han- dle complex scenarios. Therefore, more advanced prototype trajectories can be explored in future works. 3.3 Grid-based MTP Framwork Grid-based MTP framework is an alternative way by employ- ing occupancy grid maps to indicate which location the agent will go to in the next time step. As shown in Fig. 3g, the scene is divided into grid cells and the model predicts the occupancy probability in each cell determined by observed information for each timestep. Multimodal predictions can be obtained by sampling exact decision for the next location via Gumbel- Softmax in TDOR [Guo et al., 2022] or beam search for tra- jectories with top K accumulated log probabilities in Multi- verse [Liang et al., 2020] and ST-MR [Li et al., 2022]. The main benefit of the grid-based framwork is that they can be highly compliant with scenes with advanced training strate- gies such as reinforcement learning or occupancy losses and are suitable for long-term prediction. However, it is rarely used due to significant computation from the convolutional operations and high sensitivity to the resolution of the maps. 3.4 Bivariate Gaussian for Outputs Representation Instead of regressing the exact 2D coordinates, some models hypothesise a bi-variate Gaussian distribution of locations at each time step. The objective of these models is to maximise the likelihood of ground truth in the predicted distribution via negative log-likelihood loss. This strategy was first used in S-LSTM [Alahi et al., 2016] for deterministic prediction but was depreciated by GAN-based models due to its non- differentiable position sampling. Then, it is reused in Social- STGCNN [Mohamed et al., 2020] and [Shi et al., 2021] for MTP where multiple trajectories can be obtained by sampling K futures positions from the predicted distributions. However, the output positions are sampled individually and may not be temporally correlated, causing unrealistic predic- tions. One solution is to integrate it with recurrent neural net- works to generate diverse predictions as a special grid-based framework. It can also be combined with anchor-based MTP frameworks to avoid the expectation-maximisation training procedure and visualise the uncertainties under each time step for better optimisation [Chai et al., 2020]. 3.5 Other Techniques for Improved MTP Advanced Discriminators Advanced discriminators in GAN-based models have been proposed to improve the qual- ity of generated trajectories. For example, Parth and Alexan- dre [2019] and Huang et al. [2020] propose improved dis- criminators to simplify the adversarial training for recurrent neural networks. SC-GAN [Wang et al., 2020] enhances the discriminator to check scene compliance using differentiable rasterised maps and scene images while some methods pro- pose an improved discriminator to ensure social acceptance [Kothari and Alahi, 2022; van der Heiden et al., 2019]. Advanced Sampling Tricks Random sampling from an MTP model may not cover all modes due to limited sampling numbers. Therefore, advanced sampling tricks are proposed to ensure the coverage of the distribution. For example, Ma et al. [2021] propose post-hoc methods named Likelihood Di- verse Sampling (LDS) to enhance the quality and diversity for flow-based methods by training a sampling model by balanc- ing the likelihood of an individual trajectory and the spatial separation among trajectories and can also be adapted to other frameworks. Mangalam et al. [2021] propose the Test Time Sampling Trick to cluster sampled endpoints into K centres for wider coverage of predicted endpoints. Bae et al. [2022] propose the Non-Probability Sampling Network via a Quasi- Monte Carlo method to generate non-biased samples. 4 Datasets and Benchmarks for MTP Datasets and Benchmarks for Trajectory Prediction Ex- isting widely used benchmarks for both MTP and DTP include ETH & UCY [Lerner et al., 2007] and Stanford Drone Dataset [Robicquet et al., 2016] for pedestrians and NuScenes [Caesar et al., 2020], Argoverse [Chang et al., 2019] and Waymo [Ettinger et al., 2021] for vehicles. Each provides annotated trajectories and the environment informa- tion presented by videos, reference images or high-definition (HD) maps. Synthetic Dataset for Toy Experiments The distribution of trajectories in each dataset is implicit and hence it is hard to evaluate whether the model correctly fits the distribution. Therefore, synthetic datasets have been proposed with simple and controllable distributions for evaluation. For example, Amirian et al. [2019] propose a toy dataset with six groups of trajectories, each group starting from one specific point and following three different ways to the endpoint. Chai et al. [2020] propose a 3-way intersection toy dataset with the probability of choosing the left, middle or right path set. Ex- periments using these datasets highlight the mode collapse problem and socially-acceptance in current frameworks. ForkingPath: A Special Benchmark for MTP Liang et al. [2020] suggest that current trajectory prediction bench- marks all share the same problem that only one possible ground truth trajectory is provided for each agent, which is not suitable for MTP evaluation. To tackle this problem, they propose the ForkingPath dataset that provides multiple human-annotated ground truth trajectories for each agent so that ground truth distribution is visible. Further studies [Den- dorfer et al., 2021; Ma et al., 2021] also use it to compare the predicted and ground truth distributions. 5 Evaluation Metrics In DTP, the default evaluation metrics are average displace- ment error (ADE) and final displacement error (FDE), which measure the l2 distances to ground truth trajectories through all future timesteps and the last future timestep respectively. In addition, there are multiple metrics examining social ac- ceptance such as collision rate, overlap rate and offroad rate which measure whether the predicted trajectory of the agent collides with surrounding agents or enters inaccessible re- gions. Evaluation metrics for MTP need to take all predic- tions into consideration and thus are more challenging. In this section, we review these MTP metrics summarised by the taxonomy in Fig. 4 and their challenges. 5.1 Lower-bound-based MTP Metrics Lower-bound-based MTP metrics are simple and widely used in MTP. Given K predicted trajectories, each prediction is compared with the ground truth and the best score is recorded without considering the exact confidence. Therefore, these metrics can be simply converted from those for DTP and are valid for any models in trajectory prediction. Minimum-of-N (MoN) MoN is first proposed in [Gupta et al., 2018] and is the default metric for most MTP works. It calculates the minimum error among all predictions: M oN = Ei,t∈τ min k<K DE( ˆY t i,k, Y t i ) (2) where DE can be any distance metrics used in DTP. Many works adopt this strategy to adapt ADE and FDE for multi- modal prediction, abbreviated as minADEK and minFDEK Lower-Bound based Metrics Minimum of N (MoN) minADEK ; minF DEK Missing Rate (MR) MR in Argoverse [Chang et al., 2019]; Waymo [Ettinger et al., 2021]; NuScenes [Caesar et al., 2020] Most-Likely (ML) ML + ADE/FDE [Chen et al., 2021]; ML + Overlap Rate [Ettinger et al., 2021]; mAP/Soft mAP [Ettinger et al., 2021] Probability-aware Metrics TopK PCMD [Chen et al., 2021]; MoN + Sampling Tricks Evaluation Metrics Gaussian-based Metrics KDE-NLL [Ivanovic and Pavone, 2019]; AMD/AMV [Mohamed et al., 2022] Distribution-aware Metrics Coverage EMD [Amirian et al., 2019]; Precision & Recall [Dendorfer et al., 2021]; PTU [Li et al., 2022] Figure 4: An overview of the taxonomy of MTP evaluation metrics. and they become the default metrics in all multimodal trajec- tory prediction methods and benchmarks. Miss Rate (MR) Some vehicle trajectory prediction bench- marks such as Waymo, Argoverse and nuScenes use MR to indicate whether the ground truth can be covered by the pre- dictions. A prediction misses the ground truth if it is more than d meters from the ground truth according to their dis- placement error and hits otherwise. MR counts the scenarios that all predictions miss the ground truth: M R = Ei,t∈τ sign((min k<K DE( ˆY t i,k, Y t i )) − d) (3) where FDE is used as the displacement metric in Argoverse and Waymo benchmarks and ADE is used in NuScenes. The distance threshold d is 2 meters in Argoverse and NuScenes and is adjusted with speed in Waymo benchmark. Challenge: Information Leak Lower-bound-based metrics are sensitive to randomisation and are insufficient indicators of the performance of mod- els. Information leaks happen during the testing since only the best prediction is used for evaluation based on the dis- tances to the ground truth. This allows a distribution with high entropy for a lower error. For example, the constant ve- locity model (CVM) [Sch ̈oller et al., 2020] may even "out- perform" deep learning-based models by adjusting the angles for a wider spread distribution. This further results in an unre- liable indication of interaction handling. For example, a pre- diction that violates the social rules can be generated from a DTP model without social interaction modules and neglected in MTP since the best one is selected. 5.2 Probability-aware MTP Metrics Probability-aware metrics measure how likely the ground truth can be sampled from the predicted distribution. In con- trast to lower-bound metrics, MTP models are required to as- sign the highest probability to the best prediction. Most-likely (ML) based Metrics The simplest way is to select the prediction with the highest probability to perform the DTP evaluation. For example, the ML metric [Chen et al., 2021] simply selects the most likely prediction for ADE and FDE calculation, as well as the overlap rate calculation in the Waymo benchmark. Similarly, the mean average pre- cision (mAP) is used in the Waymo benchmark [Ettinger et al., 2021]. The most likely prediction is considered a true positive if it aligns with the ground truth; otherwise, it is a false positive. All other predictions are assigned a false pos- itive. Then, it computes the area under the precision-recall curve. From 2022, Waymo benchmark uses Soft mAP, which is the same as mAP except that it ignores the penalty from the predictions other than the most likely one. TopK based Metrics Chen et al. [2021] suggest that one prediction cannot represent the whole distribution. There- fore, we can select candidates with a probability larger than a threshold γ among M (cid:29) K predictions for MoN evalua- tion, known as the probability cumulative minimum distance (PCMD): PCMD = M oN ( ˆYi,k|P( ˆYi,k(cid:48)|X T i , k(cid:48) < M ) ≥ γ) (4) Then, predictions with top K probabilities are selected. How- ever, it cannot be used if the probability of each prediction is not provided. To tackle that, we can select K predictions us- ing sampling tricks in Sec. 3.5. Gaussian based Metrics If no probability is provided, an alternative method is to first estimate a Gaussian distribution given K discrete predictions using a method such as kernel density estimation (KDE), by estimating the probability den- sity function given a sequence of independent random vari- ables. In trajectory prediction, [Ivanovic and Pavone, 2019] firstly introduces KDE-NLL as one of the evaluation met- rics in MTP, which computes the mean log-likelihood of the ground truth trajectory for each future timestep: i |KDE( ˆY t KDE-NLL = −Ei,t∈τ log P(Y t i,K)), (5) and is further used in subsequent studies such as [Man- galam et al., 2020, 2021]. Mohamed et al. [2022] fur- ther improves KDE-NLL by proposing Average Mahalanobis Distance (AMD), which measures the distance between the ground truth and the generated distribution, and Average Maximum Eigenvalue (AMV) to measure the confidence of the predictions. Challenge: Ground Truth May Not Be Most Likely Probability-aware metrics hypothesise that ground truth is ex- pected to be sampled with the highest probability. However, datasets are noisy and the predictions can be more reasonable than the ground truth based on observed clues and thus should not be penalised. For example, if an agent has a behaviour such as "zig zag" in pedestrian datasets and "sudden cut in" in vehicle datasets, how likely should this behaviour happen? In these cases, we believe that lower-bound based metrics are more suitable. 5.3 Distribution-aware Metric None of the metrics above penalises the unacceptable predic- tions that are outside the ground truth distribution. The main barrier is that only one ground truth is provided and its dis- tribution cannot be estimated. To address this issue, datasets such as ForkingPath provide multiple ground truth trajecto- ries for each agent so that we can directly evaluate the cover- age of the predicted and ground truth distributions. Coverage-based Metrics Amirian et al. [2019] propose the earth-moving distance (EMD) by calculating the ADE results with linear sum assignment between predicted and ground truth samples. Dendorfer et al. [2021] propose the recall and precision metrics for generative networks to measure the cov- erage. Given the predicted and real future trajectory set, re- call counts how many predicted trajectories can find a ground truth trajectory that lies inside a certain range d. Recall = Ek<KG( min k(cid:48)<KR || ˆY t i,k − Y t i,k(cid:48)||2) < d (6) where KG is the number of predictions and KR is the num- ber of annotated ground truths for agent i. In other words, the predicted distribution should cover all ground truth trajecto- ries. On the other hand, the precision, also named Pecentage of Trajectory Usage (PTU) in [Li et al., 2022], calculates the ratio of generated samples in the support of the ground truth distribution and penalise out-of-distribution predictions: P recision = Ek<KR ( min k(cid:48)<KG ||Y t i,k − ˆY t i,k(cid:48)||2) < d (7) Challenge: Heavy Labour Effort Apparently, distribution-aware metrics require extra annota- tions and corrections by human experts on real-world datasets which is labour intensive. In addition, even human annotation cannot guarantee the coverage of all modalities. Although synthetic datasets can alleviate this problem, they can only evaluate simple and unrealistic interactions. Therefore, these metrics are not used in most benchmarks. 6 Conclusions and Future Directions In this survey, we provide a comprehensive review for MTP with our taxonomies of frameworks, datasets and evaluation metrics. Deep analysis and discussions are provided regard- ing their benefits and problems. Finally, we suggest several directions for future research as follows: Better Evaluation Metrics Evaluation metrics are impor- tant to guide the design of the model architecture and loss functions. Unfortunately, current metrics described in Sec. 5 either neglect unacceptable predictions or are constrained by the datasets and frameworks. Therefore, it is essential to pro- pose more comprehensive evaluation metrics which can cor- rectly indicate the performance of MTP models without being constrained on datasets or frameworks. Motion Planning using Multimodal Predictions We be- lieve that MTP will be finally used for downstream tasks such as motion planning and control in autonomous systems. The planning model can provide safe and collision-free routes based on trajectory predictions with diverse modalities. How- ever, to our knowledge, motion planning and MTP are cur- rently developed independently. To connect these two fields, we first suggest exploring MTP-aware motion planning mod- els that can benefit from multimodal predictions. Then, the performance of these models can be used as an evaluation metric and planning-aware MTP models can be investigated to help motion planning models achieve better results. Language Guided Explainable MTP To build a trustable and safe autonomous system, it is essential to build explain- able MTP frameworks that provide human-understandable decision-making for multimodal predictions. Currently, most MTP frameworks provide multiple predictions without ex- plaining their decisions [Kothari et al., 2021]. Although the anchor-based MTP framework alleviates this problem by con- trolling the modality of each prediction using anchors, they are far from being explainable. Recently, Xue and Salim [2022] have proposed a new prompt-based learning paradigm named PromptCast, sug- gesting that human language can be a prompt to guide time series forecasting with the form of questioning and answer- ing. We hence suggest a language-guided MTP framework can be a plausible solution for explainable MTP. We believe that language can be used as prompts to guide predictions with complex modalities and to provide human-readable ex- planations for predicted future trajectories. Lightweight MTP Frameworks It is also beneficial to pre- dict trajectories with a longer horizon which requires a larger K to cover all modalities. Moreover, some trajectory predic- tion models such as YNet [Mangalam et al., 2021] use convo- lutional decoders to generate heatmaps and encourage scene- compliant predictions. However, decoders in MTP frame- works are executed repeatedly as shown in Fig. 3 which re- sults in excessive time and memory consumption. Therefore, exploring the lightweight MTP frameworks can benefit real- time autonomous systems. MTP with Out-of-distribution (OOD) Modalities Pre- dictions from current MTP models are expected to match ex- isting modalities in the dataset and hence the datasets are re- quired to cover all kinds of modalities. It is challenging to predict OOD modalities especially when the dataset is biased and thus is not robust in an unseen environment. It will be interesting to propose a generalised framework to tackle this problem. Future directions can be building more comprehen- sive datasets or considering approaches for the OOD problem in domain generalisation to help tackle this problem. Urban-wide MTP Current MTP focuses on the future movement over short distances. However, we believe it can be extended to an urban-wide location prediction: human mo- bility prediction (HMP), which is to predict the next place- of-interest (POI) based on previous locations and rich con- text information such as the semantics of locations. HMP is naturally multimodal since multiple POIs are acceptable with different uncertainties and hence the advances in MTP can be applied on it as well. Besides, MobTCast [Xue et al., 2021] uses DTP to enhance the geographical contextual for HMP. Therefore, we believe that MTP can be an even stronger aux- iliary task to consider the uncertainty of future POIs. References Alexandre Alahi, Kratarth Goel, Vignesh Ramanathan, Alexandre Robicquet, Li Fei-Fei, and Silvio Savarese. Social LSTM: Human Trajectory Prediction in Crowded Spaces. In CVPR, pages 961–971, 2016. Javad Amirian, Jean-Bernard Hayet, and Julien Pettre. Social Ways: Learning Multi-Modal Distributions of Pedestrian Trajectories With GANs. In CVPR Workshops, 2019. Gianluca Antonini, Michel Bierlaire, and Mats Weber. Dis- crete choice models of pedestrian walking behavior. TR B, pages 667–687, 2006. Inhwan Bae, Jin-Hwi Park, and Hae-Gon Jeon. Non- probability sampling network for stochastic human trajec- tory prediction. In CVPR, pages 6477–6487, 2022. Apratim Bhattacharyya, Christoph-Nikolas Straehle, Mario Fritz, and Bernt Schiele. Haar Wavelet based Block Au- In DAGM GCPR, toregressive Flows for Trajectories. pages 275–288, 2021. Holger Caesar, Varun Bankiti, Alex H. Lang, Sourabh Vora, et al. NuScenes: A Multimodal Dataset for Autonomous Driving. In CVPR, pages 11621–11631, 2020. Yuning Chai, Benjamin Sapp, Mayank Bansal, and Dragomir Anguelov. MultiPath: Multiple Probabilistic Anchor Tra- In CoRL, jectory Hypotheses for Behavior Prediction. pages 86–99, 2020. Ming-Fang Chang, John Lambert, Patsorn Sangkloy, Jagjeet Singh, Slawomir Bak, et al. Argoverse: 3D Tracking and Forecasting With Rich Maps. In CVPR, 2019. Guangyi Chen, Junlong Li, Nuoxing Zhou, Liangliang Ren, and Jiwen Lu. Personalized trajectory prediction via dis- In ICCV, pages 15580–15589, tribution discrimination. 2021. Patrick Dendorfer, Aljosa Osep, and Laura Leal-Taixe. Goal- GAN: Multimodal Trajectory Prediction Based on Goal Position Estimation. In ACCV, 2020. Patrick Dendorfer, Sven Elflein, and Laura Leal-Taix ́e. MG-GAN: A Multi-Generator Model Preventing Out-of- Distribution Samples in Pedestrian Trajectory Prediction. In ICCV, pages 13158–13167, 2021. Scott Ettinger, Shuyang Cheng, Benjamin Caine, Chenxi Liu, Hang Zhao, et al. Large Scale Interactive Motion Forecast- ing for Autonomous Driving: The Waymo Open Motion Dataset. In ICCV, pages 9710–9719, 2021. Jiyang Gao, Chen Sun, Hang Zhao, Yi Shen, Dragomir Anguelov, et al. Vectornet: Encoding HD maps and Agent In CVPR, Dynamics from Vectorized Representation. pages 11525–11533, 2020. Junru Gu, Chen Sun, and Hang Zhao. DenseTNT: End-to- end trajectory prediction from dense goal sets. In ICCV, pages 15303–15312, 2021. Tianpei Gu, Guangyi Chen, Junlong Li, Chunze Lin, Yong- ming Rao, Jie Zhou, and Jiwen Lu. Stochastic trajectory prediction via motion indeterminacy diffusion. In CVPR, pages 17113–17122, 2022. Ke Guo, Wenxi Liu, and Jia Pan. End-to-End Trajectory Dis- tribution Prediction Based on Occupancy Grid Maps. In CVPR, pages 2242–2251, 2022. Agrim Gupta, Justin Johnson, Li Fei-Fei, Silvio Savarese, and Alexandre Alahi. Social GAN: Socially Acceptable Tra- jectories with Generative Adversarial Networks. In CVPR, pages 2255–2264, 2018. Marah Halawa, Olaf Hellwich, and Pia Bideau. Action-based In ECCV, contrastive learning for trajectory prediction. pages 143–159, 2022. Helbing and Moln ́ar. Social Force Model for Pedestrian Dy- namics. Physical Review E, pages 4282–4286, 1995. Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffu- sion probabilistic models. NeurIPS, 33:6840–6851, 2020. Yingfan Huang, Huikun Bi, Zhaoxin Li, Tianlu Mao, and Zhaoqi Wang. STGAT: Modeling spatial-temporal inter- In ICCV, pages actions for human trajectory prediction. 6272–6281, 2019. Renhao Huang, Yang Song, and Maurice Pagnucco. An Im- proved Discriminator for GAN-Based Trajectory Predic- tion Models. In DICTA, pages 1–3, 2020. B. Ivanovic and Marco Pavone. The Trajectron: Probabilis- tic Multi-Agent Trajectory Modeling With Dynamic Spa- tiotemporal Graphs. ICCV, pages 2375–2384, 2019. B. Ivanovic, Karen Leung, Edward Schmerling, and Marco Pavone. Multimodal Deep Generative Models for Trajec- tory Prediction: A Conditional Variational Autoencoder Approach. RA-L, 6:295–302, 2021. Vineet Kosaraju, Amir Sadeghian, Roberto Mart ́ın-Mart ́ın, Ian D. Reid, et al. Social-BiGAT: Multimodal Trajectory Forecasting using Bicycle-GAN and Graph Attention Net- works. In NeurIPS, 2019. Parth Kothari and Alexandre Alahi. Safety-compliant genera- tive adversarial networks for human trajectory forecasting. arXiv preprint arXiv:2209.12243, 2022. Parth Kothari, Brian Sifringer, and Alexandre Alahi. Inter- pretable Social Anchors for Human Trajectory Forecasting in Crowds. In CVPR, pages 15556–15566, 2021. Namhoon Lee, Wongun Choi, Paul Vernaza, Christopher B Choy, Philip HS Torr, and Manmohan Chandraker. Desire: Distant future prediction in dynamic scenes with interact- ing agents. In CVPR, pages 336–345, 2017. Alon Lerner, Yiorgos Chrysanthou, and Dani Lischinski. Crowds by Example. Comput. Graph. Forum, pages 655– 664, 2007. Lihuan Li, Maurice Pagnucco, and Yang Song. Graph-Based Spatial Transformer With Memory Replay for Multi- Future Pedestrian Trajectory Prediction. In CVPR, pages 2231–2241, 2022. Junwei Liang, Lu Jiang, Kevin Murphy, Ting Yu, and Alexan- der Hauptmann. The Garden of Forking Paths: Towards Multi-Future Trajectory Prediction, 2020. Rongqin Liang, Yuanman Li, Jiantao Zhou, and Xia Li. STGlow: A Flow-based Generative Framework with Dual Graphormer for Pedestrian Trajectory Prediction. ArXiv, 2022. Yecheng Jason Ma, Jeevana Priya Inala, Dinesh Jayaraman, and Osbert Bastani. Likelihood-based diverse sampling for trajectory forecasting. In ICCV, pages 13279–13288, 2021. Karttikeya Mangalam, Harshayu Girase, Shreyas Agarwal, Kuan-Hui Lee, Ehsan Adeli, et al. It is Not the Journey but the Destination: Endpoint Conditioned Trajectory Pre- diction. In ECCV, pages 759–776, 2020. Karttikeya Mangalam, Yang An, Harshayu Girase, and Jiten- dra Malik. From Goals, Waypoints & Paths to Long Term In ICCV, pages 15233– Human Trajectory Forecasting. 15242, 2021. Abduallah Mohamed, Kun Qian, Mohamed Elhoseiny, and Christian Claudel. Social-STGCNN: A Social Spatio- Temporal Graph Convolutional Neural Network for Hu- man Trajectory Prediction. In CVPR, pages 14424–14432, 2020. Abduallah Mohamed, Deyao Zhu, Warren Vu, et al. Social- Implicit: Rethinking Trajectory Prediction Evaluation and The Effectiveness of Implicit Maximum Likelihood Esti- mation. In ECCV, pages 463–479, 2022. Kothari Parth and Alahi Alexandre. Adversarial loss for hu- man trajectory prediction. In hEART, 2019. Tung Phan-Minh, Elena Corina Grigore, Freddy A. Boul- ton, Oscar Beijbom, and Eric M. Wolff. CoverNet: Mul- timodal Behavior Prediction Using Trajectory Sets. In CVPR, pages 14062–14071, 2020. Eike Rehder and Horst Kloeden. Goal-directed pedestrian prediction. In ICCV Workshops, pages 50–58, 2015. Alexandre Robicquet, Amir Sadeghian, Alexandre Alahi, and Silvio Savarese. Learning social etiquette: Human trajec- In ECCV, pages tory understanding in crowded scenes. 549–565, 2016. Andrey Rudenko, Luigi Palmieri, Michael Herman, Kris M Kitani, Dariu M Gavrila, and Kai O Arras. Human Motion IJRR, pages 895–935, Trajectory Prediction: A Survey. 2020. Amir Sadeghian, Vineet Kosaraju, Ali Sadeghian, Noriaki Hirose, Hamid Rezatofighi, and Silvio Savarese. SoPhie: An Attentive GAN for Predicting Paths Compliant to So- cial and Physical Constraints. In CVPR, pages 1349–1358, 2019. Christoph Sch ̈oller and Alois Knoll. Flomo: Tractable motion prediction with normalizing flows. In IROS, pages 7977– 7984, 2021. Christoph Sch ̈oller, Vincent Aravantinos, Florian Samuel Lay, and Alois Knoll. What the Constant Velocity Model Can Teach Us About Pedestrian Motion Prediction. RA-L, pages 1696–1703, 2020. Liushuai Shi, Le Wang, Chengjiang Long, Sanping Zhou, Mo Zhou, et al. Sparse Graph Convolution Network for Pedestrian Trajectory Prediction. In CVPR, pages 8994– 9003, 2021. Liushuai Shi, Le Wang, Chengjiang Long, Sanping Zhou, Fang Zheng, Nanning Zheng, and Gang Hua. Social In- terpretable Tree for Pedestrian Trajectory Prediction. In AAAI, pages 2235–2243, 2022. Kihyuk Sohn, Honglak Lee, and Xinchen Yan. Learning Structured Output Representation using Deep Conditional Generative Models. In NeurIPS, 2015. Izzeddin Teeti, Salman Khan, Ajmal Shahbaz, Andrew Bradley, and Fabio Cuzzolin. Vision-based Intention and Trajectory Prediction in Autonomous Vehicles: A Survey. In IJCAI, pages 5630–5637, 2022. Luca Anthony Thiede and Pratik Prabhanjan Brahma. Ana- lyzing the variety loss in the context of probabilistic trajec- tory prediction. ICCV, pages 9953–9962, 2019. Hung Tran, Vuong Le, and Truyen Tran. Goal-driven long- term trajectory prediction. In WACV, pages 796–805, 2021. Tessa van der Heiden, Naveen Shankar Nagaraja, Christian Weiss, and Efstratios Gavves. SafeCritic: Collision-Aware Trajectory Prediction. ArXiv, 2019. Eason Wang, Henggang Cui, Sai Yalamanchi, et al. Improv- ing movement predictions of traffic actors in bird's-eye view models using gans and differentiable trajectory ras- terization. In KDD, pages 2340–2348, 2020. Chuhua Wang, Yuchen Wang, Mingze Xu, and David J. Cran- dall. Stepwise goal-driven networks for trajectory predic- tion. ICRA, 2022. Ronald J. Williams and David Zipser. A Learning Algorithm for Continually Running Fully Recurrent Neural Networks. Neural Computation, pages 270–280, 1989. Pei Xu, Jean-Bernard Hayet, and Ioannis Karamouzas. So- cialVAE: Human Trajectory Prediction using Timewise Latents. In ECCV, 2022. Hao Xue and Flora Salim. Promptcast: A new prompt-based learning paradigm for time series forecasting. 2022. Hao Xue, Du Q. Huynh, and Mark Reynolds. SS-LSTM: A Hierarchical LSTM Model for Pedestrian Trajectory Pre- diction. In WACV, pages 1186–1194, 2018. Hao Xue, Flora Salim, Yongli Ren, and Nuria Oliver. MobT- Cast: Leveraging Auxiliary Trajectory Forecasting for Hu- man Mobility Prediction. NeurIPS, pages 30380–30391, 2021. Ye Yuan, Xinshuo Weng, Yanglan Ou, and Kris Ki- tani. Agentformer: Agent-aware transformers for socio- temporal multi-agent forecasting. In ICCV, pages 9813– 9823, 2021. He Zhao and Richard P. Wildes. Where Are You Heading? Dynamic Trajectory Prediction With Expert Goal Exam- ples. In ICCV, pages 7629–7638, 2021. Hang Zhao, Jiyang Gao, Tian Lan, Chen Sun, Ben Sapp, Bal- akrishnan Varadarajan, Yue Shen, et al. TNT: Target-driven Trajectory Prediction. In CoRL, pages 895–904, 2021.
http://arxiv.org/abs/2302.10454v2
2023-02-22T21:19:54
2023-02-21T05:42:06
KG-ECO: Knowledge Graph Enhanced Entity Correction for Query Rewriting
Query Rewriting (QR) plays a critical role in large-scale dialogue systems for reducing frictions. When there is an entity error, it imposes extra challenges for a dialogue system to produce satisfactory responses. In this work, we propose KG-ECO: Knowledge Graph enhanced Entity COrrection for query rewriting, an entity correction system with corrupt entity span detection and entity retrieval/re-ranking functionalities. To boost the model performance, we incorporate Knowledge Graph (KG) to provide entity structural information (neighboring entities encoded by graph neural networks) and textual information (KG entity descriptions encoded by RoBERTa). Experimental results show that our approach yields a clear performance gain over two baselines: utterance level QR and entity correction without utilizing KG information. The proposed system is particularly effective for few-shot learning cases where target entities are rarely seen in training or there is a KG relation between the target entity and other contextual entities in the query.
[ "Jinglun Cai", "Mingda Li", "Ziyan Jiang", "Eunah Cho", "Zheng Chen", "Yang Liu", "Xing Fan", "Chenlei Guo" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10454v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10454v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.CL", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.CL", "cs.LG" ]
KG-ECO: KNOWLEDGE GRAPH ENHANCED ENTITY CORRECTION FOR QUERY REWRITING Jinglun Cai*, Mingda Li, Ziyan Jiang, Eunah Cho, Zheng Chen, Yang Liu, Xing Fan, Chenlei Guo Amazon.com, Inc. USA 3 2 0 2 b e F 2 2 ] L C . s c [ 2 v 4 5 4 0 1 . 2 0 3 2 : v i X r a ABSTRACT Query Rewriting (QR) plays a critical role in large-scale dialogue systems for reducing frictions. When there is an en- tity error, it imposes extra challenges for a dialogue system to produce satisfactory responses. In this work, we propose KG-ECO: Knowledge Graph enhanced Entity COrrection for query rewriting, an entity correction system with corrupt entity span detection and entity retrieval/re-ranking functionalities.To boost the model performance, we incorporate Knowledge Graph (KG) to provide entity structural information (neigh- boring entities encoded by graph neural networks) and textual information (KG entity descriptions encoded by RoBERTa). Experimental results show that our approach yields a clear performance gain over two baselines: utterance level QR and entity correction without utilizing KG information. The pro- posed system is particularly effective for few-shot learning cases where target entities are rarely seen in training or there is a KG relation between the target entity and other contextual entities in the query. Index Terms- Query rewriting, knowledge graph, entity correction, graph neural network, few-shot learning entity correction task. Typical functionalities for a conver- sational AI include playing music, playing videos, reading books and weather forecast. We found Wikidata can cover most common entities in user queries such as celebrity names, artwork names, media names and locations. In this work, we introduce a two-layer approach: retrieval (L1), and re-ranking + span detection (L2). In the second layer we jointly re-rank the entity candidates and detect whether and where a corrupt/erroneous entity span exists in the query. The span detection task is critical for ensuring the flexibility of the QR system, as we do not assume any upstream Natural Language Understanding (NLU) or Named-entity recognition (NER) module providing entity candidates. In both L1 and L2, we incorporate the KG text description of entities, and leverage the Graph Attention Network (GAT) [1] to encode the KG structural information. Evaluations are conducted on a friction set and a clean set, representing different scenarios of real-world applications. The effectiveness of our system is demonstrated by a clear performance gain over two baselines: an utterance level QR system (gUFS-QR) [2] and an entity correction QR system without KG information. 1. INTRODUCTION 2. RELATED WORK Large-scale conversational AI based dialogue systems like Alexa, Siri, and Google Assistant, serve millions of users on a daily basis. Inevitably, some user queries result in frictions or errors. Such frictions may originate from either the dialogue system itself, or user ambiguity. Query Rewriting (QR) aims to automatically rephrase a user query into another form. For instance, the upstream module in a dialogue system may pro- duce a query with a wrong song name: "play bad boy dance by lady gaga". The QR system should rewrite the utterance into "play bad romance by lady gaga". In query rewriting, corrupt entity correction1 can be chal- lenging when we have no knowledge about the entities and limited context information. To address this, we utilize an external knowledge graph, namely Wikidata2, to facilitate the *This work was completed while the first author was an intern at Amazon. 1We focus on entity correction for textual inputs. Various related terms are used in literature, including entity retrieval / resolution / understanding with noisy input. 2https://www.wikidata.org Existing efforts treat QR as text generation problem[3] or retrieval problem[2, 4, 5, 6]. Entities have been shown to be a strong indicator of text semantics and be critical to QR task[6]. With particular emphasis on entities, we can also easily leverage Knowledge Graphs (KG), which provides rich information about entities. Our work is the first effort to utilize KG information in the QR task. Our work is also closely related to two entity-level tasks: entity correction and entity linking. Entity correction [7, 8, 9, 10] aims to tackle errors occurring in Automatic Speech Recognition (ASR) systems. These studies adopt an "entity- to-entity" approach for entity correction, however, we take the query as context, and perform contextualized entity correction. Meanwhile, we do not assume we know the location of the corrupt entity if it exists. Thus we perform entity span detec- tion jointly with entity re-ranking. Entity linking [11, 12] is another similar task which aims to link mentioned entities with their corresponding entities in a knowledge base. Our work is more challenging because the input utterance is noisy with Fig. 1. KG-ECO System Overview. The input query "play bad boy dance by lady gaga" is the output from upstream ASR system which contains one corrupt entity "bad boy dance". Our KG-ECO system, which has a two-stage architecture, predicts the correct entity "bad romance" together with the span of corrupt entity. The final rewrite is produced through a textual replacement. KG information is utilized by our system. incorrect entities. 3. KG-ECO Our Knowledge Graph enhanced Entity COrrection system (KG-ECO) consists of two layers: retrieval (L1) and re-ranking + span detection (L2), as illustrated in Figure 1. For each utter- ance, we efficiently retrieve top-K relevant entities3 encoded by the L1 model (a bi-encoder model) from the entity index. Then, the L2 model (a cross encoder model) re-ranks the top- K retrieved candidates, and detects a corrupt span (possibly empty) from the input utterance. Finally, under optimized triggering conditions, the top ranked entity will be used for rewriting via a textual replacement. 3.1. L1 Retrieval For the L1 retrieval model, we adopt a bi-encoder architecture, which comprises an utterance encoder and an entity encoder. The utterance encoder Eutt is a RoBERTa based model, accept- ing the source utterance as the input. The entity encoder Eent consists of a RoBERTa based "Entity Description" encoder, and a GAT encoder, which consumes one-hop subgraphs as its input, described in details later. The relevance between an utterance p and an entity q is defined by their dot product similarity: sim(p, q) = Eutt(p)T * Eent(q) (1) 3In this work, we retrieve and re-rank entities in surface form (the textual name of an entity), as the resolved entity labels are NOT available in query rewriting data. In case of polysemy (one surface form corresponds to multiple KG entities), we incorporate multiple entities into the input. Training. We utilize Negative Log-Likelihood (NLL) as the loss function in training such that relevant utterance and entity pairs will have higher dot product similarity than nega- tive pairs. Positive entities (ground truth) were specified when data sets were constructed. To obtain negative entities, we used two approaches: in-batch negatives and hard negatives. In-batch negatives are the other entities in the same training batch that are not positive. In this way, we efficiently utilize the computation of entity embeddings for an entire batch. For hard negatives, we follow [13] and [14] to use hard negative entities in retrieval training. For instance, the positive entity "carson city" has its hard negative "corbin city". This helps the retrieval layer to distinguish an entity from its highly similar competitors in the entity index. Inference. After training, we first produce entity embed- dings using the entity encoder, and build an index via FAISS [15], a scalable similarity search framework for dense vectors. In inference, given an utterance, we obtain its embedding and conduct FAISS search from the index to retrieve the top-K most similar entities in terms of dot product. These top-K entities are candidates for the next stage. 3.2. L2 Re-ranking + Span Detection The L2 architecture consists of a RoBERTa based cross en- coder and a GAT encoder. The cross encoder consumes both the utterance and the entity and its description as input. The L2 layer is a joint learning model with two learning tasks: re-ranking and span detection. For re-ranking, given a pair of utterance and entity, we con- catenate the output vector of CLS token of RoBERTa and the pooling output vector of GAT, and pass them to an MLP layer to produce the relevance score of the pair. For corrupt entity span detection, we predict the span's start and end positions at the token level, following similar approaches such as in [16] and [17]. Specifically, assume WS and WE are the start and the end vector respectively, and Ti ∈ RH is the final hidden vector for the ith input token, then the score of a candidate span from position i to position j is computed as: h(cid:48) i = σ(Σ(r,j)∈Ni αijWnodeφ(hr, hj)) (5) Meanwhile, the relation embedding hr is also updated via r = Wrelhr. a dedicated MLP layer: h(cid:48) 4. EXPERIMENTS sij = WS * Ti + WE * Tj (2) 4.1. Data In addition, we introduce a special case: a null span, which means that no corrupt entity exists. This happens when i = j = 0, i.e., the start and end tokens are both the CLS token of RoBERTa. We select a threshold θ for null prediction, by balancing the precision and false trigger rate. 3.3. KG Enhanced Component: Entity Description KG provides short textual descriptions of entities. We use these to augment the textual input: we concatenate an entity and its descriptions, separated by special token [des]. For example, entity "bad romance" is polysemic, corresponding to two KG entities, a song and a film. We concatenate both descriptions to obtain the input "bad romance [des] song [des] 2011 film". The description "song", will help the system to learn the relevance between utterance "play bad boy dance by lady gaga" and entity "bad romance". 3.4. KG Enhanced Component: GAT We incorporate Graph Attention Network (GAT) [1], a state-of- the-art Graph Neural Network architecture, as a component in both L1 and L2 modules. Assume (h0, ..., hn) is a sequence of graph node embeddings. A GAT layer outputs a transformed sequence (h(cid:48) n). Assume Ni is the neighborhood of node i. 0, ..., h(cid:48) αij = exp(LeakyReLU(aT [W hi||W hj])) Σk∈Ni exp(LeakyReLU(aT [W hi||W hk])) (3) h(cid:48) i = σ(Σj∈NiαijW hj) where || represents concatenation, and σ is a non-linear activa- tion. (4) In this work, we use the one-hop subgraph of the target entity as the input to GAT. To be specific, the input KG em- beddings, including both node and relation embeddings, are pre-trained with the link prediction objective. These input embeddings are fixed during training. The vanilla GAT design does not support relation-type learning, and only transforms node embeddings. Inspired by [18], we introduce a non-parametric composition of node and relation embeddings. Suppose (i, r, j) is a KG triple, where i, j are nodes and r is the relation. We apply a non-parametric function φ to merge the relation and node embeddings (hr, hj) while updating hi. We experimented with both subtraction and product for function φ, and finally selected subtraction. Knowledge Graph Datasets. Our entity correction system is enhanced by Wikidata, one of the largest publicly available knowledge bases. Specifically, we use the following two data artifacts: (I) KG Structure/Description. Kensho Derived Wiki- media Dataset4 is a pre-processed English Wikidata set. It contains 44M entities and 141M relation triples. This data set serves as a rich source of external knowledge of graph structure and textual description. (II) Retrieval Entity Index. To increase inference efficiency, we use a more condensed entity set to build the retrieval entity index. We start with a derived Wikidata version provided by Spacy Entity Linker5, and further remove entities with digits/punctuation/non-ascii symbols. The resulting entity index is 3M in surface form (textual name). Rephrase Datasets. Rephrase pairs are gathered from the production traffic of three months in a large-scale dialogue system. We remove all private and sensitive information in the utterances, and ensure our data sets are de-identified. Rephrase pairs are consecutive user queries where the first turn contains friction and the second turn is successful based on a friction de- tection model, following the methods described in [5]. Corrupt and target entities (if they exist) are further extracted using the NLU hypotheses of the rephrase data. Training Datasets. For L1 Retrieval training, we use a subset (2.4M utterances) of the entire training dataset, by re- quiring that the corrupt and target entity pair exists and the target entity appears in the entity index. This way we ensure that the model is trained to retrieve most relevant entities from the index. For L2 Re-ranking + Span detection training, we use all the training data (8.5M utterances), so that no-entity- corruption cases can support null span learning. Test Datasets. To reflect different scenarios of real-world applications, our test sets include a friction set (107K utter- ances) and a clean set (3K utterances). In the friction set, each source utterance contains exactly one corrupt entity, and the target entity exists in the entity index. Three subsets of the friction set are considered: zero-shot, few-shot and KG rela- tion. zero-shot set contains data where target entities do not appear in the training set; few-shot set contains data with target entities appearing 1 ∼ 10 times; in KG relation set the target entity has a KG relation with some context entity in the source utterance. The clean set contains utterances that do not need 4https://www.kaggle.com/kenshoresearch/kensho-derived-wikimedia- data 5https://github.com/egerber/spaCy-entity-linker KG Component Entity Precision (E-P) NLU Precision (NLU-P) Overall Zero-shot Few-shot KG-relation Overall Zero-shot Few-shot KG- relation None Description GAT + Description 38.7 41.4 43.9 5.6 11.6 12.3 23.0 28.0 31.3 36.8 39.5 43.2 30.6 33.0 34.9 4.4 8.8 9.5 18.8 23.6 26.4 27.9 30.4 33.1 Table 1. Ablation study of KG-ECO on friction subsets. No trigger threshold applied. to be rephrased, and serves as a safety measure: it calibrates how likely a model falsely rewrites a clean input that does not need to be corrected. 4.2. Evaluation Metrics and Baseline We use the following evaluation metrics6: Entity Precision (E-P): The fraction of correct rank 1 entity predictions over all the triggered predictions. NLU Precision (NLU-P): The fraction of correct NLU hypothesis predictions (in terms of exact match) over all triggered predictions. Trigger Rate (TR): The ratio between rewrite-triggered test samples and all the test samples. Correct Trigger Rate (CTR): The fraction of correctly triggered NLU hypothesis predictions over all the test samples; i.e., Correct trigger rate = Trigger rate × NLU precision. To generate the NLU hypothesis, we first obtain the NLU hypothesis for the source utterance, and replace its corrupt span with the top 1 ranked entity. For the example in Figure 1, the system replaces "bad boy dance" with "bad romance" in the NLU hypothesis "Music | PlayMusicIntent | ArtistName: lady gaga| SongName: bad boy dance". gUFS-QR [2], a state-of-the-art QR system, serves as a baseline. It is a two-layer system, retrieving and re-ranks utterances and NLU hypotheses. Since we do not assume the entities are tagged in utterances, "entity-to-entity" approaches [7, 8, 9, 10] are not appropriate baselines. Besides gUFS- QR, we also consider our two-layer entity correction system without the KG components, which is a similar design as popular entity linking system[11], as a baseline. 4.3. Results We first present evaluation results without the trigger threshold, i.e., the rewrite is always triggered. Results of our KG-ECO system on each friction subset are shown in Table 1. We observe that KG is particularly beneficial for zero-shot and few-shot learning. This is expected since the KG serves as an external source of information. Moreover, we can see GAT is more effective on the KG-relation set than on the overall friction set. Table 2 shows the overall performance of our KG-ECO system, compared to gUFS-QR baseline7 and the entity correc- 6Trigger rate applies to both friction and clean sets, while the other three metrics only apply to the friction set. 7By design, gUFS-QR system's predictions are at utterance/NLU hypoth- esis level. To evaluate entity precision for gUFS-QR, we check if the target entity appears in the slot values of top 1 NLU hypothesis. System gUFS-QR E-P NLU-P 33.4 Entity Correction w/o KG 38.7 43.9 26.7 30.6 34.9 KG-ECO Table 2. Performance on friction set. No trigger threshold applied. System Friction Set TR ↑ CTR ↑ 14.9 Entity Correction w/o KG 41.8 46.2 9.7 15.4 18.8 gUFS-QR KG-ECO Clean Set TR ↓ 2.4 2.3 2.3 Table 3. Triggered performance on clean and friction sets. tion system without KG enhanced components. We can see our method achieves the best performance in both entity precision and NLU precision. This shows that leveraging KG benefits the entity correction task substantially. Notice that even though the NLU hypothesis prediction is based on a straightforward replacement method, we can already obtain a decent absolute improvement of 8.2%. In Table 3, we present the results with tuned trigger con- ditions. We search the null threshold for span detection in (3, 4, 5, 6, 7), keeping only the results that have smaller (false) trigger rates on the clean set than gUFS-QR. Finally we select the threshold maximizing the correct trigger rate on the friction set. Our entity correction system achieves significantly higher trigger rates, while gUFS-QR appears to be overly conserva- tive with a low trigger rate. Overall, it is remarkable that the KG-ECO system outperforms gUFS-QR baseline by 9.1% in terms of the correct trigger rate. 5. CONCLUSIONS In this work, we present a novel entity correction approach for Query Rewriting, powered by Knowledge Graph. The proposed KG-ECO system significantly outperforms two base- lines: an utterance level QR system and the entity correction system without KG information, on different datasets, friction samples and clean samples. In particular, the system is excep- tionally effective for few-shot learning, which demonstrates its potential for generalization. [11] Ledell Wu, Fabio Petroni, Martin Josifoski, Sebastian Riedel, and Luke Zettlemoyer, "Zero-shot entity linking with dense entity retrieval," in EMNLP, 2020. [12] Belinda Z. Li, Sewon Min, Srinivasan Iyer, Yashar Mehdad, and Wen-tau Yih, "Efficient one-pass end-to- end entity linking for questions," in EMNLP, 2020. [13] Daniel Gillick, Sayali Kulkarni, Larry Lansing, Alessan- dro Presta, Jason Baldridge, Eugene Ie, and Diego Garcia- Olano, "Learning dense representations for entity re- trieval," in CoNLL, Hong Kong, China, Nov. 2019, pp. 528–537, Association for Computational Linguistics. [14] Vladimir Karpukhin, Barlas Oguz, Sewon Min, Patrick Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih, "Dense passage retrieval for open-domain question answering," in EMNLP, Online, Nov. 2020, pp. 6769–6781, Association for Computational Linguistics. [15] Jeff Johnson, Matthijs Douze, and Herv ́e J ́egou, "Billion- scale similarity search with gpus," IEEE Transactions on Big Data, vol. 7, no. 3, pp. 535–547, 2021. [16] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova, "BERT: Pre-training of deep bidi- rectional transformers for language understanding," in NAACL, Minneapolis, Minnesota, June 2019, pp. 4171– 4186, Association for Computational Linguistics. [17] Zhuoyi Wang, Saurabh Gupta, Jie Hao, Xing Fan, Dingcheng Li, Alexander Hanbo Li, and Chenlei Guo, "Contextual rephrase detection for reducing friction in dialogue systems," in EMNLP, Online and Punta Cana, Dominican Republic, Nov. 2021, pp. 1899–1905, Asso- ciation for Computational Linguistics. [18] Shikhar Vashishth, Soumya Sanyal, Vikram Nitin, and Partha Talukdar, "Composition-based multi-relational graph convolutional networks," in ICLR, 2020. 6. REFERENCES [1] Petar Veliˇckovi ́c, Arantxa Casanova, Pietro Li`o, Guillem Cucurull, Adriana Romero, and Yoshua Bengio, "Graph attention networks," ICLR, 2018. [2] Xing Fan, Eunah Cho, Xiaojiang Huang, and Chenlei Guo, "Search based self-learning query rewrite system in conversational ai," In 2nd International Workshop on Data-Efficient Machine Learning (DeMaL), 2021. [3] Hui Su, Xiaoyu Shen, Rongzhi Zhang, Fei Sun, Pengwei Hu, Cheng Niu, and Jie Zhou, "Improving multi-turn dia- logue modelling with utterance rewriter," arXiv preprint arXiv:1906.07004, 2019. [4] Zheng Chen, Xing Fan, Yuan Ling, Lambert Mathias, and Chenlei Guo, "Pre-training for query rewriting in a spoken language understanding system," ICASSP, 2020. [5] Eunah Cho, Ziyan Jiang, Jie Hao, Zheng Chen, Saurabh Gupta, Xing Fan, and Chenlei Guo, "Personalized search- based query rewrite system for conversational AI," in Proceedings of the 3rd Workshop on Natural Language Processing for Conversational AI. Nov. 2021, pp. 179– 188, Association for Computational Linguistics. [6] Niranjan Uma Naresh, Ziyan Jiang, Sungjin Lee, Jie Hao, Xing Fan, Chenlei Guo, et al., "Pentatron: Personalized context-aware transformer for retrieval-based conversa- tional understanding," arXiv preprint arXiv:2210.12308, 2022. [7] Arushi Raghuvanshi, Vijay Ramakrishnan, Varsha Em- bar, Lucien Carroll, and Karthik Raghunathan, "En- tity resolution for noisy ASR transcripts," in EMNLP- IJCNLP, Hong Kong, China, Nov. 2019, pp. 61–66, As- sociation for Computational Linguistics. [8] Haoyu Wang, Shuyan Dong, Yue Liu, James Logan, Ashish Kumar Agrawal, and Yang Liu, "Asr error cor- rection with augmented transformer for entity retrieval," INTERSPEECH, 2020. [9] Deepak Muralidharan, Joel Ruben Antony Moniz, Sida Gao, Xiao Yang, Justine Kao, Stephen Pulman, Atish Kothari, Ray Shen, Yinying Pan, Vivek Kaul, Mubarak Seyed Ibrahim, Gang Xiang, Nan Dun, Yidan Zhou, Andy O, Yuan Zhang, Pooja Chitkara, Xuan Wang, Alkesh Patel, Kushal Tayal, Roger Zheng, Peter Grasch, Jason D Williams, and Lin Li, "Noise robust named entity understanding for voice assistants," in NAACL: Industry Papers, Online, June 2021, pp. 196–204, Asso- ciation for Computational Linguistics. [10] Haoyu Wang, John Chen, Majid Laali, Kevin Durda, Jeff King, William Campbell, and Yang Liu, "Leveraging asr n-best in deep entity retrieval," INTERSPEECH, 2021.
http://arxiv.org/abs/2302.10446v1
2023-02-21T05:21:26
2023-02-21T05:21:26
Deep Reinforcement Learning Based on Local GNN for Goal-conditioned Deformable Object Rearranging
Object rearranging is one of the most common deformable manipulation tasks, where the robot needs to rearrange a deformable object into a goal configuration. Previous studies focus on designing an expert system for each specific task by model-based or data-driven approaches and the application scenarios are therefore limited. Some research has been attempting to design a general framework to obtain more advanced manipulation capabilities for deformable rearranging tasks, with lots of progress achieved in simulation. However, transferring from simulation to reality is difficult due to the limitation of the end-to-end CNN architecture. To address these challenges, we design a local GNN (Graph Neural Network) based learning method, which utilizes two representation graphs to encode keypoints detected from images. Self-attention is applied for graph updating and cross-attention is applied for generating manipulation actions. Extensive experiments have been conducted to demonstrate that our framework is effective in multiple 1-D (rope, rope ring) and 2-D (cloth) rearranging tasks in simulation and can be easily transferred to a real robot by fine-tuning a keypoint detector.
[ "Yuhong Deng", "Chongkun Xia", "Xueqian Wang", "Lipeng Chen" ]
10.1109/IROS47612.2022.9981669
[ { "@title": "doi", "@href": "http://dx.doi.org/10.1109/IROS47612.2022.9981669", "@rel": "related", "@type": null }, { "@title": null, "@href": "http://arxiv.org/abs/2302.10446v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10446v1", "@rel": "related", "@type": "application/pdf" } ]
[ "IEEE/RSJ International Conference on Intelligent Robots and\n Systems 2022 (IROS 2022)" ]
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.RO", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.RO", "cs.AI", "cs.LG" ]
Deep Reinforcement Learning Based on Local GNN for Goal-Conditioned Deformable Object Rearranging Yuhong Deng1,2, Chongkun Xia2, Xueqian Wang2 and Lipeng Chen1,† 3 2 0 2 b e F 1 2 ] O R . s c [ 1 v 6 4 4 0 1 . 2 0 3 2 : v i X r a Abstract- Object rearranging is one of the most common deformable manipulation tasks, where the robot needs to rearrange a deformable object into a goal configuration. Pre- vious studies focus on designing an expert system for each specific task by model-based or data-driven approaches and the application scenarios are therefore limited. Some research has been attempting to design a general framework to obtain more advanced manipulation capabilities for deformable rearranging tasks, with lots of progress achieved in simulation. However, transferring from simulation to reality is difficult due to the limitation of the end-to-end CNN architecture. To address these challenges, we design a local GNN (Graph Neural Network) based learning method, which utilizes two representation graphs to encode keypoints detected from images. Self-attention is applied for graph updating and cross-attention is applied for generating manipulation actions. Extensive experiments have been conducted to demonstrate that our framework is effective in multiple 1-D (rope, rope ring) and 2-D (cloth) rearranging tasks in simulation and can be easily transferred to a real robot by fine-tuning a keypoint detector. I. INTRODUCTION Deformable objects can be seen in many automating tasks such as food handling, assistive dressing and the manufactur- ing, assembly and sorting of garment [1], [2], [3]. Rearranging deformable objects is one of the most investigated and fundamental deformable manipulation tasks, where the robot is expected to infer a manipulation sequence to rearrange a deformable object into a goal configuration. Different from rigid object manipulation [4], [5], [6], rearranging deformable objects poses two new challenges. The first challenge lies in the high dimensionality of the configuration space [7], which makes the observation and representation of deformable objects more complicated for efficient manipulation planning. The second challenge comes from the complex and non- linear dynamics of deformable materials [8], which makes the movements of deformable objects hard to predict. There are two main solutions for deformable manipulation, including model-based and data-driven approaches. However, most pioneering works tend to provide task-specific models such as folding cloth, untangling rope-knot [9], and moving ropes in scenes with obstacles [10], which limits their generalization in real applications. Seita et al. [11] proposed a goal-conditioned transporter network, which can be a general learning framework for multiple goal-conditioned deformable rearranging tasks. However, the transporter network is based 1 Tencent Robotics X Lab, Shenzhen, China. {francisdeng, lipengchen}@tencent.com 2 The Center for Intelligent Control and Telescience, Tsinghua Shen- zhen International Graduate School, Shenzhen, China {xiachongkun, wang.xq}@sz.tsinghua.edu.cn † Corresponding author Fig. 1: We formulate the rearranging task as a sequence- to-sequence problem: generating the Q-value distribution of actions (represent the probability of picking and placing on certain keypoint pair) from the keypoints detected from current and goal images. We use a local GNN to solve this problem. The Model trained in simulation can be directly transferred to reality with only keypoint detector fine-tune. on an end-to-end CNN architecture for extracting image features, and therefore the training is data-consuming and the algorithm trained in simulation is hard to transfer into reality. To tackle this problem, we separate the processing of image features from the manipulation planning (Fig. 1). We first propose an efficient configuration representation to improve the generalization of visual features, by encoding keypoints detected from an image into a representation graph. The graph feature contains more semantic information and therefore can represent the configuration space of a deformable object more efficiently. After obtaining representation graphs of the current and goal configurations for a rearranging task, the two graphs are passed through a self-attention layer (the attention calculation is performed on keypoints from the same image) and the two graphs are updated dynamically. Finally, our framework adopts a cross-attention layer (the attention calculation is performed on keypoints from different images) to infer the manipulation action that can narrow the gap between current and goal configurations from two updated graphs. The self-cross attention strategy can reduce the complexity while ensuring performance, which makes our framework easier to deploy. In addition, existing datasets for deformable rearranging tasks are almost on a specific task, which can not be used to verify the performance of our framework. Therefore, we establish a dataset of rearranging 1-D and 2-D deformable objects, and the results demonstrate the proposed framework is effective and general for goal-conditioned rearranging tasks. Real experiments also demonstrate the enhanced sim-to-real transferability of our framework. The contributions of this paper are summarized as follows: 1) We propose a novel configuration representation for deformable manipulation, where keypoints of the de- formable object are encoded into a dynamic graph. 2) We propose an effective and general framework that utilizes self-cross attention for the rearranging of 1-D and 2-D deformable objects. 3) We narrow the gap between simulation and reality in goal-conditioned deformable object rearranging learning. The rest of this article is organized as follows. The related work is reviewed in Sec. II. We introduce our solution framework briefly in Sec. III. In Sec. IV, we discuss the detailed learning algorithm in our framework. The dataset we established is presented in Sec. V. The experimental setup and results are provided in Sec. VI. Finally, we come to the conclusion of the article in Sec. VII. II. RELATED WORK A. Approach for Deformable Object Manipulation There are two main approaches: Model-based approaches rely on physics to define the relationship between the configurations of the deformable object and manipulations. Establishing a data-driven dynamic model that can predict configurations of the deformable object is a new trend for accuracy. Wang et. [12] construct a latent space to represent configurations of the deformable object by CIGAN and establish an inverse model. After the data-driving model is es- tablished, the sampling-based method [13][14] is mostly used to get the manipulation related to configurations. However, if the initial configurations and goal configurations object varies considerably, interpolating intermediate configuration will bring an extra effort and cumulative error. Data-driven approaches can be divided into two categories according to the source of the training data: imitation learning and reinforcement learning. In imitation learning, the manipulation task is often formulated as a supervised learning problem where the robot should imitate the observed behaviors. Nair et al. [15] adopt human demonstrations to solve the multi-step manipulation task. Reinforcement learning agent acquires rearranging skills through robot exploration. Matas et al. [16] train an end-to-end RL agent to complete the task of folding a towel and draping a piece of cloth over a hanger. Wu et al. [17] make the robot learn a pick-and-place policy for cloth folding and rope straightening by a conditional reinforcement learning method. B. General Framework of Deformable Object Manipulation Designing a learning policy for a specific deformable object manipulation task has been widely investigated. However, the generalization of these algorithms is limited. Designing a general framework for deformable object manipulation has achieved some progress recently. Zeng et al. [18] proposed the transporter network that performs well on several Fig. 2: System overview: we proposed an efficient general framework for rearranging the deformable object. The con- figurations of the deformable are encoded into a graph first. And the RL agent will output a manipulation mapped from the current and goal representation graph to interact with the environment continuously until the task is finished. rearranging tasks of rigid objects and Seita et al.[11] further improved the network and applied it to additional tasks of deformable objects. Lim et al.[19] made a more systematic classification of the rearrangement tasks, and achieved better results in sequence-conditioned task learning. Shridhar et al. [20] proposed CLIPort that can produce multi-task policies conditioned on natural language. However, it's hard for these works to transfer to reality for 2 reasons. One reason is using CNN feature directly to represent the deformable object, which brings redundant information for the sparse feature of the deformable object. And the other reason is that end-to-end architecture also highly relies on quantities of data, which is hard to collect in reality. In our model design, the deformable object is represented as a graph, which provides rich semantics including keypoint positions and the topological relation between keypoints. And we use local GNN to process the graph features, which can reduce the size of the model. At the same time, our framework is consist of a keypoint detector (visual feature processing) and a local GNN (manipulation planning). All of these designs make our framework is also effective in reality. III. FRAMEWORK To provide a solution framework (Fig. 2) for deformable object rearranging tasks, we need an efficient configuration representation method. The configurations of the deformable object are represented as a graph structure in our framework. We detect keypoints from the image of the deformable object to reduce the dimensionality of the configuration firstly. The keypoint detecting task is formulated as a supervised learning problem. Our keypoint detector outputs the gaussian heatmap transformed from the coordinates of the keypoint instead of directly outputting the coordinates. The training goal of the model is to reconstruct gaussian heatmap instead of keypoint coordinates regression, which has improved the performance of keypoint detecting. These detected keypoints of current Fig. 3: The design of keypoint detector: we design a keypoint detector, the training goal is to reconstruct the gaussian heatmap centered at the coordinates of keypoints. and goal images will be used to consist of two representation graphs. Then we adopt an attention mechanism to update the relationship between the vertices in representation graphs. After getting the representation graph, manipulations for rearranging tasks can be generated. Considering that the rear- ranging task is a complex multi-step manipulation planning task, our goal is to obtain a manipulation that can narrow the gap between current and goal configurations as much as possible instead of obtaining the entire manipulation sequence for rearranging. The agent outputs a manipulation mapped from the current and goal configurations and obtains the new current configurations from the environment observation after the manipulation is taken. The robot will repeat the above processing until the gap between the current and goal configurations is small enough. The manipulation planning task is formulated as a reinforcement learning problem, where the state is the graph representation, the action is the pick and place manipulation and the reward is related to the gap between current and goal configurations. We adopt DQN (Deep Q-Learning) and we use a local Graph Neural Network to approximate the Q-value function. IV. LEARNING FOR REARRANGING TASKS A. Learning for Graph Representation The motivation of our framework is using a single complete graph whose nodes are the keypoints of the image to represent the deformable object with a large degree of freedom. Keypoint detection is the first step for graph construction. We borrowed the model in [21] and the design of our keypoint detector model is shown in Fig. 3. Given an image I ∈ RH×W ×3 of a deformable object, the feature CNN fkp extracts a feature map fkp(I) ∈ RH ×K from I firstly, we use Ω to denote the image domain (H × W lattice) and use Ω lattice). K (k = 1, 2, 3, . . . , K ) are obtained heatmaps Hc(I; k), c ∈ Ω in parallel as the channels of fkp(I) (K is the number of keypoints), one heatmap for each keypoint. to denote the feature domain (H × W ×W (cid:48) (cid:48) (cid:48) (cid:48) (cid:48) (cid:48) Second, we can estimate coordinates ( ˆxk ) of a keypoint by computing the (spatial) expected value of the lattice in each heatmap that has been normalized via spatial softmax: , ˆyk (cid:48) (cid:48) (cid:48) ( ˆxk , ˆyk (cid:48) ) = ˆc(cid:48) k = (cid:80) c∈Ω(cid:48) c ∗ exp(Hc(I; k)) (cid:80) c∈Ω(cid:48) exp(Hc(I; k)) . (1) Fig. 4: The performance of keypoint detector: our model performs well in detecting keypoints on the rope, rope ring, and cloth. Our model can detect effective points even when there are large-scale occlusions in the image. The left column represents the original image, and the right column represents the gaussian heatmap centered at keypoints detected from the image. The calculation of coordinates is fully-differentiable and can limit the information flow to improve model performance. And we can get the coordinates in image domain Ω by a direct mapping: ˆck = ( ˆxk, ˆyk) = ( H ˆxk H (cid:48) (cid:48) , (cid:48) W ˆyk W (cid:48) ). (2) Finally, we can get a gaussian heatmap by a gaussian-like function centred at ˆck with a small fixed standard deviation σ: Φc(I; k) = exp(− 1 2σ2 (cid:107)c − ˆck(cid:107)2) (3) (cid:48) (cid:48) (cid:48) i)}K (cid:48) = {c i = (x The end result is a gaussian heatmap Φ(I) = (cid:80)K k=1 Φ(I, k), Φ(I) ∈ RH×W , where the location of K maxima is the estimated keypoint coordinates. Our training goal is to make the gaussian heatmap of the estimated keypoint coordinates i, y C i=1 and that of the true keypoint coordinates C = {ci = (xi, yi)}K i=1 as close as possible instead of making the keypoint coordinates close directly. It is easy to recover the keypoint coordinates exactly from these heatmaps, this gaussian heatmap representation is equivalent to the 2D coordinates. In addition, regressing the heatmap will make the model easier to train compared to regressing coordinates directly because of a higher feature dimension. The result of keypoint detection is shown in Fig. 4. Our keypoint detector perform well in three kinds of deformable object (rope, rope ring, and cloth) involved in our dataset. After getting the current coordinates Ct and the goal coordinates Cg of keypoints, we can get a single complete graphs, whose nodes are Ct and Cg. B. Learning for Rearranging Policy To develop an optimal manipulation policy for the rear- ranging task, we design a DQN, which aims to generate a manipulation that can narrow the gap between current and goal configurations. The network architecture is shown in Fig. 5. The classic setting of DQN can be represented as a Markov decision process (MDP) define as a tuple (S, A, T, r, γ, ω), where S is the set of full observable states (representation Fig. 5: Deep reinforcement learning architecture: our RL agent encodes the representation vectors of keypoints by self-attention layers firstly and gets 2 local dynamic graphs to represent the current and goal configurations. Cross-attention layers are used to map the 2 graphs to the q-value matrix. Coordinates of the picking point are the keypoints in the current image and coordinates of the placing point are the keypoints in the goal image. graphs), A is the set of actions (pick-and-place actions), T : S × A × S is the state transition probability function (related to dynamics of the deformable object). The reward function r(s, a) specifies the reward received when the agent takes action a at state s, γ is the discount factor and ω denotes all of the parameters of the Q-value network. Given a current state st, where t is the time instant, the robot could obtain the reward rt+1 = r(st, at+1), and the accumulated reward is denoted as Rt+1 = (cid:80)∞ i=t+1 γi−t−1ri. For rearranging policy π, we use Qπ(st) = E[Rt+1|st, π] to denote the action-value mapping and Q∗ is the estimated one. We resort to the Bellman equation to calculate the optimal action policy. Considering that S ∈ RL×N (L = 2K, N is the dimension of node representation vector in the graph) and A ∈ RL (we use the position of keypoints in current and goal images as candidate positions for picking and placing), the action-value mapping is a sequence to sequence mapping. So we utilize a GNN (Graph Neural Network) as the function approximator to estimate the action-value mapping Q(ω) → Q∗. Parameters w can be iteratively estimated by minimizing the following temporal difference objective: ω ˆw = arg min E[(rt+γ max at+1 Q(st, at+1; ω)−Q(st−1, at; ω))2] (4) By formulating the temporal difference error as the following objective: L(w) = (rt + γ max at+1 Q(st, at+1; ω) − Q(st−1, at; ω))2 (5) We transform the optimization problem into a standard regression estimation problem. We will elaborate the state space, action space, and reward design as follows. 1) State Space: Current and goal coordinates are obtained using keypoint detector developed in Section IV-A, which uti- lizes the RGB image as the input and produces coordinates of keypoints. We embed the coordinates into a high-dimensional vector with a Multilayer Perceptron (MLP) and get the initial representation (0)xp for each keypoint p. (0)xp = MLP(cp) (6) We then use a single complete graph whose nodes are the keypoints of current and goal images to construct the state space. The graph is a multiplex graph that has two types of edges: self edges Eself (connect keypoints from the same image) and cross edges Ecross (connect keypoints from the different image). The message passing formulation is used to propagate information along edges. The representation of each point is updated by simultaneously aggregating messages across specified edges. Let ((cid:96))xp be the intermediate representation for keypoint p in the single complete graph at layer (cid:96), E → p is the result of aggregation messages from all keypoints q : (p, q) ∈ E, where E ∈ Eself ∪ Ecross, and [*(cid:107)*] denotes concatenation. The representation of each keypoint will be updated as follow: ((cid:96)+1)xp =((cid:96)) xp + MLP (cid:16)(cid:104)((cid:96))xp(cid:107)mE→p (cid:105)(cid:17) (7) Starting from (cid:96) = 0, E = Eself at the first (cid:96)s layers ((cid:96) < (cid:96)s), where we only aggregate messages across self edges to update the representation vector of each point. In this way, we can establish 2 local dynamic graphs Gt and Gg for current and goal configurations representation at first. After that ((cid:96) ≥ (cid:96)s), E = Ecross and the messages across cross edges will be aggregated to update the final representation vector for Q- value generation at each point, which can be considered as (a) rope (b) rope ring (c) cloth Fig. 6: Simulation environment: we resort to the pybullet robotic engine to construct simulation environments of three kinds of deformable objects involved in our dataset. the matching process between keypoints in Gt and Gg. The aggregating message mE→p is computed by an attention mechanism in Transformer [22], which is widely used in sequence to sequence tasks in Natural Language Processing. The input vectors of each keypoint p for an attention layer is consisted of the value vector vp, the query vector qp that retrieval information from vp and the key vector kp corresponding to vp. An attention function can be described as mapping a query vector and a set of key-value vector pairs to an output: mE→p = (cid:88) Softmaxq (cid:0)qT p kq (cid:1) vq (8) q:(p,q)∈E 2) Action Space: The pick-and-place action is action primitive for rearranging tasks in our solution framework. To reduce the action space, we have treated keypoints as candidate positions for picking and placing. The keypoints of the current image are candidate positions for picking to eliminate the useless picking on the empty place while the keypoints of the goal image are candidate positions for placing to increase effective placing for rearranging. at+1 = (pickt+1, placet+1) is the action will be taken at t + 1, pickt+1 is the pick point and placet+1 is the place point, Ct and Cg is the current and goal coordinates of keypoints, we have: pickt+1 ∈ Ct placet+1 ∈ Cg (9) The design of candidate positions can also formulate our manipulation task as a sequence-to-sequence task, where the input is the initial representation vectors of keypoints of current and goal images and the output is the Q-values of picking and placing on these keypoints. 3) Reward Design: We design the reward function r(st−1, at) to encourage effective actions according to the distance between the current and goal coordinates of keypoints on deformable object: Fig. 7: The goal configurations in our dataset are random. The orientation, the length ratio of sides, the included angle, and the position are not specific but given in the goal image. TABLE I: Rearranging tasks involved in our dataset Dimension 1D 1D 1D 1D 1D 1D 2D 2D Categories rope rope rope rope ring rope ring rope ring cloth cloth Tasks rope straightening rearrange the rope into a V-shape rearrange the rope into a N-shape rearrange the rope ring into a circle rearrange the rope ring into a square move the rope ring to a random position cloth flattening cloth folding V. DATASET Real robotic experiments are usually not scalable for the restricted experimental environment and the number of the robotic dataset collected in the real environment is limited by safety and cost aspects, which is not enough for the training of robotic algorithms. So we modify the dataset in [11] and establish our dataset of deformable object rearranging tasks in the pybullet [23] simulation environment. Pybullet robotic engine can provide realistic visual renderings and support for 1-D and 2-D deformable object simulation. We put a single camera in a top-down view of the planar surface and construct a dataset for our rearranging tasks. As Fig. 6 shows, our dataset involves three different types of deformable objects (rope, rope ring, and cloth) each with multiple related rearranging tasks, which makes the types of tasks in our dataset sufficient to verify the generalization and effectiveness of the framework. The rearranging tasks involved in our dataset are shown in the TABLE I. It is worth noting that the goal configurations in our dataset are random rather than specific (Fig. 7). The shape (the length ratio of two sides and the included angle of the V-shape, the included angle of the N shape), the orientation, and the position of the goal configurations are all random. Robots need to learn more effective rearranging skills. VI. EXPERIMENT RESULT This section presents experiments to show the performance r(st−1, at) = (cid:107)Ct−1 − Cg(cid:107)2 − (cid:107)Ct − Cg(cid:107)2 (cid:107)Ct−1 − Cg(cid:107)2 of our method. (10) A. Evaluation Experiment in Simulation where (cid:107)*(cid:107)2 denotes Euclidean distance. We normalize the distance change after the action at is executed by dividing it by the distance at the t − 1 instant. We first conduct experiments to evaluate the performance of our framework on multiple rearranging tasks. The robot is given random goal configurations by only visual input, Fig. 8: We evaluate our framework on 8 types of deformable object rearranging tasks involved in our dataset. Each example shows four frames in the sequence of a rearranging task. Experimental results show that our framework is general and effective. TABLE II: Evaluation results of tasks involved in our dataset Tasks rope straightening rearrange the rope into a V-shape rearrange the rope into a N-shape rearrange the rope ring into a circle rearrange the rope ring into a square move the rope ring to a random position cloth flattening cloth folding Successful rate 100% 98% 75% 72% 100% 70% 90% 86% and the robot needs to rearrange the deformable object to the goal configurations without any sub-goal input. We define that the robot completes a rearranging task within 30 picking and placing actions as a success, and the rest is a failure. The situation of completing a rearranging task is that the average pixel distance between the corresponding keypoints in the current and goal image is less than 10. We have chosen this threshold through lots of experiments. The two configurations that satisfy this situation are similar enough. We evaluate the model on the new 100 testing goal- conditioned rearranging tasks for each type of task. The result of the evaluation experiment is shown in TABLE II. The tasks involved in the circle shape (the geometry is very strict) are hard to complete for complex dynamics, the success rates have reached 75% (rearranging into a circle) and 70% (move the rope ring) even on these tasks. The success rate is also acceptable on the 2-D deformable object rearranging task. Compared with the previous framework for multi-task deformable object rearranging skill learning (the tasks involved are different) [11][19], our success rate is almost equivalent, which can verify the performance of our proposed model. However, the training of our model is much faster and the Fig. 9: The reward obtained of GNN and local GNN. size of our model is much smaller. Because we don't rely on the CNN-oriented image feature adopted in previous work, our graph feature is better at handling the sparse information of the deformable object. The calculation of attention on short sequences (32 keypoints in our model setting) is more efficient than multiple convolution calculation on the whole image, where the most area without the deformable object is redundant. Fig. 8 shows some examples of goal-conditioned deformable object rearranging tasks involved in our dataset. All of these tasks are completed in 30 manipulations. B. Ablation Study of Local GNN Architecture Instead of directly performing global attention calculation on the sequence of keypoints to generate the distribution of Fig. 10: The robot completes the rope straightening, rearranging the rope into a V-shape and an N-shape in reality. the Q value, we have adopted a local GNN. An experiment has also been conducted to validate the rationality of this design. We compared the reward obtained of our local GNN and the origin GNN in the rearranging task training. The number of layers for both models is set to be the same. As Fig. 9 shown, the reward obtained by local GNN is larger than the reward obtained by origin GNN. The improvements convincingly demonstrated our model design's positive contribution to agent performance. At the same time, the computational cost of local GNN is half that of origin GNN because the attention calculation is only performed on points from the same image (self-attention) or points from the different image (cross-attention) at each layer, which can further improve the efficiency of our model. C. Physical Experimental Validation In our framework, the processing of visual features (key- point detector) and the planning of manipulation (local GNN) are naturally separated, which enables the transfer of our framework from simulation to reality. Our model can learn multiple goal-conditioned deformable object rearranging skills from a large quantity of data in simulation and these skills can be used in reality with only keypoint detector fine-tune. We test our proposed method in a physical environment with the setup shown in Fig. 11. The rope is placed on the platform, and a UR5 robotic manipulator with a suction cup is placed in front of the platform for picking and placing. Images are captured with a Realsence camera, which is fixed on the top of the platform. It's should be noticed that we use a suction cup as the end-effector and we add 6 markers to attach to the rope for sucking. These markers have litter influence on Fig. 11: Our physical experimental setup consists of a UR5 manipulator, a Realsense camera, a suction cup, and a rope with markers. the dynamic of the rope but can make our experiment easier to conduct. It's easy to replace the sucker with the gripper by considering orientation in the picking and placing action. The orientation can be the tangent direction at the picking and placing point. Affected by the Covid-19 epidemic, we only tested the goal- conditioned rope rearranging task. We collect 500 real images [12] A. Wang, T. Kurutach, K. Liu, P. Abbeel, and A. Tamar, "Learning robotic manipulation through visual planning and acting," arXiv preprint arXiv:1905.04411, 2019. [13] W. Yan, A. Vangipuram, P. Abbeel, and L. Pinto, "Learning predictive representations for deformable objects using contrastive estimation," arXiv preprint arXiv:2003.05436, 2020. [14] M. Yan, Y. Zhu, N. Jin, and J. Bohg, "Self-supervised learning of state estimation for manipulating deformable linear objects," IEEE robotics and automation letters, vol. 5, no. 2, pp. 2372–2379, 2020. [15] A. Nair, D. Chen, P. Agrawal, P. Isola, P. Abbeel, J. Malik, and S. Levine, "Combining self-supervised learning and imitation for vision- based rope manipulation," in 2017 IEEE international conference on robotics and automation (ICRA). IEEE, 2017, pp. 2146–2153. [16] J. Matas, S. James, and A. J. Davison, "Sim-to-real reinforcement learning for deformable object manipulation," in Conference on Robot Learning. PMLR, 2018, pp. 734–743. [17] Y. Wu, W. Yan, T. Kurutach, L. Pinto, and P. Abbeel, "Learning to manipulate deformable objects without demonstrations," arXiv preprint arXiv:1910.13439, 2019. [18] A. Zeng, P. Florence, J. Tompson, S. Welker, J. Chien, M. Attarian, T. Armstrong, I. Krasin, D. Duong, V. Sindhwani et al., "Transporter networks: Rearranging the visual world for robotic manipulation," arXiv preprint arXiv:2010.14406, 2020. [19] M. H. Lim, A. Zeng, B. Ichter, M. Bandari, E. Coumans, C. Tomlin, S. Schaal, and A. Faust, "Multi-task learning with sequence-conditioned transporter networks," arXiv preprint arXiv:2109.07578, 2021. [20] M. Shridhar, L. Manuelli, and D. Fox, "Cliport: What and where pathways for robotic manipulation," in Conference on Robot Learning. PMLR, 2022, pp. 894–906. [21] T. Kulkarni, A. Gupta, C. Ionescu, S. Borgeaud, M. Reynolds, A. Zisserman, and V. Mnih, "Unsupervised learning of object keypoints for perception and control," Advances in neural information processing systems, vol. 32, pp. 10 724–10 734, 2019. [22] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin, "Attention is all you need," Advances in neural information processing systems, vol. 30, 2017. [23] E. Coumans and Y. Bai, "Pybullet, a python module for physics simulation for games, robotics and machine learning, 2016," URL http://pybullet. org, 2016. of the rope and fine-tune the keypoint detector to reduce errors caused by image style differences. The number of keypoints is set as 6, which is different from the simulation. Our model relies on GNN, which makes the number of keypoints can be not fixed. We can choose a different number of keypoints for deformable objects with different physical properties in reality, which further ensures the transferability of the model. The results are shown in Fig. 10. It denotes the image at t instant, Ig denotes the goal image of the task and at denotes the picking and placing action taken at t instant. The experimental results demonstrate that the skills our framework learned in the simulation are also effective in reality. VII. CONCLUSION In this paper, we propose a novel framework to solve the task of goal-conditioned deformable object rearranging. The configurations of the deformable object are represented as a dynamic graph in our model design. The graph feature is passed through a local GNN to obtain Q-value distribution in reinforcement learning. Extensive experiments have been conducted demonstrating that the rearranging policies learned by our framework not only perform well in simulated scenarios but can also be transferred to real scenarios with only keypoint detector fine-tune. REFERENCES [1] P. Jim ́enez, "Survey on model-based manipulation planning of de- formable objects," Robotics and computer-integrated manufacturing, vol. 28, no. 2, pp. 154–163, 2012. [2] I. Leizea, A. Mendizabal, H. Alvarez, I. Aguinaga, D. Borro, and E. Sanchez, "Real-time visual tracking of deformable objects in robot- assisted surgery," IEEE computer graphics and applications, vol. 37, no. 1, pp. 56–68, 2015. [3] A. Kapusta, Z. Erickson, H. M. Clever, W. Yu, C. K. Liu, G. Turk, and C. C. Kemp, "Personalized collaborative plans for robot-assisted dressing via optimization and simulation," Autonomous Robots, vol. 43, no. 8, pp. 2183–2207, 2019. [4] C. Wang, S. Wang, B. Romero, F. Veiga, and E. Adelson, "Swingbot: Learning physical features from in-hand tactile exploration for dynamic swing-up manipulation," in 2020 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS). IEEE, 2020, pp. 5633–5640. [5] A. Zeng, S. Song, J. Lee, A. Rodriguez, and T. Funkhouser, "Tossingbot: Learning to throw arbitrary objects with residual physics," IEEE Transactions on Robotics, vol. 36, no. 4, pp. 1307–1319, 2020. [6] Y. Deng, X. Guo, Y. Wei, K. Lu, B. Fang, D. Guo, H. Liu, and F. Sun, "Deep reinforcement learning for robotic pushing and picking in cluttered environment," in 2019 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS). IEEE, 2019, pp. 619–626. [7] H. Yin, A. Varava, and D. Kragic, "Modeling, learning, perception, and control methods for deformable object manipulation," Science Robotics, vol. 6, no. 54, p. eabd8803, 2021. [8] X. Ma, D. Hsu, and W. S. Lee, "Learning latent graph dynamics for deformable object manipulation," arXiv preprint arXiv:2104.12149, 2021. [9] J. Grannen, P. Sundaresan, B. Thananjeyan, J. Ichnowski, A. Bal- akrishna, M. Hwang, V. Viswanath, M. Laskey, J. E. Gonzalez, and K. Goldberg, "Untangling dense knots by learning task-relevant keypoints," arXiv preprint arXiv:2011.04999, 2020. [10] D. McConachie, A. Dobson, M. Ruan, and D. Berenson, "Manipulating deformable objects by interleaving prediction, planning, and control," The International Journal of Robotics Research, vol. 39, no. 8, pp. 957–982, 2020. [11] D. Seita, P. Florence, J. Tompson, E. Coumans, V. Sindhwani, K. Goldberg, and A. Zeng, "Learning to rearrange deformable cables, fabrics, and bags with goal-conditioned transporter networks," arXiv preprint arXiv:2012.03385, 2020.
http://arxiv.org/abs/2302.10441v1
2023-02-21T04:48:29
2023-02-21T04:48:29
Speech Privacy Leakage from Shared Gradients in Distributed Learning
Distributed machine learning paradigms, such as federated learning, have been recently adopted in many privacy-critical applications for speech analysis. However, such frameworks are vulnerable to privacy leakage attacks from shared gradients. Despite extensive efforts in the image domain, the exploration of speech privacy leakage from gradients is quite limited. In this paper, we explore methods for recovering private speech/speaker information from the shared gradients in distributed learning settings. We conduct experiments on a keyword spotting model with two different types of speech features to quantify the amount of leaked information by measuring the similarity between the original and recovered speech signals. We further demonstrate the feasibility of inferring various levels of side-channel information, including speech content and speaker identity, under the distributed learning framework without accessing the user's data.
[ "Zhuohang Li", "Jiaxin Zhang", "Jian Liu" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10441v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10441v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.CR" ]
SPEECH PRIVACY LEAKAGE FROM SHARED GRADIENTS IN DISTRIBUTED LEARNING Zhuohang Li1, Jiaxin Zhang2, Jian Liu1 1University of Tennessee, Knoxville 2Intuit AI Research 3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 1 4 4 0 1 . 2 0 3 2 : v i X r a ABSTRACT Distributed machine learning paradigms, such as federated learning, have been recently adopted in many privacy-critical applications for speech analysis. However, such frameworks are vulnerable to privacy leakage attacks from shared gra- dients. Despite extensive efforts in the image domain, the exploration of speech privacy leakage from gradients is quite In this paper, we explore methods for recovering limited. private speech/speaker information from the shared gradients in distributed learning settings. We conduct experiments on a keyword spotting model with two different types of speech features to quantify the amount of leaked information by measuring the similarity between the original and recovered speech signals. We further demonstrate the feasibility of in- ferring various levels of side-channel information, including speech content and speaker identity, under the distributed learning framework without accessing the user's data. Index Terms- distributed learning, privacy leakage, speech processing 1. INTRODUCTION Voice assistants, such as Google Assistant, Amazon Alexa, and Apple Siri, have been widely deployed on various smart- phones and smart speakers, as they provide a natural and con- venient way for user interaction. The modern voice user in- terface is powered by deep neural networks, which enables efficient speech processing for many tasks, such as automatic speaker verification (ASV) [1] and automatic speech recogni- tion (ASR) [2]. The remarkable performance of such models is fueled by a growing amount of training data; yet collect- ing data from users is becoming increasingly difficult due to privacy regulations [3, 4] and user privacy concerns. Distributed machine learning, which allows multiple data holders to jointly train a machine learning model under the coordination of a central server, has attracted great research attention. Compared with the conventional centralized learn- ing framework, data parallelism distributed training not only scales better to larger data sizes, but also provides a level of privacy to participating users by encoding the data mini- mization principle: clients are allowed to keep their private data on the local device and only share the gradient infor- mation to the server for updating the model. As such, dis- tributed learning, especially the emerging federated learn- Fig. 1. Illustration of speech privacy leakage from shared gra- dients in the distributed learning scenario. ing (FL), has been quickly deployed in production for many speech-related tasks, such as speaker verification [5] and key- word spotting [6]. Recently, several studies [7, 8, 9, 10] have revealed that image data can be recovered to some extent through the shared gradients in distributed learning (known as gradi- ent leakage, or gradient inversion), which may pose severe threats to user's data privacy. However, to date, there has been limited exploration of gradient leakage in the speech domain. Compared with image data, speech recordings are a rich source of personal and sensitive information that can be used to support a wide spectrum of applications, from sen- timent analysis to spoken language recognition, and further to voice biometric profiling. Therefore, distributed learning involving speech data should be evaluated carefully to fully understand its potential privacy vulnerabilities. To fill this gap, this work investigates the risk of gradient leakage on speech data with the following questions: 1. How to recover private speech data from the shared gra- dients, if feasible? 2. What level of private information (e.g., speech content, speaker identity, etc.) can be exposed from gradients? To answer the first question, we extend on previous gra- dient leakage attacks in the image domain and provide a two-stage inversion method that can numerically restore the speech waveform from the gradients shared by the client, which is illustrated in Fig. 1. We find that different from the image domain, deep learning models for processing speech data are usually trained on condensed speech features rather than the raw waveform. As a result, inverting the gradients only recovers the features of the original signal. Moreover, unlike the image data which has well-defined value space for each pixel, the spectral/cepstral feature of speech signals has a wider range and is more prone to subtle errors which would be amplified when projecting back to the time domain, and thus would require more careful treatment. To answer the second question, we design and conduct extensive experiments to investigate the amount of informa- tion that can be recovered through the gradients. We explore a distributed learning scenario of speech command recog- nition on two types of features, i.e., Mel-spectrogram and Mel-frequency cepstral coefficients (MFCC), and utilize a suite of 4 different metrics to quantify the recovered speech quality and the intelligibility of the recovered speech content. Moreover, we further inspect the amount of leaked voice biometric information leveraging a pre-trained speaker veri- fication model. Our results show that compared with MFCC, using Mel-spectrogram as the front-end feature would lead to more leakage in speech content and speaker information of the client's private speech data from the shared gradients. These findings can help the community understand the poten- tial of gradient leakage on different speech features under the gradient sharing framework and design distributed learning schemes with enhanced privacy protection. 2. RELATED WORK Distributed Learning for Speech. Recently, an increasing amount of research effort has been put into utilizing feder- ated learning as a privacy-enhancing technique to improve neural networks on distributed user devices, such as smart- phones and smart speakers. Besides early studies [11, 12, 13] conducted in simulated environments, many federated learn- ing frameworks for speech processing have already been de- ployed in production, including Apple's speaker verification model [5] and Google's keyword spotting model [6]. As hu- man speech contains rich semantics of sensitive and personal information, there is a pressing need for thoroughly under- standing the privacy risks of models trained on speech data in a distributed manner. Privacy Leakage from Gradients. A few recent studies have shown that sharing gradients in distributed learning is not as safe as it has been presumed. Zhu et al. [7] first demon- strated that it is possible to recover clients' private images from the shared gradients by generating fake images that min- imize the gradient matching loss. Geiping et al. [8] extended this method to deeper neural networks with higher resolu- tion images with a different loss function design. Following work [9, 10] further improved on this by exploring various prior information. Compared to the remarkable progress in the image domain, there is a lack of research on the feasibility and severity of gradient leakage in speech data. To our knowl- edge, the most relevant study by Dang et al. [14] proposed a method to infer speaker identity from gradients of an ASR model. However, such a method only recovers the speech features instead of the original speech waveform. Moreover, compared with ASR models that are trained on long spoken sentences, the lightweight keyword spotting models for rec- ognizing speech commands are more commonly deployed in distributed learning setting, yet the privacy risk there is still unexplored. This work is devoted to filling this research gap. 3. METHODOLOGY 3.1. Problem Formulation c∈C (cid:80) (cid:80) We consider a supervised learning task under the canoni- cal distributed learning setting that involves two parties: the server S and the clients C. The learning objective is to op- timize the parameters θ of a neural network fθ to minimize the empirical risk measured by loss function L on all train- ing data: minθ L(fθ(xi), yi), where xi, (xi,yi)∈Dc yi are the local data and label from client c's local dataset Dc. Instead of directly sharing their private data, federated learning allows participating clients to only shared the gra- dients computed on their private data, i.e., ∇θL(fθ(xi), yi). The server then collects and aggregates gradients from all participating clients to update the global model for each com- munication round. Threat Model. We assume the adversary cannot interfere with the normal federated learning procedure but has access to the gradients uploaded by each individual client. In practice, the adversary can be an honest-but-curious server or a mali- cious analyst that eavesdrops on the communication channel. Objective. The adversary's objective is to infer private in- formation about the client by attempting to reconstruct the client's private data. Previous studies [7, 8] have shown that this can be done through generating synthetic data samples to match the client's gradients. Let ∆θ denote the actual gradi- ents shared by the client and x(cid:48), y(cid:48) represent the synthetic data sample and label. Formally the adversary solves for: x(cid:48)∗, y(cid:48)∗ = argmin x(cid:48),y(cid:48) d(∆θ, ∇θL(fθ(x(cid:48)), y(cid:48))), (1) where x(cid:48)∗, y(cid:48)∗ is the minimizer of the distance between gra- dients measured by a distance metric d. Intuitively, if the gradients computed on the synthetic data closely match the actually shared gradients, the synthetic data will also recover the important semantics of the client's private data. In prac- tice, as the label y(cid:48)∗ can be analytically restored from the gra- dients [8, 9], the adversary only needs to solve for x(cid:48)∗. 3.2. Recovering Speech Data From Gradients Challenge. In the image domain, deep learning models are usually trained to directly process raw imagery data. Differ- ently, in the speech domain, it is a common practice to first extract spectral or temporal acoustic features (e.g., spectro- gram or cepstral coefficients) from the raw speech signal and then feed the extracted features into the deep learning model. This creates an additional layer of difficulty to gradient inver- sion since solving Eq. 1 only recovers the features rather than the original speech waveform. Method. To address the above challenge, the proposed method recovers speech data from the shared gradients in the following two stages: (1) Feature Reconstruction. The goal of the first stage is to recover the acoustic features from the gradients shared by the users. Specifically, let u denote the set of 2-dimensional spectral features extracted from speech waveform x. We then solve the optimization problem in Eq. 1 by minimizing the Euclidean distance in the model parameter (gradient) space: u(cid:48)∗ = argmin u(cid:48) ||∆θ − ∇θL(fθ(u(cid:48)), y(cid:48)∗)||2 2 + λr(u(cid:48)), (2) where r is a regularization term and λ > 0 is a weighting pa- rameter. In this work, we use anisotropic total variation [15] as the regularizer, i.e., r(u(cid:48)) = ||dhu(cid:48)||1 + ||dvu(cid:48)||1, where dh, dv denote the horizontal and vertical partial derivative op- erators, respectively. We do not bound the search space for h(cid:48) during optimization since unlike image data, the values of the acoustic features do not reside in a well-defined range. (2) Waveform Reconstruction. The goal of the second stage is to reconstruct the speech waveform based on the features recovered from the first stage. In this work, we con- sider recovering the waveform from two common types of features for speech processing: Mel-spectrogram and MFCC. To convert a Mel-spectrogram back to a time-domain sig- nal, we first create Mel filter banks and then approximate the normal short-time Fourier transform (STFT) magnitudes by searching for the non-negative least squares solution that minimizes the Euclidian distance between the target Mel- spectrogram and the product of the estimated spectrogram and the filter banks. Then the Griffin-Lim algorithm [16] is applied to produce the speech waveform by estimating the missing phase information. As for MFCCs, an extra step is needed to first invert the cepstral coefficients to approximate a Mel-spectrogram. This is done by first applying the inverse discrete cosine transform (iDCT) and then map the decibel- scaled results to a power spectrogram1. After that, the regular Mel-spectrogram inversion procedure is applied to further get the estimated waveform. 4. EXPERIMENTS 4.1. Experimental Setting Dataset. We use speech data from the Speech Commands dataset [17] to conduct evaluation. The dataset was developed for developing and testing compact and effcient on-device keyword spotting model, which is one of the most widely- adopted federated learning applications in production, and thus is well-suited for our task. Each sample of the dataset Table 1. Model used in evaluation. Type Conv2D Conv2D MaxPooling2D Flatten FC FC Kernel (3, 3) (3, 3) (2, 2) – – – Stride (1, 1) (1, 1) (2, 2) – – – Output (30, 30, 32) (28, 28, 64) (14, 14, 64) 12544 128 10 contains 1 second recording of spoken speech commands sampled at 16kHz and corresponding label. We select a sub- set of the dataset that contains 10 common words (i.e., "yes", "no", "up", "down", "left", "right", "on", "off", "stop", and "go") as in the first released version of the dataset. Front-end Feature Extraction. To extract acoustic features, the speech signal is first pre-emphasised with a factor of 0.97. Then speech frames are created using overlapping Hamming windows with length of 2, 048 samples and frame-shift of 512 samples. For Mel-spectrogram, 512 point fast Fourier trans- form (FFT) with 32 Mel bands is used. For MFCC, 128- channel filterbank is used to extract 32-dimensional coeffi- cient features which are further processed by cepstral mean and variance normalization (CMVN). (1) Model. We adopt the Distributed Learning Setting. same model structure as used in the Tensorflow keyword recognition example2. The model is composed of two 2D convolution layers, one max-pooling layer, and two fully- connected layers. The detailed model architecture is de- scribed in Table 1. (2) Gradient Computation. We assume the clients compute one local step of gradient descent on one random sample from their private dataset and then send back the gradients (i.e., distributed stochastic gradient descent). Parameters. We solve Eq. 2 using Adam optimizer for 8, 000 iterations with λ = 0.001 and a learning rate of 0.01. To avoid local minimum, each sample is given 2 trials and the reconstruction result with the lower loss is selected. 4.2. Experimental Results 4.2.1. Reconstruction Evaluation To evaluate the reconstruction performance, we compare the resulting speech signal recovered from gradients using our method with the original signal using the following metrics: (1) F-MSE: the mean squared error Evaluation Metrics. between the ground truth features of the original speech and (2) W-MSE: the mean squared the reconstructed features. error between the original speech waveform and the recon- structed waveform. (3) PESQ: the perceptual evaluation of speech quality (PESQ) [18] score is designed for end-to-end quality assessment of degraded audio sample in narrow-band telephone networks. The computed score is in the range of [−0.5, 4.5], with higher scores indicating better speech 1https://librosa.org/doc/main/generated/librosa. 2https://www.tensorflow.org/tutorials/audio/ feature.inverse.mfcc_to_mel.html simple_audio Table 2. Reconstruction results on 400 speech samples. F-MSE ↓ W-MSE ↓ Inverting from Features PESQ ↑ STOI ↑ Mel-spectrogram MFCC − − 0.0097 ± 0.0130 0.0091 ± 0.0119 2.1090 ± 0.3563 2.1041 ± 0.3762 0.8082 ± 0.0715 0.7856 ± 0.0760 Mel-spectrogram MFCC Inverting from Gradients 0.0002 ± 0.0017 5701.6225 ± 1919.7741 0.0095 ± 0.0129 0.0153 ± 0.0086 2.0427 ± 0.3816 1.3886 ± 0.1750 0.8004 ± 0.0804 0.4259 ± 0.1234 (a) Waveform (b) Mel-spectrogram (c) MFCC Fig. 2. Visualizing reconstructed speech command "yes". (4) STOI: the short-time objective intelligibility quality. (STOI) [19] metric measures the intelligibility of degraded speech signals based on a correlation coefficient between the temporal envelopes of the reference and degraded signals in short-time overlapping segments. Results. Table 2 presents the statistical results of conducting the reconstruction on 400 random speech samples from the testing set. We also show the results of inverting from the ground truth features (i.e., only conducting waveform recon- struction) as baseline for comparison. An example of visual- izing the reconstructed speech command "yes" is provided in Fig. 2. We observe that for Mel-spectrogram, inverting from gradients yields a similar performance as directly inverting from features, and the reconstructed waveform is very close to the original waveform, with measured W-MSE < 0.001 Table 3. Speaker re-identification results on 400 speech sam- ples. Score ↑ Success Rate ↑ w.r.t. Inverted Signal from Features MFCC Mel-spectrogram 0.7288 ± 0.1386 0.1574 ± 0.1119 w.r.t. Original Signal Mel-spectrogram 0.4445 ± 0.1450 0.0514 ± 0.0916 MFCC 99.25% 16% 90.5% 2.5% and PESQ > 2. However, for MFCC, inverting from gradi- ents would induce a large distortion, causing the quality of the reconstructed speech to degrade drastically. This is po- tentially because the coefficient values are in decibel scale and has high variance and thus are prone to small perturba- tions, which makes it harder to launch gradient leakage at- tacks against MFCCs. 4.2.2. Speaker Re-identification To examine whether the speaker information (i.e., voice bio- metric) can be retained through the reconstruction, we pass the signal recovered from gradients and the reference signal into a speaker verification model and report the cosine simi- larity score of the embeddings and the success rate of the two signals being recognized as the same speaker. To perform speaker verification, we use the ECAPA-TDNN model [20] pretrained on Voxceleb dataset provided by SpeechBrian3. Results. Table 3 presents the statistical results of conducting speaker re-identification on the same set of 400 speech sam- ples. For comparison, we show the results measured w.r.t. both the inverted signal from the ground truth features and w.r.t. the original signal. We observe that the speech signals reconstructed from Mel-spectrogram preserve most speaker information, with 99% and 90% chance to pass the speaker verification when compared to the inverted signal and original signal, respectively. In contrast, speech signals reconstructed from MFCC have a very low probability to be verified as the same speaker, especially when directly compared to the orig- inal signal. 5. CONCLUSION In this work, we study the potential of the privacy leakage of speech data from shared gradients by proposing a two- stage inversion method that sequentially achieves speech fea- ture reconstruction from gradients and waveform reconstruc- tion from the recovered features. Through extensive exper- iments, we demonstrate that compared to Mel-spectrogram, MFCC exhibits better resilience against gradient leakage at- tacks, with less leaked speech/speaker information. Future work could investigate neural vocoders for better waveform reconstruction quality. 3https://huggingface.co/speechbrain/ spkrec-ecapa-voxceleb Time−0.250.000.25Mel-spectrogramOriginalReconstructed00.150.30.450.60.750.9Time−0.250.000.25MFCCOriginalReconstructedOriginalReconstructedDifference−0.006−0.004−0.0020.0000.0020.0040.0060.008OriginalReconstructedDifference−80−60−40−2002040 6. REFERENCES [1] David Snyder, Daniel Garcia-Romero, Daniel Povey, and Sanjeev Khudanpur, "Deep neural network embed- dings for text-independent speaker verification.," in In- terspeech, 2017, vol. 2017, pp. 999–1003. [2] Dario Amodei, Sundaram Ananthanarayanan, Rishita Anubhai, Jingliang Bai, Eric Battenberg, Carl Case, Jared Casper, Bryan Catanzaro, Qiang Cheng, Guoliang Chen, et al., "Deep speech 2: End-to-end speech recog- nition in english and mandarin," in International confer- ence on machine learning. PMLR, 2016, pp. 173–182. [3] European Union, "General Data Protection Regulation," https://gdpr-info.eu/, 2021. [4] Office of the California Attorney General, "Califor- nia Consumer Privacy Act (CCPA): Proposed Text https://www.oag.ca.gov/ of Regulations," sites/all/files/agweb/pdfs/privacy/ ccpa-proposed-regs.pdf, 2021. [5] Filip Granqvist, Matt Seigel, Rogier van Dalen, Aine Cahill, Stephen Shum, and Matthias Paulik, "Improving on-device speaker verification using federated learning with privacy," 2020. [6] Andrew Hard, Kurt Partridge, Neng Chen, Sean Augen- stein, Aishanee Shah, Hyun Jin Park, Alex Park, Sara Ng, Jessica Nguyen, Ignacio Lopez Moreno, et al., "Pro- duction federated keyword spotting via distillation, fil- tering, and joint federated-centralized training," arXiv preprint arXiv:2204.06322, 2022. [7] Ligeng Zhu, Zhijian Liu, and Song Han, "Deep leakage from gradients," Advances in neural information pro- cessing systems, vol. 32, 2019. [8] Jonas Geiping, Hartmut Bauermeister, Hannah Dr ̈oge, and Michael Moeller, "Inverting gradients-how easy is it to break privacy in federated learning?," Advances in Neural Information Processing Systems, vol. 33, 2020. [9] Hongxu Yin, Arun Mallya, Arash Vahdat, Jose M Al- varez, Jan Kautz, and Pavlo Molchanov, "See through gradients: Image batch recovery via gradinversion," in Proceedings of the IEEE/CVF Conference on Com- puter Vision and Pattern Recognition, 2021, pp. 16337– 16346. [10] Zhuohang Li, Jiaxin Zhang, Luyang Liu, and Jian Liu, "Auditing privacy defenses in federated learning via in Proceedings of the generative gradient leakage," IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2022, pp. 10132–10142. [11] David Leroy, Alice Coucke, Thibaut Lavril, Thibault Gisselbrecht, and Joseph Dureau, "Federated learn- ing for keyword spotting," in IEEE International Con- ference on Acoustics, Speech and Signal Processing (ICASSP). IEEE, 2019, pp. 6341–6345. [12] Andrew Hard, Kurt Partridge, Cameron Nguyen, Ni- ranjan Subrahmanya, Aishanee Shah, Pai Zhu, Igna- cio Lopez Moreno, and Rajiv Mathews, "Training key- word spotting models on non-iid data with federated learning," 2020. [13] Dhruv Guliani, Franc ̧oise Beaufays, and Giovanni Motta, "Training speech recognition models with fed- erated learning: A quality/cost framework," in IEEE In- ternational Conference on Acoustics, Speech and Signal Processing (ICASSP). IEEE, 2021, pp. 3080–3084. [14] Trung Dang, Om Thakkar, Swaroop Ramaswamy, Ra- jiv Mathews, Peter Chin, and Franc ̧oise Beaufays, "A method to reveal speaker identity in distributed asr train- ing, and how to counter it," in ICASSP 2022-2022 IEEE International Conference on Acoustics, Speech and Sig- nal Processing (ICASSP). IEEE, 2022, pp. 4338–4342. [15] Yifei Lou, Tieyong Zeng, Stanley Osher, and Jack Xin, "A weighted difference of anisotropic and isotropic total variation model for image processing," SIAM Journal on Imaging Sciences, vol. 8, no. 3, pp. 1798–1823, 2015. [16] Daniel Griffin and Jae Lim, "Signal estimation from modified short-time fourier transform," IEEE Transac- tions on acoustics, speech, and signal processing, vol. 32, no. 2, pp. 236–243, 1984. [17] Pete Warden, "Speech commands: A dataset for limited-vocabulary speech recognition," arXiv preprint arXiv:1804.03209, 2018. [18] John G Beerends, Andries P Hekstra, Antony W Rix, and Michael P Hollier, "Perceptual evaluation of speech quality (pesq) the new itu standard for end-to- end speech quality assessment part ii: psychoacoustic model," Journal of the Audio Engineering Society, vol. 50, no. 10, pp. 765–778, 2002. [19] Cees H Taal, Richard C Hendriks, Richard Heusdens, and Jesper Jensen, "An algorithm for intelligibility prediction of time–frequency weighted noisy speech," IEEE Transactions on Audio, Speech, and Language Processing, vol. 19, no. 7, pp. 2125–2136, 2011. [20] Brecht Desplanques, Jenthe Thienpondt, and Kris De- muynck, "ECAPA-TDNN: emphasized channel at- tention, propagation and aggregation in TDNN based speaker verification," in Interspeech 2020, Helen Meng, Bo Xu, and Thomas Fang Zheng, Eds. 2020, pp. 3830– 3834, ISCA.
http://arxiv.org/abs/2302.10434v1
2023-02-21T04:15:34
2023-02-21T04:15:34
Kernel-Based Distributed Q-Learning: A Scalable Reinforcement Learning Approach for Dynamic Treatment Regimes
In recent years, large amounts of electronic health records (EHRs) concerning chronic diseases, such as cancer, diabetes, and mental disease, have been collected to facilitate medical diagnosis. Modeling the dynamic properties of EHRs related to chronic diseases can be efficiently done using dynamic treatment regimes (DTRs), which are a set of sequential decision rules. While Reinforcement learning (RL) is a widely used method for creating DTRs, there is ongoing research in developing RL algorithms that can effectively handle large amounts of data. In this paper, we present a novel approach, a distributed Q-learning algorithm, for generating DTRs. The novelties of our research are as follows: 1) From a methodological perspective, we present a novel and scalable approach for generating DTRs by combining distributed learning with Q-learning. The proposed approach is specifically designed to handle large amounts of data and effectively generate DTRs. 2) From a theoretical standpoint, we provide generalization error bounds for the proposed distributed Q-learning algorithm, which are derived within the framework of statistical learning theory. These bounds quantify the relationships between sample size, prediction accuracy, and computational burden, providing insights into the performance of the algorithm. 3) From an applied perspective, we demonstrate the effectiveness of our proposed distributed Q-learning algorithm for DTRs by applying it to clinical cancer treatments. The results show that our algorithm outperforms both traditional linear Q-learning and commonly used deep Q-learning in terms of both prediction accuracy and computation cost.
[ "Di Wang", "Yao Wang", "Shaojie Tang", "Shao-Bo Lin" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10434v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10434v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI" ]
Kernel-Based Distributed Q-Learning: A Scalable Reinforcement Learning Approach for Dynamic Treatment Regimes Di Wanga, Yao Wanga, Shaojie Tang,b Shao-Bo Lin a∗ a Center for Intelligent Decision-Making and Machine Learning, School of Management, Xi'an Jiaotong University, Xi'an, China b Naveen Jindal School of Management, University of Texas at Dallas, Richardson, Texas, USA In recent years, large amounts of electronic health records (EHRs) concerning chronic diseases, such as cancer, diabetes, and mental disease, have been collected to facilitate medical diagnosis. Modeling the dynamic properties of EHRs related to chronic diseases can be efficiently done using dynamic treatment regimes (DTRs), which are a set of sequential decision rules. While Reinforcement learning (RL) is a widely used method for creating DTRs, there is ongoing research in developing RL algorithms that can effectively handle large amounts of data. In this paper, we present a novel approach, a distributed Q-learning algorithm, for generating DTRs. The novelties of our research are as follows: 1) From a methodological perspective, we present a novel and scalable approach for generating DTRs by combining distributed learning with Q-learning. The proposed approach is specifically designed to handle large amounts of data and effectively generate DTRs. 2) From a theoretical standpoint, we provide generalization error bounds for the proposed distributed Q-learning algorithm, which are derived within the framework of statistical learning theory. These bounds quantify the relationships between sample size, prediction accuracy, and computational burden, providing insights into the performance of the algorithm. 3) From an applied perspective, we demonstrate the effectiveness of our proposed distributed Q-learning algorithm for DTRs by applying it to clinical cancer treatments. The results show that our algorithm outperforms both traditional linear Q-learning and commonly used deep Q-learning in terms of both prediction accuracy and computation cost. Key words : Q-learning, dynamic treatment regimes, distributed learning, kernel ridge regression 3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 4 3 4 0 1 . 2 0 3 2 : v i X r a ∗ Corresponding authors: [email protected] 1 2 1. Introduction Wang et al.: DQL Patients with chronic diseases, such as cancer, diabetes, and mental disease, normally undergo a long period of initial treatment, disease recurrence, and salvage treatment. Explicitly specifying the relationship of treatment type and drug dosage with patient response is generally difficult, so practitioners have to use protocols in which each patient receives a similar treatment based on the average responses of previous patients with similar cases. However, illnesses respond heterogeneously to treatment. For example, a study on schizophrenia (Ishigooka et al. 2000) discovered that patients using the exact same antipsychotic experience drastically varied outcomes; some patients experience few adverse events with improved clinical outcomes, whereas others have to discontinue treatment due to worsening symptoms. This has motivated researchers to advocate dynamic treatment regimes (DTRs) to determine treatments dynamically and individually based on clinical observations of patients (Murphy 2005a, Lavori and Dawson 2008, Chakraborty and Moodie 2013, Chakraborty and Murphy 2014, Almirall and Chronis-Tuscano 2016). A DTR is defined by a set of sequential decision rules; each rule takes the clinical observations of a patient at certain key points as input and returns the treatment action of doctors as output (Tsiatis et al. 2019). In this way, the design of a DTR can be considered a sequential decision-making problem and suits the reinforcement learning (RL) framework (Sutton and Barto 2018), in which states, actions, rewards, and policies correspond to the clinical observations of patients, treatment options, treatment outcomes, and series of decision rules, respectively. RL addresses sequential decision-making problems with sampled, evaluative, and delayed feedback simultaneously, which naturally makes it a desirable tool for developing ideal DTRs. Q-learning (Watkins and Dayan 1992) is a typical temporal-difference algorithm that produces a sequence of high-quality actions in RL and has substantially developed in the past decades in health care (Yu et al. 2021, Oh et al. 2022), control (Moore et al. 2011, 2014), recommendation (Zhao et al. 2017, Yoganarasimhan 2020), and other management-related problems (Peters and Schaal 2008, Kalashnikov et al. 2018, Schultz and Sokolov 2018). In particular, Padmanabhan et al. (2017) Wang et al.: DQL 3 used different reward functions in Q-learning to model different constraints in cancer treatments. In contrast to other application areas (Gosavi 2009), Q-learning for modern DTRs typically has the following important characteristics: • Data structure: Due to the fact that treatment decisions are often made at specific intervals, it is not possible to generate a treatment history of infinite duration. When a patient's chronic disease is not effectively treated or managed through a particular treatment plan, they may seek alternative treatment options from other doctors, resulting in treatment records with limited duration. Additionally, in Q-learning for DTRs, doctors typically have a limited number of treatment options to choose from based on patients' treatment histories (Tsiatis et al. 2019, Chap.1.4). However, for a given treatment decision, the clinical observations of patients can be unpredictable, resulting in an infinite number of states. This makes Q-learning for DTRs distinct from classical tabular-based Q-learning, which focuses on finite actions and states (Gosavi 2009). To summarize, DTRs have finite horizons, and each stage of Q-learning for DTRs has a finite number of actions but an infinite number of states. • Task orientation: Unlike other applications of Q-learning (Gosavi 2009), the treatment decisions made at each key point in Q-learning for DTRs play a crucial role in determining patients' health outcomes, regardless of when these decisions are made. For example, a poor treatment decision at some stage may lead to severe negative consequences that cannot be corrected by subsequent treatments. As a result, it is not appropriate to assume that the treatment at one point is more important than others, and the common approach of discounting rewards in Q-learning (Even-Dar and Mansour 2003, Liu and Su 2022) is not suitable for DTRs. In short, the reward of Q-learning cannot be discounted for DTRs. • Quality guarantee: Quality is crucial in medical treatment, as even a small mistake can result in negative outcomes for patients. This necessitates not only a strong understanding of the reasons and methods behind specific treatment decisions but also robust and solid theoretical guarantees supporting the effectiveness of Q-learning. This requirement eliminates the use of some heuristic yet intricate designs of Q-learning (Oroojlooyjadid et al. 2022, Fan et al. 2020) for generating DTRs. 4 Wang et al.: DQL • Computation costs: In recent years, large amounts of EHRs related to chronic diseases, such as cancer, diabetes, and mental illness, have been collected to aid in medical diagnosis. This increase in data size has allowed for the identification of previously unknown symptoms, but it also poses significant scalability challenges for the Q-learning algorithms used, in terms of storage and computational complexity. As a result, commonly used but computationally intensive approaches, such as deep Q-learning (Fran ̧cois-Lavet et al. 2018), are not suitable for DTRs. The characteristics discussed above place strict limitations on the use of Q-learning for generating DTRs. The need for quality guarantees excludes the commonly used linear Q-learning (Murphy 2005b), and the demands for computational efficiency and interpretability make the widely adopted deep Q-learning (Oroojlooyjadid et al. 2022) unsuitable for DTRs. In this paper, we aim to create a scalable Q-learning algorithm that has solid theoretical guarantees for DTRs. 1.1. Mathematical formulation of Q-learning for DTRs DTRs often involve T -stage treatment decision problems. Let st ∈ St be the pretreatment information and at ∈ At be the treatment decision at stage t, where St and At are sets of pretreatment information and treatment decisions, respectively. A history of personalized treatment is generated in the form of TT = {s1:T +1, a1:T }, where sT +1 is the status after all treatment decisions are made and s1:T = {s1, . . . , sT }. Let Rt : (S1:t+1, A1:t) → R be the clinical outcome following the decision at, which depends on the pretreatment information s1:t+1 and treatment history a1:t. A suitable function Rt should be identified to quantify the outcome in DTRs because Rt encodes the professional knowledge of doctors and defines the value of their treatment decisions. In cancer treatment, for example, Rt can be set as the tumor size or the estimated survival time when the t-th treatment decision is made. Our purpose is not to search for appropriate clinical outcome functions Rt but to develop an efficient learning scheme for generating a high-quality DTR for a given Rt. Throughout the paper, we use capital letters (A1, A2, etc.) to denote random variables and lowercase letters (a1, a2, etc.) to represent their realization. A DTR π = (π1, . . . , πT ), where πt : St × At−1 → At, is a set of rules for personalized treatment decisions at all T stages. The optimal DTR is that which maximizes the overall outcome of interest Wang et al.: DQL 5 (cid:80)T t=1 Rt(s1:t+1, a1:t) in terms of designing suitable treatment rules π = (π1, . . . , πT ). Our analysis is cast in a random setting to quantify the overall outcome (Murphy 2005b, Sugiyama 2015). Denote by ρt(st|s1:t−1, a1:t−1) the transition probability of st conditioned on s1:t−1 and a1:t−1. The value of DTR π at stage t is then defined by Vπ,t(s1:t, a1:t−1) = Eπ Rj(S1:j+1, A1:j)(cid:12) (cid:12)S1:t = s1:t, A1:t−1 = a1:t−1 (cid:35) , (cid:34) T (cid:88) j=t where Eπ is the expectation with respect to the distribution Pπ = ρ1(s1)1a1=π1(s1) T (cid:89) t=2 ρt(st|s1:t−1, a1:t−1)1at=π(s1:t,a1:t−1)ρT +1(sT +1|s1:T , a1:T ), and 1W is the indicator of the event W . Denote the optimal value function of π at stage t as V ∗ t (s1:t, a1:t−1) = max π∈Π Vπ,t(s1:t, a1:t−1), where Π denotes the collection of all treatments. We aim to find a policy ˆπ to minimize V ∗ 1 (s1) − Vˆπ,1(s1). Let pt(at|s1:t, a1:t−1) be the probability that a decision at is made given the history {s1:t, a1:t−1}. Define the optimal time-dependent Q-function by Q∗ t (s1:t, a1:t) = E[Rt(S1:t+1, A1:t) + V ∗ t+1(S1:t+1, A1:t)|S1:t = s1:t, A1:t = a1:t], (1) where E is the expectation with respect to P = ρ1(s1)p1(a1|s1) T (cid:89) t=2 ρt(st|s1:t−1, a1:t−1)pt(at|s1:t, a1:t−1)ρT +1(sT +1|s1:T , a1:T ). (2) Given the definition of V ∗ t , we derive V ∗ t (s1:t, a1:t−1) = Vπ∗,t(s1:t, a1:t−1) = Eπ∗ Rj(S1:j+1, A1:j)(cid:12) (cid:12)S1:t = s1:t, A1:t−1 = a1:t−1 (cid:35) , (cid:34) T (cid:88) j=t where π∗ is the optimal policy. Therefore, V ∗ t (s1:t, a1:t−1) = max at Q∗ t (s1:t, a1:t). (3) 6 Wang et al.: DQL With (3), the optimal treatment decisions can be determined by maximizing the optimal Q-functions. Thus, researchers have developed efficient algorithms for finding optimal Q-functions, which are named Q-learning algorithms (Watkins and Dayan 1992), in the realm of RL. With Q∗ T +1 = 0, the definition of Q∗ t indicates that Q∗ t (s1:t, a1:t) = E (cid:20) Rt(S1:t+1, A1:t) + max at+1 t+1(S1:t+1, A1:t, at+1)(cid:12) Q∗ (cid:12)S1:t = s1:t, A1:t = a1:t (cid:21) (4) for t = T, T − 1, . . . , 1. This property connects Q-functions with the well-known regression function (Gy ̈orfi et al. 2006) in supervised learning as follows. Denote Xt = S1:t × A1:t and L2 t as the space of square-integrable functions defined on Xt with respect to the distribution Pt = ρ1(s1)p1(a1|s1) t (cid:89) j=2 ρj(sj|s1:j−1, a1:j−1)pj(aj|s1:j, a1:j−1). Write xt := {s1:t, a1:t} ∈ Xt, and y∗ t := Rt(s1:t+1, a1:t) + max at+1 Q∗ t+1(s1:t+1, a1:t, at+1). (5) Then, (4) implies that the Q∗ t of each t is the regression function of the input–output pair (xt, y∗ t ) and written as Q∗ t = E[Y ∗ t |Xt = xt], t = T, T − 1, . . . , 1. (6) Therefore, the standard approach in statistical learning theory (Gy ̈orfi et al. 2006, Cucker and Zhou 2007) yields Q∗ t = arg minQt∈L2 t E (cid:2)(Y ∗ t − Qt(Xt)2(cid:3) , t = T, T − 1, . . . , 1, (7) showing that optimal Q-functions can be obtained by solving T least squares problems. In this way, Q-learning for DTRs can be solved as shown in Figure 1. As shown in Figure 1, through the iterative generation of input–output pairs, Q-learning can be regarded as a series of supervised learning problems and incorporates four steps: hypothesis space selection, optimization model development, Q-function training, and policy search. The hypothesis space selection step focuses on selecting a class of functions that encodes some a priori information Wang et al.: DQL 7 Figure 1 Training and decision-making flows of Q-learning. and determines the formats of Q-functions. Linear spaces (Murphy 2005b) and deep neural networks (Fan et al. 2020) are typical hypothesis spaces for Q-learning. The optimization model development step involves mathematically defining the Q-functions via a sequence of optimization problems. The empirical risk minimization principle (Murphy 2005a, Sugiyama 2015) is widely used for this purpose. After the optimization model is developed, a feasible optimization algorithm, such as an analytic solver (Murphy 2005b) or a gradient-based algorithm (Sutton and Barto 2018), is designed in the Q-function training step to derive Q-functions. Finally, the policy search step searches for the best possible policies for choosing appropriate actions by maximizing the Q-functions. 1.2. Problem setting Given the data structure feature of Q-learning for DTRs, we are interested in Q-learning with T stages whose state space St is an infinite continuous space and whose action space At is a discrete set of finite elements. We aim to search for a suitable hypothesis space, develop an appropriate optimization strategy, design an efficient algorithm to train high-quality Q-functions, and derive a DTR with solid theoretical guarantees. To suit different chronic diseases, the proposed Q-learning algorithm for DTRs should be feasible, efficient, and theoretically sound for a large number of reward functions because different reward functions usually correspond to various chronic diseases (Padmanabhan et al. 2017). The setting of Q-learning in this paper is shown in Table 1. Data Inputs1,a1s2,a2sT−1,aT−1sT,aTsT+1r1r2rT−1rTx=(s1,a1,...,sT,aT)y=rTx=(s1,a1,...,sT−1,aT−1)y=rT−1+maxQTx=(s1,a1,s2,a2)y=r2+maxQ3x=(s1,a1)y=r1+maxQ2TrajectoryDecision-Makings1argmaxa∈A1Q1(s1,a)a1s2a2r1argmaxa∈A2Q2(s1:2,a1,a)sT−1aT−1r2argmaxa∈AT−1QT−1(s1:T−1,a1:T−2,a)sTaTrT−1argmaxa∈ATQT(s1:T,a1:T−1,a)rTf∈HLinear SpaceDeep Neural NetworksRKHSHypothesis Space SelectionOptimization Model DevelopmentRISKEmpirical Risk MinimizationStructural Risk MinimizationStage-wise OptimizationQ-function TrainingGradient DescentSub-gradient DescentAnalytic SolverminimumQ1Q2QT−1QTTrainingProcesssT+1 8 Wang et al.: DQL Table 1 Setting of Q-learning for DTRs. Horizon Action space State space Reward function Discount Quality T Finite Continuous Smooth No Generalization error As the starting point of Q-learning, hypothesis spaces regulate the format and properties of the Q-functions to be learned and determine the type of optimization models to be developed. Therefore, the selection of hypothesis spaces is a constant problem in Q-learning (Sugiyama 2015). In particular, excessively large hypothesis spaces are beneficial for representing any Q-functions but inevitably require large computations, whereas excessively small hypothesis spaces lack expressive power and consequently exclude the optimal Q-functions. Linear spaces (Murphy 2005b) and deep neural networks (Fran ̧cois-Lavet et al. 2018) are widely known hypothesis spaces for Q-learning, and they have been used successfully in various applications (Sutton and Barto 2018, Kraus et al. 2020, Oroojlooyjadid et al. 2022). However, linear spaces have limited expressive power and cannot adapt to different reward functions, frequently performing poorly for chronic diseases, such as cancer and sepsis (Yu et al. 2021, Sec.4), whereas deep neural networks lack solid theoretical guarantees and are usually time consuming (training a neural network for specific applications of deep Q-learning requires the tuning of a great number of parameters in nonconvex nonsmooth optimization models); moreover, the running mechanisms of deep Q-learning are difficult to identify. Given the requirement for Q-learning for DTRs to have a balance between having an expressive hypothesis space for quality guarantees and a small and simple hypothesis space for scalability, we are faced with the following challenge: Problem 1. How can a hypothesis space be designed for Q-learning for DTRs that avoids the limitations of both linear spaces and deep neural networks simultaneously? Problem 1 is challenging to address because hypothesis spaces with high expressive power are large and require many parameters for training Q-functions, which leads to significant training time, particularly when the data size is large. Once the hypothesis space is determined, optimization models play a crucial role in defining Q-functions. In general, a good optimization model for Wang et al.: DQL 9 Q-learning for DTRs should be solvable, scalable, and interpretable. Solvability means that the developed model can be solved using standard optimization algorithms, such as gradient descent, subgradient descent, and analytic solvers. Scalability implies that the cost of solving the optimization problem is reasonable. Interpretability means that the developed model is easy to understand. Optimization models with good solvability, scalability, and interpretability can be easily developed for linear hypothesis spaces, but for nonlinear spaces, these properties are difficult to achieve. Furthermore, given the limited expressive power of linear spaces, we focus on the following problem: Problem 2. How can optimization models for Q-learning for DTRs, which are solvable, scalable, and interpretable, be developed to optimize the performance of chosen nonlinear or infinite hypothesis spaces? The solvability and scalability of optimization models imply that scalable optimization algorithms exist to solve these models, and the finiteness of the treatment options in DTRs means that policy search can be easily implemented. Thus, the solutions to Problems 1 and 2 are sufficient to develop DTRs through Q-learning. With the emphasis on the quality guarantee of Q-learning for DTRs, we ultimately focus on the following problem: Problem 3. How can the quality of the resulting DTRs be theoretically measured and how can solid theoretical guarantees be provided for it? Unlike other applications, such as recommendations and supply chain management, which use regret (Liu and Su 2022) to measure the quality of the developed policies, DTRs focus on the final treatment outcomes, regardless of the median treatment processes, in order to fully explore the values of the initial states. This means that new measurement and analysis tools are required for theoretical guarantees. 1.3. Our contributions We develop a scalable Q-learning algorithm for DTRs to address the above challenges. Our study is driven by three key observations. Based on Problems 1 and 2, a nonlinear or infinite hypothesis space is needed to avoid the limitations of linear spaces, but the optimization model, which is based 10 Wang et al.: DQL on the hypothesis space, should have a linear solution to be solvable, scalable, and interpretable. Kernel methods (Evgeniou et al. 2000), which map data inputs to kernel-based feature spaces to make learning methods linear, have been widely used for regression over the past two decades. The well-known representer theorem (Wahba 1990) states that even though the hypothesis spaces of kernel methods are reproducing kernel Hilbert spaces (RKHS) of infinite dimensions, kernel methods always build estimators in linear spaces whose dimensions are the sizes of the samples. This unique property of kernel methods perfectly meets the requirements of Problems 1 and 2. Additionally, numerous scalable variants of kernel methods, such as distributed learning (Zhang et al. 2015), learning with subsampling (Gittens and Mahoney 2016), and localized support vector machine (SVM) (Meister and Steinwart 2016), have been proposed to reduce the computational burden of kernel methods for regression purposes. Since Q-learning can be regarded as a T -stage least squares regression problem, a scalable Q-learning algorithm can be easily designed based on kernel methods using previously proposed approaches (Zhang et al. 2015, Gittens and Mahoney 2016, Meister and Steinwart 2016). Based on the above observations, we propose a kernel-based distributed Q-learning algorithm for DTRs. Our main contributions are as follows: • Methodological Novelty: Our approach combines distributed learning (Zhang et al. 2015) and kernel ridge regression (KRR) (Caponnetto and De Vito 2007) to estimate Q-functions, by breaking down Q-learning into T least squares regression problems. Specifically, we use an RKHS corresponding to a kernel as the hypothesis space and implement distributed regularized least squares as the optimization model. This approach avoids the limitations of linear Q-learning while addressing the computational efficiency issues of deep Q-learning. To the best of our knowledge, this is the first attempt to design a distributed Q-learning algorithm with solid theoretical guarantees. • Theoretical Novelty: We propose a novel integral operator approach to analyze the generalization error of Q-learning. Our method allows us to derive tight generalization error bounds for the proposed kernel-based distributed Q-learning algorithm. Our theoretical results indicate that the Wang et al.: DQL 11 distributed operator does not increase the generalization error, given that the data is not divided into too many subsets. Additionally, the generalization error bounds we derived are independent of the input dimensions, indicating that the proposed algorithm scales well with respect to the dimensionality of the problem. • Numerical Novelty: We evaluate the proposed algorithm against linear Q-learning and deep Q-learning in two types (small and large action spaces) of clinical trials for cancer treatments. Our numerical results show that the performance of our approach is consistently better than that of linear Q-learning and no worse than that of deep Q-learning. In terms of computation costs, our approach requires significantly less training time than deep Q-learning. These results demonstrate the effectiveness and efficiency of kernel-based distributed Q-learning for DTRs. The rest of this paper is organized as follows. Section 2 introduces some related work and compares our approach with theirs. In Section 3, we explain the proposed kernel-based distributed Q-learning algorithm for DTRs. In Section 4, we study the theoretical behaviors of the proposed algorithm by establishing two generalization error bounds, whose proofs are given in the appendix. In Section 5, two simulations concerning clinical cancer treatments are conducted to illustrate how the proposed algorithm outperforms linear Q-learning and deep Q-learning. 2. Related Work and Comparisons In this section, we compare our approach with some related work on Q-learning for DTRs, theoretical guarantees of Q-learning, and scalable kernel methods. 2.1. Q-learning for DTRs With the rapid development of medical digitization, EHRs concerning chronic diseases, such as cancer, diabetes, and mental disease, have been collected to facilitate medical diagnosis. EHRs have been widely used in health care decisions regarding chronic diseases over the last decade, including cancer prediction and analysis (Zhao et al. 2011, Humphrey 2017), warfarin dosing (Consortium 2009, Bastani and Bayati 2020), sepsis treatment (Marik et al. 2017, Raghu et al. 2017), and anesthesia analysis (Moore et al. 2011, 2014). Q-learning is a promising approach to utilizing EHRs 12 Wang et al.: DQL to yield high-quality DTRs and has gained fruitful clinical effects in improving the quality of health care decisions (Tsiatis et al. 2019, Yu et al. 2021). Zhao et al. (2009) used support vector regression (SVR) (Vapnik et al. 1996) and extremely randomized trees (Ernst et al. 2005) to fit approximated Q-functions for agent dosage decision-making in chemotherapy; Humphrey (2017) employed classification and regression trees (CART) (Breiman et al. 1984), random forests (Breiman 2001), and a modified version of multivariate adaptive regression splines (Friedman 1991) to estimate Q-values for an advanced generic cancer trial; Tseng et al. (2017) presented a multicomponent deep RL framework for patients with non-small-cell lung cancer (NSCLC) in which a deep Q-network (DQN) maps states into potential dose schemes to optimize future radiotherapy outcomes; Raghu et al. (2017) proposed a fully connected dueling double DQN approach to learn an approximation of the optimal action–value function for sepsis treatment. The reader is refered to Tables III and IV of (Yu et al. 2021) for more related work on Q-learning for DTRs. Our approach offers three main novelties. First, we employ kernel-based Q-learning to generate DTRs because the design of kernel methods satisfies the high requirements of Q-learning for DTRs (the hypothesis space of a kernel method is large enough, and the derived estimator is in a linear space). Second, we focus on distributed Q-learning algorithms for DTRs that scales well according to the data size. Such a scalable variant of Q-learning for DTRs has not been considered in the literature. Finally, we provide solid theoretical guarantees for the proposed Q-learning approach in the framework of statistical learning theory (Sugiyama 2015), which is beyond the scope of the above mentioned papers. 2.2. Generalization error analysis for Q-learning Q-learning (Watkins and Dayan 1992) is one of the most commonly employed methods for RL, and it sequentially estimates Q-functions backward (from the last stage to the first stage). Generally speak- ing, the quality of a Q-learning algorithm is indicated by three factors: generalization performance, computation costs, and stability. The generalization performance depicts the relationship between the number of samples and the value of the derived policy. The computation costs, including the Wang et al.: DQL 13 storage requirements, training time, and testing time, reflect the scalability of Q-learning. Stability describes the relationship between the generalization performance and adopted algorithmic or model parameters, which implies the difficulty of training. From the statistical learning theory viewpoint, the quality of Q-learning has been studied extensively. In particular, Even-Dar and Mansour (2003) derived a sufficient condition of the learning rate in gradient-based linear Q-learning to guarantee the convergence (stability) of Q-learning; Kearns and Singh (1999), Murphy (2005b), Goldberg and Kosorok (2012), and Oh et al. (2022) studied the generalization error of linear Q-learning; Sabry and Khalifa (2019) and Wainwright (2019) developed several variance reduction techniques to improve the performance of Q-learning; Fan et al. (2020) deduced a generalization error estimate for deep Q-learning; Xu et al. (2005, 2007) and Liu and Su (2022) studied regret bounds for kernel-based Q-learning. However, the setting of Q-learning studied in the current paper is different from those in most of these works, as we are concerned with the states, actions, and rewards in Table 1. For example, except for (Murphy 2005b, Goldberg and Kosorok 2012), and (Oh et al. 2022), all the above studies focused on Q-learning with large (or even infinite) horizons and discount rewards. The most closely related works to ours are (Oh et al. 2022) and (Liu and Su 2022). The former deduced a similar generalization error to ours for linear Q-learning under the same setting as in the present paper, whereas the latter aimed to derive regret bounds for kernel-based Q-learning. The differences between our work and (Oh et al. 2022) are as follows. We study kernel-based distributed Q-learning rather than linear Q-learning. The main advantage of utilizing an RKHS as the hypothesis space is its excellent expressive power over linear spaces. Moreover, we employ a novel integral operator approach to deduce the generalization error of Q-learning for DTRs rather than use the standard covering number approach. The generalization error bounds in our paper, derived under weaker assumptions on data distribution, are considerably tighter than the results in (Oh et al. 2022) . The main differences between our work and (Liu and Su 2022) are three aspects. First, we are interested in generalization error analysis, whereas Liu and Su (2022) 14 Wang et al.: DQL focused on regret analysis. Because the goal of treatment is to find a DTR ˆπ that minimizes 1 (s1) − Vˆπ,1(s1), the generalization error E[V ∗ V ∗ 1 (s1) − Vˆπ,1(s1)] is more appropriate for DTRs than the regret (cid:80)T t=1 ((V ∗ t (s1:t, a1:t−1) − Vˆπ,t(s1:t, a1:t−1)). Furthermore, Liu and Su (2022) imposed strong restrictions on the kernel (linear kernel or Gaussian kernel), whereas our approach is available to any positive-definite kernel. Finally, as we use a distributed version of kernel methods, the computation costs of the proposed kernel-based distributed Q-learning approach for DTRs are much less than those of the kernel-based algorithms in (Liu and Su 2022). 2.3. Kernel-based distributed learning for regression Kernel-based distributed learning is a popular computation reduction strategy for kernel methods in regression. Numerous kernel-based distributed learning algorithms, such as distributed KRR (DKRR) (Zhang et al. 2015, Lin et al. 2017), kernel-based distributed gradient descent (Lin and Zhou 2018), distributed spectral algorithms (Guo et al. 2017, M ̈ucke and Blanchard 2018), and coefficient-based distributed kernel learning (Shi 2019), have been developed with solid theoretical guarantees. Optimal generalization error bounds for DKRR were established in (Lin et al. 2017) in the standard least squares regression framework. For a specific t, (7) shows that Q-learning can be reduced to least squares regression directly, indicating that our theoretical results can be derived from (Lin et al. 2017) directly. However, there are two main challenges in borrowing the idea of the integral operator approach from (Lin et al. 2017). First, the iterative definition of Q-functions (4) makes it difficult to present a uniform bound of the derived Q-functions, making the approach in (Lin et al. 2017) unavailable for our analysis. As shown in Appendix A.5, a novel iterative method based on operator differences is proposed to bound the uniform bound of Q-functions. Second, we require an additional multistage error to embody the multistage nature of Q-learning, unlike the approaches in (Lin et al. 2017) and (Chang et al. 2017), which divided the generalization error into approximation error to infer the massiveness of the hypothesis space, sample error to describe the model and data quality, and distributed error to quantify the limitation of distributed learning. These challenges hinder the direct use of the results of (Lin et al. 2017) for Q-learning and require delicate analysis and mathematical tools. Wang et al.: DQL 15 3. Kernel-Based Distributed Q-Learning for DTRs Since (7) is defined by expectation, Q∗ t cannot be derived directly. The only thing we have access to is a set of records of personalized treatments D := {Ti,T , ri,1:T }|D| i=1, where {Ti,T }|D| i=1 = {(si,1:T +1, ai,1:T )}|D| i=1 is assumed to be drawn independently and identically (i.i.d.) according to P , ri,t := Rt(si,1:t+1, ai,1:t), and |D| denotes the cardinality of the set D. We derive an approximation of Q∗ t using D, which is a standard regression problem in supervised learning (Gy ̈orfi et al. 2006). Empirically, by setting ˆQT +1 = 0, we can compute Q-functions ( ˆQt for t = T, T − 1, . . . , 1) by solving the T structural risk minimization problem ˆQt(s1:t, a1:t) = arg min Qt∈Ht E|D| (cid:20)(cid:18) Rt(S1:t+1, A1:t)+max at+1 (cid:19) ˆQt+1(S1:t+1, A1:t, at+1) − Qt(S1:t, A1:t) (cid:21) 2 +λΩ(Qt) (8) for t = T, T − 1, . . . , 1, where E|D| is the empirical expectation, Ht is a parameterized hypothesis space, Ω(Qt) denotes some structures of Qt, and λ is a tunable parameter to balance the empirical risk and structure. We then find a suitable Ht and Ω(Qt) so that ˆQt is close to Q∗ t . In this section, we explain the proposed kernel-based distributed Q-learning for DTRs. Before presenting the detailed algorithm, we elucidate the reasons we use kernel-based Q-learning. This approach offers three main advantages: • Q-learning can be regarded as a T -stage least squares regression problem, and kernel methods are well-developed learning schemes that exhibit optimal generalization performance (Caponnetto and De Vito 2007, Lin et al. 2017) in least squares regression, which implies that kernel methods perform excellently with strong theoretical guarantees in each stage. • Numerous scalable variants of kernel methods have been proposed and successfully used, such as DKRR (Zhang et al. 2015), kernel learning with subsampling (Rudi et al. 2015), and localized SVM (Meister and Steinwart 2016). These variants provide guidance for the development of scalable Q-learning algorithms for DTRs. • Linear spaces spanned by certain basis functions and deep neural networks are common hypothesis spaces in Q-learning (Sutton and Barto 2018). Due to their simple structures, linear 16 Wang et al.: DQL hypothesis spaces are beneficial for computations but have poor generalization performance. In addition, the complex structures of deep neural networks enable deep Q-learning in generalization but are frequently time consuming. Kernel methods balance Q-learning with linear spaces and deep Q-learning; kernelized Q-learning outperforms linear Q-learning in generalization and has a smaller computational burden than deep Q-learning. Based on these, we use the well-known KRR (Caponnetto and De Vito 2007, Zhang et al. 2015) to derive an approximation of Q∗ t empirically based on the given dataset D. Let K(x, x(cid:48)) := Kt(x, x(cid:48)) be a Mercer kernel, where x, x(cid:48) ∈ Xt, and HK,t be the corresponding RKHS endowed with the norm (cid:107) * (cid:107)K,t. Given regularization parameters λt, t = 1, . . . , T , if we set QD,λT +1,T +1 = 0 with λT +1 = 0, then the Q-functions can be empirically defined by QD,λt,t = arg minQt∈HK,t 1 |D| |D| (cid:88) i=1 where (yi,t − Qt(xi,t))2 + λt(cid:107)Qt(cid:107)2 K,t, t = T, T − 1, . . . , 1, (9) yi,t := ri,t + max at+1∈At+1 QD,λt+1,t+1(si,1:t+1, ai,1:t, at+1). (10) In this way, (9) can be solved backward to derive a sequence of estimators {QD,λt,t}T t=1. We then define the corresponding KRR for DTRs (KRR-DTR) by πD,(cid:126)λ = (πD,λ1,1, . . . , πD,λT ,T ), where πD,λt,t(s1:t, a1:t−1) = arg maxat∈AtQD,λt,t(s1:t, a1:t−1, at), t = 1, . . . , T. (11) Solving KRR (9) requires O(|D|3) floating computations in each stage, which makes KRR time consuming for large-scale datasets. A scalable variant of (9) should be developed to reduce the computational burden so that (9) can be successfully utilized to handle large-scale datasets to generate a high-quality DTR. Distributed learning equipped with a divide-and-conquer strategy (Zhang et al. 2015, Lin et al. 2017, 2020) is preferable for this purpose. Kernel-based distributed Q-learning can be divided into four steps: division, local processing, synthesis, and iteration. • Division: Randomly divide the dataset D into m disjoint subsets Dj according to the uniform distribution, that is, D = ∪m j=1Dj, Dj ∩ Dj(cid:48) = ∅ for j (cid:54)= j(cid:48). Denote Dj = {si,j,1:T +1, ai,j,1:T , ri,j,1:T }|Dj | i=1 . Wang et al.: DQL 17 Figure 2 Training and decision-making flows of DKRR-DTR. • Local Processing: Initialize QD,λT +1,T +1 ≡ 0, where λT +1 = 0. At the tth stage, calculate the output of the ith sample in the jth data subset as yi,j,t := ri,j,t + max at+1∈At+1 QD,λt+1,t+1(si,j,1:t+1, ai,j,1:t, at+1), j = 1, * * * , m, (12) and run KRR with parameter λt on the data Dj to obtain a local estimator of the Q-function QDj ,λt,t = arg min Qt∈HK,t 1 |Dj| |Dj | (cid:88) i=1 (cid:0)yi,j,t − Qt(si,j,1:t, ai,j,1:t)(cid:1)2 + λt(cid:107)Qt(cid:107)2 K,t, j = 1, * * * , m. (13) • Synthesis: Synthesize the global estimator as QD,λt,t = m (cid:88) j=1 |Dj| |D| QDj ,λt,t. (14) • Iteration and Decision-Making: Repeat the local processing and synthesis steps for t = T, T − 1, . . . , 1, and obtain a set of Q-functions {QD,λt,t}T t=1 based on DKRR. Define the DKRR for DTRs (DKRR-DTR) estimator by πD,(cid:126)λ = (πD,λ1,1, * * * , πD,λT ,T ), where πD,λt,t(s1:t, a1:t−1) = arg maxat∈AtQD,λt,t(s1:t, a1:t−1, at), t = 1, . . . , T. (15) The training and decision-making flows of the above approach are shown in Figure 2, where Dj,t represents the data on the jth local machine at the tth stage and QD,λt,t is rewritten as Qt for D1:m,1D1,1D2,1Dm,1⨁D1DD2DDmDതQ1Stage 1s1,a1s2,a2sT−1,aT−1D1:m,2D1,2D2,2Dm,2⨁D1DD2DDmDതQ2Stage 2D1:m,T−1D1,T−1D2,T−1Dm,T−1⨁D1DD2DDmDതQT−1Stage T-1D1:m,TD1,TD2,TDm,T⨁D1DD2DDmDതQTStage TsT,aTsT+1r1r2rT−1rTx=(s1,a1,...,sT,aT)y=rTx=(s1,a1,...,sT−1,aT−1)y=rT−1+maxതQTx=(s1,a1,s2,a2)y=r2+maxതQ3x=(s1,a1)y=r1+maxതQ2TrajectoryTrainingProcessDecision-Makings1argmaxa∈A1തQ1(s1,a)a1s2a2r1argmaxa∈A2തQ2(s1:2,a1,a)sT−1aT−1r2argmaxa∈AT−1തQT−1(s1:T−1,a1:T−2,a)sTaTrT−1argmaxa∈ATതQT(s1:T,a1:T−1,a)rTsT+1 18 Wang et al.: DQL convenience. The detailed implementation of DKRR-DTR can also be found in Appendix B. A comparison of (14) with (9) shows that the computational complexity of KRR-DTR is reduced from O(|D|3) to (|Dj|3) at each stage on the jth local machine. If the data subset sizes are the same, that is, |D1| = |D2| = * * * = |Dm|, then each local machine has only O(|D|3/m3) floating computations at each stage. If local processing is performed in parallel on a single machine, then O(|D|3/m2) floating computations are required. As in the classical regression setting (Zhang et al. 2015, Lin et al. 2017, Lin and Zhou 2018), the number of local machines m balances the generalization error and computational complexity of DKRR-DTR. A small m yields perfect generalization but needs huge computations, whereas a large m significantly accelerates the algorithm but may degrade its generalization performance. Therefore, it is crucial to theoretically derive some values of m with which DKRR-DTR performs similarly to KRR-DTR while reducing its computational burden. 4. Theoretical Behaviors In this section, we deduce the generalization error of DKRR-DTR to quantify the relationship between the quality of DKRR-DTR and the number of samples. As a byproduct, the generalization error of KRR-DTR is derived as reference. 4.1. Assumptions According to the "no free lunch" theory in statistical learning theory (Gy ̈orfi et al. 2006, Theorem 3.1), satisfactory generalization error bounds cannot be derived for learning algorithms without any assumptions about the data. Therefore, some restrictions on the data D and the distribution P should be set for our analysis. Our first assumption focuses on the massiveness of the state and action spaces. Assumption 1. For any t = 1, . . . , T , St is a compact set and At is a finite set. The above assumption corresponds to Q-learning's infinite states and finite treatment options in DTRs. Given Assumption 1, Xt = S1:t × A1:t is also compact. Assumption 2 is established to quantify the relationship between the Q-functions and value functions in the setting of DTRs. Wang et al.: DQL Assumption 2. Let μ ≥ 1 be a constant. It holds that pt(a|s1:t, a1:t−1) ≥ μ−1, ∀ a ∈ At, t = 1, . . . , T. 19 (16) Assumption 2, a widely used assumption in the RL and dynamic treatment communities (Murphy 2005b, Qian and Murphy 2011, Goldberg and Kosorok 2012), declares that conditioned on previous treatment information, any action in the finite set At can be chosen with a probability of at least μ−1. Based on Assumption 2, it follows from (Goldberg and Kosorok 2012, Eq. (16)) that for an arbitrary Qt ∈ L2 t , there holds E[V ∗ 1 (S1) − Vπ,1(S1)] ≤ T (cid:88) t=1 2μt/2(cid:112)E[(Qt − Q∗ t )2] = T (cid:88) t=1 2μt/2(cid:107)Qt − Q∗ t (cid:107)Lt 2 , (17) where π = (π1, . . . , πT ) is defined by πt(s1:t, a1:t−1) = arg maxat∈AtQt(s1:t, a1:t−1, at). The relation (17) asserts that Qt approaching Q∗ t implies Vπ,1 approximating V ∗ 1 well, provided that π is defined to maximize Q-functions. In this way, we can derive and E[V ∗ 1 (S1) − Vπ D,(cid:126)λ ,1(S1)|D] ≤ 2 E[V ∗ 1 (S1) − Vπ D,(cid:126)λ ,1(S1)|D] ≤ 2 T (cid:88) t=1 T (cid:88) t=1 μt/2(cid:107)QD,λt,t − Q∗ t (cid:107)Lt 2 (18) μt/2(cid:107)QD,λt,t − Q∗ t (cid:107)Lt 2 , (19) showing that the generalization errors of KRR-DTR and DKRR-DTR can be bounded by the differences between the derived Q-functions and optimal Q-functions, where E[*|D] denotes the expectation conditioned on D. Our third assumption concerns the boundedness of the reward function Rt. Assumption 3. There exists an M ≥ 1 such that (cid:107)Rt(cid:107)L∞ ≤ M for any t = 1, . . . , T . Assumption 3 is quite mild because Rt is manually presented and almost all widely used reward functions (Sutton and Barto 2018, Sugiyama 2015) satisfy this assumption. According to (4) and Q∗ T +1 = 0, Assumption 3 implies that |y∗ t | ≤ (T − t + 1)M, (cid:107)Q∗ t (cid:107)L∞ ≤ (T − t + 1)M (20) 20 Wang et al.: DQL holds almost surely for any 1 ≤ t ≤ T , showing that the optimal Q-functions are also bounded. Furthermore, some regularity property of Q∗ t is given to quantify the relationship between Q∗ t and the kernel K. For this purpose, we first define an integral operator from HK,t to HK,t (also from L2 t to L2 t if no confusion is made) as LK,tf (x) = (cid:90) Xt f (x(cid:48))K(x, x(cid:48))dPt(x(cid:48)). (21) For any positive-definite kernel K(*, *), LK,t is easily verified to be a positive compact operator (Smale and Zhou 2004, 2005). Define Lr K,t as the r-th power of LK,t via spectral calculus (Smale and Zhou 2005). Assumption 4, which is standard in supervised learning (Caponnetto and De Vito 2007, Rudi et al. 2015, Zhang et al. 2015, Blanchard and Kr ̈amer 2016, Lin et al. 2017, Lin and Zhou 2018), describes the regularity of Q∗ t with respect to the kernel K. Assumption 4. For any t = 1, . . . , T , assume that Q∗ t := Lr K,tht, for some ht ∈ L2 t , r > 0, (22) where LK,t is the integral operator from L2 t to L2 t , as defined by (21). The index r in (22) quantifies the regularity of Q∗ t . If r = 0, then (22) means Q∗ t ∈ L2 t , implying that there is no regularity of Q∗ t . If r = 1/2, then (22) is equivalent to Q∗ t ∈ HK,t (Smale and Zhou 2005), showing that Q∗ t is in the RKHS associated with the kernel K. If r > 1/2, then (22) implies that Q∗ t is in other RKHSs in HK,t corresponding to smoother kernels than K. Generally speaking, the larger the r value, the better the assumed regularity of Q∗ t . As indicated by (4), the regularity assumption of Q∗ t depends on the regularity of the reward function Rt. Furthermore, since the Rt in a DTR can be manually set before the learning process, the regularity of Q∗ t in Assumption 4 indeed includes a wide range of selection of Rt, including both the smooth and constant reward functions, and is much looser than the assumptions in existing literature (Murphy 2005b, Goldberg and Kosorok 2012, Oh et al. 2022), where Q∗ t is assumed to belong to linear spaces. Wang et al.: DQL 21 Finally, we impose a restriction on the kernel. For any t, define the effective dimension (Caponnetto and De Vito 2007) as Nt(λ) := Tr((λI + LK,t)−1LK,t), λ > 0, where Tr(L) is the trace of the operator L. The following assumption describes the property of K via the effective dimension. Assumption 5. There exists an s ∈ (0, 1] such that Nt(λ) ≤ C0λ−s, ∀ t = 1, 2, . . . , T, (23) where C0 ≥ 1 is a constant independent of λ. From the definition of Nt(λt), (23) always holds for C0 = κ := maxt=1,...,T (cid:112)supx∈Xt K(x, x) and s = 1. Therefore, without this assumption, our results below always hold for s = 1. This assumption is introduced to encode the property of the kernel in our theoretical analysis to make the established generalization error bounds more delicate. In particular, Assumption 5 is equivalent to the eigenvalue decay assumption in previous studies (Caponnetto and De Vito 2007, Zhang et al. 2015) and has been widely adopted in studies on kernel learning (Blanchard and Kr ̈amer 2016, Lin et al. 2017, Guo et al. 2017, Lu et al. 2020, Shi 2019). In summary, five assumptions are involved in our analysis: Assumptions 1 and 2 are concerning the data D, Assumptions 3 and 4 are concerning the optimal Q-function Q∗ t , and Assumption 5 is concerning the kernel K. These assumptions can be simultaneously satisfied easily. For example, assume the state space is St := [0, 1] and the action space is {0, 1}; conditioned on s1:t, a1:t−1, one adopts the decision at = 1 with probability 1/2 and the reward function Rt(x) ≡ C for some constant C. If we adopt the Sobolev kernel K(xt, x(cid:48) t) = max{xt * x(cid:48) t, 1 − xt * x(cid:48) t}, then the above assumptions hold simultaneously with μ = 2, M = C, r = 1, and s = 1. 4.2. Generalization error analysis Before presenting the theoretical guarantees of DKRR-DTR, we first bound the generalization error of KRR-DTR to show the power of kernel-based Q-learning. The following theorem is our first theoretical result. 22 Wang et al.: DQL Theorem 1. Under Assumptions 1-5, with 1 2 ≤ r ≤ 1 and 0 < s ≤ 1, if λ1 = * * * = λT = |D|− 1 2r+s , then where (cid:104) E V ∗ 1 (S1) − Vπ D,(cid:126)λ (cid:105) ,1(S1) ≤ C1(T, μ)|D|− r 2r+s , (24) C1(T, μ) := C1(2μ ̄C)T T T (cid:88) 2−t T (cid:88) T −1 (cid:89) t=1 (cid:96)=t k=(cid:96) (cid:0)(T − k + 2)(2μ1/2)k−(cid:96) + 1(cid:1) , and ̄C and C1 are constants depending only on M , C0, κ, r, s, and maxt=1,...,T (cid:107)ht(cid:107)L2 t . Theorem 1 quantifies the generalization error of KRR-DTR and the data size. According to (24), the generalization error of KRR-DTR decreases with respect to the data size. Moreover, it depends heavily on the regularity of the optimal Q-functions and the property of the adopted kernel. In particular, the better the regularity of Q∗ t , the smaller the generalization error; the smaller the effective dimension of the kernel, the better the quality of KRR-DTR. The derived rate O (cid:0)|D|− r 2r+s (cid:1) is the same as that for the classical KRR for regression in supervised learning (Caponnetto and De Vito 2007, Lin et al. 2017) under similar assumptions. The derived generalization error is dimensionality independent, showing that using kernel methods in Q-learning is essentially better than linear approaches. From Theorem 1, the constant C1(T, μ) behaves exponentially with respect to the horizon T , which is different from the results in (Fan et al. 2020). The main reason is that, except for the mild restriction in Assumption 2, we do not impose any restrictions on the distribution P , unlike (Fan et al. 2020). This property makes our analysis suitable only for Q-learning with a small T , coinciding with the practical implementation requirements of DTR in Table 1. Additional restrictions on P , such as the concentration-type assumption in (Fan et al. 2020) and margin-type assumption in (Oh et al. 2022), can improve the constant C1(T, μ) and the convergence rate |D|− r 2r+s . However, as these assumptions are difficult to satisfy in practice for DTRs, we do not use them in the present paper. The derived generalization error bounds in (24) are much better than those for linear Q-learning (Murphy 2005b, Oh et al. 2022) in three aspects. First, we only impose the regularity assumption Wang et al.: DQL 23 (22) on optimal Q-functions, whereas Murphy (2005b) and Oh et al. (2022) required Q∗ t to belong to a linear combination of finite basis functions. The space of Q∗ t satisfying Assumption 4 is much more massive than the linear space studied in (Murphy 2005b) and (Oh et al. 2022). Second, the derived convergence rate |D|−r/(2r+s) is better than those established for linear Q-learning in previous studies, where rates slower than |D|−1/4 were derived under stricter assumptions. For sufficiently small values of s, our derived rates can be of the order |D|−1/2. Finally, due to linearity, the rates established in (Murphy 2005b) and (Oh et al. 2022) depend heavily on the dimension d, whereas our results are dimensionality independent, showing the power of kernelization. Our next theoretical result presents a solid theoretical guarantee for the feasibility of DKRR-DTR. Theorem 2. Under Assumptions 1-5, with 1 2 ≤ r ≤ 1 and 0 < s ≤ 1, if λ1 = * * * = λT = |D|− 1 2r+s , |D1| = * * * = |Dm|, and m(log m + 1) ≤ 2r+s−1 4r+2s |D| log |D| , then where (cid:104) E V ∗ 1 (S1) − Vπ D,(cid:126)λ (cid:105) ,1(S1) ≤ C2(T, μ)|D|− r 2r+s , (25) (26) C2(T, μ) := C2(2μ ˆC)T T T (cid:88) 2−t T (cid:88) T −1 (cid:89) t=1 (cid:96)=t k=(cid:96) (cid:0)(T − k + 2)(2μ1/2)k−(cid:96) + 1(cid:1) , and ˆC and C2 are constants depending only on M , C0, κ, r, s, and maxt=1,...,T (cid:107)ht(cid:107)L2 t . Theorem 2 presents a sufficient condition of m to guarantee the excellent generalization perfor- mance of DKRR-DTR. In particular, if the number of data subsets m and the total number of samples |D| satisfy the relation (25), then DKRR-DTR performs almost the same as KRR-DTR, showing that the computation reduction approach made by distributed learning does not degrade the generalization performance of KRR-DTR. The restriction on m, such as (25), is necessary because the generalization performance of KRR-DTR cannot be realized if we use DKRR-DTR with each data subset containing only a few samples. An extreme case is m = |D| where each data subset contains only one sample and DKRR-DTR cannot perform well. 24 Wang et al.: DQL Theorem 2 shows that DKRR-DTR possesses all the advantages of KRR-DTR, but its training cost is only O(|D|3/m3) × m = O(|D|3/m2), which is 1/m2 times smaller than that of KRR-DTR. Given that the quality of Q-learning algorithms is measured by their generalization performance, computation costs, and stability, the above assertions show that DKRR-DTR is better than linear Q-learning in generalization, better than deep Q-learning and KRR-DTR in computation, and better than deep Q-learning in stability as the optimization model defined by (13) can be analytically solved, whereas obtaining global minima with high-quality deep neural networks remains an open question in the realm of deep learning (Goodfellow et al. 2016, Chap.8). These findings illustrate that DKRR-DTR is a promising approach to yielding high-quality DTRs. 5. Simulations In this section, two types of clinical trials for cancer treatment are simulated to demonstrate the efficacy of the proposed method compared with linear least squares-based and deep neural network-based Q-learning for DTRs (LS-DTR and DNN-DTR, respectively). The first simulation aims to find treatment regimes to maximize the survival time in the clinical trial with a flexible number of stages and a small number of actions; the second simulation aims to develop a policy of the injection dose levels of a single drug to maximize the cumulative survival probability (CSP) in the clinical trial with a large number of actions that are discretized from a continuous action space. For a fair comparison, we explain the implementation details and the parameters that should be tuned. • In the training process of distributed Q-learning, training samples are randomly and equally distributed to local machines; the time of data transmission from different local machines is not considered; the computing capabilities of the local machines are assumed to be the same for simplicity. • For DNN-DTR, a fully connected feed-forward network with a sigmoid activation function and Xavier initialization (Glorot and Bengio 2010) is employed to estimate Q-functions; the number of hidden layers, the number of neurons in the hidden layers, and the number of epochs of DNN are tuned parameters, and the other important settings are listed in Table 2. Wang et al.: DQL Table 2 Default values of parameters in DNN. Optimizer Momentum Learning rate Batch size Weight decay Loss SGDM 0.9 0.05 5000 0.0001 MSELoss • For KRR-DTR and DKRR-DTR, the positive-definite function φ(x1, x2) = exp(− (cid:107)x1−x2(cid:107)2 2 2σ2 25 ) is used as the kernel function; the kernel width σ and the coefficient λ of (cid:96)2 regularization are tuned parameters. • The value of the same parameter is maintained at all clinical stages; the parameters that require tuning are chosen by grid search to maximize the specific target (such as the expected survival time or CSP). All simulations are run on a desktop workstation equipped with an Intel(R) Core(TM) i9-10980XE 3.00 GHz CPU, an Nvidia GeForce RTX 3090 GPU, 128 GB of RAM, and Windows 10; the DNN-DTR programs are executed on the GPU, and the others are executed on the CPU. The results are recorded by averaging the results from multiple individual trials with the best parameters. 5.1. Clinical trial with a small number of treatment options Patients with NSCLC typically undergo one to three treatment lines. The number of treatments is flexible because the disease progression and the therapy tolerance ability of patients are different. In this simulation, we consider the problem of developing an optimal treatment policy that maximizes the expected survival time. We use the mathematical model of cancer dynamics proposed by Goldberg and Kosorok (2012) to generate the clinical trajectory, where the treatment options include an aggressive treatment A and a conservative treatment B. The details of trajectory generation are described in Appendix C. The following cases are considered to examine the performance of the proposed method: • The state si is the wellness wi at the start of the ith stage, and the Q-functions at the ith stage are estimated separately as functions of the state si for actions A and B; we refer to this case as "single feature + separately" (S+S). 26 Wang et al.: DQL Figure 3 Survival and training times of methods with batch-mode training of all data. (a) Survival time (b) Training time • The state si is composed of the wellness wi at the start of the ith stage and the reward ri−1 of the (i − 1)th stage, that is, si = (wi, ri−1), where r0 ≡ 0, and the Q-functions at the ith stage are estimated separately as functions of the state si for actions A and B; we refer to this case as "multiple feature + separately" (M+S). • The state si is composed of the wellness wi and reward ri−1, that is, si = (wi, ri−1), and the Q-function at the ith stage is estimated as a joint function of the state si and the action ai; we refer to this case as "multiple feature + jointly" (M+J). • The state si is composed of the wellness wi and reward ri−1, that is, si = (wi, ri−1), and the Q-function at the ith stage is estimated as a joint function of the states and actions of all stages up to stage i; we refer to this case as "non-Markovian + jointly" (N+J). The experimental settings of the simulation are first introduced. We generate a dataset of N = 10000 trajectories for training and tested the policy π = (π1, π2, π3) by generating 1000 new trajectories in which the treatment of the ith stage accords with πi. For KRR-DRT and DKRR-DRT, the parameter λ is chosen from the set { 1 2q | 1 2q > 1 2N , q = 0, 1, 2, * * * }, and the kernel width σ is chosen from a set of 20 values drawn in an equally spaced logarithmic interval [0.001, 1]. For DNN-DRT, the number of hidden layers, the neuron number in the hidden layers, and the number of epochs are chosen from the sets {1, 2, 3, 4}, {10, 20, * * * , 100}, and {2000, 4000, * * * , 10000}, respectively. LS-DRT AAAAABABAABBBAABABBBABBBS+SM+SM+JN+J0.20.40.60.811.21.41.61.82Survival time (year)LS-DTRDNN-DTRKRR-DTRS+SM+SM+JN+J10-2100102104Training time (second)LS-DTRDNN-DTRKRR-DTR Wang et al.: DQL 27 has no parameters that require tuning. The expected value of survival time is estimated using the mean of the survival time of the 1000 patients. For each method with the best parameters, we conduct the simulation 500 times and record the average value of the estimated mean survival time for evaluation.1 In the following, we give some comparisons from aspects of nondistributed and distributed Q-learning. • Nondistributed Q-learning: We compare LS-DTR, DNN-DTR, and KRR-DTR with eight fixed treatments (a1a2a3 for ai ∈ {A, B}). The comparisons of survival and training times are shown in Figure 3, from which we can conclude the following: 1) The policies AAA and AAB have the best survival time among the eight fixed treatments, but they are still significantly worse than the policies obtained by the Q-learning methods, which illustrates the power of RL in discovering effective regimens for life-threatening diseases. 2) LS-DTR has the shortest training time, which increases from case S+S to case N+J. This is because the training complexity of LS-DTR is independent of the number of training samples; it is only related to the dimension of the data input (the dimension increases from case S+S to case N+J). Nevertheless, LS-DTR has the worst survival time among the three Q-learning methods. The survival times of LS-DTR for cases S+S and M+S are obviously higher than those of LS-DTR for cases M+J and N+J, which indicates that LS is not good at jointly handling states and actions when the size of the action space is small. 3) KRR-DTR performs similarly to (or slightly better than) DNN-DTR in terms of survival time, although it takes between one hundredth and tenth as long to train as DNN-DTR. 4) From case S+S to case N+J, the training time of KRR-DTR increases because the complexity of kernel computation is related to the dimension of the data input; the training time of DNN-DTR is almost unchanged because it mainly focuses on the numbers of training samples and epochs, and calculations related to data dimension can be ignored. Although KRR-DTR has the best performance in terms of both survival time and training cost in this simulation, it is unsuitable for large-scale data because of the high storage requirements of the kernel matrix and the high computational complexity of solving KRR problems. Thus, we develop a DKRR Q-learning approach. 1 The DNN-DRT simulation is conducted 100 times because of the high training cost. 28 Wang et al.: DQL Computational complexity of training flow in Appendix B. INDV represents the complexity of calculating each Table 3 individual item; TOT represents the total complexity of Step 6, the loop from Step 8 to Step 10, the loop from Step 12 to Step 15, and Step 17. MDj,t ,λj,t = (KDj,t,Dj,t + λ|Dj|IDj,t )−1, and (cid:126)αj,t = MDj,t ,λj,t (cid:126)Y Dj ,(cid:126)λt+1,t. Item INDV TOT Step 6 KDj,t,Dj,t MDj,t,λj,t N 2κt m2 O N 3 m3 (cid:16) N 2κt m2 + N 3 m3 + N 2 m2 (cid:126)αj,t N 2 m2 (cid:17) Steps 8–10 KDk,t,Dj,t N 2κt m2 (cid:16) N 2κt(cid:96)t O (cid:126)HDj ,k,a,t N 2 m2 m (cid:96)t (cid:17) m + N 2 Steps 12–15 (cid:126)HD,k,a,t Step 17 (cid:126)Y Dj ,(cid:126)λt,t−1 N O((cid:96)tmN ) N m O (cid:0) N m (cid:1) • Distributed Q-learning: The computational complexity of the training flow of DKRR-DTR in Appendix A is theoretically analyzed in Table 3, in which the computational complexities of Steps 6, 8–10, and 17 refer to those on each local machine, provided that parallelization is implemented. The time of data transmission in Steps 7, 9, and 14 is not considered. Thus, the training complexity of DKRR-DTR is O (cid:16) T N 3/m3 + (cid:16)(cid:80)T (cid:17) t=1 (cid:96)t(1 + κt) N 2/m + (cid:16)(cid:80)T t=1 (cid:96)t (cid:17) (cid:17) N m , where κt represents the complexity of calculating a kernel value at the tth stage and (cid:96)t represents the number of actions in the action space At. We define the function of training complexity as ΩDKRR-DTR(m) = T N 3/m3 + (cid:33) (cid:96)t(1 + κt) N 2/m + (cid:32) T (cid:88) t=1 (cid:33) (cid:96)t N m, (cid:32) T (cid:88) t=1 (27) where the first two terms are related to the training complexity on each local machine, and the last term is related to the training complexity of synthesis on the global machine. The function ΩDKRR-DTR(m) decreases and then increases as m increases because when the number m of local machines is large enough, the marginal utility of reducing the training time is very small, whereas training complexity focuses primarily on synthesis. Naturally, the number m with the smallest ΩDKRR-DTR(m) can be written as (cid:118) (cid:117) (cid:117) (cid:117) (cid:117) (cid:116) m(cid:63) = (cid:114)(cid:16)(cid:80)T t=1 (cid:96)t(1 + κt) (cid:17)2 (cid:16)(cid:80)T + 12T (cid:16)(cid:80)T 2 t=1 (cid:96)t t=1 (cid:96)t (cid:17) (cid:17) + (cid:80)T t=1 (cid:96)t(1 + κt) √ N , (28) which is a good estimate of the optimal number of local machines in parallel computing. Once the data and kernel function are provided, the complexity κt of computing a kernel value can be considered a constant related to the dimension of the data input. Wang et al.: DQL 29 Figure 4 Relation between survival time and the number of local machines for DKRR-DTR. (a) S+S (b) M+S (c) M+J (d) N+J Figure 5 Survival time of LS-DTR, DNN-DTR, and DKRR-DTR with different numbers of local machines. Figure 6 Relation between training time and the number of local machines for DKRR-DTR. (a) S+S (b) M+S (c) M+J (d) N+J To verify the above analysis of computational complexity and examine the efficacy of DKRR-DTR, we vary the number m of local machines from the set {5, 10, * * * , 500} in the simulation. Experiments are conducted on KRR-DTR with a single machine (denoted by S-KRR-DTR), in which the number of training samples is equal to that of each local machine in DKRR-DTR, to provide a baseline for assessing the performance of DKRR-DTR. The relation between survival time and the number of 0100200300400500The number of local machines1.61.651.71.751.8Survival time (year)S-KRR-DTRKRR-DTRDKRR-DTR0100200300400500The number of local machines1.61.651.71.751.8Survival time (year)S-KRR-DTRKRR-DTRDKRR-DTR0100200300400500The number of local machines1.61.651.71.751.8Survival time (year)S-KRR-DTRKRR-DTRDKRR-DTR0100200300400500The number of local machines1.61.651.71.751.8Survival time (year)S-KRR-DTRKRR-DTRDKRR-DTRS+SM+SM+JN+J1.31.41.51.61.71.81.92Survival time (year)LS-DTRDNN-DTRDKRR-DTR(10)DKRR-DTR(20)DKRR-DTR(50)DKRR-DTR(100)DKRR-DTR(300)DKRR-DTR(500)0100200300400500The number of local machines10-310-1101Training time (second)S-KRR-DTRKRR-DTRDKRR-DTREstimated m*0100200300400500The number of local machines10-310-1101Training time (second)S-KRR-DTRKRR-DTRDKRR-DTREstimated m*0100200300400500The number of local machines10-310-1101Training time (second)S-KRR-DTRKRR-DTRDKRR-DTREstimated m*0100200300400500The number of local machines10-310-1101Training time (second)S-KRR-DTRKRR-DTRDKRR-DTREstimated m* 30 Wang et al.: DQL Figure 7 Training time of LS-DTR, DNN-DTR, and DKRR-DTR with different numbers of local machines. local machines is shown in Figure 4, and the survival time of LS-DTR, DNN-DTR, and DKRR-DTR with different numbers of local machines is shown in Figure 5, in which the numbers in brackets after the notation DKRR-DTR are the numbers of local machines. The corresponding training time is shown in Figures 6 and 7. From the above results, we have the following observations: 1) As the number of local machines grows, the survival time of S-KRR-DTR decreases dramatically, since there are fewer training samples on a single machine. By contrast, the survival time of DKRR-DTR is almost unchanged; even with 500 local machines, the performance of DKRR-DTR remains superior to that of DNN-DTR and LS-DTR and is nearly identical to that of KRR-DTR, which trains all data in batch mode. 2) In all four cases, the curves of training time of DKRR-DTR drop sharply and then rise slowly as the number of local machines increases, which verifies the complexity deduced in (27). The points whose coordinates are composed of the estimated m(cid:63) by (28) and the corresponding training time of DKRR-DTR are marked by purple pentagrams in Figure 6. The training time with the estimated number m(cid:63) is very close to the minimum training time, which validates the correctness and reliability of (28). 3) The training complexity of DKRR-DTR is higher than that of S-KRR-DTR (especially for large values of m) because S-KRR-DTR does not have synthesis steps, but it is evidently lower than that of DNN-DTR, that is, the training time of DKRR-DTR is one thousandth (or even one ten thousandth) of that of DNN-DTR. When m is S+SM+SM+JN+J10-2100102104Training time (second)LS-DTRDNN-DTRDKRR-DTR(10)DKRR-DTR(20)DKRR-DTR(50)DKRR-DTR(100)DKRR-DTR(300)DKRR-DTR(500) Wang et al.: DQL 31 larger than 10, the training time of DKRR-DTR (in all cases except S+S) is even less than that of LS-DTR, whose training complexity is independent of training data size. Overall, DKRR-DTR is highly efficient in the training stage while generalizing comparably to KRR-DTR and DNN-DTR, which implies that DKRR-DTR can be applied to large-scale Q-learning problems. 5.2. Clinical trial with a large number of treatment options This simulation considers a clinical trial with a fixed length of treatment stages; each patient undergoes a treatment at a specific time point in each course (a month is a course, and a treatment is applied to the patient at the beginning of each month). The treatment set consists of a large number of dose levels that are discretized from the continuous dose-level intervals of a single drug. We design an optimal treatment strategy that considers a drug's efficacy and toxicity simultaneously to maximize the CSP after all treatment courses. We use the model proposed by Zhao et al. (2009) to simulate cancer dynamics and generate clinical trajectory data. The details of the simulated data are given in Appendix D. The action space consists of a large number of dose levels; therefore, we only consider the following cases: • The state si consists of the toxicity wi and tumor size mi at the ith stage, that is, si = (wi, mi), and the Q-function at the ith stage is estimated as a joint function of the state si and action ai; we refer to this case as "Markovian + jointly" (M+J). • The state si consists of the toxicity wi and tumor size mi at the ith stage, that is, si = (wi, mi), and the Q-function at the ith stage is estimated as a joint function of the states and actions of all stages up to stage i; we refer to this case as "non-Markovian + jointly" (N+J). The settings of this simulation are as follows. We generate N = 20000 trajectories for training and 1000 trajectories for evaluation. For KRR-DRT and DKRR-DRT, the parameter λ is chosen from the set { 1 2q | 100 N > 1 2q > 1 10N , q = 0, 1, 2, * * * }, and the kernel width σ is chosen from a set of 20 values drawn in an equally spaced logarithmic interval [0.01, 10]. For DNN-DRT, the parameter ranges are the same as those in Section 5.1. The expected CSP value is estimated using the mean CSP value of the 1000 patients. The simulation is conducted 100 times for each method with the best 32 Wang et al.: DQL Figure 8 CSP and training time of methods with batch-mode training of all data. (a) CSP (b) Training time parameters, and the average value of the estimated mean CSP is reported for comparison.2 We also give some comparisons from aspects of nondistributed and distributed Q-learning approaches. • Nondistributed Q-learning: We compare LS-DTR, DNN-DTR, and KRR-DTR with 10 fixed treatments whose dose levels range from 0.1 to 1.0 in increments of 0.1. Comparisons of the CSP and training time are shown in Figure 8, where the light and dark shades of each color series represent the cumulative cured probability (CCP) and trial end probability (TEP) of the compared methods. Here, the CCP is the proportion of patients cured in the treatment cycle, and TEP is the proportion of patients alive but not cured at the end of the trial. From the results, we obtain the following observations: 1) Some fixed treatments, such as dose levels of 0.3 − 0.6, have good CSP values and even outperform LS-DTR in the case of M+J. However, their CCP values are evidently lower than those of Q-learning methods. The CCP is usually more important than TEP because patients prefer to be cured in the treatment cycle. Hence, RL can provide effective treatment policies for life-threatening diseases. 2) Among the three Q-learning methods, DNN-DTR performs the best because of its excellent nonlinear fitting capability, although it has the longest training time. LS-DTR has the shortest training time; the CSP value of LS-DTR in the case of N+J is significantly better than that in M+J due to the expansion of the linear hypothesis space (the dimension of data 2 The DNN-DRT and DKRR-DTR simulations are conducted 20 times. 0.10.20.30.40.50.60.70.80.91.0M+JN+J51015202530354045CSP (%)LS-DTRDNN-DTRKRR-DTRM+JN+J10-1100101102103104Training time (second)LS-DTRDNN-DTRKRR-DTR Wang et al.: DQL 33 Figure 9 Relation between CSP (training time) and the number of local machines in DKRR-DTR. (a) M+J (b) N+J (c) M+J (d) N+J Figure 10 CSP and training time of LS-DTR, DNN-DTR, and DKRR-DTR with different numbers of local machines. (a) CSP (b) Training time input grows with the number of stages in N+J), but LS-DTR still has the lowest CSP values and the highest standard deviations. KRR-DTR is a compromise between the CSP and training time; its CSP value is slightly smaller than that of DNN-DTR, but it is more efficient than DNN-DTR. The CSP values of DNN-DTR and KRR-DTR in N+J are slightly smaller than those in M+J. This may be because the Markovian assumption holds for this simulation, and training DNN and KRR using data with large dimensions is difficult. The advantage of KRR-DTR over DNN-DTR in terms of training time is not particularly significant because the training complexity of KRR-DTR is proportional to the cube of the number of training samples, making DKRR-DTR imperative. • Distributed Q-learning: The efficiency and effectiveness of DKRR-DTR are evaluated by varying the number m of local machines from the set {2, 4, * * * , 100} in the simulation. The relationship 20406080100The number of local machines2730333639CSP (%)S-KRR-DTRKRR-DTRDKRR-DTR20406080100The number of local machines2830323436CSP (%)S-KRR-DTRKRR-DTRDKRR-DTR20406080100The number of local machines10-1101103Training time (second)S-KRR-DTRKRR-DTRDKRR-DTR20406080100The number of local machines10-1101103Training time (second)S-KRR-DTRKRR-DTRDKRR-DTRM+JN+J101520253035404550CSP (%)LSDNNDKRR(10)DKRR(20)DKRR(30)DKRR(40)DKRR(50)DKRR(70)DKRR(100)M+JN+J10-1100101102103104Training time (second)LSDNNDKRR(10)DKRR(20)DKRR(30)DKRR(40)DKRR(50)DKRR(70)DKRR(100) 34 Wang et al.: DQL of the CSP and training time against the number of local machines is shown in Figure 9, and comparisons of the CSP and training time of LS-DTR, DNN-DTR, and DKRR-DTR with different numbers of local machines are shown in Figure 10, in which LS-DTR, DNN-DTR, and DKRR-DTR are abbreviated as LS, DNN, and DKRR, respectfully, for brevity. Based on the above results, we have the following assertions: 1) The CSP value of DKRR-DTR decreases slowly as the number m of local machines increases; even m reaches 40, it is still satisfactory compared with KRR-DTR with batch-mode training of all data. Moreover, the increasing m greatly reduces training complexity, which overcomes the drawback of KRR-DTR. 2) Although DNN-DTR has a better CSP than DKRR-DTR, its training time is several orders of magnitude larger than that of DKRR-DTR. DKRR-DTR gives a perfect balance between training complexity and generalization performance, which makes it feasible and effective to implement Q-learning with large amounts of data. These simulations illustrate that DKRR-DTR has higher efficiency and superior performance in dealing with large-scale Q-learning problems compared with state-of-the-art methods, such as LS-DTR and DNN-DTR. References Almirall D, Chronis-Tuscano A (2016) Adaptive interventions in child and adolescent mental health. Journal of Clinical Child and Adolescent Psychology 45(4):383–395. Bastani H, Bayati M (2020) Online decision making with high-dimensional covariates. Operations Research 68(1):276–294. Blanchard G, Kr ̈amer N (2016) Convergence rates of kernel conjugate gradient for random design regression. Analysis and Applications 14(06):763–794. Breiman L (2001) Random forests. Machine Learning 45:5–32. Breiman L, Friedman JH, Olshen R, Stone C (1984) Classification and Regression Trees (Monterey: CRC Press). Caponnetto A, De Vito E (2007) Optimal rates for the regularized least-squares algorithm. Foundations of Computational Mathematics 7(3):331–368. Wang et al.: DQL 35 Chakraborty B, Moodie EEM (2013) Statistical Reinforcement Learning (New York: Springer). Chakraborty B, Murphy SA (2014) Dynamic treatment regimes. Annual Review of Statistics and Its Application 1:447–464. Chang X, Lin SB, Zhou DX (2017) Distributed semi-supervised learning with kernel ridge regression. The Journal of Machine Learning Research 18(1):1493–1514. Consortium IWP (2009) Estimation of the warfarin dose with clinical and pharmacogenetic data. New England Journal of Medicine 360(8):753–764. Cucker F, Zhou DX (2007) Learning Theory: An Approximation Theory Viewpoint, volume 24 (Cambridge University Press). Ernst D, Geurts P, Wehenkel L (2005) Tree-based batch mode reinforcement learning. Journal of Machine Learning Research 6:503–556. Even-Dar E, Mansour Y (2003) Learning rates for q-learning. Journal of Machine Learning Research 5(Dec):1– 25. Evgeniou T, Pontil M, Poggio T (2000) Regularization networks and support vector machines. Advances in Computational Mathematics 13(1):1–50. Fan J, Yang Z, Xie Y, Wang Z (2020) A theoretical analysis of deep q-learning. arXiv preprint arXiv:1901.00137v3 . Fran ̧cois-Lavet V, Henderson P, Islam R, Bellemare MG, Pineau J, et al. (2018) An introduction to deep reinforcement learning. Foundations and Trends in Machine Learning 11(3-4):219–354. Friedman JH (1991) Multivariate adaptive regression splines. The Annals of Statistics 19(1):1–67. Gittens A, Mahoney MW (2016) Revisiting the nystr ̈om method for improved large-scale machine learning. The Journal of Machine Learning Research 17(1):3977–4041. Glorot X, Bengio Y (2010) Understanding the difficulty of training deep feedforward neural networks. Proceedings of the 13th International Conference on Artificial Intelligence and Statistics, 249--356 (Sardinia, Italy). Goldberg Y, Kosorok MR (2012) Q-learning with censored data. The Annals of Statistics 40(1):529–560. 36 Wang et al.: DQL Goodfellow I, Bengio Y, Courville A (2016) Deep Learning (MIT Press). Gosavi A (2009) Reinforcement learning: A tutorial survey and recent advances. INFORMS Journal on Computing 21(2):178–192. Guo ZC, Lin SB, Zhou DX (2017) Learning theory of distributed spectral algorithms. Inverse Problems 33(7):074009. Gy ̈orfi L, Kohler M, Krzyzak A, Walk H (2006) A Distribution-Free Theory of Nonparametric Regression (Springer Science & Business Media). Humphrey K (2017) Using reinforcement learning to personalize dosing strategies in a simulated cancer trial with high dimensional data. Master's thesis, The University of Arizona, Tucson, URL http: //hdl.handle.net/10150/625341. Ishigooka J, Murasaki M, Miura S, Group TOLPIS (2000) Olanzapine optimal dose: Results of an open-label multicenter study in schizophrenic patients. Psychiatry and Clinical Neurosciences 54(4):467–478. Kalashnikov D, Irpan A, Pastor P, Ibarz J, Herzog A, Jang E, Quillen D, Holly E, Kalakrishnan M, Vanhoucke V, et al. (2018) Qt-opt: Scalable deep reinforcement learning for vision-based robotic manipulation. arXiv preprint arXiv:1806.10293 . Kearns MJ, Singh SP (1999) Finite-sample convergence rates for q-learning and indirect algorithms. Advances in Neural Information Processing Systems, 996–1002. Kraus M, Feuerriegel S, Oztekin A (2020) Deep learning in business analytics and operations research: Models, applications and managerial implications. European Journal of Operational Research 281(3):628–641. Lavori PW, Dawson R (2008) Adaptive treatment strategies in chronic disease. Annual Review of Medicine 59(1):443–453. Lin SB, Guo X, Zhou DX (2017) Distributed learning with regularized least squares. The Journal of Machine Learning Research 18(1):3202–3232. Lin SB, Wang D, Zhou DX (2020) Distributed kernel ridge regression with communications. J. Mach. Learn. Res. 21:93–1. Lin SB, Zhou DX (2018) Distributed kernel-based gradient descent algorithms. Constructive Approximation 47(2):249–276. Wang et al.: DQL 37 Liu S, Su H (2022) Provably efficient kernelized q-learning. arXiv preprint arXiv:2204.10349 . Lu S, Math ́e P, Pereverzev SV (2020) Balancing principle in supervised learning for a general regularization scheme. Applied and Computational Harmonic Analysis 48(1):123–148. Marik PE, Linde-Zwirble WT, Bittner EA, Sahatjian J, Hansell D (2017) Fluid administration in severe sepsis and septic shock, patterns and outcomes: an analysis of a large national database. Intensive care medicine 43(5):625–632. Meister M, Steinwart I (2016) Optimal learning rates for localized svms. The Journal of Machine Learning Research 17(1):6722–6765. Moore BL, Pyeatt LD, Kulkarni V, Panousis P, Padrez K, Doufas AG (2014) Reinforcement learning for closed-loop propofol anesthesia: a study in human volunteers. The Journal of Machine Learning Research 15(1):655–696. Moore BL, Quasny TM, Doufas AG (2011) Reinforcement learning versus proportional–integral–derivative control of hypnosis in a simulated intraoperative patient. Anesthesia & Analgesia 112(2):350–359. M ̈ucke N, Blanchard G (2018) Parallelizing spectrally regularized kernel algorithms. The Journal of Machine Learning Research 19(1):1069–1097. Murphy SA (2005a) An experimental design for the development of adaptive treatment strategies. Statistics in medicine 24(10):1455–1481. Murphy SA (2005b) A generalization error for q-learning. Journal of Machine Learning Research 6(Jul):1073– 1097. Oh EJ, Qian M, Cheung YK (2022) Generalization error bounds of dynamic treatment regimes in penalized regression-based learning. The Annals of Statistics 50(4):2047–2071. Oroojlooyjadid A, Nazari M, Snyder LV, Tak ́aˇc M (2022) A deep q-network for the beer game: Deep reinforcement learning for inventory optimization. Manufacturing & Service Operations Management 24(1):285–304. Padmanabhan R, Meskin N, Haddad WM (2017) Reinforcement learning-based control of drug dosing for cancer chemotherapy treatment. Mathematical Biosciences 293:11–20. 38 Wang et al.: DQL Peters J, Schaal S (2008) Reinforcement learning of motor skills with policy gradients. Neural Networks 21(4):682–697. Pinelis I (1994) Optimum bounds for the distributions of martingales in banach spaces. The Annals of Probability 1679–1706. Qian M, Murphy SA (2011) Performance guarantees for individualized treatment rules. Annals of Statistics 39(2):1180. Raghu A, Komorowski M, Celi LA, Szolovits P, Ghassemi M (2017) Continuous state-space models for optimal sepsis treatment: a deep reinforcement learning approach. Machine Learning for Healthcare Conference, 147--163 (Boston, MA). Rudi A, Camoriano R, Rosasco L (2015) Less is more: Nystr ̈om computational regularization. NIPS, 1657–1665. Sabry M, Khalifa A (2019) On the reduction of variance and overestimation of deep q-learning. arXiv preprint arXiv:1910.05983 . Schultz L, Sokolov V (2018) Deep reinforcement learning for dynamic urban transportation problems. arXiv preprint arXiv:1806.05310 . Shi L (2019) Distributed learning with indefinite kernels. Analysis and Applications 17(06):947–975. Smale S, Zhou DX (2004) Shannon sampling and function reconstruction from point values. Bulletin of the American Mathematical Society 41(3):279–305. Smale S, Zhou DX (2005) Shannon sampling ii: Connections to learning theory. Applied and Computational Harmonic Analysis 19(3):285–302. Sugiyama M (2015) Statistical Reinforcement Learning: Modern Machine Learning Approaches (CRC Press). Sutton RS, Barto AG (2018) Reinforcement Learning: An Introduction (MIT press). Tseng HH, Luo Y, Cui S, Chien JT, Ten Haken RK, Naqa IE (2017) Deep reinforcement learning for automated radiation adaptation in lung cancer. Medical Physics 44(12):6690––6705. Tsiatis AA, Davidian M, Holloway ST, Laber EB (2019) Dynamic Treatment Regimes: Statistical Methods for Precision Medicine (Chapman and Hall/CRC). Wang et al.: DQL 39 Vapnik V, Golowich SE, Smola AJ (1996) Support vector method for function approximation regression estimation and signal processing. Advances in Neural Information Processing Systems 9, 281–287 (MIT Press). Wahba G (1990) Spline Models for Observational Data (SIAM). Wainwright MJ (2019) Variance-reduced q-learning is minimax optimal. arXiv preprint arXiv:1906.04697 . Watkins CJ, Dayan P (1992) Q-learning. Machine Learning 8(3-4):279–292. Xu X, Hu D, Lu X (2007) Kernel-based least squares policy iteration for reinforcement learning. IEEE Transactions on Neural Networks 18(4):973–992. Xu X, Xie T, Hu D, Lu X (2005) Kernel least-squares temporal difference learning. International Journal of Information Technology 11(9):54–63. Yoganarasimhan H (2020) Search personalization using machine learning. Management Science 66(3):1045– 1070. Yu C, Liu J, Nemati S, Yin G (2021) Reinforcement learning in healthcare: A survey. ACM Computing Surveys (CSUR) 55(1):1–36. Zhang Y, Duchi J, Wainwright M (2015) Divide and conquer kernel ridge regression: A distributed algorithm with minimax optimal rates. The Journal of Machine Learning Research 16(1):3299–3340. Zhao X, Zhang L, Xia L, Ding Z, Yin D, Tang J (2017) Deep reinforcement learning for list-wise recommen- dations. arXiv preprint arXiv:1801.00209 . Zhao Y, Kosorok MR, Zeng D (2009) Reinforcement learning design for cancer clinical trials. Statistics in Medicine 28(26):3294–3315. Zhao Y, Zeng D, Socinski MA, Kosorok MR (2011) Reinforcement learning strategies for clinical trials in nonsmall cell lung cancer. Biometrics 67(4):1422–1433. 40 Appendix A: Proofs Wang et al.: DQL This appendix validates our main theoretical results. In the proof, we develop a novel integral operator approach for Q-learning. Our main tools are error decomposition for KRR-DTR and DKRR-DTR based on their operator representations and uniform bounds for KRR-DTR and DKRR-DTR estimators. A.1. Operator representations and differences The core of the integral operator approach developed in (Smale and Zhou 2005, Caponnetto and De Vito 2007), and (Lin et al. 2017) is the operator representation of kernel-based learning algorithms, error decomposition, and tight bounds of operator differences. For each t = 1, . . . , T , let SD,t : HK,t → R|D| be the sampling operator defined by SD,tQt := (Qt(xi,t))|D| i=1. Its scaled adjoint ST D,t : R|D| → HK,t (c1, c2, . . . , c|D|)T ∈ R|D|. Define is given by ST D,tc := 1 |D| (cid:80)|D| i=1 ciKxi,t for Kx = K(x, *) and c := LK,D,tQt := ST D,tSD,tQt = 1 |D| |D| (cid:88) i=1 Qt(xi,t)Kxi,t. Then, QD,λt,t, defined by (9), can be analytically represented as (Smale and Zhou 2005) QD,λt,t = (LK,D,t + λtI)−1 ST D,tyD,t, (29) where yD,λt,t := (y1,t, . . . , y|D|,t)T . Define ˆQD,λt,t := (LK,D,t + λtI)−1 ST D,ty∗ D,t, Q(cid:5) D,λt,t := (LK,D,t + λtI)−1 LK,D,tQ∗ t , (30) where y∗ D,t = (y∗ 1,t, . . . , y∗ |D|,t)T . Then ˆQD,λt,t can be regarded as running KRR on the data set {(xi,t, y∗ i,t)}|D| i=1, while Q(cid:5) D,λt,t is a noise-free version of ˆQD,λt,t. Let ˆQDj ,λt,t := (cid:0)LK,Dj ,t + λtI(cid:1)−1 ST Dj ,ty∗ Dj ,t, Dj ,λt,t := (cid:0)LK,Dj ,t + λtI(cid:1)−1 LK,Dj ,tQ∗ Q(cid:5) t (31) be the corresponding local estimators for ˆQD,λt,t and Q(cid:5) D,λt,t, respectively. Define further Q⊕ D,λt,t = (LK,t + λtI)−1ST D,tyt as the batch version of QDj ,λt,t, where yt = (y1,t, . . . , y|D|,t)T with yi,t := ri,t + max at+1∈At QD,λt+1,t+1(si,1:t+1, ai,1:t, at+1). (32) (33) Wang et al.: DQL 41 It is obvious that Q⊕ D,λt,t is different from QD,λt,t due to their different outputs of data. Denote Q(cid:63) D,λt,t(xi,t) := E[Yi,t|Xt = xi,t] = E[R(Xt, ST +1) + max at+1 QD,λt+1,t+1(Xt, ST +1, at+1)|Xt = xi,t], (34) and (cid:63) Q D,λt,t(xi,t) := E[Y t|Xt = xi,t] = E[R(Xt, ST +1) + max at+1 QD,λt+1,t+1(Xt, ST +1, at+1)|Xt = xi,t]. (35) The basic idea of our analysis is to develop novel error decomposition strategies to divide (cid:107)QD,λt,t − Q∗ t (cid:107)L2 t into differences among QD,λt,t, Q⊕ D,λt,t, ˆQD,λt,t, Q(cid:5) D,λt,t and QD,λt,t, which can be bounded by the difference between LK,D,t and LK,t. For this purpose, write WD,λt,t := (cid:107)(LK,t + λtI)−1/2(LK,t − LK,D,t)(LK,t + λtI)−1/2(cid:107), AD,λt,t := (cid:107)((LK,t + λtI)1/2 (LK,D,t + λtI)−1 ((LK,t + λtI)1/2 (cid:107), UD,λt,t,f := (cid:107)(LK,t + λtI)−1/2(LK,t − LK,D,t)f (cid:107)K,t, , PD,λt,t := (cid:107)((LK,t + λtI)−1/2 (ST D,ty∗ D,t − LK,D,tQ∗ t )(cid:107)K,t, S D,λt,t := (cid:107)((LK,t + λtI)−1/2 (cid:0)ST D,t(y∗ D,t − yD,t) − LK,D,t(Q∗ (cid:63) t − Q D,λt,t)(cid:1) (cid:107)K,t, SD,λt,t := (cid:107)((LK,t + λtI)−1/2 (cid:0)ST D,t(y∗ D,t − yt,λt,D) − LK,D,t(Q∗ t − Q(cid:63) D,λt,t)(cid:1) (cid:107)K,t. (36) (37) (38) (39) (40) (41) Our road-map of proofs is to first decompose the generalization error into differences among QD,λt,t, Q⊕ D,λt,t, ˆQD,λt,t, Q(cid:5) D,λt,t, and QD,λt,t, and then quantify the differences via the above six terms, and finally derive tight estimates of these terms via some statistical tools. A.2. Error decomposition for KRR-DTR In this subsection, we present an error decomposition and then derive an oracle inequality for KRR-DTR. Due to the triangle inequality, we get the following error decomposition directly. Proposition 1. For any 1 ≤ t ≤ T , we have (cid:107)(LK,t + λtI)1/2(QD,λt,t − Q∗ t )(cid:107)K,t ≤ (cid:107)(LK,t + λtI)1/2(Q(cid:5) D,λt,t − Q∗ t )(cid:107)K,t + (cid:107)(LK,t + λtI)1/2(Q(cid:5) D,λt,t − ˆQD,λt,t)(cid:107)K,t + (cid:107)(LK,t + λtI)1/2(QD,λt,t − ˆQD,λt,t)(cid:107)K,t. (42) We call the three terms on the right-hand side of (42) as the approximation error, sample error, and multi- stage error, respectively. The approximation error, together with some regularity of the optimal Q-functions, describes the approximation capability of the RKHS HK,t. The sample error quantifies the gap between KRR 42 Wang et al.: DQL with the theoretically optimal outputs Q∗ t and KRR with noisy optimal outputs y∗ t . The multi-stage error, exclusive to Q-learning, shows the difficulty of Q-learning in circumventing its multi-stage nature. The bounds of approximation error and sample error are standard and can be derived via the recently developed integral operator approach in (Blanchard and Kr ̈amer 2016, Guo et al. 2017, Lin et al. 2020). Lemma 1. Under Assumption 4 with 1 2 ≤ r ≤ 1, we have (cid:107)(LK,t + λtI)1/2(Q(cid:5) D,λt,t − Q∗ t )(cid:107)K,t ≤ λr t AD,λt,t(cid:107)ht(cid:107)L2 t , ∀ t = 1, . . . , T. (43) Proof. For any t = 1, . . . , T, (30) implies Q(cid:5) D,λt,t − Q∗ t = ((LK,D,t + λtI)−1 LK,D,t − I)Q∗ t = λt (LK,D,t + λtI)−1 Q∗ t . Then it follows from (37), Assumption 4, (cid:107)Af (cid:107)K ≤ (cid:107)A(cid:107)(cid:107)f (cid:107)K for positive operator A, and the fact (cid:107)L1/2 K,tf (cid:107)K,t = (cid:107)f (cid:107)L2 t that (cid:107)(LK,t + λtI)1/2(Q(cid:5) D,λt,t − Q∗ t )(cid:107)K,t ≤ λt(cid:107)(LK,t + λtI)1/2 (LK,D,t + λtI)−1 (LK,t + λtI)r−1/2(cid:107)(cid:107)L1/2 K,tht(cid:107)K ≤ λr t (cid:107)(LK,t + λtI)1/2 (LK,D,t + λtI)−1 (LK,t + λtI)1/2(cid:107)(cid:107)ht(cid:107)L2 t ≤ λr t AD,λt,t(cid:107)ht(cid:107)L2 . t This completes the proof of Lemma 1. (cid:3) Lemma 2. For any t = 1, . . . , T , it holds that (cid:107)(LK,t + λtI)1/2(Q(cid:5) D,λt,t − ˆQD,λt,t)(cid:107)K,t ≤ AD,λt,tPD,λt,t. (44) Proof. For any t = 1, . . . , T, it follows from (30) that ˆQD,λt,t − Q(cid:5) D,λt,t = (LK,D,t + λtI)−1 (ST D,ty∗ D,t − LK,D,tQ∗ t ). Then, (39), (37), (cid:107)Af (cid:107)K ≤ (cid:107)A(cid:107)(cid:107)f (cid:107)K for positive operator A, and the fact (cid:107)L1/2 K,tf (cid:107)K,t = (cid:107)f (cid:107)L2 yield t (cid:107)(LK,t + λtI)1/2(Q(cid:5) D,λt,t − ˆQD,λt,t)(cid:107)K,t ≤ (cid:107)(LK,t + λI)1/2 (LK,D,t + λtI)−1 (LK,t + λI)1/2(cid:107)(cid:107)(LK,t + λI)−1/2(ST D,ty∗ D,t − LK,D,tQ∗ t )(cid:107)K ≤ AD,λt,tPD,λt,t. This completes the proof of Lemma 2. (cid:3) The bounding of the multi-stage error is more sophisticated, as collected in the following lemma. Wang et al.: DQL Lemma 3. Under Assumption 2, for any t = 1, . . . , T , it holds that (cid:107)(LK,t + λtI)1/2(QD,λt,t − ˆQD,λt,t)(cid:107)K,t ≤ AD,λt,tSD,λ,t + AD,λt,tUD,λt,t,Q∗ t −Q(cid:63) D,λt,t + μ1/2AD,λt,t(cid:107)QD,λt+1,t+1 − Q∗ t+1(cid:107)L2 t+1 43 . (45) Proof. Due to (29) and (30), we have (cid:107)(LK,t + λtI)1/2(QD,λt,t − ˆQD,λt,t)(cid:107)K,t = ≤ + + (cid:13) (cid:13)(LK,t + λI)1/2((LK,D,t + λtI)−1 (cid:0)ST (cid:13) (cid:13) (cid:13)(LK,t + λI)1/2 (LK,D,t + λtI)−1 (LK,D,t − LK,t)(Q∗ (cid:13) (cid:13) (cid:13) (cid:13)(LK,t + λI)1/2 (LK,D,t + λtI)−1 LK,t(Q∗ (cid:13) (cid:13) D,λt,t) (cid:13)K,t t − Q(cid:63) D,t(y∗ t − Q(cid:63) . (cid:13) (cid:13) D,λt,t) (cid:13)K,t (cid:13) (cid:13)(LK,t + λI)1/2((LK,D,t + λtI)−1 ST (cid:13) D,λt,t)(cid:1)(cid:13) (cid:13) (cid:13)K,t D,t − yD,t) − LK,D,t(Q∗ t − Q(cid:63) D,t(y∗ (cid:13) (cid:13) D,t − yD,t) (cid:13)K,t It then follows from (37) and (41) that (cid:107)(LK,t + λI)1/2((LK,D,t + λtI)−1 (cid:0)ST D,t(y∗ D,t − yD,t) − LK,D,t(Q∗ t − Q(cid:63) D,λt,t)(cid:1) (cid:107)K,t ≤ AD,λt,tSD,λt,t. (46) (47) Furthermore, (37) and (38) yield (cid:13) (cid:13)(LK,t + λI)1/2 (LK,D,t + λtI)−1 (LK,D,t − LK,t)(Q∗ (cid:13) t − Q(cid:63) (cid:13) (cid:13) D,λt,t) (cid:13)K,t ≤ AD,λt,tUD,λt,t,Q∗ t −Q(cid:63) D,λt,t . (48) To bound the last term in (46), we notice (cid:13) (cid:13)(LK,t + λI)1/2 (LK,D,t + λtI)−1 LK,t(Q∗ (cid:13) t − Q(cid:63) (cid:13) (cid:13) D,λt,t) (cid:13)K,t ≤ AD,λt,t(cid:107)L1/2 K,t(Q∗ t − Q(cid:63) D,λt,t)(cid:107)K,t = AD,λt,t(cid:107)Q∗ t − Q(cid:63) D,λt,t(cid:107)L2 t . But Assumption 2, (4), (34), and (16) show D,λt,t(cid:107)2 L2 t (cid:107)Q∗ t − Q(cid:63) (cid:34)(cid:18) = E (cid:2)(Q(cid:63) D,λt,t(Xt) − Q∗ t (Xt))2|D(cid:3) = E max at+1 QD,λt+1,t+1(S1:t+1, A1:t, at+1) − max at+1 Q∗ t+1(S1:t+1, A1:t, at+1) (cid:19)2 (cid:35) |D (cid:0)QD,λt+1,t+1(S1:t+1, A1:t, at+1) − Q∗ t+1(S1:t+1, A1:t, at+1)(cid:1)2 |D (cid:21) (cid:20) ≤ E max at+1  ≤ E μ (cid:88) a∈At+1 (cid:0)QD,λt+1,t+1(S1:t+1, A1:t, a) − Q∗ t+1(S1:t+1, A1:t, a)(cid:1)2 pt(a|S1:t+1, A1:t)(cid:12) (cid:12)D   = μE (cid:104)(cid:0)QD,λt+1,t+1 − Q∗ t+1 (cid:105) (cid:1)2 |D Therefore, = μ(cid:107)QD,λt+1,t+1 − Q∗ t+1(cid:107)2 L2 t+1 . (cid:13) (cid:13)(LK,t + λI)1/2 (LK,D,t + λtI)−1 LK,t(Q∗ (cid:13) t − Q(cid:63) (cid:13) (cid:13) D,λt,t) (cid:13)K,t ≤ μ1/2AD,λt,t(cid:107)QD,λt+1,t+1 − Q∗ t+1(cid:107)L2 t+1 . (49) 44 Wang et al.: DQL Plugging (47), (48), (49) into (46), we obtain (45) directly. This finishes the proof of Lemma 3. (cid:3) Using Proposition 1, Lemma 1, Lemma 2 and Lemma 3, we can derive the following oracle inequality for KRR-DTR. Proposition 2. Under Assumption 2 and Assumption 4 with 1 2 ≤ r ≤ 1, we have (cid:107)(LK,t + λtI)1/2(QD,λt,t − Q∗ t )(cid:107)K,t T (cid:88) (cid:16) ≤ (cid:96)=t μ 1 2 AD,λ(cid:96),(cid:96) (cid:17)(cid:96)−t AD,λ(cid:96),(cid:96) (cid:16) λr t (cid:107)ht(cid:107)L2 t + PD,λ(cid:96),(cid:96) + SD,λ(cid:96),(cid:96) + UD,λ(cid:96),(cid:96),Q∗ (cid:96) −Q(cid:63) D,λ(cid:96) ,(cid:96) (cid:17) . Proof. Inserting (43), (44) and (45) into (42), we obtain for any t = 1, 2, . . . , T , (cid:107)(LK,t + λtI)1/2(QD,λt,t − Q∗ t )(cid:107)K,t ≤ AD,λt,t (cid:16) λr t (cid:107)ht(cid:107)L2 t + PD,λt,t + SD,λt,t + UD,λt,t,Q∗ t −Q(cid:63) D,λt,t (cid:17) + μ 1 2 AD,λt,t(cid:107)QD,λt+1,t+1 − Q∗ t+1(cid:107)L2 . t+1 It then follows from QD,λT +1,T +1 = Q∗ T +1 = 0 that (cid:107)(LK,t + λtI)1/2(QD,λt,t − Q∗ t )(cid:107)L2 t T (cid:88) (cid:16) ≤ (cid:96)=t μ 1 2 AD,λ(cid:96),(cid:96) (cid:17)(cid:96)−t AD,λ(cid:96),(cid:96) (cid:16) λr t (cid:107)ht(cid:107)L2 t Then the proof of Proposition 2 is completed. (cid:3) A.3. Error decomposition for DKRR-DTR + PD,λ(cid:96),(cid:96) + SD,λ(cid:96),(cid:96) + UD,λ(cid:96),(cid:96),Q∗ (cid:96) −Q(cid:63) D,λ(cid:96) ,(cid:96) (cid:17) . The generalization error of DKRR-DTR also requires an error decomposition, as shown in the following proposition. Proposition 3. For any 1 ≤ t ≤ T , it holds that (cid:107)(LK,t + λtI)1/2(QD,λt,t − Q∗ t )(cid:107)K,t ≤ m (cid:88) j=1 |Dj| |D| WDj ,λt,t(cid:107)(LK,t + λtI)1/2(QDj ,λt,t − Q∗ t )(cid:107)K,t + UD,λt,t,Q∗ t + (cid:13) (cid:13)Q⊕ D,λt,t − Q∗ t (cid:13) (cid:13)L2 t . Proof. Similar to (29), it follows from (13) and (14) that QD,λt,t = m (cid:88) j=1 |Dj| |D| (LK,Dj ,t + λtI)−1ST Dj ,tyj,t, where yj,t := (y1,j,t, . . . , y|Dj |,j,t)T . Then t )(cid:107)K,t m (cid:88) (cid:107)(LK,t + λtI)1/2(QD,λt,t − Q∗ (cid:13) (cid:13) (cid:13) (LK,t + λtI)1/2 (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (LK,t + λtI)1/2 (cid:13) (cid:13) |Dj| |D| |Dj| |D| m (cid:88) j=1 j=1 ≤ + (cid:0)(LK,Dj ,t + λtI)−1 − (LK,t + λtI)−1(cid:1) ST Dj ,tyj,t (LK,t + λtI)−1ST Dj ,tyj,t − Q∗ t (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)K,t . (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)K,t Wang et al.: DQL But and ((LK,Dj ,t + λtI)−1 − (LK,t + λtI)−1)ST Dj ,tyj,t = (LK,t + λtI)−1(LK,t − LK,Dj ,t)QDj ,λt,t = (LK,t + λtI)−1(LK,t − LK,Dj ,t)(QDj ,λt,t − Q∗ t ) + (LK,t + λtI)−1(LK,t − LK,Dj ,t)Q∗ t , m (cid:88) j=1 |Dj| |D| (LK,t + λtI)−1ST Dj ,tyj,t = (LK,t + λtI)−1ST D,tyt, m (cid:88) j=1 |Dj| |D| (LK,t + λtI)−1(LK,t − LK,Dj ,t)Q∗ t = (LK,t + λtI)−1(LK,t − LK,D,t)Q∗ t . Therefore, Jensen's inequality together with (32) yields (cid:107)(LK,t + λtI)1/2(QD,λt,t − Q∗ t )(cid:107)K,t ≤ (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) m (cid:88) j=1 |Dj| |D| (LK,t + λtI)−1/2(LK,t − LK,Dj ,t)(QDj ,λt,t − Q∗ t ) + (cid:13) (cid:13)(LK,t + λtI)−1/2(LK,t − LK,D,t)Q∗ t (cid:13) (cid:13)L2 t + (cid:13) (cid:13)(LK,t + λtI)1/2(Q⊕ D,λt,t − Q∗ t )(cid:13) (cid:13)K,t (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)L2 t ≤ m (cid:88) j=1 |Dj| |D| WDj ,λt,t(cid:107)(LK,t + λtI)1/2(QDj ,λt,t − Q∗ t )(cid:107)K,t + UD,λt,t,Q∗ t This completes the proof of Proposition 3. (cid:3) + (cid:13) (cid:13)(LK,t + λtI)1/2(Q⊕ D,λt,t − Q∗ t )(cid:13) (cid:13)K,t 45 . Our following lemma presents an upper bound of (cid:13) (cid:13)(LK,t + λtI)1/2(Q⊕ D,λt,t − Q∗ t )(cid:13) (cid:13)K,t . Lemma 4. Under Assumption 2 and Assumption 4 with 1 2 ≤ r ≤ 1, for any t = 1, . . . , t, it holds that (cid:13) (cid:13)(LK,t + λtI)1/2(Q⊕ D,λt,t − Q∗ t )(cid:13) (cid:13)K,t ≤ AD,λt,t (cid:16) λr t (cid:107)ht(cid:107)L2 t + PD,λt,t + S D,λt,t + UD,λt,t,Q∗ t −Q(cid:63) D,λt,t (cid:17) + μ1/2AD,λt,t(cid:107)QD,λt+1,t+1 − Q∗ t+1(cid:107)L2 t+1 . Proof. The proof of the lemma is almost the same as that in bounding (cid:107)(LK,t + λtI)1/2(QD,λt,t − Q∗ t )(cid:107)K,t in the previous subsection. For the sake of completeness, we sketch the proof. Due to the triangle inequality, it holds that (cid:13) (cid:13)(LK,t + λtI)1/2(Q⊕ D,λt,t − Q∗ t )(cid:13) (cid:13)K,t ≤ (cid:107)(LK,t + λtI)1/2(Q(cid:5) D,λt,t − Q∗ t )(cid:107)K,t + (cid:107)(LK,t + λtI)1/2(Q(cid:5) D,λt,t − ˆQD,λt,t)(cid:107)K,t + (cid:107)(LK,t + λtI)1/2(Q⊕ D,λt,t − ˆQD,λt,t)(cid:107)K,t. Then, it follows from Lemma 1 and Lemma 2 that (cid:13) (cid:13)(LK,t + λtI)1/2(Q⊕ D,λt,t − Q∗ t )(cid:13) (cid:13)K,t ≤ λr t AD,λt,t(cid:107)ht(cid:107)L2 + AD,λt,tPD,λt,t t + (cid:107)(LK,t + λtI)1/2(Q⊕ D,λt,t − ˆQD,λt,t)(cid:107)K,t. 46 Wang et al.: DQL Similar as the approach in proving Lemma 3, we obtain from (32) and (30) that (cid:107)(LK,t + λtI)1/2(Q⊕ D,λt,t − ˆQD,λt,t)(cid:107)K,t ≤ + + (cid:13) (cid:13)(LK,t + λI)1/2((LK,D,t + λtI)−1 (cid:0)ST (cid:13) (cid:13) (cid:13)(LK,t + λI)1/2 (LK,D,t + λtI)−1 (LK,D,t − LK,t)(Q∗ (cid:13) (cid:13) (cid:13) (cid:13)(LK,t + λI)1/2 (LK,D,t + λtI)−1 LK,t(Q∗ (cid:13) (cid:13) D,λt,t) (cid:13)K,t (cid:63) t − Q D,t(y∗ (cid:63) t − Q (cid:13) (cid:13) D,λt,t) (cid:13)K,t D,t − yt,D) − LK,D,t(Q∗ (cid:63) t − Q D,λt,t)(cid:1)(cid:13) (cid:13) (cid:13)K,t ≤ AD,λt,tS D,λt,t + AD,λt,tUD,λt,t,Q∗ t −Q(cid:63) D,λt,t + μ1/2AD,λt,t(cid:107)QD,λt+1,t+1 − Q∗ t+1(cid:107)L2 t+1 . Therefore, (cid:13) (cid:13)(LK,t + λtI)1/2(Q⊕ D,λt,t − Q∗ t )(cid:13) (cid:13)L2 t ≤ AD,λt,t (cid:16) λr t (cid:107)ht(cid:107)L2 t + PD,λt,t + S D,λt,t + UD,λt,t,Q∗ t −Q(cid:63) D,λt,t (cid:17) + μ1/2AD,λt,t(cid:107)QD,λt+1,t+1 − Q∗ t+1(cid:107)L2 t+1 . This completes the proof of Lemma 4. (cid:3) We also bound (cid:107)(LK,t + λI)1/2(QDj ,λt,t − Q∗ t )(cid:107)K,t in the following lemma. Lemma 5. Under Assumption 2 and Assumption 4 with 1 2 ≤ r ≤ 1, for any t = 1, . . . , T , it holds that (cid:13) (cid:13)(LK,t + λtI)1/2(QDj ,λt,t − Q∗ t )(cid:13) (cid:13)K,t ≤ ADj ,λt,t + μ1/2ADj ,λt,t(cid:107)QD,λt+1,t+1 − Q∗ t+1(cid:107)L2 t+1 . (cid:16) λr t (cid:107)ht(cid:107)L2 t + PDj ,λt,t + S Dj ,λt,t + UDj ,λt,t,Q∗ t −Q(cid:63) Dj ,λt,t (cid:17) Proof. It follows from Lemma 1 and Lemma 2 with D = Dj that (cid:13) (cid:13)(LK,t + λtI)1/2(QDj ,λt,t − Q∗ t )(cid:13) (cid:13)K,t ≤ (cid:107)(LK,t + λtI)1/2(Q(cid:5) Dj ,λt,t − Q∗ t )(cid:107)K,t + (cid:107)(LK,t + λtI)1/2(Q(cid:5) Dj ,λt,t − ˆQDj ,λt,t)(cid:107)K,t + (cid:107)(LK,t + λtI)1/2(QDj ,λt,t − ˆQDj ,λt,t)(cid:107)K,t ≤ λr t ADj ,λt,t(cid:107)ht(cid:107)L2 t + ADj ,λt,tPDj ,λt,t + (cid:107)(LK,t + λtI)1/2(QDj ,λt,t − ˆQDj ,λt,t)(cid:107)K,t. But for any t = 1, . . . , T , we have from (13), (31), and the same method in proving Lemma 3 that (cid:107)(LK,t + λtI)1/2(QDj ,λt,t − ˆQDj ,λt,t)(cid:107)K,t (cid:13) (cid:13)(LK,t + λI)1/2((cid:0)LK,Dj ,t + λtI(cid:1)−1 (cid:16) (cid:13) (cid:13) (cid:13)(LK,t + λI)1/2 (cid:0)LK,Dj ,t + λtI(cid:1)−1 (LK,Dj ,t − LK,t)(Q∗ (cid:13) (cid:13) (cid:13) (cid:13)(LK,t + λI)1/2 (cid:0)LK,Dj ,t + λtI(cid:1)−1 LK,t(Q∗ (cid:13) (cid:13) Dj ,λt,t) (cid:13)K,t Dj ,t − yt,Dj Dj ,t(y∗ ST (cid:63) t − Q ≤ + + ) − LK,D,t(Q∗ (cid:63) t − Q Dj ,λt,t) (cid:17)(cid:13) (cid:13) (cid:13)K,t (cid:63) t − Q (cid:13) (cid:13) Dj ,λt,t) (cid:13)K,t ≤ ADj ,λt,tS Dj ,λt,t + ADj ,λt,tUDj ,λt,t,Q∗ t −Q(cid:63) Dj ,λt,t + μ1/2ADj ,λt,t(cid:107)QD,λt+1,t+1 − Q∗ t+1(cid:107)L2 t+1 . Wang et al.: DQL Therefore, (cid:13) (cid:13)(LK,t + λtI)1/2(QDj ,λt,t − Q∗ t )(cid:13) (cid:13)K,t ≤ ADj ,λt,t + μ−1/2ADj ,λt,t(cid:107)QD,λt+1,t+1 − Q∗ t+1(cid:107)L2 t+1 . (cid:16) λr t (cid:107)ht(cid:107)L2 t 47 (cid:17) + PDj ,λt,t + S Dj ,λt,t + UDj ,λt,t,Q∗ t −Q(cid:63) Dj ,λt,t This completes the proof of Lemma 5. (cid:3) Based on Lemma 4, Lemma 5, and Proposition 3, we can derive the following oracle inequality for DKRR-DTR. Proposition 4. Under Assumption 2 and Assumption 4 with 1 2 ≤ r ≤ 1, it holds that (cid:107)(LK,t + λtI)1/2(QD,λt,t − Q∗ t )(cid:107)K,t WDj ,λt,tADj ,λt,t + AD,λt,t μ1/2 (cid:33) (cid:33)(cid:96)−t |Dj| |D| ≤ × T (cid:88) (cid:32)(cid:32) m (cid:88) (cid:96)=t (cid:32) m (cid:88) j=1 j=1 |Dj| |D| (cid:16) WDj ,λ(cid:96),(cid:96)ADj ,λ(cid:96),(cid:96) (cid:16) λr (cid:96) (cid:107)h(cid:96)(cid:107)L2 (cid:96) + PDj ,λ(cid:96),(cid:96) + S Dj ,λ(cid:96),(cid:96) + UDj ,λ(cid:96),(cid:96),Q∗ (cid:96) −Q(cid:63) Dj ,λ(cid:96) ,(cid:96) + AD,λ(cid:96),(cid:96) λr (cid:96) (cid:107)h(cid:96)(cid:107)L2 (cid:96) + PD,λ(cid:96),(cid:96) + S D,λ(cid:96),(cid:96) + UD,λ(cid:96),(cid:96),Q∗ (cid:96) −Q(cid:63) D,λ(cid:96) ,(cid:96) (cid:17) + UD,λ(cid:96),(cid:96),Q∗ (cid:96) (cid:17) . Proof. Inserting Lemma 4 and Lemma 5 into Proposition 3, we obtain (cid:107)(LK,t + λtI)1/2(QD,λt,t − Q∗ t )(cid:107)K,t ≤ m (cid:88) j=1 |Dj| |D| WDj ,λt,tADj ,λt,t(λr t (cid:107)ht(cid:107)L2 t + PDj ,λt,t + S Dj ,λt,t + UDj ,λt,t,Q∗ t −Q(cid:63) Dj ,λt,t ) + AD,λt,t(λr t (cid:107)ht(cid:107)L2 t + PD,λt,t + S D,λt,t + UD,λt,t,Q∗ t −Q(cid:63) D,λt,t ) + UD,λt,t,Q∗ t (cid:32) m (cid:88) j=1 |Dj| |D| WDj ,λt,tADj ,λt,t + AD,λt,t (cid:33) μ1/2(cid:107)QD,λt+1,t+1 − Q∗ t+1(cid:107)L2 t+1 WDj ,λt,tADj ,λt,t + AD,λt,t μ1/2 (cid:33) (cid:33)(cid:96)−t |Dj| |D| WDj ,λ(cid:96),(cid:96)ADj ,λ(cid:96),(cid:96) (cid:16) λr (cid:96) (cid:107)h(cid:96)(cid:107)L2 (cid:96) + PDj ,λ(cid:96),(cid:96) + S Dj ,λ(cid:96),(cid:96) + UDj ,λ(cid:96),(cid:96),Q∗ (cid:96) −Q(cid:63) Dj ,λ(cid:96) ,(cid:96) + AD,λ(cid:96),(cid:96) λr (cid:96) (cid:107)h(cid:96)(cid:107)L2 (cid:96) + PD,λ(cid:96),(cid:96) + S D,λ(cid:96),(cid:96) + UD,λ(cid:96),(cid:96),Q∗ (cid:96) −Q(cid:63) D,λ(cid:96) ,(cid:96) (cid:17) + UD,λ(cid:96),(cid:96),Q∗ (cid:96) (cid:17) . + ≤ × T (cid:88) (cid:32)(cid:32) m (cid:88) (cid:96)=t (cid:32) m (cid:88) j=1 j=1 |Dj| |D| (cid:16) (cid:17) (cid:17) This completes the proof of Proposition 4. (cid:3) A.4. Bounds of operator differences In this part, we aim to bounding the operator differences. Our first lemma focuses on bounding WD,λt,t, which can be found in (Lin et al. 2020, Lemma 6). 48 Wang et al.: DQL Lemma 6. Let 0 < δ ≤ 1. If Assumption 1 holds and 0 < λ ≤ 1, then with confidence 1 − δ, it holds that where C ∗ 1 := max{(κ2 + 1)/3, 2 √ WD,λt,t ≤ C ∗ 1 BD,λt,t log 4 δ , t = 1, . . . , T, κ2 + 1} and BD,λt,t := 1 + log(1 + Nt(λt)) λ|D| + (cid:115) 1 + log(1 + Nt(λt)) λ|D| . (50) The second one aims to bounding AD,λt,t, which can be found in (Lin et al. 2020, Lemma 7). Lemma 7. If Assumption 1 holds and 0 < λ ≤ 1, then for δ ≥ 4 exp{−1/(2C ∗ 1 BD,λt,t)} , with confidence 1 − δ, it holds that AD,λt,t ≤ 2, t = 1, . . . , T. The bound of UD,λt,t,f , provided in (Lin et al. 2017, Lemma 18), is shown in the following lemma. Lemma 8. Under Assumption 1, for any 0 < δ < 1 and (cid:107)f (cid:107)L∞ < ∞, with confidence at least 1 − δ, it holds that UD,λt,t,f ≤ 2(cid:107)f (cid:107)∞ log(cid:0)2/δ(cid:1) (cid:112)|D| (cid:40) κ (cid:112)|D|λt (cid:41) + (cid:112)N (λt) , t = 1, . . . , T. To bound PD,λt,t, SD,λt,t and S D,λt,t, we should introduce a Hilbert valued Berstein inequality established in (Pinelis 1994). Lemma 9. For a random variable ξ on (Z, ρ) with values in a separable Hilbert space (H, (cid:107) * (cid:107)) satisfying (cid:107)ξ(cid:107) ≤ ̄M < ∞ almost surely, and a random sample {zi}s i=1 independent drawn according to ρ, there holds with confidence 1 − (cid:101)δ, (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) 1 s s (cid:88) i=1 (ξ(zi) − E[ξ]) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:115) 2 ̄M log(cid:0)2/(cid:101)δ(cid:1) s + ≤ 2E[(cid:107)ξ(cid:107)2] log(cid:0)2/(cid:101)δ(cid:1) s . With the help of Lemma 9, we can derive the following concentration inequality, which is crucial to bound PD,λt,t, SD,λt,t and S D,λt,t. Lemma 10. Let 0 < δ < 1, yD = (y1, . . . , y|D|)T ∈ R|D| with |yi| ≤ ̃M almost surely, and g(xi) = E[Yi|xi]. Under Assumption 1, with confidence 1 − δ, it holds that (cid:107)(LK,t + λtI)−1/2(SDtyD − LK,Dg)(cid:107)K,t ≤ √ 2 2 ̃M log(2/δ) (cid:112)|D| (cid:32) √ 2 (cid:112)|D|λt + (cid:112)Nt(λt) (cid:33) . Wang et al.: DQL 49 Proof. Denote zi = (xi, yi) and ηt(zi) = (LK,t + λtI)−1/2(yi − g(xi))Kxi ∈ HK,t. Then, we have E[ηt(zi)] = 0 and (cid:107)ηt(zi)(cid:107)2 K,t = (cid:104)(LK,t + λtI)−1/2(yi − g(xi))Kxi, (LK,t + λtI)−1/2(yi − g(xi))Kxi(cid:105)K,t ≤ 4 ̃M 2(cid:107)(LK,t + λtI)−1/2(Kx)(cid:107)2 K,t = 4 ̃M 2 ∞ (cid:88) k=1 (φk,t(x))2 σk,t + λt , where (σk,t, φk,t)∞ k=1 is the normalized eigen-pairs of LK,t in HK. Therefore, we have (cid:107)ηt(zi)(cid:107)K,t ≤ 2 ̃M (cid:107)f (cid:107)L∞ √ λt and E[(cid:107)ηt(zi)(cid:107)2 K,t] ≤ 4 ̃M 2E (cid:34) ∞ (cid:88) k=1 (cid:35) (φk,t(x))2 σk,t + λt = 4 ̃M 2 ∞ (cid:88) k=1 E[φ2 k,t] σk,t + λt = 4 ̃M 2 ∞ (cid:88) k=1 σk,t σk,t + λt = 4 ̃M 2Tr(LK,t(LK,t + λtI)−1) = 4 ̃M 2Nt(λt), where we used the fact E[φ2 k,t] = σk,t which was proven in (Lin et al. 2017, eqs.(51)). Therefore, it follows from Lemma 9 that with confidence 1 − δ, it holds that (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) 1 |D| |D| (cid:88) i=1 ηt(zi) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) ≤ 4 ̃M log(cid:0)2/δ(cid:1) λt|D| √ + (cid:115) 8 ̃M 2Nt(λt) log(cid:0)2/δ(cid:1) |D| . This completes the proof of Lemma 10. (cid:3) Setting yi = y∗ i,t and ̃M = (T − t + 1)M in Lemma 10, we can derive the following bound of PD,λt,t. Lemma 11. Let 0 < δ < 1. Under Assumption 3, with confidence 1 − δ, it holds that √ 2 PD,λt,t ≤ 2(T − t + 1)M log(2/δ) (cid:112)|D| (cid:32) √ 2 (cid:112)|D|λt (cid:33) + (cid:112)Nt(λt) . Different from PD,λt,t, the bounds of SD,λt,t and S D,λt,t are much more sophisticated, which requires an upper bound of (cid:107)QD,t,λ(cid:107)L∞ t and (cid:107)QD,t,λ(cid:107)L∞ t for any t = 1, . . . , T . We leave them in the next subsection. A.5. Uniform bounds of Q-functions In this part, we aim at deriving (cid:107)QD,t,λ(cid:107)L∞ t and (cid:107)QD,t,λ(cid:107)L∞ t so that yi,t and yi,t can also be uniformly bounded. The following lemma presents an iterative relation between (cid:107)QD,t+1,λ(cid:107)L∞ t+1 and (cid:107)QD,t,λ(cid:107)L∞ t . Lemma 12. Let 0 ≤ δ ≤ 1 satisfy (cid:26) δ ≥ 8T exp − 2r + s 4sC ∗ 1 (log(C0 + 1) + 2) |D| 2r+s−1 8r+4s log−1 |D| (cid:27) . (51) 50 Wang et al.: DQL Under Assumptions 1-5 with 1 2 ≤ r ≤ 1 and 0 < s ≤ 1, if λt = |D|− 1 2r+s for t = 1, . . . , T , then with confidence 1 − δ/T , it holds that (cid:107)QD,λt,t(cid:107)L∞ t + M ≤ ̄C T (cid:88) (cid:96)=t (T − (cid:96) + 2)(2μ1/2)(cid:96)−t (cid:16) (cid:107)QD,λ(cid:96)+1,(cid:96)+1(cid:107)L∞ (cid:96)+1 (cid:17) , + M t = 1, 2, . . . , T, (52) where ̄C is a constant depending only on C0, κ, r, s, and maxt=1,...,T (cid:107)ht(cid:107)L2 t . Proof. Denote Φt = (cid:107)QD,λt,t(cid:107)L∞ t . Since λ1 = * * * = λT = |D|− 1 2r+s , we have from Assumption 5 that Nt(λt) ≤ C0λ−s t = C0|D| s 2r+s , ∀ t = 1, 2, . . . , T. Then and (cid:32) 1 (cid:112)|D| 1 (cid:112)|D|λt (cid:33) + (cid:112)Nt(λt) (cid:112) ≤ ( C0 + 1)|D| −r 2r+s , ∀t = 1, 2, . . . , T, (53) BD,λt,t ≤ 2s 2r + s (log(C0 + 1) + 2)|D| 1−2r−s 4r+2s log |D|. (54) Therefore, Lemma 7 and Lemma 11 yield that, with confidence 1 − δ/(4T ) with δ satisfying (51), there hold for any t = 1, . . . , T, AD,λt,t ≤ 2, PD,λt,t ≤ 4(T − t + 1)M ( (cid:112) C0 + 1)|D| −r 2r+s log 8T δ . (55) (56) We then get from Assumption 3 that |yi,t| ≤ M + Φt+1 almost surely. Therefore, it follows from (20), Lemma (8) with f = Q∗ t − Q(cid:63) D,λt,t, and Lemma 10 with yi = yi,t − y∗ i,t and ̃M = (T − t + 2)M + Φt+1 that UD,λt,t,Q∗ t −Q(cid:63) D,λt,t ≤ 2((T − t + 2)M + Φt+1)(κ + 1)( (cid:112) C0 + 1)|D| −r 2r+s log 8T δ , SD,λt,t ≤ 4((T − t + 2)M + Φt+1)( (cid:112) C0 + 1)|D| −r 2r+s log 8T δ , (57) (58) hold with confidence 1 − δ/(4T ). Plugging (55), (56), (57), and (58) into Proposition 2, we obtain from (51) that ≤ ≤ T (cid:88) (cid:96)=t (cid:107)QD,λt,t − Q∗ t (cid:107)K,t ≤ λ−1/2 t (cid:107)(LK,t + λtI)1/2(QD,λt,t − Q∗ t )(cid:107)K,t (T − t + 2)(2μ1/2)(cid:96)−t((cid:107)h(cid:96)(cid:107)L2 (cid:96) (cid:112) + ( C0 + 1)(M + Φ(cid:96)+1)(2κ + 10))|D| −2r+1 4r+2s log 8T δ (2r + s) (cid:80)T (cid:96)=t(T − (cid:96) + 2)(2μ1/2)(cid:96)−t (cid:16) √ + ( (cid:107)h(cid:96)(cid:107)L2 (cid:96) C0 + 1)(M + Φ(cid:96)+1) (2κ + 10) (cid:17) (4sC ∗ 1 (log(C0 + 1) + 2)) ≤ ̄C1 T (cid:88) (cid:96)=t (T − (cid:96) + 2)(2μ1/2)(cid:96)−t(Φ(cid:96)+1 + M ) Wang et al.: DQL 51 holds with confidence 1 − δ/T , where δ satisfies (51), and ̄C1 := (cid:16) 4(2r + s) max(cid:96)=1,...,T (cid:107)h(cid:96)(cid:107)L2 (cid:96) √ + ( C0 + 1) (2κ + 10) (cid:17) 4sC ∗ 1 (log(C0 + 1) + 2) . Therefore, we have (cid:107)QD,λt,t(cid:107)L∞ t + M ≤ κ(cid:107)QD,λt,t(cid:107)K,t + M ≤ κ(cid:107)QD,λt,t − Q∗ t (cid:107)K,t + κ(cid:107)Q∗ t (cid:107)K,T + M ≤ ̄C T (cid:88) (cid:96)=t (T − t + 2)(2μ1/2)(cid:96)−t(Φ(cid:96)+1 + M ), where ̄C := κ ̄C1 + κ2r maxt=1,...,T (cid:107)ht(cid:107)L2 t + 1. This completes the proof of Lemma 12. (cid:3) Based on the above lemma, we can derive an upper bound of (cid:107)QD,t,λ(cid:107)L∞ t . Proposition 5. Let 0 ≤ δ ≤ 1 with δ satisfying (51). Under Assumptions 1-5 with 1 2 ≤ r ≤ 1 and 0 < s ≤ 1, if λt = |D|− 1 2r+s for t = 1, . . . , T , then with confidence 1 − δ, it holds that (cid:107)QD,λt,t(cid:107)L∞ t ≤ 2 ̄C T (2μ1/2)T −tM T −1 (cid:89) (cid:96)=t (cid:0)(T − (cid:96) + 2)(2μ1/2)(cid:96)−t + 1(cid:1) − M, t = 1, . . . , T. Proof. Since for any ξt, ηt > 0, ξt ≤ (cid:80)T (cid:96)=t η(cid:96)ξ(cid:96)+1 implies ξt ≤ (cid:81)T −1 (cid:96)=t (η(cid:96) + 1)ηT ξT +1. Set ξt = (cid:107)QD,λt,t(cid:107)L∞ t + M and ηt = ̄C(T − (cid:96) + 1)(2μ−1/2)(cid:96)−t. We have from (52) and QD,λT +1,T +1 = 0 that (cid:107)QD,λt,t(cid:107)L∞ t + M ≤ T −1 (cid:89) (cid:96)=t (cid:0) ̄C(T − (cid:96) + 2)(2μ1/2)(cid:96)−t + 1(cid:1) 2 ̄C(2μ1/2)T −tM. This completes the proof Proposition 5. (cid:3) Similar to Lemma 12, we present an iteration relation between (cid:107)QD,λt,t(cid:107)L∞ t and (cid:107)QD,λt+1,t+1(cid:107)L∞ t+1 . Lemma 13. Let 0 ≤ δ ≤ 1 satisfy δ ≥ 40T m exp − (cid:26) 2r + s 4sC ∗ 1 (log(C0 + 1) + 2) |D| 2r+s−1 16r+8s m−1/2 log−1 |D| (cid:27) . (59) Under Assumptions 1-5 with 1 2 ≤ r ≤ 1 and 0 < s ≤ 1, if λt = |D|− 1 2r+s for t = 1, . . . , T , |D1| = * * * = |Dm|, and m satisfies (25), then with confidence 1 − δ/T , it holds that (cid:107)QD,λt,t(cid:107)L∞ t + M ≤ ˆC T (cid:88) (cid:96)=t (T − t + 2)(2μ1/2)(cid:96)−t(Φ(cid:96)+1 + M ), t = 1, 2, . . . , T, (60) where ̄C is a constant depending only on C0, κ, r, s, and maxt=1,...,T (cid:107)ht(cid:107)L2 t . Proof. Write Ψt = (cid:107)QD,λt,t(cid:107)L2 t . Since |D1| = * * * = |Dm| and λ1 = * * * = λT = |D|− 1 2r+s , (25) yields (cid:32) 1 (cid:112)|Dj| 1 (cid:112)|Dj|λt (cid:33) + (cid:112)Nt(λt) (cid:112) ≤ ( √ C0 + 1) m|D| −r 2r+s , ∀t = 1, 2, . . . , T, (61) 52 and Wang et al.: DQL BD,λt,t ≤ 2s 2r + s (log(C0 + 1) + 2) √ m|D| 1−2r−s 4r+2s log |D|. (62) From Lemma 6, Lemma 7, and Lemma 11 with D = Dj, we obtain that for any δ satisfying (59), with confidence 1 − δ/(10mT ), it holds that WDj ,λt,t ≤ C ∗ 1 2s 2r + s (log(C0 + 1) + 2) √ m|D| 1−2r−s 4r+2s log |D| log 40mT δ , ADj ,λt,t ≤ 2, PDj ,λt,t ≤ 4(T − t + 1)M ( (cid:112) √ C0 + 1) m|D| −r 2r+s log 20mT δ . (63) (64) (65) We then get from Assumption 3 that |yi,t| ≤ M + Ψt+1 almost surely. Therefore, it follows from (20), Lemma 8 with f = Q∗ (cid:63) t − Q D,λt,t, and Lemma 10 with yi = yi,t − y∗ i,t and ̃M = (T − t + 2)M + Ψt+1 that UDj ,λt,t,Q∗ t −Q(cid:63) D,λt,t ≤ 2((T − t + 2)M + Ψt+1)(κ + 1)( (cid:112) √ C0 + 1) m|D| −r 2r+s log 20mT δ , S Dj ,λt,t ≤ 4((T − t + 2)M + Ψt+1)( (cid:112) √ C0 + 1) m|D| −r 2r+s log 20mT δ (66) (67) hold with confidence 1 − δ/(10mT ). Hence, with confidence 1 − δ/(2mT ) with δ satisfying (59), we have from (25) that and where (cid:32) m (cid:88) j=1 |Dj| |D| WDj ,λt,tADj ,λt,t + AD,λt,t (cid:33)(cid:96)−t (cid:18) ≤ C ∗ 1 2s 2r + s (log(C0 + 1) + 2) √ m|D| 1−2r−s 2r+s log |D| log (cid:19)(cid:96)−t + 1 ≤ 2(cid:96)−t 40mT δ λ−1/2 t m (cid:88) j=1 |Dj| |D| WDj ,λ(cid:96),(cid:96)ADj ,λ(cid:96),(cid:96)(λr (cid:96) (cid:107)h(cid:96)(cid:107)L2 (cid:96) + PDj ,λ(cid:96),(cid:96) + S Dj ,λ(cid:96),(cid:96) + UDj ,λ(cid:96),(cid:96),Q∗ (cid:96) −Q(cid:63) Dj ,λ(cid:96) ,(cid:96) ) ≤ ˆC1(T − t + 2)(M + Ψt+1)m|D| ≤ 4 ˆC1(T − t + 2)(M + Ψt+1), 1−2r−s 4r+2s log |D||D|− 2r−1 4r+2s log2 40mT δ ˆC1 := max t=1,...,T (cid:107)ht(cid:107)L2 t (cid:112) + 4( C0 + 1) + 4( (cid:112) C0 + 1) + 2(κ + 1)( (cid:112) C0 + 1). Similarly, we can derive from (55), (56), (57), and (58) that, with confidence 1 − δ/(2T ) with δ satisfying (59), it holds that λ−1/2 t AD,λ(cid:96),(cid:96)(λr (cid:96) (cid:107)h(cid:96)(cid:107)L2 (cid:96) + PD,λ(cid:96),(cid:96) + S D,λ(cid:96),(cid:96) + UD,λ(cid:96),(cid:96),Q∗ (cid:96) −Q(cid:63) D,λ(cid:96) ,(cid:96) ) + UD,λ(cid:96),(cid:96),Q∗ (cid:96) ≤ ˆC2 T (cid:88) (cid:96)=t (T − (cid:96) + 2)(2μ1/2)(cid:96)−t(Φ(cid:96)+1 + M ), Wang et al.: DQL 53 where ˆC2 := ̄C1 + 1. The above three estimates together with (4) yield that, with confidence 1 − δ/T , it holds that (cid:107)QD,λt,t − Q∗ t (cid:107)K,t ≤ λ−1/2 t (cid:107)(LK,t + λtI)1/2(QD,λt,t − Q∗ t )(cid:107)K,t ≤ ( ˆC2 + 2 ˆC3) (cid:0)2μ1/2(cid:1)(cid:96)−t T (cid:88) (cid:96)=t T (cid:88) (cid:96)=t (T − (cid:96) + 2)(2μ1/2)(cid:96)−t(Φ(cid:96)+1 + M ). Therefore, we have (cid:107)QD,λt,t(cid:107)L∞ t + M ≤ κ(cid:107)QD,λt,t(cid:107)K,t + M ≤ κ(cid:107)QD,λt,t − Q∗ t (cid:107)K,t + κ(cid:107)Q∗ t (cid:107)K,T + M ≤ ˆC T (cid:88) (cid:96)=t (T − t + 2)( ˆC1μ1/2)(cid:96)−t(Φ(cid:96)+1 + M ), where ˆC := κ( ˆC1 + 2 ˆC2) + κ2r maxt=1,...,T (cid:107)ht(cid:107)L2 t + 1. This completes the proof of Lemma 13. (cid:3) Using the same approach as that in proving Proposition 5, we can derive the following proposition directly. Proposition 6. Let 0 ≤ δ ≤ 1 with δ satisfying (59). Under Assumptions 1-5 with 1 2 ≤ r ≤ 1 and 0 < s ≤ 1, if λt = |D|− 1 2r+s for t = 1, . . . , T , |D1| = * * * = |Dm|, and m satisfies (25), then with confidence 1 − δ, it holds that (cid:107)QD,λt,t(cid:107)L∞ t ≤ 2 ˆC T (2μ1/2)T −tM T −1 (cid:89) (cid:96)=t A.6. Deriving generalization errors (cid:0)(T − (cid:96) + 2)(2μ1/2)(cid:96)−t + 1(cid:1) − M, t = 1, . . . , T. In this subsection, we derive the generalization error of KRR-DTR and DKRR-DTR. To prove our main theorems, we need the following lemma, which is standard in statistical learning theory. We present its proof for the sake of completeness. Lemma 14. Let 0 < δ < 1, and ξ ∈ R+ be a random variable. If ξ ≤ u logb c δ holds with confidence 1 − δ for some u, b, c > 0, then E[ξ] ≤ cΓ(b + 1)u, where Γ(*) is the Gamma function. Proof. Since ξ ≤ u logb c δ holds with confidence 1 − δ, we have P [ξ > t] ≤ c exp{u−1/bt1/b}. Using the probability to expectation formula E[ξ] = (cid:90) ∞ 0 P [ξ > ε] dε (68) 54 to the positive random variable ξ, we have E[ξ] ≤ c (cid:90) ∞ 0 exp{u−1/bε1/b}dε ≤ cuΓ(b + 1). This completes the proof of Lemma 14. (cid:3) With the above foundations, we are in a position to prove our main theorems. Proof of Theorem 1. It follows from Proposition 2 that E[(cid:107)(QD,λt,t − Q∗ t )(cid:107)L2 t ] ≤ E[(cid:107)(LK,t + λtI)1/2(QD,λt,t − Q∗ t )(cid:107)K,t] ≤ T (cid:88) (cid:96)=t (cid:104) (cid:96)−t 2 E μ A(cid:96)−t+1 D,λ(cid:96),(cid:96)(λr (cid:96) (cid:107)h(cid:96)(cid:107)L2 (cid:96) + PD,λ(cid:96),(cid:96) + SD,λ(cid:96),(cid:96) + UD,λ(cid:96),(cid:96),Q∗ (cid:96) −Q(cid:63) D,λ(cid:96) ,(cid:96) Wang et al.: DQL (cid:105) ) . For λ1 = * * * = λT = |D|− 1 2r+s , it follows from (55), (56), (58), (57), and Proposition 5 that, with confidence 1 − δ with δ satisfying (51), it holds that (cid:16) A(cid:96)−t+1 D,λ(cid:96),(cid:96) λr (cid:96) (cid:107)h(cid:96)(cid:107)L2 t + PD,λ(cid:96),(cid:96) + SD,λ(cid:96),(cid:96) + UD,λ(cid:96),(cid:96),Q∗ (cid:96) −Q(cid:63) D,λ(cid:96) ,(cid:96) (cid:17) ≤ 2(cid:96)−t ̃C1 ̄C T (2μ1/2)T −(cid:96)M T −1 (cid:89) k=(cid:96) (cid:0)(T − k + 2)(2μ1/2)k−(cid:96) + 1(cid:1) |D| −r 2r+s log 8T δ , where ̃C1 := 4 max t=1,...,T (cid:107)ht(cid:107)L2 t + 16M ( (cid:112) C0 + 1) + 2(κ + 1)( (cid:112) C0 + 1) + 4( (cid:112) C0 + 1). Then it follows from Lemma 14, (68), and (51) that E[(cid:107)(QD,λt,t − Q∗ t )(cid:107)L2 t ] ≤ (cid:90) ∞ 0 P [(cid:107)(QD,λt,t − Q∗ t )(cid:107)L2 t > ε]dε (cid:90) 8T exp (cid:26) − 2r+s 4sC∗ 1 (log(C0+1)+2) 2r+s−1 8r+4s log−1 |D| (cid:27) |D| P [(cid:107)(QD,λt,t − Q∗ t )(cid:107)L2 t > ε]dε = + 0 (cid:90) ∞ 8T exp (cid:26) − (cid:26) ≤ 8T exp − 2r+s−1 8r+4s log−1 |D| (cid:27) dε |D| 2r+s 4sC∗ 1 (log(C0+1)+2) 2r + s 4sC ∗ 1 (log(C0 + 1) + 2) 2r+s−1 8r+4s log−1 |D| (cid:27) |D| (cid:90) ∞ + 0 P [(cid:107)(QD,λt,t − Q∗ t )(cid:107)L2 t > ε]dε ≤ ̃C2T T (cid:88) (cid:96)=t (cid:96)−t 2 2(cid:96)−t ̄C T (2μ1/2)T −(cid:96) μ T −1 (cid:89) k=(cid:96) (cid:0)(T − k + 2)(2μ1/2)k−(cid:96) + 1(cid:1) |D| −r 2r+s , where ̃C2 is a constant depending only on ̃C1, M , r, s, and C0. Noting further (18), we then have ,1(S1)] E[V ∗ 1 (S1) − Vπ T T (cid:88) (cid:88) μt/2T D,(cid:126)λ ≤ C1 t=1 (cid:96)=t (cid:96)−t 2 2(cid:96)−t ̄C T (2μ1/2)T −(cid:96) μ T −1 (cid:89) k=(cid:96) (cid:0)(T − k + 2)(2μ1/2)k−(cid:96) + 1(cid:1) |D| −r 2r+s for C1 = 2 ̃C. This completes the proof of Theorem 1. (cid:3) Wang et al.: DQL 55 Proof of Theorem 2. It follows from Proposition 4 that E[(cid:107)QD,λt,t − Q∗  t )(cid:107)L2 t ] ≤ E[(cid:107)(LK,t + λtI)1/2(QD,λt,t − Q∗ (cid:33)(cid:96)−t (cid:33) t )(cid:107)K,t] WDj ,λt,tADj ,λt,t + AD,λt,t μ1/2 (cid:32)(cid:32) m (cid:88) T (cid:88) E  |Dj| |D| j=1 ≤ × (cid:96)=t (cid:32) m (cid:88) j=1 |Dj| |D| (cid:16) WDj ,λ(cid:96),(cid:96)ADj ,λ(cid:96),(cid:96) (cid:16) λr (cid:96) (cid:107)h(cid:96)(cid:107)L2 (cid:96) + PDj ,λ(cid:96),(cid:96) + S Dj ,λ(cid:96),(cid:96) + UDj ,λ(cid:96),(cid:96),Q∗ (cid:96) −Q(cid:63) Dj ,λ(cid:96) ,(cid:96) (cid:17) + AD,λ(cid:96),(cid:96) λr (cid:96) (cid:107)h(cid:96)(cid:107)L2 (cid:96) + PD,λ(cid:96),(cid:96) + S D,λ(cid:96),(cid:96) + UD,λ(cid:96),(cid:96),Q∗ (cid:96) −Q(cid:63) D,λ(cid:96) ,(cid:96) (cid:17) + UD,λ(cid:96),(cid:96),Q∗ (cid:96) (cid:17)(cid:105) . But (59), (64), (55), (25), (64), (65), (67), (66), and Proposition 6 yield that for any t = 1, . . . , T , with confidence 1 − δ/2, it holds that (cid:32) m (cid:88) j=1 |Dj| |D| WDj ,λt,tADj ,λt,t + AD,λt,t ≤ 2 (cid:33) and m (cid:88) j=1 |Dj| |D| ≤ ̃C3m|D| WDj ,λ(cid:96),(cid:96)ADj ,λ(cid:96),(cid:96)(λr (cid:96) (cid:107)h(cid:96)(cid:107)L2 (cid:96) + PDj ,λ(cid:96),(cid:96) + S Dj ,λ(cid:96),(cid:96) + UDj ,λ(cid:96),(cid:96),Q∗ (cid:96) −Q(cid:63) Dj ,λ(cid:96) ,(cid:96) ) 1−2r−s 4r+2s log |D||D|− r 2r+s ˆC T (2μ1/2)T −t T −1 (cid:89) (cid:96)=t (cid:0)(T − (cid:96) + 2)(2μ1/2)(cid:96)−t + 1(cid:1) log 40mT δ ≤ ̃C3|D|− r 2r+s ˆC T (2μ1/2)T −t T −1 (cid:89) (cid:96)=t (cid:0)(T − (cid:96) + 2)(2μ1/2)(cid:96)−t + 1(cid:1) log 40 δ , where we use log ab ≤ (log a + 1) log b for a, b ≥ 3 in the last inequality, and ̃C3 := 6M C ∗ 1 2s 2r + s (log(C0 + 1) + 2)( max t=1,...,T (cid:107)ht(cid:107)L2 t (cid:112) + 8( C0 + 1)) + 2(κ + 1)( C0 + 1). (cid:112) Similarly, we can derive that with confidence 1 − δ/2, it holds that AD,λ(cid:96),(cid:96)(λr (cid:96) (cid:107)h(cid:96)(cid:107)L2 (cid:96) + PD,λ(cid:96),(cid:96) + S D,λ(cid:96),(cid:96) + UD,λ(cid:96),(cid:96),Q∗ (cid:96) −Q(cid:63) D,λ(cid:96) ,(cid:96) ) + UD,λ(cid:96),(cid:96),Q∗ (cid:96) where ≤ ̃C4|D|− r 2r+s ˆC T (2μ1/2)T −t T −1 (cid:89) (cid:96)=t (cid:0)(T − (cid:96) + 2)(2μ1/2)(cid:96)−t + 1(cid:1) log 40T δ , ̃C4 := 6M ( max t=1,...,T (cid:107)ht(cid:107)L2 t (cid:112) + 8( C0 + 1)) + 2(κ + 1)( (cid:112) C0 + 1). Hence, we have from Lemma 14 that E[(cid:107)QD,λt,t − Q∗ t )(cid:107)L2 t (cid:26) ] ≤ 40T m exp − 2r + s 1 (log(C0 + 1) + 2) 2r+s−1 16r+8s m−1/2 log−1 |D| (cid:27) |D| 4sC ∗ T −1 (cid:89) + 80( ̃C3 + ̃C4)T |D|− r 2r+s ˆC T (2μ1/2)T −t (cid:0)(T − (cid:96) + 2)(2μ1/2)(cid:96)−t + 1(cid:1) ≤ C2T |D|− r 2r+s ˆC T (2μ1/2)T −t (cid:96)=t (cid:0)(T − (cid:96) + 2)(2μ1/2)(cid:96)−t + 1(cid:1) , T −1 (cid:89) (cid:96)=t 56 Wang et al.: DQL where C2 is a constant depending only on maxt=1,...,T (cid:107)ht(cid:107)L2 t , C0, κ, M , r, and s. This together with (19) completes the proof of Theorem 2. (cid:3) Appendix B: Algorithm of DKRR-DTK In this section, we present the detailed implementation of DKRR-DTR as shown in Algorithm 1, where the steps above the dashed line are the implementation of the training process and the steps below the dashed line are the implementation of decision-making for a query. In Algorithm 1, Model(s, a) denotes the contents of the environment model that predicts the next state and reward for state-action pair (s, a), and it is related to the types of clinical trials. Algorithm 1 DKRR-DTR Input: Data subset Dj = {(si,j,1, ai,j,1, ri,j,1, * * * , si,j,T , ai,j,T , ri,j,T , si,j,T +1)}|Dj | i=1 stored in the j-th local machine for j = 1, * * * , m; families At of actions at stage t for t = 1, * * * , T ; a query with initial state s(q) 1 . 1: for j = 1, 2, * * * , m do (cid:46) Initialization 2: Initialize the label vector (cid:126)Y Dj ,T := (cid:104) y1,j,T , * * * , y|Dj |,j,T (cid:105)(cid:62) = (cid:2)r1,j,T , * * * , r|Dj |,j,T (cid:3)(cid:62). 3: end for 4: for t = T, T − 1, * * * , 1 do for j = 1, 2, * * * , m do (cid:46) Training process (cid:46) Local process 5: 6: 7: 8: 9: 10: 11: 12: 13: Run KRR on the j-th local machine with data Dj and parameter λt to obtain a function QDj ,λt,t = arg min Qt∈HK,t 1 |Dj| |Dj | (cid:88) i=1 (cid:0)yi,j,t − Qt(si,j,1:t, ai,j,1:t)(cid:1)2 + λt(cid:107)Qt(cid:107)2 K,t. Communicate {si,j,1:t, ai,j,1:t−1}|Dj | i=1 to the k-th local machine for k = 1, . . . , m. for at in At do Compute m vectors (cid:126)HDj ,k,at,t=(cid:2)QDj ,λt,t (s1,k,1:t, a1,k,1:t−1, at),* * *,QDj ,λt,t (s|Dk|,k,1:t, a|Dk|,k,1:t−1, at)(cid:3)(cid:62) for k = 1, . . . , m, and communicate these m vectors to the global machine. end for end for for at in At do Synthesize m global vectors, (cid:126)HD,k,at,t = (cid:80)m j=1 |Dj | |D| (cid:126)HDj ,k,at,t for k = 1, . . . , m. (cid:46) Synthesization Wang et al.: DQL 18: end for 19: end for 20: for t = 1, 2, * * * , T do 14: 15: 16: 17: 21: 22: 23: 24: 25: 26: 27: Distribute m vectors (cid:126)HD,k,at,t with k = 1, . . . , m to each local machine. end for for j = 1, 2, * * * , m do Compute the label vector (cid:126)Y Dj ,t−1 = (cid:126)RDj ,t−1 + max wise operator for vectors (cid:126)HD,j,at,t, and (cid:126)RDj ,t−1 = (cid:2)r1,j,t−1, * * * , r|Dj |,j,t−1 at∈At (cid:126)HD,j,at,t, where "max" is an element- 57 (cid:46) Local process (cid:3)(cid:62). (cid:46) Decision-making Distribute the query state s(q) t to m local machines. for j = 1, 2, * * * , m do (cid:46) Local process On the j-th local machine, compute |At| values h(q) Dj ,at,t = QDj ,λt,t (cid:16) s(q) 1:t , a(q) 1:t−1, at (cid:17) for at in At, and communicate these |At| values to the global machine. end for Generate |At| global estimators, h(q) D,at,t = (cid:80)m j=1 Take an action a(q) t = arg max at∈At h(q) D,at,t. |Dj | |D| h(q) Dj ,at,t for at in At. (cid:46) Synthesization (cid:46) Policy Get the next state and reward for the state-action pair (cid:16) (cid:17) (cid:16) t+1, r(q) s(q) t := Model s(q) t , a(q) t (cid:16) s(q) t (cid:17) . (cid:17) , a(q) t according to (cid:46) Environment model 28: end for Output: A treatment trajectory (cid:16) s(q) 1 , a(q) 1 , r(q) 1 , * * * , s(q) T , a(q) T , r(q) T , s(q) T +1 (cid:17) for the query with initial state s(q) 1 . Appendix C: Introduction of Simulation 1 This section provides a thorough description of the trajectory data production for Section 5.1. The observation period for patients in the clinical trial is 5 years. At each time point t ∈ [0, 5], the tumor size denoted by M (t) and the wellness denoted by W (t) for each patient are recorded. When a patient's wellness is less than 0.25, the patient suffers from death. When a patient's tumor size reaches 1, that is, when a time point ti satisfies M (ti) = 1, treatment should be administered. Here, an aggressive treatment (denoted by A) or a conservative treatment (denoted by B) is considered for application to patients. The immediate effects on wellness and tumor size for the two treatments are formulated as W (t+ i |A) = W (ti) − 0.5, M (t+ i |A) = 0.1M (ti)/W (ti), (69) 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 58 Wang et al.: DQL Algorithm 2 Trajectory generation of clinical trial with a small number of treatment options 1: Initialize the wellness w1 using the uniform distribution on the interval [0.5, 1]. Let t1 = 0, i = 1, and the indicator of trial end (cid:37) = 0. 2: while (cid:37) == 0 do Randomly choose a treatment ai from the set {A, B} with equal probability. Compute the immediate effects W (t+ i ) and M (t+ i ) of the treatment ai via (69) and (70). if W (t+ i ) < 0.25 then Let (cid:37) = 1, and ti+1 = ti. else (cid:46) The patient is dead Draw a random number τi according to an exponential distribution with a mean of 0.15(W (t+ i ) + 2)/M (t+ i ). Compute the critical time point ˆti via equation (73), and let ti+1 = min{ti + τi, ˆti, 5}. Compute the reward ri = ti+1 − ti, which represents the patient's actual survival time with the treatment ai at the ith stage. Compute the wellness wi+1 = W (ti+1) via equation (71). if ti+1 == 5 or i == 3 then (cid:46) The clinical trial ends Let (cid:37) = 1. else Let i ← i + 1. end if end if (cid:46) Go to the next stage (70) 18: end while Output: i stages of trajectory data {w1, a1, r1, * * * , wi, ai, ri, wi+1}. W (t+ i |B) = W (ti) − 0.25, M (t+ i |B) = 0.2M (ti)/W (ti). It can be seen that the aggressive treatment A yields a greater decrease in tumor size and wellness than the conservative treatment B. In the following, we rewrite both of W (t+ i |A) and W (t+ i |B) as W (t+ i ), and rewrite Wang et al.: DQL 59 both of M (t+ i |A) and M (t+ i |B) as M (t+ i ) for convenience. With the treatment, a patient's current survival time τi is drawn independently according to an exponential distribution, with a mean of 0.15(W (t+ i ) + 2)/M (t+ i ). The cancer dynamics after ti satisfy the following equations: W (t) = W (t+ i ) + (1 − W (t+ i ))(1 − 2−(t−ti)/2), M (t) = M (t+ i ) + 4M (t+ i )(t − ti)/3. (71) (72) Noted that the ith stage begins at time point ti, and ends at time point ti+1 such that M (ti+1) = 1 for some ti < ti+1 < 5, or the patient dies, or the clinical trial ends. Specifically, we can obtain the critical time point ˆti = ti + 0.75 (cid:19) (cid:18) 1 − M (t+ i ) M (t+ i ) (73) from M (ˆti) = 1, and thus compute the end of the ith stage via ti+1 = min{ˆti, ti + τi, 5}. The generation of the trajectory data is shown in Algorithm 2. We assume that only patients in urgent need of treatment are enrolled in the clinical trial, which means that all patients meet M (0) = 1 and thus t1 = 0. The wellness of patients at the beginning of the first stage is drawn independently according to the uniform distribution in the interval [0.5, 1]. A treatment is randomly chosen from the set {A, B} for each time point ti. The reward is defined as the actual survival time of the current stage. Due to the differences in initial wellness, survival time, and treatment policies for different patients, the generated trajectories may have different numbers of stages. Here, the total number of stages for all patients is limited to 3. For the missing stages of the trajectory data with a number of stages less than 3, we fill wellness and reward as zeros and randomly choose actions from the set {A, B} with equal probability, modifying the trajectory to a fixed length of 3. Appendix D: Introduction of Simulation 2 This section describes the process of generating trajectory data in Section 5.2. In this simulation, patients are monitored monthly for 6 months, and a treatment is applied to each patient at the beginning of each month. The relation of a drug's toxicity Wi, tumor size Mi, and drug dosage Ai of a treatment is characterized by the following system of ordinary difference equations: Wi+1 = Wi + 0.1(Mi ∨ M0) + 1.2(Ai − 0.5), Mi+1 = (Mi + (0.15(Wi ∨ W0) − 1.2(Ai − 0.5)) × 1Mi>0) ∨ 0, (74) (75) 60 Wang et al.: DQL for i = 1, * * * , 6, where a month is a treatment stage, ∨ is the maximum operation, and 1Mi>0 is an indicator function representing that there will be no future recurrence of the tumor when the tumor size reaches 0 (that is, the patient has been cured). The initial values of toxicity W1 and tumor size M1 are drawn independently according to the uniform distribution on the interval (0, 2). The drug dosage treatment sets for the first and last five stages are {0.51, 0.52, * * * , 1} and {0.01, 0.02, * * * , 1}, respectively. They are discretized from drug dosage intervals (0.5, 1] and (0, 1] with an increment of size 0.01. The action A1 and the actions Ai (i = 2, * * * , 6) are randomly chosen from the sets {0.51, 0.52, * * * , 1} and {0.01, 0.02, * * * , 1} with equal probability, respectively. To increase the stochasticity of the survival status, we define the conditional probability of death for the ith stage as pi = 1 − exp (− exp(Wi + Mi − 4.5)) . (76) The survival status (death is codes as 1) is drawn independently according to the Bernoulli distribution B(pi). The reward for each stage is assumed to depend on the states (including toxicity and tumor size) observed right before and after each action, and it can be decomposed into three types of rewards: Ri,1(Ai, Wi+1, Mi+1) related to survival status, Ri,2(Wi, Ai, Wi+1) related to toxicity change, and Ri,3(Mi, Ai, Mi+1) related to tumor size change. Specifically, they are defined by Ri,1(Ai, Wi+1, Mi+1) = −6, if patient died, otherwise, Ri,2(Wi, Ai, Wi+1) = Ri,3(Mi, Ai, Mi+1) =       0.5, if Wi+1 − Wi ≤ −0.5, −0.5, if Wi+1 − Wi ≥ 0.5, 0, if −0.5 < Wi+1 − Wi < 0.5, 1.5, 0.5, if Mi+1 = 0, if Mi+1 − Mi ≤ −0.5 and Mi+1 > 0, −0.5, if Mi+1 − Mi ≥ 0.5, 0, if −0.5 < Mi+1 − Mi < 0.5. (77) (78) (79) Because overall survival is the main focus of clinical interest, we take a high penalty of −6 for the death of a patient in the equation (77), and we take a relatively large bonus of 1.5 for the cure of a patient in the equation (79). In other cases, rewards are given according to the changes in toxicity and tumor size in two consecutive stages.
http://arxiv.org/abs/2302.10433v3
2023-07-07T13:32:30
2023-02-21T04:10:16
On discrete symmetries of robotics systems: A group-theoretic and data-driven analysis
We present a comprehensive study on discrete morphological symmetries of dynamical systems, which are commonly observed in biological and artificial locomoting systems, such as legged, swimming, and flying animals/robots/virtual characters. These symmetries arise from the presence of one or more planes/axis of symmetry in the system's morphology, resulting in harmonious duplication and distribution of body parts. Significantly, we characterize how morphological symmetries extend to symmetries in the system's dynamics, optimal control policies, and in all proprioceptive and exteroceptive measurements related to the system's dynamics evolution. In the context of data-driven methods, symmetry represents an inductive bias that justifies the use of data augmentation or symmetric function approximators. To tackle this, we present a theoretical and practical framework for identifying the system's morphological symmetry group $\G$ and characterizing the symmetries in proprioceptive and exteroceptive data measurements. We then exploit these symmetries using data augmentation and $\G$-equivariant neural networks. Our experiments on both synthetic and real-world applications provide empirical evidence of the advantageous outcomes resulting from the exploitation of these symmetries, including improved sample efficiency, enhanced generalization, and reduction of trainable parameters.
[ "Daniel Ordonez-Apraez", "Mario Martin", "Antonio Agudo", "Francesc Moreno-Noguer" ]
10.15607/RSS.2023.XIX.053
[ { "@title": "doi", "@href": "http://dx.doi.org/10.15607/RSS.2023.XIX.053", "@rel": "related", "@type": null }, { "@title": null, "@href": "http://arxiv.org/abs/2302.10433v3", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10433v3", "@rel": "related", "@type": "application/pdf" } ]
[ "Robotics: Science and System 2023" ]
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.RO", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.RO", "cs.LG", "cs.SY", "eess.SY", "37J15,", "J.2" ]
On discrete symmetries of robotics systems: A group-theoretic and data-driven analysis Daniel Ordonez-Apraez∗†, Mario Martin‡§, Antonio Agudo† and Francesc Moreno-Noguer† ∗ Istituto italiano di tecnologia IIT, Dynamic Legged Systems IIT-DLS & Computational Statistics and Machine Learning IIT-CSML † Institut de Rob`otica i Inform`atica Industrial CSIC-UPC. ‡ Universitat Polit`ecnica de Catalunya UPC. § Barcelona Supercomputing Center BSC [email protected], [aagudo, fmoreno]@iri.upc.edu, [email protected] 3 2 0 2 l u J 7 ] O R . s c [ 3 v 3 3 4 0 1 . 2 0 3 2 : v i X r a Abstract-We present a comprehensive study on discrete mor- phological symmetries of dynamical systems, which are com- monly observed in biological and artificial locomoting systems, such as legged, swimming, and flying animals/robots/virtual char- acters. These symmetries arise from the presence of one or more planes/axis of symmetry in the system's morphology, resulting in harmonious duplication and distribution of body parts. Signif- icantly, we characterize how morphological symmetries extend to symmetries in the system's dynamics, optimal control policies, and in all proprioceptive and exteroceptive measurements related to the system's dynamics evolution. In the context of data-driven methods, symmetry represents an inductive bias that justifies the use of data augmentation or symmetric function approxi- mators. To tackle this, we present a theoretical and practical framework for identifying the system's morphological symmetry group G and characterizing the symmetries in proprioceptive and exteroceptive data measurements. We then exploit these symmetries using data augmentation and G-equivariant neural networks. Our experiments on both synthetic and real-world applications provide empirical evidence of the advantageous outcomes resulting from the exploitation of these symmetries, including improved sample efficiency, enhanced generalization, and reduction of trainable parameters. I. INTRODUCTION Discrete Morphological Symmetries (DMSs) are ubiquitous in both biological and robotic systems. The vast majority of living and extinct animal species, including humans, exhibit bilateral/sagittal reflection symmetry, where the right side of the body is approximately a reflection of the left side (see fig. 1-left). Similarly, a significant number of species exhibit radial symmetry, characterized by two or more morphological symmetry planes/axis (see fig. 1-center) [11]. These symme- tries are a consequence of nature's tendency to symmetric body parts and harmonic duplication and distribution of limbs. A pattern perfected and exploited in the design of robotic systems. To exploit morphological symmetries for control, learn- ing, and computational design, it is necessary to establish a rigorous definition of morphological symmetry within the framework of dynamical systems theory. In section IV, we define a DMS as an energy-preserving linear transformation of the system state configuration, which allows the system to imitate some reflection, rotation, or translation of space. For instance, see how the bipedal robot Atlas and the quadruped Solo in fig. 1 imitate the reflection of space (gs) with a discrete change in their body and limbs pose (state configuration). The existence of a DMS is subjected to constraints in the system's morphology, which manifest in identifiable symmetry con- straints of the system's generalized mass matrix (section III). Symmetries of the state-space of a dynamical system trans- late to symmetries of the system's dynamics and control [29]. Thus, DMSs imply the presence of symmetries in the dynamics and control of body motions, resulting in sym- metries in all proprioceptive and exteroceptive measurements related to the evolution of the system's dynamics (e.g., joint position/velocity/torque, depth images, contact forces). This property, in data-driven applications, opens the door for the use of data augmentation to mitigate challenges of data collection in the fields of robotics, computer graphics, and computational biology. Similarly, the use of symmetry constraints in machine learning algorithms is a known technique to enhance general- ization and sample efficiency, while reducing the number of trainable parameters [29, 6, 23]. Despite the potential benefits of exploiting symmetry and the ubiquitous presence of morphological symmetries in robotic/biological/virtual systems, this relevant inductive bias is frequently left unexploited in data-driven applications in robotics, computational biology, and computer graphics. We attribute the scarce adoption of these techniques to a miss- ing theoretical framework that consolidates the concept of morphological symmetries, facilitating their study and iden- tification. And, to a missing practical framework enabling the efficient and convenient exploitation of symmetries in real- world data-driven applications. The identification of morphological symmetries and how these extend to symmetries of proprioceptive and exteroceptive data is currently a laborious and error-prone system-specific process, due to the lack of a clear theoretical framework. As a result, most recent works that exploit some morphological symmetry (e.g., [27, 1, 28] in computer graphics and [23, 16, 9, 5] in robotics/dynamical systems) have only been applied to simple systems and the simplest morphological symmetry: reflection/sagittal symmetry (see fig. 1-left), with the exception of Finzi et al. [5]. However, these works provide little guidance on how to apply these techniques to other systems, particularly those with more than a single morphological symmetry. Contrary to previous works, this paper focuses on under- standing and exploiting morphological symmetries in arbi- trary dynamical systems, with any number of symmetries. To achieve this, we study morphological symmetries from the lens of dynamical systems and of group theory (the field of C2 = ¶ e, gs | g2 © s = e ¶ K4 = e, gs, gt, gr | g2 s = g2 t = g2 r = e, gr = gsgr © gr * x gt * x gs * x x Reflection plane of gs h gs * h f1 gs * f1 e gs gs gs * f1 l k f1 gs * h . = h (cid:105) (cid:104) l k gs gs e gt r g gt gr gs gt f (x; φ) 0z l−1z gr * f1 gr * h gt * h gt * f1 × σ × σ 0W lW 0B:,:,r 0 B l B 0 c + l c + 0B:,:,1 gr * y gt * y gs * y y g * y = f (g * x; φ) | ∀ g ∈ K4 . = φ (cid:110)0 l c, . . . , (cid:111) c Fig. 1: Left: Symmetric configurations of the bipedal robot Atlas (3D animation) illustrating its morphological symmetry described by the reflection group C2. The robot can imitate reflections gs (hint: note the non-reflected text on the chest). Middle: Top-view of symmetric configurations of the quadruped robot Solo (3D animation) showcasing its morphological symmetries described by the Klein four-group K4. The robot can imitate two perpendicular reflections (gs, gt) and a 180◦ rotation (gr) of space (hint: observe the unreflected/unrotated robot's heading direction and legs coloring). Symmetry transformations (arrows) affect the robot's configuration, as well as proprioceptive measurements (center of mass linear l and angular k momentum) and exteroceptive measurements (terrain elevation, external force f1). Right: Diagram of a toy K4-equivariant neural network, processing the symmetric states of robot Solo x and outputting the symmetric binary foot contact states y (see section V). mathematics that studies symmetries, broadly used in machine learning and physics) (sections II and III). In summary, our work presents the following theoretical contributions: abstraction of the set of symmetries that different geometric objects have. Understanding symmetry as a transformation that conserves a relevant property of the object (e.g. energy). ❈ Identification of the set of DMSs of a dynamical system as a symmetry group G, that is isomorphic to a group of isometries of the Euclidean space (section IV). ❈ Characterization of DMSs as transformations to which the system's generalized mass matrix is equivariant. Enabling algorithmic identification of G (section III). ❈ Characterization of how symmetries in proprioceptive and exteroceptive measurements arise from DMSs. Furthermore, our practical contributions (section V) are: ✥ An open-access repository1 with example dynamical sys- tems with DMSs, and the tools to prototype large-scale G-equivariant Neural Networks (NN) for arbitrary DMSs. ✥ Proof of an approximate 1/|G| reduction in the trainable parameters of NN. Being |G| the number of DMSs. ✥ Derivation of an optimal initialization for the trainable parameters of G-equivariant NN layers. Lastly, we provide optional appendices where we extend our theoretical derivations and provide tutorial-like examples. II. BACKGROUND ON SYMMETRY GROUPS Group theory is the default language for studying symmetry transformations. Thus, we provide a shallow introduction to the field2 and define the notation required for our develop- ment. In a nutshell, a symmetry group in group theory is an 1 github.com/Danfoa/MorphoSymm 2Being this short section undoubtedly an unsatisfactory introduction to group theory, we refer the uninitiated and interested reader to Carter [4] for intuition and to Bronstein et al. [2] for a machine learning introduction. For instance, in fig. 1-left the reflection group C2 describes the symmetries that vectors, pseudo-vectors, rigid-bodies, and the robot Atlas have to a reflection of space gs. Being the symmetries, transformations that preserve vector magnitudes and the robot's energy. Similarly in fig. 1-center, the Klein four-group K4 describes the symmetries that the quadruped robot Solo has to 180◦ rotations (gr) and two perpendicular reflections (gs, gt). While on fig. 1-right the same group describes the symmetries of the input x and output y vector spaces of a K4-equivariant NN. This formalism enables us to study the set of DMSs of a system and the set of symmetries of proprioceptive and exteroceptive data measurements as different representations of the same symmetry group. Formally, a symmetry group is a set of invertible symmetry transformations (or actions) G = {e, g1, g-1 1 , g2, . . . }, including the trivial action e, which leaves objects unchanged. A group has an associative com- position operator (*) : G × G → G mapping group actions to other group actions. Since two different geometric objects can share the same symmetry group, an action of the group must act differently on the two objects. Here, is where group representations allow us to use the familiar language of linear algebra to characterize how an action g transforms a specific geometric object, say x ∈ X ⊆ Rk. A representation ρX : G → GL(k) is a mapping from group actions to the set of invertible square matrices of k dimensions (the General Linear group GL). Thus, a representation specifies how objects x ∈ X are transformed by group actions: g * x . = ρX (g)x. A fundamental concept for this work is the notion of function G-equivariance and G-invariance. The function f : Rn → Rm, is said to be G-equivariant or G-invariant if: g * y = f (g * x) | ∀g ∈ G (cid:125) (cid:123)(cid:122) (cid:124) Equivariance . or y = f (g * x) | ∀g ∈ G (cid:125) (cid:123)(cid:122) Invariance (cid:124) (1) Roughly speaking, an equivariant function maps symmetries of the input to symmetries of the output, while an invariant function maps symmetries of the input to an invariant output. III. LAGRANGIAN MECHANICS AND SYMMETRIES OF DYNAMICAL SYSTEMS Here we provide a group-theoretic perspective of symme- tries in an arbitrary dynamical system. The definitions and notations of this section are fundamental for understanding the objective of this work, namely DMSs. To this end, let us consider a dynamical system with generalized coordinates q ∈ Q ⊆ Rn and velocities ̇q ∈ Tq Q ⊆ Rn. Being Q the constrained configuration space, and Tq Q the space of constrained generalized velocities (i.e., the configuration tan- gent space at q). Additionally, consider a Lagrangian function L : Q × Tq Q → R = T (q, ̇q) − U(q, ̇q) specifying the energy state of the system at any state. Where T (q, ̇q), U(q, ̇q) describe the state kinetic and potential energies, respectively. The symmetries of a dynamical system are defined as transformations in the space of generalized coordinates that keep the energy of the system invariant [18, 13]. In this work, we focus on time-invariant linear transformations of generalized coordinates ρQ(g) : Rn → Rn, which are the . representations of actions of a symmetry group: g * q = ρQ(g)q | ∀ q ∈ Q, g ∈ G. Note that because of the linearity of the transformation, the velocity and acceleration of the . = ρQ(g) ̇q and transformed coordinates are given by g * g * ̈q . = ρQ(g) ̈q, respectively. ̇q Formally, we say that a dynamical system has a symmetry group G if its Lagrangian is G-invariant: L (q, ̇q) = L (g * q, g * ̇q) | ∀g ∈ G, q ∈ Q, ̇q ∈ Tq Q. (2) Being g a feasible symmetry if the transformed state is a feasible state, i.e. when g * q ∈ Q and g * ̇q ∈ Tq Q (assuming both Q and TqQ are connected sets). Since the Lagrangian structure differs between the original (q, ̇q) and transformed coordinates (g * q, g * ̇q) | ∀ g ∈ G, when we derive the Equations of Motion (EoM) of the system in the set of transformed coordinates, we obtain a set of EoMs describing the system dynamics in differ- ent coordinate systems. Formally, if we derive the EoM through the Euler-Lagrange equation of the second order Ä d ∂q ≡ M(q) ̈q − τ (q, ̇q) = 0 , the distinct dt EoM are equivariant to each other [13], a property we will refer to as dynamics G-equivariance: ∂ ̇q − ∂L(q, ̇q) ∂L(q, ̇q) ä g * [M(q) ̈q (cid:124) (cid:123)(cid:122) (cid:125) Inertial − τ (q, ̇q) (cid:124) (cid:123)(cid:122) (cid:125) M oving ] = M(g * q)g * ̈q (cid:125) (cid:123)(cid:122) Inertial (cid:124) (cid:124) − τ (g * q, g * ̇q) (cid:123)(cid:122) (cid:125) M oving ̇q ∈ Tq Q. = 0 (3) | ∀ g ∈ G, q ∈ Q, Denoting M(q) : Q → Rn×n as the generalized mass matrix function and τ (q, ̇q) : Q × Tq Q → Rn as the generalized moving forces at a given state (q, ̇q). Note that, in eq. (3) the original and transformed dynamics are related linearly by the Jacobian of the coordinate transformation [25]. Which in this case is ρQ(g) (reduced to g to preserve notation). Note that to ensure dynamics G-equivariance (eq. (3)), both the generalized inertial and moving forces need to be independently equivariant, implying: M(g * q) = gM(q)g-1 ∧ g * τ (q, ̇q) = τ (g * q, g * ̇q) | ∀ g ∈ G, q ∈ Q, ̇q ∈ Tq Q. (4) The resultant G-equivariance of the generalized mass matrix becomes an identifying property of symmetrical systems, providing a pathway for the identification of action represen- tations of the symmetry group ρQ(g) | g ∈ G (section IV-B). While the equivariance of the generalized moving forces (which in practice usually incorporates control, constraint, and external forces) implies that dynamics G-equivariance (eq. (3)) is upheld until a symmetry breaking force violates the equivariance of τ . To gain some intuition, consider as an example the bipedal robot Atlas, with symmetry group G = C2 = {e, gs}. Accord- ing to eq. (2) both robot states in fig. 1-left are symmetric states (related by the action gs). Then, eq. (3) suggests that any trajectory of motion, starting from the left robot state, will be equivalent (up to transformation by gs) to a motion trajectory starting from the right robot state, if and only if, the moving forces driving both trajectories are equivalent (up to transformation by gs). That is if the control and external forces are C2-equivariant (eq. (4)). Note, we can perform a similar analysis for each symmetric state and action of systems with larger symmetry groups (e.g. Solo in fig. 1-center). î XB ˆq ó ∈ Ed ∈ QJ Floating-base dynamical systems: All robotic, biological, and virtual systems that move in a Euclidean space of d di- mensions, can be modeled as floating-base dynamical systems. Hence, without loss in generality, we assume the system's . = Ed × QJ , configuration space can be decoupled into Q being Ed the space of all possible base configurations (all rotations/reflections and translations), and QJ the joint-space (or internal configuration space). Resulting in the decoupling . Where XB is a homogenous matrix q = describing the base position and orientation in d dimensions 3 , and ˆq ⊆ RnJ represents the internal Degrees of Freedom (DoF) configuration. This separation of the configuration space becomes useful to study the effect of a symmetry transforma- tion, since, we decouple the effect of the symmetry actions 0 g * q = ρQ(g) q = (cid:12) ∀ g ∈ G. With ρQJ (g) d (g) ∈ Ed and ρQJ (g) ∈ RnJ ×nJ being representations of ρE how action g transforms the base and joint-space configuration. Symmetries due to Euclidean isometries: floating-base sys- tems are known for having symmetries to (some) translations, (cid:105)î XB ˆq d (g) 0 (cid:104) ρE ó (cid:12) 3We use the homogeneous matrix representation of XB instead of a vector-quaternion representation, with some abuse of notation. rotations, and reflections of space (i.e. Euclidean isometries). Giving origin to the conservation of linear/angular momentum, in conservative systems[15]. We can understand these as: Definition 1 (Symmetry due to Euclidean isometries). A . floating-base system with generalized coordinates q ∈ Q = Ed × QJ , is said to be symmetric w.r.t a set of Euclidean isometries g ∈ G ⊆ Ed (involving a true rotation, reflection or translation in space), if eq. (2) holds for G. Because rotations, reflections, and translations of space preserve the mass and inertia of bodies, as well as dis- tances between them, these symmetries leave both the joint- space configuration and the generalized mass matrix invariant: ρQJ (g) = InJ and M(g * ˆq) = M( ˆq) | ∀ g ∈ G ⊆ Ed. IV. DISCRETE MORPHOLOGICAL SYMMETRIES (DMSS) A dynamical system is said to possess a DMS if it can imitate the effects of a rotation, reflection, or translation in space through a feasible discrete change in its configuration. To gain some intuition, before introducing a formal definition, we can analyze the simplest and most common DMS. Reflection DMS: Although most floating-base dynamical systems are symmetric with respect to reflections of space (definition 1), these symmetries are infeasible due to the impossibility to execute reflections in the real-world [21]. However, systems with sagittal symmetry (e.g., Atlas in fig. 1- left, or humans) can imitate the effect of a reflection with a feasible discrete change in their configuration, by rotating their body and modifying their limbs' pose. These systems share the same symmetry group, the reflection group G ≡ C2. Multiple DMSs: This property can be extended to the case of a floating-base system having multiple DMSs, allowing it to imitate multiple distinct Euclidean isometries. Most frequently systems can imitate a set of rotations and reflections, making G a Cyclic Ck or Dihedral D2k group. See examples for C3 in fig. 6, and for D4 ≡ K4 in fig. 1-center. We can formalize this property with as: Definition 2 (Discrete morphological symmetry). A floating- . base dynamical system with generalized coordinates q ∈ Q = Ed × QJ , is said to have a DMS if, for a given Euclidean isometry g ∈ Ed, there exists a feasible action g ∈ G with a non-trivial representation in joint-space (ρQJ (g) ̸= InJ ), such that both g and g are equivalent symmetries of the system: L (q, ̇q) = L (g * q, g * ̇q) = L (g * q, g * ̇q) considering that in any system state: L(cid:0)î ρE d (g )XB ˆq (cid:104) ρE d ó , (g ) ̇XB ̇ˆq (cid:12) (cid:12) (cid:12) (cid:12) (g)XB (g) ˆq (cid:105)(cid:1) = L(cid:0)î ρE d ρQJ d (g)| = ±1, |ρE |ρE d (g)X = ρE ρE ó (cid:104) ρE , d ρQJ d (g)| = 1 d (g)-1 d (g)XρE (g) ̇XB (g) ̇ˆq (cid:105)(cid:1) (6) Where the existence of the DMSs is subjected to the system's generalized mass matrix being G-equivariant (eq. (4)), and to the transformation ρE d (g) (defined through group conjugation) being proper/feasible. In practice, these restrictions represent a pathway for the identification of G for any floating-base system (section IV-C). A. Data augmentation in systems with DMS Recall from section III that due to the linearity, the action representation ρQ(g) acts on elements of configuration space Q, configuration tangent space Tq Q and any higher order tangent spaces, including the spaces of generalized acceler- ations and forces g * τ = ρQ(g)τ (eq. (3)). Since for floating- . = Ed × QJ , this property translates to the base systems Q action representations on Ed and QJ . This effectively implies that ρE d (g) can be used to augment any point, vector, and orientation in Ed and in Ed higher order tangent spaces (e.g. linear & angular veloci- ties/accelerations, depth maps, external forces, terrain height- maps). Likewise the representation ρQJ (g) can be used to augment members of QJ and its higher order tangent spaces (e.g. joints positions/velocities/accelerations/torques). locations of tactile sensing, d (g), ρE In practice, this means that any proprioceptive and extero- ceptive measurements relevant to the evolution of the system's dynamics can be augmented solely with combinations of d (g) and ρQJ (g). Since these measurements consist ρE of elements in QJ , Ed, and their higher order tangent spaces (see examples in sections C-C1 and C-D1). Furthermore, for any data point, there exist |G| symmetric data points (being |G| the order of the symmetry group). Therefore, for a system with a symmetry group of order, say, |G| = 4 (as in fig. 1- center), we can obtain an additional 3 minutes of recordings for every minute of recorded data simply by considering the symmetric states of the data. To exploit the symmetries in the measurements, we first need to identify the joint-space representations ρQJ (g), which requires additional assumptions about the system's dynamics. In this work, we focus on the case of rigid-body dynamics, although a similar analysis can be extended to other types of systems, such as soft robots. | g ∈ G, g ∈ Ed, ∀ g * q, q ∈ Q, g * ̇q, ̇q ∈ Tq Q. (5) B. DMS in the case of rigid-body dynamics The set of DMSs of the system forms its symmetry group G. Because each DMS is related with a system's symmetry g due to a Euclidean isometry (definition 1), the group G is isomorphic to a subset of the Euclidean isometries of the system. Hence, after identifying a potential Euclidean isometry to imitate g ∈ Ed, we can determine the DMS representation, Consider dynamical systems composed of nB intercon- nected rigid bodies evolving in Ed. This is the usual scenario in robotics, computer graphics, and computational biology. (cid:80)nB k mk ̇r2 The kinetic energy for these systems is determined by 2 ̇q⊺M(q) ̇q. Being T (q, ̇q) = 1 2 mk, Ik, ̇rk and w k the mass, inertia, linear velocity, and angular velocity of body k. Considering that the energy- preservation property of symmetries (eq. (2)) is dependent kIkw k = 1 k + w ⊺ solely on the G-equivariance of M(q) (eq. (4)), we can assert the existence of DMSs by analyzing M(q). The generalized mass matrix is given by M(q) = (cid:80)nB k JTk (q)⊺mkJTk (q) + JRk (q)⊺IkJRk (q), being JTk (q) : Q → Rd×n and JRk (q) : Q → Rd×n the position and orientation Jacobians, used to map generalized velocities to the linear ( ̇rk = JTk (q) ̇q) and angular (w k = JRk (q) ̇q) velocities of the body k [26]. These Jacobians are functions of the kinematic parameters of the system4. While the mass and inertia of all bodies are the system's dynamic parameters. A DMS implies symmetries over both kinematic and dynamic parameters. Symmetries of kinematic parameters (Kinematic Tree): The symmetry in kinematic parameters can be thought of as a kinematic tree symmetry. I.e., the DMS g must transform the system state in a way that produces a kinematic tree indis- tinguishable from the one obtained by applying the Euclidean isometry g. Ignoring the dynamic parameters makes it easier to see this. Consider that applying the Euclidean isometry g conserves kinetic energy as velocity vectors are only rotated or reflected. Hence, for g to imitate the effect of g, the velocity of the kth body after applying g must be equal to the velocity of the ith body after applying g. In other words, g * ̇rk = g * . ̇ri = JRi(g * q)g * ̇q | ∀ {(k, i)|k, i ∈ [nB]}. This results in the following position Jacobian constraints: . = JTi (g * q)g * ̇q and g * w k = g * w i JTi(g * q)g = g * JTk (q) | ∀q ∈ Q, {(k, i)|k, i ∈ [nB]} (7) d (g) * JTk (q). JTi(ρQ(g)q)ρQ(g) = ρE Analog constraints apply to the rotational Jacobian. Equation 7 specifies the kinematic parameter constraints required for g to be a DMS, ensuring the g-equivariance of M(q). Note that If k ̸= i, the representation ρQJ (g) entails a permutation of the i and k joint-space configurations. For example, gs swaps the left and right leg configurations of Atlas and Solo in Figure 1. Symmetries of dynamic parameters (Mass & Inertia): In addition to the kinematic tree symmetry of eq. (7), the mass, CoM, and inertia of the bodies i and k must be equivalent for g to preserve kinetic energy. To understand this morphological constraint, consider how, in eq. (6), the base body configura- tion XB ∈ SEd is transformed by the DMS ρE d (g) ∈ SEd, d (g) ∈ Ed. For both base and by the Euclidean isometry ρE configurations to have the same dynamics, their CoM must coincide, and crucially, the reflected Inertia matrices IB need to be identical. This constraint is satisfied if the reflected In- d (g)-1. In ertia is invariant to the transformation XB = XBρE practice, this invariance implies a symmetric mass distribution of the rigid body (see geometric proof in section A-B). Let's consider the robot Solo in fig. 1-center as an ex- ample. It can imitate two reflections of space (gt, gs) and a 180◦ rotation gr. The existence of the robot's DMSs can be attributed to two factors. First, the base body of Solo 4The Denavit–Hartenberg parameters are a common convention of kine- matic parameters adopted in robotics and computer graphics. Fig. 2: Left: Solo sagittal (blue) and transversal (red) symme- try planes of the base body. Right: Solo's kinematic tree, and permutation symmetries of the legs/tree-branches. possesses two symmetry planes (fig. 2), leading to symmetric mass distributions and the invariance of the body's reflected d (g)-1 | g ∈ K4. Second, inertia under the transformation XBρE the modularity of the kinematic tree. This arises from all four legs (tree branches) being structurally identical, resulting in the tree branches having equivalent inertial and kinematic parameters (see fig. 2). Consequently, we can define each ρQJ (g) as a permutation of the leg configurations. For instance, for gs, the configurations of the left and right legs are inter- changed, while for gt the front and back legs' configuration is interchanged. It is important to note that this interchange of leg configurations would violate eq. (2) if the legs were not composed of identical/reflected rigid bodies (i.e, having different mass distributions) and would violate eq. (3) if the dynamics and constraints of the leg joints differed (e.g., different position/velocity/torque limits). C. Identification of DMS group G in rigid-body dynamics The identification of the DMS group G in a floating-base dynamical system composed of rigid bodies can be achieved through the following four steps (see tutorial examples in fig. 6): 1) Identify all the unique bodies in the kinematic tree, including the base of the system, ensuring there are no duplicated or reflected versions of the same body. 2) Determine the set of Euclidean isometries g ∈ Ed for which the inertia of each unique body remains invariant. These candidate Euclidean isometries represent potential DMSs for the system. 3) Identify any modularity in the kinematic tree, such as sets of duplicated or reflected symmetric kinematic subchains. 4) Utilize eq. (7) to assess the feasibility and existence of ρQJ (g) ∈ G, progressing from the base to the end- effectors. While the presented analysis may seem extensive for simple systems and DMS groups, these abstractions open avenues for studying more complex systems and symmetry groups, enabling computational design of symmetric robotic systems, as well as algorithmic identification of DMSs and data aug- mentation. V. G-EQUIVARIANT FUNCTION APPROXIMATORS G-equivariant W as: After identifying the DMS group G of our system (sec- tion IV-C) and understanding how these symmetries mani- fest in proprioceptive and exteroceptive measurements (sec- tion IV-A), we can now exploit these symmetries in our data. Consider the symmetric input X and output Y vector spaces, of any G-equivariant/invariant (eq. (1)) function f : X → Y, that we desire to approximate with a model ˆf . We assume that X and Y are symmetric spaces as they are composed of (po- tentially several) proprioceptive/exteroceptive measurements. For instance, both spaces could contain measurements of the system state, terrain elevation, external forces, depth images, contact states, etc. See section VI for examples. To enhance the generalization and sample efficiency of our approximation, we can enforce the G-equivariant/invariant constraints of the original function on our model ˆf . In this sec- tion, we outline the process of incorporating these constraints when ˆf is a neural network parameterized by φ. By imposing symmetry constraints, we can reduce the number of trainable parameters in the architecture. Our approach builds upon the theory and implementation of Finzi et al. [6]'s framework for G-equivariant NNs. Our main motivation is to overcome the limitations that hinder the construction of large-scale G- equivariant NNs, which are commonly encountered in real-life applications (see details in Section B). Consider c to be composed of multiple perceptrons (or convolutional) layers of the form ly := σ(lW lx + lb), where lx ∈ Rn, ly ∈ Rm are the lth layer input-output. lW ∈ Rm×n and lb are the layer's linear map and bias; and σ : R → R is a strictly monotonic nonlinearity [20]. With this parametrization, the equivariance constraints of eq. (1) can be reduced to constraints on the linear map W (dropping the layer index l for notation clarity):5 ρout(g)W = Wρin(g) ⇐⇒ (ρW(g) − I)w = 0 | ∀ g ∈ G. (8) The right-side of eq. (8) is a reformulation of the linear map equivariance constraints (left-side) as a standard set of linear equations. Denoting w = vec(W) ∈ Rmn as a vectorized ⊺ ∈ Rmn×mn version of W and ρW (g) = ρout(g) ⊗ ρin(g-1) as the action representation acting on the parameter space of the linear map (⊗ stands for the Kronecker product). Here, we consider the group acting on W a semi-direct product6 of the input and output groups (refer to Finzi et al. [6] for details). Since the constraint imposed by each g is linear in W, we can stack them into a single large system of linear equations Cw = 0. The nullspace of this system of equations B ∈ Rmn×r describes the r basis vectors spawning the entire space of equivariant linear maps. Allowing to parameterize all 5A similar analysis can be made for the bias vector b. 6 Since with DMSs the input and output symmetry groups are isomorphic, using a direct product in eq. (8) implies an over-constraining of the linear map. Resulting in an excessive reduction in the number of trainable parameters. w = (cid:80)r kckB:,k ⇐⇒ W = (cid:80)r . = (cid:80)r kck unvec(B:,k) kckB:,:,k. (9) Where the basis coefficients c ∈ Rr represent the free vari- ables of the system of equations and the trainable parameters of the equivariant layer (see fig. 1 right). A. Dealing with memory complexity of equivariant layers: An equivariant layer needs to store the matrices ρW (g) ∈ Rmn×mn and B ∈ Rmn×r, in addition to the typical memory complexity of a perceptron or convolutional layer. These matrices' memory complexity quickly becomes intractable for moderate input-output dimensions (see section C). Fortunately, the symmetry groups of DMSs (finite groups) have sparse action matrix representations, resulting in both of the afore- mentioned matrices being highly sparse. We extend the API from Finzi et al. [6] to handle sparse matrix representations, limiting the additional memory footprint to a minimum. B. Dealing with the computational complexity of determining the equivariant basis B Computing B amounts to finding the nullspace of a large linear system of equations. Finzi et al. [6] proposes a Krylov gradient-based method able to handle both finite and Lie groups' arbitrary representations. While Van der Pol et al. [23] approximates B through SVD of a matrix ̄W ∈ Rz×mn (z ≥ mn). Both approaches run in polynomial time O(r2(mn)2) and approximate the space rank r numerically. These ap- proaches become intractable for large vector spaces. To handle the computational cost we exploit the fact that for DMSs all ρQJ and ρYl (representations of the output space of internal layers of the NN), can be expressed as permutation representations. Reducing the computation of the nullspace B to a search of the permutations (or orbits) of each dimension of w. A problem that can be solved in linear time. For permutation representations, the constraints imposed by each ρW(g) on w can be interpreted as parameter sharing con- straints. Becoming every unique orbit of the dimensions of the linear map G*wk = {g*wk : ∀ g ∈ G} = {wk, −wi, . . . , wj}, a vector of the null-space of C (i.e., Bi). Each unique orbit describes the sharing scheme of a free variable of the system of equations, that is, the sharing of the trainable parameter ci over multiple positions in W (see the parameter orbits of length 4 in fig. 1-right, for K4). The orbits of all w ∈ w are trivially computed with [w, ρW(g1)w, . . . , ρW(g|G|)w], while the unique r orbits can be identified in O(mn) time. Our proposed solution can be thought of as a linear-time version of Ravanbakhsh et al. [20]. C. Optimal parameter initialization for equivariant layers Proper initialization of the equivariant layer's trainable pa- rameters cl (eq. (9)) is required to avoid activations/gradients from vanishing or exploding [12]. Following the same deriva- tion of the Kaiming initialization [10] (see section B-B), we can conclude that the parameters should be initially sampled Fig. 3: CoM-estimation results comparing MLP, MLP-aug, and EMLP models. Left and Middle: Test set sample efficiency of model variants with different capacities (number of neurons hc in hidden layers) for robot Solo and Atlas. Right: Sample efficiency for robot Solo with models having hc = 512, when exploiting G = K4 (sagittal and traversal symmetries) and G = C2 = e, gs ⊂ K4 (only sagittal symmetry). The plots depict the average and standard deviation across 10 seeds. from a distribution with Var(cl) = m/λB γσ, to ensure con- stant variance of activations throughout the network layers (see fig. 7). Where λB = (cid:80)m i:j:k and γσ is a i nonlinearity dependant scalar (e.g., γReLu = 1/2, γSeLu = 1 following Klambauer et al. [12]). This initialization depends only on B. Thus, is applicable for any symmetry group. k B2 (cid:80)n j (cid:80)r D. Reduction of trainable parameters in equivariant layers: Determining analytically the number of trainable parameters (i.e. the rank r) of an G-equivariant layer is, in general, an un- resolved problem. However, for DMS groups and permutation representations, it becomes trivial to show that the number of trainable parameters of a G-equivariant layer can range from |w|/|G| ≤ r ≤ |w|, depending on the number of dimensions of the input-output spaces left invariant by the symmetry actions (see details in section B-A). In practice, this implies that for a G-equivariant layer without any input-output fixed points (e.g., all intermediate layers of a G-equivariant NN), the number of trainable parameters is reduced by 1/|G| being |G| the group order. Therefore a G-equivariant architecture with G = C2 (or G = K4) will have approximately 1/2 (or 1/4) of the trainable parameters of an unconstrained NN of the same architectural size (this applies to NN processing data from robot Atlas and Solo fig. 1). The reduction of parameters is caused by the parameter sharing constraints (eq. (9)) and is visually depicted in fig. 1-right. VI. EXPERIMENTS A. CoM momentum estimation (Regression) In this experiment, we train a NN to approximate a robot's center-of-mass momentum given the joint-space position and velocities: h = AG( ˆq) ̇ˆq, where h = [l⊺ k⊺]⊺ are the linear l and angular k momentum components and AG is the Centroidal Momentum Matrix (CMM) of Orin et al. [17]. This analytical function is highly non-linear and G-equivariant w.r.t the robot's symmetry group G (eqs. (18) and (20)). We test two robots: Atlas, a 32-DoF humanoid robot with G = C2 sagittal reflection symmetry (fig. 1-left), and Solo, a 12-DoF quadruped robot with G = K4 (fig. 1-center). We compare tree function approximation variants: a standard Multi-Layer Perceptron (MLP), an augmented MLP s(MLP- aug), and a hard-equivariant MLP (E-MLP). In fig. 3-left-&-middle, we compare the model variants. Across both robots and all model capacities, E-MLP and MLP- Aug outperform MLP in terms of sample efficiency (better generalization with fewer data) and robustness to overfitting when training data is limited. Among the E-MLP and MLP- Aug variants, lower capacity versions exhibit similar behav- ior, but as capacity increases, E-MLP demonstrates superior sample efficiency and generalization. In addition, fig. 3-right shows a comparison for the Solo robot, evaluating the perfor- mance of the model variants when exploiting either the entire symmetry group (K4) or a subgroup of the true symmetry group (C2 ⊂ K4). The results indicate that sample efficiency and generalization capacity increase with the number of true symmetries of the data exploited. We demonstrate the effectiveness of DMSs for data augmen- tation and training equivariant functions through two super- vised learning experiments: a regression task using synthetic data and a classification task using real-world data. These experiments showcase the impact of exploiting DMSs on sample efficiency and generalization capacity. While we keep the presentation concise, all the technical aspects are detailed in section C and the code repository 1. B. Static-friction-regime contact detection (Classification) In this experiment, we utilize the dataset introduced in Lin et al. [14] for estimating static-friction-regime contacts in the foots of the Mini-Cheetah quadruped robot. The dataset ̇ˆq, base linear consists of real-world proprioceptive data ( ˆq, acceleration, base angular velocity, and leg feet positions and velocities) captured over a history of 150 time-frames. These measurements were obtained from inboard sensors during Fig. 4: Static-Friction-Regime contact detection results comparing CNN, CNN-aug, and ECNN. Left: Sample efficiency in log-log scale. Middle: Average legs F1-score. Right: Classification metrics on test set performance of models trained with the entire training set. The selected metrics include contact-state (y ∈ R16) accuracy (Acc) and f1-score (F1) for each leg binary contact state. Due to the sagittal symmetry of the robot, the left front (LF) and right front (RF) legs are expected to be symmetric, as well as the left hind (LH) and right hind (RH) legs. F1-score is presented considering the dataset class imbalance (see section C-D). The reported values represent the average and standard deviation across 8 different seeds. locomotion, encompassing various gaits and terrains. The dataset also includes y ∈ R16, representing the ground truth contact state of the robot, which was estimated offline using a non-causal algorithm. Our goal is to train a causal function approximator ˆf (x; φ) to predict the contact state based on the input proprioceptive data. The Mini-Cheetah robot in the real-world exhibits an ap- proximate reflection symmetry group, G ≈ C2. As a result, both the proprioceptive data x and the contact state y share the symmetry group G (see section C-D). In this experiment, we compare three variants of function approximators: the original Convolutional Neural Network architecture proposed by Lin et al. [14] (CNN), a version of CNN trained with data augmentation (CNN-aug), and a version of CNN that incorporates hard-equivariance constraints (E-CNN). The sampling efficiency and average leg contact state classi- fication results are depicted in fig. 4-left-&-middle. The equiv- ariant model, E-CNN, demonstrates superior generalization performance and robustness to dataset biases compared to the unconstrained models (refer to section C-D2). Following E- CNN, CNN-aug exhibits better performance than the original CNN. In fig. 4-right, we evaluate the classification metrics of the test set when using the entire training data. The E- CNN model outperforms both CNN-aug and CNN in contact state classification and average leg contact detection. Notably, exploiting symmetries helps mitigate suboptimal asymmetries in the models, preventing them from favoring the classification of one leg over others (observe legs LF and RF in fig. 4-right). Further details can be found in section C-E. VII. CONCLUSIONS & DISCUSSION In this work, we present the definition of Discrete Morpho- logical Symmetry (DMS). A capability of some dynamical systems to imitate the effect of rotations, translations, and infeasible reflections of space with a feasible discrete change in the system configuration. Using the language of group theory we study the set of DMSs of a dynamical system as a symmetry group G and conclude that: (1) A system with a symmetry group G exhibits G-equivariant generalized mass matrix and dynamics. (2) That the symmetries of the dynamics extend to optimal control policies as well as to any proprioceptive and exteroceptive measurements, related to the evolution of the system's dynamics. We establish the necessary theoretical abstractions to inves- tigate and identify DMSs in any dynamical system, irrespective of the number of symmetries present. This new formalism allows us to identify the reflection/sagittal symmetry, prevalent in humans, animals, and most robots, as the simplest morpho- logical symmetry group G = C2. Crucially, we use the same formalism to identify and exploit DMSs in real-world robotic systems with a greater number of symmetries. In addition, we provide an open-access repository that facilitates the efficient prototyping of G-equivariant neural networks for exploiting DMS in various applications involving rigid-body dynamics, such as robotics, computer graphics, and computational biology. This repository includes a growing collection of symmetric dynamical systems, with their cor- responding symmetry groups already identified. Furthermore, we present compelling empirical and theoretical evidence supporting the utilization of DMSs in data-driven applications through data augmentation and the adoption of G-equivariant neural networks. Both symmetry exploitation techniques result in improved sample efficiency and generalization. Limitations: Our work makes two assumptions: (1) that the system symmetry group G is finite, and (2) that the symmetries of the system are exact. For details see section D. Further work: For data-driven applications the benefits of DMSs suggest the computational design of symmetrical dynamical systems. While for control applications, the G- equivariance nature of the generalized mass matrix suggests research on the numerical implications of this previously unexploited constraint in optimal control. ACKNOWLEDGMENTS This work's experiments were run at the Barcelona Super- computing Center in collaboration with the HPAI group. This work is supported by the Spanish government with the project MoHuCo PID2020-120049RB-I00 and the ERA-Net Chistera project IPALM PCI2019-103386. REFERENCES [1] Farzad Abdolhosseini, Hung Yu Ling, Zhaoming Xie, Xue Bin Peng, and Michiel Van de Panne. On learn- In Motion, Interaction and ing symmetric locomotion. Games, pages 1–10. 2019. [2] Michael M Bronstein, Joan Bruna, Taco Cohen, and Petar Veliˇckovi ́c. Geometric deep learning: Grids, groups, graphs, geodesics, and gauges. arXiv preprint arXiv:2104.13478, 2021. [3] Justin Carpentier, Guilhem Saurel, Gabriele Buondonno, Joseph Mirabel, Florent Lamiraux, Olivier Stasse, and Nicolas Mansard. The pinocchio c++ library: A fast and flexible implementation of rigid body dynamics In 2019 algorithms and their analytical derivatives. IEEE/SICE International Symposium on System Integra- tion (SII), pages 614–619. IEEE, 2019. [4] Nathan Carter. Visual group theory, volume 32. Ameri- can Mathematical Soc., 2021. [5] Marc Finzi, Gregory Benton, and Andrew G Wilson. Residual pathway priors for soft equivariance constraints. Advances in Neural Information Processing Systems, 34: 30037–30049, 2021. [6] Marc Finzi, Max Welling, and Andrew Gordon Wil- son. A practical method for constructing equivariant multilayer perceptrons for arbitrary matrix groups. In International Conference on Machine Learning, pages 3318–3328. PMLR, 2021. [7] Niklas Funk, Charles Schaff, Rishabh Madan, Takuma Yoneda, Julen Urain De Jesus, Joe Watson, Ethan K Gordon, Felix Widmaier, Stefan Bauer, Siddhartha S Srinivasa, et al. Benchmarking structured policies and policy optimization for real-world dexterous object ma- nipulation. IEEE Robotics and Automation Letters, 7(1): 478–485, 2021. [8] Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In Proceedings of the thirteenth international conference on artificial intelligence and statistics, pages 249–256. JMLR Workshop and Conference Proceedings, 2010. [9] Kaveh Akbari Hamed and Jessy W Grizzle. Event- based stabilization of periodic orbits for underactuated IEEE 3-d bipedal robots with left-right symmetry. Transactions on Robotics, 30(2):365–381, 2013. [10] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In Proceedings of the IEEE international conference on computer vision, pages 1026–1034, 2015. [11] G ́abor Holl ́o. Demystification of animal symmetry: Symmetry is a response to mechanical forces. Biology Direct, 12(1):1–18, 2017. [12] G ̈unter Klambauer, Thomas Unterthiner, Andreas Mayr, and Sepp Hochreiter. Self-normalizing neural networks. Advances in neural information processing systems, 30, 2017. [13] Cornelius Lanczos. The variational principles of me- chanics. University of Toronto press, 2020. [14] Tzu-Yuan Lin, Ray Zhang, Justin Yu, and Maani Ghaf- fari. Legged robot state estimation using invariant kalman In 5th Annual filtering and learned contact events. Conference on Robot Learning, 2021. [15] Emmy Noether. Invariante variationsprobleme, math- phys. Klasse, pp235-257, 1918. [16] Daniel Ordonez-Apraez, Antonio Agudo, Francesc Moreno-Noguer, and Mario Martin. An adaptable ap- proach to learn realistic legged locomotion without ex- In 2022 International Conference on Robotics amples. and Automation (ICRA), pages 4671–4678. IEEE, 2022. [17] David E Orin, Ambarish Goswami, and Sung-Hee Lee. Centroidal dynamics of a humanoid robot. Autonomous robots, 35(2):161–176, 2013. [18] Jim Ostrowski and Joel Burdick. Geometric perspectives on the mechanics and control of robotic locomotion. In Robotics Research, pages 536–547. Springer, 1996. [19] Robert J Quigley. Pseudovectors and reflections. Amer- ican Journal of Physics, 41(3):428–430, 1973. [20] Siamak Ravanbakhsh, Jeff Schneider, and Barnabas Poc- zos. Equivariance through parameter-sharing. In Inter- national conference on machine learning, pages 2892– 2901. PMLR, 2017. [21] Jon M Selig. Geometric fundamentals of robotics, volume 128. Springer, 2005. [22] Alex Simpkins. System identification: Theory for the IEEE Robotics & user, (ljung, l.; 1999)[on the shelf]. Automation Magazine, 19(2):95–96, 2012. [23] Elise Van der Pol, Daniel Worrall, Herke van Hoof, Frans Oliehoek, and Max Welling. Mdp homomorphic networks: Group symmetries in reinforcement learning. Advances in Neural Information Processing Systems, 33: 4199–4210, 2020. [24] Rui Wang, Robin Walters, and Rose Yu. Approximately equivariant networks for imperfectly symmetric dynam- ics. arXiv preprint arXiv:2201.11969, 2022. euler [25] James T. Wheeler. of the Mechanics //www.physics.usu.edu/Wheeler/ClassicalMechanics/ CMCoordinateinvarianceofEulerLagrange.pdf. General coordinate covariance Classical http: equations. 2014. lagrange notes, URL class [26] P-B Wieber. Holonomy and nonholonomy in the dynam- ics of articulated motion. In Fast motions in biomechan- ics and robotics, pages 411–425. Springer, 2006. [27] Raymond Yeh, Yuan-Ting Hu, and Alexander Schwing. Chirality nets for human pose regression. Advances in Neural Information Processing Systems, 32, 2019. [28] Wenhao Yu, Greg Turk, and C Karen Liu. Learning sym- metric and low-energy locomotion. ACM Transactions on Graphics (TOG), 37(4):1–12, 2018. [29] Martin Zinkevich and Tucker Balch. Symmetry in markov decision processes and its implications for single In In Proceedings of agent and multi agent learning. the 18th International Conference on Machine Learning. Citeseer, 2001. APPENDIX A PROPERTIES OF ROBOTIC SYSTEMS WITH DMSS Here, we present a geometric (instead of albegraic) develop- ment analog to section IV-B. For clarity of the explanation, let us imagine two different Euclidean spaces and two versions of the robot: the original space (with reference frame o) and robot with coordinates q and ̇q, and the virtual rotated/reflected space (with a reference frame o, with configuration Xo = î Rg ro ) and virtual robot with coordinates g * q and g * ̇q 0 1 referenced to o. Noting that in the case of a reflection, the virtual robot has reflected versions of each rigid body. ó o For eqs. (3) and (5) to hold, there must exist an action g ∈ G transforming the real robot configuration g *q, g * ̇q resulting in the same kinetic energy as the virtual robot's kinetic energy: T (g * q, g * ̇q) = 1 2 . = 1 2 nB(cid:88) i=1 nB(cid:88) k=1 mi ̇r ⊺ g,i ̇rg,i + w ⊺ g,iIiw g,i mk ̇r ⊺ k ̇rk + w ⊺ kIkw k = T (g * q, g * ̇q), (10) where ̇rg,i, w g,i, mi and Ii are the linear and angular velocity, mass, and inertia matrix of the transformed body i (referenced to o). Likewise, ̇ri, w i, mi and Ii are the equivalent quantities for the virtual robot and body i (referenced to o). A. Symmetries of kinematic parameters: Ignore momentarily the influence of the mass and inertia in terms of the real and virtual bodies. We can assert that for eq. (10) to hold, the transformed configuration should result in a kinematic tree indistinguishable from the virtual robot's. Thus, for everybody i in the real robot kinematic tree, there should exist an equivalent virtual body k (as seen in fig. 6, not always k = i). By equating the linear and angular velocities of the real and virtual bodies, referenced to o, and expressing the velocities as functions of the generalized coordinates we obtain: . ̇rg,i = ̇rk = Rg * ̇rk JTi(g * q)g * ̇q = Rg * JTk (q) ̇q JTi(g * q)g = Rg * JTk (q) w g,i = w k (11) . = |Rg |Rg * w k JRi(g * q)g * ̇q = |Rg |Rg * JRk (q) ̇q, JRi(g * q)g = |Rg |Rg * JRk (q), (12) where JTi(q), JRi(q) ∈ R3×n are the position and orienta- tion analytical Jacobians (describing the instantaneous velocity vectors contributed by each DoF to body i) of the real robot at a configuration q [26]. Formulating eq. (12) for each of the nB bodies of the robot we obtain at best nB × 3 × n non-linear equations that can be used to assert if g exists. In practice, the action representation ρQ(g) and especially its component acting on the joint space ρQJ (g) can be trivially determined by solving eq. (12) (or equivalently eq. (7)) for each body from top to bottom of the kinematic tree (i.e., base first, end-effectors last), if g exists. w w w p y x o owg p y x o owg pg y o x x pg y o x x ow2g p1 y p2 w2 x o ow1 g y o x x e g g pg y pg y w1g y p2g p1 g wg x o wg x o x o w2g Fig. 5: Properties of bodies capable of imitating a true reflection g of space (w.r.t the yz-plane in this case), with a proper transformation g involving only a rotation and translation. The first row shows the original bodies with their respective angular velocities w , subjected to trivial symmetry transformation e (dashed lines represent the principle axes of inertia of the bodies), and the second and third rows display the effect of g and g on the bodies and angular velocities, respectively. The first column displays a rigid body with symmetric mass distribution, for which g exists, as the reflected and rotated bodies share an equivalent angular kinetic energy. The second column shows a rigid body with asymmetrical mass distribution, for which the rotation g, that produces a kinematic symmetry, results in the reflected and rotated bodies having different angular kinetic energies (eq. (2)). The third column shows two bodies with asymmetrical mass distributions, each a reflected version of the other, in this case, the action g swaps bodies configurations to imitate the configuration and energy state of the reflected bodies transformed with g. Angular velocity is a pseudo-vector (or axial-vector), for which a reflection transformation is computed as w g = |Rg |Rg w (see Quigley [19]). B. Symmetries of dynamic prameters comply with eq. (12), we must ensure that: Let us assume kinematic symmetry and direct our attention now to the influence of the mass and inertia terms on the kinetic energy of a single rigid body when it is transformed with the action g, which imitates a true reflection of space g. Focus on the first two columns of fig. 5. Because of the kinematic symmetry the CoM of the reflected and transformed bodies coincide, both bodies have equivalent linear compo- nents of kinetic energy. However, for arbitrary rigid bodies, the reflected and transform bodies will have different angular components of kinetic energy. Note that in the general case, the transformed and reflected bodies' inertia will differ, thus even if both bodies have the same angular velocities, their kinetic energy will differ. Let p, pg and pg be frames located at the CoM of the original, reflected and transformed bodies, aligned with the principal axes of inertia of each of the bodies. Similarly, as the original and transformed bodies denote inertias referenced to o, and Ig as the reflected body inertia referenced to the reflected Euclidean space o. In order to and Io Ig o o wo )⊺ Ig o ⊺ o wo g Ig (Rg wo (Rg wo o ⊺ g = wo g Ig o ⊺ ) = wo g Ig o | w g o o = Rg Ig Ig wo g , , g wo = |Rg |Rg wo , Ro pg pg Ro Ig pg ⊺ = Rg Ro Ro pg pg Ro Ig Ro pg ⊺ = Rg Ro pg . = Rg Ro Rg | wo ≡ wo pg | Ia = Rb p Rp p Rp | Ip ≡ Ig pg g , Rg Rg = I, pg ⊺Rg a⊺, pg Rp Ig pg Ro Ig a Ib Rb pg pg ⊺ Ro pg ≡ Ig . pg pg ⊺Rg , (13a) What eq. (13a) states is that in order for the reflected and transformed bodies to have equivalent angular kinetic energy, both bodies should have co-linear (or aligned) principal axes pg as a function of inertia. This allows us to describe Ro of the original body configuration Ro p and two reflection matrices: the true reflection of space Rg and a body specific pg , which exists only if the rigid diagonal reflection matrix Rp body has a symmetric mass distribution. A visual example for symmetric and asymmetrical rigid bodies is presented in fig. 5 left and middle columns. A similar analysis follows for DMSs imitating rotations C. Symmetric position and velocity constraint configuration spaces Although it is implicitly implied on eq. (2) that the con- strained position Q and velocity TqQ configuration vector spaces should also be symmetric or equivariant, this property might be easily overlooked. As mentioned in section IV the relevance of morphological symmetries relies on the equivari- ant nature of the system dynamics (eqs. (1) and (3)), which imprints symmetry constraints on optimal control policies and proprioceptive and exteroceptive measurements. However, with non-symmetric constrained configuration spaces, eq. (2) will not hold for every system state q ∈ Q, ̇q ∈ Tq Q, and any uncontrolled or controlled trajectory of the system dynamics shall not have a symmetric equivalent trajectory, as this has the potential to violate the constraints of the configuration space. APPENDIX B EFFICIENT CONSTRUCTION OF G-EQUIVARIANT NNS FOR DMS GROUPS G As mentioned in section V our work builds upon the framework for the construction of G-equivariant NN of Finzi et al. [6]. The core limitation of this framework is the inability to handle large dimensional spaces, due to the computational and memory complexities. For instance, for an equivariant layer with input dimension n and output dimension m, the computational complexity of finding the equivariant linear map basis B (which is quadratic O((mn)2r2) through the Krylov subspace method) and the memory complexity of B ∈ Rmn×r | r ≤ mn, become easily intractable for moderate n and m dimensions. This limitation is openly discussed in the EMLP repository README.md, but regretfully not in the original paper. In practice, we found these limitations when trying to construct the equivariant version of the Contact CNN [14] in our second experiment. This architecture in its internal layers has n, m > 2000, for which: (i) the Krylov subspace method complexity renders the operation intractable with standard hardware and (ii) the matrices B of internal layers required storage of 1[Gb] > for moderate input output dimensions (m, n ≈ 250) and 1[P b] > for m, n > 2000). See section C for a comparison between dense and sparse matrix representations. A. Trainable parameter reduction of G-equivariant layers (for G a DMS group) the rank r) of an G-equivariant Determining analytically the number of trainable parameters (i.e. in general, an unresolved problem. However, for DMS groups, r can be computed once the input-output action representations are known. The requirement to compute r is that actions affecting the linear maps are a semi-direct product6 of the input-output groups, and the input-output representations are generalized layer is, permutation matrices. These conditions are met for most DMS groups (see section D). The equivariance constraints of eq. (9) on linear maps of perceptron (or convolutional) layers imply a reduction of trainable parameters from |w| = mn to |c| = r ≤ mn. For DMS groups, r is associated with the number of unique orbits of the elements of w. Thus we can compute this value using the orbit-counting theorem (also known as Burnside's Lemma), which states that the number of orbits is the average number of fix-points of G, that is r = 1 g∈G |wg |, where |G| wg . = {w ∈ w : g * w = w} represents the set of elements of w that are invariant to g (i.e. fix-points). Those fix-points can be identified by the elements on the diagonal of ρW(g) that are equal to one. Therefore, for a G-equivariant layer, the number of trainable parameters is determined by: (cid:80) r = 1 |G| (cid:80) g∈Gχ1 ρW (g) = 1 |G| (cid:80) g∈G χ1 ρin (g-1) * χ1 ρout (g), (14) ρ(g) : G → N as the number of fix-points of the denoting χ1 action representation ρ(g). Therefore, the number of trainable parameters can range from |w|/|G| ≤ r ≤ |w|, depending on the fix-points of the layers' input and output spaces. B. Parameter initialization of equivariant layers for DMS Consider a Equivariant Neural Network architecture com- posed of multiple layers of equivariant linear (or convolu- tional) layers of the form ly := σ( lW lx + lb), being l the layer index, lx ∈ Rn and ly ∈ Rm the layer's input and output lB:,:,k ∈ Rm×n the layer's linear vector spaces, lW lB ∈ Rm×n×r the layer's r basis vectors spawning the map, space of equivariant linear maps, lc ∈ Rr the layer's trainable parameters, and lb ∈ Rm the layer's bias vector. . = (cid:80)r k lck For the optimal flow of information throughout the network, it's relevant to initialize the trainable parameters such that the variance of activations (during inference/forward-propagation) and gradients (during back-propagation) is kept constant, avoiding activations/gradients from vanishing or exploiting [8]7. The derivation is based on the equivalent process for the unconstrained layers presented in He et al. [10]. Let layer's activations before the non-linearity be denoted by lz = lW lx + lb, such that ly = σ(lz), and note that lx = l−1y. Furthermore, we will assume the elements of lc and lx are mutually independent and sampled from two independent distributions, denoting the random variables of the two distributions as lc and lx. The core difference in the initialization of unconstrained layers lies in the way the linear map is and equivariant 7See Pierre Ouannes blog: pouannes.github.io/blog/initialization parameterized. For equivariant layers we have: Var( lW lx + lb) = = m (cid:88) n (cid:88) i m (cid:88) j n (cid:88) i j , = Var (cid:0) lc lx(cid:1) Var (cid:0) lWi,j lxj (cid:1) | Var( lb) = 0 (cid:32)(cid:32) r (cid:88) Var (cid:33) (cid:33) lck lBm,n,k lxj k n (cid:88) r (cid:88) m (cid:88) B2 m,n,k (15) i j (cid:124) k (cid:123)(cid:122) λlB (cid:33) | Var (cid:32) (cid:88) a p = sa const (cid:125) (cid:88) a s2 aVar(p) In the forward-propagation scenario, we are interested in conserving the variance of the activations throughout layers, that is we must ensure Var( lz) = Var( l−1z). Using eq. (15) we obtain: Var( lz) = Var( lW lx + lb) m Var( lz) = λlBVar (cid:0) lc lx(cid:1) Ö Var( lz) = λlB m E(lc2) (cid:124) (cid:123)(cid:122) (cid:125) Var(lc) E( lx2) − E(lc)2 (cid:124) (cid:123)(cid:122) (cid:125) =0 E( lx)2 Var( lz) = λlB Var(lc)E (cid:0) l−1y2(cid:1) m | lx = l−1y = σ( l−1z) Var( lz) = λlBλσ Var(lc)Var( l−1z) m | E (cid:0) l−1y2(cid:1) = λσVar (cid:0) l−1z(cid:1) Var( lz) ≡ Var( l−1z) | Var (cid:0)lc(cid:1) . = m λlBλσ è (16) (17) , . = m λlB λσ where λσ in eq. (16) is a non-linearity dependent scalar computed analytically or empirically (see He et al. [10]). In eq. (17) we conclude that if we sample the equivariant layer trainable parameters lc from a distribution ensuring Var(lc) the variance of the activations across equivariant layers remain constant. A similar procedure can be applied to the backward propagation case, concluding that in order to maintain a constant variance of the gradients across the network layers we should sample the trainable parameters ensuring Var(lc) . As remarked in He et al. [10] both variance values for the forward and backward propagation cases lead to the proper flow of information in the network. On fig. 7, it can be appreciated that our method achieves equivalent results for equivariant architectures as [10] does for standard linear and convolutional architectures. . = n λl B λσ APPENDIX C IMPLEMENTATION DETAILS & CODE Additional to this section, we provide open-access code with the scripts for reproducing the experiments of this work, the parameters of the models used for comparison, along with additional interactive examples visualizing morphological symmetries of both robotic systems and data. A. Efficient data augmentation Since any input x and output y spaces of equivariant archi- tectures have matrix symmetry action representations, ρX (g), ρY(g), it is possible to perform batched data augmentation, reducing the computational complexity of augmenting a batch of Nb samples from Nb matrix-vector multiplications to a single matrix-matrix multiplication, preferably performed after data is loaded to GPU for optimal performance. B. Hyperparameter tunning The only hyper-parameter tunned for each model and model variant was the learning rate. For all model variants presented in this work (except the original Contact-CNN model from Lin et al. [14], which we retrained using the same hyperparameters reported by the authors) we ran a grid-search in log-scale among 20 different learning rates. In this scenario, we always used the entire training dataset and optimized w.r.t computed loss in the entire validation partition. The learning rate values used for each model are depicted in section C-D2. C. Experiment: CoM Momentum Estimation The dataset for the CoM estimation experiment was gen- erated using Pinocchio [3], which in turn uses the URDF models of the robots Solo and Atlas, to extract the kinematic and dynamic parameters required to compute the Centroidal Momentum Matrix AG(q) matrix [17], with which computing the CoM momentum reduces to: g * h = AG(g * ˆq)g * ̇ˆq Ä ä g * ˆq, g * ̇ˆq; φ g * h ≈ ˆf | ∀g ∈ G. | ∀g ∈ G. (18) (19) Where eq. (18) expresses the analytical G-equivariant function to compute the CoM momentum. While eq. (19) is the approximation of this function by an G-equivariant NN, with parameters φ. 1) Determination of the input and output representations ρX (g), ρY(g) | g ∈ G: Both robots Solo and Atlas evolve in the Euclidean space of 3-dimensions. Therefore their con- . = E3 × QJ . After figuration space can be decoupled into Q identifying their symmetry groups and their corresponding E3 and QJ representations (ρE3(g), ρQ(g) | ∀ g ∈ G), identifying the representations of the input and output spaces of the NN function approximator (eq. (19)) becomes a trivial task considering that: ïρE d (g) 0 (cid:124) (cid:123)(cid:122) ρY (g) ρE ò 0 d (g) ò ï l k (cid:124)(cid:123)(cid:122)(cid:125) y (cid:125) ≈ f ÅïρQJ (g) 0 ò 0 ρQJ (g) ã ò ï ˆq ̇ˆq (cid:124)(cid:123)(cid:122)(cid:125) x (cid:124) (cid:123)(cid:122) ρX (g) | ∀ (g, g)|g ∈ G, g ∈ E3 (cid:125) (20) ó î ˆq ̇ˆq ∈ R2nJ and y = h ∈ R2d ≡ R6. Note that Defining x = by definition any improper transformation applied to a pseudo- vector (e.g. angular velocity/momentum, torques) is computed as |R|R * k. Layer Type 1D-Conv 1D-Conv 1D-Conv 1D-Conv Percept Percept Percept n 54 64 64 128 4736 2048 512 m 64 64 128 128 2048 512 16 ρw (g) Dense Memory [Bytes] B 764.41M 191.10M 1.07G 268.43M 1.07G 4.29G 4.29G 17.18G 1.50P 6.02P 17.59T 70.36T 1.07G 4.29G ρw (g) 221.18k 262.14k 524.28k 1.04M Sparse Memory [Bytes] B 110.59k 131.07k 262.14k 524.28k 620.75M 310.37M 33.55M 262.14k 67.10M 524.28k TABLE I: Comparison of memory complexity of individual layers of the equivariant version of Contact-CNN [14] (ECNN). This example compares the sparse and dense representations of matrices B ∈ Rmn×r and the |G| group action representations ρw(g) ∈ Rmn×mn, for the symmetry group G = C2 of the Mini-Cheetah robot, with r = mn/2 (see eq. (14)). Here, n, m represents the input and output dimensions of each layer. The dense memory complexity of all action representations increases with the group order |G| while the memory complexity for B decreases with larger group orders (since r ≤ mn becomes smaller). We assume floating point representations with 32 bits. RF 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 LF 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 RH LH 0 0 1 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1 0 0 1 1 1 y 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 g * y 0 2 1 3 8 10 9 11 4 6 5 7 12 14 13 15 LF 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 RF 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 LH RH 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 TABLE II: Symmetric contact state for Mini-Cheetah quadruped robot. Considering its morphological symmetry group C2 = {e, g}. Each leg binary contact state (LF: Left Front, RF: Right Front, LH: Left Hind, RH: Right Hind) is displayed with its corresponding robot contact state y. 2) Practical details of the dataset generation: The URDF files of the robots Solo and Atlas are generated using XACRO scripts, which replicate the structure of limbs to their sym- metric counterparts, making the dynamics of the robots in simulation exactly G-equivariant. However, the algorithm for computing the CoM momentum from Pinocchio is numerically sensitive, resulting in the orbits of the momentum G * h devi- ating slightly from the theoretical orbits. Therefore to reduce numerical errors and ensure the theoretical equivariance of the data, we replace every target variable by the average of its orbit (cid:80) G * g−1(AG (ρQ(g) ˆq) ρQ(g) ̇ˆq) y = h | ∀ g ∈ G. . = 1 |G| D. Experiment: Static-Friction-Regime Contact Detection The dataset presented in [14] is composed of output samples y ∈ R16, where each dimension of y represents a logit of a specific contact state, among the 16 different combinations of each of the 4 legs possible binary contact states. The input i=0 ∈ R54×150, are a history of 150 samples samples y = {zi}150 z = [ ˆq, ̇ˆq, a, w , p, v] ∈ R54. Where ˆq ∈ RnJ , ̇ˆq ∈ RnJ , a ∈ R3, w ∈ R3, p ∈ R12, v ∈ R12 are the MIT-Mini-Cheetah robot joint-space positions, velocities, base linear acceleration, base angular velocity, and each of the four legs feet's position and velocities, respectively, referenced to the robots base frame B. The function approximator to learn is expected to be approx- imately equivariant to the reflection group C2, considering the sagittal symmetry of the robot morphology. Therefore: g * y = ˆf (g * x; φ) | g ∈ G = C2 (21) 1) Determination of the input and output representations ρX (g), ρY(g) | g ∈ G: The MiniCheetah robot evolves in the Euclidean space of 3-dimensions. Therefore its configuration . = E3 × QJ . After identifying space can be decoupled into Q their symmetry groups and their corresponding E3 and QJ representations (ρE3(g), ρQ(g) | ∀ g ∈ G), we can identify the representations of the input and output spaces of the NN function approximator (eq. (21)), considering that: ρY(g)y ≈  (cid:32)     f (cid:124) ρQJ (g) 0 0 0 0 0 0 ρQJ (g) 0 0 0 0 0 0 ρE3 (g ) 0 0 0 0 0 0 ρE3 (g ) 0 0 0 0 0 0 ρp(g) 0 0 0 0 0 0 ρp(g) (cid:123)(cid:122) ρX (g) (cid:33)          ˆq ̇ˆq a w p v (cid:124) (cid:123)(cid:122) (cid:125) x (cid:125) | ∀ (g, g)|g ∈ G, g ∈ E3 Where the representation ρp(g) acting on p ∈ R12 and v ∈ R12 is determined understanding that each of the feet positions (pRF , pLF , pRH , pLH ) and velocities (vRF , vLF , vRH , vLH ) are simply vectors living in E3. Thus, we must apply the euclidean action ρE3 (g) while at the same time permuting the feets (similar to the permutation of the Robot Solo Atlas MiniCheetah MiniCheetah Model MLP/EMLP MLP/EMLP CNN E-CNN G C2 & K4 C2 C2 C2 lr 2.4 × 10−3 1.5 × 10−3 1.0 × 10−4 1.0 × 10−5 Samples 100k 500k 730k TABLE III: Robot, Models and Dataset parameters. kinematic subchains described by ρQJ (g)): g * p = ρR4 (g) ⊗ ρE3(g) (cid:125) (cid:124) = ï 0 1 0 0 1 0 0 0 0 0 0 1 0 0 1 0 g * v = ρR4 (g) ⊗ ρE3(g) (cid:125) (cid:124) ⊗ ρE3 (g) (cid:123)(cid:122) ρp(g) ò (cid:123)(cid:122) ρp(g) ò p, | ∀(g, g)|g ∈ G, g ∈ E3 (22) ï pRF pLF pRH pLH ò | g ̸= e v | ∀(g, g)|g ∈ G, g ∈ E3 (23) = ï 0 1 0 0 1 0 0 0 0 0 0 1 0 0 1 0 ⊗ ρE3 (g) ï vRF vLF vRH vLH ò | g ̸= e Being ρR4 (g) | ∀g ∈ C2 two regular representations of C2 stack in block diagonal form to form a permutation representation in 4-dimensional space, representing the right-left symmetries of the 4 kinematic tree's subchains (four legs). The nature . of the representation ρQJ (g) = ρR4 (g) ⊗ Ins might be better understood if you consider that we apply ρR4(g) to each set of symmetric DoF in the kinematic three, which for the Mini- Cheetah is ns = 3 sets of symmetric DoF (see fig. 2-right). See simpler examples in fig. 6. Lastly, the representation for the contact state ρY(g) is given by the permutation matrix relating y and g * y described in section C-D. 2) Details on dataset partitioning: We modified the original dataset partitioning to properly evaluate the generalization capacity of the models. The original dataset was composed of 15 different recordings varying ground type and gait type used during data collection (most recordings were performed on a trot gait, which heavily biased the dataset to contact states 0, 6, and 9 of section C-D). The authors of [14] partitioned all 15 recordings into (70%, 15%, 15%) training, validation and testing. This parti- tion was made such that the first 70% time-samples of each recording were assigned for training, the following 15% to validation, and the rest for testing. Because we are interested in studying the generalization capacity of the models and the out-of-training-distribution performance, we modified this partitioning such that among the 15 different recordings we selected randomly 5 recordings for testing, and the remaining 10 recordings were used for training splitting these recordings into (85%, 15%) training and validation splits as in [14], that is, for each recording, the first 85% data-samples go for training and the remaining for validation. The selected training-validation recordings were: air walk- ing gait, concrete difficult slippery, concrete left circle, middle pebble, rock road, asphalt road, concrete galloping, grass, old asphalt road, sidewalk. While the selected testing recordings were: air jumping gait, concrete pronking, concrete right circle, forest, small pebble. E. Mitigation of suboptimal asymmetries in model perfor- mance When comparing individual leg classification we see that the equivariant model converges to having a similar performance for each symmetric pair of legs, while the unconstrained models converge to an asymmetrical suboptimal state favoring the contact detection of one leg at the expense of reduced performance for the symmetric leg (see LF and RF f1-scores). This asymmetrical performance is attributed to the CNN and CNN-aug models learning to extract temporal features for both symmetric legs separately, increasing the likelihood of converging to asymmetrical local minima. On the contrary, the equivariant model E-CNN can be thought of as learning to extract a single set of symmetric temporal features for each symmetric pair of states (a consequence of the model's equivariance and parameter sharing). This implies that the temporal features used for determining the contact state of, say the left frontal leg, would also be used to determine the contact state of the symmetric leg, the right frontal leg, and vice-versa. F. Equivariant Conv1D layers For details on the construction of the Equivariant 1D Convo- lutional layers reefer to 1. Note that the symmetry of a single time-sample zi is shared across all time-samples y = {zi}150 i=0. APPENDIX D LIMITATIONS Our work makes two main assumptions: 1) Symmetries are exact: By assuming that a dynamical system has exact and not approximate symmetries we are departing from the real-world nature of DMSs since for any robotic system in the real-world the manufacturing and assembly process introduces errors/tolerances in the kinematic and dynamic parameters of each of the robot's bodies. Likewise, the dynamics of animals in nature are not perfectly equivariant since morphological symmetries are only approximate symmetries. Although exact symmetries seem to be a strong assumption, in practice, the reality is that it is a common assumption in the fields of robotics and control theory, in which idealized models of the dynamics are often assumed (in simulation and real-world). On section VI we show that the exact symmetry bias is justifiable and beneficial for learning function ap- proximators processing the dynamics of approximately symmetrical systems in the real world. However, the authors highlight the necessity to properly address the case of approximate equivariance, which we leave to future work. To address this case, system identification techniques [22] have been wildly used to approximate the deviation of the kinematic and dynamic parameters from the assumed values. While in the case of G- equivariant NN Wang et al. [24], Finzi et al. [5] provide Tri-Finger Robot G = C3 Bolt Bipedal Robot G = C2 This fixed-based robot is symmetric w.r.t. rotations of space by θ = 120◦ in the vertical axis. Therefore, its symmetry group is the cyclic group of order three (G = C3). To identify this symmetry group we apply the procedure in section IV-C: Bolt is a bipedal robot with a sagittal plane reflection symmetry (G = C2). This morphological symmetry allows to imitate the effect of arbitrary reflections of space it (g ∈ E3) by re-configuring its base and legs. To identify this symmetry group we apply the procedure in section IV-C: 1) Identify XB and IB: As a fix-based robot, we define XB to be the mounting structure supporting each finger, and the gray disk delimiting the workspace (see image). 2) Identify symmetries of IB: The inertia of this virtual to rotations by 120◦ in the base IB is invariant vertical axis. I.e., IB is invariant to XBρE3 (g)-1|g ∈ {e, gθ, g2 θ} ≡ C3 (eq. (6)). 3) Identify modularity in the kinematic tree: There are three symmetric kinematic subchains. Each finger is composed of replicated versions of the same bodies. 1) Identify XB and IB: XB is the robot base (hips) body, with its corresponding inertia IB 2) Identify symmetries of IB: The base body has sagittal the to the transformation symmetrical mass distribution w.r.t plane. Thus, IB is invariant XBρE3(g)-1|g ∈ {e, gs} ≡ C2 (eq. (6)). 3) Identify modularity in the kinematic tree: There are two symmetric kinematic subchains. The left leg subchain and bodies are reflected versions of the right leg subchain and bodies. 4) Identify the DMS group G: 4) Identify the DMS group G: the that transformation . = Consider ρE3 (g)XBρE3(g)-1 (eq. (6)) can be interpreted as a rotation of the virtual base by θ◦ followed by a rotation −θ◦ in the z axis. Thus respecting the fix-base constraint of the f 3]⊺ be system. Denote the joint-space q = ˆq = [q composed of each finger's DoF (qf i ∈ R3). ρE3(g)XB ⊺ f 2, q ⊺ f 1, q ⊺ . = ρR3 (g) ⊗ I3 | g ∈ C3. Being Then we can define ρQJ (g) ρR3 (*) the permutation representation of 3 elements of C3 (3 kinematic subchains). For the generator action of the group this is ρR3(g) = ó . î 0 1 0 0 0 1 1 0 0 Lastly, we verify if G = C3 by testing all tentative group actions for DMSs eq. (5). Augmentation of data samples: Say we collect a dataset of robot states (q, ̇q) and cube states XC at every time step t, to train the manipulation policy [7]. To obtain the symmetric states, at every t, we need to understand that since we are imitating the effect of a true rotation of space g, the symmetric states are obtained by (g * q, g * ̇q) and (g * XC . = ρE3(g)XC). Since a reflection w.r.t to the sagittal plane would imply a true reflection of the rigid bodies of the legs, we need to permute each body in the kinematic tree with each reflected R]⊺ as composed version. Denote the joint-space ˆq = [q of the left L and right R legs' DoF (qL/R ∈ R3). Denote the sign-relation between the DoF of the Left and right legs' degrees of freedom as sL|R ∈ R3. ⊺ L, q ⊺ . Then we can define ρQJ (g) = ρR2(g) ⊗ (sL|RI3) | g ∈ C2. Being ρR2 (*) the permutation representation of a 2 elements of C2(2 kinematic subchains). For the non-trivial action of the group this is ρR2(gs) = [ 0 1 1 0 ]. Lastly, recalling the definition of ρE3 (g) in eq. (6), we verify if G = C2 by testing all tentative group actions for DMSs eq. (5). Augmentation of data samples: Say we collect a dataset of robot states (q, ̇q) and ground reaction forces (fL, fR), that we transform to the space of generalized forces as (τfL, τfR ), at every timestep t. This dataset can be used to train a reactive locomotion policy as in Ordonez-Apraez et al. [16]. The symmetric states, at every t, are then defined as: (g *q, g * ̇q) and (g *τfL, g *τfR ) ≡ (ρQ(g)τfL, ρQ(g)τfR ) Fig. 6: Tutorial example morphological symmetries of the Tri-Finger [7] and Bolt robots. Fig. 7: Comparison of the initialization method of unconstrained layers of He et al. [10] with our initialization method for equivariant layers. Left and right columns correspond to MLP & EMLP architectures with σ = ReLu (left) and σ = T anh (right) non-linearities. Each row shows different initialization methods differing in the variance of the initialization distribution of the layer's trainable parameters. First and second rows show the forward and backward propagation cases of [10] for MLP . and of section B-B for EMLP, with Var(lc) = n/(λlB λσ), respectively. In these cases, the variance of activations through the network depth remains nearly constant, as desired. The last two rows show the initialization of layer parameters with a constant variance of 0.052 and 0.82, illustrating scenarios of activations vanishings and exploiting. All intermediate layers have 256 neurons. In the equivariant case, the network is K4-equivariant. . = m/(λl B λσ) and Var(lc) clear and valuable approaches to learn approximate G- equivariant NN. It is relevant to highlight that, in physics-based sim- ulation, the most common practice is to work with the idealized model of dynamics. Thus, the assumption of exact symmetries is justifiable and encouraged in applications where simulation is a relevant tool. 2) Symmetry group is finite: This work narrows its focus to DMSs, even do the definition of DMS eq. (5) can be relaxed to cover continuous morphological symmetries (an example of this continuous symmetry is the capa- bility of a robot arm manipulator to imitate rotations of space by rotating its first degree of freedom). This assumption allows us to compute in linear time the basis B of equivariant linear maps (restricted to groups with finite regular matrix representations).
http://arxiv.org/abs/2302.10432v1
2023-02-21T04:09:51
2023-02-21T04:09:51
Link Prediction on Latent Heterogeneous Graphs
On graph data, the multitude of node or edge types gives rise to heterogeneous information networks (HINs). To preserve the heterogeneous semantics on HINs, the rich node/edge types become a cornerstone of HIN representation learning. However, in real-world scenarios, type information is often noisy, missing or inaccessible. Assuming no type information is given, we define a so-called latent heterogeneous graph (LHG), which carries latent heterogeneous semantics as the node/edge types cannot be observed. In this paper, we study the challenging and unexplored problem of link prediction on an LHG. As existing approaches depend heavily on type-based information, they are suboptimal or even inapplicable on LHGs. To address the absence of type information, we propose a model named LHGNN, based on the novel idea of semantic embedding at node and path levels, to capture latent semantics on and between nodes. We further design a personalization function to modulate the heterogeneous contexts conditioned on their latent semantics w.r.t. the target node, to enable finer-grained aggregation. Finally, we conduct extensive experiments on four benchmark datasets, and demonstrate the superior performance of LHGNN.
[ "Trung-Kien Nguyen", "Zemin Liu", "Yuan Fang" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10432v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10432v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
Link Prediction on Latent Heterogeneous Graphs Trung-Kien Nguyen∗ Singapore Management University Singapore [email protected] Zemin Liu∗† National University of Singapore Singapore [email protected] Yuan Fang Singapore Management University Singapore [email protected] 3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 2 3 4 0 1 . 2 0 3 2 : v i X r a ABSTRACT On graph data, the multitude of node or edge types gives rise to heterogeneous information networks (HINs). To preserve the het- erogeneous semantics on HINs, the rich node/edge types become a cornerstone of HIN representation learning. However, in real- world scenarios, type information is often noisy, missing or inac- cessible. Assuming no type information is given, we define a so- called latent heterogeneous graph (LHG), which carries latent het- erogeneous semantics as the node/edge types cannot be observed. In this paper, we study the challenging and unexplored problem of link prediction on an LHG. As existing approaches depend heavily on type-based information, they are suboptimal or even inapplica- ble on LHGs. To address the absence of type information, we pro- pose a model named LHGNN, based on the novel idea of seman- tic embedding at node and path levels, to capture latent seman- tics on and between nodes. We further design a personalization function to modulate the heterogeneous contexts conditioned on their latent semantics w.r.t. the target node, to enable finer-grained aggregation. Finally, we conduct extensive experiments on four benchmark datasets, and demonstrate the superior performance of LHGNN. CCS CONCEPTS • Computing methodologies → Learning latent representa- tions; • Information systems → Data mining. KEYWORDS Latent heterogeneous graph, link prediction, graph neural networks ACM Reference Format: Trung-Kien Nguyen∗, Zemin Liu∗†, and Yuan Fang. 2023. Link Prediction on Latent Heterogeneous Graphs. In Proceedings of the ACM Web Confer- ence 2023 (WWW '23), May 1–5, 2023, Austin, TX, USA. ACM, New York, NY, USA, 11 pages. https://doi.org/10.1145/3543507.3583284 ∗Co-first authors with equal contribution. †Corresponding author. Work partly done at Singapore Management University. Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full cita- tion on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy other- wise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]. WWW '23, May 1–5, 2023, Austin, TX, USA © 2023 Copyright held by the owner/author(s). Publication rights licensed to ACM. ACM ISBN 978-1-4503-9416-1/23/04. . . $15.00 https://doi.org/10.1145/3543507.3583284 1 INTRODUCTION Objects often interact with each other to form graphs, such as the Web and social networks. The prevalence of graph data has cat- alyzed graph analysis in various disciplines. In particular, link pre- diction [43] is a fundamental graph analysis task, enabling wide- spread applications such as friend suggestion in social networks, recommendation in e-commerce graphs, and citation prediction in academic networks. In these real-world applications, the graphs are typically heterogeneous as opposed to homogeneous, also known as Heterogeneous Information Networks (HINs) [39], in which mul- tiple types of nodes and edges exist. For instance, the academic HIN shown in the top half of Fig. 1(a) interconnects nodes of three types, namely, Author (A), Paper (P) and Conference (C), through different types of edges such as "writes/written by" between au- thor and paper nodes and "publishes/published in" between con- ference and paper nodes, etc. The multitude of node and edge types in HINs implies rich and diverse semantics on and between nodes, which opens up great opportunities for link prediction. A crucial step for link prediction is to derive features from an in- put graph. Recent literature focuses on graph representation learn- ing [4, 37], which aims to map the nodes on the graph into a low- dimensional space that preserves the graph structures. Various ap- proaches exist, ranging from the earlier shallow embedding mod- els [10, 27, 32] to more recent message-passing graph neural net- works (GNNs) [11, 18, 34, 38]. Representation learning on HINs generally follows the same paradigm, but aims to preserve the het- erogeneous semantics in addition to the graph structures in the low-dimensional space. To express heterogeneous semantics, ex- isting work resorts to type-based information, including simple node/edge types (e.g., an author node carries different semantics from a paper node), and type structures like metapath [30] (e.g., the metapath A-P-A implies two authors are collaborators, whereas A- P-C-P-A implies two authors in the same field; see Sect. 3 for the metapath definition). Among the state-of-the-art heterogeneous GNNs, while hinging on the common operation of message pass- ing, some exploit node/edge types [12, 16, 22, 41] and others em- ploy type structures [9, 28, 35]. Our problem. The multitude of node or edge types gives rise to rich heterogeneous semantics on HINs, and forms the key thesis of HIN representation learning [39]. However, in many real-world scenarios, type information is often noisy, missing or inaccessi- ble. One reason is type information does not exist explicitly and has to be deduced. For instance, when extracting entities and their relations from texts to construct a knowledge graph, NLP tech- niques are widely used to classify the extractions into different types, which can be noisy. Another reason is privacy and security, such that the nodes in a network may partially or fully hide their identities and types. Lastly, even on an apparently homogeneous WWW '23, May 1–5, 2023, Austin, TX, USA Trung-Kien Nguyen, Zemin Liu, and Yuan Fang the latent high-order relational semantics between nodes, such as the collaborator relation between authors v4 and v0 in Fig. 1(a), to mimic the role played by metapaths such as A-P-A. Second, as context nodes of a target node often carry latent het- erogeneous semantics, how to differentiate them for finer-grained context aggregation? We propose a learnable personalization func- tion to modulate the original message from each context node. The personalization hinges on the semantic path embedding between each context node and the target node as the key differentiator of heterogeneous semantics carried by different context nodes. For il- lustration, refer to the top half of Fig. 1(b), where the green nodes (e.g., v1, v4 and v6) are the context nodes of the doubly-circled tar- get node (e.g., v0). These context nodes carry latent heterogeneous semantics (e.g., v1 is a paper written by v0, v4 is a collaborator of v0, and v6 is a related paper v0 might be interested in), and thus can be personalized by the semantic path embedding between each con- text and the target node before aggregating them. Contributions. In summary, our contributions are three-fold. (1) We investigate a novel problem of link prediction on latent het- erogeneous graphs, which differs from traditional HINs due to the absence of type information. (2) We propose a novel model LHGNN based on the key idea of semantic embedding to bridge the gap for representation learning on LHGs. LHGNN is capable of inferring both node- and path-level semantics, in order to personalize the latent heterogeneous contexts for finer-grained message passing within a GNN architecture. (3) Extensive experiments on four real- world datasets demonstrate the superior performance of LHGNN in comparison to the state-of-the-art baselines. 2 RELATED WORK Graph neural networks. GNNs have recently become the main- stream for graph representation learning. Modern GNNs typically follow a message-passing scheme, which derives low-dimensional embedding of a target node by aggregating messages from con- text nodes. Different schemes of context aggregation have been proposed, ranging from simple mean pooling [11, 18] to neural at- tention [34] and other neural networks [38]. For representation learning on HINs, a plethora of heteroge- neous GNNs have been proposed. They depend on type-based in- formation to capture the heterogeneity, just as earlier HIN em- bedding approaches [5, 8, 14]. On one hand, many of them lever- age simple node/edge types. HetGNN [41] groups random walks by node types, and then applies bi-LSTM to aggregate node- and type-level messages. HGT [16] employs node- and edge-type de- pendent parameters to compute the heterogeneous attention over each edge. Simple-HGN [22] extends the edge attention with a learnable edge type embedding, whereas HetSANN [12] employs a type-aware attention layer. On the other hand, high-order type structures such as meta-path [30] or meta-graph [6] have also been used. HAN [35] uses meta-paths to build homogeneous neighbor graphs to facilitate node- and semantic-level attentions in message aggregation, whereas MAGNN [9] proposes several meta-path in- stance encoders to account for intermediate nodes in a meta-path instance. Meta-GNN [28] differentiates context nodes based on meta- graphs. Another work Space4HGNN [45] proposes a unified de- sign space to build heterogeneous GNNs in a modularized manner, Figure 1: Illustration of our problem and approach. (a) Com- parison of HIN and LHG. (b) Key insights of our approach. graph, such as a social network which only consists of users and their mutual friendships, could have fine-grained latent types, such as different types of users (e.g., students and professionals) and dif- ferent types of friendships (e.g., friends, family and colleagues), but we cannot observe such latent types. Formally, we call those HINs without explicit type information as Latent Heterogeneous Graphs (LHGs), as shown in the bottom half of Fig. 1(a). The key difference on an LHG is that, while differ- ent types still exist, the type information is completely inaccessible and cannot be observed by data consumers. It implies that LHGs still carry rich heterogeneous semantics that are crucial to effec- tive representation learning, but the heterogeneity becomes latent and presents a much more challenging scenario given that types or type structures can no longer be used. In this paper, we investigate this unexplored problem of link prediction on LHGs, which calls for modeling the latent semantics on LHGs as links are formed out of relational semantics between nodes. Challenges and insights. We propose a novel model for link prediction on LHGs, named Latent Heterogeneous Graph Neural Network (LHGNN). Our general idea is to develop a latent hetero- geneous message-passing mechanism on an LHG, in order to ex- ploit the latent semantics between nodes for link prediction. More specifically, we must address two major challenges. First, how to capture the latent semantics on and between nodes without any type information? In the absence of explicit type in- formation, we resort to semantic embedding at both node and path levels to depict the latent semantics. At the node level, we com- plement the traditional representation of each node (e.g., h4 in Fig. 1(b), which we call the primary embedding) with an additional semantic embedding (e.g., s4). While the primary embedding can be regarded as a blend of content and structure information, the semantic embedding aims to distill the more subtle semantic infor- mation (i.e., latent node type and relation types a node tends to as- sociate with), which could have been directly expressed if explicit types were available. Subsequently, at the path level, we can learn a semantic path embedding based on the node-level semantic em- beddings in a path on an LHG, e.g., s4, s1 and s0 in the path v4–v1– v0 in Fig. 1(b). The path-level semantic embeddings aim to capture SMU Classification: RestrictedAuthorPaperConferencev!v"v#v$v%v&v'v(v)Nodev!HINLHG(a)HINvs.LHGv"v"v%v$v%v'v!v&v(v'v%v"v#v(?v"v%v!s%s"s!h%Linkpredictionh)s)Nodeembeddingofv!Node-levelsemanticsofv!Contextofnodev"Contextofnodev#Modulationwithpath-levelsemantics(b)LinkpredictiononLHGwithLHGNNPersonalizationwithpath-levelsemanticsLatentheteroge.contextaggregationWithouttypeZoominv"v!v#v$v%v&v(v' Link Prediction on Latent Heterogeneous Graphs WWW '23, May 1–5, 2023, Austin, TX, USA which can potentially utilize various type-based information. De- spite their effectiveness on HINs, they cannot be applied to LHGs due to the need of explicit type information. Link prediction on LHG. Given a query node, we rank other nodes by their probability of forming a link with the query. The difference lies in the input graph, where we are given an LHG. Knowledge graph embedding. A knowledge graph consists of a large number of relations between head and tail entities. Transla- tion models [3, 19, 36] are popular approaches that treat each re- lation as a translation in some vector space. For example, TransE [3] models a relation as a translation between head and tail enti- ties in the same embedding space, while TransR [19] further maps entities into multiple relation spaces to enhance semantic expres- siveness. Separately, RotatE [31] models each relation as a rotation from head to tail entities in complex space, and is able to capture different relation patterns such as symmetry and inversion. These models require the edge type (i.e., relation) as input, which is not available on an LHG. Compared to heterogeneous GNNs, they do not utilize entity features or model multi-hop interactions between entities, which can lead to inferior performance on HINs. Predicting missing types. A few studies [13, 25] aim to predict missing entity types on knowledge graphs. However, a recent work [42] shows that these approaches tend to propagate type prediction errors on the graph, which harms the performance of other tasks like link prediction. Therefore, RPGNN [42] proposes a relation encoder, which is adaptive for each node pair to handle the missing types. However, all of them still require partial type information from a subset of nodes and edges for supervised training, which makes them infeasible in the LHG setting. 3 PRELIMINARIES We first review or define the core concepts in this work. Heterogeneous Information Networks (HIN). An HIN [29] is defined as a graph G = (V , E,T , R,ψ, φ), where V denotes the set of nodes and T denotes the set of node types, E denotes the set of edges and R denotes the set of edge types. Moreover, ψ : V → T and φ : E → R are functions that map each node and edge to their types in T and R, respectively. G is an HIN if |T | + |R| > 2. Latent Heterogeneous Graph (LHG). An LHG is an HIN G = (V , E,T , R,ψ, φ) such that the types T , R and mapping functions ψ, φ are not accessible. That is, we only observe a homogeneous graph G ′ = (V , E) without knowing T , R,ψ, φ. Metapath and latent metapath. On an HIN, a metapath P is a Rl sequence of node and edge types [30]: P = T1 −−→ Tl+1, such that Ti ∈ T and Ri ∈ R. As an edge type Ri ∈ R represents a relation, a metapath represents a composition of relations R1 ◦ R2 ◦ . . . ◦ Rl . Hence, metapaths can capture complex, high-order semantics between nodes. A path p = (v1, v2, . . . , vl+1) on the HIN is an instance of metapath P if ψ (vi ) = Ti and φ (⟨vi, vi+1⟩) = Ri . As shown in the top half of Fig. 1(a), an example metapath is Author- Paper-Author (A-P-A), implying the collaborator relation between authors. Instances of this metapath include v0-v1-v4 and v0-v3-v4, signifying that v0 and v4 are collaborators. R1 −−→ T2 R2 −−→ ... On an LHG the metapaths become latent too, as the types Ti and Ri are not observable. Generally, any path p = (v1, v2, . . . , vl+1) on an LHG is an instance of some latent metapath, which carries la- tent semantics representing an unknown composition of relations between the starting node v1 and end node vl+1. 4 PROPOSED METHOD: LHGNN In this section, we introduce the proposed method LHGNN for link prediction on latent heterogeneous graphs. 4.1 Overall Framework We start with the overall framework of LHGNN, as presented in Fig. 2. An LHG is given as input as illustrated in Fig. 2(a), which is fed into an LHGNN layer in Fig. 2(b). Multiple layers can be stacked, and the last layer would output the node representations, to be further fed into a link encoder for the task of link prediction as shown in Fig. 2(c). More specifically, the LHGNN layer is our core component, which consists of two sub-modules: a semantic embedding sub-module to learn node-level and path-level latent se- mantics, and a latent heterogeneous context aggregation sub-module to aggregate messages for the target node. We describe each sub- module and the link prediction task in the following. 4.2 Semantic Embedding Semantic embedding aims to model both node- and path-level la- tent semantics, as illustrated in Fig. 2(b1). Node-level semantic embedding. For each node v, alongside its primary embedding hv, we propose an additional semantic em- bedding sv. Similar to node embeddings on homogeneous graphs, the primary embeddings intend to capture the overall content and structure information of nodes. However, on an LHG, the content of a node contains not only concrete topics and preferences, but also subtle semantic information inherent to nodes of each latent type (e.g., node type, and potential single or multi-hop relations a node tends to be part of). Hence, we propose a semantic encoder to locate and distill the subtle semantic information from the pri- mary embeddings to generate semantic embeddings, which will be later employed for link prediction. Note that this is different from disentangled representation learning [1], which can be regarded as disentangling a mixture of latent topics. , hl−1 v2 Specifically, in the l-th layer, given primary embeddings from the previous layer1 (hl−1 , . . .), a semantic encoder generates v1 the corresponding semantic embeddings (sl , . . .). For each node v1 v, the semantic encoder fs extracts the semantic embedding sl v v = fs (hl−1 from its primary embedding hl−1 s . While v the function fs (*; θl s ) can take many forms, we simply materialize it as a fully connected layer: s ) ∈ Rdl , sl v2 : sl ; θl v l l v = LeakyReLU(W s h s l−1 l s ), v + b (1) s ∈ Rdl s ∈ Rdl s ×dl −1 h s, bl s = {Wl where Wl and bl s are the parameters of the en- coder, i.e., θl s }. Since the semantic embedding only dis- till the subtle semantic information from the primary embedding, it needs much fewer dimensions, i.e., dl Path-level semantic embedding. A target node is often con- nected with many context nodes through paths. On an LHG, these s ≪ dl h . 1When l = 0, the primary embedding h0 vi is set to the input node features of vi . WWW '23, May 1–5, 2023, Austin, TX, USA Trung-Kien Nguyen, Zemin Liu, and Yuan Fang Figure 2: Overall framework of LHGNN. paths may carry different latent semantics by virtue of the het- erogeneous multi-hop relations between nodes. In an HIN, to cap- ture the heterogeneous semantics from different context nodes, metapaths have been a popular tool. For example, in the top half of Fig. 1(a), the HIN consists of three types of nodes. There ex- ist different metapaths that capture different semantics between authors: A-P-A for authors who have directly collaborated, or A- P-C-P-A for authors who are likely in the same field, etc. However, on an LHG, we do not have access to the node types, and thus are unable to define or use any metapath. Thus, we employ a path en- coder to fuse the node-level semantic embeddings associated with a path into a path-level embedding. The path-level semantic em- beddings attempt to mimic the role of metapaths on an HIN, to capture the latent heterogeneous semantics between nodes. Concretely, we first perform random walks to sample a set of paths. Starting from each target node, we sample N random walks of length Lmax, e.g., {p1, . . . , p4} for v1 as shown in Fig. 2(b). Then, for each sampled walk, we truncate it into a shorter path with length L ≤ Lmax. These paths of varying lengths can capture la- tent semantics of different ranges, and serve as the instances of different latent metagraphs. Next, for each path pi , a path encoder encodes it to generate a semantic path embedding sl . Let Pv denote the set of sampled pi paths starting from a target node v. If there exists a path pi ∈ Pv such that pi ends at node u, we call u a context node of v or simply context of v. For instance, given the set of paths Pv1 = {p1, . . . , p4} for the target node v1 in Fig. 2(b1), the contexts are v4, v8, v7, which carry different semantics for v1. In the l-th layer, we employ a path encoder fp to embed each path pi into a semantic path embedding pi ∈ Rdl sl s based on the node-level semantic embeddings of each node v j in the path. l l pi = fp ({s s vj | v j in the path pi }), (2) where fp can take many forms, ranging from simple pooling to re- current neural networks [24] and transformers [33]. As the design of path encoder is not the focus of this paper, we simply implement it as a mean pooling, which computes the mean of the node-level semantic embeddings as the path-level embedding. Remark. It is possible or even likely to have multiple paths be- tween the target and context nodes. Intrinsically, these paths are instances of one or more latent metapaths, which bear a two-fold advantage. First, as each latent metapath depicts a particular se- mantic relationship between two nodes, having plural latent meta- paths could capture different semantics between the two nodes. This is more general than many heterogeneous GNNs [9, 35] on a HIN, which rely on a few handcrafted metapaths. Second, it is much more efficient to sample and process paths than subgraphs [17]. Although a metagraph can express more complex semantics than a metapath [44], the combination of multiple metapaths is a good approximation especially given the efficiency trade-off. 4.3 Latent Heterogeneous Context Aggregation To derive the primary embedding of the target node, the next step is to perform latent heterogeneous context aggregation for the tar- get node. The aggregation generally follows a message-passing GNN architecture, where messages from context nodes are passed to the target node. For example, consider the target node v1 shown in Fig. 2(b2). The contexts of v1 include {v4, v8, v7} based on the paths p1, . . . , p4, and their messages (i.e., embeddings) would be aggregated to generate the primary embedding of v1. However, on an LHG, the contexts of a target node carry la- tent heterogeneous semantics. Thus, these heterogeneous contexts shall be differentiated before aggregating them, in order to pre- serve the latent semantics in fine granules. Note that on an HIN, the given node/edge types or type structures can be employed as explicit differentiators for the contexts. In contrast, the lack of type (b2) Latent Heterogeneous Context AggregationContextPersonalization(b) LHGNN LayerLink EncoderTask loss(c) PredictionContext Aggregation(b1) Semantic Embeddingv1v2v3v8v4v6v5v7SemanticEncoderPath Encoder(a) Input LHGv1p1p2p4v4v1v2v8v1v6v5v7v1Example target nodep3v1v2v3v8 Link Prediction on Latent Heterogeneous Graphs WWW '23, May 1–5, 2023, Austin, TX, USA information on an LHG prevents the adoption of the explicit dif- ferentors, and we resort to path semantic embeddings as the basis to differentiate the messages from heterogeneous contexts. That is, in each layer, we personalize the message from each context node conditioned on the semantic path embeddings between the target and context node. The personalized context messages are finally aggregated to generate the primary embedding of the target node, i.e., the output of the current layer. Context personalization. Consider a target node v, a context node u, and their connecting path p. In particular, u can be dif- ferentiated from other contexts of v given their connecting path p, which is associated with a unique semantic path embedding. Note that there may be more than one paths connecting v and u. In that case, we treat u as multiple contexts, one instance for each path, as each path carries different latent semantics and the corresponding context instance needs to be differentiated. Specifically, in the l-th layer, we personalize the message from u to v with a learnable transformation function τ, which modu- lates u's original message hl−1 (i.e., its primary embedding from the previous layer) into a personalized message ̃ hl conditioned u |p on the path p between u and v. That is, u ̃ l u |p = τ (h h l−1 l p ; θl u , s τ ), (3) where the transformation function τ (*; θl τ ) is learnable with pa- rameters θl τ . We implement τ using a layer of feature-wise linear modulation (FiLM) [20, 26], which enables the personalization of a message (e.g., hl−1 p ). The FiLM layer learns to perform scaling and shifting operations to modulate the original message: u ) conditioned on arbitrary input (e.g., sl h (4) p + 1) ⊙ h p ∈ Rdl −1 l−1 u + βl p, p ∈ Rdl −1 ̃ l u |p = (γl h where γl is a scaling vector and βl is a shift- ing vector, both of which are learnable and specific to the path p. Note that 1 is a vector of ones to center the scaling around one, and ⊙ denotes the element-wise multiplication. To make γl p and βl p learnable, we materialize them using a fully connected layer, which takes in the semantic path embedding sl p as input to become conditioned on the path p, as follows. h l l l γl p = LeakyReLU(W γ ), p + b γ s l l l βl p = LeakyReLU(W β ), p + b β s (5) (6) h ×dl s and bl ∗ ∈ Rdl −1 ∗ ∈ Rdl −1 where Wl h are learnable parameters, and LeakyReLU(*) is the activation function. Note that the parameters of the transformation function τ in layer l boil down to parameters of the fully connected layers, i.e., θl Context aggregation. Next, we aggregate the personalized mes- sages from latent heterogeneous contexts into cl h , the ag- gregated context embedding for the target node v: v = Mean({e−λL (p) ̃ l l u |p | p ∈ Pv }), c h v ∈ Rdl −1 τ = {Wl γ , Wl β γ , bl β }. , bl (7) as the aggregation function, although other choices such as sum- or max-pooling could also be used. Note that the self-information of the target node is also aggre- gated, by defining a self-loop on the target node as a special path. More specifically, given a target node v and its self-loop p, we de- fine L(p) = 0 and ̃ hl v, which means the original message of v |p the target node will be included into cl v with a weight of 1. = hl Finally, based on the aggregated context embedding, we obtain the primary embedding of node v in the l-th layer: l l l l v = LeakyReLU(W h), v + b h hc h×dl −1 h and bl h ∈ Rdl where Wl h are learnable parameters. h ∈ Rdl 4.4 Link Prediction In the following, we discuss the treatment of the link prediction task on an LHG, as illustrated in Fig. 2(c). In particular, we will present a link encoder and the loss function. (8) Link encoder. For link prediction between two nodes, we de- sign a link encoder to capture the potential latent relationships between the two candidates. Given two candidate nodes a and b and their respective semantic embeddings sa, sb obtained from the last LHGNN layer, the link encoder is materialized in the form of a recurrent unit to generate a pairwise semantic embedding: (9) sa,b = tanh (Wsb + Usa + b), where sa,b ∈ Rdh can be interpreted as an embedding of the latent relationships between the two nodes a and b, W, U ∈ Rds ×dh , b ∈ Rdh are learnable parameters. Here dh and ds are the number of dimensions of the primary and semantic embeddings from the last layer, respectively. Note that sa,b has the same dimension as the node representations, which can be used as a translation to relate nodes a and b in the loss function in the next part. Loss function. We adopt a triplet loss for link prediction. For an edge (a, b) ∈ E, we construct a triplet (a, b, c), where c is a negative node randomly sampled from the graph. Inspired by translation models in knowledge graph [3, 19], b can be obtained by a transla- tion on a and the translation approximates the latent relationships between a and b, i.e., hb ≈ ha + sa,b . Note that hv denotes the primary node embedding from the final LHGNN layer. In contrast, since c is a random node unrelated to a, hc cannot be approximated by the translation. Thus, given a set of training triplets T , we for- mulate the following triplet margin loss for the task: Ltask = 1 |T | ∑︁ max (cid:16) d (a, b) − d (a, c) + α, 0(cid:17) , (10) (a,b,c) ∈T where d (x, y) = ∥hx + sx,y − hy ∥2 is the Euclidean norm of the translational errors, and α > 0 is the margin hyperparameter. Besides the task loss, we also add constraints to scaling and shifting in the FiLM layer. During training, the scaling and shifting may become arbitrarily large to overfit the data. To prevent this is- sue, we restrict the search space by the following loss term on the scaling and shifting vectors. where L(p) gives the length of the path p so that e−λL (p) acts as a weighting scheme to bias toward shorter paths, and λ > 0 is a hyperparameter controlling the decay rate. We use mean-pooling LFiLM = l ∑︁ ∑︁ l=1 p ∈P (∥γl p ∥2 + ∥βl p ∥2), (11) WWW '23, May 1–5, 2023, Austin, TX, USA Trung-Kien Nguyen, Zemin Liu, and Yuan Fang Table 1: Summary of Datasets. Attributes FB15k-237 WN18RR DBLP OGB-MAG # Nodes # Edges # Features # Node types # Edge types Avg(degree) # Training # Validation # Testing 14,541 310,116 - - 237 29.09 272,115 17,535 20,466 40,943 93,003 - - 11 3.50 86,835 3,034 3,134 18,405 67,946 334 3 4 3.55 54,356 6,794 6796 100,002 1,862,256 128 4 4 17.88 1,489,804 186,225 186,227 where l is the total number of layers and P is the set of all sampled paths. The overall loss is then L = Ltask + μLFiLM, (12) where μ > 0 is a hyperparameter to balance the loss terms. We further present the training algorithm for LHGNN in Ap- pendix A, and give a complexity analysis therein. 5 EXPERIMENTS In this section, we conduct extensive experiments to evaluate the effectiveness of LHGNNon four benchmark datasets. 5.1 Experimental Setup Datasets. We employ four graph datasets summarized in Table 1. Note that, while all these graphs include node or edge types, we hide such type information to transform them into LHGs. • FB15k-237 [31] is a refined subset of Freebase [2], a knowledge graph about general facts. It is curated with the most frequently used relations, in which each node is an entity, and each edge represents a relation. • WN18RR [31] is a refined subset of WordNet [23], a knowledge graph demonstrating lexical relations of vocabulary. • DBLP [40] is an academic bibliographic network, which includes three types of nodes, i.e., paper (P), author (A) and conference (C), as well as four types of edges, i.e., P-A, A-P, P-C, C-P. The node features are 334-dimensional vectors which represent the bag-of-word vectors for the keywords. • OGB-MAG [15] is a large-scale academic graph. It contains four types of nodes, i.e., paper (P), author (A), institution (I) and field (F), as well as four types of edges, i.e., A-I, A-P, P-P, P-F. Fea- tures of each paper is a 128-dimensional vector generated by word2vec, while the node feature of the other types is gener- ated by metapath2vec [5] with the same dimension following previous work [7]. In our experiments, we randomly sample a subgraph with around 100K entities from the original graph us- ing breadth first search. Baselines. For a comprehensive comparison, we employ baselines from three major categories. • Classic GNNs: GCN [18], GAT [34] and GraphSAGE [11], which are classic GNN models for homogeneous graphs. • Heterogeneous GNNs: HAN [35], HGT [16] and Simple-HGN (HGN for short) [22], which are state-of-the-art heterogeneous graph neural networks (HGNNs) taking in an HIN as input. • Translation models: TransE [3] and TransR [19], which are well- known methods for knowledge graph embedding. Note that the heterogeneous GNNs and translation models re- quire node/edge types as input, to apply them to an LHG, we adopt two strategies: either treating all nodes or edges as one type, or generating pseudo types, which we will elaborate later. See Appen- dix B for more detailed descriptions of the baselines. Model settings. See Appendix D for the hyperparameters and other settings of the baselines and our method. 5.2 Evaluation of Link Prediction In this part, we evaluate the performance of LHGNN on the main task of link prediction on LHGs. Settings. For knowledge graph datasets (FB15k-237 and WN18RR), we use the same training/validation/testing proportion in previous work [31], as given in Table 1. For the other datasets, we adopt a 80%/10%/10% random splitting of the links. Note that the training graphs are reconstructed from only the training links. We adopt ranking-based evaluation metrics for link prediction, namely, NDCG and MAP [21]. In the validation and testing set, given a ground-truth link (a, b), we randomly sample another 9 nodes which are not linked to a as negative nodes, and form a can- didate list together with node b. For evaluation, we rank the 10 nodes based on their scores w.r.t. node a. For our LHGNN, the score for a candidate link (x, y) is computed as −∥hx + sx,y − hy ∥2. For classic and heterogeneous GNN models, we implement the same triplet margin loss for them, as given by Eq. (10). The only differ- ence is that d (x, y) is defined by ∥hx − hy ∥2 in the absence of se- mantic embeddings. Similarly, their link scoring function is defined as −∥hx − hy ∥2 for a candidate link (x, y). Translation models also use the same loss and scoring function as ours, except for replacing our link encoding sx,y with their type-based relation embedding. Scenarios of comparison. Since the type information is inacces- sible on LHGs, for heterogeneous GNNs and the translation meth- ods, we consider the following scenarios. The first scenario is to treat all nodes/edges as only one type in the absence of type information. In the second scenario, we generate pseudo types. For nodes, we resort to the K-means algorithm to cluster nodes into K clusters based on their features, and treat the cluster ID of each node as its type. Since the number of clusters or types K is unknown, we experiment with different values. For each heterogeneous GNN or translation model, we use "X-K" to denote a variant of model X with K pseudo node types, where X is the model name. For in- stance, HAN-3 means HAN with three pseudo node types. Note that there is no node feature in FB15k-237 and WN18RR. To per- form clustering, we use node embeddings by running X-1 first. On the other hand, edge types are derived using the Cartesian product of the node types, resulting in K × K pseudo edge types. Finally, for HAN which requires metapath, we further construct pseudo metapaths based on the pseudo node types. For each pseudo node type, we employ all metapaths with length two starting and ending Link Prediction on Latent Heterogeneous Graphs WWW '23, May 1–5, 2023, Austin, TX, USA Table 2: Evaluation of link prediction on LHGs. Best is bolded and runner-up underlined; OOM means out-of-memory error. Methods FB15k-237 WN18RR DBLP OGB-MAG MAP NDCG MAP NDCG MAP NDCG MAP NDCG GCN GAT GraphSAGE 0.790 ± 0.001 0.786 ± 0.002 0.800 ± 0.001 0.842 ± 0.001 0.839 ± 0.001 0.850 ± 0.001 0.729 ± 0.002 0.761 ± 0.001 0.728 ± 0.003 0.794 ± 0.001 0.818 ± 0.001 0.793 ± 0.002 0.879 ± 0.001 0.913 ± 0.001 0.891 ± 0.001 0.910 ± 0.001 0.936 ± 0.001 0.918 ± 0.001 0.848 ± 0.001 0.830 ± 0.004 0.849 ± 0.001 0.886 ± 0.001 0.872 ± 0.003 0.887 ± 0.001 TransE TransR HAN HGT HGN 0.675 ± 0.001 0.734 ± 0.004 0.752 ± 0.001 0.798 ± 0.003 0.511 ± 0.002 0.510 ± 0.002 0.624 ± 0.001 0.623 ± 0.001 0.488 ± 0.001 0.565 ± 0.007 0.605 ± 0.001 0.668 ± 0.005 0.552 ± 0.001 0.546 ± 0.001 0.656 ± 0.001 0.652 ± 0.001 0.725 ± 0.002 0.782 ± 0.001 0.742 ± 0.002 0.793 ± 0.002 0.837 ± 0.001 0.806 ± 0.001 0.749 ± 0.003 0.724 ± 0.003 0.802 ± 0.002 0.810 ± 0.003 0.791 ± 0.002 0.849 ± 0.002 0.763 ± 0.005 0.897 ± 0.001 0.907 ± 0.003 0.801 ± 0.004 0.923 ± 0.001 0.930 ± 0.002 OOM 0.835 ± 0.003 0.818 ± 0.001 OOM 0.876 ± 0.002 0.863 ± 0.001 LHGNN 0.858 ± 0.001 0.893 ± 0.001 0.838 ± 0.003 0.877 ± 0.002 0.932 ± 0.003 0.949 ± 0.002 0.879 ± 0.001 0.909 ± 0.001 Table 3: Evaluation of link prediction on LHGs with pseudo types for heterogeneous GNNs and translation models. Methods FB15k-237 WN18RR DBLP OGB-MAG MAP NDCG MAP NDCG MAP NDCG MAP NDCG TransE-3 0.693 TransE-10 0.701 TransR-3 0.749 TransR-10 0.727 HAN-3 HAN-10 HGT-3 HGT-10 HGN-3 HGN-10 0.594 0.648 0.799 0.750 0.746 0.735 0.767 0.773 0.810 0.794 0.685 0.734 0.850 0.812 0.809 0.800 0.510 0.519 0.485 0.497 0.673 0.384 0.733 0.607 0.814 0.822 0.623 0.630 0.604 0.614 0.616 0.529 0.797 0.701 0.859 0.864 0.599 0.677 0.585 0.631 0.603 0.618 0.888 0.857 0.903 0.898 0.670 0.568 0.693 0.694 0.599 0.754 0.683 0.695 0.599 0.719 OOM OOM 0.687 OOM OOM 0.708 OOM OOM 0.878 0.837 0.916 0.878 0.837 0.893 0.861 0.815 0.927 0.859 0.813 0.923 at that type. We also note that some previous works [13, 25] can predict missing type information. However, they cannot be used to generate the pseudo types, as they still need partial type infor- mation from some nodes and edges as supervision. Besides, in the third scenario, we also evaluate the heteroge- neous GNNs on a complete HIN with all node/edge types given. This assesses if explicit type information is useful, and how the baselines with full type information compare to our model. Performance on LHGs. In the first scenario, all methods do not have access to the node/edge types. We report the results in Ta- ble 2, and make the following observations. First, our proposed LHGNN consistently outperforms all the baselines across different metrics and datasets. The results imply that LHGNN can adeptly capture latent semantics between nodes to assist link prediction, even without any type information. Second, the performance of classic GNN baselines is consistently competitive or even slightly better than heterogeneous GNNs. This finding is not surprising-while heterogeneous GNNs can be effec- tive on HINs, their performance heavily depends on high-quality type information which is absent from LHGs. Third, translation models are usually worse than GNNs, possi- bly because they do not take advantage of node features, and lack a message-passing mechanism to fully exploit graph structures. Performance with pseudo types. In the second scenario, we generate pseudo types for heterogeneous GNNs and translation models, and report their results in Table 3. We observe different outcomes on different kinds of baselines. On one hand, translation models generally benefit from the use of pseudo types. Compared to Table 2 without using pseudo types, TransE-K can achieve an improvement of 13.2% and 8.5% in MAP and NDCG, respectively, while TransR-K can improve the two met- rics by 5.2% and 3.6%, respectively (numbers are averaged over the four datasets). This demonstrates that even very crude type esti- mation (e.g., K-means clustering) is useful in capturing latent se- mantics between nodes. Nevertheless, our model LHGNN still out- performs translation models using pseudo types. On the other hand, heterogeneous GNNs can only achieve mar- ginal improvements with pseudo types, if not worse performance. A potential reason is that pseudo types are noisy, and the message- passing mechanism of GNNs can propagate local errors caused by the noises and further amplify them across the graph. In contrast, the lack of message passing in translation models make them less susceptible to noises, and the benefit of pseudo types outweighs the effect of noises. Overall, while pseudo types can be useful to some extent, they cannot fully reveal the latent semantics between nodes due to po- tential noises. Moreover, we need to set a predetermined number of pseudo types, which is not required by our model LHGNN. Performance on complete HINs. The third scenario is designed to further evaluate the importance of type information, and how LHGNN fares against baselines equipped with full type informa- tion on HINs. Specifically, we compare the performance of the heterogeneous GNNs on the two datasets DBLP and OGB-MAG, where type information is fully provided. To enhance the link pre- diction of the heterogeneous GNN models, we adopt a relation- aware decoder [22] to compute the score for a candidate link (x, y) x Wr hy, where Wr ∈ Rdh×dh is a learnable matrix for each as hT edge type r ∈ R. We report the results in Table 4. We observe that heterogeneous GNNs with full type informa- tion consistently perform better than themselves without any type information (cf. Table 2). This is not surprising given the rich se- mantics expressed by explicit types. Moreover, LHGNN achieves comparable results to the heterogeneous GNNs or sometimes bet- ter results (cf. Table 2), despite LHGNN not requiring any explicit WWW '23, May 1–5, 2023, Austin, TX, USA Trung-Kien Nguyen, Zemin Liu, and Yuan Fang Table 4: Evaluation of link prediction on HINs with full ac- cess to node/edge types for heterogeneous GNNs. Percent- ages in parenthesis indicate the improvement to their per- formance on LHGs (cf. Table 2). Methods DBLP OGB-MAG MAP NDCG MAP NDCG HAN HGT HGN 0.789 (+3.4%) 0.902 (+0.6%) 0.909 (+0.2%) 0.821 (+2.5%) 0.927 (+0.4%) 0.932 (+0.2%) OOM 0.872 (+4.4%) 0.855 (+4.5%) OOM 0.904 (+3.2%) 0.892 (+3.4%) Table 5: Evaluation of node type classification on LHGs. Methods DBLP OGB-MAG MacroF Accuracy MacroF Accuracy 0.376 ± 0.009 GCN GAT 0.310 ± 0.003 GraphSAGE 0.477 ± 0.021 0.785 ± 0.002 0.782 ± 0.001 0.842 ± 0.012 0.599 ± 0.011 0.624 ± 0.035 0.550 ± 0.014 0.890 ± 0.003 0.894 ± 0.007 0.902 ± 0.004 HGT HGN 0.464 ± 0.009 0.292 ± 0.001 0.837 ± 0.005 0.778 ± 0.001 0.823 ± 0.018 0.973 ± 0.003 0.847 ± 0.003 0.531 ± 0.003 LHGNN 0.662 ± 0.001 0.995 ± 0.001 0.884 ± 0.002 0.953 ± 0.001 type. A potential reason is the node- and path-level semantic em- beddings in LHGNN can capture latent semantics in a finer granu- larity, whereas the explicit types on a HIN may be coarse-grained. For example, on a typical academic graph, there are node types of Author or Paper, but no finer-grained types like Student/Faculty Author or Research/Application Paper is available. 5.3 Evaluation of Node Type Classification To evaluate the expressiveness of semantic embeddings in captur- ing type information, we further use them to conduct node type classification on DBLP and OGB-MAG thanks to their accessible ground truth types. We perform stratified train/test splitting, i.e., for each node type, we use 60% nodes for training and 40% for testing. For each node, we concatenate its primary node embed- ding and semantic embedding, and feed it into a logistic regression classifier to predict its node type. We choose five competitive base- lines, and use their output node embeddings to also train a logistic regression classifier on the same split. We employ macro-F score and accuracy as the evaluation met- rics, and report the results in Table 5. We observe that LHGNN can significantly outperform the other baselines, with only one excep- tion in accuracy on OGB-MAG. Since the node types are imbal- anced (e.g., authors account for 77.8% of all nodes on DBLP, and 64.4% on OGB-MAG), accuracy may be skewed by the majority class and is often not a useful indicator of predictive power. The results demonstrate the usefulness of semantic embedding in our model to effectively express type information. Table 6: Training time. Nodes Edges Time Epochs 20k 40k 60k 80k 100k 370k 1084s 810k 1517s 1.2M 2166s 1.6M 2428s 1.8M 2251s 24 11 8 6 5 Figure 3: Ablation study. encoder, by setting all pairwise semantic embeddings sx,y to zero in both training and testing; (2) no personalization: we remove the personalization conditioned on semantic path embeddings, by us- ing a simple mean pooling for context aggregation; (3) no link en- coder & personalization: we remove both modules as described ear- lier, which is equivalent to removing the semantic embeddings al- together. We present the results in Fig. 3 and make the following observa- tions. First, the performance of LHGNN drops significantly when removing the link encoder, showing their importance on LHGs. In other words, the learned latent semantics between nodes are effective for link prediction. Second, without the personalization for context aggregation, the performance also declines. This shows that the context nodes have heterogeneous relationships to the tar- get node, and the semantic path embeddings can work as intended to personalize the contexts. Third, without both of them, the model usually achieves the worst performance. Scalability. We sample five subgraphs from the largest dataset OGB-MAG, with sizes ranging from 20k to 100k nodes. We present the total training time and number of epochs of LHGNN on these subgraphs in Table 6. As the graph grows by 5 times, total training time to converge only increases by 2 times, since generally fewer epochs are needed for convergence on larger graphs. Additional studies. We present results on additional model stud- ies in Appendices E, F and G, respectively. 6 CONCLUSION In this paper, we investigated a challenging and unexplored set- ting of latent heterogeneous graphs (LHG) for the task of link pre- diction. Existing approaches on heterogeneous graphs depend on explicit type-based information, and thus they do not work well on LHGs. To deal with the absence of types, we proposed a novel model named LHGNN for link prediction on an LHG, based on the novel idea of semantic embedding at both node and path levels, and a personalized aggregation of latent heterogeneous contexts for target nodes in a fine-grained manner. Finally, extensive experi- ments on four benchmark datasets show the superior performance of LHGNN. 5.4 Model Analyses Ablation study. To evaluate the contribution of each module in LHGNN, we conduct an ablation study by comparing with sev- eral degenerate variants: (1) no link encoder: we remove the link ACKNOWLEDGMENTS This research is supported by the Agency for Science, Technology and Research (A*STAR) under its AME Programmatic Funds (Grant No. A20H6b0151). Link Prediction on Latent Heterogeneous Graphs WWW '23, May 1–5, 2023, Austin, TX, USA REFERENCES [1] Yoshua Bengio, Aaron Courville, and Pascal Vincent. 2013. Representation learn- ing: A review and new perspectives. TPAMI 35, 8 (2013), 1798–1828. [2] Kurt Bollacker, Colin Evans, Praveen Paritosh, Tim Sturge, and Jamie Taylor. 2008. Freebase: a collaboratively created graph database for structuring human knowledge. In SIGMOD. 1247–1250. [3] Antoine Bordes, Nicolas Usunier, Alberto Garcia-Duran, Jason Weston, and Ok- sana Yakhnenko. 2013. Translating embeddings for modeling multi-relational data. In NeurIPS. [4] Hongyun Cai, Vincent W Zheng, and Kevin Chen-Chuan Chang. 2018. A com- prehensive survey of graph embedding: Problems, techniques, and applications. TKDE 30, 9 (2018), 1616–1637. [5] Yuxiao Dong, Nitesh V Chawla, and Ananthram Swami. 2017. metapath2vec: Scalable representation learning for heterogeneous networks. In KDD. 135–144. [6] Yuan Fang, Wenqing Lin, Vincent W Zheng, Min Wu, Kevin Chen-Chuan Chang, and Xiao-Li Li. 2016. Semantic proximity search on graphs with metagraph- based learning. In ICDE. 277–288. [7] Matthias Fey and Jan Eric Lenssen. 2019. Fast graph representation learning with PyTorch Geometric. arXiv preprint arXiv:1903.02428 (2019). [8] Tao-yang Fu, Wang-Chien Lee, and Zhen Lei. 2017. Hin2vec: Explore meta-paths in heterogeneous information networks for representation learning. In CIKM. 1797–1806. [9] Xinyu Fu, Jiani Zhang, Ziqiao Meng, and Irwin King. 2020. MAGNN: Metap- ath aggregated graph neural network for heterogeneous graph embedding. In WWW. 2331–2341. [10] Aditya Grover and Jure Leskovec. 2016. node2vec: Scalable feature learning for networks. In KDD. 855–864. [11] Will Hamilton, Zhitao Ying, and Jure Leskovec. 2017. Inductive representation learning on large graphs. In NeurIPS. 1024–1034. [12] Huiting Hong, Hantao Guo, Yucheng Lin, Xiaoqing Yang, Zang Li, and Jieping Ye. 2020. An attention-based graph neural network for heterogeneous structural learning. In AAAI. 4132–4139. [13] Jon Arne Bø Hovda, Darío Garigliotti, and Krisztian Balog. 2019. NeuType: A Simple and Effective Neural Network Approach for Predicting Missing Entity Type Information in Knowledge Bases. arXiv preprint arXiv:1907.03007 (2019). [14] Binbin Hu, Yuan Fang, and Chuan Shi. 2019. Adversarial learning on heteroge- neous information networks. In KDD. 120–129. [15] Weihua Hu, Matthias Fey, Marinka Zitnik, Yuxiao Dong, Hongyu Ren, Bowen Liu, Michele Catasta, and Jure Leskovec. 2020. Open graph benchmark: Datasets for machine learning on graphs. In NeurIPS. 22118–22133. [16] Ziniu Hu, Yuxiao Dong, Kuansan Wang, and Yizhou Sun. 2020. Heterogeneous graph transformer. In WWW. 2704–2710. [17] Xunqiang Jiang, Tianrui Jia, Yuan Fang, Chuan Shi, Zhe Lin, and Hui Wang. 2021. Pre-training on large-scale heterogeneous graph. In KDD. 756–766. [18] Thomas N Kipf and Max Welling. 2017. Semi-supervised classification with graph convolutional networks. In ICLR. [19] Yankai Lin, Zhiyuan Liu, Maosong Sun, Yang Liu, and Xuan Zhu. 2015. Learn- ing entity and relation embeddings for knowledge graph completion. In AAAI. 2181–2187. [20] Zemin Liu, Yuan Fang, Chenghao Liu, and Steven C.H. Hoi. 2021. Node-wise Lo- calization of Graph Neural Networks. In Proceedings of the Thirtieth International Joint Conference on Artificial Intelligence. 1520–1526. [21] Zemin Liu, Trung-Kien Nguyen, and Yuan Fang. 2021. Tail-GNN: Tail-Node Graph Neural Networks. In KDD. 1109–1119. [22] Qingsong Lv, Ming Ding, Qiang Liu, Yuxiang Chen, Wenzheng Feng, Siming He, Chang Zhou, Jianguo Jiang, Yuxiao Dong, and Jie Tang. 2021. Are we really making much progress? Revisiting, benchmarking and refining heterogeneous graph neural networks. In KDD. 1150–1160. [23] George A Miller. 1995. WordNet: a lexical database for English. CACM 38, 11 (1995), 39–41. [24] Ramesh Nallapati, Feifei Zhai, and Bowen Zhou. 2017. SummaRuNNer: A re- current neural network based sequence model for extractive summarization of documents. In AAAI. 3075–3081. [25] Arvind Neelakantan and Ming-Wei Chang. 2015. Inferring missing entity type instances for knowledge base completion: New dataset and methods. In NAACL. 515–525. [26] Ethan Perez, Florian Strub, Harm De Vries, Vincent Dumoulin, and Aaron Courville. 2018. FiLM: Visual reasoning with a general conditioning layer. In AAAI. 3942–3951. [27] Bryan Perozzi, Rami Al-Rfou, and Steven Skiena. 2014. DeepWalk: Online learn- ing of social representations. In KDD. 701–710. [28] Aravind Sankar, Xinyang Zhang, and Kevin Chen-Chuan Chang. 2019. Meta- GNN: Metagraph neural network for semi-supervised learning in attributed het- erogeneous information networks. In ASONAM. 137–144. [29] Yizhou Sun and Jiawei Han. 2012. Mining heterogeneous information networks: principles and methodologies. Synthesis Lectures on Data Mining and Knowledge Discovery 3, 2 (2012), 1–159. [30] Yizhou Sun, Jiawei Han, Xifeng Yan, Philip S Yu, and Tianyi Wu. 2011. Path- sim: Meta path-based top-k similarity search in heterogeneous information net- works. PVLDB 4, 11 (2011), 992–1003. [31] Zhiqing Sun, Zhi-Hong Deng, Jian-Yun Nie, and Jian Tang. 2018. RotatE: Knowl- edge Graph Embedding by Relational Rotation in Complex Space. In ICLR. [32] Jian Tang, Meng Qu, Mingzhe Wang, Ming Zhang, Jun Yan, and Qiaozhu Mei. 2015. LINE: Large-scale information network embedding. In WWW. 1067–1077. [33] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In NeurIPS. 5998–6008. [34] Petar Veličković, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua Bengio. 2018. Graph attention networks. In ICLR. [35] Xiao Wang, Houye Ji, Chuan Shi, Bai Wang, Yanfang Ye, Peng Cui, and Philip S Yu. 2019. Heterogeneous graph attention network. In WWW. 2022–2032. [36] Zhen Wang, Jianwen Zhang, Jianlin Feng, and Zheng Chen. 2014. Knowledge graph embedding by translating on hyperplanes. In AAAI. 1112–1119. [37] Zonghan Wu, Shirui Pan, Fengwen Chen, Guodong Long, Chengqi Zhang, and S Yu Philip. 2020. A comprehensive survey on graph neural networks. TNNLS 32, 1 (2020), 4–24. [38] Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. 2019. How powerful are graph neural networks?. In ICLR. [39] Carl Yang, Yuxin Xiao, Yu Zhang, Yizhou Sun, and Jiawei Han. 2020. Heteroge- neous network representation learning: A unified framework with survey and benchmark. TKDE 34, 10 (2020), 4854–4873. [40] Seongjun Yun, Minbyul Jeong, Raehyun Kim, Jaewoo Kang, and Hyunwoo J Kim. 2019. Graph transformer networks. In NeurIPS. 11983–11993. [41] Chuxu Zhang, Dongjin Song, Chao Huang, Ananthram Swami, and Nitesh V Chawla. 2019. Heterogeneous graph neural network. In KDD. 793–803. [42] Han Zhang, Yu Hao, Xin Cao, Yixiang Fang, Won-Yong Shin, and Wei Wang. 2021. Relation prediction via graph neural network in heterogeneous informa- tion networks with missing type information. In CIKM. 2517–2526. [43] Muhan Zhang and Yixin Chen. 2018. Link prediction based on graph neural networks. In NeurIPS. 5171–5181. [44] Wentao Zhang, Yuan Fang, Zemin Liu, Min Wu, and Xinming Zhang. 2022. mg2vec: Learning Relationship-Preserving Heterogeneous Graph Representa- tions via Metagraph Embedding. TKDE 34, 3 (2022), 1317–1329. [45] Tianyu Zhao, Cheng Yang, Yibo Li, Quan Gan, Zhenyi Wang, Fengqi Liang, Huan Zhao, Yingxia Shao, Xiao Wang, and Chuan Shi. 2022. Space4HGNN: A Novel, Modularized and Reproducible Platform to Evaluate Heterogeneous Graph Neu- ral Network. In SIGIR. 2776–2789. WWW '23, May 1–5, 2023, Austin, TX, USA Trung-Kien Nguyen, Zemin Liu, and Yuan Fang APPENDICES A Algorithm and Complexity We outline the model training for LHGNN in Algorithm 1. Algorithm 1 Model Training for LHGNN Input: latent heterogeneous graph G = (V , E), training triplets T , a set of random walk paths Pv for each node v Output: Model parameters Θ. 1: initialize parameters Θ; 2: while not converged do 3: 4: 5: 6: 7: 8: v sample a batch of triplets Tbat ⊂ T ; for each target node v in the batch Tbat do for each layer l ∈ {1, 2, . . . , l } do ; θl s ); v ← fs (hl −1 sl for each path p ∈ Pv that ends at context node u do sl p ← fp ( {sl vi |vi in the path p }); ̃ u |p ← τ (hl −1 p ; θl u , sl hl τ ); v ← Aggregate( { ̃ hl hl u |p |p ∈ Pv }; 9: 10: Calculate the loss L by Eqs. (10),(11) and (12); update Θ by minimizing L; 11: 12: 13: return Θ. In line 1, we initialize the model parameters. In line 3, we sample a batch of triplets from training data. In lines 4–10, we calculate layer-wise node representations on the training set. Specifically, for each node v in layer l, we calculate the semantic embeddings at the node level in line 6 and path level in line 8. Next, we personalize the contexts in line 9 and aggregate them in line 10. In lines 11-12, We compute the loss and update the parameters. h sdl−1 dl−1 h ), where dl h We compare the complexity of one layer and one target node in LHGNN against a standard message-passing GNN. In a standard GNN, the aggregation for one node in the l-th layer has complex- ity O ( ̄ddl is the output dimension of the l-th layer h and ̄d is the node degree. In our model, we first need to compute the node- and path-level semantic embeddings. At the node level, the cost is O (dl h ) based on Eq. (1); at the path level, given a node with k paths of maximum length Lmax, the cost is O (kLmaxdl s ) based on Eq. (2). The computation of scaling and shifting vectors takes O (kdl−1 dl s ) based on Eqs. (5) and (6), and the personaliza- tion of context embeddings takes O (kdl−1 h ) based on Eq. (4). Thus, dl−1 the aggregation and representation update step takes O (kdl h ) h based on Eqs. (7) and (8). Furthermore, the cost to sample a path of length Lmax is O (Lmax). To sample k paths for a target node in one LHGNN layer, the overhead is O (kLmax), which is negligible compared to the aggregation cost, as Lmax is small (less than 5 in our experiments). Therefore, the total complexity for one node in dl−1 one layer is O (kLmaxdl h + kdl ). As Lmax is a small h dl−1 constant and dl−1 h ). Furthermore, we can limit k, the number of sampled paths from each node, by some constant value, in which case our model has the same complexity class as a standard GNN. dl−1 s , the complexity reduces to O (kdl h s ≪ dl−1 s + kdl h h B Details of Baselines We provide detailed descriptions for the baselines. • Classic GNNs: GCN [18] aggregates information for the target node by applying mean-pooling over its neighbors. GAT [34]: utilizes self-attention to assign different weights to neighbors of the target node during aggregation. Meanwhile, GraphSAGE [11]: concatenates the target node with the aggregated informa- tion from its neighbors to produce the node embedding. These models treat all nodes or edges as a uniform type and do not attempt to distinguish them. • Heterogeneous GNNs: HAN [35] makes use of handcrafted meta- paths to decompose HIN into multiple homogeneous graphs, one for each metapath, then employs hierarchical attention to learn both node-level and semantic-level importance for aggre- gation. HGT [16] applies the transformer model, using node and edge type parameters to capture the heterogeneity. HGN [22] extends GAT by employing node type information in the calcu- lation of attention scores. These three models require type-based information in their architectures. Given an LHG, we either as- sume a single node/edge type or employ pseudo types for these methods, as described in the main paper. • Translation models: TransE [3] models the relation between en- tities as a translation in the same embedding space. TransR [19] maps entity embeddings into a relation-wise space before the translation. These models require the relation type (i.e., edge type) to be known. Similarly, we assume a single edge type or employ pseudo types for them. C Environment All experiments are conducted on a workstation with a 12-core CPU, 128GB RAM, and 2 RTX-A5000 GPUs. We implemented the proposed LHGNN using Pytorch 1.10 and Python 3.8 in Ubuntu- 20.04. D Model Settings For all the approaches, we use the same output dimension as 32 for fair comparison to conduct link prediction. For the two knowl- edge graph datasets (i.e., FB15k-237 and WN18RR), we randomly initialize a learnable parameter vector for each entity with embed- ding dimension 200. We tune the margin hyperparameter α for each model in order to achieve its optimal performance. All exper- iments are repeated 5 times, and we report the average results with standard deviations. For all GNN baselines, we employ two layers with L2 Normal- ization on each layer. We use a margin 0.2 and dropout ratio 0.5 for all of them. For GCN, we set the hidden dimension as 32. For GAT, we use four attention heads with hidden dimension of each head as 16. For GraphSAGE, we use the mean aggregator and set its hid- den dimension as 32. For all HGNN baselines, we mainly follow the default setting in [22]. In particular, we also employ 2-layer archi- tectures for all of them. For HAN, for the node-level aggregation, we use GAT with eight attention heads with hidden dimension 8 for each head, and its dropout ratio is 0.6; and we set the dimen- sion for semantic-level attention as 128 and set α = 1. For HGT, we use eight attention heads, with dropout ratio as 0.2 and margin as 1. For HGN, we use eight attention heads with dropout ratio as 0.5. We set the dimension of edge embeddings as 64, and the mar- gin as 0.5. For translation models including TransE and TransR, we Link Prediction on Latent Heterogeneous Graphs WWW '23, May 1–5, 2023, Austin, TX, USA Table VII: Impact of different number of layers. In each column, the best is bolded and the runner-up is underlined. Methods GCN-2 GCN-3 GCN-4 HGT-2 HGT-3 HGT-4 FB15k-237 WN18RR DBLP OGB-MAG MAP NDCG MAP NDCG MAP NDCG MAP NDCG 0.790 ± 0.001 0.782 ± 0.001 0.778 ± 0.001 0.782 ± 0.001 0.788 ± 0.001 0.784 ± 0.005 0.842 ± 0.001 0.837 ± 0.001 0.833 ± 0.001 0.837 ± 0.001 0.841 ± 0.001 0.838 ± 0.003 0.729 ± 0.002 0.726 ± 0.005 0.711 ± 0.005 0.724 ± 0.003 0.727 ± 0.012 0.751 ± 0.007 0.794 ± 0.001 0.792 ± 0.003 0.781 ± 0.004 0.791 ± 0.002 0.792 ± 0.009 0.811 ± 0.006 0.879 ± 0.001 0.861 ± 0.001 0.851 ± 0.003 0.897 ± 0.001 0.890 ± 0.001 0.881 ± 0.011 0.910 ± 0.001 0.896 ± 0.001 0.888 ± 0.003 0.923 ± 0.001 0.917 ± 0.001 0.911 ± 0.009 0.848 ± 0.001 0.799 ± 0.003 0.802 ± 0.002 0.835 ± 0.003 0.826 ± 0.002 0.822 ± 0.003 0.886 ± 0.001 0.849 ± 0.002 0.851 ± 0.002 0.876 ± 0.002 0.870 ± 0.002 0.867 ± 0.003 LHGNN 0.858 ± 0.001 0.893 ± 0.001 0.838 ± 0.003 0.877 ± 0.002 0.932 ± 0.003 0.949 ± 0.002 0.879 ± 0.001 0.909 ± 0.001 Table VIII: Impact of model size. |Θ| denotes the number of learnable parameters in a model. layers might not give better results. Overall, they are still much worse than our proposed LHGNN. Methods DBLP |Θ| MAP NDCG |Θ| OGB-MAG MAP NDCG GCN-32 GCN-64 GCN-96 12K 0.879 ± 0.001 0.910 ± 0.001 25K 0.890 ± 0.001 0.918 ± 0.001 41K 0.890 ± 0.001 0.918 ± 0.001 5K 0.848 ± 0.001 0.886 ± 0.001 12K 0.849 ± 0.001 0.887 ± 0.001 21K 0.847 ± 0.001 0.886 ± 0.001 26K 0.913 ± 0.001 0.936 ± 0.001 GAT-16 60K 0.910 ± 0.001 0.932 ± 0.001 GAT-32 GAT-48 102K 0.910 ± 0.002 0.933 ± 0.002 13K 0.830 ± 0.004 0.872 ± 0.003 33K 0.828 ± 0.001 0.871 ± 0.001 62K 0.815 ± 0.005 0.861 ± 0.004 HGT-32 HGT-64 21K 0.897 ± 0.001 0.923 ± 0.001 61K 0.907 ± 0.001 0.930 ± 0.001 14K 0.835 ± 0.003 0.876 ± 0.002 48K 0.836 ± 0.003 0.877 ± 0.002 HGN-32 239K 0.907 ± 0.003 0.930 ± 0.002 231K 0.818 ± 0.001 0.863 ± 0.001 HGN-64 717K 0.905 ± 0.001 0.929 ± 0.001 703K 0.826 ± 0.001 0.869 ± 0.001 LHGNN 25K 0.932 ± 0.003 0.949 ± 0.002 12K 0.879 ± 0.001 0.909 ± 0.001 Figure IV: Impact of parameters. set the learning rate as 0.005, embedding dimension as 200 and the margin as 0.2. For our model, we also employ a two-layer architecture with L2- Normalization. We randomly sample 50 paths starting from each target node. We set the dimension of semantic embeddings as 10, decay ratio λ as 0.1, the weight of scaling and shifting constraints μ as 0.0001, and margin as 0.2. E Number of Layers We investigate the impact of number of layers in representative baseline models. Results from Table VII show that adding more F Impact of Model Size We investigate the impact of model size (i.e., the number of learn- able parameters in a model) on empirical performance. Specifi- cally, we select several representative GNNs from the baselines, and vary the size of each GNN by increasing its hidden dimen- sion. For instance, GCN-32 indicates that its hidden layer has 32 neurons. Table VIII shows the link prediction performance of the GNNs with varying model sizes. Overall, larger models employ- ing the same GNN architecture can only achieve slight improve- ments, and LHGNN continues to outperform them despite having a relatively small model. The results imply that the effectiveness of LHGNN comes from the architectural design rather than stacking with more parameters. G Parameter Sensitivity To study the impact of model parameters, we showcase two of the important parameters, including the maximum length for path sampling Lmax, and the weight of scaling and shifting constraint μ. We present the results in Fig. IV. For sparse datasets with low av- erage degree such as WN18RR and DBLP, using a large maximum length for paths can generally improve the performance, as it can exploit more contextual structures around the target node. For the other two datasets, their performance is generally less affected as the maximum length of paths increases. For the hyper-parameter μ, LHGNN generally achieves the best performance in the interval [0.0001, 0.001] across the four datasets, demonstrating the neces- sity of this constraint. H Data Ethics Statement To evaluate the efficacy of this work, we conducted experiments which only use publicly available datasets234, in accordance to their usage terms and conditions if any. We further declare that no personally identifiable information was used, and no human or animal subject was involved in this research. 2https://github.com/DeepGraphLearning/KnowledgeGraphEmbedding.git 3https://github.com/seongjunyun/Graph_Transformer_Networks.git 4https://github.com/snap-stanford/ogb.git
http://arxiv.org/abs/2302.10430v1
2023-02-21T04:00:44
2023-02-21T04:00:44
Interval Type-2 Fuzzy Neural Networks for Multi-Label Classification
Prediction of multi-dimensional labels plays an important role in machine learning problems. We found that the classical binary labels could not reflect the contents and their relationships in an instance. Hence, we propose a multi-label classification model based on interval type-2 fuzzy logic. In the proposed model, we use a deep neural network to predict the type-1 fuzzy membership of an instance and another one to predict the fuzzifiers of the membership to generate interval type-2 fuzzy memberships. We also propose a loss function to measure the similarities between binary labels in datasets and interval type-2 fuzzy memberships generated by our model. The experiments validate that our approach outperforms baselines on multi-label classification benchmarks.
[ "Dayong Tian", "Feifei Li", "Yiwen Wei" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10430v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10430v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI", "cs.CV" ]
3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 0 3 4 0 1 . 2 0 3 2 : v i X r a Interval Type-2 Fuzzy Neural Networks for Multi-Label Classification Dayong Tian, Feifei Li, Yiwen Wei 1 Interval type-2 fuzzy logic is capable of representing different human opinions on categorization. It is the motivation that we explore how to build a fuzzy-logic-based model for MLC. In uni-label classification, probability and type-1 fuzzy Abstract-Prediction of multi-dimensional labels plays an im- portant role in machine learning problems. We found that the classical binary labels could not reflect the contents and their relationships in an instance. Hence, we propose a multi-label classification model based on interval type-2 fuzzy logic. In the proposed model, we use a deep neural network to predict the type-1 fuzzy membership of an instance and another one to predict the fuzzifiers of the membership to generate interval type-2 fuzzy memberships. We also propose a loss function to measure the similarities between binary labels in datasets and interval type-2 fuzzy memberships generated by our model. The experiments validate that our approach outperforms baselines on multi-label classification benchmarks. Index Terms-Interval type-2 fuzzy logic, structured predic- tion, multi-dimensional labels, multi-label classification. I. INTRODUCTION M Ulti-label classification (MLC) aims at predicting dependencies among labels. It has been widely used in natural language processing [10] and computer vision [40]. exploring multiple labels the by Classical MLC models make binary predictions. That they use 0 and 1 to indicate the categorizations. is, However, intuitively, human has fuzzy discrimination on an instance(Fig. 1). image (a), their categories. For When categorizing these four images in Fig. 1, human observers may consider the semantic relationships between flowers or women in the images and hence they may give fuzzy estimations of it apparently belongs to flower. For (b), someone may consider the woman is the main content while others may consider woman and flower are of the same importance. For (c), we human can make sure that the image belongs to the woman category and the flower is just a decoration. However, the flower occupies a considerably large area in the image. A MLC model may also consider that it belongs to flower category in certain degree. For (d), human observers' opinions may be contradictory again because someone may consider the woman holds the flower in front of her face so she probably want to show a special species of flower, while someone may consider that the flower is just an ordinary one and the main content of the image is still the woman. Almost in all datasets, instances are directly labeled by 0 or 1, which cannot effectively represent humans' fuzzy judgment. This work was supported in part by Natural Science Foundation of Shaanxi Province under Grant 2020JQ-197. Dayong Tian and Feifei Li are with the School of Electronics and Infor- mation, Northwestern Polytechnical University, Xi'an, 710071, P.R. China. Yiwen Wei is with the School of Physics and Optoelectronic Engineering, Xidian University, Xi'an, 71000, P.R. China. Fig. 1. Illustration of different types of labels. The labels in dataset are binary. Type-1 fuzzy labels may be generated from the judgment of a human expert. Type-2 fuzzy labels may be generated from the several human experts' judgment. To visualize the feature extraction of a learning model, say convolutional neural network, we assume the extracted features are two- dimensional. The images' features are plotted in the feature space. logic are a little bit confusing. Softmax is widely used in neural networks for uni-label classification. The output of softmax can be explained as the probability of an instance belonging to a category. Someone can "illegally" explain the probabilities as type-1 fuzzy memberships. If we are working on uni-label classification, there is few numerical difference between these two explanations. For example, we can explain Fig. 1 as this. The probability of the image (a) belonging to flower category is maximum, so the image is belonging to flower category. The membership of the image (b) belonging to woman category is maximum. If we must make a decision on which category it belongs to, we have to categorize the image into woman category. However, if we are interested in multi-label classifications, there is a key difference between probabilities and fuzzy logic. We should examine the joint probability (Fig. 2). Instead, we can explain the outputs of a neural network as type-1 fuzzy memberships. Although we give a reasonable explanation to the outputs, type-1 fuzzy logic is not fuzzy [36]. Hence, type-2 fuzzy logic is used here. We believe that interval the more categories an instance belongs to, the fuzzier its memberships are. Therefore, we use the number of its categories to control the fuzziness of its memberships (Fig. 2). By introducing interval type-2 fuzzy logic, we need design (flower, woman)abcdLabels in Dataset(1,0)(1,1)(1,1)(1,1)Type-1 Fuzzy Labels(1,0)(0.7,0.3)(0.2,0.8)(0.3,0.7)Type-2 Fuzzy Labels([1,1],[0,0])([0.5,0.9],[0.2,0.4])([0.1,0.3],[0.7,0.9])([0.1,0.7],[0.2,0.9])Feature Space 2 Fig. 2. The differences among probabilities, type-1 fuzzy logic and interval type-2 fuzzy logic. Suppose we have L categories. In the multi-label classification case, we examine the joint probabilities of all elements in the label powerset which is defined as a set of all possible label combinations. Hence, there are 2L label combinations. If we directly explain the output of the classifier as type-1 or type-2 fuzzy predictions, we only need to examine L fuzzy memberships. the loss function of the classifier to measure the dissimilarities between interval type-2 fuzzy labels and binary labels. The overall scheme of our model is illustrated in Fig. 3. The following of this paper is organized as follows. In Section II, related works are briefly reviewed. The preliminaries are given in Section III. The formulation of our models is shown in Section IV. In Section V, we report the experimental results of our method. The conclusive remarks are given in Section VI. II. RELATED WORKS An intuitive way for MLC is using classifier chains [30] which decomposes a multi-label classification into a series of binary classifications. The subsequent binary classifiers are built on the prediction of preceding ones. Recurrent neural networks (RNN) and convolutional neural networks (CNN) are used in classifier chains [40]. The MLC can be also transformed to a label ranking problem. Label ranking based methods use L(L − 1)/2 bi- nary classifiers for pairwise comparisons between each label pair [17]. Wang et al. [43] proposed an efficient learning algorithm for solving multi-label ranking problem which is used to model facial action unit recognition task. Random k-Labelsets [37][42] methods build multi-class sub-models on random subsets of labels, and then learn single- in the label classifier for the prediction of each element powerset of this subset. Lo et al. [26] proposed a basis expansions model for MLC. The basis function is a label powerset classifier trained on a random k-labelset. The authors derive an analytic solution to learn the expansion coefficients which minimize the error between the prediction and the groundtruth. Mutual information is incorporated to evaluate the redundancy level and imbalance level of each k-labelset [41]. K-nearest neighbor (KNN), another classical machine learn- ing method, is combined with maximum a posteriori (MAP) principle to determine the label set of an unseen in- stance [49]. Dimension reduction methods can be also used for MLC [6][11][21]. Xu et al.[45] proposed a probabilistic class saliency estimation approach for calculating the projection matrix in linear discriminant analysis for dimension reduction. Decision tree can be built recursively based on a multi-label- entropy based information gain criterion [14]. A set of support vector machines can be optimized to minimize an empirical ranking loss for MLC [16]. The correlation labels can be encoded as constrains for MLC [19]. Aligning embeddings of data features and labels in a latent space is a popular trend in MLC. Yeh et al. [46] use canonical correlation analysis to combine two autoencoders for features and labels to build a label-correlation sensitive loss function. However, the learned latent space is not smooth so small perturbations can lead to totally different decoding results. Similar decoded targets cannot be guaranteed even though the embeddings of features and labels are close in the latent space [2]. Bai et al. [2] substitute the autoencoders with variational autoencoders so the deterministic latent spaces become probabilistic latent spaces. KL-divergence is used to align the Gaussian latent spaces and the sampling process enforces smoothness. Sundar et al. [33] adopt the β-VAE for similar purposes. These methods assume a uni-modal Gaussian latent space, which may cause over-regularization and posterior collapse [15][44]. Li et al. [25] proposed a deep label-specific feature learning model to bind the label and local visual region in images and they use two variant graph convolutional networks to capture the relationships among labels. Tan et al. [34] link the manifolds of instance and label spaces, which facilitates using topological relationship of the manifolds in the instance space to guide the manifold construction of the label space. Modeling label correlation is another popular research in MLC. Structured prediction energy networks area (SPENs) [3][4] optimize the sum of local unary potentials 0.700.300.80Classifier OutputUni-labelClassification0.360.240.40Softmax(=3|)=0.40(=2|)=0.24(=1|)=0.36Joint Distribution1 0 00.141 0 10.62Multi-labelClassification(1=1,2=0,3=0|)=0.14(1=1,2=0,3=1|)=0.62Type-1 FuzzyLabelType-2Fuzzy Label0.700.300.80[0.60,0.80][0.20,0.40][0.70,0.90] 3 Fig. 3. The scheme of our method. The input data are used to train two neural networks, a fuzziness intializer and a fuzzifier estimator. The fuzziness intializer is used to generate type-1 fuzzy labels. The output of the bottleneck of the autoencoder is used as an input of a fuzzifier estimator. The estimated fuzzifiers are incorporated into type-1 fuzzy labels to generate interval type-2 fuzzy labels. Then, we design a loss function to measure the dissimilarities between binary labels in original dataset and generated interval type-2 fuzzy labels. The loss function is used to train the parameters of the fuzziness intializer. Finally, the interval type-2 fuzzy labels are defuzzified to binary predictions. All metrics in our experiments are computed based the binary predictions and groundtruth binary labels. and a global potential are trained with a SVM loss. However, the alternating optimization approach suffers from instabilities during training. Tu et al. [38] proposed several strategies to stabilize the joint training of structured prediction of SPENs. The deep value network (DVN) [20] trains a similar energy network by fitting the task cost function. Zhang et al. [48] pro- posed cross-coupling aggregation strategy to simultaneously exploit the label correlation and handle class-imbalance issue. Ma et al. [27] assume the instances can be clustered into different groups so that the label correlations can be modeled within each sub-group. Input convex neural networks (ICCNs) [1] design potentials which are convex with respect to the labels so that inference optimization will be able to reach global optimum. Bi et al. [7] use a probabilistic model exploiting the multi-label correlations. Lanchantin et al. [24] propose label message passing (LaMP) neural networks for MLC. LaMP treats labels as nodes on a label-interaction graph and computes the hidden representation of each label node conditioned on the input using attention-based neural message passing. Chen et al. [12] adopt graph convolutional network (GCN). Each node on the graph is represented by word embeddings of a label. The GCN is learned to map this label graph into a set of inter-dependent object classifiers. These classifiers are applied to the image descriptors extracted by another sub-net, enabling the whole network to be end-to-end trainable. Zhang et al. [50] predict labels using a deep neural network in a way that respects the set structure of the problem. Patel et al. [29] exploit the taxonomic relationships among labels using box embeddings [39]. Brukhim et al. [9] use cardinality [35] of labels as constraints for training the classifier. III. PRELIMINARIES We consider the setting of assigning L labels y = (y1, . . . , yL) to an input x ∈ Rd, where d is the dimension of instance features. The true label (which is binary) of x is denoted as y∗. The fuzziness of y is controlled by fuzzifier m and m. That is, x is belonged to the i-th category in a degree of [ym i ]. Almost all datasets provide binary labels. To compute the metrics for comparison, we will generate binary predicted labels ˆy based on y. ˆy's are the final predictions of our model. The notations are listed in Table I. i , ym TABLE I NOTATIONS notations x y y∗ ̄y ˆy m m d L α, β, γ η, λ spaces Rd [0, 1]L {0, 1}L RL {0, 1}L R+ R+ N+ N+ R R+ descriptions Instance feature vector Estimated type-1 fuzzy label vector Groundtruth binary label vector Temporary result for defuzzification Estimated binary label vector Fuzzifier for lower bound Fuzzifier for upper bound Dimension of feature vectors Dimension of label vectors Learned parameters Preset hyperparameters IV. FORMULATION In this section, we will explain our models in details. There are three main components in our model. First, there is a deep neural network used as a fuzziness initializer to generate BottleneckEncoderDecoderFuzzinessInitializerInput DataReconstructed DataFuzzifier EstimatorType-1 Fuzzy LabelsType-2 Fuzzy Labels 1⋯0⋮⋱⋮1⋯1 BinaryLabelsLossDefuzzification 1⋯0⋮⋱⋮1⋯1 BinaryPredictions initial labels. Second, we use another network to predict the fuzzifier m and m. Third, we design an algorithm to compare the interval type-2 labels and binary labels. A. Fuzziness initializer Indeed, we can use any classical classification neural net- works as our fuzziness initializer. The key difference is the activation functions of output layers. To generate the initial guess of fuzzy membership value, we should use an activation function whose value ranges from 0 to 1. Rather than using Sigmoid function which may cause gradient vanishing and slow convergence, we use the following activation function: (cid:40) g(x) = 0.5 + α (cid:0)w(cid:62)x − 1 f (x) = max (0, min (1, g(x))) , L (cid:0)1(cid:62)x + 1(cid:62)w(cid:1)(cid:1) (1) where L is the dimension of vector x or w, and α is a learned parameter which is initially set as 1. 1 L (x + w) can be treated as bias term of the neuron. Eq. (1) is similar to the idea of Batch Normalization (BN) [23]. BN learns two parameters β and γ in ̃Z = βZ + γ, (2) to standardize mini-batches, where Z is the output of one layer and ̃Z is the output of BN. γ in Eq. (2) is expected to be a constant vector. However, when the neural network is trained by mini-batch, it is impossible for γ to hold constant. Hence, for each neuron, we minus the means of x and w. The bias term of each neuron can vary according to mini-batched data. What Eq. (1) really learns is a proper weight w that makes w(cid:62)x can be centered by 1 L (x + w). 0.5 in Eq. (1) is used to shift the zero-centered outputs to 0.5-centered so that we can use f (x) to generate values in interval [0, 1]. α in Eq. (1) is similar to β in Eq. (2). It is used to change the standard deviation of outputs to approximately 1. Therefore, Eq. (1) can avoid gradient vanishing as BN. B. Fuzzifier Estimator Fuzziness estimator is used to estimate the fuzzifier of predicted labels, i.e. m and m. As we discussed above, the fuzziness is related to the number of categories an instance belongs to, i.e. |y∗|. Hence, we use another neural network to predict |y∗|. We denote the prediction of |y∗| as ˆm hereafter. To estimate ˆm, firstly, we train an autoencoder. Then, we train a constrained linear regression model on the outputs of the bottleneck of the autoencoder to estimate ˆm (Fig. 3). We add a softmax layer on the bottleneck of the autoencoder and we add a cross-entropy to the object function of the autoencoder: 4 to. If the i-th element of l is non-zero, it indicates that the instance belongs to i categories. For example, if the original label of an instance is [0, 1, 0], its l is [1, 0, 0] which indicates the instance only belongs to one category. If the original label of an instance is [1, 0, 1], its l is [0, 1, 0] which indicates the instance belongs to two categories. The reason why we do not directly train a classification neural network to predict l is that we want to de-correlate the neural networks we used for predicting y and l. This idea comes from Random Forest which randomly chooses subsets of variables to construct trees so that these trees are less correlated. The Random Forest increases the bias of the model while decreases the variance of the model. In our model, although y and l are different supervision information, they are correlated to each other. Furthermore, the neural networks have the ability of predicting y or l using a few layers close to the output, even when the inputs are the same. That is, if we use the same random seed and structure for two deep neural networks that predict y and l respectively, they may only significantly differ in 1 or 2 layers close to the output. Using autoencoder, the data themselves are another "supervision" information for training so that those two neural networks are possible to be more de-correlated. After the autoencoder is trained, we use the bottleneck's outputs to train a simple linear regression model. The label is the number of categories an instance belongs to, i.e. |y∗|. We use the output of the linear regression model as ˆm. We set m = ˆm/|y∗| and m = ˆm/L. Note that |y∗| ≤ L and 0 ≤ y ≤ 1. Therefore, m ≥ m and ym ≤ ym. For a special case when m = m, the fuzzifier estimator believes the instance only belongs to one category. There is no fuzziness at all in this case. C. Loss Function Traditional loss functions for structured learning can be cross entropy, F1 measure, etc. Our model generates interval type-2 fuzzy labels for data. However, the real labels for the data are generally binary. Hence, we should make a judgment on the differences between the predicted labels y and real labels y∗. An intuitive way is using the middle point of each interval [ym i ]. Then, the traditional loss functions can be applied. The problem is that two different intervals may have the same middle point. For example, [0.3, 0.6] and [0.4, 0.5] have the same middle point 0.45. This way cannot sufficiently utilize the fuzziness information. i , ym We design our loss function based on the continuous exten- sion of F1 measure [20]: E (y, y∗, m, m) = − 2ym(cid:62)y∗ 1(cid:62) (ym + y∗) − 2ym(cid:62)y∗ 1(cid:62) (ym + y∗) (4) arg min Θe,Θd (cid:107)x − h (h (x; Θe) ; Θd)(cid:107)2 F +ηCE (S (h (x; Θe) , l)) , (3) D. Defuzzification where h(x, Θe) is the function of encoder, h(x, Θd) is the function of decoder, CE is cross entropy function, S is the Softmax layer and η is a tuned parameter. l is an one-hot vector which indicates the number of categories an instance belongs To compute the metrics for comparing different methods. We eventually have to generate binary prediction of labels. That is, we have to determine an instance belongs to which categories based on their fuzzy memberships. Suppose we use the middle point of an interval for defuzzification. Then, we 5 just need to sort the middle points, and set top [ ˆm] yi's as 1 and the remaining yi's as 0, where [*] rounds * to the closest integer. The problem is, as we discussed above, the middle point cannot fully utilize the information of interval type-2 fuzzy logic. Here, we use a linear combination between middle point and interval size for defuzzification, i.e. ym + ym 2 (cid:0)ym − ym(cid:1) , ̄y = λ 2 (5) − where λ is positive constant which is set as 0.1 in our experiments. Finally, we sort the elements in ̄y, and set the top [ ˆm] elements as 1 and the remaining elements as 0 to generate final prediction ˆy. E. Implementation Details Fuzziness initializers can be any classification neural net- works as long as their output layers can be written as an activation imposing on a linear combination of weights and inputs. We use B = {bi}, i = 1, . . . to represent the set that contains all such neural networks. bi is a single candidate neural network that can be used as our fuzziness initializer. We can directly substitute the activation function of the output layer of bi with Eq. (1). Otherwise, if we want to directly use the pre-trained weights, we can add an additional layer with activation function Eq. (1) on the top of the output layer of bi. For computational efficiency, we do not have to train the layers of the autoencoder separately. We can use several fuzziness initializer bi as the encoder, build a symmetric neural network as decoder and freeze all other parameters. Let us take VGG16 [32] as an example. VGG16 is a convolutional neural network for image classification. We can freeze all the param- eters of convolutional layers. Then we use the full-connected layers as encoder and build a symmetric full-connected layers as decoder. Thus, the input data x of autoencoder in Eq. (3) is actually the outputs of convolutional part or the inputs of full- connected part of VGG16. The rationale of this is illustrated in Fig. 4. Note that in the view of signal processing, convolution in time domain is multiplication in frequency domain. One can use Fourier Transform to compute the spectrum of a time- domain signal. In Fig 4, both of the fuzziness intializer and the fuzzifier estimator can use the same vector for their own predictions. For convolutional neural networks, such as VGG16, we treat the convolutional part as feature extraction. Fuzziness intializer and fuzzifier estimator share the features. Thus, after we trained the fuzziness intializer, we can freeze the feature ex- traction part. On the other hand, we can directly use pretrained deep neural networks to extract feature vectors from raw data. In this way, deep full-connected neural networks of several layers can be used both for the fuzziness initializer and the fuzzifier estimator. V. EXPERIMENTAL RESULTS A. Benchmarks We evaluate our method on three widely-used multi-label datasets, scene [8], mirflickr [22] and nus-wide [13]. These Fig. 4. Illustration of training fuzzifier estimator. When Chord C is played, the three pressed keys have a spectrum like the second row. If 7 band-pass filters are used to detect which of the 7 white keys in an octave are pressed, the filters' spectrum will look like the third row. Finally, we examine the output of these 7 filters. The filters that have significant outputs are denoted as 1 and others are denoted as 0. We will get the a binary vector at the fourth row. The fuzziness intializer identifies which chord is played, while the fuzzifier estimator only counts how many keys are pressed, which is equivalent to compute the l0-norm of filters' outputs. datasets are publicly available1. The statistics of these three datasets are given in Table II. We randomly separate nus- wide dataset into training (80%), validation (10%) and tesing (10%) splits and use the original splits of scene and mirflickr datasets. To eliminate the effects of feature extraction neural networks, we directly use extracted features rather than raw images. For scene and mirflickr datasets, there is only one option on features in the download links. For nus-wide dataset, we select the 128D-cVALD features. B. Baselines We compare our methods to ASL [31], RBCC [18], MP- VAE [2], LaMP [24], C2AE [46], SLEEC [6], HARAM [5], MLKNN [49] and BR [47]. ASL uses an asymmetric loss for positive and negative samples so that easy negative samples can be dynamically down-weighted. RBCC learns a Bayesian network to condition the prediction of child nodes only on their parents in order to circumvent the unprincipled ordering in classical recurrent classifier chains [28]. MPVAE learns and aligns probabilistic embedding for labels and features. LaMP uses attention-based neural message passing to compute the hidden representation of label nodes of a label-interaction graph to learn the interac- tions among labels. C2AE adopts autoencoders to embedding data and labels in a latent space. SLEEC assumes the label 1scene and nus-wide datasets with 128D-cVALD features are available at http://mulan.sourceforge.net/datasets-mlc.html. mirflickr dataset is available at https://github.com/JunwenBai/c-gmvae. TABLE II DATASETS STATISTICS Dataset scene mirflickr nus-vec No. Samples 2407 25000 269648 No. Labels 6 1000 128 Feature Dimension Mean Labels Per Sample Mean Samples Per Label 294 38 85 1.07 4.8 1.86 170.83 1247.34 3721.7 6 TABLE III EXAMPLE-F1 AND MICRO-F1 SCORES OF DIFFERENT METHODS ON ALL DATASETS TABLE IV MACRO-F1 AND HA SCORES OF DIFFERENT METHODS ON ALL DATASETS Metric Dataset BR example-F1 scene mirflickr nus-wide 0.606 MLKNN 0.691 HARAM 0.717 SLEEC 0.718 0.698 C2AE LaMP 0.728 MPVAE 0.751 ASL 0.770 RBCC 0.758 0.782 Ours 0.325 0.383 0.432 0.416 0.501 0.492 0.514 0.477 0.468 0.536 0.343 0.342 0.396 0.431 0.435 0.376 0.468 0.468 0.466 0.483 micro-F1 scene mirflickr nus-wide 0.706 0.667 0.693 0.699 0.713 0.716 0.742 0.753 0.749 0.771 0.371 0.415 0.447 0.413 0.545 0.535 0.552 0.525 0.513 0.582 0.371 0.368 0.415 0.428 0.472 0.472 0.492 0.495 0.490 0.521 matrix is low-rank so embedding the label in low-dimensional space can improve the prediction accuracy. HARAM adds an extra ART layer to fuzzy adaptive resonance associative map neural network to increase the classification speed. MLKNN first finds the k-nearest neighbors of an instance and then uses maximum a posteriori principle to determine the label set. BR decomposes the multi-label classification into independent binary classifications. C. Evaluation We evaluate our method using four metrics, i.e. Example F1, Micro-F1, Macro-F1 and Hamming Accuracy (HA). We denote true positives, false positives and false negatives by T Pj, F Pj and F Nj, respectively for the j-th of L label categories. HA is defined as Metric Dataset BR macro-F1 scene mirflickr nus-wide 0.704 MLKNN 0.693 HARAM 0.713 SLEEC 0.699 0.728 C2AE LaMP 0.745 MPVAE 0.750 ASL 0.765 RBCC 0.753 0.772 Ours 0.182 0.266 0.284 0.364 0.393 0.387 0.422 0.410 0.409 0.445 0.083 0.086 0.157 0.135 0.174 0.203 0.211 0.208 0.202 0.231 HA scene mirflickr nus-wide 0.901 0.863 0.902 0.894 0.893 0.903 0.909 0.912 0.904 0.917 0.886 0.877 0.634 0.870 0.897 0.897 0.898 0.893 0.888 0.908 0.971 0.971 0.971 0.971 0.973 0.980 0.980 0.975 0.975 0.986 D. Results and discussion The results are given in Table III and Table IV. Our method outperforms the existing state-of-the-art methods on all datasets. The best numbers are marked in bold. All the numbers of our method are averaged over 5 random seeds. For example-F1, the best results of compared methods are among MPVAE, ASL and RBCC. Our method improves over the best compared method by 1.6%, 4.3% and 3.2% on scene, mirflickr and nus-wide, respectively. For micro-F1 and macro- F1, the best results of compared methods are between MPVAE and ASL. For micro-F1, our method improves over the best compared one by 2.4%, 5.4% and 5.3% on scene, mirflickr and nus-wide, respectively. For macro-F1, our method improves over the best compared one by 0.9%, 5.5% and 9.5% on scene, mirflickr and nus-wide, respectively. For HA, the best results of compared methods are among LaMP, MPVAE and ASL, our method improves over the best one by 0.5%, 1.1% and 0.6% on scene, mirflickr and nus-wide, respectively. 1 L L (cid:88) j=1 1 (cid:2)ˆyj = y∗ j (cid:3) , (6) E. Ablation studies where 1[*] is an indicator function which equals to 1 if the condition is true otherwise equals to 0. Example-F1 is defined as 2 (cid:80)L j=1 ˆyjy∗ j (cid:80)L j=1 yj + y∗j . Micro-F1 is defined as (cid:80)L j=1 tpj j=1 2tpj + f pj + f nj (cid:80)L Macro-F1 is defined as (7) (8) . To demonstrate the effectiveness of interval type-2 fuzzy logic used in our method, we modify our method by type-1 fuzzy logic. Eq. (4) is modified as E(y, y∗) = − 2y(cid:62)y∗ 1(cid:62)(y + y∗) . (10) For defuzzification, we directly use 1[yj ≥ 1/ ˆL]. The results on three datasets are given in Table V. In Table V, example- F1, micro-F1 and macro-F1 are abbreviated as ex-F1, mi- F1 and ma-F1, respectively. The interval Type-2 fuzzy logic substantially improves the performance over type-1 fuzzy logic. 1 L L (cid:88) j=1 2tpj 2tpj + f pj + f nj . (9) η in Eq. (3) and λ in Eq. (5) are two important hyperpa- rameters in our model. η controls the weight of cross entropy. 7 Fig. 5. ∆M on different λ settings. TABLE V COMPARISON BETWEEN INTERVAL TYPE-2 FUZZY LOGIC AND TYPE-1 FUZZY LOGIC OF OUR METHOD scene mirflickr nus-wide method type-1 type-2 type-1 type-2 type-1 type-2 ex-F1 mi-F1 ma-F1 0.753 0.749 0.755 0.772 0.771 0.782 0.412 0.554 0.511 0.445 0.582 0.536 0.208 0.499 0.454 0.231 0.521 0.483 HA 0.901 0.917 0.874 0.908 0.973 0.986 In Eq. (3), both of mean squared error and cross entropy can be independently used as an objective function for training a neural network. We set η as 1 in all our experiments. Our model is robust to η. However, with large η, one should be careful with the choice of learning rate. Our model is relatively sensitive to λ. In Fig. 5, we show the performance of our model in different λ settings. In Fig. 5, ∆M = Mbest − Mcurrent. (11) M stands for a metric, i.e. exmaple-F1, micro-F1, macro-F1 or HA. Mbest stands for the best metric among all experiments of different λ settings. Mcurrent stands for metric corresponding to current λ setting. Hence, all the values of ∆M are no greater than 0. From Fig. 5, we found the best M 's are generally achieved at λ = 0.1 ∼ 0.2 and occasionally at λ = 0. When λ = 0, Eq. (5) degrades to classical defuzzification, i.e. the middle point of the interval. When λ gets larger, say exceeding 0.3, the performance drops dramatically. This phenomenon is reasonable. The size of the interval should not dominate the prediction. For example, given two intervals [0.4, 0.5] and [0.5, 0.9], although the latter interval has a larger size, it still implies the classifier is more confident on the prediction, because all the numbers in the latter interval is no less than those in the former one. VI. CONCLUSION In this paper, we proposed a multi-label classification method using interval type-2 fuzzy logic. Two neural net- works are used for fuzziness intializer and fuzzifier estimation. The fuzzifier estimation neural network is supervised by the number of categories an instance belongs to and its predic- tion is used to generate interval type-2 fuzzy labels. A loss function measuring the dissimilarities between interval type- 2 fuzzy labels and binary labels were proposed for training the fuzziness intializer. Finally, a defuzzification method is proposed to generate binary labels from interval type-2 fuzzy labels for metric computations. Experiments on widely-used datasets validate the better performance of our methods to the compared state-of-the-art methods. Future works include modeling hierarchical relations among labels using interval type-2 fuzzy logic and extending the pro- posed method to multi-modal multi-label classification task. REFERENCES [1] B. Amos, L. Xu, and J. Z. Kolter, "Input convex neural networks," in Proceedings of the 34th International Conference on Machine Learning, Sydney NSW Australia, 06–11 Aug 2017, pp. 146–155. [2] J. Bai, S. Kong, and C. Gomes, "Disentangled Variational Autoencoder based Multi-Label Classification with Covariance-Aware Multivariate Probit Model," in Proceedings of the Twenty-Ninth International Joint Conference on Artificial Intelligence, Yokohama, Japan, Jul. 2020, pp. 4313–4321. [3] D. Belanger and A. McCallum, "Structured prediction energy networks," Jun. 2016, arXiv:1511.06350. [4] D. Belanger, B. Yang, and A. McCallum, "End-to-end learning for structured prediction energy networks," in Proceedings of the 34th International Conference on Machine Learning - Volume 70, Sydney, NSW, Australia, 2017, p. 429–439. [5] F. Benites and E. Sapozhnikova, "HARAM: A Hierarchical ARAM Neural Network for Large-Scale Text Classification," in 2015 IEEE International Conference on Data Mining Workshop (ICDMW), Atlantic City, NJ, USA, Nov. 2015, pp. 847–854. [6] K. Bhatia, H. Jain, P. Kar, M. Varma, and P. Jain, "Sparse local embed- dings for extreme multi-label classification," in 29th Annual Conference on Neural Information Processing Systems, NIPS 2015, December 7, 2015 - December 12, 2015, Montreal, QC, Canada, December 2015, pp. 730–738. [7] W. Bi and J. T. Kwok, "Multilabel classification with label correlations and missing labels," in 28th AAAI Conference on Artificial Intelligence, AAAI 2014, 26th Innovative Applications of Artificial Intelligence Con- ference, IAAI 2014 and the 5th Symposium on Educational Advances in Artificial Intelligence, EAAI 2014, July 27, 2014 - July 31, 2014, Quebec City, QC, Canada, 2014, pp. 1680–1686. [8] M. R. Boutell, J. Luo, X. Shen, and C. M. Brown, "Learning multi-label scene classification," Pattern Recognition, vol. 37, no. 9, pp. 1757–1771, Sep. 2004. [9] N. Brukhim and A. Globerson, "Predict and constrain: Modeling car- dinality in deep structured prediction," in Proceedings of the 35th International Conference on Machine Learning, Stockholm Sweden, 10– 15 Jul 2018, pp. 659–667. [10] W.-C. Chang, H.-F. Yu, K. Zhong, Y. Yang, and I. Dhillon, "X-BERT: eXtreme multi-label text classification with using bidirectional encoder representations from transformers," 2020, arXiv:1905.02331. [11] Y.-n. Chen and H.-t. Lin, "Feature-aware Label Space Dimension Reduc- tion for Multi-label Classification," in Advances in Neural Information Processing Systems, Lake Tahoe Nevada, December 2012, p. 1529–1537. [12] Z.-M. Chen, X.-S. Wei, P. Wang, and Y. Guo, "Multi-Label Im- age Recognition with Graph Convolutional Networks," Apr. 2019, arXiv:1904.03582. 00.10.20.30.4-0.12-0.1-0.08-0.06-0.04-0.02 Example-F1Example-F1scenemirflickrnus-wide00.10.20.30.4-0.08-0.06-0.04-0.020 Micro-F1Micro-F1scenemirflickrnus-wide00.10.20.30.4-0.04-0.03-0.02-0.010 Macro-F1Macro-F1scenemirflickrnus-wide00.10.20.30.4-0.1-0.08-0.06-0.04-0.020 HAHAscenemirflickrnus-wide 8 [35] D. Tian, C. Gong, M. Gong, Y. Wei, and X. Feng, "Modeling cardinality in image hashing," IEEE Transactions on Cybernetics, pp. 1–10, Early Access. [36] D. Tian, D. Zhou, M. Gong, and Y. Wei, "Interval type-2 fuzzy logic for semisupervised multimodal hashing," IEEE Transactions on Cybernetics, vol. 51, no. 7, pp. 3802–3812, 2021. [37] G. Tsoumakas and I. Vlahavas, "Random k-Labelsets: An Ensemble Method for Multilabel Classification," in Machine Learning: ECML 2007, Berlin, Heidelberg, 2007, pp. 406–417. [38] L. Tu, R. Y. Pang, and K. Gimpel, "Improving joint training of inference networks and structured prediction energy networks," in Proceedings of the Fourth Workshop on Structured Prediction for NLP, Online, Nov. 2020, pp. 62–73. [39] L. Vilnis, X. Li, S. Murty, and A. McCallum, "Probabilistic embedding of knowledge graphs with box lattice measures," in Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), Melbourne, Australia, Jul. 2018, pp. 263–272. [40] J. Wang, Y. Yang, J. Mao, Z. Huang, C. Huang, and W. Xu, "CNN- RNN: A Unified Framework for Multi-label Image Classification," Apr. 2016, arXiv:1604.04573. [41] R. Wang, S. Kwong, Y. Jia, Z. Huang, and L. Wu, "Mutual informa- tion based k-labelsets ensemble for multi-label classification," in 2018 IEEE International Conference on Fuzzy Systems (FUZZ-IEEE), Rio de Janeiro, Brazil, 2018, pp. 1–7. [42] R. Wang, S. Kwong, X. Wang, and Y. Jia, "Active k-labelsets ensemble for multi-label classification," Pattern Recognition, vol. 109, no. C, p. 107583, Jan 2021. [43] S. Wang, G. Peng, S. Chen, and Q. Ji, "Weakly supervised facial action unit recognition with domain knowledge," IEEE Transactions on Cybernetics, vol. 48, no. 11, pp. 3265–3276, 2018. [44] M. Wu and N. Goodman, "Multimodal Generative Models for Scalable Weakly-Supervised Learning," Nov. 2018, arXiv:1802.05335. [45] L. Xu, J. Raitoharju, A. Iosifidis, and M. Gabbouj, "Saliency-based mul- tilabel linear discriminant analysis," IEEE Transactions on Cybernetics, vol. 52, no. 10, pp. 10 200–10 213, 2022. [46] C.-K. Yeh, W.-C. Wu, W.-J. Ko, and Y.-C. F. Wang, "Learning deep latent spaces for multi-label classification," Jul. 2017, arXiv:1707.00418. [47] M.-L. Zhang, Y.-K. Li, X.-Y. Liu, and X. Geng, "Binary relevance for multi-label learning: an overview," Front. Comput. Sci., vol. 12, no. 2, pp. 191–202, Apr. 2018. [48] M.-L. Zhang, Y.-K. Li, H. Yang, and X.-Y. Liu, "Towards class- imbalance aware multi-label learning," IEEE Transactions on Cyber- netics, vol. 52, no. 6, pp. 4459–4471, 2022. [49] M.-L. Zhang and Z.-H. Zhou, "ML-KNN: A lazy learning approach to multi-label learning," Pattern Recognition, vol. 40, no. 7, pp. 2038–2048, 2007. [50] Y. Zhang, J. Hare, and A. Pr ̈ugel-Bennett, "Deep set prediction net- works," 2019, arXiv:1906.06565. [13] T.-S. Chua, J. Tang, R. Hong, H. Li, Z. Luo, and Y. Zheng, "NUS- WIDE: a real-world web image database from National University of Singapore," in Proceedings of the ACM International Conference on Image and Video Retrieval, New York, NY, USA, Jul. 2009, pp. 1–9. [14] A. Clare and R. D. King, "Knowledge Discovery in Multi-label Phe- notype Data," in Principles of Data Mining and Knowledge Discovery, Berlin, Heidelberg, 2001, pp. 42–53. [15] N. Dilokthanakul, P. A. M. Mediano, M. Garnelo, M. C. H. Lee, H. Salimbeni, K. Arulkumaran, and M. Shanahan, "Deep Unsupervised Clustering with Gaussian Mixture Variational Autoencoders," Jan. 2017, arXiv:1611.02648. [16] A. Elisseeff and J. Weston, "A kernel method for multi-labelled classifi- cation," in Proceedings of the 14th International Conference on Neural Information Processing Systems: Natural and Synthetic, Cambridge, MA, USA, 2001, p. 681–687. [17] J. F ̈urnkranz, E. H ̈ullermeier, E. Loza Menc ́ıa, and K. Brinker, "Multi- label classification via calibrated label ranking," Mach. Learn., vol. 73, no. 2, p. 133–153, nov 2008. [18] W. Gerych, T. Hartvigsen, L. Buquicchio, E. Agu, and E. A. Runden- steiner, "Recurrent Bayesian Classifier Chains for Exact Multi-Label Classification," in Advances in Neural Information Processing Systems, 2021, pp. 15 981–15 992. [19] N. Ghamrawi and A. McCallum, "Collective multi-label classification," in Proceedings of the 14th ACM International Conference on Infor- mation and Knowledge Management, New York, NY, USA, 2005, p. 195–200. [20] M. Gygli, M. Norouzi, and A. Angelova, "Deep value networks learn to evaluate and iteratively refine structured outputs," in Proceedings of the 34th International Conference on Machine Learning - Volume 70, Sydney, NSW, Australia, 2017, p. 1341–1351. [21] D. Hsu, S. M. Kakade, J. Langford, and T. Zhang, "Multi-Label Prediction via Compressed Sensing," Jun. 2009, arXiv:0902.1284. [22] M. J. Huiskes and M. S. Lew, "The MIR Flickr retrieval evaluation," in 1st International ACM Conference on Multimedia Information Retrieval, MIR2008, Co-located with the 2008 ACM International Conference on Multimedia, MM'08, August 30, 2008 - August 31, 2008, Vancouver, BC, Canada, 2008, pp. 39–43. [23] S. Ioffe and C. Szegedy, "Batch normalization: Accelerating deep network training by reducing internal covariate shift," in Proceedings of the 32nd International Conference on International Conference on Machine Learning - Volume 37, Lille, France, 2015, p. 448–456. [24] J. Lanchantin, A. Sekhon, and Y. Qi, "Neural Message Passing for Multi- Label Classification," Apr. 2019, arXiv:1904.08049. [25] J. Li, C. Zhang, J. T. Zhou, H. Fu, S. Xia, and Q. Hu, "Deep-lift: Deep label-specific feature learning for image annotation," IEEE Transactions on Cybernetics, vol. 52, no. 8, pp. 7732–7741, 2022. [26] H.-Y. Lo, S.-D. Lin, and H.-M. Wang, "Generalized k-labelsets ensemble for multi-label and cost-sensitive classification," IEEE Transactions on Knowledge and Data Engineering, vol. 26, no. 7, pp. 1679–1691, 2014. [27] J. Ma, B. C. Y. Chiu, and T. W. S. Chow, "Multilabel classification with group-based mapping: A framework with local feature selection and local label correlation," IEEE Transactions on Cybernetics, vol. 52, no. 6, pp. 4596–4610, 2022. [28] J. Nam, E. L. Menc ́ıa, H. J. Kim, and J. F ̈urnkranz, "Maximizing subset accuracy with recurrent neural networks in multi-label classification," in Proceedings of the 31st International Conference on Neural Information Processing Systems, Long Beach, California, USA, 2017, p. 5419–5429. [29] D. Patel, P. Dangati, J. Y. Lee, M. Boratko, and A. McCallum, "Modeling label space interactions in multi-label classification using box embed- dings," in ICLR, Mar 2022. [30] J. Read, B. Pfahringer, G. Holmes, and E. Frank, "Classifier Chains for Multi-label Classification," in Machine Learning and Knowledge Discovery in Databases, Berlin, Heidelberg, 2009, pp. 254–269. [31] T. Ridnik, E. Ben-Baruch, N. Zamir, A. Noy, I. Friedman, M. Protter, and L. Zelnik-Manor, "Asymmetric Loss For Multi-Label Classification," in 2021 IEEE/CVF International Conference on Computer Vision (ICCV), Montreal, QC, Canada, Oct. 2021, pp. 82–91. [32] K. Simonyan and A. Zisserman, "Very deep convolutional networks for large-scale image recognition," 2014, arXiv:1409.1556. [33] V. K. Sundar, S. Ramakrishna, Z. Rahiminasab, A. Easwaran, and A. Dubey, "Out-of-distribution detection in multi-label datasets using latent space of β-VAE," Mar. 2020, arXiv:2003.08740. [34] C. Tan, S. Chen, G. Ji, and X. Geng, "Multilabel distribution learning based on multioutput regression and manifold learning," IEEE Transac- tions on Cybernetics, vol. 52, no. 6, pp. 5064–5078, 2022.
http://arxiv.org/abs/2302.10429v2
2023-07-05T09:45:47
2023-02-21T03:55:29
FedSpeed: Larger Local Interval, Less Communication Round, and Higher Generalization Accuracy
Federated learning is an emerging distributed machine learning framework which jointly trains a global model via a large number of local devices with data privacy protections. Its performance suffers from the non-vanishing biases introduced by the local inconsistent optimal and the rugged client-drifts by the local over-fitting. In this paper, we propose a novel and practical method, FedSpeed, to alleviate the negative impacts posed by these problems. Concretely, FedSpeed applies the prox-correction term on the current local updates to efficiently reduce the biases introduced by the prox-term, a necessary regularizer to maintain the strong local consistency. Furthermore, FedSpeed merges the vanilla stochastic gradient with a perturbation computed from an extra gradient ascent step in the neighborhood, thereby alleviating the issue of local over-fitting. Our theoretical analysis indicates that the convergence rate is related to both the communication rounds $T$ and local intervals $K$ with a upper bound $\small \mathcal{O}(1/T)$ if setting a proper local interval. Moreover, we conduct extensive experiments on the real-world dataset to demonstrate the efficiency of our proposed FedSpeed, which performs significantly faster and achieves the state-of-the-art (SOTA) performance on the general FL experimental settings than several baselines. Our code is available at \url{https://github.com/woodenchild95/FL-Simulator.git}.
[ "Yan Sun", "Li Shen", "Tiansheng Huang", "Liang Ding", "Dacheng Tao" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10429v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10429v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.DC", "math.OC" ]
3 2 0 2 l u J 5 ] G L . s c [ 2 v 9 2 4 0 1 . 2 0 3 2 : v i X r a Published as a conference paper at ICLR 2023 FEDSPEED: LARGER LOCAL INTERVAL, LESS COM- MUNICATION ROUND, AND HIGHER GENERALIZATION ACCURACY Yan Sun The University of Sydney [email protected] Li Shen∗ JD Explore Academy [email protected] Tiansheng Huang Georgia Institute of Technology [email protected] Liang Ding JD Explore Academy [email protected] Dacheng Tao JD Explore Academy & The University of Sydney [email protected] ABSTRACT Federated learning is an emerging distributed machine learning framework which jointly trains a global model via a large number of local devices with data privacy protections. Its performance suffers from the non-vanishing biases introduced by the local inconsistent optimal and the rugged client-drifts by the local over- fitting. In this paper, we propose a novel and practical method, FedSpeed, to alleviate the negative impacts posed by these problems. Concretely, FedSpeed applies the prox-correction term on the current local updates to efficiently reduce the biases introduced by the prox-term, a necessary regularizer to maintain the strong local consistency. Furthermore, FedSpeed merges the vanilla stochastic gradient with a perturbation computed from an extra gradient ascent step in the neighborhood, thereby alleviating the issue of local over-fitting. Our theoretical analysis indicates that the convergence rate is related to both the communication rounds T and local intervals K with a upper bound O(1/T ) if setting a proper local interval. Moreover, we conduct extensive experiments on the real-world dataset to demonstrate the efficiency of our proposed FedSpeed, which performs significantly faster and achieves the state-of-the-art (SOTA) performance on the general FL experimental settings than several baselines. Our code is available at https://github.com/woodenchild95/FL-Simulator.git. 1 INTRODUCTION Since McMahan et al. (2017) proposed federated learning (FL), it has gradually evolved into an efficient paradigm for large-scale distributed training. Different from the traditional deep learning methods, FL allows multi local clients to jointly train a single global model without data sharing. However, FL is far from its maturity, as it still suffers from the considerable performance degradation over the heterogeneously distributed data, a very common setting in the practical application of FL. We recognize the main culprit leading to the performance degradation of FL as local inconsistency and local heterogeneous over-fitting. Specifically, for canonical local-SGD-based FL method, e.g., FedAvg, the non-vanishing biases introduced by the local updates may eventually lead to inconsistent local solution. Then, the rugged client-drifts resulting from the local over-fitting into inconsistent local solutions may make the obtained global model degrading into the average of client's local parameters. The non-vanishing biases have been studied by several previous works Charles & Koneˇcn`y (2021); ∗Li Shen is the corresponding author. 1 Published as a conference paper at ICLR 2023 Malinovskiy et al. (2020) in different forms. The inconsistency due to the local heterogeneous data will compromise the global convergence during the training process. Eventually it leads to serious client-drifts which can be formulated as x∗ ̸= (cid:80) i /m. Larger data heterogeneity may enlarge the drifts, thereby degrading the practical training convergence rate and generalization performance. i∈[m] x∗ In order to strengthen the local consistency during the local training process, and avoid the client-drifts resulting from the local over-fitting, we propose a novel and practical algorithm, dubbed as FedSpeed. Notably, FedSpeed incorporates two novel components to achieve SOTA performance. i) Firstly, FedSpeed inherits a penalized prox-term to force the local offset to be closer to the initial point at each communication round. However, recognized from Hanzely & Richt ́arik (2020); Khaled et al. (2019) that the prox-term between global and local solutions may introduce undesirable local training bias, we propose and utilize a prox-correction term to counteract the adverse impact. Indeed, in our theoretical analysis, the implication of the prox-correction term could be considered as a momentum- based term of the weighted local gradients. Via utilizing the historical gradient information, the bias brought by the prox-term can be effectively corrected. ii) Secondly, to avoid the rugged local over-fitting, FedSpeed incorporates a local gradient perturbation via merging the vanilla stochastic gradient with an extra gradient, which can be viewed as taking an extra gradient ascent step for each local update. Based on the analysis in Zhao et al. (2022); van der Hoeven (2020), we demonstrate that the gradient perturbation term could be approximated as adding a penalized squared L2-norm of the stochastic gradients to the original objective function, which can efficiently search for the flatten local minima Andriushchenko & Flammarion (2022) to prevent the local over-fitting problems. We also provide the theoretical analysis of our proposed FedSpeed and further demonstrate that its convergence rate could be accelerated by setting an appropriate large local interval K. Explicitly, under the non-convex and smooth cases, FedSpeed with an extra gradient perturbation could achieve the fast convergence rate of O(1/T ), which indicates that FedSpeed achieves a tighter upper bound with a proper local interval K to converge, without applying a specific global learning rate or assuming the precision for the local solutions (Durmus et al., 2021; Wang et al., 2022). Extensive experiments are tested on CIFAR-10/100 and TinyImagenet dataset with a standard ResNet-18-GN network under the different heterogeneous settings, which shows that our proposed FedSpeed is significantly better than several baselines, e.g. for FedAvg, FedProx, FedCM, FedPD, SCAFFOLD, FedDyn, on both the stability to enlarge the local interval K and the test generalization performance in the actual training. To the end, we summarize the main contributions of this paper as follows: • We propose a novel and practical federated optimization algorithm, FedSpeed, which applies a prox-correction term to significantly reduce the bias due to the local updates of the prox-term, and an extra gradient perturbation to efficiently avoid the local over-fitting, which achieves a fast convergence speed with large local steps and simultaneously maintains the high generalization. • We provide the convergence rate upper bound under the non-convex and smooth cases and prove that FedSpeed could achieve a fast convergence rate of O(1/T ) via enlarging the local training interval K = O(T ) without any other harsh assumptions or the specific conditions required. • Extensive experiments are conducted on the CIFAR-10/100 and TinyImagenet dataset to verify the performance of our proposed FedSpeed. To the best of our interests, both convergence speed and generalization performance could achieve the SOTA results under the general federated settings. FedSpeed could outperform other baselines and be more robust to enlarging the local interval. 2 RELATED WORK McMahan et al. (2017) propose the federated framework with the properties of jointly training with several unbalance and non-iid local dataset via communicating with lower costs during the total training stage. The general FL optimization involves a local client training stage and a global server update operation Asad et al. (2020) and it has been proved to achieve a linear speedup property in Yang et al. (2021). With the fast development of the FL, a series of efficient optimization method are applied in the federated framework. Li et al. (2020b) and Kairouz et al. (2021) introduce a detailed overview in this field. There are still many difficulties to be solved in the practical scenarios, while in this paper we focus to highlight the two main challenges of the local inconsistent solution and client-drifts due to heterogeneous over-fitting, which are two acute limitations in the federated 2 Published as a conference paper at ICLR 2023 optimization Li et al. (2020a); Yang et al. (2019); Koneˇcn`y et al. (2016); Liu et al. (2022); Shi et al. (2023); Liu et al. (2023). Local consistency. Sahu et al. (2018) study the non-vanishing biases of the inconsistent solution in the experiments and apply a prox-term regularization. FedProx utilizes the bounded local updates by penalizing parameters to provide a good guarantee of consistency. In Liang et al. (2019) they introduce the local gradient tracking to reduce the local inconsistency in the local SGD method. Charles & Koneˇcn`y (2021); Malinovskiy et al. (2020) show that the local learning rate decay can balance the trade-off between the convergence rate and the local inconsistency with the rate of O(ηl(K − 1)). Furthermore, Wang et al. (2021; 2020b) through a simple counterexample to show that using adaptive optimizer or different hyper-parameters on local clients leads to an additional gaps. They propose a local correction technique to alleviate the biases. Wang et al. (2020a); Tan et al. (2022) consider the different local settings and prove that in the case of asynchronous aggregation, the inconsistency bias will no longer be eliminated by local learning rate decay. Haddadpour et al. (2021) compress the local offset and adopt a global correction to reduce the biases. Zhang et al. (2021) apply the primal dual method instead of the primal method to solve a series of sub-problems on the local clients and alternately updates the primal and dual variables which can achieve the fast convergence rate of O( 1 T ) with the local solution precision assumption. Based on FedPD, Durmus et al. (2021) propose FedDyn as a variants via averaging all the dual variables (the average quantity can then be viewed as the global gradient) under the partial participation settings, which can also achieve the same O( 1 T ) under the assumption that exact local solution can be found by the local optimizer. Wang et al. (2022); Gong et al. (2022) propose two other variants to apply different dual variable aggregation strategies under partial participation settings. These methods benefit from applying the prox-term Li et al. (2019); Chen & Chao (2020) or higher efficient optimization methods Bischoff et al. (2021); Yang et al. (2022) to control the local consistency. Client-drifts. Karimireddy et al. (2020) firstly demonstrate the client-drifts for federated learning framework to indicate the negative impact on the global model when each local client over-fits to the local heterogeneous dataset. They propose SCAFFOLD via a variance reduction technique to mitigate this drifts. Yu et al. (2019) and Wang et al. (2019) introduce the momentum instead of the gradient to the local and global update respectively to improve the generalization performance. To maintain the property of consistency, Xu et al. (2021) propose a novel client-level momentum term to improve the local training process. Ozfatura et al. (2021) incorporate the client-level momentum with local momentum to further control the biases. In recent Gao et al. (2022); Kim et al. (2022), they propose a drift correction term as a penalized loss on the original local objective functions with a global gradient estimation. Chen et al. (2020) and Chen et al. (2021; 2022) focus on the adaptive method to alleviate the biases and improve the efficiency. Our proposed FedSpeed inherits the prox-term at local update to guarantee the local consistency during local training. Different from the previous works, we adopt an extra prox-correction term to reduce the bias during the local training introduced by the update direction towards the last global model parameters. This ensures that the local update could be corrected towards the global minima. Furthermore, we incorporate a gradient perturbation update to enhance the generalization performance of the local model, which merges a gradient ascent step. 3 METHODOLOGY In this part, we will introduce the preliminaries and our proposed method. We will explain the implicit meaning for each variables and demonstrate the FedSpeed algorithm inference in details. Notations and preliminary. Let m be the number of total clients. We denote S t as the set of active clients at round t. K is the number of local updates and T is the communication rounds. (*)t i,k denotes variable (*) at k-th iteration of t-th round in the i-th client. x is the model parameters. g is the stochastic gradient computed by the sampled data. ̃g is the weighted quasi-gradient computed as defined in Algorithm 1. ˆg is the prox-correction term. We denote ⟨*, *⟩ as the inner product for two vectors and ∥ * ∥ is the Euclidean norm of a vector. Other symbols are detailed at their references. As the most FL frameworks, we consider to minimize the following finite-sum non-convex problem: F (x) = Fi (x) , 1 m m (cid:88) i=1 3 (1) Published as a conference paper at ICLR 2023 Algorithm 1 FedSpeed Algorithm Framework Input: model parameters x0, total communication rounds T , local gradient controller ˆg−1 i = 0, penalized select active clients-set S t at round t for client i ∈ S t parallel do communicate xt to local client i and set xt for k = 0, 1, 2, * * * , K − 1 do i,0 = xt i,k and do sample a minibatch εt compute unbiased stochastic gradient: gt update the extra step: ̆xt i,k + ρgt compute unbiased stochastic gradient: gt compute quasi-gradient: ̃gt update the gradient descent step: xt i,k = xt i,k = (1 − α)gt i,k,1 = ∇Fi(xt i,k,1 i,k,2 = ∇Fi( ̆xt i,k,1 + αgt i,k,2 i,k − ηl (cid:0) ̃gt i,k+1 = xt i,k; εt i,k) i,k; εt i,k) weight λ. Output: model parameters xT . 1: for t = 0, 1, 2, * * * , T − 1 do 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: end for end for i = ˆgt−1 ˆgt i − 1 communicate ˆxt end for xt+1 = 1 S λ (xt i = xt i∈St ˆxt (cid:80) i i,K − xt) i,K − λˆgt i to the global server i,k − ˆgt−1 i + 1 λ (xt i,k − xt)(cid:1) where F : Rd → R, Fi(x) := Eεi∼DiFi(x, εi) is objective function in the client i, and εi represents for the random data samples obeying the distribution Di. m is the total number of clients. In FL, Di may differ across the local clients, which may introduce the client drifts by the heterogeneous data. 3.1 FEDSPEED ALGORITHM In this part, we will introduce our proposed method to alleviate the negative impact of the heteroge- neous data and reduces the communication rounds. We are inspired by the dynamic regularization Durmus et al. (2021) for the local updates to eliminate the client drifts when T approaches infinite. i,k; εt i,k,1 with gt i,k,1 = ∇Fi(xt i,k and merging the gt i,k; (2) computing the unbiased stochastic gradient gt Our proposed FeedSpeed is shown in Algorithm 1. At the beginning of each round t, a subset of clients S t are required to participate in the current training process. The global server will communicate the parameters xt to the active clients for local training. Each active local client performs three stages: (1) computing the unbiased stochastic gradient gt i,k) with a randomly sampled mini-batch data εt i,k and executing a gradient ascent step in the neighbourhood to approach ̆xt i,k,2 with the same sampled mini- batch data in (1) at the ̆xt i,k,2 to introduce a basic perturbation to the vanilla descent direction; (3) executing the gradient descent step with the merged quasi-gradient i,k − xt∥2 and the local prox-correction term ˆgt−1 i,k, the prox-term ∥xt ̃gt . After K iterations local training, prox-correction term ˆgt−1 i will be updated as the weighted sum of the current local offset i,K − xt (xt i,0) and the historical offsets momentum. Then we communicate the amended model parameters ˆxt i to the global server for aggregation. On the global server, a simple average aggregation is applied to generate the current global model parameters xt+1 at round t. Prox-correction term. In the general optimization, the prox-term ∥xt i,k − xt∥2 is a penalized term for solving the non-smooth problems and it contributes to strengthen the local consistency in the FL framework by introducing a penalized direction in the local updates as proposed in Sahu et al. (2018). However, as discussed in Hanzely & Richt ́arik (2020), it simply performs as a balance between the local and global solutions, and there still exists the non-vanishing inconsistent biases among the local solutions, i.e., the local solutions are still largely deviated from each other, implying that local inconsistency is still not eliminated, which limits the efficiency of the federated learning framework. To further strengthen the local consistency, we utilize a prox-correction term ˆgt i which could be considered as a previous local offset momentum. According to the local update, we combine the i,k−1 term in the prox term and the local state, setting the weight as (1 − ηl xt λ ) multiplied to the basic i,K − λˆgt i = xt i 4 Published as a conference paper at ICLR 2023 local state. As shown in the local update in Algorithm 1 (Line.11), for ∀ x ∈ Rd we have: i,K − xt = −γλ xt K−1 (cid:88) k=0 γk γ i,k + γλˆgt−1 ̃gt i , (2) ηl λ (cid:0)1 − ηl λ (cid:1)K−1−k = γ. Proof details can be referred to the Appendix. where (cid:80)K−1 k=0 γk = (cid:80)K−1 k=0 Firstly let ˆg−1 i = 0, Equation (2) indicates that the local offset will be transferred to a exponential average of previous local gradients when applying the prox-term, and the updated formation of the local offset is independent of the local learning rate ηl. This is different from the vanilla SGD-based methods, e.g. FedAvg, which treats all local updates fairly. γk changes the importance of the historical gradients. As K increases, previous updates will be weakened by exponential decay significantly for ηl < λ. Thus, we apply the prox-correction term to balance the local offset. According to the iterative formula for ˆgt i (Line.13 in Algorithm 1) and the equation (2), we can rewrite this update as: i = (1 − γ)ˆgt−1 ˆgt i + γ (cid:16)K−1 (cid:88) k=0 (cid:17) , ̃gt i,k γk γ (3) where γ and γk is defined the same as in Equation (2). Proof details can be referred to the Appendix. Note that ˆgt i performs as a momentum term of the historical local updates before round t, which can be considered as a estimation of the local offset at round t. At each local iteration k of round t, ˆgt−1 provides a correction for the local update to balance the impact of the prox-term to enhance the i contribution of those descent steps executed firstly at each local stages. It should be noted that ˆgt−1 is different from the global momentum term mentioned in Wang et al. (2019) which aggregates the average local updates to improve the generalization performance. After the local training, it updates the current information. Then we subtract the current ˆgt i,K to counteract the influence in the local stages. Finally it sends the post-processed parameters ˆxt i,K to the global server. i from the local models xt i Gradient perturbation. Gradient perturbations (Foret et al., 2020a; Mi et al.; Zhao et al., 2022; Zhong et al., 2022) significantly improves generalization for deep models. An extra gradient ascent in the neighbourhood can effectively express the curvature near the current parameters. Referring to the analysis in Zhao et al. (2022), we show that the quasi-gradient ̃g, which merges the extra ascent step gradient and the vanilla gradient, could be approximated as penalizing a square term of the L2-norm of the gradient on the original function. On each local client to solve the stationary point of minx{Fi(x) + β∥∇Fi(x)∥2} can search for a flat minima. Flatten loss landscapes will further mitigate the local inconsistency due to the averaging aggregation on the global server on heterogeneous dataset. Detailed discussions can be referred to the Appendix. 4 CONVERGENCE ANALYSIS In this part we will demonstrate the theoretical analysis of our proposed FedSpeed and illustrate the convergence guarantees under the specific hyperparameters. Due to the space limitations, more details could be referred to the Appendix. Some standard assumptions are stated as follows. Assumption 4.1 (L-Smoothness) For the non-convex function Fi holds the property of smoothness for all i ∈ [m], i.e., ∥∇Fi(x) − ∇Fi(y)∥ ≤ L∥x − y∥, for all x, y ∈ Rd. Assumption 4.2 (Bounded Stochastic Gradient) The stochastic gradient gt with the randomly sampled data εt bounded variance, i.e., E[gt i,k) i,k on the local client i is an unbiased estimator of ∇Fi with i,k = ∇Fi(xt i,k, εt i,k)∥2 ≤ σ2 l , for all xt i,k) and E∥gt i,k] = ∇Fi(xt i,k − ∇Fi(xt i,k ∈ Rd. Assumption 4.3 (Bounded Heterogeneity) The dissimilarity of the dataset among the local clients is bounded by the local and global gradients, i.e., E∥∇Fi(x) − ∇F (x)∥2 ≤ σ2 g, for all x ∈ Rd. Assumption 4.1 guarantees a Lipschitz continuity and Assumption 4.2 guarantees the stochastic gradient is bounded by zero mean and constant variance. Assumption 4.3 is the heterogeneity bound for the non-iid dataset, which is widely used in many previous works (Reddi et al., 2020; Yang et al., 5 Published as a conference paper at ICLR 2023 2021; Xu et al., 2021; Wang et al., 2021; Karimi et al., 2021). Our theoretical analysis depends on the above assumptions to explore the comprehensive properties in the local training process. Proof sketch. To express the essential insights in the updates of the Algorithm 1, we introduce two auxiliary sequences. Considering the ut = 1 i,K as the mean averaged parameters of the m last iterations in the local training among the local clients. Based on {ut}, we introduce the auxiliary sequences {zt = ut + 1−γ γ (ut − ut−1)}t>0. Combining the local update and the Equation (3): i∈[m] xt (cid:80) ut+1 = ut − λ 1 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ (cid:0)γ ̃gt i,k + (1 − γ)ˆgt−1 i (cid:1) . (4) If we introduce K virtual states ut (cid:0)ut correction term ˆgt−1 which implies the global update direction in the local training process. And zt updates as: i,k, it could be considered as a momentum-based update of the prox- (cid:1), i with the coefficient γ. And the prox-correction term ˆgt i,K − ut i,0 i = − 1 λ zt+1 = zt − λ 1 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ ̃gt i,k, (5) Detailed proofs can be referred in the Appendix. After mapping xt to ut, the local update could be considered as a client momentum-like method with a normalized weight parameterized by γk. Further, after mapping ut to zt, the entire update process will be simplified to a SGD-type method with the quasi-gradients ̃g. zt contains the penalized prox-term in the total local training stage. Though a prox-correction term is applied to eliminate the local biases, xt maintains to be beneficial from the update of penalizing the prox-term. The prox-correction term plays the role as exponential average of the global offset. Then we introduce our proof of the convergence rate for the FedSpeed algorithm: 6αL , and the local learning rate satisfies ηl ≤ min{ 2 − 3α2L2ρ2 − 1536η2 Theorem 4.4 Under the Assumptions 4.1-4.3, when the perturbation learning rate satisfies ρ ≤ 1√ , 2λ}, and the local interval satisfies K ≥ λ/ηl, let κ = 1 l L2K is a positive constant with selecting the proper ηl and ρ, the auxiliary sequence zt in Equation (5) generated by executing the Algorithm 1 satisfies: 64ηlL2K κmT 2(F (z1) − F ∗) λκT 32λ2L2 κT E∥∇F (zt)∥2 ≤ ˆg0 i ∥2 +Φ, 1 √ 3KL i ∥2 + E∥ˆg0 T −1 (cid:88) 1 m Et∥ 1 T (cid:88) (cid:88) + 32 i∈[m] i∈[m] t=1 where F is a non-convex objective function F ∗ is the optimal of F . The term Φ is: Φ = 1 κ (cid:0)32λη2 l L2K(16σ2 g + σ2 l ) + λα2L2ρ2(3σ2 g + σ2 l )(cid:1) , where α is the perturbation weight. More proof details can be referred to the Appendix. (6) (7) Corollary 4.5 Let ρ = O(1/ 6αL, and let ηl = O(1/K) T ) with the upper bound of ρ ≤ 1/ with the lower bound of ηl ≥ λ/K, when the local interval K is long enough with K = O(T ), the proposed FedSpeed achieves a fast convergence rate of O(1/T ). √ √ Remark 4.6 Compared with the other prox-based works, e.g. for (Durmus et al., 2021; Wang et al., 2022; Gong et al., 2022), their proofs rely on the harsh assumption that local client must approach an exact stationary point or ε-inexact stationary point in the local training per round. It cannot be strictly satisfied in the practical federated learning framework with the current theoretical analysis of the last iteration point on the non-convex case. We relax this assumption through enlarging the local interval and prove that federated prox-based methods can also achieve the convergence of O(1/T ). √ Remark 4.7 Compared with the other current methods, FedSpeed can improve the convergence rate by increasing the local interval K, which is a good property for the practical federated learning framework. For the analysis of FedAvg (Yang et al., 2021), under the same assumptions, it achieves SKT + K/T ) which restricts the value of K to not exceed the order of T . Karimireddy et al. O(1/ SKT ) under the constant local interval, and (Reddi (2020) contribute the convergence as O(1/ et al., 2020) proves the same convergence under the strict coordinated bounded variance assumption for the global full gradient in the FedAdam. Our experiments also verify this characteristic in Section 5.3. Most current algorithms are affected by increasing K in the training while FedSpeed shows the good stability under the enlarged local intervals and shrunk communication rounds. √ 6 Published as a conference paper at ICLR 2023 (a) 10% participation of 100 clients on CIFAR-10. (b) 2% participation of 500 clients on CIFAR-10. (c) 2% participation of 500 clients on CIFAR-100. (d) 2% participation of 500 clients on TinyImagenet. Figure 1: The top-1 accuracy in communication rounds of all compared methods on CIFAR-10/100 and TinyImagenet. Communication rounds are set as 1500 for CIFAR-10/100, 3000 for TinyImagenet. In each group, the left shows the performance on IID dataset while the right shows the performance on the non-IID dataset, which are split by setting heterogeneity weight of the Dirichlet as 0.6. 5 EXPERIMENTS In this part, we firstly introduce our experimental setups. We present the convergence and generaliza- tion performance in Section 5.2, and study ablation experiments in Section 5.3. 5.1 SETUP Dataset and backbones. We test the experiments on CIFAR-10, CIFAR-100 Krizhevsky et al. (2009) and TinyImagenet. Due to the space limitations we introduce these datasets in the Appendix. We follow the Hsu et al. (2019) to introduce the heterogeneity via splitting the total dataset by sampling the label ratios from the Dirichlet distribution. We train and test the performance on the standard ResNet-18 He et al. (2016) backbone with the 7×7 filter size in the first convolution layer with BN-layers replaced by GN Wu & He (2018); Hsieh et al. (2020) to avoid the invalid aggregation. Implementation details. We select each hyper-parameters within the appropriate range and present the combinations under the best performance. To fairly compare these baseline methods, we fix the most hyper-parameters for all methods under the same setting. For the 10% participation of total 100 clients training, we set the local learning rate as 0.1 initially and set the global learning rate as 1.0 for all methods except for FedAdam which applies 0.1 on global server. The learning rate decay is set as multiplying 0.998 per communication round except for FedDyn, FedADMM and FedSpeed which apply 0.9995. Each active local client trains 5 epochs with batchsize 50. Weight decay is set as 1e-3 for all methods. The weight for the prox-term in FedProx, FedDyn, FedADMM and FedSpeed is set as 0.1. For the 2% participation, the learning rate decay is adjusted to 0.9998 for FedDyn and FedSpeed. Each active client trains 2 epochs with batchsize 20. The weight for the prox-term is set as 0.001. The other hyper-parameters specific to each method will be introduced in the Appendix. Baselines. We compare several classical and efficient methods with the proposed FedSpeed in our experiments, which focus on the local consistency and client-drifts, including FedAvg McMahan et al. (2017), FedAdam Reddi et al. (2020), SCAFFOLD Karimireddy et al. (2020), FedCM Xu et al. (2021), FedProx Sahu et al. (2018), FedDyn Durmus et al. (2021) and FedADMM Wang et al. (2022). FedAdam applies adaptive optimizer to improve the performance on the global updates. SCAFFOLD and FedCM utilize the global gradient estimation to correct the local updates. FedProx introduces the prox-term to alleviate the local inconsistency. FedDyn and FedADMM both employ the different variants of the primal-dual method to reduce the local inconsistency. Due to the limited space, more detailed description and discussions on these compared baselines are placed in the Appendix. 7 0200400600800100012001400Communication Rounds0.600.650.700.750.800.850.90Test Top-1 AccFedProxFedAvgFedCMFedAdamFedADMMFedDynSCAFFOLDFedSpeed0200400600800100012001400Communication Rounds0.600.650.700.750.800.850.90Test Top-1 AccFedProxFedAvgFedCMFedAdamFedADMMFedDynSCAFFOLDFedSpeed0200400600800100012001400Communication Rounds0.600.650.700.750.800.850.90Test Top-1 AccFedProxFedAvgFedCMFedAdamFedADMMFedDynSCAFFOLDFedSpeed0200400600800100012001400Communication Rounds0.600.650.700.750.800.850.90Test Top-1 AccFedProxFedAvgFedCMFedAdamFedADMMFedDynSCAFFOLDFedSpeed0200400600800100012001400Communication Rounds0.00.10.20.30.40.5Test Top-1 AccFedProxFedAvgFedCMFedAdamFedADMMFedDynSCAFFOLDFedSpeed0200400600800100012001400Communication Rounds0.00.10.20.30.40.5Test Top-1 AccFedProxFedAvgFedCMFedAdamFedADMMFedDynSCAFFOLDFedSpeed050010001500200025003000Communication Rounds0.200.250.300.350.400.45Test Top-1 AccFedProxFedAvgFedCMFedAdamFedADMMFedDynSCAFFOLDFedSpeed050010001500200025003000Communication Rounds0.200.250.300.350.400.45Test Top-1 AccFedProxFedAvgFedCMFedAdamFedADMMFedDynSCAFFOLDFedSpeed Published as a conference paper at ICLR 2023 Table 1: Test accuracy (%) on the CIFAR-10/100 and TinyImagenet under the 2% participation of 500 clients with IID and non-IID dataset. The heterogeneity is applied as Dirichlet-0.6 (DIR.). Method FedAvg FedProx FedAdam SCAFFOLD FedCM FedDyn FedADMM FedSpeed CIFAR-10 CIFAR-100 TinyImagenet IID. 77.01 77.68 82.92 80.11 84.20 83.36 81.29 85.80 DIR. 75.21 75.97 80.55 77.71 83.48 80.57 79.71 84.79 IID. 40.68 41.29 51.65 47.38 52.35 46.18 45.51 53.93 DIR. 39.33 39.69 49.29 46.33 50.98 46.60 46.65 52.88 IID. 33.58 33.71 40.85 38.03 41.90 34.69 36.03 43.38 DIR. 32.71 32.78 39.71 37.54 41.67 33.92 33.83 42.75 5.2 EXPERIMENTS CIFAR-10. Our proposed FedSpeed is robust to different participation cases. Figure 1 (a) shows the results of 10% participation of total 100 clients. For the IID splits, FedSpeed achieves 6.1% ahead of FedAvg as 88.5%. FedDyn suffers the instability when learning rate is small, which is the similar phenomenon as mentioned in Xu et al. (2021). When introducing the heterogeneity, FedAdam suffers from the increasing variance obviously with the accuracy dropping from 85.7% to 83.2%. Figure 1 (b) shows the impact from reducing the participation. FedAdam is lightly affected by this change while the performance degradation of SCAFFOLD is significant which drops from 85.3% to 80.1%. CIFAR-100 & TinyImagenet. As shown in Figure 1 (c) and (d), the performance of FedSpeed on the CIFAR-100 and TinyImagenet with low participating setting performs robustly and achieves approximately 1.6% and 1.8% improvement ahead of the FedCM respectively. As the participation is too low, the impact from the heterogeneous data becomes weak gradually with a similar test accuracy. SCAFFOLD is still greatly affected by a low participation ratio, which drops about 3.3% lower than FedAdam. FedCM converges fast at the beginning of the training stage due to the benefits from strong consistency limitations. FedSpeed adopts to update the prox-correction term and converges faster with its estimation within several rounds and then FedSpeed outperforms other methods. Table 1 shows the accuracy under the low participation ratio equals to 2%. Our proposed FedSpeed outperforms on each dataset on both IID and non-IID settings. Table 1 shows the accuracy under the low participation ratio equals to 2%. Our proposed FedSpeed outperforms on each dataset on both IID and non-IID settings. We observe the similar results as mentioned in Reddi et al. (2020); Xu et al. (2021). FedAdam and FedCM could maintain the low consistency in the local training stage with a robust results to achieve better performance than others. While FedDyn is affected greatly by the number of training samples in the dataset, which is sensitive to the partial participation ratios. Large local interval for the prox-term. From the IID case to the non-IID case, the heterogeneous dataset introduces the local inconsistency and leads to the severe client-drifts problem. Almost all the baselines suffer from the performance degradation. High local consistency usually supports for a large interval as for their bounded updates and limited offsets. Applying prox-term guarantees the local consistency, but it also has an negative impact on the local training towards the target of weighted local optimal and global server model. FedDyn and FedADMM succeed to apply the primal-dual method to alleviate this influence as they change the local objective function whose target is reformed by a dual variable. These method can mitigate the local offsets caused by the prox-term and they improve about 3% ahead of the FedProx on CIFAR-10. However, the primal-dual method requires a local ε-close solution. In the non-convex optimization it is difficult to determine the selection of local training interval K under this requirement. Though Durmus et al. (2021) claim that 5 local epochs are approximately enough for the ε-close solution, there is still an unpredictable local biases. FedSpeed directly applies a prox-correction term to update K epochs and avoids the requirement for the precision of local solution. This ensures that the local optimization stage does not introduce the bias due to the error of the inexact solution. Moreover, the extra ascent step can efficiently improve the performance of local model parameters. Thus, the proposed FedSpeed can improve 3% than FedDyn and FedADMM and achieve the comparable performance as training on the IID dataset. 8 Published as a conference paper at ICLR 2023 (a) FedAdam. (b) FedCM. (c) SCAFFOLD. (d) FedSpeed. Figure 2: Performance of FedAdam, FedCM, SCAFFOLD and FedSpeed with local epochs E = 1, 2, 5, 10, 20 on the 10% participation case of total 100 clients on CIFAR-10. We fix T × E = 2500 as the equaled total training epochs to illustrate the performance of increasing E and decreasing T . An interesting experimental phenomenon is that the performance of SCAFFOLD gradually degrades under the low participation ratio. It should be noticed that under the 10% participation case, SCAF- FOLD performs as well as the FedCM. It benefits from applying a global gradient estimation to correct the local updates, which can weaken the client-drifts by a quasi gradient towards to the global optimal. Actually the estimation variance is related to the participation ratio, which means that their efficiencies rely on the enough number of clients. When the participation ratio decreases to be extremely low, their performance will also be greatly affected by the huge biases in the local training. 5.3 HYPERPARAMETERS SENSITIVITY Local interval K. To explore the acceleration on T by applying a large interval K, we fix the total training epochs E. It should be noted that K represents for the iteration and E represents for the epoch. A larger local interval can be applied to accelerate the convergence in many previous works theoretically, e.g. for SCAFFOLD and FedAdam, while empirical studies are usually unsatisfactory. As shown in Figure 2, in the FedAdam and FedCM, when K increases from 1 to 20, the accuracy drops about 13.7% and 10.6% respectively. SCAFFOLD is affected lightly while its performance is much lower. In Figure 2 (d), FedSpeed applies the larger E to accelerate the communication rounds T both on theoretical proofs and empirical results, which stabilizes to swing within 3.8% lightly. Table 2: Performance of different ρ0 with α = 1. Learning rate ρ for gradient perturbation. In the simple analysis, ρ can be selected as a proper value which has no impact on the convergence complexity. By noticing that if α ̸= 0, ρ could be selected irrelevant to ηl. To achieve a better performance, we apply the ascent learning rate ρ = ρ0/∥∇Fi∥ to in the experiments, where ρ0 is a constant value selected from the Table 2. ρ is consistent with the sharpness aware minimization Foret et al. (2020b) which can search for a flat local minimal. Table 2 shows the performance of utilizing the different ρ0 on CIFAR-10 by 500 communication rounds under the 10% participation of total 100 clients setting. Due to the space limitations more details could be referred to the Appendix. 84.35 85.38 83.97 85.72 Acc. 0.05 0.01 84.6 0.2 0.1 ρ0 0 6 CONCLUSION In this paper, we propose a novel and practical federated method FedSpeed which applies a prox- correction term to neutralize the bias due to prox-term in each local training stage and utilizes a perturbation gradient weighted by an extra gradient ascent step to improve the local generalization performance. We provide the theoretical analysis to guarantee its convergence and prove that FedSpeed benefits from a larger local interval K to achieve a fast convergence rate of O(1/T ) without any other harsh assumptions. We also conduct extensive experiments to highlight the significant improvement and efficiency of our proposed FedSpeed, which is consistent with the properties of our analysis. This work inspires the FL framework design to focus on the local consistency and local higher generalization performance to implement the high-efficient method to federated learning. 9 0500100015002000Total Epochs0.550.600.650.700.750.800.850.90Test Top-1 Acc.12510200500100015002000Total Epochs0.550.600.650.700.750.800.850.90Test Top-1 Acc.12510200500100015002000Total Epochs0.550.600.650.700.750.800.850.90Test Top-1 Acc.12510200500100015002000Total Epochs0.550.600.650.700.750.800.850.90Test Top-1 Acc.1251020 Published as a conference paper at ICLR 2023 REFERENCES Maksym Andriushchenko and Nicolas Flammarion. Towards understanding sharpness-aware mini- mization. In International Conference on Machine Learning, pp. 639–668. PMLR, 2022. Muhammad Asad, Ahmed Moustafa, and Takayuki Ito. Fedopt: Towards communication efficiency and privacy preservation in federated learning. Applied Sciences, 10(8):2864, 2020. Sebastian Bischoff, Stephan G ̈unnemann, Martin Jaggi, and Sebastian U Stich. On second-order optimization methods for federated learning. arXiv preprint arXiv:2109.02388, 2021. Debora Caldarola, Barbara Caputo, and Marco Ciccone. Improving generalization in federated learning by seeking flat minima. In Computer Vision–ECCV 2022: 17th European Conference, Tel Aviv, Israel, October 23–27, 2022, Proceedings, Part XXIII, pp. 654–672. Springer, 2022. Zachary Charles and Jakub Koneˇcn`y. Convergence and accuracy trade-offs in federated learning and meta-learning. In International Conference on Artificial Intelligence and Statistics, pp. 2575–2583. PMLR, 2021. Congliang Chen, Li Shen, Haozhi Huang, and Wei Liu. Quantized adam with error feedback. ACM Transactions on Intelligent Systems and Technology (TIST), 12(5):1–26, 2021. Congliang Chen, Li Shen, Wei Liu, and Zhi-Quan Luo. Efficient-adam: Communication-efficient distributed adam with complexity analysis. arXiv preprint arXiv:2205.14473, 2022. Hong-You Chen and Wei-Lun Chao. Fedbe: Making bayesian model ensemble applicable to federated learning. arXiv preprint arXiv:2009.01974, 2020. Xiangyi Chen, Xiaoyun Li, and Ping Li. Toward communication efficient adaptive gradient method. In Proceedings of the 2020 ACM-IMS on Foundations of Data Science Conference, pp. 119–128, 2020. Alp Emre Durmus, Zhao Yue, Matas Ramon, Mattina Matthew, Whatmough Paul, and Saligrama Venkatesh. Federated learning based on dynamic regularization. In International Conference on Learning Representations, 2021. Pierre Foret, Ariel Kleiner, Hossein Mobahi, and Behnam Neyshabur. Sharpness-aware minimization for efficiently improving generalization. arXiv preprint arXiv:2010.01412, 2020a. Pierre Foret, Ariel Kleiner, Hossein Mobahi, and Behnam Neyshabur. Sharpness-aware minimization for efficiently improving generalization. arXiv preprint arXiv:2010.01412, 2020b. Liang Gao, Huazhu Fu, Li Li, Yingwen Chen, Ming Xu, and Cheng-Zhong Xu. Feddc: Fed- erated learning with non-iid data via local drift decoupling and correction. arXiv preprint arXiv:2203.11751, 2022. Yonghai Gong, Yichuan Li, and Nikolaos M Freris. Fedadmm: A robust federated deep learning framework with adaptivity to system heterogeneity. arXiv preprint arXiv:2204.03529, 2022. Farzin Haddadpour, Mohammad Mahdi Kamani, Aryan Mokhtari, and Mehrdad Mahdavi. Federated learning with compression: Unified analysis and sharp guarantees. In International Conference on Artificial Intelligence and Statistics, pp. 2350–2358. PMLR, 2021. Filip Hanzely and Peter Richt ́arik. Federated learning of a mixture of global and local models. arXiv preprint arXiv:2002.05516, 2020. Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016. Kevin Hsieh, Amar Phanishayee, Onur Mutlu, and Phillip Gibbons. The non-iid data quagmire of decentralized machine learning. In International Conference on Machine Learning, pp. 4387–4398. PMLR, 2020. 10 Published as a conference paper at ICLR 2023 Tzu-Ming Harry Hsu, Hang Qi, and Matthew Brown. Measuring the effects of non-identical data distribution for federated visual classification. arXiv preprint arXiv:1909.06335, 2019. Peter Kairouz, H Brendan McMahan, Brendan Avent, Aur ́elien Bellet, Mehdi Bennis, Arjun Nitin Bhagoji, Kallista Bonawitz, Zachary Charles, Graham Cormode, Rachel Cummings, et al. Ad- vances and open problems in federated learning. Foundations and Trends® in Machine Learning, 14(1–2):1–210, 2021. Belhal Karimi, Xiaoyun Li, and Ping Li. Fed-lamb: Layerwise and dimensionwise locally adaptive optimization algorithm. CoRR, abs/2110.00532, 2021. Sai Praneeth Karimireddy, Satyen Kale, Mehryar Mohri, Sashank Reddi, Sebastian Stich, and Ananda Theertha Suresh. Scaffold: Stochastic controlled averaging for federated learning. In International Conference on Machine Learning, pp. 5132–5143. PMLR, 2020. Ahmed Khaled, Konstantin Mishchenko, and Peter Richt ́arik. First analysis of local gd on heteroge- neous data. arXiv preprint arXiv:1909.04715, 2019. Geeho Kim, Jinkyu Kim, and Bohyung Han. Communication-efficient federated learning with acceleration of global momentum. arXiv preprint arXiv:2201.03172, 2022. Jakub Koneˇcn`y, H Brendan McMahan, Felix X Yu, Peter Richt ́arik, Ananda Theertha Suresh, and Dave Bacon. Federated learning: Strategies for improving communication efficiency. arXiv preprint arXiv:1610.05492, 2016. Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009. Li Li, Yuxi Fan, Mike Tse, and Kuo-Yi Lin. A review of applications in federated learning. Computers & Industrial Engineering, 149:106854, 2020a. Tian Li, Anit Kumar Sahu, Manzil Zaheer, Maziar Sanjabi, Ameet Talwalkar, and Virginia Smithy. Feddane: A federated newton-type method. In 2019 53rd Asilomar Conference on Signals, Systems, and Computers, pp. 1227–1231. IEEE, 2019. Tian Li, Anit Kumar Sahu, Ameet Talwalkar, and Virginia Smith. Federated learning: Challenges, methods, and future directions. IEEE Signal Processing Magazine, 37(3):50–60, 2020b. Xianfeng Liang, Shuheng Shen, Jingchang Liu, Zhen Pan, Enhong Chen, and Yifei Cheng. Variance reduced local sgd with lower communication complexity. arXiv preprint arXiv:1912.12844, 2019. Ji Liu, Jizhou Huang, Yang Zhou, Xuhong Li, Shilei Ji, Haoyi Xiong, and Dejing Dou. From distributed machine learning to federated learning: A survey. Knowledge and Information Systems, pp. 1–33, 2022. Yixing Liu, Yan Sun, Zhengtao Ding, Li Shen, Bo Liu, and Dacheng Tao. Enhance local consistency in federated learning: A multi-step inertial momentum approach. arXiv preprint arXiv:2302.05726, 2023. Grigory Malinovskiy, Dmitry Kovalev, Elnur Gasanov, Laurent Condat, and Peter Richtarik. From local sgd to local fixed-point methods for federated learning. In International Conference on Machine Learning, pp. 6692–6701. PMLR, 2020. Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Aguera y Arcas. Communication-efficient learning of deep networks from decentralized data. In Artificial intelli- gence and statistics, pp. 1273–1282. PMLR, 2017. Peng Mi, Li Shen, Tianhe Ren, Yiyi Zhou, Xiaoshuai Sun, Rongrong Ji, and Dacheng Tao. Make sharpness-aware minimization stronger: A sparsified perturbation approach. In Advances in Neural Information Processing Systems. Emre Ozfatura, Kerem Ozfatura, and Deniz G ̈und ̈uz. Fedadc: Accelerated federated learning with drift control. In 2021 IEEE International Symposium on Information Theory (ISIT), pp. 467–472. IEEE, 2021. 11 Published as a conference paper at ICLR 2023 Zhe Qu, Xingyu Li, Rui Duan, Yao Liu, Bo Tang, and Zhuo Lu. Generalized federated learning via sharpness aware minimization. In International Conference on Machine Learning, pp. 18250– 18280. PMLR, 2022. Sashank Reddi, Zachary Charles, Manzil Zaheer, Zachary Garrett, Keith Rush, Jakub Koneˇcn`y, Sanjiv Kumar, and H Brendan McMahan. Adaptive federated optimization. arXiv preprint arXiv:2003.00295, 2020. Anit Kumar Sahu, Tian Li, Maziar Sanjabi, Manzil Zaheer, Ameet Talwalkar, and Virginia Smith. arXiv preprint On the convergence of federated optimization in heterogeneous networks. arXiv:1812.06127, 3:3, 2018. Yifan Shi, Li Shen, Kang Wei, Yan Sun, Bo Yuan, Xueqian Wang, and Dacheng Tao. Improving the model consistency of decentralized federated learning. arXiv preprint arXiv:2302.04083, 2023. Yue Tan, Guodong Long, Lu Liu, Tianyi Zhou, Qinghua Lu, Jing Jiang, and Chengqi Zhang. Fedproto: Federated prototype learning across heterogeneous clients. In AAAI Conference on Artificial Intelligence, volume 1, 2022. Dirk van der Hoeven. Exploiting the surrogate gap in online multiclass classification. Advances in Neural Information Processing Systems, 33:9562–9572, 2020. Han Wang, Siddartha Marella, and James Anderson. Fedadmm: A federated primal-dual algorithm allowing partial participation. arXiv preprint arXiv:2203.15104, 2022. Jianyu Wang, Vinayak Tantia, Nicolas Ballas, and Michael Rabbat. Improving communication-efficient distributed sgd with slow momentum. arXiv preprint arXiv:1910.00643, 2019. Slowmo: Jianyu Wang, Qinghua Liu, Hao Liang, Gauri Joshi, and H Vincent Poor. Tackling the objective inconsistency problem in heterogeneous federated optimization. Advances in neural information processing systems, 33:7611–7623, 2020a. Jianyu Wang, Qinghua Liu, Hao Liang, Gauri Joshi, and H Vincent Poor. Tackling the objective inconsistency problem in heterogeneous federated optimization. Advances in neural information processing systems, 33:7611–7623, 2020b. Jianyu Wang, Zheng Xu, Zachary Garrett, Zachary Charles, Luyang Liu, and Gauri Joshi. Local adaptivity in federated learning: Convergence and consistency. arXiv preprint arXiv:2106.02305, 2021. Yuxin Wu and Kaiming He. Group normalization. In Proceedings of the European conference on computer vision (ECCV), pp. 3–19, 2018. Jing Xu, Sen Wang, Liwei Wang, and Andrew Chi-Chih Yao. Fedcm: Federated learning with client-level momentum. arXiv preprint arXiv:2106.10874, 2021. Haibo Yang, Minghong Fang, and Jia Liu. Achieving linear speedup with partial worker participation in non-iid federated learning. arXiv preprint arXiv:2101.11203, 2021. Peng Yang, Yuning Jiang, Ting Wang, Yong Zhou, Yuanming Shi, and Colin N Jones. Over-the-air federated learning via second-order optimization. arXiv preprint arXiv:2203.15488, 2022. Qiang Yang, Yang Liu, Yong Cheng, Yan Kang, Tianjian Chen, and Han Yu. Federated learning. Synthesis Lectures on Artificial Intelligence and Machine Learning, 13(3):1–207, 2019. Hao Yu, Rong Jin, and Sen Yang. On the linear speedup analysis of communication efficient momentum sgd for distributed non-convex optimization. In International Conference on Machine Learning, pp. 7184–7193. PMLR, 2019. Xinwei Zhang, Mingyi Hong, Sairaj Dhople, Wotao Yin, and Yang Liu. Fedpd: A federated learning framework with adaptivity to non-iid data. IEEE Transactions on Signal Processing, 69:6055–6070, 2021. 12 Published as a conference paper at ICLR 2023 Yang Zhao, Hao Zhang, and Xiuyuan Hu. Penalizing gradient norm for efficiently improving generalization in deep learning. arXiv preprint arXiv:2202.03599, 2022. Qihuang Zhong, Liang Ding, Li Shen, Peng Mi, Juhua Liu, Bo Du, and Dacheng Tao. Improving sharpness-aware minimization with fisher mask for better generalization on language models. arXiv preprint arXiv:2210.05497, 2022. 13 Published as a conference paper at ICLR 2023 In this part, we will introduce the gradient perturbation, the proofs of the major equations and the theorem, and some extra experiments. In Section A, we provide a explanation for understanding the gradient perturbation step in our proposed FedSpeed. In Section C, we provide the full proofs of the major equation in the text, some main lemmas and the theorem. In Section B, we provide the details of the implementation of the experiments including the setups, dataset, hyper-parameters and some extra experiments. A GRADIENT PERTURBATION A.1 UNDERSTANDING OF GRADIENT PERTURBATION We propose the gradient perturbation in the local training stage instead of the traditional stochastic gradient, which merges an extra gradient ascent step to the vanilla gradient by a hyper-parameter α. While its ascent step usually approximates the worst point in the neighbourhood. This has been studied in many previous works, e.g. for the form of extra gradient and the sharpness aware minimization. In our studies, we perform the extra gradient ascent step instead of the descent step in extra gradient method. It also could be considered as a variant of the sharpness aware minimization method via weighted averaging the ascent step gradient and the vanilla gradient, instead of the normalized gradient. Here we illustrate the implicit of this quasi-gradient ̃g in our proposed FedSpeed and explain the positive efficiency for the local training from the perspective of objective functions. Firstly we consider to minimize the non-convex problem Lp(x). To approach the stationary point of Lp, we can simply introduce a penalized gradient term as a extra loss in Lp, which is to solve the problem minx{L(x) ≜ Lp(x) + β 2 ∥∇Lp(x)∥2}. The final optimization target is consistent with the vanilla target, while penalizing gradient term can approach a flatten minimal empirically. We compute the gradient form as follows: ∇L(x) = ∇Lp(x) + β 2 ∇∥∇Lp(x)∥2 = ∇Lp(x) + β∇2Lp(x) * ∇Lp(x). (8) The update in Equation (8) contains second-order Hessian information, which involves a huge amount of parameters for calculation. To further simplify the updates, we consider an approximation for the gradient form. We expand the function Lp via Taylor expansion as: Lp(x + ∆) = Lp(x) + ∇Lp(x)∆ + 1 2 ∆T ∇2Lp(x)∆ + R∆, where R∆ = O(∥∆∥2) is the infinitesimal to ∥∆∥2, which is directly omitted in our approximation. Thus we have the gradient form on ∆ as: ∇Lp(x + ∆) ≈ ∇Lp(x) + ∇2Lp(x)∆. R∆ is relevant to ∆. We set the ∆ = ρ∇Lp(x) and then we have: ∇2Lp(x)∇Lp(x) ≈ 1 ρ (cid:0)∇Lp (cid:0)x + ρ∇Lp(x)(cid:1) − ∇Lp(x)(cid:1). (9) Thus we connect Equation (8) and Equation (9), we have: ∇L(x) = ∇Lp(x) + β∇2Lp(x) * ∇Lp(x) β ρ (cid:1)∇Lp(x) + ≈ ∇Lp(x) + = (cid:0)1 − (cid:0)∇Lp ∇Lp β ρ β ρ = (1 − α)∇Lp(x) + α∇Lp (cid:0)x + ρ∇Lp(x)(cid:1) (cid:0)x + ρ∇Lp(x)(cid:1). (cid:0)x + ρ∇Lp(x)(cid:1) − ∇Lp(x)(cid:1) Here we can see that the balance weight α in our proposed method is actually the ratio of the gradient penalized weight β and the gradient ascent step size ρ. To fix the step size ρ, increasing α 14 Published as a conference paper at ICLR 2023 means increasing the gradient penalized weight β, which facilitates searching for a flatten stationary point to improve the generalization performance. While the second term of ∇L(x) can not be directly computed for its nested form, we approximate the second term with the chain rule as follows: Finally we have: ∇Lp (cid:0)x + ρ∇Lp(x)(cid:1) ≈ ∇Lp(θ)|θ=x+ρ∇Lp(x). ∇L(x) ≈ (1 − α)∇Lp(x) + α∇Lp(θ)|θ=x+ρ∇Lp(x). (10) The Equation (10) provides an understanding for the weighted quasi gradient ̃g on the local training stage in our proposed FedSpeed. We select an appropriate 0 ≤ β ≤ ρ to satisfy the update of perturbation gradient. It executes a gradient ascent step firstly with the step size ρ to ̆x. Then it generates the stochastic gradient by the same sampled mini-batch data as the ascent step at ̆x. The quasi-gradient is merged as Equation (10) to execute the gradient descent step. This is just a simple approximation for the gradient perturbation to help for understanding the implicit of the quasi-gradient and its performance in the training stage. Actually the error of the approximation depends a lot on ρ. The smaller ρ, the higher the accuracy of this estimation, but the smaller ρ, the less efficient the optimizer performs. Similar understanding can be referred in the (Qu et al., 2022; Caldarola et al., 2022; Andriushchenko & Flammarion, 2022). B EXPERIMENTS B.1 SETUPS Dataset CIFAR-10 CIFAR-100 TinyImagenet Table 3: Dataset introductions. Training Data Test Data Class 50,000 50,000 100,000 10,000 10,000 10,000 10 100 200 Size 3×32×32 3×32×32 3×64×64 Dataset and Backbones. Extensive experiments are tested on CIFAR-10/100 dataset. We test on the two different settings as 10% participation of total 100 clients and 2% participation of total 500 clients. CIFAR-10 dataset contains 50,000 training data and 10,000 test data in 10 classes. Each data sample is a 3×32×32 color image. CIFAR-100 Krizhevsky et al. (2009) includes 50,000 training data and 10,000 test data in 100 classes as 500 training samples per class. TinyImagenet involves 100,000 training images and 10,000 test images in 200 classes for 3×64×64 color images, as shown in Table 3. To fairly compare with the other baselines, we train and test the performance on the standard ResNet-18 He et al. (2016) backbone with the 7×7 filter size in the first convolution layer as implemented in the previous works, e.g. for Karimireddy et al. (2020); Durmus et al. (2021); Xu et al. (2021). We follow the Hsieh et al. (2020) to replace the batch normalization layer with group normalization layer Wu & He (2018), which can be aggregated directly by averaging. These are all common setups in many previous works. Dataset Partitions. To fairly compare with the other baselines, we follow the Hsu et al. (2019) to introduce the heterogeneity via splitting the total dataset by sampling the label ratios from the Dirichlet distribution. An additional parameter is used to control the level of the heterogeneity of the entire data partition. In order to visualize the distribution of heterogeneous data, we make the heat maps of the label distribution in different dataset, as shown in Figure 3. Since the heat map of 500 clients cannot be displayed normally, we show 100 clients case. It could be seen that for heterogeneity weight equals to 0.6, about 10% to 20% of the categories dominate on each client, which is white block in the Figure 3. The IID dataset is totally averaged in each client. Data Argumentation. For CIFAR-10/100, we follow the implementation in the Karimireddy et al. (2020); Durmus et al. (2021) to normalize the pixel value within a specific mean and std value in our code, which are [0.491, 0.482, 0.447] for mean, [0.247, 0.243, 0.262] for std and [0.5071, 0.4867, 0.4408] for mean, [0.2675, 0.2565, 0.2761] for std. We randomly flip the training samples and randomly crop the images enlarged with the padding equal to 4. For TinyImagenet, the same argumentation is applied except for the padding equal to 8. 15 Published as a conference paper at ICLR 2023 (a) CIFAR-10. (b) CIFAR-100. Figure 3: Heat maps for different dataset under heterogeneity weight equals to 0.6 for Dirichlet distribution. Baselines. FedAvg McMahan et al. (2017) is proposed as the basic framework in the federated learning. And FedOpt improves it as a two-stage optimizer with a local and global optimizer update alternatively. Yang et al. (2021) proves a specific ηg (not the average weight) can achieve faster convergence (non-dominant term). FedAdam Reddi et al. (2020) utilizes a adaptive optimizer on the global server and SGD optimizer on the clients, which average the averaged local gradients as a quasi-gradient for global server to implement the adaptive update. SCAFFOLD Karimireddy et al. (2020) applies the variance reduction technique , i.e. SVRG, to approximate the global gradient as the averaged local gradients and transfer an extra variable to the client per round. This implementation can accelerate the convergence rate of the non-dominant term theoretically and achieve a high performance empirically. FedCM Xu et al. (2021) proposes a client-level momentum to merge the global update as a momentum buffer to the local updates, which extremely reduces the local consistency. Though it introduces a unpredictable biases into the local updates, it achieves the SOTA performance ahead of other methods. FedProx Sahu et al. (2018) implements the prox-point optimizer into the FL framework on local updates with a regularization prox-term regularizer. It limits the local updates towards the initial point at the start of each local stage. Many previous works have analyzed its advantages and weaknesses. Durmus et al. (2021); Wang et al. (2022); Gong et al. (2022) use different variants of primal-dual method into FL and achieve nice satisfactory in the FL framework. It does not need a heterogeneity bounded assumption theoretically, which requires a high local convergence guarantees. Our proposed FedSpeed achieve the same convergence rate without assuming the local exact solution and we provide the local interval bound to achieve this faster convergence. Both theoretical analysis and empirical results verifies the performance of our proposed FedSpeed. B.2 EXPERIMENTS B.3 HYER-PARAMETERS Hyper-parameters Selections. We fix the local learning rate as 0.1 and global learning rate as 1.0 for average, except for the FedAdam which is applied 0.1. The penalized weight of prox-term in FedProx, FedDyn, FedADMM and FedSpeed is selected from the [0.001, 0.01, 0.1, 0.5]. The learning rate decay is fixed as 0.998 expect for the FedDyn, FedADMM and FedSpeed is selected from [0.998, 0.999, 0.9995, 0.99995]. The perturbation weight is selected from [0, 0.5, 0.75, 0.875, 0.9375, 1]. The batchsize is selected from [20, 50]. The local interval K is selected from [1, 2, 5, 10, 20]. For the specific parameters in FedAdam, the momentum weight is set as 0.1 and the second order momentum weight is set as 0.01. The minimal value is set as 0.001 to prevent the calculation of dividing by 0. The client-level momentum weight of FedCM is set as 0.1. 16 0102030405060708090Clients0123456789ClassesHeterogeneity Distribution in CIFAR-100.10.20.30.40.50.60102030405060708090Clients0102030405060708090ClassesHeterogeneity Distribution in CIFAR-1000.020.040.060.080.100.120.140.16 Published as a conference paper at ICLR 2023 Table 4: Communication rounds required to achieve the target accuracy. On CIFAR-10/100 it trains 1,500 rounds and on TinyImagenet it trains 3,000 rounds. "-" means the test accuracy can not achieve the target accuracy within the fixed training rounds. DIR represents for the Dirichlet distribution with the heterogeneity weight equal to 0.6. Local interval K is set as 5 on CIFAR-10 (100-10%) and 2 on others. Other hyper-parameters are introduced above. Dataset CIFAR-10 (100-10%) CIFAR-10 (500-2%) Heterogeneity IID. DIR. IID. DIR. Target Acc. (%) 80.0 85.0 80.0 85.0 75.0 82.5 75.0 82.5 FedAvg FedProx FedAdam SCAFFOLD FedCM FedDyn FedADMM FedSpeed 344 338 324 207 109 121 169 136 - - 1343 654 620 400 917 280 472 465 689 272 192 166 174 169 - - - - 1092 - 756 380 772 720 613 628 325 547 505 495 - - 1357 1151 1476 - 1160 - 1440 926 878 967 449 673 687 662 - - - - 1399 - - 1148 Dataset CIFAR-100 (500-2%) TinyImagenet (500-2%) Heterogeneity IID. DIR. IID. DIR. Target Acc. 40.0 50.0 40.0 50.0 33.0 40.0 33.0 40.0 FedAvg FedProx FedAdam SCAFFOLD FedCM FedDyn FedADMM FedSpeed 1013 957 614 720 505 661 687 522 - - 1277 - 1150 - - 973 - - 847 784 526 703 715 541 - - - - 1336 - - 1038 - - - - 1615 1588 - - - - 1151 2495 1584 949 661 1419 921 684 - 1187 1360 817 1843 - - 2559 2711 - - 1373 962 1885 Here we briefly introduce the selection of the hyperparameters in FedSpeed. (1) ηl is the learning rate which is a basic hyperparameters in the deep learning, and usually we do not finetune this for the fair comparison in the experiments. We just select the same and common settings as the previous works mentioned. (2) λ is the coefficient for the prox-term, which is proposed in the FedProx and a lot of prox-based federated methods adopt this hyperparameter widely both in personalized-FL and centralized-FL. The selection of this hyperparameter has been studied in many previous works which verify its efficiency. Usually the selection of λ are in {10, 100} on the CIFAR-10/100 dataset, and we test it also works on the TinyImagenet. (3) ρ is the ascent step learning rate. Like many extra gradient method, the selection of ρ is usually related to the local learning rate ηl. In order not to unduly affect the performance of the gradient descent, the learning rate for the extra gradient step ρ is usually set not much larger than the learning rate for the gradient descent step ηl. Obviously, if ρ is set very small, the updated state of the extra gradient steps will be very limited, which makes this operation have no effect. Therefore, the selection 17 Published as a conference paper at ICLR 2023 of ρ usually matches that of ηl. In our experiments, the ηl is set as 0.1, which is a common selection in the previous works. We test the selection of ρ in {0, 0.01, 0.05, 0.1, 0.2} which represents for {"no extra gradient", "0.1ηl", "0.5ηl, "1ηl", "2ηl"}. The best performing selection is ρ = 1ηl in CIFAR-10 (details in Section 5.3 paragraph "Learning rate ρ for the gradient perturbation"). We also test this selection on the CIFAR-100 and TinyImagenet, and it also works well. We recommend that the selection of ρ should be kept comparable to the learning rate ηl. (4) α is the ratio for merging the gradient of the extra ascent step. In FedSpeed, the α is in the range of [0, 1]. The same, if α is set very small, which means it does not merge the gradient of the ascent steps. In our experiments, we test the selection of α in {0, 0.5, 0.75, 0.875, 0.9375, 1.0}. The best performing selection is α = 0.9375 in CIFAR-10. In fact α = 1 also works well (details in Section 5.3 paragraph "Perturbation weight α"). Thus, about α, we recommend that it should be close to 1.0, e.g. for 0.9, 0.99, 1.0. This also verifies the improvements of the ascent steps. B.3.1 BEST PERFORMING HYPER-PARAMETERS. For fair comparison, the learning rate is fixed for all the methods. For CIFAR-10 dataset, we select the batchsize as 50 for 100 clients and 20 for 500 clients. The total dataset is 50,000 and there are 100 images under a single client if it is set as 500 clients. Thus we decay it to 20 for 5 iterations per local epoch. The local epochs is set as 5, the same as the experiments of Karimireddy et al. (2020); Durmus et al. (2021); Xu et al. (2021) etc. and their performance is matching. We select the local interval K as 5. The prox-term weight is selected as 0.1. The learning rate decay is selected as 0.9995 for prox-term based methods. We train the total dataset for 1,500 communication rounds. For CIFAR-100 dataset, we select the 500 clients with 2% participation ratio in the experiments. Thus for each hyper-parameters we fine-tune a little. The batchsize is selected as 20 to avoid too little iterations per local epoch. The local epochs is set as 2 for the final results comparison. The ablation study on local interval K indicates that our proposed FedSpeed outperforms significantly than other methods when K is large. Thus to compare the performance more clearly, we select the 2 as the local epochs. We decay the prox-term weight as 0.01 for prox-term based methods. The learning rate decay is selected as 0.99995 for prox-based methods. We train 1,500 rounds and then test the performance. For TinyImagenet dataset, the most selections are the same as for the CIFAR-100 dataset. The prox-term weight is selected as 0.1 and the learning rate decay is selected as 0.9995. Total 3,000 communication rounds are implemented in the training stage. B.3.2 SPEED COMPARISON. Table 4 shows the communication rounds required to achieve the target test accuracy. At the beginning of training, FedCM performs faster than others and usually achieve a high accuracy finally. FedSpeed is faster in the middle and late stages of training. We bold the data for the top-2 in each test and generally FedCM and FedSpeed significantly performs well on the training speed. Figure 4 shows the performance of different learning rate decay and prox-term weight for FedSpeed. B.3.3 TIME COST Table 5: Training wall-clock time comparison. α1 Times (s/Round) Rounds Total (s) Cost Ratio FedAvg FedProx FedAdam SCAFFOLD FedCM FedDyn FedSpeed 10.44 11.33 14.74 14.34 13.22 14.11 16.42 - - 1343 654 622 400 281 - - 19795.8 9378.3 8222.8 5644.0 4614.0 - - 4.31× 2.03× 1.78× 1.22× 1× 18 Published as a conference paper at ICLR 2023 (a) Prox-term weight=0.5. (b) Prox-term weight=0.1. (c) Prox-term weight=0.01. (d) Prox-term weight=0.001. Figure 4: Performance of different ascent step size ρ under different prox-term weights of [0.001, 0.01, 0.1, 0.5]. We test the time on the A100-SXM4-40GB GPU and show the performance in the Table B.3.3. Experimental setups are the same as the CIFAR-10 10% participation among total 100 clients on the DIR-0.6 dataset. The rounds in the table are the communication rounds required that the test accuracy achieves accuracy 85%. "-" means it can not achieve the target accuracy. FedSpeed is slower due to the requirement of computing an extra gradient. So it gets slower in one single update, approximately 1.57× wall-clock time costs than FedAvg. But its convergence process is very fast. For the final convergence speed, FedSpeed still has a considerable advantage over other algorithms. The issue is possibly one of the improvements for FedSpeed in the future. For example, introduces a single-call gradient method to save half the costs during backpropagation. We are also currently trying to introduce new module to save the cost. B.3.4 DIFFERENT HETEROGENEITY. Table 6: Comparison on different heterogeneous dataset. α1 IID Dir-0.6 Dir-0.3 Drops (i.i.d. > Dir-0.6) Drops (Dir-0.6 > Dir-0.3) FedAvg FedAdam 77.01 82.92 SCAFFOLD 80.11 84.20 83.36 85.80 FedCM FedDyn FedSpeed 75.21 80.55 77.71 83.48 80.57 84.79 71.96 76.87 74.34 81.02 77.33 82.68 1.80 2.37 2.40 0.72 2.79 1.01 3.25 3.68 3.37 2.46 3.24 2.11 We test on the Dir-0.3 setups on CIFAR-10 and show the results as Table B.3.4, the other settings are the same as the test in the text. The (i.i.d. > Dir-0.6) is the difference between the IID dataset and the Dir-0.6 dataset and (Dir-0.6 > Dir-0.3) is the difference between the Dir-0.6 dataset and the DIR-0.3 dataset. FedSpeed can outperform the others on the Dir-0.3 setups whose heterogeneity is much 19 0200400600800100012001400Communication Rounds0.7000.7250.7500.7750.8000.8250.8500.8750.900Test Top-1 Acc=0.01=0.05=0.1=0.20200400600800100012001400Communication Rounds0.7000.7250.7500.7750.8000.8250.8500.8750.900Test Top-1 Acc=0.01=0.05=0.1=0.20200400600800100012001400Communication Rounds0.7000.7250.7500.7750.8000.8250.8500.8750.900Test Top-1 Acc=0.01=0.05=0.1=0.20200400600800100012001400Communication Rounds0.7000.7250.7500.7750.8000.8250.8500.8750.900Test Top-1 Acc=0.01=0.05=0.1=0.2 Published as a conference paper at ICLR 2023 (a) CIFAR-10 IID. (b) CIFAR-10 non-IID. (c) FedCM. (d) FedSpeed. Figure 5: (a) and (b) show the loss curves on the CIFAR-10 IID/DIR-0.6 dataset. The FedSpeed achieves the best and stable performance in the training. (c) and (d) show the loss curve of FedCM and FedSpeed on the CIFAR-10 DIR-0.6 dataset with increasing the local epochs from E = 1 to 20. stronger than Dir-0.6 setups. the heterogeneity becomes stronger, FedSpeed can still maintain a stable generalization performance. The correction term helps to correct the biases during the local training, while the gradient perturbation term helps to resist the local over-fitting on the heterogeneous dataset. FedSpeed can benefit from avoiding falling into the biased optima. B.3.5 ABLATION STUDIES Table 7: Ablation studies on different modules. Prox-term Prox-correction term Gradient perturbation Accuracy (%) - √ √ √ √ - - √ - √ - - - √ √ 81.92 82.24 83.94 83.88 85.70 From the practical training point of view, compared with the vanilla FedAvg, FedSpeed adds three main modules: (1) prox-term, (2) prox-correction term, and (3) gradient perturbation. We test the performance of 500 communication rounds of the different combination of the modules above on the CIFAR-10 with the settings of 10% participating ratio of total 100 clients. The TableB.3.5 shows their performance. From the table above, we can clearly see the performance of different modules. The prox-term is proposed by the FedProx. But due to some issues we point out in our paper, this term has also a negative impact on the performance in FL. When the prox-correction term is introduced in, it improves the performance from 82.24% to 83.94%. When the gradient perturbation is introduced in, it improves the performance from 82.24% to 83.88%. While FedSpeed applies them together and achieves a 3.46% improvement. Different performance of these modules: As introduced in our paper, the prox-term simply performs as a balance between the local and global solutions, and there still exists the non-vanishing inconsistent biases among the local solutions, i.e., the local solutions are still largely deviated from each other, implying that local inconsistency is still not eliminated. Thus we utilize the prox-correction term to correct the inconsistent biases during the local training. About the function of gradient perturbation, we refer to a theoretical explanation in the main text, and its proof is provided in the supplementary material due to the space limitations. This perturbation is similar to utilize a penalized gradient term to the objective function during local optimization process. The additional penalty will bring better properties to the local state, e.g. for flattened minimal and smoothness. For federated learning, the smoother the local minima is, the more flatness the model merged on the server will be. FedSpeed benefits from these two modules to improve the performance and achieves the SOTA results. 20 0200400600800100012001400Communication Rounds0.500.751.001.251.501.752.002.25LossFedAvgFedCMFedAdamFedDynSCAFFOLDFedSpeed0200400600800100012001400Communication Rounds0.51.01.52.02.5LossFedAvgFedCMFedAdamFedDynSCAFFOLDFedSpeed05001000150020002500Communication rounds0.00.51.01.52.0Loss125102005001000150020002500Communication rounds0.51.01.52.02.5Loss1251020 Published as a conference paper at ICLR 2023 B.3.6 LOSS CURVE COMPARISON According to the Figure 5, in (a) and (b) we can see the common FedAvg method fail to resist the local over-fitting and finally does not approach a stable state in the training, while FedSpeed can converge stably and efficiently, which if far faster than other baselines. (c) and (d) show the empirical studies of increasing the local interval. FedCM is the second SOTA-performing method in our baselines, while it still can not speed up by increasing local interval in the practical training. As shown in (c), increasing local interval almost does not have any benefits to FedCM, and the communication rounds can not be reduced. While in (d), FedSpeed succeed to apply a larger local interval to reduce the communication rounds. When K is increasing, to achieve the similar performance, the total communication rounds is nearly decreasing as K×, which is a useful property that is very efficient in practical training. In our paper, what we claim is that if a federated learning method could adopt a large K, it is a good property. Unfortunately, most SGD-type algorithms cannot increase the convergence rate by increasing K. Some useful techniques are adopt in the FL framework to improve the performance, e.g. variance reduction, gradient tracking and regularization term (mainly the prox-based methods). FedSpeed is a prox-based method which incorporates the correction term and extra ascent gradient to improve the performance. In fact, it has been proven that prox-based methods have the potential to apply the larger local interval in the local training under the requirement of local minimal solution per communication round. We theoretically prove that FedSpeed can achieve the fast rate without this harsh assumption and it can apply the large K in the local client. Yang et al. (2021) have proven that if FedAvg change the partial participation to the full participation (Local-SGD-type), the dominant √ K√ ), which will be relaxed to K term of convergence rate will change from O( nT times faster. Full participation usually achieves higher theoretical rate than the partial participation. VRL-SGD Liang et al. (2019) can theoretically improve the efficiency by adopting a larger order of local interval K = O( T ) than FedAvg, while FedSpeed can adopt K = O(T ). ) to O( 1√ mKT √ B.3.7 ABLATION STUDY OF PERTURBATION WEIGHT α Table 8: Performance of different α with ρ0 = 0.1. Perturbation weight α. α determines the degree of influence of the perturba- tion gradient term to the vanilla stochas- tic gradient on the local training stage. It is a trade-off to balance the ratio of the perturbation term. We select the α from 0 to 1 and find FedSpeed can converge with any α ∈ [0, 1]. Though the theoretical analysis demonstrates that by applying a α > 0 in the term Φ will not increas- ing the extra orders. And the experimental results shown in Table 8, indicates that the generalization performance improves by increasing α. 0.9375 0.875 85.72 84.36 85.46 83.97 84.91 85.74 Acc. 0.75 1.0 0.5 α 0 C PROOFS FOR ANALYSIS In this part we will demonstrate the proofs of all formula mentioned in this paper. Each formula is presented in the form of a lemma. C.1 PROOF OF EQUATION (2) Equation (2) shows the update in the total local training stage. Lemma C.1 For ∀ xt i,K = (cid:80)K ∆t k=0 δt i,k = xt i,k ∈ Rd and i ∈ S t, we denote δt i,k = xt i,k − xt i,k−1 with setting δt i,0 = 0, and i,K − xt i,0, under the update rule in Algorithm Algorithm 1, we have: where (cid:80)K−1 k=0 γk = (cid:80)K−1 k=0 ∆t i,K = −λγ K−1 (cid:88) k=0 γk γ i,k + γλˆgt−1 ̃gt i , ηl λ (cid:0)1 − ηl λ (cid:1)K−1−k = γ = 1 − (1 − ηl λ )K. 21 (11) Published as a conference paper at ICLR 2023 Proof 1 According to the update rule of Line.11 in Algorithm Algorithm 1, we have: δk = ∆t i,k−1 = xt i,k − ∆t (cid:0) ̃gt i,k−1 i,k − xt 1 λ (xt = −ηl i,k−1 − ˆgt−1 i + i,k−1 − xt i,0)(cid:1) = −ηl( ̃gt i,k−1 − ˆgt−1 i + 1 λ ∆t i,k−1). Then We can formulate the iterative relationship of ∆t i,k as: ∆t i,k = ∆t i,k−1 − ηl( ̃gt i,k−1 − ˆgt−1 i + 1 λ ∆t i,k−1) = (1 − ηl λ )∆t i,k−1 − ηl( ̃gt i,k−1 − ˆgt−1 i ). Taking the iteration on k and we have: i,K − xt xt i,0 = ∆t i,K = (1 − ηl λ )K∆t i,0 − ηl K−1 (cid:88) (1 − k=0 ηl λ )K−1−k( ̃gt i,k − ˆgt−1 i ) (a) = −ηl K−1 (cid:88) (1 − ηl λ )K−1−k( ̃gt i,k − ˆgt−1 i ) k=0 K−1 (cid:88) k=0 K−1 (cid:88) k=0 ηl λ ηl λ = −λ = −λ (1 − (1 − ηl λ ηl λ )K−1−k( ̃gt i,k − ˆgt−1 i ) )K−1−k ̃gt i,k + (cid:0)1 − (1 − ηl λ )K(cid:1)λˆgt−1 i = −λγ K−1 (cid:88) k=0 γk γ i,k + γλˆgt−1 ̃gt i . (a) applies ∆t i,0 = δt i,0 = 0. C.2 PROOF OF EQUATION (3) Equation (3) shows the update of the prox-correction term, which utilizes the weighted sum of the previous local offsets as a bias controller for eliminating the non-vanishing bias resulting from the prox-term. Lemma C.2 Under the update rule in Algorithm Algorithm 1, we have: where (cid:80)K−1 k=0 γk = (cid:80)K−1 k=0 i = (1 − γ)ˆgt−1 ˆgt i + γ K−1 (cid:88) k=0 γk γ ̃gt i,k. ηl λ (cid:0)1 − ηl λ (cid:1)K−1−k = γ = 1 − (1 − ηl λ )K. (12) Proof 2 According to the update rule of Line.13 in Algorithm Algorithm 1, we have: i = ˆgt−1 ˆgt i − 1 λ (xt i,K − xt i,0) (a) = ˆgt−1 i + = ˆgt−1 i + = ˆgt−1 i + ηl λ ηl λ ηl λ K−1 (cid:88) (cid:0)1 − k=0 K−1 (cid:88) (cid:0)1 − k=0 K−1 (cid:88) (cid:0)1 − k=0 (cid:1)K−1−k ηl λ ( ̃gt i,k − ˆgt−1 i ) ηl λ ηl λ (cid:1)K−1−k ̃gt i,k − (cid:1)K−1−k ̃gt i,k − ηl λ ηl λ (cid:16)K−1 (cid:88) (cid:0)1 − k=0 (cid:1)K−1−k(cid:17) ˆgt−1 i ηl λ 1 − (1 − ηl λ )K ηl λ ˆgt−1 i = (1 − ηl λ )K ˆgt−1 i + ηl λ K−1 (cid:88) (cid:0)1 − k=0 ηl λ (cid:1)K−1−k ̃gt i,k 22 Published as a conference paper at ICLR 2023 = (1 − γ)ˆgt−1 i + γ K−1 (cid:88) k=0 γk γ ̃gt i,k. (a) applies the Lemma C.1. C.3 PROOF OF EQUATION (4) AND (5) Lemma C.3 Considering the ut+1 = 1 m last iteration of local clients at time t, the auxiliary sequence (cid:8)zt = ut + 1−γ satisfies the update rule as: i∈[m] xt i,K is the mean averaged parameters among the γ (ut − ut−1)(cid:9) t>0 (cid:80) zt+1 = zt − λ 1 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ ̃gt i,k. (13) Proof 3 Firstly, according to the lemma C.1 and Line.14 and Line.16 in Algorithm 1, we have: ut+1 − ut = = = 1 m 1 m 1 m (cid:88) i∈[m] (cid:88) i∈[m] (xt i,K − xt−1 i,K ) (xt i,K − xt i,0 − λˆgt−1 i ) (cid:88) (−λγ i∈[m] K−1 (cid:88) k=0 γk γ i,k + λγ ˆgt ̃gt i − λˆgt−1 i ) = −λ 1 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ (cid:0)γ ̃gt i,k + (1 − γ)ˆgt−1 i (cid:1) . This could be considered as a momentum-like term with the coefficient of γ. Here we define a virtual observation sequence {ut} and its update rule is: i,k+1 = ut ut i,k − λ ut+1 i,0 = ut+1 = γk γ 1 m (cid:0)γ ̃gt i,k + (1 − γ)ˆgt−1 i (cid:1) , (cid:88) i∈[m] ut i,K. According to the lemma C.2 and above update rule, we can get that: i = (1 − γ)ˆgt−1 ˆgt i + γ K−1 (cid:88) k=0 γk γ ̃gt i,k = − 1 λ (ut i,K − ut i,0) − γ K−1 (cid:88) k=0 γk γ ̃gt i,k + γ K−1 (cid:88) k=0 γk γ ̃gt i,k = − 1 λ (ut i,K − ut i,0). This function indicates that the virtual sequence ut could be considered as a momentum-based update method with a global correction term to guide the local update, and the correction term is calculated from the offset of the virtual observation sequence during the training process at round t. Then we expand the the auxiliary sequence zt as: zt+1 − zt = (ut+1 − ut) + 1 − γ γ (ut+1 − ut) − 1 − γ γ (ut − ut−1) 23 Published as a conference paper at ICLR 2023 = 1 γ (ut+1 − ut) − 1 − γ γ (ut − ut−1) = −λ = −λ = −λ = −λ = −λ = −λ 1 m 1 m 1 m 1 m 1 m 1 m (cid:32) (cid:16)K−1 (cid:88) (cid:88) i∈[m] k=0 (cid:88) K−1 (cid:88) i∈[m] k=0 (cid:88) K−1 (cid:88) i∈[m] k=0 (cid:88) K−1 (cid:88) i∈[m] k=0 (cid:88) K−1 (cid:88) i∈[m] k=0 (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ γk γ γk γ γk γ γk γ (cid:17) + ̃gt i,k γk γ 1 − γ γ (cid:33) ˆgt−1 i − 1 − γ γ (ut − ut−1) ̃gt i,k − 1 − γ γ 1 m (cid:88) i∈[m] λˆgt−1 i − 1 − γ γ (ut − ut−1) (cid:88) (ut − ut−1 + λˆgt−1 i ) i∈[m] (cid:88) (xt−1 i,K − xt−2 i,K + λˆgt−1 i ) i∈[m] (cid:88) (xt−1 i,K − xt−1 i,0 + λˆgt−1 i − λˆgt−2 i ) i∈[m] ̃gt i,k − 1 − γ γ 1 m ̃gt i,k − 1 − γ γ 1 m ̃gt i,k − 1 − γ γ 1 m ̃gt i,k. C.4 PROOF OF THEOREM 4.5 Firstly we state some important lemmas applied in the proof. Lemma C.4 (Bounded global update) The global update 1 m Et∥ 1 m (cid:88) i∈[m] ˆgt−1 i ∥2 ≤  Et∥ 1 m 1 γ (cid:88) i∈[m] ˆgt−1 i ∥2 − Et∥ 1 m (cid:88) i∈[m] (cid:80) i∈[m] ˆgt   + Et∥ i∥2 ˆgt i holds the upper bound of: 1 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ i,k∥2. ̃gt Proof 4 According to the lemma C.2,we have: 1 m (cid:88) i∈[m] ˆgt i = (1 − γ) 1 m (cid:88) i∈[m] ˆgt−1 i + γ 1 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ ̃gt i,k. Take the L2-norm and we have: ∥ 1 m (cid:88) i∈[m] i∥2 = ∥(1 − γ) ˆgt ≤ (1 − γ)∥ 1 m 1 m (cid:88) i∈[m] (cid:88) i∈[m] ˆgt−1 i + γ 1 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ i,k∥2 ̃gt ˆgt−1 i ∥2 + γ∥ 1 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ i,k∥2. ̃gt Thus we have the following recursion, Et∥ 1 m (cid:88) i∈[m] ˆgt−1 i ∥2 ≤  Et∥ 1 m 1 γ (cid:88) i∈[m] ˆgt−1 i ∥2 − Et∥ 1 m (cid:88) i∥2 ˆgt i∈[m]   + Et∥ 1 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ i,k∥2. ̃gt 24 Published as a conference paper at ICLR 2023 Lemma C.5 (Bounded local update) The local update ˆgt i holds the upper bound of: 1 m (cid:88) i∈[m] Et∥ˆgt−1 i ∥2 ≤ P γ 1 m (cid:88) i∈[m] (cid:0)Et∥ˆgt−1 i ∥2 − Et∥ˆgt i∥2(cid:1) + 24P L2 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ Et∥xt i,k − xt∥2 + 12P Et∥∇F (zt)∥2 + P (12σ2 g + σ2 l ), where 1 P = 1 − 24λ2L2(1−2γ)2 γ2 . Proof 5 According to the lemmaC.2, we have: i = (1 − γ)ˆgt−1 ˆgt i + γ K−1 (cid:88) k=0 γk γ ̃gt i,k. Take the L2-norm and we have: ∥ˆgt i∥2 = ∥(1 − γ)ˆgt−1 i + γ K−1 (cid:88) k=0 γk γ i,k∥2 ̃gt (a) ≤ (1 − γ)∥ˆgt−1 i ∥2 + γ∥ K−1 (cid:88) k=0 γk γ i,k∥2 ̃gt (b) ≤ (1 − γ)∥ˆgt−1 i ∥2 + γ K−1 (cid:88) k=0 γk γ ∥ ̃gt i,k∥2 = (1 − γ)∥ˆgt−1 i ∥2 + K−1 (cid:88) k=0 γk∥ ̃gt i,k∥2. (a) and (b) apply the Jensen inequality. Thus we have the following recursion: 1 m (cid:88) i∈[m] Et∥ˆgt−1 i ∥2 ≤ 1 γ 1 m (cid:88) i∈[m] (cid:0)Et∥ˆgt−1 i ∥2 − Et∥ˆgt i∥2(cid:1) + 1 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ Et∥ ̃gt i,k∥2. Here we provide a loose upper bound as a constant for the quasi-stochastic gradient: 1 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ Et∥ ̃gt i,k∥2 = = ≤ ≤ ≤ 1 m 1 m 2 m 2 m 4 m (cid:88) K−1 (cid:88) i∈[m] k=0 (cid:88) K−1 (cid:88) i∈[m] k=0 (cid:88) K−1 (cid:88) i∈[m] k=0 (cid:88) K−1 (cid:88) i∈[m] k=0 (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ γk γ γk γ γk γ γk γ Et∥(1 − α)gt i,k,1 + αgt i,k,2∥2 Et∥gt i,k,1 + α(gt i,k,2 − gt i,k,1)∥2 (cid:0)Et∥∇Fi(xt i,k)∥2 + α2Et∥∇Fi( ̆xt i,k) − ∇Fi(xt i,k)∥2(cid:1) + σ2 l (cid:0)Et∥∇Fi(xt i,k)∥2 + α2L2ρ2Et∥∇Fi(xt i,k)∥2(cid:1) + σ2 l Et∥∇Fi(xt i,k) − ∇Fi(zt) + ∇Fi(zt) − ∇F (zt) + ∇F (zt)∥2 + σ2 l 25 Published as a conference paper at ICLR 2023 (cid:88) K−1 (cid:88) i∈[m] k=0 (cid:88) K−1 (cid:88) ≤ ≤ ≤ ≤ 12L2 m 12L2 m 24L2 m 24L2 m γk γ γk γ γk γ i∈[m] k=0 + 12Et∥∇F (zt)∥2 + (12σ2 K−1 (cid:88) (cid:88) g + σ2 l ) k=0 i∈[m] + 12Et∥∇F (zt)∥2 (cid:88) K−1 (cid:88) i∈[m] k=0 + 12Et∥∇F (zt)∥2 + (12σ2 g + σ2 l ). γk γ Et∥xt i,k − zt∥2 + 12Et∥∇F (zt)∥2 + (12σ2 g + σ2 l ) Et∥xt i,k − xt + xt − ut + ut − zt∥2 Et∥xt i,k − xt∥2 + 24L2∥xt − ut + ut − zt∥2 + (12σ2 g + σ2 l ) Et∥xt i,k − xt∥2 + 24L2λ2(1 − 2γ)2 γ2 1 m (cid:88) i Et∥ˆgt−1 i ∥2 We applies the Jensen inequality, the basic inequality ∥ (cid:80)n bound of ρ ≤ 1 αL . Combining the above inequalities, let 1 have: i=1 ai∥2 ≤ n (cid:80)n P = 1 − 24L2λ2(1−2γ2) i=1 ∥ai∥2, and the upper is the constant, we γ2 1 m (cid:88) i∈[m] Et∥ˆgt−1 i ∥2 ≤ P γ 1 m (cid:88) i∈[m] (cid:0)Et∥ˆgt−1 i ∥2 − Et∥ˆgt i∥2(cid:1) + 24P L2 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ Et∥xt i,k − xt∥2 + 12P Et∥∇F (zt)∥2 + P (12σ2 g + σ2 l ). C.4.1 L-SMOOTHNESS OF THE FUNCTION F For the general non-convex case, according to the Assumptions and the smoothness of F , we take the conditional expectation at round t + 1 and expand the F (zt+1) as: Et[F (zt+1)] ≤ F (zt) + Et⟨∇F (zt), zt+1 − zt⟩ + Et∥zt+1 − zt∥2 L 2 L = F (zt) + ⟨∇F (zt), Et[zt+1] − zt⟩ + 2 K−1 (cid:88) = F (zt) + Et⟨∇F (zt), −λ (cid:88) 1 m i∈[m] k=0 Et∥zt+1 − zt∥2 γk γ ̃gt i,k⟩ + L 2 Et∥zt+1 − zt∥2 1 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ i,k − ∇F (zt) + ∇F (zt)⟩ ̃gt = F (zt) − λEt⟨∇F (zt), + L 2 Et∥zt+1 − zt∥2 = F (zt) − λ∥∇F (zt)∥2 −λEt⟨∇F (zt), (cid:124) + L 2 Et∥zt+1 − zt∥2 (cid:123)(cid:122) (cid:125) (cid:124) R2 . γk γ 1 m (cid:88) K−1 (cid:88) k=0 i∈[m] (cid:123)(cid:122) R1 i,k − ∇F (zt)⟩ ̃gt (cid:125) 26 Published as a conference paper at ICLR 2023 C.4.2 BOUNDED R1 Note that R1 can be bounded as: R1 = −λEt⟨∇F (zt), (a) = −λEt⟨∇F (zt), 1 m 1 m (cid:88) K−1 (cid:88) i∈[m] k=0 (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ i,k − ∇F (zt)⟩ ̃gt γk γ ̃gt i,k − 1 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ ∇Fi(zt)⟩ (b) = (c) ≤ λ 2 λ 2 ∥∇F (zt)∥2 + ∥∇F (zt)∥2 + λ 2 λ 2 Et∥ 1 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ (cid:0)E ̃gt i,k − ∇Fi(zt)(cid:1)∥2 − λ 2m2 Et∥ (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ E ̃gt i,k∥2 (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ 1 m (cid:124) Et∥E ̃gt i,k − ∇Fi(zt)∥2 − (cid:123)(cid:122) R1.a (cid:125) λ 2m2 Et∥ (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ E ̃gt i,k∥2. (cid:80) i∈[m] ∇Fi(zt) = ∇F (zt). (b) applies −⟨x, y⟩ = 1 2 (a) applies the fact that 1 m ∥x + y∥2(cid:1). (c) applies the Jensen's inequality and the fact that (cid:80)K−1 According to the update rule we have: (cid:3) + αE (cid:2)gt i,k,2 i,k) + α∇Fi( ̆xt (cid:3) = (1 − α)E (cid:2)∇Fi(xt i,k) = (1 − α)∇Fi(xt i,k,1 = (1 − α)∇Fi(xt i,k = (1 − α)E (cid:2)gt E ̃gt k=0 i,k; εt i,k) + α∇Fi(xt γk γ = 1. i,k)(cid:3) + αE (cid:2)∇Fi( ̆xt i,k; εt i,k)(cid:3) i,k + ρgt i,k,1). (cid:0)∥x∥2 + ∥y∥2 − Let ρ ≤ 1√ 3αL , thus we could bound the term R1.a as follows: 1 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ Et∥E ̃gt i,k − ∇Fi(zt)∥2 = = ≤ ≤ = ≤ 1 m 1 m 2 m (cid:88) K−1 (cid:88) i∈[m] k=0 (cid:88) K−1 (cid:88) i∈[m] k=0 (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ γk γ γk γ Et∥(1 − α)∇Fi(xt i,k) + α∇Fi(xt i,k + ρgt i,k,1) − ∇Fi(zt)∥2 Et∥∇Fi(xt i,k) − ∇Fi(zt) + α (cid:16) ∇Fi(xt i,k + ρgt i,k,1) − ∇Fi(xt i,k) (cid:17) ∥2 Et∥∇Fi(xt i,k) − ∇Fi(zt)∥2 + 2α2 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ Et∥∇Fi( ̆xt i,k) − ∇Fi(xt i,k)∥2 2L2 m 2L2 m 4L2 m (cid:88) K−1 (cid:88) i∈[m] k=0 (cid:88) K−1 (cid:88) i∈[m] k=0 (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ γk γ γk γ Et∥xt i,k − zt∥2 + 2α2L2ρ2 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ Et∥gt i,k,1∥2 Et∥xt i,k − xt + xt − ut + ut − zt∥2 + 2α2L2ρ2 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ Et∥gt i,k,1∥2 Et∥xt i,k − xt∥2 + 4L2 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ Et∥(xt − ut) + (ut − zt)∥2 + 2α2L2ρ2 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ Et∥gt i,k,1 − ∇Fi(xt i,k)∥2 + 2α2L2ρ2 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ Et∥∇Fi(xt i,k)∥2 ≤ 4L2 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ Et∥xt i,k − xt∥2 + 2α2L2ρ2 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ Et∥∇Fi(xt i,k)∥2 + 2α2L2ρ2σ2 l 27 Published as a conference paper at ICLR 2023 + 4L2Et∥(xt − ut) + (ut − zt)∥2 = 4L2 m (cid:88) K−1 (cid:88) i∈[m] γk γ Et∥xt i,k − xt∥2 + 2α2L2ρ2 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ Et∥∇Fi(xt i,k)∥2 + 2α2L2ρ2σ2 l + 4L2Et∥ − k=0 1 m (cid:88) i∈[m] λˆgt−1 i + γ − 1 γ (ut − ut−1)∥2 (cid:88) K−1 (cid:88) = 4L2 m i∈[m] + 4L2Et∥ k=0 1 m i∈[m] γk γ Et∥xt i,k − xt∥2 + 2α2L2ρ2 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ Et∥∇Fi(xt i,k)∥2 + 2α2L2ρ2σ2 l (cid:88) (cid:16) (ut − ut−1 + λˆgt−1 i ) − 1 γ (ut − ut−1 + λˆgt−1 i ) + ( 1 − 2γ γ )λˆgt−1 i (cid:17) ∥2 = 4L2 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ Et∥xt i,k − xt∥2 + 2α2L2ρ2 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ Et∥∇Fi(xt i,k)∥2 + 2α2L2ρ2σ2 l + 4λ2L2(1 − 2γ)2 γ2 Et∥ 1 m (cid:88) i∈[m] ˆgt−1 i ∥2 = 4L2 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ Et∥xt i,k − xt∥2 + 4λ2L2(1 − 2γ)2 γ2 Et∥ 1 m (cid:88) i∈[m] ˆgt−1 i ∥2 + 2α2L2ρ2σ2 l + 2α2L2ρ2 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ Et∥∇Fi(xt i,k) − ∇Fi(zt) + ∇Fi(zt) − ∇F (zt) + ∇F (zt)∥2 (a) ≤ 4L2 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ Et∥xt i,k − xt∥2 + 4λ2L2(1 − 2γ)2 γ2 Et∥ 1 m (cid:88) i∈[m] ˆgt−1 i ∥2 + 2α2L2ρ2σ2 l + 2L2 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ Et∥xt i,k − zt∥2 + 6α2L2ρ2σ2 g + 6α2L2ρ2Et∥∇F (zt)∥2 (cid:88) K−1 (cid:88) ≤ 8L2 m k=0 i∈[m] + 6α2L2ρ2σ2 g + 6α2L2ρ2Et∥∇F (zt)∥2. γk γ Et∥xt i,k − xt∥2 + 8λ2L2(1 − 2γ)2 γ2 Et∥ 1 m (cid:88) i∈[m] ˆgt−1 i ∥2 + 2α2L2ρ2σ2 l (b) ≤ 8L2 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ Et∥xt i,k − xt∥2 + 8λ2L2(1 − 2γ)2 γ3  Et∥ 1 m (cid:88) i∈[m] ˆgt−1 i ∥2 − Et∥  i∥2 ˆgt  1 m (cid:88) i∈[m] + 8λ2L2(1 − 2γ)2 γ2 Et∥ 1 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ i,k∥2 + 2α2L2ρ2σ2 ̃gt l + 6α2L2ρ2σ2 g + 6α2L2ρ2Et∥∇F (zt)∥2. (a) applies the bound of ρ as ρ ≤ 1√ E[x − E[x]]2 = E[x2] − [E[x]]2 and ∥x + y∥2 ≤ (1 + a)∥x∥2 + (1 + 1 3αL . (b) applies the lemma C.4. These others use the fact a )∥y∥2. We denote ct = 1 m updates, we firstly consider the ct i∈m (cid:80) (cid:80)K−1 k=0 (γk/γ)Et∥xt (cid:80) i∈m i,k − xt∥2 term as the local offset after k iterations Et∥xt i,k − xt∥2 and it can be bounded as: k = 1 m 1 m (cid:88) i∈[m] ct k = = 1 m 1 m (cid:88) i∈[m] (cid:88) i∈[m] Et∥xt i,k − xt∥2 = Et∥xt i,k − xt i,k−1 + xt i,k−1 − xt i,0∥2 Et∥ − ηl( ̃gt i,k−1 − ˆgt−1 i ) + (1 − ηl λ )(xt i,k−1 − xt i,0)∥2 28 Published as a conference paper at ICLR 2023 ≤ (1 + a)(1 − ηl λ )2 1 m (cid:88) i∈[m] Et∥xt i,k−1 − xt i,0∥2 + (1 + 1 a ) η2 l m (cid:88) i∈[m] Et∥ ̃gt i,k−1 − ˆgt−1 i ∥2 = (1 + a)(1 − ηl λ )2ct k−1 + (1 + 1 a ) η2 l m (cid:88) i∈[m] Et∥(1 − α)gt i,k−1,1 + αgt i,k−1,2 − ˆgt−1 i ∥2 = (1 + 1 a ) η2 l m (cid:88) i∈[m] Et∥∇Fi(xt i,k−1) − ˆgt−1 i + α(∇Fi( ̆xt i,k−1) − ∇Fi(xt i,k−1))∥2 (cid:0)Et∥∇Fi(xt i,k−1)∥2 + Et∥ˆgt−1 i ∥2 + α2L2ρ2Et∥∇Fi(xt i,k−1)∥2(cid:1) (cid:88) i∈[m] 1 a ) 3η2 l m (cid:88) i∈[m] Et∥ˆgt−1 i ∥2 + (1 + 1 a )η2 l σ2 l )η2 l σ2 l + (1 + a)(1 − ηl λ )2ct k−1 )η2 l σ2 l + (1 + a)(1 − ηl λ )2ct k−1 (cid:88) Et∥∇Fi(xt i,k−1)∥2 + (1 + + (1 + ≤ (1 + 1 a + (1 + ≤ (1 + 1 a 1 a 3η2 l m ) 1 a 4η2 l m ) ≤ (1 + 1 a ) 4η2 l m i∈[m] ηl λ (cid:88) i∈[m] + (1 + a)(1 − )2ct k−1 Et∥∇Fi(xt i,k−1) − ∇Fi(xt) + ∇Fi(xt) − ∇Fi(zt) + ∇Fi(zt) − ∇F (zt) + ∇F (zt)∥2 + (1 + 1 a ) 3η2 l m (cid:88) i∈[m] Et∥ˆgt−1 i ∥2 + (1 + 1 a )η2 l σ2 l + (1 + a)(1 − ηl λ )2ct k−1 ≤ (1 + 1 a ) 16η2 l L2 m (cid:88) i∈[m] Et∥xt i,k−1 − xt∥2 + (1 + 1 a )16η2 l L2∥xt − zt∥2 + (1 + 1 a )η2 l (16σ2 g + σ2 l ) )16η2 l ∥∇F (zt)∥2 + (1 + 1 a ) 3η2 l m (cid:88) i∈[m] Et∥ˆgt−1 i ∥2 + (1 + a)(1 − ηl λ )2ct k−1 ≤ (1 + a)(1 − ηl λ )2 + (1 + (cid:21) )16η2 l L2 1 a ct k−1 + (1 + 1 a )η2 l (16σ2 )16η2 l Et∥∇F (zt)∥2 + (1 + (cid:20) 3 + 1 a )η2 l 16λ2L2(1 − 2γ)2 γ2 g + σ2 l ) (cid:21) 1 m (cid:88) i∈[m] Et∥ˆgt−1 i ∥2 + (1 + 1 a (cid:20) + (1 + 1 a (cid:20) = (1 + a)(1 − ηl λ )2 + (1 + (cid:21) )16η2 l L2 1 a ct k−1 + (1 + )η2 l (16σ2 g + σ2 l ) + (1 + + (1 + + (1 + 1 a 1 a 1 a )η2 )16η2 l ) 1 l L2 (88P − 16) ct + (1 + a 1 )η2 a (cid:0)Et∥ˆgt−1 Et∥∇F (zt)∥2 + (1 + (cid:88) l (P − 1) 3γ 1 m i 2η2 ) i∈[m] 1 a l (P − 1) 3 2η2 (12σ2 g + σ2 l ) l (44P − 8)Et∥∇F (zt)∥2 ∥2 − Et∥ˆgt i∥2(cid:1) When P satisfies the condition of P ≤ 2, which means 1 the constant of 2(P −1) 3 < 1, let the last 12σ2 3 ≤ 2 P = 1 − 24λ2L2(1−2γ)2 γ2 ≥ 1 2 , then we have g enlarged to 16σ2 g for convenience, we have: (cid:20) (1 + a)(1 − ct k ≤ ηl λ )2 + (1 + (cid:21) )16η2 l L2 1 a ct k−1 + 2(1 + 1 a 29 )η2 l (16σ2 g + σ2 l ) + 160(1 + 1 a )η2 l L2ct Published as a conference paper at ICLR 2023 96(1 + 1 a )η2 l Et∥∇F (zt)∥2 + 2(1 + 1 a ) η2 l γ 1 m (cid:88) i∈[m] (cid:0)Et∥ˆgt−1 i ∥2 − Et∥ˆgt i∥2(cid:1) . Here we get the recursion formula between the ct ct = (cid:80)K−1 k=0 (γk/γ)ct k, thus let the weight satisfies that: γK−2 γK−1 )2 + (1 + l L2 ≤ )16η2 ηl λ 1 a (1 + a)(1 − = γK−3 γK−2 = * * * = γ1 γ0 = 1 − ηl λ , k and ct k−1. Actually we need to upper bound the let ηl ≤ λ and thus we have: ct = K−1 (cid:88) k=0 γk γ ct k ≤ 2(1 + + 1 mγ 1 a ) η2 l γ (cid:88) i∈[m] K−1 (cid:88) ′ k −1 (cid:88)    γk  (cid:16) 16σ2 g + σ2 l + 48Et∥∇F (zt)∥2 + 80L2ct k=0 k′ =0 (cid:0)Et∥ˆgt−1 i ∥2 − Et∥ˆgt i∥2(cid:1)(cid:17) (a) ≤ 2(1 + 1 a K−1 (cid:88) (cid:32)K−1 (cid:88) )η2 l (cid:33) (cid:16) γk γ 16σ2 g + σ2 l + 48Et∥∇F (zt)∥2 + 80L2ct k=0 k′ =0 (cid:0)Et∥ˆgt−1 i ∥2 − Et∥ˆgt i∥2(cid:1)(cid:17) + 1 mγ (cid:88) i∈[m] = 2(1 + 1 a )η2 l K  16σ2 g + σ2 l + 48Et∥∇F (zt)∥2 + (cid:0)Et∥ˆgt−1 i ∥2 − Et∥ˆgt i∥2(cid:1)   1 mγ (cid:88) i∈[m] + 160(1 + 1 a )η2 l L2Kct. (a) enlarge the sum from k Let ηl satisfies the upper bound of ηl ≤ to K − 1 where k √ ′ ′ ≤ K − 1. 1 320(1+1/a)KL for convenience, we can bound the ct as: ct = 4(1 + 1 a )η2 l K  16σ2 g + σ2 l + 48Et∥∇F (zt)∥2 + (cid:0)Et∥ˆgt−1 i ∥2 − Et∥ˆgt i∥2(cid:1)  .  1 mγ (cid:88) i∈[m] Let the a satisfies a = 1 for convenience, we summarize the extra terms above and bound the term R1.a as: R1.a = 1 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ Et∥E[ ̃gt i,k] − ∇Fi(zt)∥2 ≤ 8L2ct + 8λ2L2(1 − 2γ)2 γ3  Et∥ 1 m (cid:88) i∈[m] ˆgt−1 i ∥2 − Et∥ 1 m (cid:88) i∥2 ˆgt i∈[m]   + 2α2L2ρ2σ2 l + 8λ2L2(1 − 2γ)2 γ2 Et∥ 1 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ i,k∥2 + 6α2L2ρ2σ2 ̃gt g + 6α2L2ρ2Et∥∇F (zt)∥2 ≤ 8λ2L2(1 − 2γ)2 γ3  Et∥ 1 m (cid:88) i∈[m] ˆgt−1 i ∥2 − Et∥ 1 m (cid:88) i∥2 ˆgt i∈[m]   + 2α2L2ρ2σ2 l + 6α2L2ρ2σ2 g 30 Published as a conference paper at ICLR 2023 + 8λ2L2(1 − 2γ)2 γ2 Et∥ 1 m (cid:88) K−1 (cid:88) γk γ i,k∥2 + ̃gt 64η2 l L2K mγ (cid:88) (cid:0)Et∥ˆgt−1 i ∥2 − Et∥ˆgt i∥2(cid:1) + 3072η2 i∈[m] l L2KEt∥∇F (zt)∥2 + 6α2L2ρ2Et∥∇F (zt)∥2 + 64η2 i∈[m] k=0 l L2K(16σ2 g + σ2 l ). thus we can bound the R1 as follow: R1 ≤ λ 2 Et∥∇F (zt)∥2 + λ 2 R1.a − λ 2m2 Et∥ (cid:88) K−1 (cid:88) i∈[m] k γk γ E[ ̃gt i,k]∥2 ≤ (cid:18) λ 2 + 3λα2L2ρ2 + 1536λη2 l L2K (cid:19) Et∥∇F (zt)∥2 + 32ληlL2K γm (cid:88) i∈[m] (cid:0)E∥ˆgt−1 i ∥2 − E∥ˆgt i∥2(cid:1) + 4λ3L2(1 − 2γ)2 γ3  Et∥ 1 m (cid:88) i∈[m] ˆgt−1 i ∥2 − Et∥ 1 m (cid:88) i∥2 ˆgt i∈[m]   + λα2L2ρ2(3σ2 g + σ2 l ) + 4λ3L2(1 − 2γ)2 γ2 Et∥ 1 m (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ i,k∥2 + 32λη2 ̃gt l L2K(16σ2 g + σ2 l ). We notice that R1 contains the same term with a negative weight, thus we can set another constrains for λ to eliminate this term. We will prove it in the next part. C.4.3 BOUNDED GLOBAL GRADIENT As we have bounded the term R1 and R2, according to the smoothness inequality, we combine the inequalities above and get the inequality: Et[F (zt+1)] ≤ F (zt) − λ∥∇F (zt)∥2 + R1 + L 2 R2 = F (zt) − (cid:18) λ 2 − 3λα2L2ρ2 − 1536λη2 l L2K (cid:19) ∥∇F (zt)∥2 + λα2L2ρ2(3σ2 g + σ2 l ) + (cid:16) 4λ3L2(1 − 2γ)2 γ2 + λ2L 2m2 − λ 2m2 (cid:17) Et∥ (cid:88) K−1 (cid:88) i∈[m] k=0 γk γ i,k∥2 ̃gt + 32ληlL2K γm (cid:88) (cid:0)E∥ˆgt−1 i i∈[m] ∥2 − E∥ˆgt i∥2(cid:1) + 32λη2 l L2K(16σ2 g + σ2 l ) + 4λ3L2(1 − 2γ)2 γ3  Et∥ 1 m (cid:88) i∈[m] ˆgt−1 i ∥2 − Et∥  i∥2 ˆgt  . 1 m (cid:88) i∈[m] We follow as Yang et al. (2021) to set λ that it satisfies 4λ3L2(1−2γ)2 2m2 ≤ 0, which is easy to verified that λ has a upper bound for the quadratic inequality. Thus, the stochastic gradient term is diminished by this λ. We denote the constant λκ = λ l L2K and κ 2 − 3λα2L2ρ2 − 1536λη2 could be considered as a constant. We can select two constants c1 ∈ (0, 1 2 ), c2 ∈ (0, 1 2 ) and they 2 − c1 and 1 satisfy c1 + c2 ∈ (0, 1 l L2K > 1 2 − 1536η2 2 − c2, where c2 < the ρ and ηl satisfy ρ < . Then we can bound the 6KL κ = 1 κ < which is a constant upper bound. 2 ), we let 1 2 − 3α2L2ρ2 > 1 √ c1√ < 1√ and ηl < 3αL 6αL l L2K > 1 2 − 3α2L2ρ2 − 1536η2 2 − c1 − c2 > 0, and the term 1 2 1−2c1−2c2 2m2 − λ 1 √ 3KL + λ2L √ √ γ2 32 16 We take the full expectation on the bounded global gradient as: 32ληlL2K γm λκE∥∇F (zt)∥2 ≤ (cid:0)EF (zt) − EF (zt+1)(cid:1) + (cid:0)E∥ˆgt−1 i ∥2 − E∥ˆgt i∥2(cid:1) (cid:88) i∈[m] 31 Published as a conference paper at ICLR 2023 + 4λ3L2(1 − 2γ)2 γ3  Et∥ 1 m (cid:88) i∈[m] ˆgt−1 i ∥2 − Et∥  i∥2 ˆgt  1 m (cid:88) i∈[m] + 32λη2 l L2K(16σ2 g + σ2 l ) + λα2L2ρ2(3σ2 g + σ2 l ). Take the full expectation and telescope sum on the inequality above and applying the fact that F ∗ ≤ F (x) for x ∈ Rd, we have: 1 T T −1 (cid:88) t=1 Et∥∇F (zt)∥2 ≤ 1 λκT (cid:0)F (z1) − Et[F (zT )](cid:1) + 32ηlL2K κγmT (cid:88) i∈[m] (cid:0)E∥ˆg0 i ∥2 − E∥ˆgt i∥2(cid:1) + 4λ2L2(1 − 2γ)2 κγ3T  Et∥ 1 m (cid:88) i∈[m] i ∥2 − Et∥ ˆg0  i∥2 ˆgt  1 m (cid:88) i∈[m] + 1 κ 1 λκT ≤ (cid:0)32λη2 l L2K(16σ2 g + σ2 l ) + λα2L2ρ2(3σ2 g + σ2 l )(cid:1) (cid:0)F (z0) − F ∗)(cid:1) + 32ηlL2K κγmT (cid:88) i∈[m] E∥ˆg0 i ∥2 + + 4λ2L2(1 − 2γ)2 κγ3T Et∥ 1 m (cid:88) i ∥2 ˆg0 i∈[m] 1 κ (cid:0)32λη2 l L2K(16σ2 g + σ2 l ) + λα2L2ρ2(3σ2 g + σ2 l )(cid:1) Here we summarize the conditions and some constrains in the above conclusion. Firstly we should note that γ = 1 − (1 − ηl λ )K < 1 when ηl ≤ 2λ. Thus we have 1/γ > 1. When K satisfies that K ≥ λ e−1 < 2. To let ηl κ = 1 1 √ 3KL λ K ≤ e−1, and then γ > 1 − e−1 and 1/γ < e and ηl < , (1 − ηl 2 − 3α2L2ρ2 − 1536η2 l L2K > 0 hold, ρ and ηl satisfy that ρ < 1√ λ )K ≤ e− ηl 6αL 32 . 1 T T −1 (cid:88) t=1 E∥∇F (zt)∥2 ≤ 2(F (z1) − F ∗) λκT + 64ηlL2K κT 1 m (cid:88) i∈[m] E∥ˆg0 i ∥2 + 32λ2L2 κT Et∥ 1 m (cid:88) ˆg0 i ∥2 i∈[m] + 1 κ (cid:0)32λη2 l L2K(16σ2 g + σ2 l ) + λα2L2ρ2(3σ2 g + σ2 l )(cid:1) . 32
http://arxiv.org/abs/2302.10428v1
2023-02-21T03:51:52
2023-02-21T03:51:52
A Dynamic Temporal Self-attention Graph Convolutional Network for Traffic Prediction
Accurate traffic prediction in real time plays an important role in Intelligent Transportation System (ITS) and travel navigation guidance. There have been many attempts to predict short-term traffic status which consider the spatial and temporal dependencies of traffic information such as temporal graph convolutional network (T-GCN) model and convolutional long short-term memory (Conv-LSTM) model. However, most existing methods use simple adjacent matrix consisting of 0 and 1 to capture the spatial dependence which can not meticulously describe the urban road network topological structure and the law of dynamic change with time. In order to tackle the problem, this paper proposes a dynamic temporal self-attention graph convolutional network (DT-SGN) model which considers the adjacent matrix as a trainable attention score matrix and adapts network parameters to different inputs. Specially, self-attention graph convolutional network (SGN) is chosen to capture the spatial dependence and the dynamic gated recurrent unit (Dynamic-GRU) is chosen to capture temporal dependence and learn dynamic changes of input data. Experiments demonstrate the superiority of our method over state-of-art model-driven model and data-driven models on real-world traffic datasets.
[ "Ruiyuan Jiang", "Shangbo Wang", "Yuli Zhang" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10428v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10428v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
A Dynamic Temporal Self-attention Graph Convolutional Network for Traffic Prediction Ruiyuan Jiang, Shangbo Wang, Member, IEEE, Yuli Zhang 3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 8 2 4 0 1 . 2 0 3 2 : v i X r a Abstract-Accurate traffic prediction in real time plays an important role in Intelligent Transportation System (ITS) and travel navigation guidance. There have been many attempts to predict short-term traffic status which consider the spatial and temporal dependencies of traffic information such as temporal graph convolutional network (T-GCN) model and convolutional long short-term memory (Conv-LSTM) model. However, most existing methods use simple adjacent matrix consisting of 0 and 1 to capture the spatial dependence which can not meticulously describe the urban road network topological structure and the law of dynamic change with time. In order to tackle the problem, this paper proposes a dynamic temporal self-attention graph convolutional network (DT-SGN) model which considers the adjacent matrix as a trainable attention score matrix and adapts network parameters to different inputs. Specially, self- attention graph convolutional network (SGN) is chosen to capture the spatial dependence and the dynamic gated recurrent unit (Dynamic-GRU) is chosen to capture temporal dependence and learn dynamic changes of input data. Experiments demonstrate the superiority of our method over state-of-art model-driven model and data-driven models on real-world traffic datasets. Index Terms-Traffic prediction, self-attention, dynamic net- work parameter, spatial dependence, temporal dependence, in- telligent transportation system (ITS). I. INTRODUCTION W Ith the exponential growth of population, the usage of vehicles has increased significantly in the past few years. To better improve the efficiency of urban transportation networks, traffic prediction technique has received more and more attention which plays a key role in Intelligent Trans- portation System (ITS). In urban networks, traffic information such as flow, speed and density can be considered as a spatiotemporal data collected from multiple sensors. Making prediction on these time series serves as a foundation to many real-world applications [1]. For example, online traffic prediction is critical in many applications such as vehicle navigation system [2], predictive bus control framework [3] and travel time estimation. However, considering the complex temporal and spatial dependencies of traffic data, making accurate and reliable predictions has been a challenge task. Most time series models such as Autoregressive Integrated Moving Average (ARIMA) [4] and Gated Recurrent Unit (GRU) [5] mainly learn and preserve temporal correlations of traffic data. In contrast, some models were proposed to capture the spatial dependence to improve the model performance. For example, Graph Convolutional Network (GCN) [6] can utilize spatial correlations among sensors through adjacency matrix. In addition, data collected by nearby loop sensors tend to have similar temporal characteristics. Hence, some hybrid spatiotemporal prediction models such as Temporal Graph Convolutional Network (T-GCN) [7] and Traffic Graph Convolutional Long Short-term Memory (TGC-LSTM) [6] network were developed to focus on the temporal and spatial dependencies of traffic data. However, the existing traffic prediction methods have the following problems. Firstly, most methods capture the spatial correlations using a simple adjacency matrix. The adjacency matrix consists of 0 and 1, where 1 represents there is a connection between the two sensors where 0 denotes that there is no connection. So the adjacency matrix can only reflect the general network topology rather than accurately describe the spatial dependence between the tested sensors, which has a negative impact on the prediction accuracy. Secondly, most of the prevalent deep learning models perform inference in a static manner. That is, the model parameters are fixed after the training process, which may limit their representation power, efficiency and interpretability [8], [9]. To solve the above problems, we propose a dynamic tem- poral self-attention graph convolutional network (DT-SGN) in this paper which can describe the spatial correlation between selected sensors more accurately and make the model adapt- able to different inputs. Inspired by the recent research on tem- poral graph neural network [7] and dynamic neural networks [10], this model applies self-attention mechanism in T-GCN network and designs the framework of dynamic features to make the model parameters be dynamically rescaled according to the inputs to improve the efficiency. The main contributions of this paper are summarized as follows. 1) We proposed a novel self-attention GCN model to de- scribe the topology structure of the urban network. That is, we calculate the correlation coefficient between the selected road sections through multiplying the query and key of adjacency matrix, then use the coefficient matrix to replace the original adjacency matrix to further capture the spatial dependency of traffic data. Hence, the coefficient matrix can be considered as a trainable matrix which can be updated during model training process, so that the prediction performance can be improved. 2) We applied the attention mechanism on the output of GRU network for dynamic features, so that the spatial locations could be dynamically rescaled with attention to improve the representation power of the model. Moreover, the framework can adapt model parameters to different inputs which is effective in improving the representation power of networks with a minor increase of computational cost. 3) We tested the proposed model on two real-world traffic datasets, namely the SZ-taxi dataset and Los-Loop dataset. We compare our proposed model with other recent state-of- art models through extensive experiments and demonstrate the superiority and accurate performance of our model. The rest of the paper is organized as follows. In section II, we briefly review related work on model-driven and data- driven models for traffic prediction and the applications of attention mechanism in time series data prediction models. Section III introduces the DT-SGN framework and provides the methodology and formula derivation of our model. Sec- tion IV provides the extensive numerical experimental results conducted on the two real-world datasets, followed by the conclusion and future work in section V. II. RELATED WORK In this section, we review and summarize some related studies on modeling traffic data X ∈ RN ×T , where N is the number of time series and T is the number of time points. We will firstly introduce relevant work in traffic prediction. Then we will focus on the application of attention mechanism in time series prediction models. A. Traffic Prediction Models Various traffic prediction models have been investigated in existing literature which can be divided into two categories: the model-driven approaches and data-driven approaches. Firstly, the model-driven approaches mainly explain the instantaneous and steady-state relationships among traffic volume, speed and density [11]. As one of the most popular model-driven models, ARIMA (Autoregressive Integrated Moving Average) based models such as S-ARIMA [12] and ST-ARIMA [13] have raised great concern in traffic prediction. Besides ARIMA based models, the microscopic fundamental diagram model [14], the cell transmission model [15] were also applied in traffic forecasting. However, the existing model-driven models cannot describe the variations of traffic data in real-world environments. Secondly, data-driven models are used to predict and eval- uate the traffic state based on the historical data [16] [17]. In most recent years, novel deep learning-based traffic forecasting models such as deep bidirectional LSTM [18] and shared hidden LSTM [19]. In addition, CNN based methods including [20], [21] and [22] attempted to convert traffic status data into three-dimensional data, so that more effective features can be captured through novel models based on the CNN network. To better capture the temporal and spatial dependencies of traffic data, spatiotemporal prediction models such as GCN- DDGF [23], TGC-LSTM [6] and LSTM-GL-REMF [24] were proposed to utilize the temporal dependence in time series as well as capture the spatial correlation among sensors. Lin et al. designed GCN-DDGF (Graph Convolutional Neural Network with Data-Driven Graph Filter) in order to learn the spatial dependence through GCN based framework while Cui et al. proposed TGC-LSTM (Traffic Graph Convolutional Recurrent Neural Network) which defined spatial correlation based on traffic road network connectivity. In LSTM-GL-REMF, long short-term memory (LSTM) was chosen as the temporal regularizer to capture temporal dependency and Graph Lapla- cian (GL) served as the spatial regularizer to utilize spatial correlations to enhance the prediction performance. B. Attention Mechanism in Time Series Data Prediction Attention mechanism has been applied in time series data prediction combined with some deep learning models in recent researches. Kong et al. [25] employed a hierarchical exten- sion of the proposed ST-LSTM (HST-LSTM) in an encoder- decoder manner which modeled the contextual historic infor- mation in order to boost the prediction performance. Similarly, Zhang et al. [26] designed a Dual Attention-Based Federated Learning (FedDA) for wireless traffic prediction, by which a high-quality prediction model was trained collaboratively by multiple edge clients. In this framework, a dual attention scheme was proposed by aggregating the intra and inter- cluster models to construct the global model. Fu et al. [27] proposed a spatiotemporal attention mechanism followed by graph convolutions to model the local correlations and pat- terns between traffic sensors on the same arterial road. Jin et al. [28] put forward GAN-Based Short-Term Link traffic prediction under a parallel learning framework (PL-WGAN) for urban networks which added spatial-temporal attention mechanism to adjust the importance of different temporal and spatial contexts. In addition, Duan et al. [29] applied fully dynamic self-attention spatiotemporal graph network (FDSA- STG) by improving the attention mechanism using graph attention networks (GATs). This model jointly modified the GATs and the self-attention mechanism that fully dynamically focused and integrated spatial, temporal and periodic corre- lations. Wang et al. [30] proposed a novel spatial-temporal self-attention 3D network (STSANet) for video prediction, which integrated self-attention into 3D convolutional network to perceive contextual contents in semantic and spatiotemporal subspaces and narrows semantic and spatiotemporal gaps during saliency feature fusion. Chaabane et al. [31] used an adapted self-attention convolutional neural network to high- light the temporal evolution of land cover areas through the construction of a spatiotemporal map. This research proposed a new deep learning CNN based approach by introducing a self- attention mechanism that exploits both spatial and temporal dimension of image data. Kumar et al. [32] designed graph attention networks (GAT) to address the problem of treating all neighbors equally, which encoded the node of interest by using the weight features of its one-hot neighbors. Through it, local clustering coefficient solved the problem of unexplored intra-neighbor which can improve the model efficiency. III. METHODOLOGY In this section, we will firstly give a problem descrip- tion of this paper. Secondly, we introduce temporal graph convolutional (T-GCN) [7] network which serves as a basis to understand our methodology. Then we will introduce the can encode the topological structure of the road networks and the attributes on the roads to obtain the spatial dependence. Then the time series of spatial dependence are input into GRU network to capture the dynamic variation of traffic information on the roads for obtaining the temporal dependence. The output of GRU is eventually used as the prediction result. C. Dynamic Temporal Self-attention Graph Convolutional Network On the basis of T-GCN, we propose a novel dynamic tem- poral self-attention graph convolutional network (DT-SGN) for traffic prediction. The DT-SGN consists of two structures: self-attention graph convolutional network (SGN) and dynamic gated recurrent unit (Dynamic-GRU), where SGN can capture topological structure of urban networks and Dynamic-GRU is able to capture temporal dependence of the traffic data. 1) Self-attention graph neural network: To learn the spatial correlations of road sections, here we propose the self-attention graph convolutional network (SGN) model by employing a self-attention mechanism to model the spatial factor matrix. We use an adjacency matrix as the initial spatial score matrix in SGN, whose nodes represent the sensors, and whose edges represent dependency relationships between them. The adja- cency matrix includes two values 0 and 1, where 1 denotes there is a connection between the two corresponding road sections and 0 denotes that there is no connection between them. proposed dynamic temporal self-attention graph convolutional network (DT-SGN) model for traffic prediction task. A. Problem Description We assume a spatiotemporal setting for traffic data in this paper. In general, traffic data with N sensors and T time steps can be organized in a data matrix X ∈ RN ×T in which each row and column corresponds to a sensor and a time step respectively. As shown in Figure 1, the goal of our research is to predict traffic information in a certain period of time based on the observed data achieved in previous time steps. In experiment section, we use traffic speed data as an example of traffic information. Fig. 1. Overview of traffic state prediction B. Temporal Graph Convolutional Network As mentioned, traffic data is a two-dimensional matrix of temporal series and spatial series. Thus, traffic prediction has always been a challenge task due to its complex spatial and temporal dependencies. Different from some classical pre- diction models which only capture the temporal dependence of traffic information such as ARIMA and LSTM, or other models which capture the spatial dependence such as GCN, T-GCN integrates GCN and GRU to predict future traffic data. Fig. 3. Framework of SGN Figure 3 presents the framework of SGN network which can be controlled through the query and key generated from the adjacency matrix. Unlike classical GCN model [6], SGN de- scribes the correlation between road sections more accurately and extracts the road features according to the topological structure of the urban networks instead of directly using the adjacency matrix in a convolution layer. That is, based on the physical structure of sections connections, we scale up the correlation coefficients between sections with high spatial cor- relation while scale down the correlation coefficients between sections with low spatial correlation, so that the topological factors can be described as a matrix coefficients with a variety Fig. 2. Structure of T-GCN Figure 2 shows the specific structure of a T-GCN cell, ht−1 denotes the output at time t-1, ut, rt are update gate and reset gate at time t. As shown in Figure 2, T-GCN firstly uses GCN network to learn spatial features of traffic data which of values rather than the original matrix consisting of 0 and 1. To realize this, we use the concept of attention score to adjust the importance of different spatial contexts. The detailed methodology is shown as follows. Given the adjacency matrix A ∈ RN ×N , where Aij repre- sents the presence of a directed edge from section i to section j. Two weight matrices Wq and Wk are allocated for the adjacency matrix to achieve the query and key value, as shown below: Query = WqA Key = WkA (1) (2) Based on the query and key, we can extract the features of the road network structure through calculating the correlation of query and key. In this paper, we apply the attention mechanism to assess the correlation of the two matrices, as shown below: S = Sof tmax(QueryKeyT ) (3) where S represents the score matrix we use in model training, Sof tmax(*) is a normalized function. Based on the score matrix and the traffic data matrix X, we use the GCN model to construct a filter in the Fourier domain. Following the method proposed in [33], we firstly estimate the matrix with added self-connections (cid:101)S and the degree matrix (cid:101)D: (cid:101)S = (cid:101)S + IN (cid:88) (cid:101)D = (cid:103)Si,j (4) (5) j where IN is a N dimensional identity matrix. Then the SGN model can be built by stacking multiple convolutional layers, which can be expressed as: H n+1 = σ( (cid:101)D− 1 2 (cid:101)S (cid:101)D− 1 2 H nθn) Algorithm 1 Procedure of SGN Input: Traffic data matrix X; Adjacency matrix A; Output: Predicted value SG; 6: 7: 1: Initialize two weights Wq, Wk for adjacency matrix. 2: Initialize two weights W1, W2 for GCN network. 3: Set epochs = m. 4: for i = 0 to m do Query = WqA. 5: Key = WkA. S = sof tmax(QueryKeyT ). (cid:98)S = (cid:101)D− 1 SG = σ( (cid:98)SReLU ( (cid:98)SXW1)W2). Update Wq, Wk, W1 and W2. 8: 9: 10: 11: end for 12: Get predicted value SG based on updated weights. 13: return SG; 2 (cid:101)S (cid:101)D− 1 2 2) Dynamic gated recurrent unit: To capture the temporal dependence of traffic information, we design a dynamic gated recurrent unit (Dynamic-GRU) in this paper. According to the temporal changes of traffic information, we dynamically rescale the features through adapting parameters to different inputs, which can effectively improve the representation power of networks with a minor increase of computational cost [10] and improve the efficiency of the network. Figure 4 represents the concept of Dynamic-GRU network, where X denotes the input of Dynamic-GRU network, O represents the output of GRU network, Y is the output of Dynamic-GRU. We apply attention α mechanism on the output of a GRU network, which is equivalent to performing computation with re-weighted parameters: GRU (X, Θ) ⊗ α = GRU (X, Θ⊗α) (8) (6) where GRU denotes the process of GRU network, Θ is the GRU network parameters, ⊗ denotes the Kronecker product. where H n is the output of the nth layer, H n+1 is the output of the n+1hth lthayer, θn represents the model parameters of the nth layer. In this paper, we use two-layer GCN model [34] to cap- ture the spatial dependence of road networks, which can be expressed as: SG = σ( (cid:98)SReLU ( (cid:98)SXW1)W2) 2 (cid:101)S (cid:101)D− 1 where (cid:98)S = (cid:101)D− 1 2 represents pre-processing step, W1 is the weight matrix from input layer to hidden layer and W2 is the weights matrix from hidden layer to output layer, ReLU (*) represents the Rectified Linear Unit, SG ∈ RN ×l denotes the output value with the prediction length l. (7) Fig. 4. Concept of Dynamic-GRU In summary, we use the SGN model to capture the spatial dependence of traffic information. Attention score of adja- cency matrix is used in model training process while we can update the score matrix with two weights Wq and Wk in each training epoch, so that the matrix can better capture the feature of road sections networks. The procedure of SGN is shown Algorithm 1. The specific process is shown below. Xt represents the input of GRU network at time t, W and b represent the weights and bias in GRU training process, ht−1 denotes the output at time t-1, and ut, rt, ct are update gate, reset gate, cell gate at time t, and ht is the output at time t. ut = σ(Wu[Xt, ht−1] + bu) (9) rt = σ(Wr[Xt, ht−1] + br) ct = tanh(Wc[Xt, (rt ∗ ht−1)] + bc) ht = ut ∗ ht−1 + (1 − ut) ∗ ct (10) (11) (12) In the model training process, we update the model parame- ters in the structures to minimize the error between real traffic data and predicted value. The loss function of our network can be shown as below. Then, we add an attention layer on the output of hidden layer to rescale the features according to the input of the network. Instead of using pooling operations to efficiently gather global information in attention mechanism, we adopt convolutions to encode local information. Based on the hidden state H = h1, h2, * * * , hn obtained from GRU network, the weights of each characteristic αi can be obtained through the similarity of query and key value of hidden state: αi = Sof tmax( QhKh |Qh||Kh| ) (13) where Qh and Kh are query and key value of hidden state. And the attention function can be designed, the calculation of context containing local information is: Ct = n (cid:88) i=1 αi ∗ ht (14) Finally, we add a full-connected layer on the context and calculate the output of Dynamic-GRU network: Y = WGCt + bG (15) where WG and bG are weight and bias allocated for full- connected layer. 3) Dynamic temporal self-attention graph neural network: According to the temporal and spatial correlation of traffic information, we propose the dynamic temporal self-attention graph neural network (DT-SGN) in this research. The proposed model joins SGN and Dynamic-GRU in series to capture the spatial and temporal dependencies of traffic information simultaneously. As shown in Figure 5, the left side is the framework of SGN model and the right side is the frame- work of Dynamic-GRU model, where SA represents the self- attention score process, ht−1 denotes the output at time t-1, F C denotes the full-connected layer. Based on the framework shown in Figure 5, the specific process of the DT-SGN model is shown as below. According to the traffic data matrix X and the adjacency matrix A, we firstly apply SGN model to learn the spatial dependence of traffic information: Gt = SGN (Xt + εi,t) (16) where Gt represents the output of SGN network at time t, SGN (*) is the process of SGN network, Xt ∈ RN ×i is used to present the traffic data on each section at time i, εi,t is a zero-mean noise-term. Then we use the output of SGN as the input of Dynamic- GRU network, as shown below: (cid:98)Yt = DGRU (Gt)0 (17) where (cid:98)Yt represents the predicted output of Dynamic-GRU network, DGRU (*) denotes the process of Dynamic-GRU. 0L = ||Yt − (cid:98)Yt|| + λLreg (18) where Yt represents the real traffic data, (cid:98)Yt is the predicted value, λ is a hyper-parameter and Lreg is the L2 regularization term that helps to avoid an overfitting problem. In summary, the procedure of DT-SGN is shown in Algorithm 2. Algorithm 2 Procedure of DT-SGN Input: 0 Traffic data matrix X; Adjacency matrix A; Output: Predicted value Yt; 1: Initialize model parameters θs for SGN network. 2: Initialize model parameters θg for Dynamic-GRU net- 3: work, and WG, bG for the full connected layer. 4: Set epochs = n. 5: for i = 0 to n do 6: 7: 8: 9: 10: Train SGN (Algorithm 1) on data X, and capture spatial dependence as shown in Eq. (7) and get Gt. ht = GRU (Gt) as shown in Eq. (9) to Eq. (12). Ct = att(ht) as shown in Eq. (13) and Eq. (14). Yt = F C(Ct) as shown in Eq. (15). L = ||Yt − (cid:98)Yt|| + λLreg. Update θs, θg, WG and bG. 11: 12: 13: end for 14: Get predicted value Yt based on updated parameters. 15: return Yt; IV. EXPERIMENTS A. Data Description To demonstrate the superiority of our proposed model, we evaluate the performance of DT-SGN on two datasets: SZ-taxi dataset and Los-loop dataset. (1) SZ-taxi dataset: This dataset consists taxi trajectory data of Shenzhen from Jan. 1 to Jan. 31, 2015. The study area includes 156 road sections of Luohu District. This experi- mental dataset mainly consists of two parts. The first part is a two-dimensional matrix which describes the speed data of 156 selected road sections over time, where each row denotes one road and each column is the traffic speed on the roads in different time periods. We apply 15 minutes as the time interval between each time period. The second part is an 156 × 156 adjacency matrix which describes the basic topological structure of road network. Each row represents one road and the values in the matrix denotes the connectivity between the roads, where 1 represents the two roads are connected and 0 denotes the opposing situation. (2) Los-loop dataset: This dataset consists traffic speed data collected from 207 sensors in Los Angles County from Mar. 1 to Mar. 7, 2012. Similarly, the data consists of two parts, the first part is a two-dimensional matrix which describes the speed data collected from the selected sensors and the second part is an adjacency matrix which represents the connectivity Fig. 5. DT-SGN framework in road networks. We apply 5 minutes as the time interval between each time period. In the experiments, we use 80 percent of the data in the dataset as the training set and remaining data is used as the test data. In addition, the input data is normalized to the interval [0, 1] for the convenience of the calculation process. B. Evaluation Metrics We use five metrics to evaluate the prediction performance of the DT-SGN network: Root Mean Square Error (RMSE), Mean Absolute Error (MAE), Accuracy (ACC), Coefficient of Determination (R2), Explained Variance Score (var). Assume yi,j and ypred represent the real traffic speed and the predicted value of the jth time instant in the ith road; Y and Y pred respectively, ̄Y is the represent the the set of yi,j and ypred average of Y ; M is the number of sampling time instants, N is the number of roads. The metrics are respectively, computed by the following equations: i,j i,j (1) Root Mean Square Error (RMSE): (cid:118) (cid:117) (cid:117) (cid:116) RM SE = N (cid:88) M (cid:88) * 1 M N j=1 i=1 (yi,j − ypred i,j )2 (19) (2) Mean Absolute Error (MAE): M AE = 1 M N * M (cid:88) N (cid:88) j=1 i=1 |yi,j − ypred i,j | (20) (3) Accuracy (ACC): ACC = 1 − ||yi,j − ypred i,j ||yi,j||F ||F (4) Coefficient of Determination (R2): R2 = 1 − (cid:80)M (cid:80)N j=1 (cid:80)M j=1 i=1 (yi,j − ypred )2 (cid:80)N i=1 (yi,j − ̄Y )2 i,j (5) Explained Variance Score (var): V AR = 1 − fvar(Y − Y pred) fvar(Y ) (23) where fvar refers to the variance function. C. Baselines We compare the performance of DT-SGN with the following baseline methods: (1) Attention Temporal Graph Convolutional Network (A3T- GCN): As referred in [35], A3T-GCN captures the temporal dependence of data using GRU and learns the spatial de- pendence of data through GCN. Moreover, a self-attention is introduced to adjust the importance of different time points and assemble global temporal information; (2) Temporal Graph Convolutional Network (T-GCN): As referred in [7], T-GCN applies GCN and GRU integrated to capture the temporal and spatial dependencies of traffic speed data simultaneously; (3) Long Short-Term Memory (LSTM): LSTM has a strong ability to model time series data and normally has better pre- diction performance than linear models and shallow-learning models. (4) Bidirectional Gated Recurrent Unit (Bi-GRU): As shown in [36], similar to the use of LSTM, Bi-GRU can be seen as a structure that combines the forget and output gates which specializes in exploring temporal dynamics. (5) Autoregressive Integrated Moving Average (ARIMA): As referred in [4], ARIMA is a conventional time series model; (21) D. Model Parameters In this paper, we use the same datasets as referred in [7]. In [7], a series of experiments have been conducted on the hyper-parameter of prediction models. Hence, we refer to the experiment results to set the model parameters in our paper. We choose the following model parameters in experiments: (22) learning rate, batch size, training epoch and the number of GRU unit. In the experiment, we manually adjust and set the learning rate to 0.001, the batch size to 33, the training epoch to 200, the number of GRU unit to 32, as shown in Table 1: TABLE I Parameters learning rate batch size training epoch GRU unit Value 0.001 33 200 32 E. Modeling Results and Discussions To demonstrate the superiority of DT-SGN network, we show the prediction results of our model and compare the prediction0 performance00 of DT-SGN network with the se- lected baselines on two real-world datasets: SZ-taxi dataset and Los-loop dataset. (a) (b) (c) Fig. 6. Prediction performance of DT-SGN network for prediction horizon of 15 minutes on Los-loop dataset. (a) is the prediction performance of whole test time, (b) is the prediction performance from time 0 to time 80, (c) is the prediction performance from time 300 to time 400. 1) Los-loop dataset: Figure 6 shows the prediction result of DT-SGN model on Los-loop dataset, where the red curve represents the prediction results, the blue curve denotes the real data. From the overall situation shown in Figure 6 (a), it can be seen that the prediction results are in good agreement with the real data, which verifies the efficiency of DT-SGN network. Also, the curve of the prediction results is smoother than the curve of real data. It is mainly because that the GCN model uses a smooth filter to capture the spatial dependence through moving the filter constantly, which leads to a smaller change in the prediction results compared with the real data. From the detailed situation of Figure 6 (a), we find that the prediction accuracy is high when the data is steady, while the accuracy becomes lower when there is a sudden increase or decrease of data. To get better sense of the phenomenon, we zoom in on two phases in the test set that contain significant data fluctuations which are shown in Figure 6 (b) and Figure 6 (c), where we find that the differences between predicted value and the real data get larger where there is a sharp change in data. The main reason is that our proposed model is a data-driven model which predicts the future data based on historical data patterns. Hence, the prediction results is more like a regular smooth curve, so that when there is a large change in data, the prediction results will be delayed, leading to the low prediction accuracy. Then we compare the prediction performance of the DT- SGN model and baseline methods. Figure 7 shows the pre- diction performance given by RMSE and MAE, it can be seen that the DT-SGN network obtains the best prediction performance among all prediction methods, proving the effec- tiveness of spatiotemporal traffic prediction. Among all data- driven models, the RMSE error and MAE error of DT-SGN network are significantly lower than the other models, while prediction performances of A3T-GCN and T-GCN rank second and third respectively, which are far ahead of other models. Also, compared with ARIMA which is a model-driven model, DT-GCN demonstrates the obvious superiority according to the two metrics as well. To further compare the prediction efficiency of DT-SGN model and baselines, we apply accuracy, coefficient of deter- mination and explained variance score to evaluate the predic- tion performance of prediction models. As shown in Table II, the value of the three evaluation metrics of our proposed model remain the highest compared with the baselines. For example, ACC of DT-SGN are improved by approximately 1%, 14.5%, 10.6% compared with A3T-GCN, LSTM and ARIMA and R2 of DT-SGN are improved by approximately 4.5%, 5.2%, 227.2% compared with A3T-GCN, T-GCN and LSTM. Also, compared with A3T-GCN and T-GCN, V AR of DT-SGN are increased by 4.3% and 5.2%. Moreover, the superiority of T-GCN based models including DT-SGN, A3T-GCN and T- GCN is mainly due to the fact that the framework of such models capture the spatial and temporal dependencies of traffic information which can improve the prediction performance. 2) Sz-taxi dataset: Figure 8 shows the prediction result of DT-SGN model on Sz-taxi dataset, where the red curve represents the prediction results, the blue curve denotes the real data. From the blue curve in Figure 8 (a), it can be seen that the data of Sz-taxi dataset takes the form of constant oscillations, which shows high frequency and amplitude of change across the whole time line. Compared the prediction results with the real data, we find that the two curves are basically consistent, while the curve of prediction results generally appears below the curve of real data. To evaluate the prediction performance of DT-SGN in more detail, we take two pieces of data from the test set and compare them with the prediction value, as shown in Figure 8 (b) and Figure 8 (c). Figure 8 (b) shows the prediction results and real data from time instant 0 to time (a) (b) Fig. 7. Prediction capacity on Los-loop dataset. (a) is the RMSE of tested methods and (b) is the MAE of tested methods. Metric ACC R2 V AR DT-SGN A3T-GCN 0.9146 0.8679 0.8684 0.9036 0.8318 0.8322 TABLE II T-GCN 0.9016 0.8244 0.8260 LSTM 0.7987 0.2652 0.2654 Bi-GRU ARIMA 0.7983 0.2624 0.2854 0.8271 0.0214 0.002 instant 80 while Figure 8 (c) shows the prediction results and real data from time instant 300 to time instant 400. We find that compared to the frequency and amplitude of oscillation of real data, the two elements of prediction results significantly decrease, so that the curve of prediction results is smoother. The reason of this phenomenon is similar to that we show in the above which is caused by the smooth filter of GCN network. Figure 9 shows the prediction performance of DT-SGN and baseline methods given by RMSE and MAE on Sz-taxi dataset. It can be seen that the RMSE error and MAE error of DT-SGN network are the smallest among all methods. The prediction performance of DT-SGN is slightly better than that of Bi-GRU while RMSE and MAE of DT-SGN are 4.3997 and 2.9236, RMSE and MAE of Bi-GRU are 4.4108 and 3.1507. Similarly, DT-SGN is superior to A3T-GCN and T-GCN by the two metrics and the superiority becomes more obvious compared with LSTM and ARIMA. That is, our model shows superiority over the data-driven methods and model-driven methods o0f selected baselines. Again, we evaluate the performance of DT-SGN and base- lines by accuracy, coefficient of determination and explained variance score. The three evaluation metrics also proves the superiority of DT-SGN as shown in Table III. For example, ACC of DT-SGN are improved by approximately 15.4%, 12.3% and 27.1% compared with A3T-GCN, T-GCN and LSTM while R2 of DT-SGN are approximately 17.7%, 14.1%, 23.8% higher than that of A3T-GCN, T-GCN and LSTM. Also, compared with A3T-GCN and T-GCN and LSTM, V AR (a) (b) (c) Fig. 8. Prediction performance of DT-SGN model for prediction horizon of 15 minutes on Sz-taxi dataset. (a) is the prediction performance of whole test time, (b) is the prediction performance from time 0 to time 80, (c) is the prediction performance from time 300 to time 400. of DT-SGN are increased by 17.9%, 14.4% and 34.7%. In addition, as a model-driven model, the prediction performance of ARIMA is relatively lower than data-driven models such as Bi-GRU and LSTM. This is mainly because that ARIMA model has difficulty in processing the long-term time series data. Also, ARIMA model is calculated by the error of each node and averaging, so when the data fluctuate widely, the accuracy of ARIMA model is not satisfactory. 3) Analysis: Firstly, the experiment results proves the high prediction precision and the ability in capturing temporal and spatial dependencies of traffic information of DT-SGN. As shown in Figure7 and Figure 9, DT-SGN demonstrates the superiority compared with the baseline methods according to RMSE and MAE. It can be seen that compared with data- driven models and model-driven model, DT-SGN obtains the best prediction performance among all methods. Also, Table II and TableIII indicate the high prediction efficiency of DT- SGN by accuracy, coefficient of determination and explained variance score compared with the most existing prediction methods. Also, we find that the prediction performance of the same prediction methods exists a little differences according to the distribution of data. The reason of differences in prediction accuracy is shown as below. DT-SGN and the most baselines are data-driven models which obtain the data patterns through model training, so that the accuracy will decrease when the data appears great changes or the data fluctuates frequently. The overall distribution of data in Los-loop data set is stable except for two sharp declines while the data in Sz-taxi dataset constantly fluctuates in a wide range. Compared with the data of Sz-taxi dataset, the overall distribution of data in Los- loop data set is stable except for two sharp declines, so the prediction accuracy is high during the period of steady flow and get affected when there is a large change in the data. Comparatively speaking, the accuracy of prediction results tested on Sz-taxi dataset is lower than that tested on Los-loop dataset caused by the persistent unstable data series. V. CONCLUSION In this paper, we propose a dynamic temporal self-attention graph convolutional (DT-SGN) network to predict traffic in- formation. Firstly, we propose a self-attention GCN (SGN) model which applies self-attention mechanism to model the adjacency matrix to make the topological structure of urban networks a trainable matrix during a deep learning model training process, aiming at better capturing the spatial depen- dence of traffic data. In addition to SGN operation, we add an attention layer on the output of GRU network for dynamic features, so that the framework can adapt model parameters to different inputs, which can improve the prediction performance with a minor increase of computation cost. These technical developments together make the model beyond the state-of- art methods of traffic prediction. Also, developing dynamic features with attention mechanism can improve the represen- tation power of the model. The proposed model has been implemented and intensively evaluated in two real-world datasets: Los-loop dataset and Sz- taxi dataset. The computational experiments demonstrate the superiority in traffic state prediction. Compared with the base- line methods including A3T-GCN, T-GCN, LSTM, Bi-GRU and ARIMA, the proposed model provides the best prediction performance according to different kinds of evaluation metrics. Future work is to integrate the model for traffic signal control or autonomous vehicle control. The idea aims to firstly use DT-SGN network to predict future traffic state which can be applied as the basic of data for control systems. In the long run, our network can be further developed and combined with Q network or deep Q learning for traffic management to improve the existing reinforcement learning model. REFERENCES [1] C. Faloutsos, J. Gasthaus, T. Januschowski, and Y. Wang, "Forecasting big time series: old and new," Proceedings of the VLDB Endowment, vol. 11, no. 12, pp. 2102–2105, 2018. [2] Seungjae, Lee, Young-Ihn, Lee, Bumcheol, and Cho, "Short-term travel speed prediction models in car navigation systems," Journal of Advanced Transportation, 2006. [3] Matthias, Andres, Rahul, and Nair, "A predictive-control framework to address bus bunching," Transportation Research Part B Methodological, 2017. [4] E. Stellwagen and L. Tashman, "Arima: The models of box and jenkins," Foresight: The International Journal of Applied Forecasting, pp. 28–33, 2013. [5] J. Chung, C. Gulcehre, K. H. Cho, and Y. Bengio, "Empirical evaluation of gated recurrent neural networks on sequence modeling," Eprint Arxiv, 2014. [6] Z. Cui, K. Henrickson, R. Ke, Z. Pu, and Y. Wang, "Traffic graph convolutional recurrent neural network: A deep learning framework for network-scale traffic learning and forecasting," IEEE Transactions on Intelligent Transportation Systems, vol. 21. [7] L. Zhao, Y. Song, C. Zhang, Y. Liu, P. Wang, T. Lin, M. Deng, and H. Li, "T-gcn: A temporal graph convolutional network for traffic prediction," 2018. [8] A. Graves, "Adaptive computation time for recurrent neural networks," 2016. [9] G. Huang, D. Chen, T. Li, F. Wu, V. Laurens, and K. Q. Weinberger, "Multi-scale dense networks for resource efficient image classification," 2017. [10] Y. Han, G. Huang, S. Song, L. Yang, and Y. Wang, "Dynamic neural networks: A survey," 2021. [11] L. Zhao, Y. Song, C. Zhang, Y. Liu, P. Wang, T. Lin, M. Deng, and H. Li, "T-gcn: A temporal graph convolutional network for traffic prediction," IEEE Transactions on Intelligent Transportation Systems, vol. 21, no. 9, pp. 3848–3858, 2020. [12] B. M. Williams and L. A. Hoel, "Modeling and forecasting vehicular traffic flow as a seasonal arima process: Theoretical basis and empirical results," Journal of Transportation Engineering, vol. 129, no. 6, pp. 664–672, 2003. [13] P. Duan, G. Mao, Changsheng, Zhang, and J. Kang, "A trade-off between accuracy and complexity: Short-term traffic flow prediction with spatio-temporal correlations," in 2018 21st International Conference on Intelligent Transportation Systems (ITSC), 2018. [14] F. F. Xu, Z. C. He, and Z. R. Sha, "Impacts of traffic management mea- sures on rban network microscopic fundamental diagram," Journal of Transportation Systems Engineering & Information Technology, vol. 13, no. 2, pp. 185–190, 2013. [15] P. Wei, Y. Cao, and D. Sun, "Total unimodularity and decomposition method for large-scale air traffic cell transmission model," Transporta- tion Research Part B Methodological, vol. 53, no. jul., p. 1–16, 2013. [16] D. Zhao and Y. Xia, "Urban road traffic speed estimation for missing probe vehicle data based on multiple linear regression model," IEEE, 2013. [17] S. Guojiang, W. Xiaohu, K. Xiangjie, 沈国江, 王啸虎, and 孔祥杰, "Short-term traffic volume intelligent hybrid forecasting model and its application短时交通流量智能组合预测模型及应用," 系统工程理论 与实践, vol. 31, no. 3, pp. 561–568, 2011. [18] Z. Cui, R. Ke, Z. Pu, and Y. Wang, "Deep bidirectional and unidi- rectional lstm recurrent neural network for network-wide traffic speed prediction," 2018. [19] X. Song, H. Kanasugi, and R. Shibasaki, "Deeptransport: prediction and simulation of human mobility and transportation mode at a citywide level," 2016. Fig. 9. Prediction capacity on Los-loop dataset. (a) is the RMSE of tested methods and (b) is the MAE of tested methods. Metric ACC R2 V AR DT-SGN A3T-GCN 0.6935 0.8225 0.8272 0.6023 0.7011 0.7012 TABLE III T-GCN 0.6174 0.7232 0.7233 LSTM 0.5455 0.6095 0.6119 Bi-GRU 0.6927 0.82161 0.8275 ARIMA 0.3833 0.04673 0.0141 images using deep convolutional neural networks," Tenth International Conference on Machine Vision (ICMV 2017), 2018. [32] R. K. Yadav, A. Abhishek, S. Sourav, and S. Verma, "Gcn with clustering coefficients and attention module," in 2020 19th IEEE International Conference on Machine Learning and Applications (ICMLA), 2020. [33] J. Bruna, W. Zaremba, A. Szlam, and Y. Lecun, "Spectral networks and locally connected networks on graphs," 2013. [34] T. N. Kipf and M. Welling, "Semi-supervised classification with graph convolutional networks," 2016. [35] J. Bai, J. Zhu, Y. Song, L. Zhao, Z. Hou, R. Du, and H. Li, "A3t-gcn: Attention temporal graph convolutional network for traffic forecasting," ISPRS International Journal of Geo-Information, vol. 10, no. 7, 2021. [Online]. Available: https://www.mdpi.com/2220-9964/10/7/485 [36] W. Shu, K. Cai, and N. N. Xiong, "A short-term traffic flow prediction model based on an improved gate recurrent unit neural network," IEEE Transactions on Intelligent Transportation Systems, vol. 23, no. 9, pp. 16 654–16 665, 2022. [20] C. Zhang and P. Patras, "Long-term mobile traffic forecasting using deep spatio-temporal neural networks," 2018, pp. 231–240. [21] C. Cen, K. Li, S. G. Teo, G. Chen, and Z. Zeng, "Exploiting spatio- temporal correlations with multiple 3d convolutional neural networks for citywide vehicle flow prediction," in 2018 IEEE International Conference on Data Mining (ICDM), 2018. [22] S. Guo, Y. Lin, S. Li, Z. Chen, and H. Wan, "Deep spatial-temporal 3d convolutional neural networks for traffic data forecasting," IEEE Transactions on Intelligent Transportation Systems, vol. PP, no. 99, pp. 1–14, 2019. [23] L. Lin, Z. He, and S. Peeta, "Predicting station-level hourly demands in a large-scale bike-sharing network: A graph convolutional neural network approach," 2017. [24] J. M. Yang, Z. R. Peng, and L. Lin, "Real-time spatiotemporal prediction and imputation of traffic status based on lstm and graph laplacian regu- larized matrix factorization," Transportation research, Part C. Emerging technologies, no. Aug., p. 129, 2021. [25] D. Kong and F. Wu, "Hst-lstm: A hierarchical spatial-temporal long- short term memory network for location prediction," in Twenty-Seventh International Joint Conference on Artificial Intelligence IJCAI-18, 2018. [26] C. Zhang, S. Dang, B. Shihada, and M.-S. Alouini, "Dual attention-based federated learning for wireless traffic prediction," in IEEE INFOCOM 2021 - IEEE Conference on Computer Communications, 2021, pp. 1–10. [27] T. Li, Z. Zhao, C. Sun, R. Yan, and X. Chen, "Hierarchical attention graph convolutional network to fuse multi-sensor signals for remaining useful life prediction," Reliability Engineering & System Safety, vol. 215, pp. 107 878–, 2021. [28] J. Jin, D. Rong, T. Zhang, Q. Ji, H. Guo, Y. Lv, X. Ma, and F.-Y. Wang, "A gan-based short-term link traffic prediction approach for urban road networks under a parallel learning framework," IEEE Transactions on Intelligent Transportation Systems, vol. 23, no. 9, pp. 16 185–16 196, 2022. [29] Y. Duan, N. Chen, S. Shen, P. Zhang, Y. Qu, and S. Yu, "Fdsa-stg: Fully dynamic self-attention spatio-temporal graph networks for intelligent traffic flow prediction," IEEE Transactions on Vehicular Technology, vol. 71, no. 9, pp. 9250–9260, 2022. [30] Z. Wang, Z. Liu, G. Li, T. Zhang, L. Xu, and J. Wang, "Spatio-temporal self-attention network for video saliency prediction," 2021. [31] N. Hatami, Y. Gavet, and J. Debayle, "Classification of time-series
http://arxiv.org/abs/2302.10426v2
2023-05-10T13:42:09
2023-02-21T03:38:37
AttentionMixer: An Accurate and Interpretable Framework for Process Monitoring
An accurate and explainable automatic monitoring system is critical for the safety of high efficiency energy conversion plants that operate under extreme working condition. Nonetheless, currently available data-driven monitoring systems often fall short in meeting the requirements for either high-accuracy or interpretability, which hinders their application in practice. To overcome this limitation, a data-driven approach, AttentionMixer, is proposed under a generalized message passing framework, with the goal of establishing an accurate and interpretable radiation monitoring framework for energy conversion plants. To improve the model accuracy, the first technical contribution involves the development of spatial and temporal adaptive message passing blocks, which enable the capture of spatial and temporal correlations, respectively; the two blocks are cascaded through a mixing operator. To enhance the model interpretability, the second technical contribution involves the implementation of a sparse message passing regularizer, which eliminates spurious and noisy message passing routes. The effectiveness of the AttentionMixer approach is validated through extensive evaluations on a monitoring benchmark collected from the national radiation monitoring network for nuclear power plants, resulting in enhanced monitoring accuracy and interpretability in practice.
[ "Hao Wang", "Zhiyu Wang", "Yunlong Niu", "Zhaoran Liu", "Haozhe Li", "Yilin Liao", "Yuxin Huang", "Xinggao Liu" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10426v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10426v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.AI", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.AI", "cs.LG", "eess.SP", "stat.AP" ]
JOURNAL OF IEEE TRANSACTIONS ON ARTIFICIAL INTELLIGENCE, VOL. XX, NO. X 1 AttentionMixer: An Accurate and Interpretable Framework for Trustworthy Process Monitoring Hao Wang Student Member, IEEE, Zhiyu Wang, Yunlong Niu, Zhaoran Liu, Haozhe Li, Yilin Liao, Yuxin Huang, Xinggao Liu Member, IEEE 3 2 0 2 y a M 0 1 ] I A . s c [ 2 v 6 2 4 0 1 . 2 0 3 2 : v i X r a Abstract-Trustworthy process monitoring seeks to build an accurate and interpretable monitoring framework, which is critical for ensuring the safety of energy conversion plant (ECP) that operates under extreme working conditions. Current self- attentive token-mixers are inadequate for trustworthy ECP moni- toring for two reasons: (1) they rely on step-wise correlations that lack physical semantics in ECP logs, resulting in suboptimal ac- curacy and ambiguous interpretation; (2) the attention matrix is often cluttered with spurious correlations that obscure meaning- ful ones, further hindering effective interpretation. To overcome these issues, we propose AttentionMixer, a framework designed to improve the accuracy and interpretability of existing methods and establish a trustworthy ECP monitoring framework. Specifically, to tackle issue (1), we propose to employ a spatial adaptive message passing block that captures variate-wise correlations with meaningful physical semantics. This block is combined with a temporal adaptive message passing block through a mixing operator, resulting in a comprehensive representation of ECP logs that captures both step-wise and variate-wise correlations. To tackle issue (2), we devise a sparse message passing regularizer to eliminate spurious and noisy correlations. We evaluate our proposed framework on two real-world ECP monitoring datasets obtained from the radiation monitoring network for Chinese nuclear power plants, and demonstrate its superior performance in terms of accuracy, interpretability, and overall trustworthiness. Impact Statement-Energy conversion plants (ECPs) are op- erating under extreme conditions to improve power conversion efficiency and reduce carbon emissions. Therefore, establishing a trustworthy monitoring framework for ECPs is critical to ensure environmental safety and energy security. However, current solu- tions such as Convolutional Neural Networks (CNNs), Recurrent Neural Networks (RNNs), and Transformers have limitations in terms of accuracy, interpretability, and trustworthiness. To address these limitations, we propose the AttentionMixer frame- work to improve the accuracy and interpretability of existing methods and establish a trustworthy ECP monitoring framework. The proposed method's efficacy and superiority are demonstrated Manuscript recieved Sept. 28, 2022. This work is supported by the National Natural Science Foundation of China (12075212, 62073288) and Zhejiang University NGICS Platform. Hao Wang is with the State Key Laboratory of Industrial Control Technol- ogy, Hangzhou, CO 310027 China (e-mail: [email protected]). Zhiyu Wang is with the State Key Laboratory of Industrial Control Technology, Hangzhou, CO 310027 China (e-mail: [email protected]). Yunlong Niu is with the State Key Laboratory of Industrial Control Technology, Hangzhou, CO 310027 China (e-mail: [email protected]). Zhaoran Liu is with the State Key Laboratory of Industrial Control Technology, Hangzhou, CO 310027 China (e-mail: [email protected]). Haozhe Li is with the State Key Laboratory of Industrial Control Technol- ogy, Hangzhou, CO 310027 China (e-mail: [email protected]). Yilin Liao is with the State Key Laboratory of Industrial Control Technol- ogy, Hangzhou, CO 310027 China (e-mail: [email protected]). Yuxin Huang is with the State Key Laboratory of Industrial Control Technology, Hangzhou, CO 310027 China (e-mail: [email protected]). Xinggao Liu is with the State Key Laboratory of Industrial Control Technology, Hangzhou, CO 310027 China (e-mail: [email protected]). This paragraph will include the Associate Editor who handled your paper. in a large-scale ECP monitoring project: atmospheric nuclear radiation monitoring practice in China. The monitoring logs have been open-sourced on our project website. The proposed framework has the potential to enhance the safety of ECPs by providing a more trustworthy monitoring framework, which is crucial for ensuring environmental safety and energy security. Index Terms-Artificial intelligence in energy, Time series analysis, Artificial intelligence in security, Artificial intelligence in environment. I. INTRODUCTION M ONITORING energy conversion plants (ECPs) using high dimensional input sensory data is a critical prac- tice for ensuring energy safety and environmental security. As the demand for power conversion efficiency and carbon emission reduction increases, ECPs are increasingly operating under extreme conditions in order to reach the thermodynamic limit defined by the Clausius theorem. Examples of such extreme operating conditions include the working fluid at extremely high temperatures in coal-based power generation plants [1], the extreme pressure due to the force of falling water in hydroelectric power plants, and the high temperatures and pressures with the risk of nuclear radiation leaks in nuclear power plants [2], [3]. These extreme conditions give rise to severe safety and environmental concerns, highlighting the necessity of a trustworthy monitoring approach for ECPs to ensure energy safety and environmental security. Trustworthy artificial intelligence (AI) has emerged as a rapidly evolving field that is dedicated to developing safe, interpretable, and transparent AI systems [4]–[7]. The growing concern for AI security has led to the need for trustworthy AI in fundamental domains such as computer vision [8] and natural language processing [9], [10]. We believe such demand is especially salient for ECPs due to the risky and extreme operating conditions. In particular, A trustworthy ECP monitor should therefore possess both high accuracy and interpretability [5]–[7]The interpretability here refers to the ability of the monitor's decision process to be understood by domain experts, enabling them to verify the correctness based on their own domain knowledge. This is critical for building trust in AI monitors and ensuring the safety of ECPs under extreme operating conditions. To develop accurate monitors, data-driven approaches have become prevalent [11]–[14] with the development of measure- ment and learning techniques [15]–[17]. Initially, identification methods like ARIMA [18] and statistical methods such as extreme gradient boosting [19], [20] dominated process mon- itoring. With the advent of deep learning, deep monitors are 2 JOURNAL OF IEEE TRANSACTIONS ON ARTIFICIAL INTELLIGENCE, VOL. XX, NO. X then dominant, with recurrent neural networks (RNN) [12], convolution neural networks (CNN) [21], graph neural net- works (GNN) [22]–[24] being the representative approaches, each with its own advantages and limitations. For instance, RNNs can perform lifelong monitoring but are single-threaded; GNNs utilize variate-wise correlations for decision-making but require a predefined adjacency matrix that may be unavailable for ECPs. Recently, self-attentive token-mixers have emerged as a variant of GNNs, which do not require predefined graph structures and have shown great potential in various fields such as computer vision [25] and AI4Science [26]. However, current progress in ECP monitoring is limited to conventional backbones such as CNNs and RNNs, and the huge potential of self-attentive structures remains to be explored. This paper aims to explore the potential of self-attentive architecture for building a trustworthy ECP monitoring frame- work. The canonical self-attentive mechanism, however, has inherent characteristics that impede its trustworthiness in ECP monitoring. (1) It only considers step-wise correlations while ignoring variate-wise correlations, which are more informative and relevant for ECP monitoring. Unlike word embeddings, a single step of the monitoring log lacks physical semantics, rendering the step-wise correlations incapable of providing informative interpretations or effective discrimination for ECP monitoring. Therefore, we focus on understanding how the model perceives variate-wise correlations that possess specific physical semantics, rather than step-wise correlations. (2) The generated attention matrix is filled with spurious correlations, which obscures meaningful correlations and further hinders effective interpretation. To tackle these problems, we propose AttentionMixer un- der a generalized message passing framework. Specifically, to tackle issue (1), we devise a spatial adaptive message passing (SAMP) block to capture variate-wise correlations with meaningful physical semantics and combine it with a temporal adaptive message passing (TAMP) block using a mixing operator. This produces a comprehensive understand- ing of ECP logs that captures both step-wise and variate-wise correlations. To tackle issue (2), we devise a sparse message passing regularizer (SMPR) to eliminate spurious correlations and highlight important correlations. By explicitly modeling variate-wise correlations and effectively eliminating spurious correlations, AttentionMixer achieves better accuracy, inter- pretability, and therefore, trustworthiness in ECP monitoring. To summarize our main contributions: ● We propose AttentionMixer, the first attempt to imple- ment a self-attentive model on both spatial and temporal scales to achieve trustworthy ECP monitoring. ● We develop a sparsification regularizer to eliminate the spurious correlations and improve the accuracy and in- terpretability of monitoring. ● We conduct extensive experiments on a nuclear power plant monitoring task to demonstrate the trustworthiness of AttentionMixer in ECP monitoring. The real-time monitoring log is open-sourced on our project website1. The remaining sections are structured as follows: In Sec- 1https://data.rmtc.org.cn/gis/PubIndex.html tion II, we introduce some technical preliminaries to better understand the proposed method. In Section III, we describe the architecture and learning objective of AttentionMixer. In Section IV, we deploy AttentionMixer on a real-world ECP monitoring practice: radiation dose rate monitoring for nuclear power plants, and demonstrate its superiority on trustworthi- ness. Conclusions and future works are discussed in Section V. II. PRELIMINARIES A. Message Passing Mechanism Message passing is a general framework that encapsulates many spatial GNN models such as GCN, GraphSAGE, and GAT [27]. Let M and U be the message generation function the k-th round of and state update function, respectively; message passing for central node νi can be expressed as mk i = ∑ M(F k i , F k j ), νj ∈NG (νi) i , F k = U(mk i ), F k+1 i (1) where F k is the feature embedding of νi. In (1), M generates i the message embedding mk i from the neighboring nodes of νi (denoted as NG), and U updates the feature embedding of νi by fusing the message embedding mk i and the original feature embedding F k i . Despite its success in many fundamental fields, it is not directly applicable to ECP monitoring due to the lack of graph structure G. B. Self-attentive Sequential Models The self-attentive mechanism [28] can be considered as a form of message passing mechanism, which enables interac- tions between inputs without prior specification of a graph structure. Let T and D be the number of time steps and the hidden dimension, respectively; Q ∈ RT×D, K ∈ RT×D, and V ∈ RT×D be the query, key, and value sequences, respectively. The attention matrix is generated as follow: M = SoftMax( QKT √ D ), (2) which is then utilized for fusing the value sequences: U = M ∗ V. Notably, (2) can be treated as an message generation and aggregation step in the message passing mechanism, where U ∈ RT×D corresponds to the message embedding in (1). The core formula of self-attention mechanism in (2) enables interactions between inputs without requiring a predefined graph, thereby enhancing its flexibility and applicability across various fields. Self-attentive models, beginning with Trans- formers [28], have revolutionized fundamental domains such as computer vision (e.g., Swin Transformer [25]) and AI for science (e.g., AlphaFold-v2 [26]). Furthermore, self-attentive blocks are increasingly being used as core token-mixers in emerging sequential models, enabling the capture of long- term patterns. For example, FedFormer [29] incorporates a filter-enhanced attentive token-mixer to eliminate data noise; Informer [30] incorporates a ProbSparse self-attention to filter out lazy queries and minimize redundancy; Pyraformer [31] develops a pyramidal attention architecture to capture global HAO WANG et al.: ATTENTIONMIXER 3 and local dependencies at different levels of abstraction in long sequences; LogTrans [32] and TCCT [33] incorporates convolution operators in self-attention block to emphasize the role of locality in generating sequence representation. Mean- while, some plug-and-play components have been devised to meet task-specific requirements, such as adversarial training to improve multi-step forecast [34] and the patching trick for processing long history [35]. Additionally, some efforts have been made to address the complexity of self-attentive models with ultra-long input sequences, with notable examples being Reformer [36], BigBird [37], and PerFormer [38]. Self-attentive models have shown promise in many dis- ciplines that feature sequential modeling. However, current implementations are based on step-wise correlations that are insufficient for providing informative interpretations or effec- tive discrimination for ECP monitoring. In this study, we pro- pose a self-attentive approach that captures both variate-wise and step-wise correlations, thus addressing the aforementioned issues and highlighting the role of self-attentive mechanisms in constructing trustworthy ECP monitors. III. METHODOLOGY In this section, we introduce AttentionMixer, which is based on a generalized message passing paradigm as described in Section II-A. AttentionMixer utilizes the spatial adaptive message passing (SAMP) block to capture the correlations between variates and the temporal adaptive message passing (TAMP) block to capture the correlations between time steps. Additionally, AttentionMixer incorporates a sparse message passing regularizer (SMPR) to eliminate spurious correla- tions without the need for unstable sampling procedures. The technical distinctions from prevalent self-attentive methods involve: (1) the depiction of variate-wise correlations; (2) the elimination of spurious relationships. A. Problem Definition We use bold uppercase letters (e.g., X) to denote matrix, lowercase letters (e.g., x) to denote associated vectors. The input variables at the t-th step is denoted as xt ∈ RD×1. Given historical observations Xt ∶= [xt+1, xt+2, ..., xt+T] with window length T, our goal is to learn a function f ∶ RT×D → R such that f (Xt) → yH t , where yH is the value of key t performance indicators (KPIs) at the t + T + H step. In the offline training stage, we aim to accurately forecast KPIs using historical KPIs and external factors [12], [13]; in the inference stage, we anticipate that anomalous events will be indicated by large deviations between actual and forecast KPI values, as the training set only consists of normal logs. B. Spatial Adaptive Message Passing Module Canonical self-attention methods [28] treat each time step as a node and perform message passing at a temporal scale. This approach neglects variate-wise correlations and thus results in suboptimal accuracy and hinders meaningful interpretation in ECP monitoring. To address this issue, the SAMP module in this section depicts variate-wise correlations by performing message passing at a spatial scale, with each variate being treated as a node. Figure 1 (b) shows the k-th round of message passing with input Sk,in ∈ RD×T and output Sk,out ∈ RD×T. The computation workflow comprises three steps as follows. 1) Message Generation: We first generate the outgoing S ∈ RD×T for each node by feeding message embeddings Vk their individualized state embeddings into a multiple layer perception (MLP) layer: Vk S ∶= MLP(Sk,in), (3) S [i] ∈ RT is the outgoing message embedding of where Vk the i-th node, the MLP layer involves a learnable affine transformation and a linear activation function following [28]. We then define an attention matrix Mk S ∈ RD×D as follow: Qk Kk ˆMk Mk S ∶= MLP(Sk,in), S ∶= MLP(Sk,in), √ T S ∶= Qk S ∗ [Kk S] / S ∶= SoftMax ( ˆMk S) , D, (4) where Mk S [i, j] is a generalized similarity measure between D avoids the i-th node and the j-th node; the division of numerical errors during optimization [28]. The SoftMax oper- ation normalizes the attention scores of each node as follow: √ Mk S [i, j] ∶= S [i, j]) exp ( ˆMk i=1 exp ( ˆMk ∑D S [i, j]) . (5) Finally, we generate the incoming message embeddings S ∈ RD×T for each node by aggregating the outgoing Uk message embeddings using the attention matrix Mk S. The main intuition here is straightforward: neighbors with more remark- able similarities should convey more important messages. As such, the incoming message embeddings are calculated as Uk S ∶= Mk S ∗ Vk S, (6) where the incoming message embedding of the i-th node is a weighted sum of the outgoing message embeddings of its neighbors, with the weight being its attention to its neighbors: Uk S [i, ∶] ∶= D ∑ j=1 Mk S [i, j] Vk S [j, ∶] . (7) 2) State Update: The state embedding for each node is renewed according to its previous state embedding Sk,in and incoming message embedding Uk S as follow: Sk,out ∶= LayerNorm (Sk,in + Uk S) , (8) where the residual link preserves the previous state embed- dings that is excluded in the generation process of Uk S; the LayerNorm technique standardizes the data distribution at each layer to stabilize the training process. 4 JOURNAL OF IEEE TRANSACTIONS ON ARTIFICIAL INTELLIGENCE, VOL. XX, NO. X (a) Overall architecture of AttentionMixer which mainly consists of the SAMP and TAMP blocks (b) Architecture of Spatial Adaptive Message Passing (SAMP) block (c) Architecture of Temporal Adaptive Message Passing (TAMP) block Fig. 1. Overview of the architecture of AttentionMiixer, where the output of each module is marked under the corresponding module. C. Temporal Adaptive Message Passing Module The SAMP module focuses on variate-wise correlations while ignoring temporal correlations. However, temporal cor- relations are crucial for capturing auto-regressive characteris- tics in monitoring logs. Thus, ignoring temporal correlations can result in suboptimal performance for ECP monitoring, necessitating the TAMP module in this section. Figure 1 (c) illustrates the k-th round of temporal message passing, with Tk,in ∈ RT×D representing the input and Tk,out ∈ RT×D representing the output. The computation workflow is similar to that of SAMP, but TAMP relies on correlations between time steps rather than variates. TAMP models such step-wise correlations by performing message passing at a temporal scale, with each time step being treated as a node and the input Tk,in serving as the state embeddings of T nodes. T ∈ RT×T thus depends on the The message passing route Mk correlations between time steps. D. Sparse Message Passing Regularizer The correlations learned by self-attentive models are highly dense according to Figure 7 (a) , whereas the actual relation- ships in the physical world are sparse, as per the Occam's razor principle [39], [40]. This implies the existence of many spurious relationships, which can lead to overfitting and ob- scure meaningful relationships [37], ultimately compromising the accuracy and interpretability of monitoring. To address this issue, several graph sparsification techniques [24], [30], [41] have been proposed to obtain interpretable and meaningful graph structures. However, most of these techniques rely on sampling, resulting in significant variance in both training and inference phases, which is undesirable for ECP monitoring under extreme working conditions. To avoid introducing sampling during model inference, reg- ularization on the graph structure during the training process is preferable. In our framework, the graph structure is represented by the message passing route M, and a natural approach is to regularize their (cid:96)-1 norm as follows: Lsmpr ∶= ∥MS∥1 ∶= K ∑ k=1 D ∑ i,j=1 ∥Mk S∥ + 1 K ∑ k=1 ∥Mk T∥ , 1 ∣MS [i, j]∣ , ∥MT∥1 ∶= (9) T ∑ i,j=1 ∣MT[i, j]∣ where ∥ ⋅ ∥1 indicates the mean absolute value of the matrix, which promotes sparse solutions during model training. This regularization approach helps eliminate spurious relationships and highlight meaningful relationships, ultimately improving the accuracy and interpretability of process monitoring. E. AttentionMixer Framework for ECP Monitoring 1) Overall Architecture: As depicted in Figure 1 (a), At- tentionMixer consists of cascaded SAMP and TAMP blocks. The preprocessed data is first fed into SAMP, i.e., S1,in = S0, where messages are passed through the adaptive spatial graph. Next, the output of SAMP undergoes a transposition operation to obtain the input for TAMP. Specifically, the spatial and temporal dimensions of SAMP's output are transposed to get the input to TAMP: Sk,out ∶= SAMP (Sk,in) , Tk,in ∶= Transpose (Sk,out) , (10) where k ≤ K is the round of current message passing. Afterwards, TAMP extracts the temporal correlations in the SAMP BlockTAMP BlockInput GRUOutput S0∈RT×DSk,in∈RD×TTk,in∈RT×DSk,out∈RD×TTk,out∈RT×D̂y∈RInput MLPMLPMLPInput Output σMkS∈RD×DSk,in∈RD×TQkS∈RD×TKkS∈RD×TVkS∈RD×TSk,out∈RD×TSk,in∈RD×T×KInput MLPMLPMLPInput Output σMkT∈RT×TTk,in∈RT×DQkT∈RT×DKkT∈RT×DVkT∈RT×DTk,out∈RT×DTk,in∈RT×DMatrix multiplicationAdd and LayerNormTransposeσSoftmaxUkS∈RD×TUkT∈RT×DZ ∈ RD×1SAMP BlockTAMP BlockInput GRUOutput S0∈RT×DSk,in∈RD×TTk,in∈RT×DSk,out∈RD×TTk,out∈RT×D̂y∈RInput MLPMLPMLPInput Output σMkS∈RD×DSk,in∈RD×TQkS∈RD×TKkS∈RD×TVkS∈RD×TSk,out∈RD×TSk,in∈RD×T×KInput MLPMLPMLPInput Output σMkT∈RT×TTk,in∈RT×DQkT∈RT×DKkT∈RT×DVkT∈RT×DTk,out∈RT×DTk,in∈RT×DMatrix multiplicationAdd and LayerNormTransposeσSoftmaxUkS∈RD×TUkT∈RT×DZ ∈ RD×1SAMP BlockTAMP BlockInput GRUOutput S0∈RT×DSk,in∈RD×TTk,in∈RT×DSk,out∈RD×TTk,out∈RT×D̂y∈RInput MLPMLPMLPInput Output σMkS∈RD×DSk,in∈RD×TQkS∈RD×TKkS∈RD×TVkS∈RD×TSk,out∈RD×TSk,in∈RD×T×KInput MLPMLPMLPInput Output σMkT∈RT×TTk,in∈RT×DQkT∈RT×DKkT∈RT×DVkT∈RT×DTk,out∈RT×DTk,in∈RT×DMatrix multiplicationAdd and LayerNormTransposeσSoftmaxUkS∈RD×TUkT∈RT×DZ ∈ RD×1 HAO WANG et al.: ATTENTIONMIXER 5 TABLE I VARIABLE DEFINITION OF THE MONITORING LOG Field Unit of measure Atmospheric radiation Dose rate Spectrum (1024 channels) Meteorological conditions Temperature Humidity Atmosphere pressure Wind direction Wind speed Precipitation indicator Amount of precipitation nGy / h ANSI/IEEE N42.42 ○C % hPa Clockwise angle m / s Boolean value mm Spectrometer operating conditions Battery voltage Spectrometer voltage Spectrometer temperature V V ○C pollution. As a preventive technology, automatic monitoring networks for nuclear power plants have been widely deployed, such as the RadNet in America [45], the Fixed Point Surveil- lance network in Canada [46], and the Atmospheric Nuclear Radiation Monitoring Network (ANRMN) in China. The ANRMN project consists of approximately 500 in- dividual stations for nuclear radiation monitoring, as shown in Figure 2. The key performance indicator (KPI) of these stations is the γ-ray dose rate in the atmosphere [47], which reflects the intensity of radionuclides. However, the measured dose rate is not only related to the intensity of generated radionuclides but also affected by meteorological conditions and spectrometer operating conditions [48], [49]. For example, natural radionuclide radon in the air can be washed to the ground during rainfall, resulting in a spurious increase in the dose rate measured by monitoring sensors [48]. Ignoring such external factors can lead to false alarms and reduced reliability of monitoring. To construct data-driven ECP monitoring system, the mon- itoring log includes atmospheric radiation data, meteorolog- ical conditions, and spectrometer operating conditions. The atmospheric radiation data is collected with the ionization chamber and spectrometer in Figure 3 . The ionization cham- ber measures γ-ray dose rate [50], and its measurements are uploaded daily on our online monitoring board 2. The spectrometer3 measures spectrum, an important indicator of radionuclide concentrations in the environment. Figure 4 (a) shows a 1024-channel spectrum where different channels show different patterns of variation, with the energy decaying in higher channels. Figure 4 (b) provides further details on the dynamics of the measured spectrum with four selected channels, which are non-stationary and noisy due to the influence of external factors. In order to calibrate such external impacts, meteorological conditions (e.g., precipitation) and spectrometer operating conditions (e.g., battery voltage) are supplemented in the monitoring logs. 2Real-time dose rate data has been released on our website. 3The spectrometer employs the SARA detector by ENVINET GmbH. (a) (b) Fig. 2. Overview of the national automatic nuclear radiation monitoring network in China: (a) the distribution of monitoring stations that have been deployed; (b) the composition of a specific monitoring station. data, and the transpose of its output is the input to the SAMP block in the next round of message passing: Tk,out ∶= TAMP (Tk,in) , Sk+1,in ∶= Transpose (Tk,out) . (11) The output of the last TAMP block, TK,out, is fed into a gated recurrent unit (GRU) decoder to get the dose rate estimate: Z ∶= GRU (TK,out) , ˆyH t ∶= Linear (Z) , (12) where ˆyH t horizion, Linear(⋅) is a MLP-layer with linear activation. is the output of AttentionMixer, H is the forecast 2) Learning Objective: The learning objective aims to min- imize the error of forecast and the density of message passing. Given input Xt and label yH t , the forecast error is 2 Lpred ∶= (yH t − ˆyH t ) is the actual radiation dose rate at the t + H time is the output of the proposed AttentionMixer given where yH t step, ˆyH t input S0 ∶= Xt. The overall learning objective is (13) , LMixer = Lpred + λ ⋅ Lsmpr, (14) where λ controls the strength of SMPR. The network structure and learning objective coorperate to improve accuracy and interpretability, both critical for nuclear radiation monitoring. IV. EXPERIMENTS To demonstrate the effectiveness of the proposed Attention- Mixer for ECP monitoring under extreme working conditions, we conduct experiments on the nuclear radiation monitoring downstream task, where the monitoring logs are collected from real-world monitoring stations for nuclear power plants. A. Background of Nuclear Radiation Monitoring As a resilient and reliable source of energy [42], [43], nuclear power plants generate nearly 800 billion kilowatt- hours of electricity per year in America, supplying more than 60% of the emission-free electricity, reducing about 500 million metric tons of carbon emission [44]. However, as an extreme-condition ECP, it raises serious concerns regarding environmental safety and energy security [2], [3]. In the event of a nuclear anomaly, excessive amounts of radionuclides can be released into the atmosphere, causing severe environmental A: Radiation monitoring stationB: Weather sensorsC: SpectrometerD: Ionization chamberE: Aerosol samplerF: Rain gaugeG: Settlement samplerCABFGED 6 JOURNAL OF IEEE TRANSACTIONS ON ARTIFICIAL INTELLIGENCE, VOL. XX, NO. X TABLE II DESCRIPTION OF SAMPLING STRATEGY. Station Location #Sample #Variable Interval Start time Changchi Industrial Park Beijing Baicheng 38,686 38,687 1,034 1,034 5 min 5 min 10/3/2020 21/4/2020 (a) Error on the validation set. (b) Accuracy on the test set. Fig. 5. Monitoring performance of AttentionMixer on Beijing benchmark. 3) Training Strategy: In our experiments, all deep models are trained for a total of 200 epochs using the Adam opti- mizer [55] with early stopping strategy. The batch size is set to 64, and the window length T is set to 16. The learning rate is set to 0.001, and the patience for early stopping is set to 15 epochs. The strength λ of SMPR is set to 5e−5 for the Baicheng station and 1e−5 for the Beijing station, respectively. The round K of message passing is set to 2. To ensure a fair comparison, we applied this setup to all methods. We check- point models on the validation set every epoch, and report the best performance on the test set. 4) Evaluation Strategy: The coefficient of determination (R2) is used as the main fitness metric in line with [22], [23]. R2 = 1 − N ∑ t=1 (yH 2 t − ˆyH t ) / N ∑ i=1 (yH 2 t − ̄yH t ) , (15) is the actual dose rate, ˆyH t where yH is the estimated dose t is the mean value of yH rate, ̄yH for t = 1 ∶ N, N is the size of t t test set. To provide a comprehensive model comparison, root mean squared error (RMSE) and mean absolute error (MAE) are employed as additional metrics: RMSE = [ (yH 2 t − ˆyH t ) 1/2 ] , (16) 1 N N ∑ t=1 N ∑ t=1 MAE = 1 N ∣yH t − ˆyH t ∣ . C. Overall Performance Table III compares AttentionMixer and its competitors at four forecast horizons (H = 1, 3, 5, 7). The observations can be summarized as follows: Identification-based models demonstrate practical short- term forecasting capabilities. For example, ARIMA achieves an R2 of 0.77 and 0.79 on the Beijing and Baicheng bench- marks, respectively, confirming the presence of autocorrelation characteristics in the data. However, these models are limited to describing linear autocorrelation, making them vulnerable to non-linear autocorrelation in datasets. This limitation becomes evident in the long-term forecast performance, where ARIMA achieves an R2 of 0.73 for H=7 on the Beijing benchmark but only 0.12 on the Baicheng benchmark. This significant drop is attributed to the strong non-linear autocorrelation in the Baicheng benchmark. Fig. 3. Real-world monitoring stations with key sensors being highlighted. B. Experimental Setup 1) Datasets: Two industrial benchmarks are constructed using the monitoring logs obtained from the ANRMN project. These benchmarks consist of 1034 input variables, as de- scribed in Table I, which includes the 1024-channel spectrum, 7-channel meteorological conditions, and 3-channel spectrom- eter operating conditions. The sampling strategy used to create both benchmarks is detailed in Table II. Both benchmarks are divided chronologically into training, validation, and test sets in a ratio of 0.7:0.15:0.15. Finally, they are scaled using a min-max scaler to facilitate model training and evaluation. 2) Baselines: AttentionMixer is compared with three groups of baselines. (1) Identification-based models: Auto-Regression (AR) [18], Moving Average (MA) [18], AutoRegressive In- tegrated Moving Average (ARIMA) [18]; (2) Statistic-based models: Lasso Regression (LASSO) [51], Support Vector Regression (SVR) [20], Random Forest (RF) [52], Gradi- ent Boosting Decision Tree (GBDT) [19], eXtreme Gradient Boosting (XGB) [19]; (3) Deep models: Long Short-Term Memory (LSTM) [53], Gated Recurrent Unit (GRU) [54], Transformer [28], Informer [30], FedFormer [29]. Consistent with AttentionMixer, we use GRU as the decoder for former- like baselines for fair comparison. (a) (b) Fig. 4. Spectrometer measurements and dose rates of 1000 sequential time steps starting from 2020/5/15 21:54:00, in Baicheng Station, Jilin. 02004006008001000Time step050100ValueC-256C-384C-512C-10240255075Epochs0.020.040.060.080.10Volume of ErrorRMSEMAE0.000.250.500.751.00Predictions0.000.250.500.751.00Labels HAO WANG et al.: ATTENTIONMIXER 7 TABLE III COMPARATIVE STUDY ON THE BEIJING AND BAICHENG BENCHMARKS OVER FOUR FORECAST HORIZONS. Methods Metrics Beijing Station Baicheng Station Identification based models Statistic based models Deep models AR MA ARIMA LASSO SVR RF GBDT XGB LSTM GRU Transformer Informer Fedformer Current work AttentionMixer MAE R2 MAE R2 MAE R2 MAE R2 MAE R2 MAE R2 MAE R2 MAE R2 MAE R2 MAE R2 MAE R2 MAE R2 MAE R2 MAE R2 H=1 0.0925 0.7672 0.0952 0.7563 0.0962 0.7700 0.0500 0.4015 0.0723 0.4743 0.0337 0.8580 0.0396 0.7453 0.0302 0.8943 0.0181 0.9025 0.0177 0.9021 0.0142 0.9642 0.0189 0.9082 0.0104 0.9750 0.0104 0.9756 H=3 0.1005 0.7265 0.1027 0.7193 0.0982 0.7339 0.0511 0.3663 0.0712 0.4843 0.0360 0.8193 0.0406 0.7137 0.0332 0.8393 0.0214 0.8343 0.0214 0.8382 0.0223 0.8640 0.0287 0.8444 0.0185 0.9239 0.0197 0.9044 H=5 0.1068 0.6887 0.1081 0.6828 0.1048 0.7228 0.0527 0.3124 0.0677 0.4828 0.0383 0.7589 0.0420 0.6543 0.0370 0.7684 0.0251 0.7478 0.0247 0.7577 0.0282 0.7915 0.0276 0.7745 0.0233 0.8506 0.0213 0.8465 H=7 0.1161 0.6455 0.1161 0.6437 0.1000 0.7342 0.0546 0.2491 0.0664 0.4429 0.0413 0.6753 0.0444 0.5678 0.0412 0.6719 0.0294 0.6547 0.0280 0.6742 0.0334 0.6826 0.0482 0.6144 0.0254 0.7684 0.0280 0.7245 H=1 0.0999 0.7051 0.1537 0.3457 0.0818 0.7954 0.0207 0.3998 0.0486 0.3247 0.0159 0.8918 0.0176 0.7840 0.0105 0.9485 0.0160 0.8916 0.0179 0.8621 0.0111 0.9423 0.0123 0.8949 0.0069 0.9765 0.0066 0.9783 H=3 0.1329 0.5110 0.1794 0.1095 0.1094 0.6611 0.0210 0.3708 0.0599 -0.0073 0.0171 0.8393 0.0175 0.7559 0.0118 0.9012 0.0170 0.8331 0.0189 0.8046 0.0154 0.7996 0.0140 0.8416 0.0100 0.9215 0.0093 0.9229 H=5 H=7 0.1669 0.2196 0.2019 -0.1363 0.1452 0.3940 0.0216 0.3260 0.0647 -0.2074 0.0172 0.7879 0.0178 0.7057 0.0136 0.8335 0.0183 0.7640 0.0198 0.7426 0.0177 0.7318 0.0221 0.6941 0.0125 0.8483 0.0112 0.8708 0.1899 -0.0282 0.2201 -0.3642 0.1762 0.1258 0.0224 0.2719 0.0655 -0.2936 1.0183 0.7118 0.0183 0.6460 0.0149 0.7555 0.2000 0.6886 0.0210 0.6720 0.0210 0.6252 0.0186 0.6738 0.0149 0.7882 0.0156 0.7859 Bold fonts and underlined fonts indicate the best and second best performance for each metric, respectively. Statistic-based models incorporate external factors such as meteorological and spectral measures, leading to competitive short-term forecast performance. Non-linear estimators (RF, GBDF, XGB) with higher capacity outperform linear estima- tors (LASSO, SVR). For example, RF exhibits a MAE of 0.033 and 0.0159, significantly outperforming LASSO and SVR. Additionally, XGB shows remarkable performance, surpassing conventional deep models like LSTM and GRU on both datasets. This can be attributed to XGB's ability to cap- ture effective intersections between input variables in tabular datasets, enabling it to outperform some deep models when variate-wise intersections dominate the task. These findings highlight the importance of effectively modeling variate-wise intersections to improve the accuracy of ECP monitoring. Deep models achieve the best overall performance among all baselines. RNN-based deep models, such as LSTM and GRU, outperform all non-deep models except XGB. Self- attentive models further enhance monitoring performance significantly, indicating their potential for ECP monitoring, although more exploration is needed. Notably, Informer is inferior to Transformer in our context, possibly due to the overly aggressive and restrictive sampling-based sparsification strategy, which can reduce model performance. A similar phenomenon is observed in AttentionMixer, where overly large strength of SMPR can lead to a decrease in performance. correlations and effectively eliminating spurious correlations, AttentionMixer achieves higher accuracy. A notable strong baseline is FedFormer, which achieves competitive perfor- mance with AttentionMixer. However, FedFormer fails to consider variate-wise correlations, and its decision process lacks interpretability, which hinders its trustworthiness in ECP monitoring under extreme working conditions. Figure 5 provides a more detailed demonstration of At- tentionMixer's monitoring performance. During the training the model converges rapidly, as evidenced by the phase, validation error stabilizing after approximately 25 epochs. In the test phase, AttentionMixer accurately estimates dose rates, as indicated by the distribution of estimated and actual values clustering around a line with a slope of 1. D. Discussion on Trustworthiness 1) Accuracy: A trustworthy ECP monitoring framework should be accurate. To assess the effectiveness of Attention- Mixer's components in improving accuracy, we compare its performance with four variants: 1) w/o SAMP: AttentionMixer without the SAMP module; 2) w/o TAMP: AttentionMixer without the TAMP module; 3) w/o SMPR: AttentionMixer without SAMP, i.e., λ = 0; 4) w/o asymmetry: AttentionMixer with undirected message S = Kk passing graph, i.e., Qk S and Qk T = Kk T. AttentionMixer outperforms all baseline methods on most metrics and benchmarks. By explicitly modeling variate-wise The results in Table IV reveal the observations as follows. First, both SAMP and TAMP modules are crucial for achieving 8 JOURNAL OF IEEE TRANSACTIONS ON ARTIFICIAL INTELLIGENCE, VOL. XX, NO. X TABLE IV COMPARISON OF ATTENTIONMIXER AND ITS VARIANTS (MEAN±STD). Dataset Metrics Beijing Station Baicheng Station RMSE ↓ MAE ↓ R2 ↑ RMSE ↓ MAE ↓ R2 ↑ 0.8066±0.0167† w/o SAMP 0.9676±0.0025† w/o TAMP 0.9660±0.0036† w/o SMPR w/o asymmetry 0.9739±0.0052 0.9756±0.0019 AttentionMixer ∗ marks the variants significantly inferior to AttentionMixer at p-value< 0.05 over paired sample t-test. Bolded fonts indicate the best results. 0.0315±0.0034† 0.0124±0.0008† 0.0118±0.0003† 0.0104±0.0008 0.0104±0.0005 0.0155±0.0007† 0.0085±0.0004† 0.0073±0.0008 0.0069±0.0004 0.0066±0.0003 0.0339±0.0008† 0.0145±0.0009† 0.0141±0.0019 0.0137±0.0013 0.0125±0.0008 0.0572±0.0025† 0.0234±0.0009† 0.0240±0.0012† 0.0209±0.0021 0.0203±0.0008 0.8413±0.0074† 0.9710±0.0036† 0.9723±0.0070† 0.9740±0.0052† 0.9783±0.0027 TABLE V COMPLEXITY ANALYSIS OF FOUR BLOCKS Blocks Complexity Sequential Ops Path Length RNN TCN TAMP SAMP O(T ⋅ D2) O(τ ⋅ T ⋅ D2) O(T2 ⋅ D) O(T ⋅ D2) O(T) O(1) O(1) O(1) O(T) O(logτ T) O(1) O(1) overall performance, emphasizing the significance of variant- wise and step-wise correlations in accurate ECP monitoring. Second, the SMPR mechanism, which eliminates noisy cor- relations and reduces overfitting risks, significantly improves AttentionMixer's performance. For instance, it enhances R2 from 0.966 to 0.975 on the Beijing benchmark and reduces RMSE from 0.014 to 0.012 on the Baicheng benchmark. Finally, inclusion of asymmetry in attention matrices also contributes to improved performance. Notably, in a temporal scale, the latter step is a consequence of the former step, but not vice versa; in a spatial scale, meteorological conditions af- fect dose-rate measures, but not vice versa. Hence, asymmetry exists in nuclear radiation monitoring logs, and disregarding this property diminishes model accuracy. 2) Interpretability: Interpretability and consistency with ex- pert knowledge are crucial for trusting AI monitors in extreme operating conditions. However, most existing monitoring so- lutions lack interpretability: conventional deep models such as RNNs and TCNs consist of stacked non-linear transformations that lack physical meaning; canonical self-attention methods rely on step-wise correlations, which have no specific semantic in ECP logs and are not understandable by human experts. To address this limitation, we introduce the SAMP block, which explicitly models variate-wise ccorrelations and en- ables a transparent decision process as per Figure 7. Unlike step-wise attention, sequence-wise correlation contains more discriminative information and has understandable physical meaning in the context of ECP monitoring. This technical advancement is significant not only for ECP monitoring but also for other fields like natural language processing and time series forecast. Furthermore, the attention matrix generated by Attention- Mixer is highly dense, as depicted in Figure 7 (a). However, real-world relationships are often sparse. The dense attention matrix contains spurious correlations that obscure meaning- ful ones, reducing interpretability. By involving SMPR, the attention matrix gradually becomes sparsified and spurious re- (a) Performance with different strengths of SMPR λ (×10−2). (b) Performance with different rounds of message passing K. (c) Performance with different settings of window length L. (d) Performance with different settings batch size. Fig. 6. Parameter sensitivity studies of AttentionMixer, where the marker and dark area indicates the mean value and 90% confidence interval, respectively. 0.00.010.050.10.5λ0.9650.9700.9750.980R2BaichengBeijing0.00.010.050.10.5λ0.02RMSEBaichengBeijing1.01.52.02.53.0K0.40.60.81.0R2BaichengBeijing1.01.52.02.53.0K0.020.040.06RMSEBaichengBeijing4816243264L0.60.70.80.9R2BaichengBeijing4816243264L0.020.040.060.08RMSEBaichengBeijing8163264128Batch size0.880.900.920.940.960.98R2BaichengBeijing8163264128Batch size0.020.04RMSEBaichengBeijing HAO WANG et al.: ATTENTIONMIXER 9 (a) λ = 0 (b) λ = 0.03 (c) λ = 0.1 Fig. 7. The attention matrix in the first SAMP module with different strengths of SMPR λ. lationships are eliminated, as demonstrated in the dark red part of Figure 7 (b-c). Consequently, the meaningful relationships are highlighted, and the model's interpretability is improved. Moreover, the interpretation of AttentionMixer can be val- idated with existing expert knowledge. The lower half of Figure 7 illustrates the impact of weather conditions on other measurements, where the sixth weather condition (precipita- tion) has a significant impact on most spectrometer measures. Increasing the strength of SMPR further emphasizes this phenomenon. Expert knowledge [47], [48] confirms that pre- cipitation and spectrometer measures are mechanically related, as rain washes radionuclide radon in the air to the ground, leading to an increase in spectrometer measures. This finding highlights the consistency of our monitoring process with expert knowledge, which is critical for trusting AI monitors in extreme-condition ECPs. E. Parameter Sensitivity Study In this section, we aim to examine four critical hyperparam- eters that can significantly affect the final performance of our model. These hyperparameters include the strength of SMPR (λ), the round of message passing (K), the window length (L), and the batch size. The strength of SMPR (λ) is a crucial hyperparameter that directly affects the learning objective (14) and, consequently, has a significant impact on the final performance. As shown in Figure 6, SMPR positively contributes to the overall monitor- ing performance within a wide range of λ values. Specifically, the value of R2 increases from 0.968 at λ = 0 to 0.976 at λ = 0.0001. However, assigning a large weight to SMPR can have a detrimental effect on the performance, with R2 dropping to 0.969 at λ = 0.005. It is speculated that over- emphasizing SMPR in a multitask learning framework could make it challenging to minimize forecast errors effectively. The round of message passing (K) is another crucial hyper- parameter. According to Figure 6, a single round of message passing is adequate to obtain a comprehensive spatio-temporal representation, which can be effectively utilized for moni- toring. Incorporating additional rounds of message passing provides limited benefits and may even lead to overfitting and optimization difficulties, resulting in performance drop. We further investigate the impact of window length (L) on performance. Overall, the model's performance is relatively insensitive to this parameter within a larger range, indicat- ing that modeling overly long-term step-wise relationships is unnecessary for effective monitoring. Rather, establishing effective variate-wise relationships is crucial for achieving good monitoring performance. These findings align with the conclusions drawn from our ablation studies in Table IV. Finally, we investigate the effect of batch size on performance. Overall, larger batch sizes can stabilize the training process and improve the final results within a wide range. F. Complexity Analysis In this section, we provide a comparison of computational costs among different sequence transformation methods, as reported in Table V following [28]. The methods are employed to transform one sequence (x1, ..., xT) to another sequence (z1, ..., zT) with equal length T and feature number D. Three metrics are considered, including complexity, sequential ops, and path length, which respectively measure the amount of floating-point operations, non-parallelizable operations, and the minimum number of layers to model the relationships between any time steps. RNNs exhibit inefficiencies in training and inference due to sequential operations and path length. TCNs, with a kernel length τ , allow for full parallelization; however, the need to stack multiple TCN layers to model global relationships limits efficiency for long-term dependencies. TAMPs, specifically the vanilla self-attention block, demonstrate advantages in terms of parallelization and path length, but their complexity of O(T2) poses challenges in handling large window length [37], [56]. The proposed SAMP module enjoys the superiority of parallelization and path length while reducing the complexity to O(T) in relation to window length. Figure 8 depicts the inference time of the SAMP and TAMP modules for 64 samples, indicating that the inference time 10 JOURNAL OF IEEE TRANSACTIONS ON ARTIFICIAL INTELLIGENCE, VOL. XX, NO. X monitoring quality of AttentionMixer. The second direction of our future work aims to deploy the proposed model on our online monitoring board1 to serve nuclear power plants nationwide, which will enable us to evaluate the performance of the framework under a broader range of conditions and further refine its effectiveness. REFERENCES [1] X. Wu, X.-H. Xia, G. Chen, X. Wu, and B. Chen, "Embodied energy analysis for coal-based power generation system-highlighting the role of indirect energy cost," Appl. Energy, vol. 184, pp. 936–950, 2016. [2] F.-C. Chen and M. R. Jahanshahi, "Nb-cnn: Deep learning-based crack detection using convolutional neural network and na ̃A ̄ve bayes data fusion," IEEE Trans. Ind. Electron., vol. 65, no. 5, pp. 4392–4400, 2018. [3] M. Embrechts and S. Benedek, "Hybrid identification of nuclear power transients with artificial neural networks," IEEE Trans. Ind. plant Electron., vol. 51, no. 3, pp. 686–693, 2004. [4] H. Liu, Y. Wang, W. Fan, X. Liu, Y. Li, S. Jain, Y. Liu, A. Jain, and J. Tang, "Trustworthy ai: A computational perspective," ACM Transactions on Intelligent Systems and Technology, vol. 14, no. 1, pp. 1–59, 2022. [5] L. Floridi, "Establishing the rules for building trustworthy ai," Nature Machine Intelligence, vol. 1, no. 6, pp. 261–262, 2019. [6] W. Liang, G. A. Tadesse, D. Ho, L. Fei-Fei, M. Zaharia, C. Zhang, and J. Zou, "Advances, challenges and opportunities in creating data for trustworthy ai," Nature Machine Intelligence, vol. 4, no. 8, pp. 669–677, 2022. [7] A. F. Markus, J. A. Kors, and P. R. Rijnbeek, "The role of explain- ability in creating trustworthy artificial intelligence for health care: a comprehensive survey of the terminology, design choices, and evaluation strategies," Journal of Biomedical Informatics, vol. 113, p. 103655, 2021. [8] S. J. Nightingale and H. Farid, "Ai-synthesized faces are indistinguish- able from real faces and more trustworthy," Proceedings of the National Academy of Sciences, vol. 119, no. 8, p. e2120481119, 2022. [9] R. Zellers, A. Holtzman, H. Rashkin, Y. Bisk, A. Farhadi, F. Roesner, and Y. Choi, "Defending against neural fake news," Advances in neural information processing systems, vol. 32, 2019. [10] A. Sheth, M. Gaur, K. Roy, and K. Faldu, "Knowledge-intensive language understanding for explainable ai," IEEE Internet Computing, vol. 25, no. 5, pp. 19–24, 2021. [11] Y. Huang, H. Wang, Z. Liu, L. Pan, H. Li, and X. Liu, "Modeling task relationships in multi-variate soft sensor with balanced mixture-of- experts," IEEE Trans. Ind. Informat., pp. 1–9, 2022. [12] X. Yuan, L. Li, and Y. Wang, "Nonlinear dynamic soft sensor modeling with supervised long short-term memory network," IEEE Trans. Ind. Informat., vol. 16, no. 5, pp. 3168–3176, 2019. [13] X. Yuan, J. Zhou, B. Huang, Y. Wang, C. Yang, and W. Gui, "Hierar- chical quality-relevant feature representation for soft sensor modeling: A novel deep learning strategy," IEEE Trans. Ind. Informat., vol. 16, no. 6, pp. 3721–3730, 2019. [14] Q. Dai, C. Zhao, and B. Huang, "Incremental variational bayesian gaussian mixture model with decremental optimization for distribu- tion accommodation and fine-scale adaptive process monitoring," IEEE Trans. Cybern., 2022. [15] H. Wang, T. Chang, T. Liu, J. Huang, Z. Chen, C. Yu, R. Li, and W. Chu, "ESCM2: entire space counterfactual multi-task model for post-click conversion rate estimation," in SIGIR, pp. 363–372, ACM, 2022. [16] H. Li, W. Wang, Z. Liu, Y. Niu, H. Wang, S. Zhao, Y. Liao, W. Yang, and X. Liu, "A novel locality-sensitive hashing relational graph matching network for semantic textual similarity measurement," Expert Systems with Applications, vol. 207, p. 117832, 2022. [17] J. Fan, Y. Zhuang, Y. Liu, H. Jianye, B. Wang, J. Zhu, H. Wang, and S.- T. Xia, "Learnable behavior control: Breaking atari human world records via sample-efficient behavior selection," in ICLR, 2023. [18] A. Chandrakar, D. Datta, A. K. Nayak, and G. Vinod, "Statistical analysis of a time series relevant to passive systems of nuclear power plants," Int. J. Syst. Assur. Eng. Manag., vol. 8, no. 1, pp. 89–108, 2017. [19] J. I. Aizpurua, S. D. J. McArthur, B. G. Stewart, B. Lambert, J. G. Cross, and V. M. Catterson, "Adaptive power transformer lifetime predictions through machine learning and uncertainty modeling in nuclear power plants," IEEE Trans. Ind. Electron., vol. 66, no. 6, pp. 4726–4737, 2019. (a) Inference time on the Intel(R) Xeon(R) Gold 6140 CPU. (b) Inference time on the Nvidia RTX Titan GPU. Fig. 8. Inference time of the SAMP and TAMP blocks on CPUs (a) and GPUs (b). The default settings of L and D are 16 and 32, respectively. The batch size is set to 64 and the results are mean values of 10 trials. adequately satisfies the requirements of ECP monitoring. The observed evolution of inference costs aligns with the analytical results presented in Table V. One potential drawback of the SAMP module is its second-order complexity in relation to feature number D. However, this issue can be mitigated by mapping the input data into a lower-dimensional space before the SAMP block. V. CONCLUSION This study proposes a novel AttentionMixer framework to address the current limitations of ECP monitoring methods in terms of accuracy and interpretability, with the goal of providing a trustworthy process monitoring framework for ECPs operating under extreme conditions. The framework employs spatial and temporal adaptive message passing blocks to build a comprehensive representation of ECP logs. Ad- ditionally, a sparse message passing regularizer is utilized to eliminate spurious and noisy correlations. By explicitly modeling variate-wise correlations and effectively eliminating spurious correlations, AttentionMixer achieves better accuracy, interpretability, and therefore, trustworthiness in ECP monitor- ing. The evaluation of AttentionMixer on two real-world ECP monitoring datasets demonstrates its superior performance in terms of accuracy and interpretability, highlighting its potential to achieve trustworthy ECP monitoring. The first direction aims to explore the role and flexibility of techniques in vanilla Transformers, such as patching [35], sparse attentions [36], [38], [57], and adversarial training [34], within the AttentionMixer framework, particularly in the SAMP block that is constructed based on variate-wise cor- relations. This exploration is expected to further improve the 32641282565121024Window length L0.00.20.40.60.8Time (s)TAMPSAMP32641282565121024Feature Number D0.00.20.40.6Time (s)TAMPSAMP32641282565121024Window length L0.000.010.020.030.04Time (s)TAMPSAMP32641282565121024Feature Number D0.010.020.03Time (s)TAMPSAMP HAO WANG et al.: ATTENTIONMIXER 11 [20] L. Tang, L. Yu, S. Wang, J. Li, and S. Wang, "A novel hybrid ensemble learning paradigm for nuclear energy consumption forecasting," Appl. Energy, vol. 93, pp. 432–443, 2012. [21] H. Wang, M. Peng, R. Xu, A. Ayodeji, and H. Xia, "Remaining useful life prediction based on improved temporal convolutional network for nuclear power plant valves," Front. Energy Res., vol. 8, p. 296, 2020. [22] Z. Wu, S. Pan, G. Long, J. Jiang, and C. Zhang, "Graph wavenet for deep spatial-temporal graph modeling," in IJCAI, pp. 1907–1913, 2019. [23] Z. Wu, S. Pan, G. Long, J. Jiang, X. Chang, and C. Zhang, "Connecting the Dots: Multivariate Time Series Forecasting with Graph Neural Networks," in SIGKDD, pp. 753–763, 2020. [24] Z. Chen and Z. Ge, "Knowledge automation through graph mining, convolution and explanation framework: a soft sensor practice," IEEE Trans. Ind. Informat., 2021. [25] Z. Liu, Y. Lin, Y. Cao, H. Hu, Y. Wei, Z. Zhang, S. Lin, and B. Guo, "Swin transformer: Hierarchical vision transformer using shifted windows," in ICCV, pp. 10012–10022, 2021. [26] J. Jumper, R. Evans, A. Pritzel, T. Green, M. Figurnov, O. Ronneberger, K. Tunyasuvunakool, R. Bates, et al., "Highly accurate protein structure prediction with alphafold," Nature, vol. 596, no. 7873, pp. 583–589, 2021. [27] Y. Ma and J. Tang, Deep Learning on Graphs. Cambridge University Press, 2021. [28] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin, "Attention is all you need," NeurIPS, vol. 30, 2017. [29] T. Zhou, Z. Ma, Q. Wen, X. Wang, L. Sun, and R. Jin, "Fedformer: Frequency enhanced decomposed transformer for long-term series fore- casting," in ICML, pp. 27268–27286, PMLR, 2022. [30] H. Zhou, S. Zhang, J. Peng, S. Zhang, J. Li, H. Xiong, and W. Zhang, "Informer: Beyond efficient transformer for long sequence time-series forecasting," in AAAI, vol. 35, pp. 11106–11115, 2021. [31] S. Liu, H. Yu, C. Liao, J. Li, W. Lin, A. X. Liu, and S. Dustdar, "Pyraformer: Low-complexity pyramidal attention for long-range time series modeling and forecasting," in International conference on learning representations, 2021. [32] S. Li, X. Jin, Y. Xuan, X. Zhou, W. Chen, Y.-X. Wang, and X. Yan, "En- hancing the locality and breaking the memory bottleneck of transformer on time series forecasting," Advances in neural information processing systems, vol. 32, 2019. [33] L. Shen and Y. Wang, "Tcct: Tightly-coupled convolutional transformer on time series forecasting," Neurocomputing, vol. 480, pp. 131–145, 2022. [34] S. Wu, X. Xiao, Q. Ding, P. Zhao, Y. Wei, and J. Huang, "Adversar- ial sparse transformer for time series forecasting," NeurIPS, vol. 33, pp. 17105–17115, 2020. [35] Y. Nie, N. H. Nguyen, P. Sinthong, and J. Kalagnanam, "A time series is worth 64 words: Long-term forecasting with transformers," in ICLR, 2023. [36] N. Kitaev, L. Kaiser, and A. Levskaya, "Reformer: The efficient trans- former," in ICLR. [37] M. Zaheer, G. Guruganesh, K. A. Dubey, J. Ainslie, C. Alberti, S. Onta ̃n ́on, P. Pham, A. Ravula, Q. Wang, L. Yang, and A. Ahmed, "Big bird: Transformers for longer sequences," in NeurIPS, vol. 33, pp. 17283–17297, 2020. [38] K. M. Choromanski, V. Likhosherstov, D. Dohan, X. Song, A. Gane, T. Sarlos, P. Hawkins, J. Q. Davis, A. Mohiuddin, L. Kaiser, et al., "Rethinking attention with performers," in ICLR. [39] S. Wu, X. Xiao, Q. Ding, P. Zhao, Y. Wei, and J. Huang, "Adversarial [44] M. B. Roth and P. Jaramillo, "Going nuclear for climate mitigation: An analysis of the cost effectiveness of preserving existing us nuclear power plants as a carbon avoidance strategy," Energy, vol. 131, pp. 67– 77, 2017. sparse transformer for time series forecasting," in NeurIPS, vol. 33, pp. 17105–17115, 2020. [40] K. Champion, B. Lusch, J. N. Kutz, and S. L. Brunton, "Data-driven discovery of coordinates and governing equations," PNAS, vol. 116, no. 45, pp. 22445–22451, 2019. [41] Z. Wu, S. Pan, G. Long, J. Jiang, X. Chang, and C. Zhang, "Con- necting the dots: Multivariate time series forecasting with graph neural networks," in SIGKDD, pp. 753–763, 2020. [42] P. Ball et al., "The start-ups chasing clean, carbon-free fusion energy," Nature, vol. 599, no. 7885, pp. 362–366, 2021. [43] R. Y. Cui, N. Hultman, D. Cui, H. McJeon, S. Yu, M. R. Edwards, A. Sen, K. Song, C. Bowman, L. Clarke, et al., "A plant-by-plant strategy for high-ambition coal power phaseout in china," Nat. Commun., vol. 12, no. 1, pp. 1–10, 2021. [45] L. Li, A. J. Blomberg, J. D. Spengler, B. A. Coull, J. D. Schwartz, and P. Koutrakis, "Unconventional oil and gas development and ambient particle radioactivity," Nat. Commun., vol. 11, no. 1, pp. 1–8, 2020. [46] C. Liu, W. Zhang, K. Ungar, E. Korpach, B. White, M. Benotto, and E. Pellerin, "Development of a national cosmic-ray dose monitoring sys- tem with health canada's fixed point surveillance network," J. Environ. Radioact., vol. 190, pp. 31–38, 2018. [47] Y.-J. Huang, Z.-H. Shang-Guan, F. Zhao, M.-G. Lin, X.-D. Sha, D.- Y. Luo, Q. Chen, and K. Peng, "A correlation study of continuously monitored gamma dose rate and meteorological conditions," J. Environ. Radioact., vol. 192, pp. 467–477, 2018. [48] J. Hirouchi, S. Hirao, J. Moriizumi, H. Yamazawa, and A. Suzuki, "Esti- mation of infiltration and surface run-off characteristics of radionuclides from gamma dose rate change after rain," J. Nucl. Sci. Technol., vol. 51, no. 1, pp. 48–55, 2014. [49] J. F. Mercier, B. L. Tracy, R. D'Amours, F. Chagnon, I. Hoffman, E. P. Korpach, S. Johnson, and R. K. Ungar, "Increased environmental gamma-ray dose rate during precipitation: a strong correlation with contributing air mass," J. Environ. Radioact., vol. 100, no. 7, pp. 527– 533, 2009. [50] M. Kowatari, H. Yoshitomi, S. Nishino, Y. Tanimura, T. Ohishi, P. Kessler, S. Neumaier, and A. R ̈ottger, "Establishment of a Low Dose Rate Gamma Ray Calibration Field for Environmental Radiation Monitoring Devices," Radiat. Prot. Dosimetry., pp. 1–8, 2019. [51] Y. K. Chan and Y. C. Tsai, "Multiple regression approach to pre- for Chinshan nuclear power plant," turbine-generator output dict Kerntechnik, vol. 82, no. 1, pp. 24–30, 2017. [52] S. Grape, E. Branger, Z. Elter, and L. P. Balkest ̊ahl, "Determination of spent nuclear fuel parameters using modelled signatures from non- destructive assay and random forest regression," Nucl. Instrum. Methods Phys. Res., Sect. A, vol. 969, p. 163979, 2020. [53] J. Choi and S. J. Lee, "Consistency Index-Based Sensor Fault Detection System for Nuclear Power Plant Emergency Situations Using an LSTM Network," Sensors, vol. 20, no. 6, p. 1651, 2020. [54] J. Zhang, Z. Pan, W. Bai, and X. Zhou, "Pressurizer water level reconstruction for nuclear power plant based on gru," in IMCCC, pp. 1675–1679, 2018. [55] D. P. Kingma and J. A. Ba, "Adam: A method for stochastic optimiza- tion," in ICLR, vol. 434, pp. 1–15, 2015. [56] T. M. Nguyen, V. Suliafu, S. J. Osher, L. Chen, and B. Wang, "Fmm- former: Efficient and flexible transformer via decomposed near-field and far-field attention," in NeurIPS, vol. 34, pp. 29449–29463, 2021. [57] M. Zaheer, G. Guruganesh, K. A. Dubey, J. Ainslie, C. Alberti, S. Ontanon, P. Pham, A. Ravula, Q. Wang, L. Yang, et al., "Big bird: Transformers for longer sequences," Advances in neural information processing systems, vol. 33, pp. 17283–17297, 2020.
http://arxiv.org/abs/2302.10423v1
2023-02-21T03:24:17
2023-02-21T03:24:17
Criminal Investigation Tracker with Suspect Prediction using Machine Learning
An automated approach to identifying offenders in Sri Lanka would be better than the current system. Obtaining information from eyewitnesses is one of the less reliable approaches and procedures still in use today. Automated criminal identification has the ability to save lives, notwithstanding Sri Lankan culture's lack of awareness of the issue. Using cutting-edge technology like biometrics to finish this task would be the most accurate strategy. The most notable outcomes will be obtained by applying fingerprint and face recognition as biometric techniques. The main responsibilities will be image optimization and criminality. CCTV footage may be used to identify a person's fingerprint, identify a person's face, and identify crimes involving weapons. Additionally, we unveil a notification system and condense the police report to Additionally, to make it simpler for police officers to understand the essential points of the crime, we develop a notification system and condense the police report. Additionally, if an incident involving a weapon is detected, an automated notice of the crime with all the relevant facts is sent to the closest police station. The summarization of the police report is what makes this the most original. In order to improve the efficacy of the overall image, the system will quickly and precisely identify the full crime scene, identify, and recognize the suspects using their faces and fingerprints, and detect firearms. This study provides a novel approach for crime prediction based on real-world data, and criminality incorporation. A crime or occurrence should be reported to the appropriate agencies, and the suggested web application should be improved further to offer a workable channel of communication.
[ "S. J. Dilmini", "R. A. T. M. Rajapaksha", "Erandika Lakmali", "S. P. S. Mandula", "D. D. G. Delgasdeniya", "Pradeepa Bandara" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10423v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10423v1", "@rel": "related", "@type": "application/pdf" } ]
[ "International Journal of Engineering Applied Sciences and\n Technology, 2023, Vol 7, No 9, 34-39" ]
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.CY" ]
International Journal of Engineering Applied Sciences and Technology, 2022 Vol. 7, No. 9, Pages 34-39 Published Online January 2023 in IJEAST (http://www.ijeast.com) CRIMINAL INVESTIGATION TRACKER WITH SUSPECT PREDICTION USING MACHINE LEARNING Dilmini S. J Faculty of Computing Sri Lanka Institute of Information Technology Malabe, Sri Lanka Rajapaksha R.A.T.M Faculty of Computing Sri Lanka Institute of Information Technology Malabe, Sri Lanka Erandika Lakmali University of Kelaniya Dalugama, Kelaniya, Sri Lanka Mandula S.P. S Faculty of Computing Sri Lanka Institute of Information Technology Malabe, Sri Lanka Delgasdeniya D.D. G Faculty of Computing Sri Lanka Institute of Information Technology Malabe, Sri Lanka Pradeepa Bandara Faculty of Computing Sri Lanka Institute of Information Technology Malabe, Sri Lanka Abstract - An automated approach to identifying offenders in Sri Lanka would be better than the current system. Obtaining information from eyewitnesses is one of the less reliable approaches and procedures still in use today. Automated criminal identification has the ability to save lives, notwithstanding Sri Lankan culture's lack of awareness of the issue. Using cutting-edge technology like biometrics to finish this task would be the most accurate strategy. The most notable outcomes will be obtained by applying fingerprint and face recognition as biometric techniques. The main responsibilities will be image optimization and criminality. CCTV footage may be used to identify a person's fingerprint, identify a person's face, and identify crimes involving weapons. Additionally, we unveil a notification system and condense the police report to Additionally, to make it simpler for police officers to understand the essential points of the crime, we develop a notification system and condense the police report. Additionally, if an incident involving a weapon is detected, an automated notice of the crime with all the relevant facts is sent to the closest police station. The summarization of the police report is what makes this the most original. In order to improve the efficacy of the overall image, the system will quickly and precisely identify the full crime scene, identify, and recognize the suspects using their faces and fingerprints, and detect firearms. This study provides a novel approach for crime prediction based on real-world data, and criminality incorporation. A crime or occurrence should be reported to the appropriate agencies, and the suggested web application should be improved further to offer a workable channel of communication. International Journal of Engineering Applied Sciences and Technology, 2022 Vol. 7, No. 9, Pages 34-39 Published Online January 2023 in IJEAST (http://www.ijeast.com) Keywords- Criminal Investigation, Suspect Prediction, Face Recognition, Fingerprint Detection, Forensic Science, Police Data Processing I. INTRODUCTION This research presents a desktop program that is more efficient than current approaches for quickly and accurately identifying offenders based on suspects' faces, fingerprints, and the detection of weapons. There is presently no comprehensive system in place in Sri Lanka that makes use of cutting-edge technology to spot illegal activity and alert the appropriate authorities right away. A system will acquire and preserve information on crimes while taking the circumstances into account, ensuring that parties and the rest of the community are aware of specific occurrences in real time. It will then look at and add information that could be useful for future research. A team must come up with and implement a sophisticated approach for compiling data and analyzing it to get the appropriate conclusion in line with that vast field of research. The Sri Lankan Penal Code was initially adopted as a reaction to the ambiguity and sufficiency of the nation's pre-existing criminal legislation. Despite some updates, this Penal Code is still in effect today. It is recognized that insanity, drunkenness, need, duress, and private defense are all strong defenses against criminal liability. The ability to reason, or "men's rea," is deemed absent in children under the age of eight [1]. A crime is defined as "an act done in violation of a law banning it or omitted in violation of a law ordering it" in its most basic form. Anyone who commits a crime may be subject to repercussions from the police and the government since it is a disgusting and illegal activity that breaks the law [2]. A criminal is a person who has either committed or is currently committing a crime. Crime is a societal blight that has a wide range of negative effects on our society. Criminality is growing increasingly pervasive in our society. 10% of criminals are responsible for 50% of all crimes. Crime is essentially an "unpredictable" occurrence. It is not limited by space or time. Everything depends on what individuals do. Illegal actions can take many different forms, ranging from careless driving to terrorist attacks. Criminals produce a considerable quantity of data via their various operations, which may be accessible in a range of ways. As a result, it might be challenging to assess crime data. Data mining is a method for obtaining useful information from enormous amounts of data [3]. Technology is underutilized when it comes to deterring crime and identifying offenders, while criminals today employ more advanced tools to perpetrate crimes. II. RELATED WORK The same subjects have been emphasized within the literature review, along with the related research roles and components. The major goal of this research is to create a completely automated criminal investigation and tracking system in Sri Lanka that includes a suspect prediction system using CCTV images of public places. This central system is composed of four components. They are the following: the face detection system, the weapon detection, and alarm the fingerprint detection system, the smart notification system, and the content summarizer. There isn't a system in operation right now that has all four of these components. trigging systems, Algorithms for detecting and identifying fingerprints in criminal investigations were developed by Khin Nandar Win and his colleagues. Fingerprints are the skin's identifying features. We may use it to identify someone because of its unusual roughness and form. Additionally, fingerprints can be created by applying fluids, such as ink or plasma, to the skin or by pressing an assumed print into a delicate layer [4]. The fingerprint image's to boost biometric quality has identification's reliability when used with AFIS. Ding et al. developed the orientation-selective 2D Adaptive Chebyshev Band-pass Filter (ACBF), also known as the fingerprint enhancement filter [5]. to be raised in order Wati and his colleagues demonstrated a system design for Face Detection and Recognition in Smart Home Security. They also discussed how the concept was implemented using MyRIO 1900 and LabVIEW, respectively. A camera that is USB-connected to MyRIO is used to take pictures of people. When tested with a live picture, the facial recognition technology attained an accuracy of 80% [6]. The most common form of home security system requires constant use of the key to open and close the door and is mechanical. It is believed that using traditional security methods is ineffective and wasteful. Using the face increases security because it cannot be reproduced or changed hands [7]. The closed-circuit television (CCTV) operator develops video blindness after 20 to 40 minutes of active monitoring, according to a study by Dadashi and his colleagues (Research, 2003; Cohen et al., 2009; Dadashi, 2008). Over the past two decades, academics and industry professionals have focused their research on developing surveillance systems that can detect suspicious conduct (Zhou & Tan, 2010; Liwei et al., 2010; Kishore et al., 2012; Mandrupkar et al., 2013). Automation is required for complex scenarios to reduce the effort of the human operator and improve performance [8]. As a result, it is still required to intervene, modernize, and switch from traditional to intelligent and smart monitoring systems (Shah et al., 2007; Tian et al., 2008). There is ZERO human participation in IVSS. The sophisticated monitoring system immediately sends out a warning in the event of any suspicious behavior or illegal activity. The operator is able to focus completely on the video feed and take useful action as a consequence. S. A. Kovalchik and his team looked at new measures that provide metrics for an information-sharing system in a community of sex offenders in Southern California. On each of the four focus occurrences, offenders were matched (citations, field interviews, crime cases, and arrests). The quantity and timing of police events were related to the sharing of information on sex offender registry status [9]. Text summarizing, which Laith Abualigah and his four collaborators devised, creates summaries from raw sources by International Journal of Engineering Applied Sciences and Technology, 2022 Vol. 7, No. 9, Pages 34-39 Published Online January 2023 in IJEAST (http://www.ijeast.com) retaining noteworthy information. Systems for text summarizing follow extractive and abstractive principles. They create extractive-compressive summaries for oracles. KALIMAT corpus of 18 M words is utilized to assess the proposed method [10]. III. RESEARCH OBJECTIVES Through public place monitoring, this research aims to identify crimes and provide the essential information and a visual representation of the reported occurrence to the appropriate security services. This project aims to find and identify offenders more quickly and precisely than the present methods by using their faces, fingerprints, weapons, and picture enhancement. Additionally, the police report summary is presented here. The sub-goals are as follows: A. Fingerprint images are used to identify suspects. Those images might not be appropriate for use in the following procedures. A high-quality picture is necessary in order for the system to identify fingerprints with accuracy. It is required to increase the matching rate of the image enhancement method's processing speed and quality in comparison to other techniques on the market. B. The core objective of developing an AI-based solution to assess obtained data and provide them as crucial proof comes to mind when it comes to the approach. As a result, the main emphasis should be on real-time video collection, processing, and analysis of the data obtained, identification of criminal conduct, notification of the relevant authorities, and highlighting of the original footage. C. Creating and deploying an automated system to detect and identify weapon-related crimes and alarms are primarily focused on finding weapons like firearms and knives in public spaces that are being held by people to commit a damaging deed. Identify the most common weapons and crime trends here. Investigate and examine the data set, Create an appropriate algorithm for CCTV data preparation, Utilize an algorithm to determine the best method for feature extraction of firearms, Use live CCTV images, and train the model to identify and categorize firearms. Determine and train the model to quickly classify crimes involving weapons. D. The content summarizer and smart notification system are the system's last stages. Because it is so helpful to the police department and other authorized parties in conducting a criminal investigation, this web-based application was created. Here, the notice will automatically send to the closest police station with the pertinent date, time, and position when the quiet alarm is activated at the spot where it is installed. The generation of the summary of the police report has also saved time in this case. III. METHODOLOGY In this study, online apps are employed to identify suspects rapidly and reliably. A smart notification system, content summary, fingerprint detection, face identification, and object detection from the CCTV footage will conduct the main tasks alternately. Authorities can add offenders to the system thanks to our technology. Our technology is expected to be able to recognize and apprehend anyone who is intending to conduct or has already committed a crime. The proposed strategy provides Sri Lanka's state security sector great potential to curtail and ultimately eradicate criminal activity. Fig. 1. Overall System Diagram A. Fingerprint Detection - First, we created a dataset and Oregon the images. and we build up a Siamese network with the images. the Siamese network is the core here which builds up with the convolutional neural network (CNN) architecture algorithm. it gives a similarity rate of 0,1 when we input the image of the fingerprint. Additionally, if a fingerprint is not already recorded in the database, one is created and added automatically. B. Face detection and identification - Here we used Face Net, a pre-trained model. we newly fine- tuned the pictures and after that when we give a new image to the system, it predicts by face-trained model and gives the ArcFace. later it saved this feature vector and gives a key. when we input a new suspect's face image and it checks the similarity between the face vector through cosine similarity. the Face Net is the main model and gives a 0,1 value via the cosine similarity matrix. it calculates the users' similarity when the rate is more than .8. International Journal of Engineering Applied Sciences and Technology, 2022 Vol. 7, No. 9, Pages 34-39 Published Online January 2023 in IJEAST (http://www.ijeast.com) C. Weapon detection and alarm trigging - Due to our interest in real-time detection, we are particularly concerned with classification speed. Additionally, we are particularly concerned with accuracy because a false alarm could result in very unfavorable reactions. These two factors make our project distinct from other Object Classification problems. When choosing the optimal course of action, we must find the ideal compromise between precision and quickness. On the identification of firearms in picture and video data, some research has been done. We reviewed works on the detection of violent movie scenes, the analysis of infrared data for concealed weapons, and the identification of guns in body camera footage as part of our assessment of image classification research. Olmos, Tabik, and Herrera look at alarms that go off automatically when a gun is spotted in surveillance footage (Automatic Handgun Detection Alarm in Videos Using Deep Learning) [6]. Although this work uses deep learning/neural net techniques, the majority of research in the field has not. The project uses YOLO V7 to fine-tune the action sequence of a revolver being drawn. D. Smart notification system and content summarizer - The police can utilize a web application that is part of the smart notification system to be informed of crises and criminal activity. Here, we activate a quiet alarm in a crowded area (eg: Bank). If the system detects a weapon, the silent trigger activates and sends a notice directly to the nearest police station with the pertinent time, date, and position pinned on GPS. The basic objective of text summarizing is to extract the most accurate and useful information from any data source. This situation is special in that Sri Lankan authorities have not yet discovered or shut down the police record and report converter. Summary creation is useful for many Natural Language Processing (NLP) tasks. In NLP, extractive and abstractive text summarization are the two basic categories. [11] I choose extractive summarization in this case since it draws out key terms from the provided text. The first step in the content summarization method used by our technology is to exclude frequent terms like am and are. After that, create an array from the sentence. Ex: I return home. I and go are often used terms. The highlight is home. The text is then numbered. The words are then given a numerical number and are added value in accordance with their significance. After that, create a NumPy array from the text. According to the word's and number's priority, a calculation is made. We then receive the finished product. To produce a word, that priority is required. It displays the text's strongest phrases. With this, a sizable document is sent to the person who drafts the police report. This entails reading it to someone else while highlighting the key passages. They can read it effortlessly, which is a benefit. And all of this is done to shorten the time needed. When we provide a text or document, the result is significantly shorter than the one provided. This also serves as an introduction to Sri Lanka. This is frequently utilized while reading a police document and pulling out the key points. We used T5 architecture for Sinhala language summarization. IV. RESULTS AND DISCUSSION This sector presents the results and discoveries obtained through training and testing methods. A. Fingerprint detection and identification system - The system compares and matches the picture that we enter with the database's image-matching rate. The algorithm recognizes him as a suspect if there is a matching rate of more than 80% from that. [12] The database then displays the suspect's information, including name, age, and ID card number. The database will save the supplied image as a new image if it does not match any of the photos already there. Fig. 2. Detection of fingerprint in python B. Face detection and identification system - Here, we discuss several facets of the face. This system has advanced sufficiently for it to distinguish a sideways-facing face. [13] We also become better to the point where we can recognize faces in hazy videos. Fig. 3. Face detection in python International Journal of Engineering Applied Sciences and Technology, 2022 Vol. 7, No. 9, Pages 34-39 Published Online January 2023 in IJEAST (http://www.ijeast.com) C. Weapon detection and alarm trigging system - We detect the weapons hidden in the body or in the clothes depending on how their form shifts, are being worn. We are putting a lot of effort into finding hidden weapons and have already created a method to detect guns. Fig. 5. Content summarizer Fig. 6. Web application V. CONCLUSION AND FUTURE WORK The recommended remedy allows for just incident detection. Though it would be possible to adapt this system to foresee incidents as technology advances. The data acquired from the CCTV stream will be used in the next system training. To provide a viable channel of communication between a crime or incident and pertinent agencies, the recommended web application should be enhanced further. This study suggests a unique method for character training, crime including weapons, crime prediction based on real-world data, and face and fingerprint identification. The suggested approach was tested, and the results of the subsystems were compared to find confirmation. The police report summary is also given a lot of weight by the system. V. REFERENCE [1] [2] Library, T. '. (2022). Criminal Justice system of Sri Lanka. (UpCounsel Technologies) Retrieved from https://www.upcounsel.com/lectl-criminal-justice- system-of-sri-lanka Shanti Nandana Wijesinghe, M. L. (December 2016). Sri Lanka: Interviews with Prosecutors and Criminal Defense Lawyers Across the Globe. Research Gate. [3] [4] Shanth,Y. D. (2018). Crime Investigation Monitoring and Public Security Information System for Sri Lanka Police. Colombo: University of Colombo School of Computing. S.S. Mudholkar, P. M. (2012). Biometrics Authentiction Technique For,. India. Khin Nandar Win, K. L. (2019). Khin Nandar Win, Kenli Li, Jianguo Chen, Philippe Fournier Viger,. Elsevier B.V. [5] Fig. 4. Weapon detection in python D. Smart notification and content summarizer - Police officers may respond right away after receiving the notification thanks to our online application. When a weapon is detected, the system sounds the alert and notifies the user via the website. The notice contains all the pertinent details about the occurrence. the time, place, and date. For greater accuracy, it's conceivable that we'll submit a CCTV video and show it alongside the notification. The police report or record is summarized on the other side. We all are aware that a police report or criminal report has lengthy paragraphs and circumstances. As a result, reading the record and acquiring a sense of the occurrence takes a lot of time for the officers under this approach, when a police officer enters any police report or document into the system, it summaries the extensive context and outputs the most significant and helpful lines or ideas to the officer. Officers can therefore quickly read the written summary and understand it. They only need to spend a short amount of time on this. In order to find the most challenging facts in documents, this study illustrates a programmed method for reflecting all accessible information using non-fuzzy ideas on a range of extracted data. This is highly unique to our study project since the recommended method, which employs a small number of fuzzy rules, may evolve, and be used with emerging intelligent robots that can assess writing. International Journal of Engineering Applied Sciences and Technology, 2022 Vol. 7, No. 9, Pages 34-39 Published Online January 2023 in IJEAST (http://www.ijeast.com) [12] [13] November Saponara, S., Elhanashi, A., & Zhen, Q. (n.d.). Recreating Fingerprint Images by Convolutional Neural Network Autoencoder Architecture. Retrieved 02 from https://ieeexplore.ieee.org/document/9598889 Florian Schroff, D. K. (n.d.). FaceNet: A Unified Embedding for Face Recognition and Clustering. IEEE. [14] O. S. A. Council. (28 4 2020. [Online]). Sri Lanka 2020 Crime & Safety Report. Retrieved from Available: https://www.osac.gov/Country/SriLanka/Content/Detai l/Report/02c5e26f-e7eb-44a8-b536-188dea9af39f 2021, [6] Yassin Kortli 1, 2. J. (2020). Face Recognition Systems: A Survey. MDPI. [8] [9] [7] Wati, D. A. (2017). Design of face detection and recognition . International Conferences on . 2nd International conferences on Information Technology, Information Systems and Electrical Engineering (ICITISEE) Dongtian Zheng1, a. H. (2017). A design of endoscopic imaging system for hyper long pipeline based on wheeled pipe robot. AIP Publishing. S. A. Kovalchik and r. . A. Jackson. (2016.). "Developing Outcome Measures for Criminal Justice Information Sharing: A Study of a Multi- Jurisdictional,". USA. Laith Abualigah, M. Q. (2020). Text Summarization: A Brief Review. ResearchGate. Jablonski, J. (2022). Natural Language Processing With Python's NLTK Package. ( Real Python) Retrieved from https://realpython.com/nltk-nlp-python/ [11] [10]
http://arxiv.org/abs/2302.10418v2
2023-02-28T01:02:38
2023-02-21T03:11:21
MAC-PO: Multi-Agent Experience Replay via Collective Priority Optimization
Experience replay is crucial for off-policy reinforcement learning (RL) methods. By remembering and reusing the experiences from past different policies, experience replay significantly improves the training efficiency and stability of RL algorithms. Many decision-making problems in practice naturally involve multiple agents and require multi-agent reinforcement learning (MARL) under centralized training decentralized execution paradigm. Nevertheless, existing MARL algorithms often adopt standard experience replay where the transitions are uniformly sampled regardless of their importance. Finding prioritized sampling weights that are optimized for MARL experience replay has yet to be explored. To this end, we propose MAC-PO, which formulates optimal prioritized experience replay for multi-agent problems as a regret minimization over the sampling weights of transitions. Such optimization is relaxed and solved using the Lagrangian multiplier approach to obtain the close-form optimal sampling weights. By minimizing the resulting policy regret, we can narrow the gap between the current policy and a nominal optimal policy, thus acquiring an improved prioritization scheme for multi-agent tasks. Our experimental results on Predator-Prey and StarCraft Multi-Agent Challenge environments demonstrate the effectiveness of our method, having a better ability to replay important transitions and outperforming other state-of-the-art baselines.
[ "Yongsheng Mei", "Hanhan Zhou", "Tian Lan", "Guru Venkataramani", "Peng Wei" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10418v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10418v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI", "cs.MA" ]
MAC-PO: Multi-Agent Experience Replay via Collective Priority Optimization Hanhan Zhou The George Washington University Washington, DC, United States [email protected] Yongsheng Mei The George Washington University Washington, DC, United States [email protected] Tian Lan The George Washington University Washington, DC, United States [email protected] 3 2 0 2 b e F 8 2 ] G L . s c [ 2 v 8 1 4 0 1 . 2 0 3 2 : v i X r a Guru Venkataramani The George Washington University Washington, DC, United States [email protected] Peng Wei The George Washington University Washington, DC, United States [email protected] ABSTRACT Experience replay is crucial for off-policy reinforcement learning (RL) methods. By remembering and reusing the experiences from past different policies, experience replay significantly improves the training efficiency and stability of RL algorithms. Many decision- making problems in practice naturally involve multiple agents and require multi-agent reinforcement learning (MARL) under cen- tralized training decentralized execution paradigm. Nevertheless, existing MARL algorithms often adopt standard experience replay where the transitions are uniformly sampled regardless of their im- portance. Finding prioritized sampling weights that are optimized for MARL experience replay has yet to be explored. To this end, we propose MAC-PO, which formulates optimal prioritized experi- ence replay for multi-agent problems as a regret minimization over the sampling weights of transitions. Such optimization is relaxed and solved using the Lagrangian multiplier approach to obtain the close-form optimal sampling weights. By minimizing the resulting policy regret, we can narrow the gap between the current policy and a nominal optimal policy, thus acquiring an improved prior- itization scheme for multi-agent tasks. Our experimental results on Predator-Prey and StarCraft Multi-Agent Challenge environ- ments demonstrate the effectiveness of our method, having a better ability to replay important transitions and outperforming other state-of-the-art baselines. KEYWORDS Multi-Agent Reinforcement Learning; Experience Replay; Priority Optimization ACM Reference Format: Yongsheng Mei, Hanhan Zhou, Tian Lan, Guru Venkataramani, and Peng Wei. 2023. MAC-PO: Multi-Agent Experience Replay via Collective Priority Optimization. In Proc. of the 22nd International Conference on Autonomous Agents and Multiagent Systems (AAMAS 2023), London, United Kingdom, May 29 – June 2, 2023, IFAAMAS, 17 pages. 1 INTRODUCTION Reinforcement learning (RL) has demonstrated great success in solving challenging problems [26, 50]. For off-policy RL, experience Proc. of the 22nd International Conference on Autonomous Agents and Multiagent Sys- tems (AAMAS 2023), A. Ricci, W. Yeoh, N. Agmon, B. An (eds.), May 29 – June 2, 2023, London, United Kingdom. © 2023 International Foundation for Autonomous Agents and Multiagent Systems (www.ifaamas.org). All rights reserved. replay mechanism [31, 40] allows utilizing history experiences in the replay buffer that stores the most recently collected transitions for training. It has been shown to significantly improve policy learning and RL algorithms' stability. Due to these benefits, various approaches [49, 51, 66] for computing priority scores of experiences have been proposed for single-agent RL. For instance, prioritized experience replay (PER) [49] leverages predefined metrics for pri- oritizing experience based on the temporal-difference (TD) error related to the loss of the critic network. It calculates the sampling probabilities proportional to the magnitude of TD error, resulting in a non-uniform sampling/prioritization scheme in Q-learning [65]. In practice, we often face RL tasks involving multiple agents shar- ing the same environment, e.g., in autonomous driving [7, 21] and robotics and planning [22, 30, 35]. To coordinate multiple agents and learn desired joint behavior from their collective experiences, we require multi-agent reinforcement learning (MARL) [2, 24, 60], such as value-based methods QMIX [46] and QPLEX [61], or policy- based methods COMA [12] and MADDPG [34]. These approaches leverage centralized training decentralized execution (CTDE) [27] and often employ standard memory replay buffers with a uniform sampling of transition history. However, in MARL problems, such a standard sampling strategy of the replay buffer cannot reflect the dynamics in the environment caused by multi-agent interac- tions. Therefore, indiscriminately training from past experiences will make agents less capable of using experiences optimally. Al- though we can impart existing single-agent prioritization schemes directly to the joint action-value function of MARL, such a naive ap- plication is oblivious to the interaction between multiple agents in the shared environment and may lead to sub-optimal performance. Thus, priority optimization for experience replay in MARL is still an open problem. To this end, we propose MAC-PO, which formulates MARL pri- oritized experience replay problems as a regret minimization over the sampling weights of different state-action values. Specifically, we define policy regret as the difference between the expected dis- counted reward of a nominal optimal policy and that of the current policy under given sampling weights. By minimizing such a pol- icy regret by considering its upper bound, we can narrow the gap between the optimal and current policies with respect to the sam- pling weights, leading to an optimal solution of sampling weights with minimum regret. We note that similar regret minimization techniques have been employed in single-agent RL settings [33]. Our paper expands it to analyze multi-agent prioritized experience replay and develops new solutions, e.g., to handle joint actions of multiple agents and to analyze concurrent optimality constraints. It turns out that the optimal sampling weights in MARL now depend on the collective policies of decentralized agents. To the best of our knowledge, this is the first proposal for optimizing prioritized experience replay in cooperative MARL. In particular, we show that the proposed optimization can be solved via the Lagrangian multiplier method [4] considering an upper bound of the regret. Since we focus on multi-agent prioritized experience replay problems, the optimization objective is defined by the joint policy of all agents. Therefore, when we further analyze the Lagrangian conditions for optimality, the agents' conditions depend on each other and become a vector form. Further, by ex- amining a weighted Bellman equation, we leverage the implicit function theorem [28] for multiple agents and apply a group of Karush–Kuhn–Tucker (KKT) [14] conditions to find the optimal sampling weights in closed form. Our results illuminate the key principles contributing to opti- mal sampling weights in multi-agent prioritized experience replay. The optimal sampling weights can be interpreted to consist of four components: Bellman error, value enhancement, on-policiness of available transitions, and a new term depending on joint action probabilities. While the first three have been identified in single agent settings [29, 33], our paper shed light on a new term - as a function of joint action probabilities - to reveal that optimal sam- pling weights of multi-agent prioritized experience replay should depend on the interaction among all the agents within an envi- ronment. More specifically, we should assign the highest sampling weights to transitions only if one agent's action probability is small in the transition while all other agents' action probabilities are large. The result – slightly counter-intuitive since higher weights are assigned to transitions with more differentiated action probabil- ities (rather than similar ones) – is quantified and formalized as a new theorem in our paper. Based on this result, we also present an approximated solution for estimating sampling weights in problems involving many agents or having limited information for an exact solution. Following the theoretical analysis, we propose a MARL algo- rithm, MAC-PO, for multi-agent prioritized experience replay via re- gret minimization. Like existing methods, MAC-PO can be plugged into any MARL algorithms with a memory replay buffer. We vali- date the effectiveness of MAC-PO in StarCraft Multi-Agent Chal- lenge (SMAC) [48] and Predator-Prey [5] through comparison with other single-agent experience replay methods (adapted to MARL problems by considering all agents as a conceptual agent). Moreover, we also compared MAC-PO with state-of-the-art MARL algorithms. In the experiments, MAC-PO demonstrates improved convergence and superior empirical performance. The main contributions of our work are as follows: • We propose a novel method, MAC-PO, which formulates multi-agent experience replay as a policy regret minimiza- tion and solves the optimal sampling weights in closed form. • The theoretical results illuminate a new factor in optimal sampling weights and motivate the design of new MARL experience replay algorithms with both exact and approxi- mated weights. • Experiment results of MAC-PO in SMAC and Predator-Prey environments demonstrate superior convergence and empiri- cal performance over various baselines, including experience replay and state-of-the-art MARL methods. 2 BACKGROUND 2.1 Partially Observable Markov Decision Process In this work, we consider a multi-agent sequential decision-making task as a decentralized partially observable Markov decision process (Dec-POMDP) [44] consisting of a tuple G = ⟨S, U , P, R, Z, O, n, γ⟩, where s ∈ S describes the global state of the environment. At each time step, each agent a ∈ A ≡ {1, . . . , n} selects an action ua ∈ U , and all selected actions combine and form a joint action u ∈ U ≡ U n. Such a process leads to a transition in the environment based on the state transition function P (s ′|s, u) : S × U × S → [0, 1]. All agents share the same reward function r (s, u) : S × U → R with a discount factor γ ∈ [0, 1). In the partially observable environment, the agents' individual observations z ∈ Z are generated by the observation function O (s, u) : S × A → Z . Each agent has an action-observation history τa ∈ T ≡ (Z ×U )∗. Conditioning on the history, the policy becomes πa (ua |τa) : T × U → [0, 1]. The joint policy π has a joint action- value function: Q π (st , ut ) = Est +1:∞,ut +1:∞ [Rt |st , ut ], where t is the i=0 γirt +i is the discounted return. In this timestep and Rt = (cid:205)∞ paper, we adopt the CTDE mechanism. The learning algorithm has access to all local action-observation histories τ and global state s during training, yet every agent can only access its individual history in execution. Although we compute individual policy based on histories in practice, following the existing work [54], we will use πa (ua |s) in analysis and proofs for simplicity. 2.2 Policy Regret In MARL, we aim to find a joint policy π that can maximize the i=0 γirt +i ]. For a fixed policy, the expected return: η (π) = Eπ [(cid:205)∞ Markov decision process becomes a Markov reward process, where the discounted state distribution is defined as d π (s). Similarly, the discounted state-action distribution is defined as d π (s, u) = d π (s)π (u|s). Then, we will have the expected return rewritten as η (π) = 1 1−γ Ed π (s,u) [r (s, u)]. We assume a nominal optimal joint policy π ∗ such that π ∗ = arg maxπ η (π). The regret of the joint policy π is the difference be- tween the expected discounted reward of an optimal policy and that of the current policy as regret(π) = η (π ∗) −η (π). The policy regret measures the expected loss when following the current policy π instead of optimal policy π ∗. Since η (π ∗) is a constant, minimizing the regret is consistent with maximizing of expected return η (π). In this paper, we use regret as an alternative optimization objective for finding the optimal sampling weight in MARL tasks, along with multiple constraints, such as the Bellman equation. By minimizing the regret, the current joint policy πk of all agents' actions will approach the optimum π ∗. 2.3 Connection of Prioritized Sampling and Weighted Loss Function The design of prioritized sampling methods is not isolated from the loss function. Instead, the expected gradient of a loss function with non-uniform sampling is equivalent to that of a weighted loss function with uniform sampling, which facilitates the design of prioritized sampling algorithms [13]. Given a data sample set D of size d, a regular loss function L1 where we use a specific priority scheme pr (*) to sample the transitions, and another loss function L2 whose transitions are sampled uniformly, the two approaches are equivalent if we have the following requisition satisfied: ∇Q L1 = χ pr ∇Q L2, and i ∈ D is the uniformly sampled instance. where χ = (cid:205)i pr (i) d We can leverage such equivalence to analyze the correctness of approaches using non-uniform sampling by transforming the loss into the uniform-sampling equivalent or considering whether the new loss is in line with the target objective. It also provides a recipe for transforming a regular loss function L1 with a non-uniform sampling scheme into an equivalent weighted loss function L2 with uniform sampling. 3 RELATED WORKS 3.1 MARL Algorithms MARL algorithms have developed into neural-network-based meth- ods that can cope with high-dimensional state and action spaces. Early methods practice finding policies for a multi-agent system by directly learning decentralized value functions or policies. For example, independent Q-learning [57] trains independent action- value functions for each agent via Q-learning. [56] extends this technique to DQN [40]. Recently, approaches for CTDE have come up as centralized learning of joint actions that can conveniently solve coordination problems without introducing non-stationary. COMA [12] uses a centralized critic to train decentralized actors to estimate a counterfactual advantage function for every agent. Similar works [17, 34] are also proposed based on such analysis. Under CTDE manner, value decomposition approaches [8, 16] are widely used in value-based MARL. Such methods integrate each agent's local action-value functions through a learnable mixing function to generate global action values. For instance, QMIX [46] estimates the optimal joint action-value function by combining mentioned utilities via a continuous state-dependent monotonic function generated by a feed-forward mixing network with non- negative weights. QTRAN [52] and QPLEX [61] further extend the class of value functions that can be represented. ReMIX [39] provides a factorization weighting scheme to find the optimal pro- jection of an unrestricted mixing function onto monotonic function classes. PAC[69] and LAS-SAC[70] proposes to use latent assisted information [38] as extra-state information for better value fac- torization. Aside from methods focusing on tackling cooperative problems, other mechanisms can also solve competitive problems or mixed problems. MADDPG [34] utilizes the ensemble of poli- cies for each agent that leads to more robust multi-agent policies, showing strength in cooperative and competitive scenarios. Beyond that, the extensions [15, 23, 53] of MADDPG have been proposed to realize further optimization towards the original algorithm. In this paper, we focus on the cooperative setting and leverage a standard QMIX with a monotonic mixing network, along with an unrestricted QMIX [45] without a monotonic function for retrieving the optimal joint policy. 3.2 Single-Agent Experience Replay Many RL algorithms adopt prioritization to increase the learning speed, initially originating from prioritized sweeping for value iteration [41, 59]. Besides, they have also been used in other modern applications, such as learning from demonstrations [18]. Prioritized experience replay [49] is one of several popular improvements to the DQN algorithms [58, 64] and has been included in many algorithms combining multiple improvements [3, 19]. Variations of PER have been proposed for considering sequences of transitions [6, 9] or optimizing the prioritization function [66]. Furthermore, to favor recent transitions without explicit prioritization, alternate replay buffers have been raised [42]. [10, 67] studied the composition and size of the replay buffer, and [32] looked into prioritization in simple environments. Other important sampling approaches also greatly improved the performance. [29] re-weights updates to reduce variance. [33] uses the regret minimization method to design the prioritized experience replay scheme for the only agent in the environment. MaPER [43] employs model learning to improve experience replay by using a model-augmented critic network and modifying the rule of priority. Also, new loss function designs can help develop prioritization schemes [55]. So far, most works about experience replay are designed for single-agent reinforcement learning, and a limited number of works [1, 11, 63] investigate the possible extensions. In this paper, we proposed MAC-PO for MARL tasks by considering the interaction among multiple agents through collective priority optimization to seek an optimal multi- agent prioritization mechanism. 4 METHODOLOGY 4.1 Problem Formulation Let Qk denote the action-value function at iteration k. We lever- age B∗Qk−1 as the target with a Bellman operator B∗ and up- date Qk in tandem using a weighted Bellman equation: Qk = arg minQ ∈ Q Eμ [wk (s, u)(Q − B∗Qk−1)2 (s, u)], where wk (s, u) rep- resent non-negative sampling weights for different transitions that need to be optimized for the experience replay. To formulate the policy regret with respect to the joint action- value function, we consider a Boltzmann policy πk corresponding k ]T and to each agent's individual utilities Qa k k = eQa πa a) . Our objective is to minimize the policy regret η (π ∗) − η (π) over non-negative sampling weights under relevant constraints, i.e., , i.e., πk = [π 1 k k (τa,ua) /(cid:205)τa,u′ , ..., πn k (τa,u′ eQa a η (π ∗) − η (πk ) min wk s.t. Qk = arg min Q ∈ Q Eμ [wk (s, u)(Q − B∗Qk−1)2 (s, u)], (1) Eμ [wk (s, u)] = 1, wk (s, u) ≥ 0, where πk and π ∗ are Boltzmann policies for the current and nom- k inal optimal policy, and the latter can be obtained from another network. The sampling weights must sum up to 1, and μ is the dis- tribution that we uniformly sample data from the replay buffer. An additional table to summarize and explain the common notations is provided in Appendix A. 4.2 Solving Optimal Sampling Weights for Experience Replay Our goal is to seek the optimal priority by minimizing the regret at every iteration k, with respect to the weight w used for Bellman error minimization at iteration k. For this purpose, we consider an upper bound of the relaxed regret objective and formulate its Lagrangian by introducing Lagrangian multipliers regarding the constraints. It allows us to solve the proposed regret-minimization problem and obtain optimal projection weights in closed form (al- beit with a normalization factor Z ∗). Theorem 1 (Optimal sampling weight). The optimal weight wk (s, u) to a relaxation of the regret minimization problem in Equa- tion (1) with discrete action space is given by: wk (s, u) = 1 Z ∗ (Ek (s, u) + εk (s, u)), (2) where we have: Ek (s, u) = d πk (s, u) μ (s, u) |Qk − B∗Qk−1| n ∑︁ n (cid:214) n (cid:214) 1 + * exp(−|Qk − Q∗|) (cid:169) (cid:173) (cid:173) (cid:173) (cid:171) where Z ∗ is the normalization factor, and εk (s, u) is a negligible term when the probability of reversing back to the visited state is small or the number of steps agents take to revisit a previous state is large. π j k − n j=1 j≠i (cid:170) (cid:174) (cid:174) (cid:174) (cid:172) πi k i=1 i=1 , (3) Proof (Sketch). We give a sketch of the steps involved for com- pleteness below. The complete proof is provided in the Appendix B. The derivation of optimal weights consists of the following major steps: (i) Use a relaxation and Jensen's inequality to obtain a more tractable upper bound of the regret objective for minimization. (ii) Formulate the Lagrangian for the new optimization problem and analyze its KKT conditions. (iii) Compute various terms in the KKT condition and, in particular, analyze the gradient of Qk with respect to weights pk (defined through the weighted Bellman equation) by leveraging the implicit function theorem (IFT). (iv) Derive the optimal projection weights in closed form by setting the Lagrangian gradient to zero and applying KKT and its slackness conditions. Step 1: Relaxing the objective and using Jensen's Inequality. To begin with, we replace the original optimization objective function, the policy regret, with a relaxed upper bound. This replacement can be achieved through the following inequality: η (π ∗) − η (πk ) ≤ Ed πk (s,u) [|Qk − Q∗|(s, u)]. The proof of this result is given in the appendix. The key idea is to rewrite the regret using the expectation of the action-value functions with respect to discounted state distribution dπk . Af- ter that, we adopt Jensen's inequality [36] to continue relaxing the intermediate objective function. Consider a convex function (4) g(x) = exp(−x), a new optimization objective relaxed via Jensen's inequality generated from Equation (4) becomes: min wk − log Ed πk (s,u) [exp(−|Qk − Q∗|) (s, u)], (5) where the constraints still hold for the new optimization objective. Step 2: Computing the Lagrangian. In this step, we leverage the Lagrangian multiplier method to solve the new optimization prob- lem in Equation (5). For simplicity, we use pk that absorbs the data distribution μ into wk . The constructed Lagrangian is: L (pk ; λ,ψ ) = − log Ed πk (s,u) [exp(−|Qk − Q∗|) (s, u)] + λ( ∑︁ s,u pk − 1) − ψ Tpk, where pk is the weight wk multiplied by the data distribution μ, and λ,ψ are the Lagrange multipliers. Step 3: Computing the Gradients Required in the Lagrangian. Ac- can cording to the first constraint in Equation (1), the gradient ∂Qk ∂pk be computed via IFT given by: ∂Qk ∂pk = −[diag(pk )]−1 [diag|Qk − B∗Qk−1|]. We also derive the gradient ∂d πk (s,u) for solving the Lagrangian. ∂pk The derivation details are given in the appendix. Step 4: Deriving the Optimal Weight. After having the equation for two gradients and an expression of the Lagrangian, we can compute the optimal pk via an application of the KKT conditions, which needs to set the partial derivative of the Lagrangian equaling to zero, as: ∂L (pk ; λ,ψ ) ∂pk where the optimal weight wk can be acquired from the pk . = 0, □ The theoretical results shed light on the key factors determining an optimal sampling weight for experience replay. Specifically, the optimal weights consist of four components relating to the Bellman error, the value enhancement, the joint action probability, and the on-policiness of available transitions. We will interpret these four components next, provide the analyses of some special cases in which the transitions will be assigned with higher weights, and develop a deep MARL algorithm through approximations of the optimal sampling weights. Bellman error |Qk − B∗Qk−1|: is the estimation of the action value function after the Bellman update. This term measures the distance between the estimation and the Bellman target. A signifi- cant difference in this term means higher hindsight Bellman error and will lead to higher sampling weight assignment. This character is also similar to the prioritization criterion used in PER, which nev- ertheless considers more about the Bellman error in the previous iterations, i.e., |Qk−1 − B∗Qk−2|. Value enhancement exp(−|Qk −Q∗|): As we compute the absolute value between the current and optimal action-value function, the value enhancement term indicates that any transitions with less accurate action values compared to the optimal value estimation (i.e., a wider gap between Qk and Q∗) after the Bellman update should be assigned with lower weights. Conversely, a high sampling weight will be given if the current action value is approaching the optimal one. k (cid:206)n j=1,j≠i π j i=1 πi k − n (cid:206)n Joint action probability 1 + (cid:205)n : The i=1 agent policies determine the probabilities of choosing certain ac- tions. This result turns out that the optimal sampling weights de- pend on the individual policy of each agent as well, which is unique in the MARL task. According to this term, higher sampling weights will be assigned to transitions only if one agent's action probability is small in the transition while all other agents' action probabilities are large. This is a little counter-intuitive because we give higher weights to transitions with more differentiated action probabilities rather than similar ones. We will provide a thorough analysis in section 4.3 regarding studying the condition for the highest weight assignment in the general multi-agent scenario. d πk (s,u) μ (s,u) : The efficient up- date of the joint action value function can be achieved by focusing on transitions that are more possibly to be visited by the current policy, i.e., with a higher d πk (s, u). Such strategy has been empiri- cally studied in existing works [51]. Adding this term can speed up the search for the optimal Qk close to Q∗. Measurement of on-policy transitions 4.3 Approximated Weights via Joint Action Probability Studies Theorem 1 shows terms determining the sampling weights needed for transitions, where a function of the joint action probability is the new result for MARL tasks. Although numerical calculation for the joint action probability is available, to lower the computational complexity when the environment has many agents involved, we develop an approximated weighting scheme that can determine the joint action probability via action probabilities and action-value functions of agents. For this purpose, we present a new theorem indicating the condition for obtaining maximum probability and several special case studies. a, ..., uma For the environment, we consider a general MARL scenario with agent space of n, where we have a ∈ A ≡ {1, . . . , n}. Every step, each agent a selects an action from its action space U a, following a ∈ U a ≡ {u1 ui a }, where ma is the size of action space of agent a. Let the ̄ua ∈ U a denote the selected action of agent a at the step k from the action space. Due to the CTDE manner of MARL algorithms, the joint action value function space Q contains the combinations of ui a (i ranges from 1 to ma) for each agent a. 1 , . . . , uin For simplicity, we use Qi to be the shorthand of Q (s, ui1 n ), which represent a random action value function from Q space. In particular, considering one selected action combination ̄u = ( ̄u1, . . . , ̄un), the joint action-value function is ̄Q = Q (s, ̄u). Since we use Boltzmann policy to compute the action probability, for one agent a ∈ A with the action ̄ua, its individual policy is: πa k = E u e j −a ∼μ Q (s, ̄ua,u j −a) (cid:205)ma i=1 e E u j −a ∼μ Q (s,ui a,u j −a) = −a (cid:205)j μQ (s, ̄ua,u j −a (cid:205)j μQ (s,ui −a) a,u j e(cid:205) i=1 e(cid:205) (cid:205)ma −a) , (6) where −a represents all the agents except for target agent a, and μ is short for μ (s, ui1 n ) representing the data distribution. 1 , . . . , uin Under the general environmental setting, the state s will be fixed at each iteration, and the size of the action value function space Q is (cid:206)n a=1 ma with the dimension of n. Let the following function denotes the joint action probability: n ∑︁ n (cid:214) f def= 1 + π j k − n n (cid:214) πi k, (7) i=1 j=1 j≠i and we will provide another theorem indicating the conditions where we can acquire the maximum value of joint probability f in Equation (3). i=1 Theorem 2 (Maximum probability conditions). Considering a selected action value ̄Q with action combination ̄u of the step k, the joint action probability function reaches its maximum fmax if and only if the value of each action probability πi k is on the boundary (i.e., either 0 or 1) as well as at least one probability πa k equals to 0. Proof. See Appendix C. □ Based on Theorem 2, a higher joint action probability will be as- signed to ̄Q of which agents' action probabilities are on the bound- ary of the interval [0, 1] and at least one of the agents have its probability equaling 0. This conclusion casts light on determining the approximated sampling weights for MARL tasks. To better il- lustrate such an idea, we introduce several special case studies with respect to the selected ̄Q at step k. Case 1: single large value ̄Q. In this case, we assume only one action value ̄Q out of the action value function space Q is large, and values Qi of other action combinations elsewhere are negli- gibly small, represented by ν. These small values obey ν ≈ 0 and ν ≪ Qm. Therefore, according to Equation (6) and Theorem 2, the joint action probability for the selected action combination of ̄Q is lower since the action probability πa for each agent is similarly k large. In contrast, the action combinations with only one action difference (e.g., Q (s, ̄u−a1, ui a1 )) will be given with high weights αh. The remaining position, such as the action combinations with two or more different actions, along with ̄Q, will be assigned with low weight αl . Case 2: dual large values ̄Q, ̄Q ′. We propose only two large values ̄Q ≈ ̄Q ′ under this setting. Other positions are filled with negli- gible value ν. ̄Q ′ is the very same as ̄Q except that one agent's action is different, i.e., Qm = Q (s, ̄u) and ̄Q ′ = Q (s, ̄u−a1, ui a1 ). Since two large values equally share the importance over the action value space, based on given equations/conditions, we can drive those action combinations with only one different agent's action other than agent a will be assigned with medium weights αm, e.g., Q (s, ̄u−(a1,a2), ui a2 ). The positions where action combination a1 with one action difference over agent a1 will receive high weights αh, e.g., Q (s, ̄u−a1, ui′ a1 ). Besides, we will give low weight αl for other locations. , u j , u j Case 3: isolated large value ̄Q ′′ and ̄Q. Apart from given ̄Q, we assume an isolated large value with two or more actions different from ̄Q, i.e., ̄Q ′′ = Q (s, ̄u−(a1,a2), ui a2 ), which exists somewhere a1 in the action value function space, and satisfies ̄Q ≈ ̄Q ′′. Other action values are ν. In this situation, both two large values share the same importance, and we will assign the medium weight αm to ̄Q, ̄Q ′′, and the action combinations having one action different over agent a1 or a2, such as Q (s, ̄u−(a1,a2), ui′ a2 ). The rest of the a1 action combination values will be allocated with low weight αl . This special case demonstrates that if one or more action values , u j are extraordinarily large, indicating another joint policy candidate with latent high joint action probability, we should also heed such equivalent competitor and its local search. We can establish the approximation structure by studying from mentioned special cases. The scaled weights αl , αm, and αh provide an alternative solution that spares us from directly using the numer- ically computed sampling weights to solve the latent computational cost, yet the performance remains mainly impervious. 4.4 Proposed Algorithms Our analytical results in Theorem 1 identify four key factors deter- mining the optimal projection weights. The first term, relating to the Bellman error, recovers the designs in classic prioritized expe- rience replay. Specifically, when the Bellman error of a particular transition is high, which indicates a wide hindsight gap between Qk and the Bellman target, we may consider assigning a larger weight to this transition. Besides, the value enhancement term selectively emphasizes the importance of incoming transitions. Based on the difference between current Qk and ideal Q∗, it will compensate the near-optimal Qk with larger importance while penalizing non- optimal Qk with a smaller weighting modifier. Moreover, similar to previous studies, the measurement of on-policy transitions in the weighting expression underlines the useful information carried by more current, on-policy transitions. Our analysis also identifies a new term reflecting the interaction among agents in the MARL scenario: the joint action probability of multiple agents, which is crucial in obtaining optimal sampling weights for specific transitions. We interpret the joint action proba- bility term in optimal weights constrained by the given condition: one agent's action probability is small in the transition, while all other agents' action probabilities are large. We increase the weights for transitions satisfying this condition. On the contrary, we de- crease the weight if the condition fails to be satisfied. Following these theoretical results, we propose a MARL algo- rithm for collective priority optimization, MAC-PO, with regret- minimizing joint policy in multi-agent environments. We consider a new loss function with respect to the optimal sampling weights wk applied to the Bellman equation of, i.e., LMAC−PO = b ∑︁ i=1 wk (s, u)(Qk − yi )2 (s, u), (8) where b is the batch size, and yi = B∗Qk−1 is a fixed target that can be obtained through a target network. The Bellman error and joint action probability of all agents in the environment can be directly computed using Theorem 1. To compute the sampling weights for value enhancement term in prac- tice, we use the backbone of the classical value factorization MARL algorithm QMIX and leverage the unrestricted joint action-value function Q∗ to compute the approximated optimal action-value function quantitatively. Ideally, we could have included measure- ment of on-policy transitions term in the computation, but it is not readily available since the distribution d πk (s, u) in the numerator cannot be directly obtained. It is also worth mentioning that such term can be dismissed and the other terms in the weight expression are enough to provide a good estimate and lead to performance improvements, as shown in existing work [29]. Furthermore, based on our previous discussion, we designed an approximated counter- part, MAC-PO Approximation, by setting the threshold and scaling sampling weights values into low, medium, and high ones. The pseudo-codes are provided in Appendix D. 5 EXPERIMENTS In this section, we present our experimental results on Predator- Prey and SMAC benchmarks and demonstrate the effectiveness of MAC-PO by comparing the results with several state-of-the-art MARL baselines. Additionally, we compare MAC-PO and MAC-PO Approximation with other experience replay methods adapted from single-agent RL to multi-agent environments. Each comparison is implemented independently with fixed and optimized [37] hyper- parameters. We also conduct the ablation experiments to discuss the contribution of each term mentioned in Theorem 1. More imple- mentation details are provided in Appendix E. The code has been made available at: https://github.com/ysmei97/MAC-PO. 5.1 Comparison with Existing Experience Replay Methods In this experiment, we compare MAC-PO with other experience replay methods in the multi-agent environment SMAC. Since exist- ing experience replay methods are designed for the single-agent scenario, we borrow their core designs and transplant them to multi- agent environments by considering all agents as the conceptual agent to match the single-agent target in their original settings. Such transplanting will recover the most important ingredients from RL to MARL to the greatest extent. It is worth mentioning that many other algorithms are also introducing a variety of ex- perience replay schemes. Some of them [43, 55] depend on new components, and others [47] have different algorithm architectures. Since the backbone MARL algorithm of our choice in this exper- iment is QMIX, we do not expect a significant change over the algorithm architecture (e.g., actor-network) or major components (e.g., loss structure) as presented in other approaches to realize a relatively fair comparison. The first approach for comparing is PER [49]. Due to the equiv- alence between loss functions and non-uniform sampling for ex- perience replay [13], we reconstruct PER scheme by computing weights only related to the current TD error regarding the joint action-value function. We also compare our method with the one mentioned in DisCor [29], where the weights are calculated from the production of Bellman error and value enhancement terms, and ReMERN [33], which has an additional term describing action likelihood, and we extend it to the multi-agent case. Besides, we transplanted the mechanism from PSER [6], which is another ex- tension of PER, by applying an additional decay factor and window size on the weights for coming transitions. For this experiment, we set the decay factor as 0.4 and the window size as 5. Figure 1 shows the performance comparison among MAC-PO and other experience replay algorithms on three maps of SMAC benchmark, which are 3s_vs_5z, 5m_vs_6m, and MMM2. Compared to MAC-PO, other experience replay schemes underperform in im- proving learning performance. DisCor and ReMERN have higher final winning rates than the regular PER, demonstrating the ef- fectiveness of additional terms. PSER also acts better than PER (a) 3s_vs_5z (hard) (b) 5m_vs_6m (super hard) (c) MMM2 (super hard) Figure 1: Comparison between MAC-PO, MAC-PO Approximation and other experience replay methods on three SMAC maps (from hard to super hard), where MAC-PO outperforms the second best one – MAC-PO Approximation by 10%, 6%, and 4% on each map, respectively. (a) No punishment (b) Punishment = −1.5 Figure 2: Average reward per episode on the Predator-Prey tasks for MAC-PO and other MARL algorithms of two settings, where MAC-PO shows the profoundly better convergence speed and pretty good results. owing to its decaying mechanism for selecting history transitions. All transplanted algorithms from single-agent scenario act unsta- bly in the multi-agent environment, as we can notice the variance reflected by the shaded area in Figure 1. Besides, we also test our approximated sampling weight ap- proach, shown as MAC-PO Approximation in Figure 1. We set the higher weight αh as 0.75, medium weight αm as 0.5, and lower weight αl as 0.25. The final result is almost identical to the original MAC-PO with small nuance. For the original MAC-PO, the compu- tational complexity of obtaining sampling weights will increase if more agents get involved. Since the approximated MAC-PO uses scaled weights instead of numerical results, it will improve the computational efficiency of the original MAC-PO at the price of slightly sacrificing the overall performance. 5.2 Comparison with MARL Algorithms 5.2.1 Predator-Prey. We compare MAC-PO with MARL algorithms on a complex partially-observable multi-agent cooperative envi- ronment, Predator-Prey, that involves eight agents in cooperation as predators to catch eight prey on a 10×10 grid. In this task, a successful capture with the positive reward of 1 must include two or more predator agents surrounding and catching the same prey simultaneously, requiring a high level of cooperation. A failed coor- dination between agents to capture the prey, which happens when only one predator catches the prey, will receive a negative punish- ment reward. We select multiple state-of-the-art MARL algorithms for comparison, which include value-based factorization MARL al- gorithm (i.e., QMIX, WQMIX [45], and QPLEX), decomposed policy gradient method (i.e., VDAC [53]), and decomposed actor-critic approaches (i.e., FOP [68] and DOP [62]). All mentioned baselines have shown strength in handling MARL tasks in existing works. Figure 2 shows the performance of seven algorithms with dif- ferent punishments, where all results show the effectiveness of MAC-PO. Besides, regarding efficiency, we can spot that MAC-PO has the fastest convergence speed in seeking the best policy. In Fig- ures 2b, MAC-PO significantly outperforms other state-of-the-art algorithms in a hard setting requiring a higher level of coordination among agents as learning the best policy. Most MARL algorithms learn a sub-optimal policy where agents learn to work together with limited coordination. Although the performance of MAC-PO and WQMIX are similar, compared to the latter, MAC-PO converges to the optimal policy profoundly faster, demonstrating that our multi-agent optimal weighting scheme can efficiently learn from specific existing transitions. 7 N WHVWZLQUDWH0$&320$&32$SSUR['LV&RU5H0(5136(53(57 N WHVWZLQUDWH0$&320$&32$SSUR['LV&RU5H0(5136(53(57 N WHVWZLQUDWH0$&320$&32$SSUR['LV&RU5H0(5136(53(57 N 0HDQ5HZDUG'23)239'$&:40,;43/(;40,;0$&327 N 0HDQ5HZDUG'23)239'$&:40,;43/(;40,;0$&32 (a) 3s_vs_5z (hard) (b) 5m_vs_6m (hard) (c) MMM2 (super hard) Figure 3: Comparison between MAC-PO and other MARL algorithms on three SMAC maps (from hard to super hard). MAC-PO achieves the best results with the optimal weighting scheme alone, outperforming the second best result by 11%, 4%, and 16% on each map, respectively. SMAC. Next, we evaluate MAC-PO on the SMAC bench- 5.2.2 mark. We report the experiments on three maps consisting of two hard maps and one super-hard map. The selected baselines for this experiment are consistent with those in the Predator-Prey environ- ment. The empirical results are provided in Figure 3, demonstrating that MAC-PO can effectively generate optimal weight transitions on SMAC for achieving a higher win rate, especially when the environment becomes substantially complicated and harder, such as MMM2. We can see that several state-of-the-art algorithms are brittle when significant exploration is undergoing without finding optimal sampling weights. Specifically, MAC-PO performs well on hard maps, such as 3s_vs_5z, the best policy found by our optimal weighting approach significantly outperforms the remaining baseline algorithms regard- ing winning rate. For super-hard map MMM2, MAC-PO, along with QMIX, WQMIX, and QPLEX, can learn a better policy than VDAC, DOP, and FOP. We achieve the highest winning rate by adopting our algorithm on MMM2, showing the superiority of the optimal weighting scheme in utilizing past transitions. 5.3 Ablation Experiments For ablations, we conduct experiments by disabling one term (men- tioned in Theorem 1) every trial to investigate their contribution to finding optimal sampling weights, respectively. The terms consid- ered in these experiments are Bellman error, value enhancement, and joint action probability. Figure 4 shows the results on MMM2. Compared to the original result, missing any of the terms will be detrimental to the performance, and the tests without joint action probability have the lowest final winning rate, which is around 60%. Such a phenomenon demonstrates that the interaction among agents is the critical factor in MARL tasks. The designing of the optimal weighting scheme without taking joint action probability into account will be less capable of achieving ideal results. Further- more, the contributions of Bellman error and value enhancement terms are similar according to the given trend in Figure 4. Figure 4: Ablations by disabling one term each for MAC-PO on MMM2 (super hard). The final winning rates decrease by 18% for disabling the joint action probability term, 15% for disabling the Bellman error term, and 10% for disabling the value enhancement term. 6 CONCLUSION In this paper, we formulate multi-agent experience replay as a re- gret minimization problem and solve the optimal sampling weights in close form. The theoretical results illustrate key ingredients for an optimal experience replay in MARL settings. The results enable us to propose MAC-PO (with both exact and approximated weights) as a new MARL experience replay algorithm with optimized expe- rience replay weights. Our experiment results in multiple MARL environments show the effectiveness of MAC-PO by demonstrat- ing superior convergence and empirical performance over other experience replay solutions (adapted from single-agent RL) as well as state-of-the-art MARL methods. ACKNOWLEDGMENTS This research is based on work supported by the National Science Foundation under grant CCF-2114415 and partially by research gifts from CISCO and Meta. 7 N WHVWZLQUDWH0$&3240,;43/(;:40,;9'$&)23'237 N WHVWZLQUDWH0$&3240,;43/(;:40,;9'$&)23'237 N WHVWZLQUDWH0$&3240,;43/(;:40,;9'$&)23'237 N WHVWZLQUDWH0$&321R%HOOPDQHUURU1RMRLQWDFWLRQSURE1RYDOXHHQKDQFHPHQW REFERENCES [1] S Ahilan and P Dayan. 2021. Correcting Experience Replay for Multi-Agent Communication. In Ninth International Conference on Learning Representations (ICLR 2021). [2] Bowen Baker, Ingmar Kanitscheider, Todor Markov, Yi Wu, Glenn Powell, Bob McGrew, and Igor Mordatch. 2019. Emergent tool use from multi-agent autocur- ricula. arXiv preprint arXiv:1909.07528 (2019). [3] Gabriel Barth-Maron, Matthew W Hoffman, David Budden, Will Dabney, Dan Horgan, TB Dhruva, Alistair Muldal, Nicolas Heess, and Timothy Lillicrap. 2018. Distributed Distributional Deterministic Policy Gradients. In International Con- ference on Learning Representations. [4] Dimitri P Bertsekas. 2014. Constrained optimization and Lagrange multiplier methods. Academic press. [5] Wendelin Böhmer, Vitaly Kurin, and Shimon Whiteson. 2020. Deep coordination graphs. In International Conference on Machine Learning. PMLR, 980–991. [6] Marc Brittain, Josh Bertram, Xuxi Yang, and Peng Wei. 2019. Prioritized sequence experience replay. arXiv preprint arXiv:1905.12726 (2019). [7] Yongcan Cao, Wenwu Yu, Wei Ren, and Guanrong Chen. 2012. An overview of recent progress in the study of distributed multi-agent coordination. IEEE Transactions on Industrial informatics 9, 1 (2012), 427–438. [8] Jacopo Castellini, Frans A Oliehoek, Rahul Savani, and Shimon Whiteson. 2019. The representational capacity of action-value networks for multi-agent reinforce- ment learning. arXiv preprint arXiv:1902.07497 (2019). [9] Brett Daley and Christopher Amato. 2019. Reconciling λ-returns with experience replay. Advances in Neural Information Processing Systems 32 (2019). [10] Tim De Bruin, Jens Kober, Karl Tuyls, and Robert Babuška. 2015. The importance of experience replay database composition in deep reinforcement learning. In Deep reinforcement learning workshop, NIPS. [11] Sheng Fan, Guanghua Song, Bowei Yang, and Xiaohong Jiang. 2020. Prioritized Experience Replay in Multi-Actor-Attention-Critic for Reinforcement Learning. In Journal of Physics: Conference Series, Vol. 1631. IOP Publishing, 012040. [12] Jakob Foerster, Gregory Farquhar, Triantafyllos Afouras, Nantas Nardelli, and Shi- mon Whiteson. 2018. Counterfactual multi-agent policy gradients. In Proceedings of the AAAI conference on artificial intelligence, Vol. 32. [13] Scott Fujimoto, David Meger, and Doina Precup. 2020. An equivalence between loss functions and non-uniform sampling in experience replay. Advances in neural information processing systems 33 (2020), 14219–14230. [14] Benyamin Ghojogh, Ali Ghodsi, Fakhri Karray, and Mark Crowley. 2021. KKT Conditions, First-Order and Second-Order Optimization, and Distributed Opti- mization: Tutorial and Survey. arXiv preprint arXiv:2110.01858 (2021). [15] Kailash Gogineni, Peng Wei, Tian Lan, and Guru Venkataramani. 2023. Scalability Bottlenecks in Multi-Agent Reinforcement Learning Systems. arXiv preprint arXiv:2302.05007 (2023). [16] Carlos Guestrin, Michail Lagoudakis, and Ronald Parr. 2002. Coordinated rein- forcement learning. In ICML, Vol. 2. Citeseer, 227–234. [17] Jayesh K Gupta, Maxim Egorov, and Mykel Kochenderfer. 2017. Cooperative multi-agent control using deep reinforcement learning. In International conference on autonomous agents and multiagent systems. Springer, 66–83. [18] Todd Hester, Matej Vecerik, Olivier Pietquin, Marc Lanctot, Tom Schaul, Bilal Piot, Dan Horgan, John Quan, Andrew Sendonaris, Ian Osband, et al. 2018. Deep q- learning from demonstrations. In Proceedings of the AAAI Conference on Artificial Intelligence, Vol. 32. [19] Dan Horgan, John Quan, David Budden, Gabriel Barth-Maron, Matteo Hessel, Hado van Hasselt, and David Silver. 2018. Distributed Prioritized Experience Replay. In International Conference on Learning Representations. [20] Jian Hu, Siyang Jiang, Seth Austin Harding, Haibin Wu, and Shih-wei Liao. 2021. RIIT: Rethinking the Importance of Implementation Tricks in Multi-Agent Reinforcement Learning. arXiv preprint arXiv:2102.03479 (2021). [21] Yeping Hu, Alireza Nakhaei, Masayoshi Tomizuka, and Kikuo Fujimura. 2019. Interaction-aware decision making with adaptive strategies under merging sce- narios. In 2019 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS). IEEE, 151–158. [22] Maximilian Hüttenrauch, Adrian Šošić, and Gerhard Neumann. 2017. Guided deep reinforcement learning for swarm systems. arXiv preprint arXiv:1709.06011 (2017). [23] Shariq Iqbal and Fei Sha. 2019. Actor-attention-critic for multi-agent reinforce- ment learning. In International conference on machine learning. PMLR, 2961–2970. [24] Natasha Jaques, Angeliki Lazaridou, Edward Hughes, Caglar Gulcehre, Pedro Ortega, DJ Strouse, Joel Z Leibo, and Nando De Freitas. 2019. Social influence as intrinsic motivation for multi-agent deep reinforcement learning. In International conference on machine learning. PMLR, 3040–3049. [25] Sham Kakade and John Langford. 2002. Approximately optimal approximate reinforcement learning. In In Proc. 19th International Conference on Machine Learning. Citeseer. [26] Dmitry Kalashnikov, Alex Irpan, Peter Pastor, Julian Ibarz, Alexander Herzog, Eric Jang, Deirdre Quillen, Ethan Holly, Mrinal Kalakrishnan, Vincent Vanhoucke, et al. 2018. Scalable deep reinforcement learning for vision-based robotic manipulation. In Conference on Robot Learning. PMLR, 651–673. [27] Landon Kraemer and Bikramjit Banerjee. 2016. Multi-agent reinforcement learn- ing as a rehearsal for decentralized planning. Neurocomputing 190 (2016), 82–94. [28] Steven George Krantz and Harold R Parks. 2002. The implicit function theorem: history, theory, and applications. Springer Science & Business Media. [29] Aviral Kumar, Abhishek Gupta, and Sergey Levine. 2020. Discor: Corrective feedback in reinforcement learning via distribution correction. Advances in Neural Information Processing Systems 33 (2020), 18560–18572. [30] Sergey Levine, Chelsea Finn, Trevor Darrell, and Pieter Abbeel. 2016. End-to-end training of deep visuomotor policies. The Journal of Machine Learning Research 17, 1 (2016), 1334–1373. [31] Long-Ji Lin. 1992. Self-improving reactive agents based on reinforcement learning, planning and teaching. Machine learning 8, 3 (1992), 293–321. [32] Ruishan Liu and James Zou. 2018. The effects of memory replay in reinforcement learning. In 2018 56th annual allerton conference on communication, control, and computing (Allerton). IEEE, 478–485. [33] Xu-Hui Liu, Zhenghai Xue, Jingcheng Pang, Shengyi Jiang, Feng Xu, and Yang Yu. 2021. Regret Minimization Experience Replay in Off-Policy Reinforcement Learning. Advances in Neural Information Processing Systems 34 (2021), 17604– 17615. [34] Ryan Lowe, Yi I Wu, Aviv Tamar, Jean Harb, OpenAI Pieter Abbeel, and Igor Mordatch. 2017. Multi-agent actor-critic for mixed cooperative-competitive environments. Advances in neural information processing systems 30 (2017). [35] Laëtitia Matignon, Laurent Jeanpierre, and Abdel-Illah Mouaddib. 2012. Coor- dinated multi-robot exploration under communication constraints using decen- tralized markov decision processes. In Twenty-sixth AAAI conference on artificial intelligence. [36] Edward James McShane. 1937. Jensen's inequality. Bull. Amer. Math. Soc. 43, 8 (1937), 521–527. [37] Yongsheng Mei, Tian Lan, Mahdi Imani, and Suresh Subramaniam. 2022. A Bayesian Optimization Framework for Finding Local Optima in Expensive Multi- Modal Functions. arXiv preprint arXiv:2210.06635 (2022). [38] Yongsheng Mei, Tian Lan, and Guru Venkataramani. 2023. Exploiting Partial Com- mon Information Microstructure for Multi-Modal Brain Tumor Segmentation. arXiv preprint arXiv:2302.02521 (2023). [39] Yongsheng Mei, Hanhan Zhou, and Tian Lan. 2023. ReMIX: Regret Minimiza- tion for Monotonic Value Function Factorization in Multiagent Reinforcement Learning. arXiv preprint arXiv:2302.05593 (2023). [40] Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. 2015. Human-level control through deep reinforcement learning. nature 518, 7540 (2015), 529–533. [41] Andrew W Moore and Christopher G Atkeson. 1993. Prioritized sweeping: Reinforcement learning with less data and less time. Machine learning 13, 1 (1993), 103–130. [42] Guido Novati and Petros Koumoutsakos. 2019. Remember and forget for experi- ence replay. In International Conference on Machine Learning. PMLR, 4851–4860. [43] Youngmin Oh, Jinwoo Shin, Eunho Yang, and Sung Ju Hwang. 2021. Model- augmented Prioritized Experience Replay. In International Conference on Learning Representations. [44] Frans A Oliehoek and Christopher Amato. 2016. A concise introduction to decen- tralized POMDPs. Springer. [45] Tabish Rashid, Gregory Farquhar, Bei Peng, and Shimon Whiteson. 2020. Weighted QMIX: Expanding Monotonic Value Function Factorisation for Deep Multi-Agent Reinforcement Learning. arXiv:2006.10800 [cs.LG] [46] Tabish Rashid, Mikayel Samvelyan, Christian Schroeder, Gregory Farquhar, Jakob Foerster, and Shimon Whiteson. 2018. Qmix: Monotonic value function factori- sation for deep multi-agent reinforcement learning. In International Conference on Machine Learning. PMLR, 4295–4304. [47] Baturay Saglam, Furkan B Mutlu, Dogan C Cicek, and Suleyman S Kozat. 2022. Actor Prioritized Experience Replay. arXiv preprint arXiv:2209.00532 (2022). [48] Mikayel Samvelyan, Tabish Rashid, Christian Schroeder De Witt, Gregory Far- quhar, Nantas Nardelli, Tim GJ Rudner, Chia-Man Hung, Philip HS Torr, Jakob Foerster, and Shimon Whiteson. 2019. The starcraft multi-agent challenge. arXiv preprint arXiv:1902.04043 (2019). [49] Tom Schaul, John Quan, Ioannis Antonoglou, and David Silver. 2016. Prioritized Experience Replay. In ICLR. [50] Guy Shani, David Heckerman, Ronen I Brafman, and Craig Boutilier. 2005. An MDP-based recommender system. Journal of Machine Learning Research 6, 9 (2005). [51] Samarth Sinha, Jiaming Song, Animesh Garg, and Stefano Ermon. 2022. Experi- ence replay with likelihood-free importance weights. In Learning for Dynamics and Control Conference. PMLR, 110–123. [52] Kyunghwan Son, Daewoo Kim, Wan Ju Kang, David Earl Hostallero, and Yung Yi. 2019. Qtran: Learning to factorize with transformation for cooperative multi- agent reinforcement learning. In International Conference on Machine Learning. PMLR, 5887–5896. [53] Jianyu Su, Stephen Adams, and Peter Beling. 2021. Value-decomposition multi- agent actor-critics. In Proceedings of the AAAI Conference on Artificial Intelligence, Vol. 35. 11352–11360. [54] Kefan Su and Zongqing Lu. 2022. Divergence-regularized multi-agent actor-critic. In International Conference on Machine Learning. PMLR, 20580–20603. [55] Shivakanth Sujit, Somjit Nath, Pedro HM Braga, and Samira Ebrahimi Kahou. 2022. Prioritizing Samples in Reinforcement Learning with Reducible Loss. arXiv preprint arXiv:2208.10483 (2022). [56] Ardi Tampuu, Tambet Matiisen, Dorian Kodelja, Ilya Kuzovkin, Kristjan Kor- jus, Juhan Aru, Jaan Aru, and Raul Vicente. 2017. Multiagent cooperation and competition with deep reinforcement learning. PloS one 12, 4 (2017), e0172395. [57] Ming Tan. 1993. Multi-agent reinforcement learning: Independent vs. cooperative agents. In Proceedings of the tenth international conference on machine learning. 330–337. [58] Hado Van Hasselt, Arthur Guez, and David Silver. 2016. Deep reinforcement learning with double q-learning. In Proceedings of the AAAI conference on artificial intelligence, Vol. 30. [59] Harm Van Seijen and Rich Sutton. 2013. Planning by prioritized sweeping with small backups. In International Conference on Machine Learning. PMLR, 361–369. [60] Oriol Vinyals, Igor Babuschkin, Wojciech M Czarnecki, Michaël Mathieu, An- drew Dudzik, Junyoung Chung, David H Choi, Richard Powell, Timo Ewalds, Petko Georgiev, et al. 2019. Grandmaster level in StarCraft II using multi-agent reinforcement learning. Nature 575, 7782 (2019), 350–354. [61] Jianhao Wang, Zhizhou Ren, Terry Liu, Yang Yu, and Chongjie Zhang. 2020. Qplex: Duplex dueling multi-agent q-learning. arXiv preprint arXiv:2008.01062 (2020). [62] Yihan Wang, Beining Han, Tonghan Wang, Heng Dong, and Chongjie Zhang. 2020. Dop: Off-policy multi-agent decomposed policy gradients. In International Conference on Learning Representations. [63] Yishen Wang and Zongzhang Zhang. 2019. Experience selection in multi-agent deep reinforcement learning. In 2019 IEEE 31st International Conference on Tools with Artificial Intelligence (ICTAI). IEEE, 864–870. [64] Ziyu Wang, Tom Schaul, Matteo Hessel, Hado Hasselt, Marc Lanctot, and Nando Freitas. 2016. Dueling network architectures for deep reinforcement learning. In International conference on machine learning. PMLR, 1995–2003. [65] Christopher JCH Watkins and Peter Dayan. 1992. Q-learning. Machine learning 8, 3 (1992), 279–292. [66] Daochen Zha, Kwei-Herng Lai, Kaixiong Zhou, and Xia Hu. 2019. Experience Replay Optimization. In IJCAI. [67] Shangtong Zhang and Richard S Sutton. 2017. A deeper look at experience replay. arXiv preprint arXiv:1712.01275 (2017). [68] Tianhao Zhang, Yueheng Li, Chen Wang, Guangming Xie, and Zongqing Lu. 2021. FOP: Factorizing Optimal Joint Policy of Maximum-Entropy Multi-Agent Reinforcement Learning. In International Conference on Machine Learning. PMLR, 12491–12500. [69] Hanhan Zhou, Tian Lan, and Vaneet Aggarwal. 2022. PAC: Assisted Value Factorisation with Counterfactual Predictions in Multi-Agent Reinforcement Learning. arXiv preprint arXiv:2206.11420 (2022). [70] Hanhan Zhou, Tian Lan, and Vaneet Aggarwal. 2022. Value functions factoriza- tion with latent state information sharing in decentralized multi-agent policy gradients. arXiv preprint arXiv:2201.01247 (2022). A NOMENCLATURE Table 1 summarizes the common notations used in this paper. Table 1: Definitions of the common notations. Notation Definition s a u u r γ τ π π ∗ η (π) d π (s) Q (*) Q∗ (*) V (*) V ∗ (*) A(*) L(*) B∗ w α State of the environment Agent Agent's individual action Agents' joint action Reward Discount factor Action-observation history Joint policy Expected optimal joint policy Expected return under the joint policy π Discounted state distribution Action value function Optimal action value function Value function Optimal value function Advantage function Loss function Bellman operator: B∗Q (s, u) def= r (s, u) + γ arg maxu′ Es′Q (s ′, u′) Sampling weight Scaled sampling weight B PROOF OF THEOREM 1 We have provided the outline of the proof including four key steps. In this section, we present the detailed proof of the theorem. The optimization problem needed solving is: η (π ∗) − η (πk ) min wk s.t. Qk = arg min Q ∈ Q Eμ [wk (s, u)(Q − B∗Qk−1)2 (s, u)], This problem is equivalent to: Eμ [wk (s, u)] = 1, wk (s, u) ≥ 0, η (π ∗) − η (πk ) min pk s.t. Qk = arg min Q ∈ Q pk (s, u) = 1, ∑︁ s,u Epk [(Q − B∗Qk−1)2 (s, u)], pk (s, u) ≥ 0, (9) where pk = wk (s, u)μ (s, u) is the solution to problem (9). metric, and the diameter of a set. To solve the optimization problem in Equation (9), we needed to provide some definitions, which are total variation distance, Wasserstein Definition 1 (Total variation distance). The total variation distance of the distribution P and Q is defined as D (P, Q) = 1 Definition 2 (Wasserstein metric). For F,G two cumulative distribution function over the reals, the Wasserstein metric is defined as dp (F, G) def= infU ,V ∥U − V ∥p , where the infimum is taken over all pairs of random variables (U,V) with cumulative distributions F and G, respectively. 2 ∥P − Q ∥. Definition 3 (Diameter of a set). The diameter of a set A is defined as diam(A) = supx,y ∈A m(x, y), where m is the metric on A. Furthermore, we introduce some mild assumption as follows: Assumption 1. The state space S, action space U and observation space Z are compact metric spaces. Assumption 2. The action-value and observation function are continuous on S × U and Z , respectively. Assumption 3. The transition function T is continuous regarding S×U in the sense of Wasserstein metric: lim(s,u)→(s0,u0) dp (T (*|s, u),T (*|s0, u0)). Assumption 4. The joint policy π is the product of each agent's individual policy πa These assumptions can be satisfied in most MARL environments. Let dπ a (s) denote the discounted state distribution of agent a, and dπ a (s) denote the distribution where the state is visited by the agent i for the i-th time. Thus, we have: where each dπ a i (s) is given by: dπ a (s) = ∞ ∑︁ i=1 dπ a i (s), dπ a i (s) = (1 − γ) ∞ ∑︁ ti =0 γti Pr(sti = s, stk = s, ∀k = 1, ..., i − 1), (10) (11) where the Pr(sti = s, stk = s, ∀k = 1, ..., i − 1) in this equation contains the probability of visiting state s for the i-th time at ti and a sequence of times tk , for k = 1, ..., i, such that state s is visited at each tk . Thus, state s will be visited for i times at time ti in total. The following lemmas are proposed by Liu [33], where Lemma 1 support the derivation of the Lemma 2, and Lemma 2 demonstrates that ∂dπa (s) ∂π a (s) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) is a small quantity. Lemma 1. Let f be an Lebesgue integrable function. P and Q are two probability distributions, f ≤ C, then: |EP (x) f (x) − EQ (x) f (x)| ≤ C * D (P, Q). (12) Lemma 2. Let ρ be the probability of the agent a starting from (s, ua) and coming back to s at time step t under policy πa, i.e. Pr(s0 = s, ua ua, st = s, s1:t −1 ≠ s; πa), and ε = sups,ua (cid:205)∞ t =1 γt ρπ a (s, ua, t). We have: ∂dπ a (s) ∂πa (s) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) ≤ εdπ a 1 (s), where dπ a 1 (s) = (1 − γ) (cid:205)∞ t1=0 γt1 Pr(st1 = s) and ε ≤ 1. Lemma 1 and 2 can be extended to suit the multi-agent scenario. Besides, we have the following lemma holds in MARL: Lemma 3. Given two policy π and ̃π, where π = exp(Q (s,u)) u′ exp(Q (s,u′)) is defined as the Boltzmann policy, we have: (cid:205) Eu∼ ̃π [Q (s, u)] − Eu∼π [Q (s, u)] ≤ 1 Proof. Assume there are two joint actions u and ̃u. Let Q (s, u) = p, Q (s, ̃u) = q and let p ≤ q. Eu∼ ̃π [Q (s, u)] − Eu∼π [Q (s, u)] ≤ q − = q − pep + qeq ep + eq p + qeq−p 1 + eq−p = q − p − (q − p)eq−p 1 + eq−p . Let f (z) = z − zez conclude: 1+ez , the maximum point z0 satisfies f ′(z) = 0, from which we further have 1 + ez0 = z0ez0 where z0 ∈ (1, 2). Therefore, we Eu∼ ̃π [Q (s, u)] − Eu∼π [Q (s, u)] ≤ f (q − p) ≤ z0 − 1 ≤ 1. □ Remark 1. The inequality in Lemma 3 can be applied to both the situation where we have joint action of more than two agents and the situation regarding per-agent action. The following lemma is proposed by Kakade [25]. It was originally proposed for the finite MDP, while it will also hold for the continuous scenario that is given by Assumption 1 and 2. 0 = (13) (14) Lemma 4. For any policy π and ̃π, we have: where Aπ (s, u) is the advantage function given by Aπ (s, u) = Q π (s, u) − V π (s). η ( ̃π) − η (π) = 1 1 − γ Ed ̃π (s,u) [Aπ (s, u)], (15) Lemma 5. Let επk = sups,u relationship as follows: t =1 γt ρ π (s, u, t), the optimal solution pk to a relaxation of optimization problem in Equation (9) satisfies (cid:205)∞ where Dk (s, u) = d πk (s, u)|Qk − B∗Qk−1| exp(−|Qk − Q∗|) (1 + (cid:205)n i=1 i=1 πi k ) and Z ∗ is the normalization constant. Proof. Suppose u∗ ∼ π ∗ (s). Let π = π ∗ and ̃π = πk in Lemma 4, we have pk (s, u) = 1 Z ∗ (Dk (s, u) + εk (s, u)), j=1,j≠i π j k − n (cid:206)n (cid:206)n Ed πk (s,u) [Aπ ∗ (s, u)] Ed πk (s,u) [V ∗ (s) − Q∗ (s, u)] = = = − η (π ∗) − η (πk ) 1 1 − γ 1 1 − γ 1 1 − γ 1 1 − γ 1 1 − γ 2 1 − γ (a) ≤ (cid:2)E ≤ = Ed πk (s,u) [V ∗ (s) − Qk (s, u∗) + Qk (s, u∗) − Qk (s, u) + Qk (s, u) − Q∗ (s, u)] (cid:2)Ed πk (s) (Q∗ (s, u∗) − Qk (s, u∗)) + Ed πk (s,u) (Qk (s, u) − Q∗ (s, u)) + 1(cid:3) (cid:2)Ed πk (s) |Q∗ (s, u∗) − Qk (s, u∗)| + Ed πk (s,u) |Qk (s, u) − Q∗ (s, u)| + 1(cid:3) where d πk ,π ∗ (s, u) = d πk (s) πk +π ∗ 2 (u|s) and (a) uses Lemma 3. d πk ,π ∗ |Q∗ (s, u) − Qk (s, u)| + 1(cid:3) (16) (17) □ Since the original optimization is non-tractable, we consider this upper bound to obtain a closed-form solution. Therefore, we replace the objective in Equation (9) with the upper bound in Equation (17) and solve the relaxed optimization problem, given by: Ed πk (s,u) [|Qk − Q∗|(s, u)] min pk s.t. Qk = arg min Q ∈ Q pk (s, u) = 1, ∑︁ pk (s, u) ≥ 0, Epk [(Q − B∗Qk−1)2 (s, u)], (18) As we cannot access π ∗, we use d πk (s, u) to replace d πk ,π ∗ . The best surrogate available is πk . The objective in Equation (18) can be further relaxed with Jensen's inequality. Consider a convex function g(x) on the real space R, the inequality is given by: s,u According to Equation (19), we select the convex function g(x) = exp(−x), and the objective can be further relaxed as: E[g(X )] ≥ g(E[X ]). − log Ed πk (s,u) [exp(−|Qk − Q∗|) (s, u)] min pk s.t. Qk = arg min Q ∈ Q pk (s, u) = 1, ∑︁ Epk [(Q − B∗Qk−1)2 (s, u)], pk (s, u) ≥ 0, (19) (20) In order to handle optimization problem in Equation (20), we follow the standard procedures of Lagrangian multiplier method, which is: L (pk ; λ,ψ ) = − log Ed πk (s) [exp |Qk − Q∗|(s, u)] + λ( pk − 1) − ψ Tpk, ∑︁ s,u (21) s,u After constructing the Lagrangian, we further compute some gradients that will be used in calculating the optimal solution. We first calculate the ∂Qk according to the implicit function theorem (IFT). Based on the first constraint in Equation (20), we aim to find the minimum ∂pk Qk to satisfy the arg min(*), and therefore we need to ensure the derivative of the term inside arg min(*) (we use f (pk, Qk ) to denote this term) to be zero, which is: f ′ Qk = 2 ∑︁ u pk (Qk − B∗Qk−1) = 0 (22) We can notice that F (pk, Qk ) : f ′ Qk the Hessian matrices of pk and Qk in f (pk, Qk ) as follows: = 0 is an implicit function regarding Qk and pk . Hence, we apply the IFT on the F (pk, Qk ) considering ∂Qk ∂pk = − F ′ pk F ′ Qk = −[diag(pk )]−1 [diag(Qk − B∗Q∗ k−1)]. Next, we derive the expression for ∂d πk (s,u) ∂pk in the following equation: ∂d πk (s, u) ∂pk = ∂d πk (s, u) ∂πk ∂πk ∂Qk ∂Qk ∂pk = diag (cid:169) d πk (s) (cid:173) (cid:173) (cid:173) (cid:171) n (cid:214) j=1 j≠i π j k + ε0 (s) ∂πk ∂Qk ∂Qk ∂pk (cid:170) (cid:174) (cid:174) (cid:174) (cid:172) (b) = diag (c) = diag (cid:169) d πk (s) (cid:173) (cid:173) (cid:173) (cid:171) (cid:169) d πk (s) (cid:173) (cid:173) (cid:173) (cid:171) n (cid:214) j=1 j≠i n (cid:214) j=1 j≠i diag (cid:32) ∂πi k ∂Qk (cid:33) ∂Qk ∂pk π j k + ε0 (s) (cid:170) (cid:174) (cid:174) (cid:174) (cid:172) π j k + ε0 (s) n (cid:214) i=1 (cid:170) (cid:174) (cid:174) (cid:174) (cid:172) k diag(1 − πi πi k ) ∂Qk ∂pk = d πk (s, u) π j k − n n ∑︁ n (cid:214) i=1 j=1 j≠i (cid:169) (cid:173) (cid:173) (cid:173) (cid:171) ∂Qk ∂pk n (cid:214) i=1 πi k (cid:170) (cid:174) (cid:174) (cid:174) (cid:172) + ε0 (s) n (cid:214) i=1 πi k diag(1 − πi k ) ∂Qk ∂pk , (23) (24) where ε0 (s) = and Assumption 4. ∂d πk (s,u) ∂πk is a small quantity provided by Lemma 2. Besides, (b) and (c) are based on the the definition of the Boltzmann policy Since we have all the preparations ready, we now compute the Lagrangian by applying the Karush–Kuhn–Tucker (KKT) condition. We let the Lagrangian gradient to be zero, i.e., Besides, the partial derivative of the Lagrangian can be computed as: ∂L (pk ; λ,ψ ) ∂pk = 0 ∂L (pk ; λ,ψ ) ∂pk ∂ log Ed πk (s,u) [exp(−|Qk − Q∗|) (s, u)] ∂pk + λ − ψs,u exp(−|Qk − Q∗|) ( ∂d πk (s, u) ∂pk + d πk (s, u) ∂Qk ∂pk ) + λ − ψs,u, = − 1 Z = (25) (26) where Z = Es′,u′∼d πk (s,u) exp(−|Qk − Q∗|)(s ′, u′). Based on Equation (25) and (26), and substituting the expression of ∂Qk ∂pk and ∂d πk (s,a) ∂pk with the derived results in Equation (23) and (24), we obtain: pk (s, a) = 1 Z (ψ ∗ s,u − λ∗)    d πk (s, u)|Qk − B∗Qk−1| exp(−|Qk − Q∗|)      +ε0|Qk − B∗Qk−1| exp(−|Qk − Q∗|) k diag(1 − πi πi k ) n (cid:214) π j k − n n (cid:214) i=1 πi k (cid:170) (cid:174) (cid:174) (cid:174) (cid:172) 1 + n ∑︁ n (cid:214) i=1 j=1 j≠i (cid:169) (cid:173) (cid:173) (cid:173) (cid:171) (cid:35) , (27) i=1 According to Lemma 2, the value of ε0 is smaller than d πk (s) so the second term will not influence the sign of the equation. Equation (27) will always be larger or equal to zero. By KKT condition, when Equation (27) equal to zero, we let ψ ∗ will not affect pk . In the contrast, when Equation (27) is larger than 0, the pk should equal to zero. Therefore, Equation (27) can be simplify as follows: s,u = 0 because the value of ψ ∗ s,u pk (s, u) = 1 Z ∗ (Dk (s, u) + εk (s, u)), (28) (29) (30) where we have Dk (s, u) = d πk (s, u)|Qk − B∗Qk−1| exp(−|Qk − Q∗|) εk = ε0|Qk − B∗Qk−1| exp(−|Qk − Q∗|) n (cid:214) i=1 This concludes the proof. C PROOF OF THEOREM 2 We first reform Equation (7) via factorization of extracting πa k , given by: n ∑︁ n (cid:214) i=1 j=1 j≠i 1 + (cid:169) (cid:173) (cid:173) (cid:173) (cid:171) π j k − n n (cid:214) i=1 πi k , (cid:170) (cid:174) (cid:174) (cid:174) (cid:172) πi k diag(1 − πi k ) n (cid:214) f = 1 + k + πa πi k ( n ∑︁ n (cid:214) i=1 i≠a j=1 j≠i,a k π j πi k − n πi k ). n (cid:214) i=1 i≠a i=1 i≠a i=1,i≠a πi j=1,j≠i,a −n (cid:206)n Let g represent the term (cid:205)n i=1,i≠a the range [0, 1], if g > 0, we have πa g = 0, the value of πa k fmax. Therefore, it is obvious that the condition for reaching fmax is that all the values of πa k (cid:206)n k = 1 to ensure the f reaches its maximum; if g < 0, we let πa in Equation (30). Based on the fact that the agent's action probability is within k = 0 for the same purpose. In the case that will not affect can be either 0 or 1, as the third term, including g will be eventually canceled out, and the value of πa k After determining the boundary condition, from Equation (30), the second term, which is (cid:206)n must be on their boundary. i=1,i≠a πi k with i ≠ a is 1; if the second term equals 0, at least one of the agents' probabilities πi k , will be either 0 or 1. If it equals 1, is 0. Assuming that the number of k indicating all the πi k πi k equaling 0 is Nπ , we have: According to Equation (31), we can numerically compute fmax as follows: g = −1 Nπ = 0 Nπ = 1 1 Nπ ≥ 2. 0    fmax = (cid:40)2, Nπ = 0, πa k = 0 or Nπ = 1, πa 1, Nπ ≥ 2, ∀πa k . k = 1 (31) (32) Since πa k can be the probability of any selected agent, such discussion is applicable for the probabilities of all agents in the environment. So far, we successfully proved the Theorem 2 that, to maximize the joint action probability function f without loss of the generality, we shall let all πi k equal to 1, but at least one of the probabilities πa k be 0. This concludes the proof. D ALGORITHMS In this section, we provide the pseudo-codes for MAC-PO and MAC-PO Approximation in Algorithms 1 and 2, respectively. E ENVIRONMENT DETAILS We use more recent baselines (i.e., FOP and DOP) that are known to outperform QTRAN [52] and QPLEX [61] in the evaluation. In general, we tend to choose baselines that are more closely related to our work and most recent. This motivated the choice of QMIX (baseline for value-based factorization methods), WQMIX (close to our work that uses weighted projections so better joint actions can be emphasized), VDAC [53], FOP [68], DOP [62] (SOTA actor-critic based methods). We acquired the results of QMIX, WQMIX based on their hyper-parameter tuned versions from pymarl2[20] and implemented our algorithm based on it. E.1 Predator-Prey A partially observable environment on a grid-world predator-prey task is used to model relative overgeneralization problem [5] where 8 agents have to catch 8 prey in a 10 × 10 grid. Each agent can either move in one of the 4 compass directions, remain still, or try to catch any adjacent prey. Impossible actions, i.e., moving into an occupied target position or catching when there is no adjacent prey, are treated as unavailable. If two adjacent agents execute the catch action, a prey is caught and both the prey and the catching agents are removed from the grid. An agent's observation is a 5 × 5 sub-grid centered around it, with one channel showing agents and another indicating prey. An episode ends if all agents have been removed or after 200 steps. Capturing a prey is rewarded with r = 10, but unsuccessful attempts by single agents are punished by a negative reward p. In this paper, we consider two sets of experiments with p = (0, -0.5, -1.5, -2). The task is similar to the matrix game proposed by [52] but significantly more complex, both in terms of the optimal policy and in the number of agents. Algorithm 1 MAC-PO 1: Initialize step, learning rate α and replay buffer D, and set θ − = θ 2: for step = 1 : stepmax do 3: 4: while sk ≠ terminal and k < episode limit do 5: k = 0, s0 = initial state for each agent a do k = τa τa ua k = k−1 ∪ (ok, uk−1) (cid:40)arg maxua Q (τa k randint(1, |U |) k , ua k ) with probability 1 − ε with probability ε 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 20: 21: end for Obtain the reward rk and next state sk+1 Store the current trajectory into replay buffer D = D ∪ (sk, uk, rk, sk+1) k = k + 1, step = step + 1 end while Collect b samples from the replay buffer D following uniform distribution μ. for each timestep k in each episode in batch b do Evaluate Qk , Q∗ and target values Obtain the utilities Qa from agents' local networks, and compute the individual policy πa k Compute the weight: wk ∝ |Qk − B∗Qk−1| exp(−|Qk − Q∗|) (cid:16)1 + (cid:205)n i=1 j=1,j≠i π j k − n (cid:206)n i=1 πi (cid:206)n (cid:17) k end for 18: 19: Minimize the Bellman error for Qk weighted by wk , update the network parameter θ : θ = θ − α (∇θ if update-interval steps have passed then i wk (Qk − yi )2). (cid:205)b 1 b θ − = θ 22: end if 23: end for E.2 SMAC For the experiments on StarCraft II micromanagement, we follow the setup of SMAC [48] with open-source implementation including QMIX [46], WQMIX [45], QPLEX [61], FOP [68], DOP [62] and VDAC [53]. We consider combat scenarios where the enemy units are controlled by the StarCraft II built-in AI and the friendly units are controlled by the algorithm-trained agent. The possible options for built-in AI difficulties are Very Easy, Easy, Medium, Hard, Very Hard, and Insane, ranging from 0 to 7. We carry out the experiments with ally units controlled by a learning agent while built-in AI controls the enemy units with difficulty = 7 (Insane). Depending on the specific scenarios(maps), the units of the enemy and friendly can be symmetric or asymmetric. At each time step each agent chooses one action from discrete action space, including noop, move[direction], attack[enemy_id], and stop. Dead units can only choose noop action. Killing an enemy unit will result in a reward of 10 while winning by eliminating all enemy units will result in a reward of 200. The global state information is only available in the centralized critic. Each baseline algorithm is trained with 4 random seeds and evaluated every 10k training steps with 32 testing episodes for main results, and with 3 random seeds for ablation results and additional results. E.3 Implementation Details and Hyperparameters Table 2: Hyperparameter value settings. Hyperparameter Value Batch size Replay buffer size Target network update interval Every 200 episodes Learning rate TD-lambda 128 10000 0.001 0.6 In this section, we introduce the implementation details and hyperparameters we used in the experiment. We carried out the experiments on NVIDIA 2080Ti with fixed hyperparameter settings. Recently [20] demonstrated that MARL algorithms are significantly influenced by code- level optimization and other tricks, e.g. using TD-lambda, Adam optimizer, and grid-searched/Bayesian optimized [37] and hyperparameters Algorithm 2 MAC-PO Approximation 1: Initialize step, learning rate α and replay buffer D, and set θ − = θ 2: for step = 1 : stepmax do 3: 4: while sk ≠ terminal and k < episode limit do 5: k = 0, s0 = initial state for each agent a do k = τa τa ua k = k−1 ∪ (ok, uk−1) (cid:40)arg maxua Q (τa k randint(1, |U |) k , ua k ) with probability 1 − ε with probability ε 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 21: 22: end for Obtain the reward rk and next state sk+1 Store the current trajectory into replay buffer D = D ∪ (sk, uk, rk, sk+1) k = k + 1, step = step + 1 end while Collect b samples from the replay buffer D following uniform distribution μ. for each timestep k in each episode in batch b do Evaluate Qk , Q∗ and target values Obtain the utilities Qa from agents' local networks, and compute the individual policy πa k Re-scale the weights to high αh, medium αm, and low αl based on one individual policy πa k Compute the weight: and other policies π −a k : wk ∝ |Qk − B∗Qk−1| exp(−|Qk − Q∗|) * αh when πa when (cid:206)n αl αm elsewhere k ≈ 0 and πa i=1 πi k ≪ π −a k k ≈ 0, or (cid:206)n i=1 πi k ≈ 1    end for 19: 20: Minimize the Bellman error for Qk weighted by wk , update the network parameter θ : θ = θ − α (∇θ if update-interval steps have passed then i wk (Qk − yi )2). (cid:205)b 1 b θ − = θ 23: end if 24: end for (where many state-of-the-art are already adopted), and proposed fine-tuned QMIX and WQMIX, which is demonstrated with significant improvements from their original implementation. We implemented our algorithm based on its open-sourced codebase and acquired the results of QMIX and WQMIX from it. We use one set of hyperparameters for each environment, i.e., no tuned hyperparameters for individual maps. We use epsilon greedy for action selection with annealing from ε = 0.995 decreasing to ε = 0.05 in 100000 training steps in a linear way. The performance for each algorithm is evaluated for 32 episodes every 1000 training steps. Additional hyperparameter values are provided in Table 2.
http://arxiv.org/abs/2302.10920v1
2023-02-21T03:11:11
2023-02-21T03:11:11
'The Taurus': Cattle Breeds & Diseases Identification Mobile Application using Machine Learning
Dairy farming plays an important role in agriculture for thousands of years not only in Sri Lanka but also in so many other countries. When it comes to dairy farming cattle is an indispensable animal. According to the literature surveys almost 3.9 million cattle and calves die in a year due to different types of diseases. The causes of diseases are mainly bacteria, parasites, fungi, chemical poisons and etc. Infectious diseases can be a greatest threat to livestock health. The mortality rate of cattle causes a huge impact on social, economic and environmental damage. In order to decrease this negative impact, the proposal implements a cross-platform mobile application to easily analyze and identify the diseases which cattle suffer from and give them a solution and also to identify the cattle breeds. The mobile application is designed to identify the breeds by analyzing the images of the cattle and identify diseases after analyzing the videos and the images of affected areas. Then make a model to identify the weight and the age of a particular cow and suggest the best dose of the medicine to the identified disease. This will be a huge advantage to farmers as well as to dairy industry. The name of the proposed mobile application is 'The Taurus' and this paper address the selected machine learning and image processing models and the approaches taken to identify the diseases, breeds and suggest the prevention methods and medicine to the identified disease.
[ "R. M. D. S. M. Chandrarathna", "T. W. M. S. A. Weerasinghe", "N. S. Madhuranga", "T. M. L. S. Thennakoon", "Anjalie Gamage", "Erandika Lakmali" ]
10.31033/ijemr.12.6.27
[ { "@title": "doi", "@href": "http://dx.doi.org/10.31033/ijemr.12.6.27", "@rel": "related", "@type": null }, { "@title": null, "@href": "http://arxiv.org/abs/2302.10920v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10920v1", "@rel": "related", "@type": "application/pdf" } ]
[ "International Journal of Engineering and Management Research, vol\n 12, no 6, (December 2022), 198-205" ]
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.CV" ]
International Journal of Engineering and Management Research e-ISSN: 2250-0758 | p-ISSN: 2394-6962 Volume-12, Issue-6, (December 2022) www.ijemr.net https://doi.org/10.31033/ijemr.12.6.27 "The Taurus": Cattle Breeds & Diseases Identification Mobile Application using Machine Learning R.M.D.S.M.Chandrarathna1, T.W.M.S.A.Weerasinghe2, N.S.Madhuranga3, T.M.L.S.Thennakoon4, Anjalie Gamage5 and Erandika Gamage6 1Faculty of Computing, Sri Lanka Institute of Information Technology, (SLIIT), Malabe, SRI LANKA 2Faculty of Computing, Sri Lanka Institute of Information Technology, (SLIIT), Malabe, SRI LANKA 3Faculty of Computing, Sri Lanka Institute of Information Technology, (SLIIT), Malabe, SRI LANKA 4Faculty of Computing, Sri Lanka Institute of Information Technology, (SLIIT), Malabe, SRI LANKA 5Faculty of Computing, Sri Lanka Institute of Information Technology, (SLIIT), Malabe, SRI LANKA 6Faculty of Computing, Sri Lanka Institute of Information Technology, (SLIIT), Malabe, SRI LANKA 1Corresponding Author: [email protected] ABSTRACT Dairy important role farming plays an in agriculture for thousands of years not only in Sri Lanka but also in so many other countries. When it comes to dairy farming cattle is an indispensable animal. According to the literature surveys almost 3.9 million cattle and calves die in a year due to different types of diseases. The causes of diseases are mainly bacteria, parasites, fungi, chemical poisons and etc. Infectious diseases can be a greatest threat to livestock health. The mortality rate of cattle causes a huge impact on social, economic and environmental damage. In order to decrease this negative impact, the proposal implements a cross-platform mobile application to easily analyze and identify the diseases which cattle suffer from and give them a solution and also to identify the cattle breeds. The mobile application is designed to identify the breeds by analyzing the images of the cattle and identify diseases after analyzing the videos and the images of affected areas. Then make a model to identify the weight and the age of a particular cow and suggest the best dose of the medicine to the identified disease. This will be a huge advantage to farmers as well as to dairy industry. The name of the proposed mobile application is "The Taurus" and this paper address the selected machine learning and image processing models and the approaches taken to identify the diseases, breeds and suggest the prevention methods and medicine to the identified disease. Keywords-- Machine Learning, Cattle, Diseases, Analyze, Image Processing I. INTRODUCTION Cattle are considered as the most useful domestic animal in the world. We have so many evidences which says that, cattle are used for so many works throughout the ancient times and cattle have contributed to the survival of human for many thousand years [1]. They have contributed in human welfare supplying, milk powder, milk, gee and so many other dairy products which are enriched with high nutrition. Having those helps in making good heart health, boots up immune system, prevent humans from various types of diseases such as diabetes [2]. Apart from the benefits which humans take from the cattle, there are so many other benefits to the environment also. Cattle is the number one agricultural source of greenhouse gases worldwide. Proper cattle grazing management can help to mitigate climate changes and also cows help in restoring healthy soils, conserve sensitive species and enhancing overall ecological function [3]. But most of the time people fail to appreciate or recognize the advantages of having cattle on earth. Each and every country in the world get the advantages of cattle. If cows inhabit the earth, human would no longer have access to milk or countless dairy products which it spawns. Globally, dairy provides 5% of the energy in diet. So having no cattle means that humans would lose a key source of minerals and vitamins including calcium, phosphorus, zinc, potassium, vitamin A and D, etc. [4]. When it comes to the reasons of the decrement of cattle population, there are reasons such as respiratory problems, digestive problems, and diseases as the leading reasons [5]. In most countries like Sri Lanka, most of the farmers and cattle owners own a small-scale farm. And most of them do not have a proper way to manage the diseases which their cattle get diagnosed with. In some areas it is very much difficult to contact a veterinarian, so that the diseased cattle would have dead by the time the veterinarian arrives. And most of the time the owners don't have a way to take their animal to get the medical attention. Because of this reason the farm owners lose the main way of their income. Considering these reasons this study explores the use of ICT solutions to implement a mobile application to easily identify and get to know about the cattle breeds and diseases and let the user know the prevention methods. Today in the modern world, each and every person owns a smart phone. Therefore, considering the difficulties cattle owners face when treating their sick cows, having a mobile application which can identify the breeds, diseases and prevention methods can lead the farmers to save most of their sick cows with a less help of veterinarians and within a less time. This will lead the increment of cattle population and the economy of the farmers. II. BACKGROUND AND LITERATURE SURVEY 198 This work is licensed under Creative Commons Attribution 4.0 International License. International Journal of Engineering and Management Research e-ISSN: 2250-0758 | p-ISSN: 2394-6962 Volume-12, Issue-6, (December 2022) www.ijemr.net https://doi.org/10.31033/ijemr.12.6.27 When identifying the diseases of cattle, their breed also plays an important role. In the world there are 250+ cattle breeds. Cattle can be used for many purposes therefore cattle need to be saved and protected. There are mainly dairy cattle breeds and beef cattle breeds. In our proposed system we concern about dairy cattle breeds which is a main resource in the society. Thus, dairy cattle act as an important factor in dairy industry. Though farmer in the closest person who deal with cattle, they are aware about only few breeds which are the breeds they are dealing in day-to-day activities. And others who concern about cattle such as students, doctors, people who are interested about cattle etc. There are mainly 2 cattle breeds they are dairy cattle breeds and beef cattle , though countries like Sri Lanka based on only dairy production our European countries are interested in both dairy and beef both. Accordingly, two breeds are having different characterizes in between two breeds. The genetic diseases in dairy and beef cattle are tissue specific. There is difference in occurring generic diseases such as below figure. those Table I: Generic diseases Dairy Cattle Beef Cattle Specific tissue Sr. No . 1 Skeletal a. Chrondrodysplac ia b. Complex vertebral malformation c. Osteogenesis Imperfecta d. Osteoporosis e. Syndactylism 2 Central Nervous System a. Weaver Syndrome b. Spinal Dysmielination c. Spinal Muscular Atrophy a. Osteoporosis b. Arachnomelia c. Arthrogyposis Multiplex d. Congenital Contractual Arachnodacty ly e. Syndactylism a. Idiopathic Epilepsy b. Neuronal Ceroid Lipofuscinosi s c. Hydrocephalu s d. Spastic Paresis 3 Blood a. BLAD b. Hereditary Zinc Deficiency c. Citrullinemia Nil 4 Skin a. Epitheliogenesis a. Hypotrichosis Imperfecta b. X-Linked Anhidrotic Ectodermal 5 Muscle a. Congenital Function Disorder Nil Pseudomyoto nia b. Crooked tail Syndrome 6 Ophthalmi a. Anapthlmos and a. Anapthlmos c Microthlmos b. Congenital Cataract c. Optic Nerve Colobomas and Microthlmos b. Congenital Cataract c. Optic Nerve Colobomas The various scientists had reported the frequency as 3.33% and 4.0% in Iranian Holstein Friesian and Chinese Holstein cattle, respectively. However, in India BLAD carrier was estimated as 3.23% in pure and crossbred Holstein-Friesian only. The details of these genetic diseases with special reference to its definition, genetic cause (DNA mutation) and its clinical symptoms are discussed in the review [6]. Therefore, identifying the breed of a cattle is one of the most crucial factors where there to identify any generic diseases for that specific cattle breed and provide necessary treatments. In Sri Lanka, there are 03 categories as, up- country, low –country and mid country, as such they are as follows: Table II: Cattle breeds in Sri Lanka Up-country Low-country Mid-country  Ayrshire  Jersey  Friesian  Sindhi  Sahiwal  Tharparkar  AMZ(Australian ZEBU) Milking  AFS(Australian Friesian Sahiwal)  Local Crossbreeds  Jersey  Friesian  AMZ Though there are comparably a smaller number of breeds in Sri Lanka there are cross breeds also, and other main breeds are also can be seen all around Sri Lanka. Thus, they have many more special characteristics with their living environment, climate etc. [7]. To understand their special characteristics and their features identifying the breed is an important task which leads to provide a best treatment. According to the above reading I have done, understanding a breed is a main task and it makes the treatment a best, which the cattle can be treated by identifying the breed and they're by understanding their breed generic disease. As such by understanding and implementing a procedure to identify a cattle breed it will be an great opportunity to protect our cattle population. 199 This work is licensed under Creative Commons Attribution 4.0 International License. International Journal of Engineering and Management Research e-ISSN: 2250-0758 | p-ISSN: 2394-6962 Volume-12, Issue-6, (December 2022) www.ijemr.net https://doi.org/10.31033/ijemr.12.6.27 When it comes to the diseases, there are various diseases which are diagnosed by cattle. Following is some of them. Table III: Cattle diseases No Cattle disease 1 4 2 3 Bovine Enzootic Bovine Leucosis (EBL) Bluetongue Infectious Rhinotracheitis (IBR) Bovine Viral Diarrhea (BVD) 5 Anthrax 6 7 8 9 10 Trichomonosis 11 Neosporosis 12 Liver fluke 13 14 Q fever 15 Aujeszky's disease 16 Mycoplasmosis 17 Contagious bovine Par tuberculosis Salmonellosis Salmonellosis Leptospirosis Streptococcal infection pleuropneumonia Staphylococcal infection 18 19 Bovine respiratory disease 20 Epizootic haemorrhagedisease coronavirus inflation 21 22 Ringworm 23 Bovine digital dermatitis of Number countries that have a CP in place 31 27 24 23 16 15 8 7 7 7 6 5 5 4 4 3 2 2 2 1 1 1 1 From the above diseases foot and mouth disease, mastitis, lumpy skin disease can be identified using image data. For an example Mastitis disease is caused by Streptococcus bacteria and milk production is reduced due to this disease. Also, if not treated at the right time, the udder will be damaged and milk production will not be restored. The symptoms of this are udder such as swelling, redness, heat, hardness, pain and the milk such as watery appearance and flakes. Often soon after calving, with the abnormal milk having to be discarded and inject some antibiotic therapy, disease can be prevented. One of the main factors to check whether a person is sick, is the particular person's behavior change. Not only for humans is this applicable for animals also. According to the research which has been done so far, the identification of sick dairy cows in an early state of the disease can be done by observing the individual cow's behavior. Other than that, observing behavioral changes plays a significant role in identifying the injuries and diseases the cattle suffer from. Cattle thereby exhibit distinctive behavioral patterns such as walking, resting, lying, feeding, social behavior and other physical activities which are usually changed by other external factors such as climate changes and diseases. Bovine Spongiform Encephalopathy, Lameness, Heat Stress can be taken as main diseases which result behavioral changes [8]. The following figure shows the main changes in behavior when a cow is diagnosed with mad cow disease or the Bovine spongiform encephalopathy. Table IV: Changes in behavior of cattle with mad cow disease After identifying the diseases, the main thing to do to save the cattle population is to suggest the treatments. The given medicine dosage differs from the age and the weight of the cattle. Before provide medicine for animals we need to identify best dose by considering age, weight, gender, etc. Here we can identify age of the cattle by capture and upload images to the system of diseased cattle's mouth to estimate cattle age using image processing technique [9]. The medicine dosage is always based on the "Age" and "Weight". So that we need to detect the "Age" and "Weight" of diseased cattle before suggesting the dosage of medicine [10]. Figure 1: Dentition according to the age Table V: Age of cow based on dentition Actual Age Teeth Present Less than 2 years old 2 years old Two incisors present Four incisors present permanent permanent 3 years old permanent Six incisors present Other Comments - Will be the middle incisor teeth- called pincers Called first intermediate- One 200 This work is licensed under Creative Commons Attribution 4.0 International License. International Journal of Engineering and Management Research e-ISSN: 2250-0758 | p-ISSN: 2394-6962 Volume-12, Issue-6, (December 2022) www.ijemr.net https://doi.org/10.31033/ijemr.12.6.27 4 years old 5 years old Older than 6 years Eight permanent incisors present Ten incisors present All teeth present permanent About years 12 Some may missing be side of on each pincers Called intermediate Called corner incisor second Age based on tooth wear separation and visibility of tooth root The arch in mouth has disappeared and become teeth triangular with extremely noticeable wear Another important fact which we consider before treatment is cattle's' "Weight". Because when we suggest medicine for diseased cattle, we should always know the weight of the cattle. to check to constantly weigh animals Also need whether they are healthy or not. The data collected after weighing them will give you a better understanding of when to increase or reduce their feed. The data can also be used to suggest any changes in the diet or recommend more nutrients. Through image processing the weight and the age of cattle can be identified. III. METHODOLOGY When considering the overall process of "The Taurus" mobile application, it consists of four main identification, disease functions, named as breeds identification using images, disease identification using videos and predict the best medicine dosage for an identified disease considering age and the weight of the cow. Identifying a cow's breed is a critical factor in identifying the genetic diseases. In the present world there are so many small-scale farms which has no solution to identify the cattle breeds, in the process of identifying the diseases they may face. Therefore, this study aims to give an ICT solution to identify cattle breeds in the process of identifying the diseases faced by cattle. Accordingly, we found that special features between the cattle breeds and they can be differentiated using the special characteristics and identify them using them. Features such as tail, body shape, horns differentiate cattle breeds from each other. In the process of the MobileNet V2, which is an efficient convolutional neural network for mobile vision is used. the dataset training Table VI: Details regarding breeds image dataset Identified Breed Ayrshire cattle breed Brown Swiss cattle breed Holstein Friesian breed cattle Jersey cattle breed Unknown Number trained of images 260 238 254 252 119 The dataset for the component is collected through websites, small scale farms in Sri Lanka and Abewela Farm Sri Lanka. Identifying the disease by uploading an image is another solution we have implemented in the study. According to the surveys we have done, the unavailability of a mobile function to identify diseases using machine learning techniques is identified and here in our study we gave a solution for the unavailability. In the process of identifying the diseases also the CNN's (Convolutional Neural Network) approach, Mobile Net V2 is used. DiseasesIdentification.h5 model was created using Mobile Net V2 which is a very effective algorithm to feature extraction for object detection and the details of Identified is segmentation. Following diseases and number of data trained. Table VII: Details regarding diseases image dataset Identified Disease Bovine John's Disease Foot and mouth disease Lumpy skin disease Mastitis disease Milk fever disease Healthy cow Unknown Number trained of images 32 75 92 74 28 61 92 Identifying cattle's behavior is also a critical factor in identifying the diseases cattle may face. There are no mobile applications available to identify the diseases of a cow considering the behavioral changes. Therefore, one of the aims of this study is to give an ICT solution to analyze the changes of the normal behavior, identify the changes and identify the disease of the cow. Inception V3 and the GRU (Gate Recurrent Unit) models are used to implement the video analyzing .h5 model. Video is simply a sequence of multiple images that are updated really fast creating an appearance of a 201 This work is licensed under Creative Commons Attribution 4.0 International License. International Journal of Engineering and Management Research e-ISSN: 2250-0758 | p-ISSN: 2394-6962 Volume-12, Issue-6, (December 2022) www.ijemr.net https://doi.org/10.31033/ijemr.12.6.27 motion. Here in the study, Inception V3 approach is used to extract the features of the video frames and Gated Recurrent Network is used to capture the sequence relationship between the frames of the video. Table VII: Details regarding video dataset Identified changes behavioral Number of videos trained Bovine Encephalopathy Spongiform Lameness Heat Stress Healthy Unknown 90 37 21 19 81 The video dataset used in this video analyzing component is obtained through leading dairy farming countries such as India, New Zealand, Department of Agriculture, Food and Marine of Ireland by referring the websites and YouTube channels and from Sri Lankan small scale farms. Through the surveys done, the other issue we identified is that there is no mobile application containing the facility of the prescribing the medicine by analyzing the age and the weight of the cow by referring to an image of the cow. Therefore through our study we provide ICT solution for this problem. The age and the weight of the diseased cow is analyzed through images and according to the identified disease, the best dosage for the disease is provided. Two models were implemented to identify the cattle weight and age using Mobile Net V2 algorithm. Table IX: Details regarding "age" dataset Identified Age Groups Number trained of images 1 – 5 Years 5 – 10 Years 11 – 15 Years 12 47 22 Table X: Details regarding "Weight" dataset Identified Weight group Number trained of images 93 lbs. -177 lbs. 183 lbs. – 278 lbs. 259 lbs. – 548 lbs. 498 lbs. – 738lbs. 144 80 595 238 Dataset was collected via dairy farming sites, small scale farms in Sri Lanka and websites by going through researches. IV. EVALUATION AND RESULTS A. Breeds Identification The breeds identification model was created using Mobile Net V2 model. 1123 image data was trained using Mobile Net V2 model. Figure 2: Identified breeds Table XI: Actual And Predicted reults of breeds Uploaded breed image Ayrshire – 1 Actual Result Ayrshire Predicted Result Ayrshire Ayrshire – 2 Ayrshire Holstein Holstein Holstein Holstein Confident 96% 35% 99% Jersey – 1 Jersey Brown Swiss 20% Jersey – 2 Jersey Jersey 100% Brown Swiss Brown Swiss Brown Swiss 100% Figure 3: Mobile UIs of breeds identification function B. Diseases Identification using Images diseases identification model was implemented using Mobile Net V2 model by training total number of 454 image data. The 202 This work is licensed under Creative Commons Attribution 4.0 International License. International Journal of Engineering and Management Research e-ISSN: 2250-0758 | p-ISSN: 2394-6962 Volume-12, Issue-6, (December 2022) www.ijemr.net https://doi.org/10.31033/ijemr.12.6.27 Figure 4: Trained dataset for disease identification Table XII: Actual And Predicted reults of breeds Uploaded disease image Foot Mouth & Actual Result Predicted Result Confident Foot Mouth & Foot mouth and 94% Bovine John's disease Bovine John's disease Bovine John's disease 99% Lumpy Skin Disease Lumpy Skin Disease Lumpy Skin Disease 86 % Mastitis – 1 Mastitis Healthy Mastitis – 2 Mastitis Mastitis Milk Fever Milk Fever Milk Fever Healthy Healthy Healthy 26% 80% 90% 70% Figure 6: Video analysing model summary Table XIII: Actual And Predicted reults of behavioral changes Uploaded video Bovine spongiform encephalopat hy Actual Result Bovine spongiform encephalopat hy Predicted result Bovine spongiform encephalopat hy Confide nt 90% Lameness – 1 Lameness Lameness Lameness - 2 Lameness Heat Stress Heat Stress Heat Stress Heat Stress Healthy Healthy Healthy Unknown Unknown Unknown 86% 45% 99% 70% 99% Figure 5: Mobile application UIs of disease identification using images function C. Diseases Identification using Videos Diseases Identification using videos model was implemented using Gated Recurrent unit and Inception V3 model by training total number of 248 video files. 203 This work is licensed under Creative Commons Attribution 4.0 International License. International Journal of Engineering and Management Research e-ISSN: 2250-0758 | p-ISSN: 2394-6962 Volume-12, Issue-6, (December 2022) www.ijemr.net https://doi.org/10.31033/ijemr.12.6.27 Figure 7: Mobile application UIs of disease identification using videos function D. Age and Weight Identification & Provide Customized Medicine Two models were created to analyze weight and age, using Mobile Net V2 and training total number of 1356 image data. Figure 8: Dataset of age identification function Figure 9: Dataset of weight identification function Figure 10: Mobile UIs of age and Weight identification Function V. CONCLUSION Our research project will save cattle population which is a great opportunity to save a valuable life. According to the above mention details , most of the cattle dies due to suffering from diseases. Our intention is to save the cattle life. Our application is easy to use by any person with any educational level .Our application is a faster method of identifying the cattle breed , identify cattle diseases and identifying the cattle age and weight. By uploading image or video identification process can be proceed. And user can experience the accuracy of the 204 This work is licensed under Creative Commons Attribution 4.0 International License. International Journal of Engineering and Management Research e-ISSN: 2250-0758 | p-ISSN: 2394-6962 Volume-12, Issue-6, (December 2022) www.ijemr.net https://doi.org/10.31033/ijemr.12.6.27 output . All the android and iOS devices are supported which we are focusing a larger number of users for our mobile application . Therefore our application will be an useful mobile application. ACKNOWLEDGMENT We are grateful for giving the guidance in each step of developing our research project from the selecting the topic ,our superior and co-superior for sharing their experience. And Abewela farm , veterinarians , farmers and doctors for providing necessary data for our project. in Nuwara Eliya REFERENCES [1] "Cows and climate change", UC Davis, 2022. [Online]. Available: https://www.ucdavis.edu/food/news/making- cattle-more- sustainable#:~:text=Overgrazing%20those%20lands%20ca n%20degrade,even%20help%20mitigate%20climate%20c hange. [Accessed: 30- Jan- 2022]. [2] https://www.agupdate.com/farmandranchguide/opinion/col umnists/farm_and_ranch_life/cattle-s-importance-to- humans-throughout-history/article_eb7a8c7a-ef26-5b86- b8c7- 03be8f7691f7.html#:~:text=Cattle%20have%20contribute d%20to%20the,milk%2C%20and%20as%20draft%20anim als. [Accessed: 01- Feb- 2022]. [3] Available:https://www.journalofdairyscience.org/article/S0 022-0302(79)83246- 4/pdf#:~:text=Cattle%20were%20domesticated%206%2C [Online]. worldwide population "Cattle/cow 2012- Available: 000%20to,complement%20to%20cereal%20based%20diet s. [Accessed: 13- Jan- 2022]. [4] 2021," Statista. https://www.statista.com/statistics/263979/global-cattle- population-since-1990/. [Accessed: 20-Jan-2022]. [5] "Livestock losses," WildEarth Guardians, 09-Jul-2018. Available: [Online]. https://wildearthguardians.org/historical-archive/livestock- losses/. [Accessed: 21-Jan-2022]. [6] "Genetic diseases in cattle: A review," Isca.in. Available: [Online]. http://www.isca.in/AVFS/Archive/v2/i2/5.ISCA-RJAVFS- 2014- 005.pdf#:~:text=Genetic%20Diseases%20of%20Dairy%20 Cattle%20Skeletal%20Tissue%3A%20Chondrodysplasia %3A,hence%20it%20inhibits%20the%20function%20of% 20the%20transporter. [Accessed: 11-Feb-2022]. [7] I. Kawsar, "18 most common cattle diseases: You must know as A farm owner," The Vet Expert, 12-Apr-2020. [Online]. Available: https://www.thevetexpert.com/18- most-common-cattle-diseases-you-must-know-as-a-farm- owner/. [Accessed: 21-Jan-2022]. [8] I. Dittrich, M. Gertz & J. Krieter. (2019). Alterations in sick dairy cows' daily behavioural patterns. Heliyon, 5(11), e02902. [9] "A simple practice guide for dose conversion between animals and human", Australian Prescriber, vol. 41, no. 2, p. Available: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4804402/. [10] Getting The Dose Right!. Extension Veterinarian School of Veterinary Medicine University of California, Davis, 2022. 2018. 54, 205 This work is licensed under Creative Commons Attribution 4.0 International License.
http://arxiv.org/abs/2302.10417v1
2023-02-21T03:09:45
2023-02-21T03:09:45
FedSDG-FS: Efficient and Secure Feature Selection for Vertical Federated Learning
Vertical Federated Learning (VFL) enables multiple data owners, each holding a different subset of features about largely overlapping sets of data sample(s), to jointly train a useful global model. Feature selection (FS) is important to VFL. It is still an open research problem as existing FS works designed for VFL either assumes prior knowledge on the number of noisy features or prior knowledge on the post-training threshold of useful features to be selected, making them unsuitable for practical applications. To bridge this gap, we propose the Federated Stochastic Dual-Gate based Feature Selection (FedSDG-FS) approach. It consists of a Gaussian stochastic dual-gate to efficiently approximate the probability of a feature being selected, with privacy protection through Partially Homomorphic Encryption without a trusted third-party. To reduce overhead, we propose a feature importance initialization method based on Gini impurity, which can accomplish its goals with only two parameter transmissions between the server and the clients. Extensive experiments on both synthetic and real-world datasets show that FedSDG-FS significantly outperforms existing approaches in terms of achieving accurate selection of high-quality features as well as building global models with improved performance.
[ "Anran Li", "Hongyi Peng", "Lan Zhang", "Jiahui Huang", "Qing Guo", "Han Yu", "Yang Liu" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10417v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10417v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.CR" ]
FedSDG-FS: Efficient and Secure Feature Selection for Vertical Federated Learning Anran Li, Hongyi Peng, Lan Zhang, Jiahui Huang, Qing Guo, Han Yu, Yang Liu 3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 7 1 4 0 1 . 2 0 3 2 : v i X r a Abstract-Vertical Federated Learning (VFL) enables multiple data owners, each holding a different subset of features about largely overlapping sets of data sample(s), to jointly train a useful global model. Feature selection (FS) is important to VFL. It is still an open research problem as existing FS works designed for VFL either assumes prior knowledge on the number of noisy features or prior knowledge on the post-training threshold of useful features to be selected, making them unsuitable for practical applications. To bridge this gap, we propose the Fed- erated Stochastic Dual-Gate based Feature Selection (FedSDG- FS) approach. It consists of a Gaussian stochastic dual-gate to efficiently approximate the probability of a feature being selected, with privacy protection through Partially Homomorphic Encryption without a trusted third-party. To reduce overhead, we propose a feature importance initialization method based on Gini impurity, which can accomplish its goals with only two parameter transmissions between the server and the clients. Extensive experiments on both synthetic and real-world datasets show that FedSDG-FS significantly outperforms existing approaches in terms of achieving accurate selection of high-quality features as well as building global models with improved performance. Index Terms-Feature selection, vertical federated learning I. INTRODUCTION Federated learning (FL) [1]–[5] is an emerging machine learning pardigm, which enables multiple data owners to jointly train a model by iteratively exchanging model parame- ters through an FL server, while preserving local data privacy. Based on the distribution of local data, there are two main categories of FL scenarios: 1) horizontal federated learning (HFL) and 2) vertical federated learning (VFL). Under HFL [6]–[8], data owners' local datasets have little overlap in the sample space but large overlaps in the feature space. Under VFL [9]–[11], data owners' local datasets have large overlaps in the sample space but little overlap in the feature space. VFL scenarios often arise in real applications [12], [13], e.g., an e-commerce company, a bank and a ride-sharing company can collaborate to build a model to identify potential financial fraudsters based on the multiple perspectives on people's behaviour through VFL. The quality of data owners' local features determines the effectiveness of their local models, thereby affecting the performance of the global VFL model. In practice, data owners can possess noisy features that are irrelevant to the learning task, or a large number of redundant features, which seriously impairs global model performance. §This paper has been accepted by IEEE INFOCOM 2023. Anran Li, Hongyi Peng, Han Yu and Yang Liu are with the school of Computer Science and Engineering of Nanyang Technological University, Singapore. Lan Zhang and Jiahui Huang are with the school of Computer Science and Technology of University of Science and Technology of China, China. Qing Guo is with the Center for Frontier AI Research, A*STAR, Singapore. As an example, one of our experiments in Section III-B shows that a two-class classifier trained by VFL with the real dataset suffered an accuracy loss from 82.6% to 54.2% due to the existence of noisy features. To improve the performance of VFL systems, in this work, we focus on filtering noisy features and selecting important features. A number of feature selection methods have been proposed for centralized machine learning settings [14]–[16], while few work focused on VFL [17]. Feature selection methods for centralized machine learning can be divided into three categories: 1) filter methods calculate per-feature relevance scores based on statistical measures (e.g., Gini impurity) to filter features prior to learning a model [16], [18], [19]; 2) wrapper methods search for the optimal feature subset in large search spaces [20], [21]; and 3) embedded methods attempt to select subset of important features while simultaneously learn the model [15], [22], [23]. Existing FS works designed for VFL either assumes prior knowledge on the number of noisy features [17] or prior knowledge on the post-training threshold of useful features to be selected [24]. These assumptions make them unsuit- able for practical VFL applications. The problem of feature selection in VFL settings remains open. To enable feature selection to be performed in VFL settings, the following key research questions need to be addressed. 1) How to accurately identify noisy features, and select a small number of important features to train an optimal global VFL model in a privacy-preserving manner? Existing FS methods require direct access to training samples, the training process and the labels simultaneously, which is not permitted in VFL. Besides, during VFL training, intermediate parameters are transmitted in ciphertexts [25], [26], which further increases the difficulty of feature selection. 2) How to conduct feature selection efficiently and adaptively in VFL settings? Existing FS methods require a large number of training iterations to select features, especially for high-dimensional data [15], [22]. Directly applying them in VFL will incur significant computation and communication overhead since each training round involves multiple encryption/decryption operations and intermediate parameter transfers. To address the aforementioned questions and the limita- tions of existing works [17], [24], we propose the Federated Stochastic Dual-Gate based Feature Selection (FedSDG-FS) approach. It is an embedded feature selection approach con- sisting of a feature importance initialization module and a secure important feature selection module. Its advantages are summarized as follows: • Context-Awareness: FedSDG-FS can jointly perform feature selection and model training following the pro- posed stochastic dual-gate and Gini impurity-based fea- ture importance initialization, thereby ensuring the se- lected features be to relevant to the context of the model. • Efficiency: The FedSDG-FS Gini impurity based feature to importance initialization enables the global model quickly filter out noisy features and select important ones, thus speeding up model training. The stochastic dual- gates are designed to reduce the sizes of the embedding vectors, thereby saving communication costs. • Security: FedSDG-FS achieves secure feature selection and model training by leveraging partially homomor- phic encryption (PHE) and the randomized mechanism. During the feature selection and model training process, neither data nor labels are exposed to any party other than their original owners. We evaluate FedSDG-FS via extensive experiments using nine datasets including tabular data, images, texts and audios on a VFL system. The results show that it significantly outperforms existing approaches in terms of achieving accurate and secure selection of high-quality features to build high-performance VFL models. Taking MADELON dataset as an instance, the average test accuracy of FedSDG-FS is 27.0% higher than that of the best performing baseline with 47% fewer features required, and only half the communication cost. II. RELATED WORKS Feature selection plays an important role in machine learn- ing tasks. There are a number of feature selection methods proposed for centralized machine learning settings [14]–[16], while few works deal with feature selection in VFL [17]. A. Feature Selection in Centralized Learning Feature selection methods in centralized learning settings can be divided into three categories: 1) filter methods, 2) wrap- per methods, and 3) embedded methods. Filter FS methods attempt to remove irrelevant features prior to learning a model. These methods filter features using relevance scores (e.g., Gini impurity) and mutual information, which are calculated based on statistical measures [14], [16], [18], [27]. Wrapper FS methods leverage the outcomes of a model to determine the importance of each feature. They attempt to select a subset of features which can achieve the best prediction performance. As the number of subsets can be very large in the context of deep neural networks, and a model need to be recomputed for each subset, wrapper methods are generally computationally expensive [20], [21], [28]. Embedded FS methods aim to select a subset of relevant features, while simultaneously learning the model [15], [22], [23]. The least absolute shrinkage and selection operator [23] is a well-known embedded FS method, whose objective is to minimize the loss while enforcing an l1 constraint on the weights of the features. Another recently proposed method [15] uses a continuously relaxed Bernoulli variable to conduct FS based on stochastic gates. However, this method requires a large number of parameters to be trained in the first layer, resulting in overfitting to the training data, especially for deep neural networks with high-dimensional data or when there are only a limited number of training samples available. Since these methods are designed for centralized learning scenarios in which all training data are accessible, such approaches are not applicable to VFL which demands data privacy protection. In addition, they are also not optimized to reduce communication or computation costs when the volume of training data is large. B. Feature Selection in VFL In VFL, there are only two works on feature selection (FS) [17], [29]. In [17], FS is performed with the filter method based on secure multi-party computation. However, since it performs VFL feature selection out of the context of the learning task, it can lead to inaccurate feature selection. Besides, it assumes that the number of noisy features is known in advance, and that there is a trusted third party for performing FS. These assumptions are unrealistic in practice. Further, it incur large communication overhead since a massive amount of parameters are transmitted between participants and the trusted third party. In [29] the embedded method combined the auto-encoder with l2 constraints on feature weights is used for FS. However, it suffers from shrinkage of the model parameters, and requires post-training threshold setting to determine the selected features [24]. The proposed FedSDG- FS approach addresses these limitations of the state of the art. III. PRELIMINARIES & PROBLEM DEFINITION A. Basic Setup of VFL There are two types of entities involved in VFL: a server S and M clients M := {1, 2, * * * , M }. A dataset U = {U1, * * * , UM } of N samples, {X, Y } := {xn, yn}N n=1, is maintained by the M clients. Let [N ] = {1, 2, * * * , N }. Each client m is associated with a unique set of features {fm,1, * * * , fm,dm}, and owns sample xn,m ∈ Rdm , n ∈ [N ], where xn,m is the m-th block of the n-th sample vector xn := (cid:2)x(cid:62) (cid:3)(cid:62) . Suppose there are c possible class labels, the n-th label yn ∈ [c] is stored by server S. Typically, a data owner, which holds both the feature and the class labels, can act as the "FL server". It is referred to as the active party. Others which hold only features are referred to as the passive parties. n,2, * * * , x(cid:62) n,1, x(cid:62) n,M Each client m learns a local embedding hm parameterized by θm ∈ Θ that maps a high-dimensional vector xn,m ∈ Rdm into a low-dimensional one hn,m := hm(θm; xn,m) ∈ Rdm with dm (cid:28) dm. The server S learns the prediction ˆyn pa- rameterized by the top model θ0 := {w1, * * * , wM , α0} ∈ Θ, wm ∈ Rdm, m ∈ [M ], where {w1, * * * , wM } are parameters of the interactive layer which concatenates embedding vectors hn,1, * * * , hn,M in a weighted manner. α0 denotes the parame- ters of the succeeding layers of the top model connected to the interactive layer. Ideally, the objective of VFL is to minimize, R(θ) := EX,Y L(h(θ0, hn,1, * * * , hn,M ); yn) with hn,m := hm(θm; xn,m), m ∈ [M ] (1) (a) Accuracy and model size vs. number of participating features (b) Accuracy vs. number of partici- pating features Fig. 1. Test accuracy and model size of vertical neural networks training using (a) the dataset ARECENE with redundant features; (b) the dataset MADELON with noisy features. n,m}M where θ := {θi}M i=0 denotes the global model, which consists of M local models θ1, * * * , θM and the top model θ0, and L(*; *) is the loss function. This problem can be solved via iterative stochastic optimization. In the t-th iteration, the server receives embedding vectors {ht m=1 from M clients. It then calculates and sends the gradients of the loss w.r.t. ht n,m to all clients. Upon receiving the gradients, client m updates the local model to obtain θt+1 m . Then, client m randomly selects a datum xn,m, calculates ht+1 m , and uploads it to the server. This process is repeated until the global model converges (i.e., a convergence criterion is met). To ensure that neither data nor labels can be obtained or inferred by any other party, the above iterative training must be conducted in a privacy-preserving manner. n,m using θt+1 B. Motivating Examples Here, we perform data driven analysis to demonstrate the necessity of feature selection in VFL. We illustrate this from two aspects: 1) many clients may possess a large number of redundant features, which results in a low quality and very complex global model; and 2) some clients can pos- sess noisy or task irrelevant features which reduce global model performance. Specifically, we use datasets ARCENE [30] and MADELON [31] as training data to investigate the two observations. ARCENE contains 2,400 instances with 7,000 informative but redundant features. MADELON contains 4,400 instances with 5 informative features and 480 noisy features. We employ two clients, A and B, and a server to jointly train neural networks [25] based on these two datasets via VFL. To illustrate aspect 1), we assign different numbers of features of ARCENE to client B, while assigning 100 fixed features to client A to train the VFL network. The results in Fig 1(a) show that, as the number of redundant features increases, the test accuracy of the global model decreases slightly, while the model size grows rapidly. To illustrate aspect 2), we assign different numbers of noisy features from the MADELON dataset to client B, while assigning 10 fixed features to client A to train the VFL models. The results are shown in Fig. 1(b), where 10 : k indicates that, A owns 10 features (i.e., 3 informative features and 7 noisy features), and B owns k features (i.e., 2 informative features and (k − 2) noisy features). The result shows that as the number of noisy features increases, the Fig. 2. System overview of FedSDG-FS. 1(cid:13) Send encrypted embeddings, 2(cid:13) send encrypted gradients. test accuracy of the global VFL model decreases significantly. These results show that an efficient and privacy-preserving feature selection method is urgently needed for VFL. C. Problem Formulation In a typical VFL system, under the coordination of the server S, all participants train a global model by transferring their local embedding vectors trained using their local datasets. Additionally, we consider a situation in practice in which some clients possess a large number of noisy features or redundant features. This may result in a low-performance and extremely complex global model. Specifically, we can divide all features into qualified important features and negatively influential features, e.g., noisy features or redundant features, by their effects to the objective of the global model. A desired VFL framework should enable all participants to jointly train a simple global model with a small number of important features, while eliminating negatively influential features. The goal of feature selection in VFL is to simultaneously select a subset of features, and construct a global model ˆθ with the objective by minimizing the risk, R(θ, s) := EX,Y L(h(θ0, hn,1, * * * , hn,M ); yn) with hn,m := hm(θm; xn,m (cid:12) sm), m ∈ [M ], (2) where sm = {0, 1}dm is the vector of indicator variables, and sm,i, i ∈ [dm] are Bernoulli variables which indicate whether or not the i-th feature of client m is selected. We assume that all participants are semi-honest. They follow the exact protocol of VFL and feature selection, but are curious about others' private information. IV. THE PROPOSED FedSDG-FS APPROACH In this section, we first present the system architecture of FedSDG-FS. Then, we illustrate the key technique to enable feature selection to be performed jointly with model training under VFL settings. Finally, we present the details of the FedSDG-FS algorithms. 1001000300050006900# of participating features of client B6065707580859095100testAcc (%)100200300400500600model size (*1000)0100200300400500training rounds45505560657075808590testAcc(%)10:1010:5010:10010:25010:450Client !Bottom ModelInteractiveLayerTop LayerClient "ClientServer...Top ModelOutputModelRetraining1. FeatureImportanceInitialization (Before Training)CalculateGiniscoresGenerateIndicatorOptimal Model #$Selected Features2. ImportantFeatureSelection (Training)Client %...Communication21⨀'(,*+(,*...⨀⨀,(,*,-,*⨀'-,*+-,*⨀'.,*+.,*StochasticDual-Gates... A. System Overview FedSDG-FS consists of two modules (as shown in Fig. 2): 1) Feature Importance Initialization before Training. To save feature selection costs, local clients first securely initialize feature importance based on Gini impurity and PHE, in cooperation with the server prior to the model training. 2) Important Feature Selection during Training. After feature importance initialization, the server coordinates clients to select important features, while training the VFL model for improved performance. Specifically, to fulfil the requirement that neither data nor labels can be obtained or inferred by any other party other than their original owners, we propose a secure FS approach which includes forward propagation for secure feature selection, and backward propagation for secure feature selection, based on the proposed stochastic dual- gate, PHE and the randomized noise mechanism. In this way, FedSDG-FS determines the selected features and produces an optimal global model ˆθ with higher accuracy and fast convergence. B. Stochastic Dual-Gates for VFL To achieve accurate feature selection while simultaneously training the global model in VFL, we need to dynamically quantify the influence of features on the global model during training, and increase the probability of selection for highly influential features. In VFL, local embedding vectors are transferred to the server, where the size of embedding vectors affects the communication cost. To reduce communication overhead in feature selection, we first introduce stochastic dual-gates for VFL to efficiently approximate the probabilities of features and embedding vectors being selected. We re- express Eq. (2) into minimizing the l0 constrained risk: R(θ, s, q) := EX,Y L(h(θ0, gn,1, * * * , gn,M ); yn) + λ (cid:88) m (cid:0)|sm|0 + |qm|0 (cid:1) (3) where hn,m := hm(θm; xn,m (cid:12)sm), gn,m = hn,m (cid:12)qm, qm = {0, 1}dm is the vector of indicator variables, where qm,i, i ∈ [dm] are Bernoulli variables and indicate whether or not the i- th dimension of embedding hn,m is selected for global model training. λ is a weighting factor for the regularization. The l0 norm penalizes the number of non-zero entries in the vectors sm, qm, thus encourages sparsity in the final estimates. Notice that l0 norm induces no shrinkage on the actual values of the parameters, which is in contrast to l1 regularization [23]. However, as the optimization of hard feature selection with binary masks suffers from high variance, we pro- pose a secure Gaussian-based continuous relaxation for the Bernoulli variables for VFL. We approximate each element of sm, qm to clipped Gaussian random variables parameterized by μm, ωm as sm,i = max(0, min(1, μm,i + ρm,i)), qm,j = max(0, min(1, ωm,j + γm,j)), where ρm,i, γm,j are drawn from N (0, σ2), and μm,i, ωm,j can be learned during VFL training. Under the continuous relaxation, the regularization term in Eq. (3) is simply the sum of the probabilities that (cid:80) j∈[dm] P (qm,j > 0), and can be i∈[dm] P (sm,i > 0) + (cid:80) (a) Ratio of the same selected fea- tures by stochastic gate and Gini impurity (b) Comparison of the original gate method and FedSDG-FS Fig. 3. Example motivation of FedSDG-FS design. The vertical neural network is trained on the dataset MADELON. i∈[dm] Φ( μm,i calculated by (cid:80) σ ), where Φ(*) is the cumulative distribution function (CDF) of the standard Gaussian distribution. By employing the continuous distribution, we can thus transform Eq. (3) into the following: j∈[dm] Φ( ωm,j σ ) + (cid:80) R(θ, μ, ω) :=EX,Y L(h(θ0, gn,1, * * * , gn,M ); yn) (cid:18) (cid:88) + λ m,i Φ (cid:17) (cid:16) μm,i σ + Φ (cid:16) ωm,j σ (cid:88) m,j (cid:17) (cid:19) . (4) To optimize the objective of Eq. (4), we first differentiate it with respect to μm, ωm. However, since the loss L of the global model is calculated and stored at the server S, client m performs the differentiation using chain rules [32] based on the Monte Carlo sampling gradient estimator, e.g., for μm: 1 C (cid:88) i∈[C] (cid:20) ∂Ln ∂gn,m * ∂gn,m ∂sm * ∂sm,i ∂μm,i (cid:21) + λ ∂ ∂μm Φ (cid:17) (cid:16) μm σ (5) where C is the number of Monte Carlo samples. The calcu- lation of gradient of estimator for ωm is similar to Eq. (5). Thus, we can update μm, ωm via stochastic gradient descent. Updating the parameters and conducting the above oper- ations require access to all local training samples or train- ing process, which are, however, obfuscated from any third party including the server. In addition, directly applying the stochastic gates to the clients' inputs would require a large number of parameters to be trained (e.g., μm, m ∈ [M ]), which slows down the convergence of the global model, and incurs significant computation and communication overhead, especially for high-dimension features. To address this challenge, we propose an efficient and secure feature selection framework, FedSDG-FS, which leverages Gini impurity for VFL to initialize the importance of indi- vidual features to facilitate feature selection. Then important features and significant local embeddings can be selected by the proposed stochastic dual gates, enhanced with PHE and the randomized noisy mechanism for privacy preservation. To illustrate the motivation of the importance initialization, we make the following empirical observations. Firstly, as illustrated in Fig. 3(a), there can be a large ratio of the same features being selected by the Gini impurity [14] and by the stochastic gates in some training rounds. Secondly, Gini impurity initialization can speed up feature selection (Fig. 3(b)). Moreover, the reason that Gini impurity cannot 0255075100125150175Training rounds0.500.510.520.530.540.550.560.57Ratios60708090100testAcc(%)original-GateVFL-FS0255075100125150175200Training rounds0.60.70.80.91.0Ratio of selected featuresoriginal-GateVFL-FS Algorithm 1: Feature Importance Initialization for VFL : Server S, clients m Input Output: Initialized feature importance Generate an indicator matrix A, [[A]] ← Enc(A) Send [[A]] to all clients 1 Server S 2 3 4 Client m 5 6 7 8 9 a∈I(Um,i)[[A]]a,k/|Um,i| Induce a partition Um,1 ∪ Um,2 ∪ * * * ∪ Um,b of Um Calculate [[pm,k]] ← (cid:80) Calculate [[pm,k]]2 with the protocol in [33] [[G(Um,i)]] ← 1 − (cid:80) [[G(fm,j)]] ← (cid:80)c * [[G(Um,i)]] i=1 Send [[G(fm,j)]], j ∈ [dm] to the server k∈[c][[pm,k]]2 |Um,i| |Um| 10 11 Server S 12 G(fm,j) ← Dec([[G(fm,j)]]) 13 14 Client m 15 16 Return feature importance initialization μm,j, j ∈ [dm] Send G(fm,j), j ∈ [dm] to client m Initialize μm,j ∝ 1 G(fm,j ) the private label Specifically, the server first generates an indicator matrix A with a size of N ×c, where An,k = 1 indicates the category of the n-th sample is k; otherwise, An,k = 0. Then, the probabil- ity pm,k can be calculated as pm,k = (cid:80) a∈I(Um,i) Aa,k/|Um,i| for client m, where I(Um,i) denotes the index set of instances from Um,i. To prevent information from being leaked, the server encrypts the matrix A, and sends [[A]] to all clients. Then, client m calculates the probability [[pm,k]] = (cid:80) a∈I(Um,i)[[A]]a,k/|Um,i| and uses the protocol in [33] to compute the square of [[pm,k]] as follows. Firstly, client m generates a random value r and computes [[um,k]] = [[pm,k + r]], such that p2 m,k − 2um,k * r + r2 and m,k equals u2 [[−2um,k * r + r2]] can be locally computed by the client. Then, client m sends [[um,k]] to the server. The server decrypts it, computes and sends [[u2 m,k]] to client m. Finally, the client m,k−2um,k*r+r2]]. After calculating [[p2]], computes [[p2]] = [[u2 client m calculates the Gini impurity [[G(fm,j)]] of feature fm,j, and sends them to the server. The server then decrypts them, and assigns larger initial importance values to features with smaller Gini values. During this process, only the server learns the Gini scores of client m's features, while other parties learn nothing. The main steps are shown in Algorithm 1. be directly used for feature selection is that it cannot take into account the specific VFL models and has no prior knowledge of the number of important features to select. The feature importance initialization step can be accomplished by FedSDG-FS through two parameter transmissions with two encryption/decryption operations on the server based on Gini impurity and PHE, which significantly improves efficiency and privacy preservation. In this way, we can achieve efficient and secure feature selection as well as construct the global VFL model with high inference accuracy and fast convergence. C. Feature Importance Initialization 4 5 k∈[c] p2 M clients have a set U = {U1, * * * , UM } of N samples, and the corresponding c class labels are stored at the server. For client m, if the j-th feature fm,j is a discrete feature that can assume b values, then it induces a partition Um,1 ∪ * * * ∪ Um,b of the set Um in which Um,i is the set of instances with the i-th value for fm,j. The Gini impurity of Um,i is defined as G(Um,i) = 1 − (cid:80) m,k, where pm,k is the probability of a randomly selected instance from Um,i belonging to the k-th class. The Gini score of feature fm,j is calculated as G(fm,j) = (cid:80) * G(Um,i), where G(fm,j) measures the likelihood of a randomly selected instance being misclassi- fied. If fm,j is a feature with continuous values, then G(fm,j) is defined as the weighted average of the Gini impurities of a set of discrete feature values. We use the Paillier as the PHE method which supports homomorphic addition of two ciphertexts and homomorphic multiplication between a plaintext and a ciphertext. The calculation of pm,k requires collaboration between client m and the server. Thus, we design an efficient and secure collaborative calculation protocol. |Um,i| |Um| i∈[b] 6 8 12 13 17 Algorithm 2: Forward Propagation for Secure Feature Selection Input : M clients with N samples {xn, yn}N n=1, xn,m ∈ Rdm Output: Global model ˆθ, indicator vector {sm}M m=1 1 Initialize model θ0 := {α0, w1, w2, * * * , wM }, {θi}M i=1, noise (cid:15)acc; initialize μm with Algorithm 1, ωm ∈ Rdm 2 Client m, m ∈ [M ] 3 Select datum (or data mini-batch) xn,m Sample ρm,i, γm,j ∼ N (0, σ2), i ∈ [dm], j ∈ [dm] Compute sm,i = max(0, min(1, μm,i + ρm,i)) qm,j = max(0, min(1, ωm,j + γm,j)) 7 Rm = (cid:80) i∈[dm] Φ(cid:0) μm,i σ (cid:1) + (cid:80) j∈[dm] Φ(cid:0) ωm,j σ (cid:1) hn,m ← hm(θm; xn,m (cid:12) sm), gn,m = hn,m (cid:12) qm [[gn,m]] ← Enc(gn,m), sends [[gn,m]] to the server 9 10 Server S 11 Calculate the noisy weight (cid:101)wm ← wm + (cid:15)acc, m ∈ [M ] Compute [[(cid:101)zn,m]] ← [[gn,m]] * (cid:101)wm Add random noise [[(cid:101)zn,m + (cid:15)s]] ← [[(cid:101)zn,m]] + (cid:15)s Send [[(cid:101)zn,m + (cid:15)s]] to client m 14 15 Client m, m ∈ [M ] 16 (cid:101)zn,m + (cid:15)s ← Dec([[(cid:101)zn,m + (cid:15)s]]) Remove noise zn,m + (cid:15)s ← (cid:101)zn,m + (cid:15)s − (cid:15)accgn,m Send zn,m + (cid:15)s to the server 18 19 Server S 20 Remove noise zn,m ← zn,m + (cid:15)s − (cid:15)s Compute Ln ← L(h(α0, zn,1, * * * , zn,M ); yn) 21 22 Return the loss Ln D. Secure Important Feature Selection 1) Forward Propagation on Clients: Client m randomly selects a private datum (or mini-batch) xn,m, and calculates the indicator sm,i for each feature fm,i, i ∈ [dm]. Then, it calculates the embedding vector hn,m using the local model θm and the masked embedding gh,m = hn,m (cid:12) qm, and encrypts it with PHE to obtain [[gn,m]] = Enc(gn,m), which is sent to the server. 2) Forward Propagation on the Server: After receiving the encrypted embedding [[gn,m]], the server calculates the weighted vector [[zn,m]] = [[gn,m]] (cid:12) wm, and performs the forward propagation of the top model. Since the non-linear activation function on the top model cannot be calculated on the encrypted data, the weighted vector [[zn,m]] should be sent back to client m for decryption. However, sending the weighted vector directly without any protection would leak the prediction to the client (e.g., client m can use the activation prediction pair (zn,m, gn,m) to infer activation values and weights of the top model). To prevent this, the server adds random noises (cid:15)s on [[zn,m]], and sends [[zn,m +(cid:15)s]] to client m. Then, client m decrypts the noisy weighted sum [[zn,m + (cid:15)s]], and sends zn,m + (cid:15)s to the server. Finally, the server removes the noise and computes the activation for the next layer. The process repeats until the final layer is reached. Another problem is that the server holds both wm and zn,m, and can easily infer hn,m via linear regression. To avoid this, the server should use the noisy weight (cid:101)wm to calculate the weighted vector [[(cid:101)zn,m]] ← [[gn,m]] (cid:12) (cid:101)wm, where (cid:101)wm = wm + (cid:15)acc, (cid:15)acc is generated by the client. The forward propagation for secure feature selection is shown in Algorithm 2. 3) Backward Propagation on the Server: To update the global model, two gradients need to be computed first, the loss gradients w.r.t. the weight of the interactive layer ∂Ln , ∂wm ∂Ln and the embedding vector . Since these two gradients ∂gn,m are linear transformations of either gn,m or wm, both the server and client m can derive what they want to acquire via regression. To this end, we design the following secure backward propagation method. ]], ∂ (cid:101)Ln ∂gn,m this would result Specifically, the server first calculates the following gra- dients: [[ ∂Ln , ∂Ln . If the server updates [[wm]] by ∂α0 ∂wm [[wm]] = wm − ηm[[ ∂Ln ]], in two en- ∂wm crypted quantities in calculating the weighted vector zn,m = [[wm]][[gn,m]], which is incompatible with PHE. To avoid this, the server needs to send [[ ∂Ln ]] to client m, and receive ∂wm back. However, sending [[ ∂Ln the decrypted gradient ∂Ln ]] ∂wm ∂wm directly to client m would leak information about both parties, because the server holds ∂Ln and client m holds hn,m. Thus, ∂zn,m both the server and client m need to add random noises to the encrypted gradient of weights ∂Ln before sending them to ∂zn,m the other party, and update the parameters (see lines 4-10 of Algorithm 3). Note that the noise (cid:15)s generated by the server can be removed when the gradient ∂ (cid:101)Ln still contains noise, ∂wm where ∂ (cid:101)Ln ∂wm weights as (cid:101)wt+1 , the server updates the m + (cid:15)m. . With ∂ (cid:101)Ln ∂wm − (cid:15)m η0 − (cid:15)m η0 m − η( ∂Ln ∂wm = ∂Ln ∂wm m = wt ) = wt+1 m=1 (cid:80)t m = (cid:101)wt+1 It can be observed that the noise (cid:15)m will accumulate in weights wm in each iteration. If we take the accumulated noise as (cid:15)acc = (cid:80)M i=1 (cid:15)i m, the true weights used in forward and backward propagation should be wt+1 m − (cid:15)acc. To perform the correct forward operation, client m needs to remove the noise by subtracting gn,m(cid:15)acc from the noisy weighted vector (cid:101)zn,m. Similarly, the extra noise should be added to ∂ (cid:101)Ln , and removed before backpropagation by client ∂gn,m m. To achieve this, client m needs to send the encrypted noise [[(cid:15)acc]] to the server, and the server calculates the true gradient via [[ ∂Ln , and sends the encrypted ∂gn,m gradient [[ ∂Ln ∂gn,m ]] = ∂ (cid:101)Ln ∂gn,m ]] to the client m. − [[(cid:15)acc]] * ∂Ln ∂zn,m 4) Backward Propagation on Clients: The client m first decrypts the gradient [[ ∂Ln ]] received from the server. Then, ∂gn,m it updates the local model θm and the variable μm, ωm. In this way, model update and feature selection can be accomplished simultaneously. The entire secure backpropagation approach is detailed in Algorithm 3. Algorithm 3: Backward Propagation for Secure Fea- ture Selection Input : Loss Ln on the server, target {yn}N n=1, learning rates η0, ηm Output: Global model ˆθ, indicator vector sm, qm, m ∈ [M ] ]] ← ∂Ln ∂zn,m * [[gn,m]], ]] + (cid:15)s 1 Server S 2 3 * (cid:101)wm, ∂Ln Compute the gradients [[ ∂Ln ∂wm ∂ (cid:101)Ln ← ∂Ln ∂zn,m ∂gn,m Add noise [[ ∂Ln ∂wm Send [[ ∂Ln + (cid:15)s]] to client m 4 ∂wm 5 Client m ∈ [M ] 6 ∂α0 + (cid:15)s]] ← [[ ∂Ln ∂wm 7 8 9 + (cid:15)s]]) + (cid:15)s ← Dec([[ ∂Ln ∂wm + (cid:15)s ← ∂Ln ∂wm ∂Ln ∂wm Add noise ∂ (cid:101)Ln ∂wm Encrypt noise [[(cid:15)acc]] ← Enc((cid:15)acc) Accumulate noise (cid:15)acc ← (cid:15)acc + (cid:15)m Send ∂ (cid:101)Ln ∂wm + (cid:15)s, and [[(cid:15)acc]] to the server + (cid:15)s − (cid:15)m η0 10 11 Server S , α0 ← α0 − η0∇α0 Ln − [[(cid:15)acc]] * ∂Ln ∂zn,m + (cid:15)s − (cid:15)s 13 12 ← ∂ (cid:101)Ln ∂wm Remove noise ∂ (cid:101)Ln ∂wm Update θ0 = {w1, * * * , wm, α0}: ∂ (cid:101)Ln (cid:101)wm ← (cid:101)wm − η0 ∂wm Remove noise [[ ∂Ln ∂gn,m Send [[ ∂Ln ]] to client m 15 ∂gn,m 16 Client m ∈ [M ] 17 ]] ← ∂ (cid:101)Ln ∂gn,m 14 ← [Dec([[ ∂Ln ∂gn,m ∂Ln ]]) ∂gn,m , ∂Ln Calculate ∂Ln ∂θm ∂μm Update μm ← μm − ηm ωm ← ωm − ηm , ∂Ln ∂ωm (cid:0) ∂Ln ∂μm (cid:0) ∂Ln ∂μm + λ ∂Rm ∂ωm 20 21 Return the global model θ = {θm}M 18 19 (cid:1) + λ ∂Rm ∂μm (cid:1), θm ← θm − ηm ∂Ln ∂θm m=0. E. Convergence Analysis We present convergence results for FedSDG-FS through two steps. First, we show that there is an equivalence between our proposed l0 constrained optimization for feature selection and optimization over Bernoulli distribution through Mutual Information (MI). Then, we present the convergence results of the gradient decent methods for optimizing the l0 constrained optimization. Without loss of generality, we only consider the bottom level stochastic gates here. The goal of feature selection is to find the subset of features Q that has the highest MI with the target variable Y . We can then formulate the task as selecting Q such that the MI I(*) between XQ and Y is maximized: max Q I(XQ, Y ) s.t. |Q| = k. (6) Then, under the mild assumption that there exists an optimal subset of indices Q∗, the equation above is equivalent to max 0≤π≤1 I(X (cid:12) ̃Q; Y ) s.t. (cid:88) E (cid:105) (cid:104) ̃Qi ≤ k, (7) i where ̃Q are independently sampled from the Bernoulli distri- bution with parameter π. Then, we can rewrite this constrained optimization problem as a penalty optimization problem, which is the same as Eq. (3): R = min L(X (cid:12) ̃Q; Y ) + λ| ̃Q| (8) So far, we have proved the equivalence between the proposed l0 constrained optimization and the selection of the optimal feature subset. Next, we give the convergence results of the l0 constrained optimization for feature selection. Assumption 1. The gradient ∂R(θ) ∂θ0 , m ∈ [M ] is Km-Lipschitz continuous. is K-Lipschitz continu- ous, and ∂R(θ) ∂θm Theorem 1. Under Assumption 1, and the assumption that ρ minm(t+T0) with the R(θ) is ρ-strongly convex, if ηt = constant T0 > 0. Then the convergence rate is O(1/T ). 1 Time and storage complexity analysis. The time complex- ity of the algorithm is O( K||θ0−ˆθ||2 m)T (||θ0 − 2(cid:15) ˆθ||2). The storage complexity is O(|θ| + |s| + |q|), where | * | denotes the parameter size, and the communication cost is O (cid:16) |q| K||θ0−ˆθ||2 ), (cid:15) = 2(ηt+ηt (cid:17) 1 . (cid:15) V. EXPERIMENTAL EVALUATION A. Experiment Configuration images, 1) Datasets. We use 9 datasets with 4 types of data: tabular data, texts and audios. These include 2 synthetic datasets, MADELON [31] and FRIEDMAN [34]; and 7 real- world datasets, ARCENE [30], BASEHOCK [35], RELATHE [35], PCMAC [35], GISETTE [36], COIL20 [37] and ISOLET [38]. The synthetic datasets are derived from the feature selection challenge [31], where MADELON consists of 5 infor- mative features, 15 redundant features constructed by linear combinations of those 5 informative features, and 480 noisy features, while FRIEDMAN consists of 5 informative and 995 noisy features. For the real-world datasets, most of them are collected from the ASU feature selection database online [35]. The descriptions of all datasets are listed in Table I. We employ two clients in our settings, where we divide features into two parts randomly for every dataset, and assign each part to clients A and B. The labels are located in the server. For the text, image and audio datasets, we divide the features randomly by rows for the clients. TABLE I DESCRIPTION OF DATASETS FOR EMPIRICAL EVALUATIONS Dataset MADELON FRIEDMAN ARCENE BASEHOCK RELATHE PCMAC GISETTE COIL20 ISOLET Features 500 1,000 10,000 7,862 4,322 3,289 5,000 1,024 617 Train size 2,000 750 1,400 1,594 2,320 1,554 5,600 1,008 1,248 Test size 2,400 250 600 398 2,088 388 1,400 432 312 Classes 2 2 2 2 2 2 2 20 26 Type Tabular Tabular Tabular Text Text Text Image Image Audio 2) VFL Models. We have implemented the typical logistic regression model for VFL [39] on FRIEDMAN, and neural net- works for VFL [25] on the other 8 datasets (see Table II). We run VFL models until a pre-specified test accuracy is reached, or a maximum number of iterations has elapsed. In addition, training the dual-gates until convergence may sometimes cause overfitting of the model, where we set the cutoff value of the variables and perform early stopping. We use the Paillier as the PHE method. We use the Adam optimizer, and set learning rate η = 0.03, batch size b = 128, weight factor λ = 0.1. We test the accuracy of the global model on the hold-out test datasets. We build our VFL models with Flower 0.19.0 [40] and Pytorch 1.8.1 [41]. All the experiments are performed on Ubuntu 16 operating system equipped with a 12-core i7 Intel CPU, 64G of RAM and 4 Titan X GPUs. TABLE II SETTINGS FOR TRAINING DIFFERENT VFL MODELS. Model VFLNN-MADELON VFLLR-FRIEDMAN VFLNN-ARCENE VFLNN-BASEHOCK VFLNN-RELATHE VFLNN-PCMAC VFLNN-GISETTE VFLNN-COIL20 VFLNN-ISOLET # of parameters 130,552 130,501 1,030,552 516,752 462,752 359,452 530,552 109,360 93,476 Task Two-class classification Regression Cancer detection Text classification Text classification Text classification Digit number recognition Face image recognition Letter-name recognition B. Evaluating Gini Impurity for VFL Firstly, we evaluate the effectiveness of our Gini impurity metric (FedSDG-FS-gini) designed for feature importance initialization in FedSDG-FS by comparing the test accuracy of the global models to the other three filtering based feature selection strategies, SFFS [17], random FS, and all features participating (allFeatures). We select different numbers of fea- tures (i.e., k features with the smallest Gini scores), and assign them to the two clients. Since those datasets differ in both the number of features and the number of noisy features. Thus, (a) VFLNN-MADELON (b) VFLLR-FRIEDMAN Fig. 4. Test accuracy and R2 scores vs. number of selected features on synthetic datasets. (a) VFLNN-ARCENE (b) VFLNN-GISETTE Fig. 5. Test accuracy vs. number of selected features by training models for 20 rounds. (a) VFLNN-ARCENE (b) VFLNN-GISETTE (c) VFLNN-ARCENE (d) VFLNN-GISETTE Fig. 6. Test accuracy and number of selected features during model training of original gate selection method and FedSDG-FS. N (cid:80) (cid:80) n∈[N ](yn−ˆyn)2 n∈[N ](yn− ̄y) , where ̄y = 1 (cid:80) we select features from each dataset in similar proportions and round the numbers of selected features. We perform 5-fold cross validation and report the average R2 scores, test accuracy and standard deviations in Fig. 4. Here, the R2 score is defined as R2 = 1 − n∈[N ] yn, and yn, ˆyn are the true target and predicted target of the n- th sample, respectively. The results show that FedSDG-FS- gini achieves higher test accuracy and R2 scores than other strategies. Specifically, the average test accuracy and R2 scores of FedSDG-FS-gini are 28.71%/ 123.8%, 29.69%/ 70.3%, 12.85%/ 3.4% higher than that of random, allFeatures and SFFS for MADELON and FRIEDMAN, respectively. Meanwhile, the standard deviations are relative small, e.g., with 1.22% and 4.3% smaller than that of SFFS for MADELON and FRIEDMAN. Besides, the reason why some of the test accuracy in Fig 4. is less than 50% is that there are noisy features irrelevant to the learning task and a large number of redundant features possessed by local clients, samples with very similar or the same features may have completely opposite labels. C. Evaluating Important Feature Selection 1) Precision. We use precision to measure the accu- racy of FedSDG-FS, which calculates the proportion of cor- rectly selected informative features over all selected features. For FedSDG-FS and the original gate method, we train VFLNN-MADELONE until the model converges, and determine the important features. For SFFS and MS-GINI, we calculate the F-statistics and Gini impurity of each individual feature, respectively, and select different numbers of informative fea- tures. The results are shown in Fig 7. It can be observed that FedSDG-FS and the original gate method achieve much higher precision than allFeatures, SFFS, MS-GINI, and FedSDG-FS achieves the highest precision. This illustrates that reducing the sizes of embedding vectors does not degrade the model accuracy. For example, the average precision scores of differ- ent number settings of FedSDG-FS are 13% and 76% higher than the original gate method and SFFS, respectively. As the number of selected features increases, the precision of SFFS and MS-GINI decreases dramatically, while the presicion de- creases slightly for the FedSDG-FS and original gate methods, which demonstrates the effectiveness of FedSDG-FS without knowing the number of features to be selected. After feature importance initialization, FedSDG-FS pro- ceeds to select important features using the stochastic dual- gates. We now evaluate our FedSDG-FS method compared to other baselines, all features participating (allFeatures), SFFS, VFLFS [24], and the original gate based method which has neither gates of the embedding vectors nor importance initialization (original-Gate), using various datasets. For fair comparison, we implement VFLFS [24] without the part that makes use of the non-overlapping samples. Further, we extend a filter feature selection method MS-GINI [14] based on Gini impurity in VFL settings to compare with FedSDG-FS. We perform 5-fold cross validation and report average accuracy. 2) Learning Accuracy. We compare FedSDG-FS with others by training different VFL models and evaluating the test accuracy of the global models, and the ratios of selected features. The results are shown in Table III. It can be observed that FedSDG-FS achieves the highest test accuracy using the fewest features in almost all datasets. Taking MADELON as an example, the average test accuracy of FedSDG-FS is 0.3%, 33.6%, 27.0%, 47.2%, 50.2% higher than the four methods; while the ratio of selected features is 0.02, 0.97, 0.47, 0.47, 0.47 less than them. In some cases where there are small number of noisy features, and having little negative impact on the model, using all features results the higher accuracy. 203050607090110130160# of selected features405060708090testAcc(%)randomallFeaturesSFFSFedSDG-FS-gini10204050100200250400500# of selected features1.51.00.50.00.51.0R2 scorerandomallFeaturesSFFSFedSDG-FS-gini2000300040005000600070008000900010000# of selected features6065707580859095100testAcc(%)original-GateFedSDG-FSSFFS300400500600700# of selected features65707580859095100testAcc(%)original-GateFedSDG-FSSFFS020406080100120140160Training round80859095100testAcc(%)original-GateFedSDG-FSFedSDG-FS020406080100120140160Training round2030405060708090100# of selected features(*100)original-GateFedSDG-FS020406080100120Training round300400500600700800900# of selected featuresoriginal-GateFedSDG-FS 4) Efficiency. Finally, we evaluate the efficiency of FedSDG-FS from two aspects: 1) the speed of the feature importance initialization, and 2) communication saving during model prediction. Firstly, we calculate the number of selected features in different rounds of training VFLNN-ARCENE and VFLNN-GISETTE (Fig. 6(c) and Fig. 6(d)). The results show that with importance initialization, the models can quickly filter out noisy features and select important ones, thus speed- ing up model training. Secondly, we compare the prediction communication overhead of those models of FedSDG-FS, allFeatures and the original gate method. Fig. 8 shows the average communication cost of each method to select features. The communication cost of FedSDG-FS is more than 50% lower than that of the other methods (e.g., 53.2%, 54.7% lower for datasets ARCENE and GISETTE). The efficiency analysis clearly demonstrated the advantages of the feature importance initialization module of FedSDG-FS. VI. CONCLUSIONS In this work, we proposed an efficient and secure ver- tical federated learning feature selection framework to se- lect important features in VFL settings. We first designed a Gaussian stochastic dual-gates for clients' inputs to efficiently approximate the probability of a feature being selected. Then, we incorporated PHE and randomized noise mechanism into stochastic dual-gates to achieve secure feature selection. To reduce overhead, we proposed a feature importance initial- ization method based on Gini impurity and PHE, which can be accomplished through only two parameter transmissions, and two encryption/decryption operation on the server. Exper- iment results show that FedSDG-FS significantly outperforms existing approaches in terms of achieving more accurate selection of high-quality features and building global models with better performance. FedSDG-FS achieves the privacy protection goal, e.g., during the entire feature selection and model training process, neither data nor labels will be acquired or inferred by any party other than their original owners. ACKNOWLEDGMENTS Han Yu is the corresponding author. This research is sup- ported by Nanyang Technological University (NTU), under SUG Grant (020724-00001); the National Research Founda- tion, Prime Ministers Office, National Cybersecurity R&D Program (No. NRF2018NCR-NCR005-0001), NRF Investi- gatorship NRF-NRFI06-2020-0001; the National Research Foundation, Singapore and DSO National Laboratories under the AI Singapore Programme (AISG Award No: AISG2- RP-2020-019); Alibaba Group through Alibaba Innovative Research (AIR) Program and Alibaba-NTU Singapore Joint Research Institute (JRI) (Alibaba-NTU-AIR2019B1), NTU, Singapore; the RIE 2020 Advanced Manufacturing and En- gineering Programmatic Fund (No. A20G8b0102), Singapore; NTU Nanyang Assistant Professorship, Future Communi- cations Research & Development Programme (FCP-NTU- the National Key R&D Program of China RG-2021-014), Fig. 7. Precision of different meth- ods on MADELON. Fig. 8. Communication cost for 100 samples. Nevertheless, FedSDG-FS can still achieve comparable test accuracy with fewer features. To further validate the proposed methods, we conducted experiments with five clients and ten clients. Two example results are presented in Table IV, which show that FedSDG-FS achieves the highest test accuracy using the fewest features in most cases. For the only case where FedSDG-FS performs second best in terms of accuracy, our accuracy 99.5% is very close to the best accuracy 99.8%, while FedSDG-FS use about 20% fewer features. TABLE III TEST ACCURACY OF MODELS TRAINED WITH FEATURES SELECTED. Datasets MADELON ARCENE BASEHOCK RELATHE PCMAC GISETTE COIL20 ISOLET allFeatures 52.0/ 1.0 80.1/ 1.0 99.7/ 1.0 95.5/ 1.0 97.6/ 1.0 99.1/ 1.0 96.4/ 1.0 98.0/ 1.0 Test Accuracy (%) / Ratio of Selected Features MS-GINI 72.2/ 0.5 87.5/ 0.5 98.5/ 0.5 92.1/ 0.5 90.2/ 0.5 98.0/ 0.5 94.8/ 0.5 91.4/ 0.5 SFFS 65.6/ 0.5 95.0/ 0.5 99.1/ 0.5 87.2/ 0.5 79.34/ 0.5 99.0/ 0.5 65.6/ 0.5 92.7/ 0.5 VFLFS 51.0/ 0.5 70.1/ 0.5 94.4/ 0.5 86.5/ 0.5 86.11/ 0.5 50.2/ 0.5 72.2/ 0.5 71.4/ 0.5 original-Gate 98.9/ 0.05 97.4/ 1.0 99.5/ 0.48 99.7/ 0.71 99.1/ 0.66 99.3/ 0.81 91.2/ 1.0 93.2/ 1.0 FedSDG-FS 99.2/ 0.03 99.8/ 0.58 99.9/ 0.3 99.8/ 0.41 98.7/ 0.45 99.5/ 0.53 97.5/ 0.71 96.7/ 0.75 TABLE IV TEST ACCURACY OF MODELS TRAINED WITH FEATURES SELECTED. Datasets Test Accuracy (%) / Ratio of Selected Features ARCENE RELATHE allFeatures 85.8/ 1.0 97.6/ 1.0 SFFS 92.2/ 0.5 84.8/ 0.5 5 Clients MS-GINI 92.0/ 0.5 92.7/ 0.5 10 Clients VFLFS 71.0/ 0.5 86.1/ 0.5 original-Gate 98.2/ 1.0 99.8/ 0.69 FedSDG-FS 99.7/ 0.59 99.5/ 0.45 ARCENE RELATHE allFeatures 91.0/ 1.0 97.5/ 1.0 SFFS 94.0/ 0.5 85.6/ 0.5 MS-GINI 92.7/ 0.5 93.6/ 0.5 VFLFS 82.0/ 0.5 85.7/ 0.5 original-Gate 98.6/ 1.0 99.5/ 0.68 FedSDG-FS 99.2/ 0.56 99.8/ 0.44 3) Stability. We evaluate the stability of FedSDG-FS from two aspects, 1) test accuracy of the global model with different numbers of selected features, and 2) test accuracy at different training rounds. We illustrate the test accuracy of models VFLNN-ARCENE and VFLNN-GISETTE by training them for 20 rounds with different numbers of features in Fig. 5. The results show that compared to SFFS, the original based method and FedSDG-FS both achieve much higher test accuracy. The performance of FedSDG-FS has little variation in all cases. Then, we calculate the test accuracy of the two models in different training rounds, and plot them in Fig. 6(a) and Fig. 6(b). The results show that FedSDG-FS and the original gate method achieve comparably high test accuracies at different training rounds, while FedSDG-FS is more stable (i.e., the test accuracy of global model drops 2.8% in the 80-th round for FedSDG-FS and 17.9% for the original gate method). The analysis results of test accuracy on other models with different numbers of selected features and at different training rounds are similar to that of VFLNN-ARCENE, VFLNN-GISETTE. 550100150200250300350400450# of selected features0.00.20.40.60.81.0PrecisionFedSDG-FSoriginal-GateSFFSMS-GINIARCENEGISETTE050100150200250Cost (KB)allFeaturesoriginal-GateFedSDG-FS [24] C. Louizos, M. Welling, and D. P. Kingma, "Learning sparse neural networks through l0 regularization," arXiv preprint arXiv:1712.01312, 2017. [25] Y. Zhang and H. Zhu, "Additively homomorphical encryption based deep neural network for asymmetrically collaborative machine learning," arXiv preprint arXiv:2007.06849, 2020. [26] K. Cheng, T. Fan, Y. Jin, Y. Liu, T. Chen, D. Papadopoulos, and Q. Yang, "Secureboost: A lossless federated learning framework," IEEE Intelligent Systems, vol. 36, no. 6, pp. 87–98, 2021. [27] L. Song, A. Smola, A. Gretton, K. M. Borgwardt, and J. Bedo, "Super- vised feature selection via dependence estimation," in Proceedings of the 24th international conference on Machine learning, 2007, pp. 823–830. [28] G. I. Allen, "Automatic feature selection via weighted kernels and regularization," Journal of Computational and Graphical Statistics, vol. 22, no. 2, pp. 284–299, 2013. [29] S. Feng, "Vertical federated learning-based feature selection with non- overlapping sample utilization," Expert Systems with Applications, p. 118097, 2022. [30] J. Thomas, "Mass spectrometric data." [Online]. Available: https: //www.openml.org/d/41157 [31] I. Guyon, S. Gunn, A. Ben-Hur, and G. Dror, "Result analysis of the nips 2003 feature selection challenge," Advances in neural information processing systems, vol. 17, 2004. [32] A. Miller, N. Foti, A. D'Amour, and R. P. Adams, "Reducing reparame- terization gradient variance," Advances in Neural Information Processing Systems, vol. 30, 2017. [33] Z. Erkin, M. Franz, J. Guajardo, S. Katzenbeisser, I. Lagendijk, and T. Toft, "Privacy-preserving face recognition," in International sympo- sium on privacy enhancing technologies symposium. Springer, 2009, pp. 235–253. [34] J. H. Friedman, "Multivariate adaptive regression splines," The annals of statistics, vol. 19, no. 1, pp. 1–67, 1991. [35] A. state university, "Feature selection datasets," Public online, 2010. [Online]. Available: https://jundongl.github.io/scikit-feature/OLD/ datasets old.html [36] U. machine learning repository, recognition problem." [Online]. Available: https://archive.ics.uci.edu/ml/datasets/ Gisette "Handwritten digit [37] C. University, "Image classification task." [Online]. Available: https: //www.cs.columbia.edu/CAVE/software/softlib/coil-20.php [38] U. machine learning repository, "Letter-name classification task." [Online]. Available: https://archive.ics.uci.edu/ml/datasets/isolet [39] S. Hardy, W. Henecka, H. Ivey-Law, R. Nock, G. Patrini, G. Smith, and B. Thorne, "Private federated learning on vertically partitioned data via entity resolution and additively homomorphic encryption," arXiv preprint arXiv:1711.10677, 2017. [40] Flower, "Flower: A friendly federated learning framework," Public online, 2022. [Online]. Available: https://flower.dev/ [41] Pytorch, "Pytorch," Public online, 2022. [Online]. Available: https: //pytorch.org/ 2021YFB2900103, China National Natural Science Founda- tion with No. 61932016, and "the Fundamental Research Funds for the Central Universities" WK2150110024. REFERENCES [1] B. McMahan, E. Moore, D. Ramage, S. Hampson, and B. A. y Arcas, "Communication-efficient learning of deep networks from decentralized data," in Artificial intelligence and statistics. PMLR, 2017, pp. 1273– 1282. [2] Y. Hu, D. Niu, J. Yang, and S. Zhou, "Fdml: A collaborative machine learning framework for distributed features," in Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, 2019, pp. 2232–2240. [3] Q. Yang, Y. Liu, Y. Cheng, Y. Kang, T. Chen, and H. Yu, "Federated learning," Synthesis Lectures on Artificial Intelligence and Machine Learning, vol. 13, no. 3, pp. 1–207, 2019. [4] J. Wang, L. Zhang, A. Li, X. You, and H. Cheng, "Efficient participant contribution evaluation for horizontal and vertical federated learning," in 2022 IEEE 38th International Conference on Data Engineering (ICDE). IEEE, 2022, pp. 911–923. [5] A. Li, L. Zhang, J. Wang, F. Han, and X.-Y. Li, "Privacy-preserving efficient federated-learning model debugging," IEEE Transactions on Parallel and Distributed Systems, vol. 33, no. 10, pp. 2291–2303, 2021. [6] A. Li, L. Zhang, J. Wang, J. Tan, F. Han, Y. Qin, N. M. Freris, and X.-Y. Li, "Efficient federated-learning model debugging," in 2021 IEEE 37th International Conference on Data Engineering (ICDE). IEEE, 2021, pp. 372–383. [7] W. Zhuang, Y. Wen, and S. Zhang, "Joint optimization in edge- cloud continuum for federated unsupervised person re-identification," in Proceedings of the 29th ACM International Conference on Multimedia, 2021, pp. 433–441. [8] A. Li, L. Zhang, J. Tan, Y. Qin, J. Wang, and X.-Y. Li, "Sample-level data selection for federated learning," in IEEE INFOCOM 2021-IEEE Conference on Computer Communications. IEEE, 2021, pp. 1–10. [9] Y. Liu, Y. Kang, L. Li, X. Zhang, Y. Cheng, T. Chen, M. Hong, and Q. Yang, "A communication efficient vertical federated learning framework," Unknown Journal, 2019. [10] T. Chen, X. Jin, Y. Sun, and W. Yin, "Vafl: a method of vertical asynchronous federated learning," arXiv preprint arXiv:2007.06081, 2020. [11] J. Tan, L. Zhang, Y. Liu, A. Li, and Y. Wu, "Residue-based label protection mechanisms in vertical logistic regression," arXiv preprint arXiv:2205.04166, 2022. [12] PowerFL, "Angel powerfl," https://data.qq.com/powerfl/. [13] FATE, "Fate-federated-ai," https://github.com/FederatedAI/DOC-CHN. [14] X. Li, R. Dowsley, and M. De Cock, "Privacy-preserving feature selection with secure multiparty computation," ICML 2021, 2021. [15] Y. Yamada, O. Lindenbaum, S. Negahban, and Y. Kluger, "Feature se- lection using stochastic gates," in International Conference on Machine Learning. PMLR, 2020, pp. 10 648–10 659. [16] J. Chen, M. Stern, M. J. Wainwright, and M. I. Jordan, "Kernel feature selection via conditional covariance minimization," NeurIPS 2017, 2017. [17] F. Pan, D. Meng, Y. Zhang, H. Li, and X. Li, "Secure federated feature selection for cross-feature federated learning," 2020. [18] L. Song, A. Smola, A. Gretton, J. Bedo, and K. Borgwardt, "Feature selection via dependence maximization." Journal of Machine Learning Research, vol. 13, no. 5, 2012. [19] P. A. Est ́evez, M. Tesmer, C. A. Perez, and J. M. Zurada, "Normalized mutual information feature selection," IEEE Transactions on neural networks, vol. 20, no. 2, pp. 189–201, 2009. [20] D. Roy, K. S. R. Murty, and C. K. Mohan, "Feature selection using deep neural networks," in 2015 International Joint Conference on Neural Networks (IJCNN). IEEE, 2015, pp. 1–6. [21] M. M. Kabir, M. M. Islam, and K. Murase, "A new wrapper feature selection approach using neural network," Neurocomputing, vol. 73, no. 16-18, pp. 3273–3283, 2010. [22] Y. Li, C.-Y. Chen, and W. W. Wasserman, "Deep feature selection: theory and application to identify enhancers and promoters," Journal of Computational Biology, vol. 23, no. 5, pp. 322–336, 2016. [23] C. Hans, "Bayesian lasso regression," Biometrika, vol. 96, no. 4, pp. 835–845, 2009.
http://arxiv.org/abs/2302.10413v3
2023-04-15T04:06:52
2023-02-21T02:53:37
CADIS: Handling Cluster-skewed Non-IID Data in Federated Learning with Clustered Aggregation and Knowledge DIStilled Regularization
Federated learning enables edge devices to train a global model collaboratively without exposing their data. Despite achieving outstanding advantages in computing efficiency and privacy protection, federated learning faces a significant challenge when dealing with non-IID data, i.e., data generated by clients that are typically not independent and identically distributed. In this paper, we tackle a new type of Non-IID data, called cluster-skewed non-IID, discovered in actual data sets. The cluster-skewed non-IID is a phenomenon in which clients can be grouped into clusters with similar data distributions. By performing an in-depth analysis of the behavior of a classification model's penultimate layer, we introduce a metric that quantifies the similarity between two clients' data distributions without violating their privacy. We then propose an aggregation scheme that guarantees equality between clusters. In addition, we offer a novel local training regularization based on the knowledge-distillation technique that reduces the overfitting problem at clients and dramatically boosts the training scheme's performance. We theoretically prove the superiority of the proposed aggregation over the benchmark FedAvg. Extensive experimental results on both standard public datasets and our in-house real-world dataset demonstrate that the proposed approach improves accuracy by up to 16% compared to the FedAvg algorithm.
[ "Nang Hung Nguyen", "Duc Long Nguyen", "Trong Bang Nguyen", "Thanh-Hung Nguyen", "Huy Hieu Pham", "Truong Thao Nguyen", "Phi Le Nguyen" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10413v3", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10413v3", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.CV" ]
3 2 0 2 r p A 5 1 ] G L . s c [ 3 v 3 1 4 0 1 . 2 0 3 2 : v i X r a CADIS: Handling Cluster-skewed Non-IID Data in Federated Learning with Clustered Aggregation and Knowledge DIStilled Regularization Nang Hung Nguyen∗, Duc Long Nguyen∗, Trong Bang Nguyen∗, Thanh-Hung Nguyen∗, Huy Hieu Pham†, Truong Thao Nguyen‡§, Phi Le Nguyen∗§ ∗School of Information and Communication Technology, Hanoi University of Science and Technology, Hanoi, Vietnam hung.nn184118@sis, long.nd183583@sis, bang.nt190038@sis, hungnt@soict, lenp@soict } †College of Engineering & Computer Science and VinUni-Illinois Smart Health Center, VinUniversity; [email protected] †The National Institute of Advanced Industrial Science and Technology (AIST), Japan; [email protected] .hust.edu.vn { Abstract-Federated learning enables edge devices to train a global model collaboratively without exposing their data. Despite achieving outstanding advantages in computing efficiency and privacy protection, federated learning faces a significant challenge when dealing with non-IID data, i.e., data generated by clients that are typically not independent and identically distributed. In this paper, we tackle a new type of Non-IID data, called cluster-skewed non-IID, discovered in actual data sets. The cluster-skewed non-IID is a phenomenon in which clients can be grouped into clusters with similar data distributions. By performing an in-depth analysis of the behavior of a classification model's penultimate layer, we introduce a metric that quantifies the similarity between two clients' data distributions without violating their privacy. We then propose an aggregation scheme that guarantees equality between clusters. In addition, we offer a novel local training regularization based on the knowledge- distillation technique that reduces the overfitting problem at clients and dramatically boosts the training scheme's perfor- mance. We theoretically prove the superiority of the proposed aggregation over the benchmark FedAvg. Extensive experimental results on both standard public datasets and our in-house real- world dataset demonstrate that the proposed approach improves accuracy by up to 16% compared to the FedAvg algorithm. Index Terms-Federated learning, non-IID data, clustering, knowledge distillation, regularization, aggregation. I. INTRODUCTION With the rise in popularity of mobile phones, wearable devices, and autonomous vehicles, the amount of data gen- erated by edge devices is exploding [1]. With the emergence of Deep Learning (DL), edge devices bring endless possi- bilities for various tasks in modern society, such as traffic congestion prediction and environmental monitoring [2], [3]. In the conventional cloud-centric approach, the data from edge devices is gathered and processed at a centralized server [4]. This strategy, however, encounters several computational, communication, and storage-related constraints. Critically, the centralization strategy reveals unprecedented challenges in guaranteeing privacy, security, and regulatory compliance [5]– [7]. In such a context, Federated Learning (FL), a novel distributed learning paradigm, emerged as a viable solution, §Corresponding authors Fig. 1. Distribution of pill images collected from 100 real patients. Patients with the same disease usually take similar pills. Data can be classified into three groups: Diabetes (red), Disorder (blue), and others (green). enabling distributed devices (clients) to train DL models co- operatively without disclosing their raw data [8]. FL prevents user data leakage and decreases server-side computation load. Each communication round in a standard FL starts with the server transmitting a global model to the clients. Each client then utilizes its own data to train the model locally and uploads the model parameters (or changes), rather than the raw data, to the FL server for aggregation. The server then combines local models to generate an updated version, which is subsequently transmitted to all clients for the next round. This training process terminates once the server receives a desirable model. Despite having notable benefits in terms of computing performance and privacy conservation, FL suffers from a significant challenge in dealing with heterogeneous data. In FL, data is generated independently at every device, resulting in highly skewed, non-independent-and-identically- distributed (non-IID) data across clients [11], [12]. Addition- ally, the data distribution of each client might not represent the global data distribution. In 2017, McMahan proposed a pioneer FL model named FedAvg [8], which employs SGD for training local models and averaging aggregation at the server-side. In this work, the authors also mentioned the non-IID issue and (a) Data Distribution (b) FedAvg (c) FedProx (d) FedFA (e) CADIS Fig. 2. A case-study on the effect of cluster-skew non-IID. (a): illustration of cluster-skew non-IID on MNIST dataset where client 0 − 5th has the same local data distribution that can be grouped into a cluster. (b)-(e) confusion matrix when testing the global model obtained after 100 training rounds, of FedAvg [8], FedProx [9], FedFA [10], and CADIS. The value of row ith, column jth shows the rate where a samples of class j are predicted as class i. Previous works introduce worse performance on the rare classes which belongs to small number of clients, e.g., class 6 − 9th. By considering the cardinality of the cluster containing a given client when assign the weight in aggregation at server, CADIS improves the prediction performance in rare classes. (4) Clustering-based Aggregation (3) Clustering using Q-matrix r e v r e S t n e i l C i g n n a r T i (2) Penultimate Gradient-based Similarity Estimation and Q-matrix Update Local data + i g n n a r T i i g n n a r T i i g n n a r T i (1) Local Training with KD-based Regularization Fig. 3. Overview of the proposed CADIS architecture. argued that FedAvg is compatible with non-IID data. However, later on, other studies [13], [14]showed that non-IID data substantially impact the performance of FL models (including FedAvg). In particular, non-IID data may slow down the model convergence, destabilize local training at clients, and degrade model accuracy in consequence [15]–[19]. Numerous efforts have been devoted to overcoming the non-IID issue, which may be classified into two primary categories: (i) reduce the impact of non-IID data by optimizing the aggregation [10], [20], [21] or by optimizing the method to select the client each round [22]–[24] on the server-side, and (ii) enhancing training on the client side [9], [25]–[29]. However, current research on non-IID faces the two critical issues as follows. First, most previous studies have focused only on the non- ignoring the non-independent identical distribution aspect, the data collected feature of the clients' data. In reality, from clients exhibit a substantial degree of clustering, with many clients having similar labels. For example, consider a pill-recognition FL system in which clients use their taken pill images to train the model (as illustrated in Figure 1). Users with the same disease usually have data belonging to identical classes. In other words, clients will be separated into disease-specific categories. In addition, common disease clusters will be considerably larger than other clusters. For example, the users are classified into three groups in Figure 1: diabetic patients, disorder, and others, with the cardinality of the diabetic group being much greater than the disorder group. To fill in this gap, in this work, besides considering common types of non-IID data as existing studies, we focus on a new non-IID data that exhibits non-independent property of data across clients in this work. Specifically, we tackle non- IID data having inter-client correlation, i.e., clients sharing a common feature can have correlated data. We consider that the global distribution of data labels is not uniform, and data labels frequently are partitioned into clusters. The number of clients per group is varied (identified as cluster- skewed non-IID [30], [31]). For cluster-skewed data, utilizing the conventional aggregation strategies, which consider the roles of clients by assigning each client i's local model a weight pi depend on the intra-client properties 1, will lead to clusters with large numbers of clients dominating the others. To confirm this hypothesis, we have performed a case-study experiment using cluster-skewed data and discovered that in the aggregation process, if we weight clients inversely with the cardinality of the cluster containing them, we can dramatically increase performance compared to vanilla FedAvg (as shown in Figure 2). However, it is crucial to determine how to cluster clients whose dataset is not publicly available. In light of this, we have an important observation that the penultimate layer might provide considerable insights into the training data distribution. Motivated by this fact, we design a novel mechanism to cluster clients based on the data extracted from the penultimate layer of their local models. Second, the majority of existing approaches either optimize 1 FedAvg [8] and its variance methods assign the weighted based on the number of samples in each clients ni, i.e., pi = ni P(ni) . Methods that enhances training on client side such as FedProx [9] give all the clients a same role with pi = P(ni) . The approaches optimizing the aggregation adaptively assigned the weights, e.g., based on the client training accuracy and training frequency as in FedFA [10]. 1 server-side aggregation [10], [20], [21] or enhance client-side training efficiency [9], [25], which results in sub-optimal per- formance. Therefore, it is crucial to investigate a total solution that simultaneously solves the problem at both the client and server sides. We observe that, in reality, the quantity of data possessed by each client is rather small. In addition, due to the non-IID nature, the data distribution of each client does not correspond to the overall data distribution. Therefore, one of the critical dilemmas is that local model trained on the client side quickly over-fits after several epochs [32], [33]. To tackle this issue, we leverage the Knowledge Distillation paradigm and design a regularization term that aims to narrow the gap between the local and global models, thereby preventing the local model from falling into the local minimum. Figure 3 depicts the overview of our proposed approach named CADIS (Clustered Aggregation and Knowledge DIS- tilled Regularization), which consists of four steps: (1) Local training with the aid of KD-based regularization term; (2) Cal- culating the similarity of clients by utilizing the penultimate layer; (3) Clustering clients into groups; and (4) Aggregating local models using weighted averaging, with the weights determined based on clients' data size and clusters' cardinality. Our main contributions are as follows. 1) We perform a theoretical analysis of the penultimate layer to identify its relationship with the training data. Based on the insights retrieved from the penultimate layer, we offer an approach to quantify the similarity between clients, thereby grouping them into clusters. 2) We propose a server-side aggregation approach that adequately handles the cluster-skewed non-IID data. The proposed method is applicable to a wide range of non- IID data problems. 3) We provide a knowledge distillation-based regularization term that overcomes the overfitting in the local training process on the client-side. 4) To demonstrate the superiority of the proposed approach over the state-of-the-art, we conduct comprehensive ex- periments on the common datasets and our collected real dataset. The results show that our proposal improves the accuracy by up to 16% compared to the FedAvg. II. CADIS - FEDERATED LEARNING WITH CLUSTERED AGGREGATION AND KNOWLEDGE DISTILLED REGULARIZATION The proposed CADIS framework consists of two main components: Cluster-based aggregation on the server and knowledge distillation-based regularization on the client side. Figure 3 shows the overview of our proposed approach named CADIS. In CADIS, the clients utilize SGD to train the model locally using a loss function composed of the cross-entropy loss and a knowledge distillation-based regularization term. Upon receiving the trained models from the clients, the server leverages information collected from the penultimate layer to assess the similarity between the clients. Specifically, the server maintains a so-called Q-matrix that records the clients' Fig. 4. An illustration of our proposed clustering algorithm. In each communication round, the server calculates every client pair's similarity and updates the Q-matrix. After that, it partitions the clients into clusters based on their similarities. similarities, which are cumulatively updated over communi- cation rounds. Given the similarity of the clients, the server groups them into clusters. Finally, it combines clients' local models using weighted averaging, where each client's weight is determined depending on the quantity of its data and the cardinality of its cluster. In the following, we first give the details of the aggregation process in Section III. We then present the regularization term in Section IV. Section V evaluates the performance of CADIS and compares it to the-state-of-the-art, while the Section VI presents the related works for dealing with different type of non-IID distributions and different approach of cluster-based federated learning. Finally, Section VII concludes the paper. III. CLUSTERED AGGREGATION In the following, we first present our proposed cluster-based aggregation formula in Section III-A and then go into the de- tails of our clustering algorithm in Section III-B. Specifically, we introduce an analysis of what the penultimate layer may tell us about the training data distribution in III-B1. Motivated by this finding, we then propose a clustering algorithm based on the improvement of the penultimate layer as shown in Fig. 4. The main idea is to estimate the clients' data distribution simi- larity using the improvement of the penultimate layer ( III-B2) and then partition them according to their similarities (III-B3). Moreover, to speed up the convergence of the similarity matrix, we propose a transitive learning mechanism in Section III-C. Finally, we provide an analysis on the rate of our clustered aggregation compared to those of the FedAvg in Section III-D. A. Aggregation Formula } ∈ { 1, ..., n Let C1, ..., Cn be the n clients. Suppose that Cτ1 , ..., Cτk (τ1, ..., τk ) are the clients participating in the train- ing process at the communication round t. Upon completion of the local training process, these k clients transmit to the server the information of k trained local models, denoted by τ1, ..., ωt ωt τk. The server will partition k clients into mτ clusters using the algorithm provided in Section III-B. For each client τi, let M t τi be the number of elements of the cluster containing τi at round t. The server then performs weighted aggregation, where client τi's weight, denoted by αt nτi N τi , is defined as τi = αt (1) × , 1 M t τi where nτi is the number of samples owned by client τi, and N is the total samples of all clients. The intuition of this aggregation weight is as follows. Clients in the same cluster are supposed to have similar training datasets, resulting in similar locally trained models. Let's consider the following scenario. Suppose cluster A has a large number of clients, say fifty, whereas cluster B has a small number of clients, say five. Due to the data similarity, the local training at clients in cluster A produces fifty similar models, and so do the clients in cluster B. To facilitate the understanding, we refer to WA and WB as the ones representing the models of clients in cluster A and cluster B, respectively. If we simply treat all clients equally and aggregate them, then model WA will have a tenfold greater impact on the global model than model WB. To equalize the contribution across the clusters, we employ the first term in (1), which is inversely proportional to cluster cardinality. The second term in (1), inherited from FedAvg, is proportional to the number of samples of each client. This term enables clients with more data to contribute more to the global model since clients with more data will, in general, possess more knowledge. Finally, αt τi is normalized and applied to the client models' weights as follows ) 3 0- 1 x ( t n e m e v o r p m i s ' r e y a l . n e P 100 50 0 −50 100 50 0 −50 Trained on class 8 Trained on class 5, 7 0 1 2 4 3 6 Pen. layer's rows 5 7 8 9 20 10 0 −10 −20 20 10 0 −10 −20 20 10 0 −10 −20 ) 3 0 1 x ( t n e m e v o r p m i s ' r e y a l . n e P Diabetes Diabetes Other 1 2 3 0 6 5 4 7 Pen. layer's rows 8 9 10 12 14 (a) Training with MNIST (b) Training with Pill dataset Fig. 5. The behavior of the penultimate layer. The rows corresponding to the untrained classes decrease. L(x) ∈ Rv the logits of x, then L(x) is defined as follows L(x) = W * R =       R1w11 + R2w12 + . . . + Ruw1u R1w21 + R2w22 + . . . + Ruw2u ... R1wv1 + R2wv2 + . . . + Ruwvu  . (3)      Let p(x) be the prediction result which is the output of the softmax layer, then the probability of sample x being classified into class j, i.e., pj(x), is determined by the following formula ωt+1 g = αt τi τk i=1 αt τi × ωt i . τk i=1 X P B. Penultimate Layer-assisted Clustering Algorithm M 1) Insights of the Penultimate Layer: Let us consider a typical deep neural network for a classification task, consisting of a feature extractor and a classifier that is trained using the cross entropy loss by SGD method. We assume that the classifier comprises of a dense layer, represented by W , followed by a softmax layer. Here, we give the mathematical supports for the non-bias case because the maths can be easily extended by append a constant 1 to the sample vector x. Suppose there are v classes, denoted by 1, ..., v. We have the following observations. Proposition III.1. Suppose W = [w1, ..., wv], where wi is the i-th row of W . Let x be a sample with the groundtruth Rv be the one-hot vector label of j, j 1, ..., v representing j. After training the model with sample (x, y), the values of all items in wj increase while that of the other rows decrease. , and y ∈ { M ∈ } (2) pj(x) = eLj v i=1 eLi . (4) The cross entropy loss concerning sample (x, y) is given by P v L(p(x), y) = yi log i=0 X 1 pi(x) . (cid:19) (cid:18) (5) Let wrc be the item at row r and column c of W , then the gradient of the loss (p(x), y) with respect to wrc W is ∂L ∂wrc = We have L v i=1 (cid:18) X ∂L ∂pi(x) * v (cid:18) Xk=1 ∈ ∂pi(x) ∂Lk * ∂Lk . ∂wrc (cid:19)(cid:19) ∂L ∂pi(x) = − 1 ln 10 yi pi(x) = yj pj (x) ln 10 − 1 0 ( if i = j if i 6= j , pj(x)(1 pk(x)) − pj(x)pk(x) if k = j otherwise ; ∂pj(x) ∂Lk ∂Lk ∂wrc = = ( ( − Rc 0 if k = r otherwise . (6) (7) (8) (9) Figure 5(a) illustrates an intuition for Proposition III.1. In the upper sub-figure, we trained the model with a sample be- longing to class 8 and measured the change of the penultimate layer. It can be observed that the 8-th exhibits positive growth, whereas the remaining rows have negative values. Ru denote the representation Sketch Proof. Let R = R(x) ∈ of x. For the sake of the arguments, we assume that all items Ri of R are non-negative (attainable with the most popular Sigmoid or ReLU activation functions). Let us denote by From (7, 8) and (9), we deduce that ∂L ∂wrc −1 ln 10 yj (1 − pj(x))Rc 1 ln 10 yj pr(x)Rc = ( if r = j, otherwise. (10) As yj = 1, pi(x) > 0 and Rc > 0 ( i, c), when applying the gradient descent, the values of the j-th row of W increase while those on all other rows decrease. ∀ Proposition III.1 can be generalized (with slightly more work) to the case where multiple labels being trained during - the training process. Figure 5(a) depicts an illustration for the general case. In the lower sub-figure, we trained the model with samples belonging to classes 5 and 7. As seen, only the rows 5, 7 may contain positive values, while values of the remaining rows are strictly negative. From this proposition we come up to the following observation. Observation III.2. By analyzing the improvement of the penultimate layer, we may identify whether the training data comprises samples from a particular class. Specifically, the training data consists of class j's samples if and only if the improvement of the j-th row of the penultimate layer's matrix is not negative (i.e., at least one item in the j-th row gets higher after training). Figure 5(b) depicts our observation III.2 in the context of the real-world scenario. Specifically, we train three local models using three pill datasets, two of which contain images of pills taken by diabetic patients and the other by a normal user. The figure demonstrates that the improvement of the penultimate layers of the two diabetic patients is comparable, whereas that of the normal user is clearly different. M M M M i and i, and 2) Similarity Estimation: Let j be two models locally trained by client Ci and Cj using their respective datasets Di and Dj. We seek to estimate the similarities of the distributions of Di and Dj by using the information obtained from the penultimate layers of j. To ease the presentation, in the following, we use the term similarity of client Ci and Cj to indicate the similarity between Ci and Cj 's data distributions. We encounter the following two significant challenges. First, in the FL training methodology, only a portion of clients engage in the training process during each communication round. Consequently, it is impossible to gather information on the penultimate layers of all clients concurrently. Second, we observe that the change in the penultimate layer throughout each communication round is negligible. It is thus impossible to determine similarity using the raw improvement of the penultimate layer. To address the first issue, the server will maintain a so-called similarity matrix whose each item sij depicts the estimated similarity between client Ci and Cj . In each communication round t, for each pair of clients (Ci, Cj) participating in that round, the server estimates the instance similarity st ij of Ci and Cj, which depicts the similarity of the training data of Ci and Cj at round t. st ij is defined by the following formula st ij = (W t kW t i − W t i − W t g )T * (W t g kkW t j − W t g ) j − W t g k , (11) where W t j are the penultimate layers of i and W t j at round t, while W t i and g is the penultimate layer of the M global model that the server delivered to the clients at the beginning of round t. Note that, W t g are the improvements of Ci and Cj's local models' penultimate layers after training at round t, respectively. Therefore, st ij indicates the cosine similarity between the penultimate layers' improvements. g and W t i − j − W t W t M As the instance similarity st ij may not accurately reflect the actual similarity between clients, we utilize st ij to update the cumulative similarity sij in the similarity matrix to achieve accurate estimates. Specifically, sij is updated as sij ← f t ij f t ij + 1 sij + 1 f t ij + 1 st ij , (12) where f t pated in the same communication round up to round t. ij represents the total times Ci and Cj have partici- The second issue, namely the incremental improvement of the penultimate layer, results in the similarity value of all client pairs rapidly converging to 1. To this end, our solution is to use the min-max rescaling on the similarity matrix to obtain a so-called Q-matrix. 3) Client Clustering: Given the Q-matrix at a commu- nication round t, the server uses a binary indicator uij to determine whether clients Ci and Cj belong to the same cluster as in Equation 13, where ε is updated upward after every communication round. Note that as qij is adjusted every round, uij is also updated over communication rounds, but it will converge after some rounds uij = 1, 0, ( if qij ≥ ε; otherwise. (13) C. Enhancing the Similarity Matrix with Transitive Learning it requires in each round, In the FL training methodology, there is only a portion of clients participating in the training process. Therefore, the similarity matrix to converge. To speedup the convergence, we propose an algorithm to estimate the similarity of two arbitrary clients Ci and Cj via their similarities with other clients. We notice that cosine similarity possess a transitive characteristic which is reflected by the following theorem [34]. significant time for Theorem III.3. Let sx,y denote the cosine similarity of two vectors x and y. Given three arbitrary vectors x, y and z, then their cosine similarities satisfy the following inequality sa,bsb,c − r(cid:16) sa,bsb,c + 1 − s2 a,b s2 b,c 1 − ≤ (cid:17) (cid:17) (cid:16) sa,c 1 r(cid:16) s2 a,b − s2 b,c . 1 − (cid:17) (cid:16) (cid:17) ≤ √(1−s2 ip)(1−s2 3 Motivated by this theorem, we utilize the Gaussian distribu- jp) tion with the mean of sipsjp and deviation of , N(sip,sjp), to estimate the value of sij. Accordingly, denoted as for every client pair (Ci, Cj ) which does not co-occurence in a communication round t, the server will find all clients Cp N(sip,sjp) is less than a threshold γ, such that the deviation of < γ (∗). For each such a client Cp, we i.e., denote by sij,p a random number following the distribution N(sip,sjp). The final estimated value for st ij is the average of sij,p for all p satisfying condition (∗). ip)(1−s2 3 √(1−s2 jp) Theorem III.4. Let n be the total number of clients and k be the number of clients participating in a communication . P 1 + round. Let δ be the expected number of communication rounds needed to estimate the similarity of all client pairs. Then, δ n−1 i=k (n k) k)−( i (n k) Sketch Proof. We denote Si ( [0, n]) as a random variable i ∀ representing the number of communication rounds needed for all clients participate in the training at least one time, given i clients have already participated in training so far. Then, δ equals the expected value of S0, i.e., E(S0). E(S0) can be determined recursively as follows ≤ ∈ E(S0) = 1 + E(Sk), E(Si) = E(Sn) = 0, P i j=0 aij(1 + E(Sk+j)), ∀i   (14)  where aij is the transitioning probability from state Si to Sk+j i defined by aij = j=0 aij = 1, and k, we have aij = E(Si) i j=i−k aij = 1. 0 ( − Accordingly, i). Moreover, when i i j=0 aij = ( n−i k+j−i)×( i (n k) k). Therefore, E(Si+1) ( . We have ≥ j < i P ≥ i−j) ∀ ∀ i P P E(Si) = 1 + aij × E(Sk+j) + ai(i−k) × E(Si) Xj=i−k+1 i ≤ 1 + aij × E(Si+1) + ai(i−k) × E(Si) Xj=i−k+1 = 1 + (1 − ai(i−k)) × E(Si+1) + ai(i−k) × E(Si). It can be deduced that E(Si) ≤ E(Si+1) + 1 1 − ai(i−k) = E(Si+1) + ⇒ E(Sk) ≤ E(Sn) + n−1 (cid:1) ⇒ E(S0) = 1 + E(Sk) ≤ 1 + (cid:0) Xi=k n k n k − (cid:0) (cid:1) n−1 (cid:0) i k Xi=k n−1 Xi=k . = 0 + (cid:1) n k n k − (cid:0) (cid:1) i k (cid:0) (cid:1) (cid:0) (cid:1) i k 1 − (cid:0) (cid:1) i k where φi = (1 have − n k − (cid:0) (cid:1) n k n (cid:1) k − (cid:1) (cid:0) (cid:0) n k (cid:0) (cid:1) (cid:0) (cid:1) D. Convergence Analysis Finally, we have the following finding on the convergence rate of proposed clustered aggregation compared to FedAvg. Proposition III.5. Once converged, the inference loss of the global model achieved by CADIS's aggregation process is smaller than those generated by FedAvg LF edAvg − LCADIS ≥ 0, (15) L L F edAvg and where CADIS indicate, respectively, the losses of the converged global models derived by FedAvg and CADIS. Due to space constraints, in the following, we provide a sketch proof when there are clusters among the clients. Sketch Proof. To simplify, we consider a FL with three clients C1, C2, C3, in which C1 and C2 belong to a cluster and C3 does not. As loss functions are usually convex ones and have at least one minimum, we consider the simple loss functions for C1, C2, C3 as fi = aiz2 + biz, (ai > 0, i = 1, 2, 3). Let Di be the dataset owned by Ci. As C1 and C2 belong to the same cluster, we assume that C1 and C2 are similar. Let D be the dataset whose distribution is identical with our targeted can be form by taking a half of D1, D2 and data, then all of D3. Accordingly, we can prove that, the optimal loss function when we train a global model with the single set of D is given by D f ∗ = 1 4 (f1 + f2) + 1 2 f3. (16) i Let zt,E (E is the number of training epochs) be the trained model that Ci sends to the server at the end of communication round t, given the initial model zt,0 g. Then we have i = zt i = zt,E−m zt,E i (1 − 2aiηt)m − ηtbi (1 − 2aiηt)j, (17) m−1 j=0 X where ηt is the learning rate at the client-side in round t. Aggregation by FegAvg. By aggregaring local models using FegAvg, we obtain the global model as Z t F edAvg = 2φ1 + φ3 3 t ! Z 0 F edAvg 1 − − (cid:18) 2φ1 + φ3 3 t b1 a1 (1 ! (cid:19) 3 − − 1−φ3 2 φ1) + b3 a3 (2φ1 + φ3) . Aggregation by CADIS. When using CADIS to aggregate the local models, we obtain the following global model Z t CADIS = φ1 + φ3 2 t ! Z 0 CADIS t φ1 + φ3 2 b1(1−φ1) 2a1 2 + b3(1−φ3) 2a3 (φ1 + φ3) . − (cid:18) − 2aiηt)K . When the models converge, we ! (cid:19) ZF edAvg = lim t→∞ Z t F edAvg = ZCADIS = lim t→∞ Z t CADIS = 1−φ3 2 , b1 a1 b1 a1 (1 − φ1) + b3 a3 (2φ1 + φ3) 3 − 2 + b3(1−φ3) 1−φ1 2a3 (φ1 + φ3) 2 . − By substituting the results above into (16) we obtain F edAvg L − L CADIS = f ∗(ZF edAvg) 1 8 b2 1 a1a3 = − (a1 + a3)2v1v2, f ∗(ZCADIS) φ1−1 P and v2 = + 1 where v1 = Q a3 − φ1+φ3−2 , Q = 2φ1−2 2φ1+φ3−3 . By proving v1 > 0 and v2 > 0, we F edAvg > deduce that L (Q + P ) CADIS. ; P = 1 a1 2 a3 − (cid:18) (cid:19) L IV. KNOWLEDGE DISTILLATION-BASED REGULARIZATION We have proposed a clustering strategy to balance the bias on the inter-client level. However, when there are no clusters amongst the clients, the performance of CADIS returns to that of FedAvg, which is sensitive toward intra-client heterogeneity. Therefore, as an extension to our proposal, we integrate a subtle regularization into the local training process to diminish the effect of data heterogeneity. To this end, we design a Representations generated by the models Distributions estimated by KDE method Regularization term computed using KL divergence 1 2 3 (cid:1) KDE (cid:3) (cid:5) KDE (cid:6) a t a d g n n a r T i i Fig. 6. Illustration of a local training process at the client-side. At every training epoch e, the client calculates a regularization term which is the KL divergence between the representation generated by locally trained model ωt,e and that obtained from the global model ωt g. i (a) PILL (b) CIFAR-10, MC Fig. 7. Illustration of data distribution of CIFAR-10 dataset, and real-world PILL dataset in the case of 10 clients. regularization term inspired by the feature-based knowledge distillation technique [35]. This regularization term intuitively helps the clients to gain new knowledge from their local data without overwriting the previously learnt knowledge in the global model. As a result, the knowledge of the global model is accumulated throughout the federated training process. We observe that the global model is an aggregation of multiple local models; as a result, it possesses more infor- mation and a higher generalizability. Therefore, we use the global model delivered by the server at the beginning of each round as a teacher, while the clients' local models serve as students. A client's regularization term is then defined by the Kullback-Leibler (KL) divergence between the representations generated by the client's local model and those obtained from the global model. Figure 6 illustrates the flow for a client calculate the regularization term. The details are as follows. Consider a client with the training dataset of X, let RS(X) be the representations generated by the locally trained model, and RT (X) be the representation produced by global model delivered by the server. Instead of model the distribution of RS(X) and RT (X) directly, we try to model the pairwise interactions between their data samples, because as helps to describe the geometry of their respective feature spaces [36]. To accomplish this, we employ the joint probability density, which represents the likelihood that two data points are close together. These joint density probability functions can be easily estimated using Kernel Density Estimation (KDE) [37]. Let be the joint density probability functions corresponding to RS(X) and RT (X). Suppose pij ∈ P denote the joint probability of xi and xj then pij can be h(xi, xj), where estimated using KDE as pij = pi|jpj = G(x, xi, h) is a Gaussian kernel, with h is the K bandwidth of the Gaussian bell. However, as stated in [38], it is often impossible to learn a model that can accurately reproduce the entire geometry of a complex teacher model. Therefore, the conditional probability distribution of the samples can be used instead of the joint probability density function as follows h(x, xi) = and Q K K P Leibler (KL) divergence to calculate the difference between by using the following formula the two distributions and P Q b b LKD = KL(Q k P) ≈ qj|i × log i=1 X Xj=1,j6=i qj|i pj|i ! , (19) where b is the batch size. Consequently, the final loss function for training at client Ci in round t is defined as L = LCC + λLKD = + λKL KDEωt (cid:16) E ni/b 1 ni CE (Xu, Yu) |ωt,e i e=1 X g (Xu) kKDEωt,e u=1 n(cid:16) X i (Xu) . (cid:17) (20) (cid:17)o Here ni is the cardinality of Ci's dataset, E is the number of training epochs; (Xu, Yu) is training dataset of the u-th batch, where Xu depicts the image set, and Yu denotes the corresponding labels; λ 0 is the weighting factor of the regularization term. ≥ V. EXPERIMENTS AND RESULTS This section evaluates the performance of the proposed FL method, i.e., CADIS, against competing approaches for various FL scenarios. We show that CADIS is able to achieve higher performance and more stable convergence compared with state-of-the-art FL methods including FedAvg [8], Fed- Prox [9], FedDyn [25], and FedFA [39], on various datasets and non-IID settings. In the following, we first introduce four image classification datasets used in our experiments including both standard conventional datasets and real-world medical imaging datasets. We also describe the setup for the experiments in Section V-A. We then report and compare the performance of the CADIS with state-of-the-art methods using the top-1 accuracy on the test datasets. (Section V-B). In all experiments, the SingleSet setting (centralized training at the server or training in the system of only one client)2 is used as the reference. Finally, in Section V-C, we conduct ablation studies to highlight some key properties of CADIS. A. Datasets and Experimental Settings pi|j = Kh(xi, xj) k=1,k6=j Kh(xk, xj) ∈ [0, 1]. (18) To evaluate the robustness of the proposed method in a real- world setting, we collect a large-scale real-world pill image The similar process is applied to estimate the probability distribution of the global model. Finally, we use Kullback- P 2Because Singleset trained on a single client (or server), it may be equivalent to training with an IID dataset. classification dataset (due to the double-blind policy, we name our dataset as PILL). The dataset consists in total of 10, 042 images from 96 patients, 276 diagnoses and 94 pills (classes). However, in our experiments, we use a subset of 10 clients constituted 7 clients diagnosed with diabetes and 3 clients from other diseases. We then annotate the data of selected clients to be our evaluated sub-dataset 3. The sub-dataset consists of 15 classes, e.g., the pill name, and 7, 084 images. The dataset is then divided into two disjoint parts, where 90% of images are used for training and the rest 10% are used for testing. To further evaluate the effectiveness of CADIS on bigger datasets, we use three benchmark imaging datasets with the same train/test sets as in previous work [8], [9], [25], [39], which are MNIST [40], CIFAR-10 [41], and CIFAR-100 [41]. We simulate data heterogeneity scenarios, i.e., cluster-skewed non-IID, by partitioning datasets and distributing the training samples among n = 100 clients. In this work, we target the sample-unbalanced multi-cluster (denoted as MC) non-IID, in which clients have the same label distribution belonging to the same cluster. We choose 5 clusters with the ratio of clients in the clusters are 3 : 3 : 2 : 1 : 1. The number of samples per client is unbalanced and each client has approximately 20% of labels (classes), e.g., 2 classes for CIFAR-10. We also further consider different data partition methods in SectionV-C. Fig- ure 7 illustrates the class distribution of the PILL subset and CIFAR-10 dataset across clients with MC partition methods. We train simple convolutional neural networks (CNNs) on MNIST as mentioned in [8]. Specifically, we train ResNet- 9 [42] network on CIFAR-10, and CIFAR-100 dataset, and ResNet-18 [42] on PILL dataset. For all the experiments, we use SGD (stochastic gradient descent) as the local optimizer. We also set the local epochs E = 5, a learning rate of 0.001, and a local batch size b = 8. We evaluate with the system of 100 clients like prior work in FL [8], [9]. The number of participating clients at each communication round is k = 3 for PILL and k = 10 50 for other datasets. We also used the default hyper-parameters suggested by the original paper of each FL benchmark. Specifically, we set the proximal term μ = 0.01 for the FedProx method. For FedFA, we set α = 1.0 and β = 0 as suggested in [39]. For FedDyn, we use α = 0.5 [25]. → B. Experimental Results 1) Top-1 accuracy: Table I presents the results of the classification accuracy when comparing our proposed CADIS to the baseline methods on all the datasets with cluster- skewed non-IID. We report the best accuracy that each FL method reaches within 500 communication rounds. Specifi- cally, CADIS achieves better accuracy than all other FL meth- ods. For example, CADIS achieves an accuracy of 79.71% on the PILL dataset. This result significantly outperforms the best benchmark FL methods, e.g., FedAvg, by 8.7%. Compared to the second-best benchmark (marked in bold- blue text), our CADIS surpasses it by 1.35%, 1.60%, and 3We have to evaluate on sub-dataset because of the lack of manpower to annotate the whole dataset at the time of submission. TABLE I COMPARISON OF TOP-1 TEST ACCURACY TO THE BENCHMARK APPROACHES WITH MULTI-CLUSTER NON-IID. THE VALUES SHOW THE BEST ACCURACY THAT EACH FL METHOD REACHES DURING TRAINING(∗) Dataset #Clients Top-1 Accuracy (%) Impr. (%) SingeSet FedAvg FedProx FedFA FedDyn CADIS (a) (b) PILL 3/10 92.32 73.36 70.04 6.67 22.17 79.71 CIFAR-10 10/100 82.11 48.74 48.43 10.00 19.62 50.09 8.7 2.8 8.7 2.8 CIFAR-100 MNIST 10/100 20/100 30/100 40/100 50/100 10/100 20/100 30/100 40/100 50/100 52.36 52.36 52.36 52.36 52.36 99.15 99.15 99.15 99.13 99.15 33.42 32.70 32.07 31.65 31.11 93.04 95.12 95.06 94.10 94.83 33.21 32.13 32.37 31.48 31.27 92.91 95.12 95.02 94.05 94.86 36.49 35.28 35.42 35.20 35.12 93.33 95.55 95.50 94.50 95.27 5.39 3.68 5.73 6.30 6.59 88.04 93.58 93.92 88.04 93.55 38.09 14.0 4.4 38.16 16.7 8.2 38.55 20.2 8.8 36.35 14.8 3.3 36.23 16.5 3.2 93.45 95.71 96.00 95.60 96.20 0.4 0.6 1.0 1.6 1.4 0.1 0.2 0.5 1.2 1.0 (*) The best and second best results are highlighted in the bold-red and bold-blue. (**) impr.(a) and impr.(b) are the relative accuracy improvement of CADIS compared with FedAvg and the best benchmark FL method (in percentage), respectively. 0.41% top-1 accuracy in CIFAR-10, CIFAR-100, and MNIST datasets, respectively (k = 10 clients participating in each round). It is worth noting that the image classification tasks in MNIST dataset are simple such as the accuracy of all the methods is asymptotic to that of the SingleSet, leading no room for optimizing. As a result, CADIS is only slightly better than the baseline methods. This result emphasizes that our cluster-based weighted aggregation method can engage the clients from the 'smaller' clusters (i.e., groups with a smaller cardinality) more effectively than the sample-quantity- based aggregation of FedAvg and the training-frequency-based aggregation of FedFA. It demonstrates our theoretical finding mentioned in Proposition III.5. We next conduct a sensitivity study to quantify the impact of the number of participating clients k per communication round on accuracy. As shown in Table I, we change k from 10 up to 50 when training on the CIFAR-100 and MNIST datasets. We observe that varying the number of participating clients would slightly affect the top-1 accuracy but would not impact the relative result between CADIS and the baseline methods. As the result, the improvement in accuracy of CADIS over the other two baseline methods is consistently maintained. 2) Convergence analysis: To demonstrate the effectiveness of CADIS in reducing local computation at clients, we provide the number of communication rounds to reach a target top- 1 accuracy and speedup relative to the FedAvg (Table II. Overall, the convergence rate of CADIS is fastest in most of the evaluated cases except for the CIFAR-100 dataset. Specifically, to reach an accuracy of 60% for the PILL dataset, CADIS requires only 45 communication rounds. FedAvg and FedProx spend 1.6 longer than CADIS. In addition, CADIS is equivalent to FedFA in the case of MNIST dataset, while it is slower than FedFA in the case of CIFAR-100. It is because CADIS requires some first communication rounds for the similarity matrix coverage (Theorem III.4), which leads to an incorrect clustering and slow down its coveragence rate. However, it is worth noting that CADIS achieves higher top-1 × (a) Top-1 accuracy (b) Inference accuracy among all clients. Fig. 8. Stability comparison of top-1 test accuracy (%) and inference accuracy among all clients on the PILL, MNIST datasets. We omit the result of CIFAR-10 due to the space limitation. The results are plotted with the average-smoothed of every 10 communication rounds to have a better visualization. TABLE II NUMBER OF COMMUNICATION ROUNDS REQUIRED TO REACH A TARGET TOP-1 ACCURACY AND SPEEDUP RELATIVE TO FEDAVG. TABLE III COMPARISON OF TOP-1 TEST ACCURACY TO THE BENCHMARKS WITH DIFFERENT PARTITIONING METHODS, I.E., PA, BC, UC. Acc. FedAvg FedProx Dataset PILL MNIST 60% 74 70% 159 80% 94 90% 341 CIFAR-10 48% 960 FedFA FedDyn CADIS 45 (1.6×) 74 (1.0×) N/A 338 (0.5×) N/A 136 (1.2×) 94 (1.0×) 94 (1.0×) 279 (0.3×) 94 (1.0×) 281 (1.2×) 341 (1.0×) 281 (1.2×) N/A 537 (1.8×) 960 (1.0×) N/A N/A N/A N/A CIFAR-100 35% N/A N/A 281 N/A 644 (*) The symbol N/A means the method is not able to reach the target test accuracy. accuracy than FedFA when converged. C. Ablation studies 1) Robustness to the client datasets: In the previous sub- section, we focus on the top-1 testing accuracy on an IID test dataset to estimate the goodness of the trained model over the global distribution. Because only a small portion of clients participate in the training process at each communication round, the aggregated global model at the server overly fits the sub-dataset of some clients, e.g., most-recently trained clients, or clients in the same cluster. To estimate the robustness of an FL method against clients, we consider the trend of top- 1 accuracy by estimating the average accuracy obtained in the last 10 communication rounds (named 10-round averaging accuracy for short). As shown in Figure 8(a) (Left), the difference in the top-1 accuracy between two communication rounds of FedAvg and FedProx is non-trivial. The top-1 accuracy of CADIS oscillates with a smaller amplitude than those of FedAvg and FedProx. As the result, there is a clear gap of 10-round averaging accuracy between CADIS and the FedAvg as shown in Figure 8(a) (Middle). Another interesting point is that although CADIS is equivalent to another baseline method for the MNIST dataset in terms of top-1 accuracy, the 10-round averaging accuracy of CADIS outperforms those of the baseline significantly, e.g., 95.3% as in CADIS versus around 94.2% of FedAvg (Figure 8(a) (Right). We also test the global model on the local sub-dataset of all the participating clients at the beginning of each communication round, i.e., do Partitioning method MNIST CIFAR-10 CIFAR-100 PA BC UC PA BC UC PA BC UC SingeSet 99.22 99.24 99.18 81.37 39.20 84.75 80.85 52.66 52.62 FedAvg FedProx FedFA FedDyn CADIS 96.89 96.69 96.02 62.26 20.22 43.45 21.01 34.96 34.16 96.73 96.66 96.01 62.63 20.18 43.86 20.76 34.61 34.06 37.18 37.38 96.50 96.67 96.29 66.41 10.00 10.00 92.79 93.36 91.72 18.79 19.34 19.28 13.75 9.69 96.89 96.74 96.58 62.93 34.83 47.42 21.52 34.96 34.62 1.00 2.14 (*) The best and second best results are highlighted in the red and blue. the inference pass at clients. The result in Figure 8(b) shows that CADIS has consistently higher average inference accuracy across clients with smaller variances than the baselines. The results imply that the aggregated global model obtained by CADIS is more stable than the others and does not overfit clients' sub-datasets. It is expected because CADIS is designed with Knowledge Distillation-based Regularization for clients to avoid the local overfitting issue. Thus, we state that our CADIS could learn a well-balanced model between clients. 2) Impact of the non-IID type: We study the robustness of our method with the different types of non-IID by considering both conventional label distribution skew (Pareto), and other patterns of cluster skew [31] (N = 100 and k = 10). • Pareto (denoted as PA): The number of images of a class among clients following a power law [9], [13]. • Sample-balanced single cluster (denoted as BC): a simple case of cluster skew with only one cluster and the number of samples per client does not change among clients. To measure the bias of the proposed model toward the cluster, we choose the number of clients inside the cluster significantly higher than the others, e.g, 60%. • Sample-unbalanced single cluster (denoted as UC): Sim- ilar to the BC but the number of samples per client is unbalanced. In Section V-B, we showed numerical data regarding the MC distribution, in which CADIS demonstrated an improvement in accuracy compared to other methods. A similar observa- Transitive Standard E S M 0 . 2 5 . 1 0 . 1 5 . 0 0 . 0 0 20 40 60 80 100 Communication round Fig. 9. Similarity matrix conver- gence speed of transitive learning. Fig. 10. Impact of the hyper-parameter. CADIS[factor λ, threshold ǫ] tion was observed in the PA, BC, and UC data distribution (Table III). CADIS achieves the best top-1 accuracy in most of the experiments (the second-best top-1 in the remaining). For example, CADIS improves the top-1 accuracy by 1.7 × and 1.1 in the case of the CIFAR-10 dataset, BC and UC, respectively. The result implies that CADIS has a good performance with different types of cluster-skewed non-IID while achieving acceptable performance with label distribution non-IID (equivalent to FedAvg). × D. Discussion 1) Impact of the transitive learning: We introduced transi- tive learning in Section III-C to speed up the convergence of the similarity matrix. We confirm that CADIS with transitive learning (Transitive) and without transitive learning (Standard) could reach the same accuracy in our experiment. However, transitive learning clusters the clients into groups faster than Standard. Figure 9 shows the MSE distance of the similarity matrix built up by two methods with the correct similarity matrix (ideal one). Transitive could coverage after 40 commu- nication rounds while Standard needs approximate 100 rounds. 2) Impact of hyper-parameters: In the experiments shown in Section V-B, we tune the similarity threshold γ and the factor λ and report the best result obtained. In this section, we discuss how the hyper-parameters impact the top-1 accuracy. Figure 10 show the results when we change both hyper- parameters of CADIS on the CIFAR-100 dataset, MC distri- bution. The result shows that both two hyper-parameter could lead to a change in accuracy. However, CADIS is much more sensitive to the similarity threshold ǫ. For example, CADIS[1, 0.975] achieve 26.6% while CADIS[1, 0.9] reaches 32.1%. In our experiment, the best similarity threshold also changes when we change the dataset, e.g., 0.975 for MNIST and 0.9 for CIFAR-10 and CIFAR-100. 3) The generalization of proposition III.1: It is worth noting that the proof of proposition III.1 can be used regardless of the condition R 0. In the case where the values of R are not confined to the non-negative domain, one may deduce that the updates among rows of the penultimate layer will exhibit an inverse trend, depending on the label being trained. However, since our objective is to discover the labels underlying the ≥ ) s ( e m i t n o i t a g e r g g A 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0.0 e c n a m r o f r e p e v i t a e R l 3.0 2.5 2.0 1.5 1.0 0.5 0.0 FedProx FedFA FedDyn CADIS FedAvg Fig. 11. Average aggregation time at server Left) and relative performance (samples/s) of local training at client normalized to those of FedAvg (Right) over 50 communication rounds. training dataset, we only analyze the scenario in which the representation vector R is monotonically non-negative. 4) Computational Overhead: We now estimate the compu- tational overhead of the aggregation at the server of CADIS in comparison with FedAvg and the other methods. The result in Fig. 11 (Left) shows that the computation overhead at the server of the CADIS's clustering module is trivial, i.e., the time of CADIS is approximate those of FedAvg and FedProx. This is an expected result because CADIS clusters the clients based on the information of the penultimate layer whose size is quite small, e.g., 256 100 in the case of the ResNet-9 model and CIFAR-100 dataset. × For the computation overhead of local training at client, we estimate the relative performance (on average) of CADIS over those one of FedAvg using the same device setting, e.g., the GPU Force-GTX 3090. The result in Fig. 11 (Right) shows CADIS require 1.37 more computation at local than FedAvg (for performing the knowledge distillation regularization). × VI. RELATED WORKS To tackle the statistical heterogeneity, i.e., non-IID, problem, many efforts focused on designing weighting strategies for aggregation at server [10], [20], [21]. The authors in [10] developed a weighed aggregation mechanism, in which the weight of a client's local model is the sum of the information entropy calculated from the accuracy of the local model and the number of the client has participated in the training. In [20], Wang et al., focused on the internal and externa conflict between the clients. The former indicates the unfairness among clients selected in the same round, whereas the latter represents a conflict between the assumed gradient of a client who has not been chosen and the global update. In order to accomplish this, they proposed a mechanism to eliminate conflicts before averaging the gradients. Alternatively, many studies improve the training algorithm at client side [9], [25]–[27]. In [9], the authors addressed data heterogeneity by adding a so- called proximal term to the loss function, which restricts local updates to be closer to the initial (global) model. The authors in [25] used an adaptive regularization term leveraging the cumulative gradients when training the local models. In [26], the authors investigated how to remedy the client drift induced by the heterogeneous data among clients in their local updates. However, previous studies specifically take into account the label skew non-IID when each client has a fixed number of [8], [9], [28], [43]–[45]) or classes (label size imbalance when the number of samples of a certain class is distributed to clients using the power-law or Dirichlet distribution (label distribution imbalance [13], [27], [39], [46]). Recently, some works consider the non-IID scenario which is more close to the real-world data such as the numbers of classes are often highly imbalanced [29], or following the cluster-skew non-IID distribution [30], [31]. Especially, cluster-skew is firstly introduced by [30] where there exists a data correlation between clients. Authors in [31] tackle this data distribution by adaptively assigning the weights for clients at aggregation by using Deep Reinforcement Learning. This work also focuses on cluster-skew. Unlike [31], we combine both the aggre- gation optimization approach (clustered aggregation) at the server side and the training enhancement approach at clients (knowledge distillation-based regularization) in this work. Cluster-based Federated Learning: Recent works cluster the clients into groups where different groups of clients have different learning tasks [47], [48], or different compu- tation/network resource [43], [49]. Other methods have been proposed to identify adversarial clients and remove them from the aggregation [48], [50] based on their cosine similarities. Recently [51], [52] proposed to use clustering to address the non-IID issue. It is worth noting that most of the previous cluster-based Federated Learning methods assume that all clients will participate in the clustering process or use the whole model for clustering which is unpractical in a real Fed- erated Learning system. Our proposed CADIS can effectively cluster clients by using the information of the penultimate layer only. VII. CONCLUSION In this paper, we introduced for the first time a new type of non-IID data called cluster-skewed non-IID, in which clients can be grouped into distinct clusters with similar data distri- butions. We then provided a metric that quantifies the simi- larity between two clients' data distributions without violating their privacy, and then employed a novel aggregation scheme that guarantees equality between clusters. Moreover, we de- signed a local training regularization based on the knowledge- distillation technique that reduces the impact of overfitting on the clients' training process and dramatically boosts the trained model's performance. We performed the theoretical analysis to give the basis of our proposal and proved its superiority against a benchmark. Extensive experimental results on both standard public datasets and our own collected real pill image dataset demonstrated that our proposed method, CADIS, outperforms state-of-the-art. Notably, in the cluster-skewed scenario, our proposed FL framework, CADIS, improved top-1 accuracy by 16% compared to FegAvg and by up to 8.7% concerning other state-of-the-art approaches. VIII. ACKNOWLEDGMENTS This work was funded by Vingroup Joint Stock Company (Vingroup JSC),Vingroup, and supported by Vingroup Innovation Foundation (VINIF) under project code VINIF.2021.DA00128. This work was supported by JSPS KAKENHI under Grant Number JP21K17751 and is based on results obtained from a project, JPNP20006, commissioned by the New Energy and Industrial Technology Development Organization (NEDO). REFERENCES [1] M. Chiang and T. Zhang, "Fog and iot: An overview of research opportunities," IEEE Internet of Things Journal, vol. 3, no. 6, pp. 854– 864, 2016. [2] N. Abbas, Y. Zhang, A. Taherkordi, and T. Skeie, "Mobile edge computing: A survey," IEEE Internet of Things Journal, vol. 5, no. 1, pp. 450–465, 2018. [3] H. Li, K. Ota, and M. Dong, "Learning iot in edge: Deep learning for the internet of things with edge computing," IEEE Network, vol. 32, no. 1, pp. 96–101, 2018. [4] Y. Wei and M. B. Blake, "Service-oriented computing and cloud computing: Challenges and opportunities," IEEE Internet Computing, vol. 14, no. 6, pp. 72–75, 2010. [5] H. Takabi, J. B. Joshi, and G.-J. Ahn, "Security and privacy challenges in cloud computing environments," IEEE Security and Privacy, vol. 8, no. 6, pp. 24–31, 2010. [6] J. Domingo-Ferrer, O. Farr`as, J. Ribes-Gonz ́alez, and D. S ́anchez, "Privacy-preserving cloud computing on sensitive data: A survey of methods, products and challenges," Computer Communications, vol. 140-141, pp. 38–60, 2019. [7] M. B. Mollah, M. A. K. Azad, and A. Vasilakos, "Security and privacy challenges in mobile cloud computing: Survey and way ahead," Journal of Network and Computer Applications, vol. 84, pp. 38–54, 2017. [8] B. McMahan, E. Moore et al., "Communication-efficient learning of deep networks from decentralized data," in Artificial Intelligence and Statistics. PMLR, 2017, pp. 1273–1282. [9] T. Li, A. K. Sahu et al., "Federated optimization in heterogeneous networks," Proceedings of Machine Learning and Systems, vol. 2, pp. 429–450, 2020. [10] W. Huang, T. Li, D. Wang, S. Du, J. Zhang, and T. Huang, "Fairness and accuracy in horizontal federated learning," Information Sciences, vol. 589, pp. 170–185, 2022. [11] X. Ma, J. Zhu, Z. Lin, S. Chen, and Y. Qin, "A state-of-the-art survey on solving non-iid data in federated learning," Future Generation Computer Systems, vol. 135, pp. 244–258, 2022. [12] H. Zhu, J. Xu et al., "Federated learning on Non-IID data: A survey," arXiv preprint arXiv:2106.06843, 2021. [13] X. Li, K. Huang, W. Yang, S. Wang, and Z. Zhang, "On the convergence of FedAvg on Non-IID data," in 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26- 30, 2020, 2020. [14] T. Li, A. K. Sahu, A. Talwalkar, and V. Smith, "Federated learning: Challenges, methods, and future directions," IEEE Signal Processing Magazine, vol. 37, no. 3, pp. 50–60, 2020. [15] H. Wang, Z. Kaplan, D. Niu, and B. Li, "Optimizing federated learning on non-iid data with reinforcement learning," in IEEE INFOCOM 2020 - IEEE Conference on Computer Communications, 2020, pp. 1698–1707. [16] J. Zhang, S. Guo, Z. Qu, D. Zeng, Y. Zhan, Q. Liu, and R. Akerkar, "Adaptive federated learning on non-iid data with resource constraint," IEEE Transactions on Computers, vol. 71, no. 7, pp. 1655–1667, 2022. [17] F. Hu, W. Zhou, K. Liao, and H. Li, "Contribution- and participation- based federated learning on non-iid data," IEEE Intelligent Systems, pp. 1–1, 2022. [18] M. Jiang, Z. Wang, and Q. Dou, "Harmofl: Harmonizing local and global drifts in federated learning on heterogeneous medical images," in Proceedings of the AAAI Conference on Artificial Intelligence, vol. 36, no. 1, 2022, pp. 1087–1095. [19] J. Zhang, S. Guo, Z. Qu, D. Zeng, Y. Zhan, Q. Liu, and R. Akerkar, "Adaptive federated learning on non-iid data with resource constraint," IEEE Transactions on Computers, vol. 71, no. 7, pp. 1655–1667, 2021. [20] Z. Wang, X. Fan, J. Qi, C. Wen, C. Wang, and R. Yu, "Federated learning with fair averaging," 2021 International Joint Conference on Artificial Intelligence (IJCAI), 2021. [21] H. Wu and P. Wang, "Fast-convergent federated learning with adaptive weighting," IEEE Transactions on Cognitive Communications and Net- working, vol. 7, no. 4, pp. 1078–1088, 2021. [22] Y. J. Cho, J. Wang et al., "Client selection in federated learning: Convergence analysis and power-of-choice selection strategies," arXiv preprint arXiv:2010.01243, 2020. [23] H. Wang, Z. Kaplan et al., "Optimizing federated learning on non-IID data with reinforcement learning," in IEEE Conference on Computer Communications (INFOCOM), 2020, pp. 1698–1707. [24] D. Y. Zhang, Z. Kou, and D. Wang, "FedSens: A federated learning approach for smart health sensing with class imbalance in resource constrained edge computing," in IEEE Conference on Computer Com- munications (INFOCOM 2021), 2021, pp. 1–10. [25] D. A. E. Acar, Y. Zhao, R. Matas, M. Mattina, P. Whatmough, and V. Saligrama, "Federated learning based on dynamic regularization," in International Conference on Learning Representations, 2021. [Online]. Available: https://openreview.net/forum?id=B7v4QMR6Z9w [26] S. P. Karimireddy, S. Kale, M. Mohri, S. Reddi, S. Stich, and A. T. Suresh, "Scaffold: Stochastic controlled averaging for federated learn- ing," in International Conference on Machine Learning. PMLR, 2020, pp. 5132–5143. [27] J. Wang, Q. Liu et al., "A novel framework for the analysis and design of heterogeneous federated learning," IEEE Transactions on Signal Processing, vol. 69, pp. 5234–5249, 2021. [28] H. Zeng, T. Zhou, Y. Guo, Z. Cai, and F. Liu, FedCav: Contribution- aware model aggregation on distributed heterogeneous data in federated learning. New York, NY, USA: Association for Computing Machinery, 2021. [29] X. Shuai, Y. Shen, S. Jiang, Z. Zhao, Z. Yan, and G. Xing, "Balancefl: Addressing class imbalance in long-tail federated learning," in 2022 21st ACM/IEEE International Conference on Information Processing in Sensor Networks (IPSN), 2022, pp. 271–284. [30] K. Hsieh, A. Phanishayee et al., "The non-IID data quagmire of de- centralized machine learning," in Proceedings of the 37th International Conference on Machine Learning (ICML), vol. 119. PMLR, 13–18 Jul 2020, pp. 4387–4398. [31] N. H. Nguyen, P. L. Nguyen, D. L. Nguyen, T. T. Nguyen, T. D. Nguyen, H. H. Pham, and T. T. Nguyen, "FedDRL: Deep Reinforcement Learning-based Adaptive Aggregation for Non-IID Data in Federated Learning," 2022. [Online]. Available: https://arxiv.org/abs/2208.02442 [32] S. Ji, T. Saravirta, S. Pan, G. Long, and A. Walid, "Emerging trends in federated learning: From model fusion to federated x learning," 2021. [Online]. Available: https://arxiv.org/abs/2102.12920 [33] M. Mohri, G. Sivek, and A. T. Suresh, "Agnostic federated learning," in Proceedings of the 36th International Conference on Machine Learning, ser. Proceedings of Machine Learning Research, K. Chaudhuri and R. Salakhutdinov, Eds., vol. 97. PMLR, 09–15 Jun 2019, pp. 4615– 4625. [34] E. Schubert, "A triangle inequality for cosine similarity," in International Conference on Similarity Search and Applications. Springer, 2021, pp. 32–44. [35] N. Passalis and A. Tefas, "Learning deep representations with probabilis- tic knowledge transfer," in Proceedings of the European Conference on Computer Vision (ECCV), September 2018. [36] L. Van der Maaten and G. Hinton, "Visualizing data using t-sne." Journal of machine learning research, vol. 9, no. 11, 2008. [37] D. W. Scott, Multivariate density estimation: theory, practice, and visualization. John Wiley & Sons, 2015. [38] N. Passalis and A. Tefas, "Learning deep representations with probabilis- tic knowledge transfer," in Proceedings of the European Conference on Computer Vision (ECCV), 2018, pp. 268–284. [39] W. Huang, T. Li et al., "Fairness and accuracy in federated learning," arXiv preprint arXiv:2012.10069, 2020. [40] Y. Lecun, L. Bottou et al., "Gradient-based learning applied to document recognition," Proceedings of the IEEE, vol. 86, no. 11, pp. 2278–2324, 1998. [41] A. Krizhevsky and G. Hinton, "Learning multiple layers of features from tiny images," Master's thesis, Dep. of Comp. Sci. Univ. of Toronto, 2009. [42] K. He, X. Zhang, S. Ren, and J. Sun, "Deep residual learning for image recognition," in CVPR, 2016, pp. 770–778. "FedAT: A high-performance [43] Z. Chai, Y. Chen et al., and communication-efficient federated learning system with asynchronous tiers," in Proceedings of the International Conference for High Perfor- mance Computing, Networking, Storage and Analysis, ser. SC '21, 2021. [44] Z. Wang, X. Fan et al., "Federated learning with fair averaging," in Proceedings of the Thirtieth International Joint Conference on Artificial Intelligence, IJCAI-21, Z.-H. Zhou, Ed. International Joint Conferences on Artificial Intelligence Organization, 8 2021, pp. 1615–1623. [45] P. Xiao, S. Cheng et al., "Averaging is probably not the optimum way of aggregating parameters in federated learning," Entropy, vol. 22, no. 3, p. 314, 2020. [46] Z. Wang, Y. Zhu et al., "FedACS: Federated skewness analytics in heterogeneous decentralized data environments," in IEEE/ACM 29th International Symposium on Quality of Service (IWQOS), 2021, pp. 1– 10. [47] A. Ghosh, J. Chung, D. Yin, and K. Ramchandran, "An efficient framework for clustered federated learning," in Advances in Neural Information Processing Systems, H. Larochelle, M. Ranzato, R. Hadsell, M. Balcan, and H. Lin, Eds., vol. 33. Curran Associates, Inc., 2020, pp. 19 586–19 597. [48] F. Sattler, K.-R. M ̈uller, and W. Samek, "Clustered federated learning: Model-agnostic distributed multitask optimization under privacy con- straints," IEEE Transactions on Neural Networks and Learning Systems, vol. 32, no. 8, pp. 3710–3722, 2021. [49] K. Muhammad, Q. Wang, D. O'Reilly-Morgan, E. Tragos, B. Smyth, N. Hurley, J. Geraci, and A. Lawlor, "Fedfast: Going beyond average for faster training of federated recommender systems," in Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, ser. KDD '20. New York, NY, USA: Association for Computing Machinery, 2020, p. 1234–1242. [50] F. Sattler, K.-R. M ̈uller, T. Wiegand, and W. Samek, "On the byzantine robustness of clustered federated learning," in ICASSP 2020 - 2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), 2020, pp. 8861–8865. [51] C. Chen, Z. Chen, Y. Zhou, and B. Kailkhura, "Fedcluster: Boosting the convergence of federated learning via cluster-cycling," in 2020 IEEE International Conference on Big Data (Big Data), 2020, pp. 5017–5026. [52] C. Briggs, Z. Fan, and P. Andras, "Federated learning with hierarchical clustering of local updates to improve training on non-iid data," in 2020 International Joint Conference on Neural Networks (IJCNN). IEEE, 2020, pp. 1–9. [53] Z. Wang, X. Fan, J. Qi, C. Wen, C. Wang, and R. Yu, "Federated learning with fair averaging," arXiv preprint arXiv:2104.14937, 2021. APPENDIX A ARTIFACT DESCRIPTION BADGE APPLICATION: Open Research Objects (ORO) A. SUMMARY OF EXPERIMENTAL SETTINGS Our codes has been published at Artifact 1, which is a modified framework for federated learning introduced in [53]. The original framework can be accessed at Artifact 2. To reproduce our experiments, simply follow the instructions shown in the Readme file. Below are detailed experimental and hyperparameter settings. At clients, we apply Stochastic Gradient Descent (SGD) as the optimizer with the learning rate 0.001, batch size 8 and local epochs 5 if not explicitly say otherwise. The knowledge distillation-based loss is scaled with the factor λ, which is set 1 during experiments, if not explicitly say otherwise. The number of total clients varies from 10 to 100 whereas the participation ratio every round increases from 10% to 50%. Regarding the server, the similarity-based clustering threshold ǫ is varied regarding different datasets. In details, we found that ǫ = 0.975 worked best for MNIST, 0.95 for CIFAR10 and 0.9 CIFAR100. B. HARDWARE estimate the relative performance (on average) of CADIS over those one of FedAvg using the same device setting, e.g., the GPU Force-GTX 3090. Note that some of our experiments are intensive. With aforementioned system, an experiment takes up to 36 hours to complete. Therefore, low-resource systems might take few days. We highly recommend a system that is equal to or better than aforementioned settings for experimental reproducibility. C. SOFTWARE We use a pytorch-implemented framework for experimental evaluation. Whilst the full requirement can be viewed in the README.md in Artifact 1, below are some prerequisites: • Compilers: Python 3.8.12 • Frameworks: Pytorch - py3.8 cuda11.3 cudnn8.2.0 0 • Support libraries: wandb 0.13.5 • Core libraries: please check README.md • Datasets: CIAFR-10, MNIST, CIFAR-100. D. ARTIFACTS Artifact 1 Github: ORO-CCGRID2023-CADIS Artifact name: ORO-CCGRID2023-CADIS Most of experiments were conducted on a computer that consists of 2 Intel Xeon Gold CPUs, and 4 NVIDIA V100 GPUs. We deploy only one experiment on an entire GPU. For the computation overhead of local training at client, we Artifact 2 Github: easyFL Artifact name: easyFL Appendix: Artifact Description for paper 9766 CADIS: Handling Cluster-skewed Non-IID Data in Federated Learning with Clustered Aggregation and Knowledge Distilled Regularization • Frameworks: Pytorch - py3.8 cuda11.3 cudnn8.2.0 0 • Support libraries: wandb 0.13.5 • Core libraries: please check README.md • Datasets: CIAFR-10, MNIST, CIFAR-100. D. ARTIFACTS Artifact 1 Github: ORO-CCGRID2023-CADIS Artifact name: ORO-CCGRID2023-CADIS Artifact 2 Github: easyFL Artifact name: easyFL 3 2 0 2 r p A 5 1 ] G L . s c [ 3 v 3 1 4 0 1 . 2 0 3 2 : v i X r a Index Terms-Federated learning, non-IID data, clustering, knowledge distillation, regularization, aggregation. BADGE APPLICATION: Open Research Objects (ORO) A. SUMMARY OF EXPERIMENTAL SETTINGS Our codes has been published at Artifact 1, which is a modified framework for federated learning introduced in [?]. The original framework can be accessed at Artifact 2. To reproduce our experiments, simply follow the instructions shown in the Readme file. Below are detailed experimental and hyperparameter settings. At clients, we apply Stochastic Gradient Descent (SGD) as the optimizer with the learning rate 0.001, batch size 8 and local epochs 5 if not explicitly say otherwise. The knowledge distillation-based loss is scaled with the factor λ, which is set 1 during experiments, if not explicitly say otherwise. The number of total clients varies from 10 to 100 whereas the participation ratio every round increases from 10% to 50%. Regarding the server, the similarity-based clustering threshold ǫ is varied regarding different datasets. In details, we found that ǫ = 0.975 worked best for MNIST, 0.95 for CIFAR10 and 0.9 CIFAR100. B. HARDWARE Most of experiments were conducted on a computer that consists of 2 Intel Xeon Gold CPUs, and 4 NVIDIA V100 GPUs. We deploy only one experiment on an entire GPU. For the computation overhead of local training at client, we estimate the relative performance (on average) of CADIS over those one of FedAvg using the same device setting, e.g., the GPU Force-GTX 3090. Note that some of our experiments are intensive. With aforementioned system, an experiment takes up to 36 hours to complete. Therefore, low-resource systems might take few days. We highly recommend a system that is equal to or better than aforementioned settings for experimental reproducibility. C. SOFTWARE We use a pytorch-implemented framework for experimental evaluation. Whilst the full requirement can be viewed in the README.md in Artifact 1, below are some prerequisites: • Compilers: Python 3.8.12
http://arxiv.org/abs/2302.10411v1
2023-02-21T02:48:57
2023-02-21T02:48:57
Regret Analysis of Online LQR Control via Trajectory Prediction and Tracking: Extended Version
In this paper, we propose and analyze a new method for online linear quadratic regulator (LQR) control with a priori unknown time-varying cost matrices. The cost matrices are revealed sequentially with the potential for future values to be previewed over a short window. Our novel method involves using the available cost matrices to predict the optimal trajectory, and a tracking controller to drive the system towards it. We adopted the notion of dynamic regret to measure the performance of this proposed online LQR control method, with our main result being that the (dynamic) regret of our method is upper bounded by a constant. Moreover, the regret upper bound decays exponentially with the preview window length, and is extendable to systems with disturbances. We show in simulations that our proposed method offers improved performance compared to other previously proposed online LQR methods.
[ "Yitian Chen", "Timothy L. Molloy", "Tyler Summers", "Iman Shames" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10411v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10411v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "math.OC", "@scheme": "http://arxiv.org/schemas/atom" }
[ "math.OC", "cs.LG", "cs.SY", "eess.SY", "49N10, 49M05" ]
Proceedings of Machine Learning Research vol XX:1–22, 2023 Regret Analysis of Online LQR Control via Trajectory Prediction and Tracking: Extended Version Yitian Chen∗ Timothy L. Molloy∗ Tyler Summers† Iman Shames∗ ∗CIICADA Lab, The Australian National University [email protected] [email protected] [email protected] [email protected] †The University of Texas at Dallas Abstract In this paper, we propose and analyze a new method for online linear quadratic regulator (LQR) control with a priori unknown time-varying cost matrices. The cost matrices are revealed sequen- tially with the potential for future values to be previewed over a short window. Our novel method involves using the available cost matrices to predict the optimal trajectory, and a tracking controller to drive the system towards it. We adopted the notion of dynamic regret to measure the performance of this proposed online LQR control method, with our main result being that the (dynamic) regret of our method is upper bounded by a constant. Moreover, the regret upper bound decays exponen- tially with the preview window length, and is extendable to systems with disturbances. We show in simulations that our proposed method offers improved performance compared to other previously proposed online LQR methods. Keywords: Online LQR, Dynamic Regret, Trajectory tracking. 1. Introduction Optimal control problems arise in many fields such as econometrics (Bj ̈ork et al., 2021; Radneantu, 2009), robotics (Hampsey et al., 2022; Renganathan et al., 2020), physics (Liu et al., 2021) and machine learning (Westenbroek et al., 2020). The Linear Quadratic Regulator (LQR) problem is the archetypal optimal control problem with vector-valued states and controls, and is reviewed in the following. Consider a controllable linear time-invariant system xt+1 = Axt + But + wt, (1) where t is a nonegative integer, m and n are positive integers, A ∈ Rn×n, B ∈ Rn×m, xt, wt ∈ Rn, and x0 = ̄x0 for some given ̄x0 ∈ Rn, and ut ∈ Rm. For a given finite time horizon T ≥ 2 and initial condition ̄x0, the control decisions {ut}T −2 t=0 are computed to minimize the quadratic cost function 3 2 0 2 b e F 1 2 ] C O . h t a m [ 1 v 1 1 4 0 1 . 2 0 3 2 : v i X r a JT ({xt}T −1 t=0 , {ut}T −2 t=0 ) := T −2 (cid:88) t=0 t Qtxt + uT xT t Rtut + xT T −1QT −1xT −1, (2) + and Rt ∈ Sm where Qt ∈ Sn ++ are time-varying cost matrices and Sn ++ denote the sets of positive semi-definite symmetric and positive definite symmetric matrices, respectively. The states xt and controls ut minimizing (2) must satisfy (1). When the cost matrices {Qt}T −1 t=0 and {Rt}T −2 t=0 + and Sn © 2023 Y. Chen∗, T. L. Molloy∗, T. Summers† & I. Shames∗. REGRET ANALYSIS OF ONLINE LQR CONTROL are known a priori, the controls minimizing (2) subject to (1) can be found in closed form, cf. (Anderson and Moore, 2007, Chapter 2). However, in many real word applications, such as power systems (Kouro et al., 2009), chemistry (Chen et al., 2012) and mechatronics (Vukov et al., 2015), full information about the cost matrices over the whole time horizon is not available (in advance) to the decision maker. In our work, for a given time horizon T and preview window length 0 ≤ W ≤ T − 2, we suppose that at any time t where 0 ≤ t < T − 2 − W , only the initial condition of the system (1) and the (partial) sequences of cost matrices {Qi}t+W i=0 are known. Let the cost- function information available to the decision maker at time t be i=0 and {Ri}t+W Ht := {{Qi}t+W i=0 , {Ri}t+W i=0 , ̄x0}, (3) where Ht contains the full temporal information about the cost matrices for t ≥ T − 2 − W . The main focus of our work is to propose a novel control policy that generates ut using the information available at time t, and investigate its performance. We specifically consider a feedback control policy π(*, *) of the form ut = π(xt, Ht), (4) and adopt the notion of regret to measure its performance. Several different notions of regret have been well studied and explored in the online optimization problem, including static regret (Zinke- vich, 2003; Shalev-Shwartz, 2012), dynamic regret (Jadbabaie et al., 2015). In our work, perfor- mance is measured by dynamic regret. For any control sequence {ut}T −2 t=0 and associated state sequence {xt}T −1 t=0 , the dynamic regret is defined as RegretT ({ut}T −2 t=0 ) := JT ({xt}T −1 t=0 , {ut}T −2 t=0 ) − JT ({x∗ t }T −1 t=0 , {u∗ t }T −2 t=0 ), where {u∗ t }T −2 t=0 := argmin {υi}T −2 i=0 JT ({ξi}T −2 i=0 , {υi}T −2 i=0 ), (5) (6) and {x∗ t }T −1 t=0 satisfy the system dynamics (1) for input sequence {u∗ t }T −2 t=0 . 1.1. Related Works Similar investigations have recently been conducted in Cohen et al. (2018), Zhang et al. (2021), and Akbari et al. (2022). Cohen et al. (2018) and Akbari et al. (2022) consider a different notion of regret involving comparison with controls ̃ut = −K ̃xt (instead of u∗ t ) generated by a fixed gain K from the set of ( ̄κ, ̄γ) strongly stable gains denoted by K. More precisely, K is the set of all gains where for any K ∈ K, there exists matrices L and H such that A + BK = HLH −1, with (cid:107)L(cid:107) ≤ 1 − ̄γ and (cid:107)H(cid:107) , (cid:13) (cid:13) ≤ ̄κ for prescribed scalars ̄κ and ̄γ1. For a sequence of controls {ut}T −1 t=0 , the notion of regret for time horizon T and controls {ut}T −1 (cid:13)H −1(cid:13) StablizingRegretT ({ut}T −2 t=0 ) := JT ({xt}T −1 t=0 , {ut}T −2 t=0 ) − JT ({ ̃xt}T −1 t=0 from these works is t=0 , { ̃K ̃xt}T −2 t=0 ), (7) where ̃K ∈ argminK∈K JT ({ ̃xt}T −1 t=0 , {K ̃xt}T −2 t=0 ) and { ̃xt}T −1 t=0 satisfies (1). Cohen et al. (2018) propose an online LQR algorithm that yields controls with a theoretical t=0 ) ≤ O( T ). However, the algorithm involves a regret upper bound of StablizingRegretT ({ut}T −1 √ 1. We shall use (cid:107) * (cid:107) to denote either the 2-norm of a vector or the spectral norm of a matrix, depending on its argument. 2 REGRET ANALYSIS OF ONLINE LQR CONTROL computationally expensive projection step at each time t, and the projection set can become empty for some controllable systems when the covariance of the system disturbances wt is positive defi- nite2. Thus, this method is not applicable to all controllable linear time-invariant systems. More- over, the theoretical stabilizing regret upper bound is proportional to the inverse of the cube of lower bound of covariance of system disturbances, i.e., StablizingRegretT (ut σ3 ), where the covariance of disturbances from (1) is lower bounded by σ2I. If σ = 0, the theoretical regret upper bound is undefined. Akbari et al. (2022) proposed an Online Riccati Update algorithm that obtains StablizingRegretT ({ut}T −1 t=0 ) = O(σ2 log(T )). The result avoids the undefined regret upper bound of Cohen et al. (2018) when the covariance matrix is not lower bounded by a positive σ. However, like Cohen et al. (2018), the performance of the algorithm proposed in Akbari et al. (2022) is only guaranteed to achieve sublinear stabilizing regret (7) against the best fixed control gain K from the set K. This notion of regret is not suitable for dynamic non-stationary environments. For exam- ple, a self-driving car may operate in different environments such as high-wind areas, or high and low-friction road surfaces. For the best performance to counter-act these environments, we need to use time-varying control gains and compare them against the best time-varying policies chosen in hindsight. T −1 t=0 ) = O( 1 Zhang et al. (2021) investigate the dynamic regret (5) offered by an online LQR approach in- spired by model predictive control. Future cost matrices and predicted disturbances are assumed to be available over a short future preview window of length W ≥ 0, and the following assumption is made. Assumption 1 There exist symmetric positive definite matrices Qmin, Qmax, Rmin, Rmax such that for time 0 ≤ t ≤ T − 2, 0 ≺ Qmin (cid:22) Qt (cid:22) Qmax, 0 ≺ Rmin (cid:22) Rt (cid:22) Rmax, (8) where F ≺ G denotes G − F being positive definite for symmetric matrices F and G. Under Assumption 1, Zhang et al. (2021) propose an online LQR algorithm for selecting con- trols ut at time t by solving min {uk}t+W k=t t+W (cid:88) k=t k Qkxk + uT xT k Rkuk + xT t+W +1Pmaxxt+W +1 subject to (1) where Pmax is the solution of the algebraic Riccati equation for the infinite-horizon LQR problem with cost matrices Qmax and Rmax. The dynamic regret (5) of control sequences generated by this method is shown to be upper bound by a quantity that shrinks exponentially as the preview window length increases. However, the estimate of the tail cost at each time step (i.e., xT t+W +1Pmaxxt+W +1) can be too pessimistic due to its reliance on Pmax and the matrices Qmax and Rmax from the bounds given in Assumption 1. 2. For example, the set is empty, if A = (cid:18)1 6 2 9 (cid:19) , B = (cid:19) (cid:18)9 6 , and the disturbances are distributed according to a multivariate Gaussian with mean zero and covariance matrix I2. 3 REGRET ANALYSIS OF ONLINE LQR CONTROL 1.2. Contributions The key contributions of this paper are: • The proposal of a method for solving the online LQR problem that is independent of the given upper or lower bounds on the cost matrices; • Development of a regret bound for the disturbance-free case and proof that our proposed control policy yields sublinear regret; • Provision of sufficient conditions under which our regret bound is less than that of the state- of-the-art methodology; and • Analysis of our regret bound in the presence of disturbances. Outline. The rest of the paper is organized as follows. In Section 2, we state the online LQR In Section 3, we introduce our proposed online LQR algorithm and problem that we consider. bound its dynamic regret. In Section 4, we provide numerical results for the simulation of our proposed algorithm. Concluding remarks are presented in the last section. 2. Problem Formulation In this paper, we consider the following problem. Problem 1 (Online LQR) Consider the controllable system (1). Let the cost matrices in (5) satisfy Assumption 1 for any given T ≥ 2 and W < T − 2. At time 0 ≤ t ≤ T − W − 2, the available information to the decision maker is given by Ht as defined in (3). It is desired to design a control policy π(*, *) of the form (4) that yields a regret, as defined by (5), that is independent of the bounds given in Assumption 1. Moreover, we seek to establish appropriate regret bounds for the following cases: a) The case where wt = 0 for 0 ≤ t ≤ T − 1; b) The case where the disturbances wt for 0 ≤ t ≤ T − 1 are independent and identically t ) = Wd with E(*) distribution (i.i.d.) random variables such that E(wt) = 0 and E(wtwT being the expectation operator and Wd ∈ Sn +. Specifically, for part a) of Problem 1 we show that the regret (as defined in (5)) associated with our proposed control policy is sublinear with respect to the time horizon T for the case where wt = 0 for 0 ≤ t ≤ T − 1, i.e., For part b), we define the notion of "expected regret" as RegretT ({ut}T −2 t=0 ) ≤ o(T ). ExpectedRegretT ({ut}T −2 t=0 ) := E(JT ({xt}T −1 t=0 , {ut}T −2 t=0 ) − JT ({x∗ t }T −1 t=0 , {u∗ t }T −2 t=0 )), (9) (10) and show that our proposed control policy yields controls that satisfy ExpectedRegretT ({ut}T −2 t=0 ) ≤ CERT γ2W for positive scalars CER and γ3. In what follows we address this problem. 3. The exact definition of γ will be presented in Theorem 1. 4 REGRET ANALYSIS OF ONLINE LQR CONTROL 3. Approach and Regret Analysis Our proposed online LQR approach involves first using the available information Ht at each time t to predict the optimal state x∗ t+1 solving the full information LQR problem described in (6). We then select controls to track this prediction. At time 0 ≤ t ≤ T − 1, we only know the information in Ht. Let xt+1|t+W denote the estimate of the optimal state at time t + 1 based on Ht. We aim to track to the state xt+1|t+W at time t + 1. Prediction. At each time t, we plan an optimal trajectory starting from the initial state ̄x0 using the known cost matrices up to time t + W and setting all the future matrices to be equal to their known values for time t + W . Specifically, at time t where 0 ≤ t < T − W , define Jt+W (*, *) as Jt+W ({ξi}T −1 i=0 , {υi}T −2 i=0 ) := t+W (cid:88) k=0 [ξT k Qkξk + υT k Rkυk] T −2 (cid:88) + k=t+1+W and [ξT k Qt+W ξk + υT k Rt+W υk] + ξT T −1Qt+W ξT −1, Jt+W ({ξi}T −1 i=0 , {υi}T −2 i=0 ) := JT ({ξi}T −1 i=0 , {υi}T −2 i=0 ) for T − W ≤ t ≤ T − 1. Then, we find the predicted optimal control sequence for all 0 ≤ j ≤ T − 2 by solving (cid:16) {xj|t+W }T −1 j=0 , {uj|t+W }T −2 j=0 (cid:17) = ({ξi}T −1 argmin i=0 ,{υi}T −2 i=0 ) subject to Jt+W ({ξi}T −1 i=0 , {υi}T −2 i=0 ) ξi+1 = Aξi + Bυi, ξ0 = ̄x0. Prediction Tracking. We propose the following feedback control policy π(xt, Ht) = K(xt − xt|t+W ) + ut|t+W , (11) (12) (13) (14) where K ∈ Rm×n is a control matrix such that ρ(A + BK) < 1, and ρ(*) denotes the matrix spectral radius. Intuitively, such control matrix K leads to contraction of the distance between xt+1 and xt+1|t+W , respectively given by (1) and (13). 3.1. Regret Analysis for the Disturbance-free Case In the following theorem, we present the result for the case of Problem 1a) that the control sequence generated by (14) incurs a sublinear upper bound regret with respect to time horizon T . Here, with slight abuse of notation, for a sequence of matrices {Σi}N := {Στ | 0 ≤ τ ≤ N, Στ (cid:23) Σk for all 0 ≤ k ≤ N } and min0≤t≤N Σt := {Στ | 0 ≤ τ ≤ N, Στ (cid:22) Σk for all 0 ≤ k ≤ N }. This enables us to define cost matrix sequence extrema as ̄Rmax := max0≤t≤T −2 Rt, ̄Qmax := max0≤t≤T −1 Qt, ̄Rmin := min0≤t≤T −2 Rt, and ̄Qmin := min0≤t≤T −1 Qt. For any matrix Γ, we further define λmin(Γ) as the minimum eigenvalue of Γ and λmax(Γ) as the maximum eigenvalue of Γ. i=0, we define max0≤t≤N Σt 5 REGRET ANALYSIS OF ONLINE LQR CONTROL Theorem 1 (Main Result) Consider the linear system defined by (1). For a given time horizon T ≥ 2 and preview window length 0 ≤ W ≤ T − 2. Suppose that at time 0 ≤ t ≤ T − 2 the control input ut is generated by policy π(*, *) as given by (14). Under Assumption 1, the regret defined by (5) satisfies RegretT ({ut}T −2 t=0 ) ≤ 10Dγ2W (cid:107) ̄x0(cid:107)2 3 (cid:20) (α1 + α2)( (cid:18) C2CKγ (γ − 1) )2 γ2ST (η2γ2) − 2γST (η2γ) + ST (η2)) + 10C2 f 3 (ηγ)2ST (η2γ2) q2(q − ηγ)2 + (( + where ̄Pmax satisfies − ηγ q(q − ηγ) η2ST (η2) q2(q − η)2 ) η q(q − η) )2ST (q2) (15) (cid:19) + (CKC2)2ST (η2) (cid:21) , ̄Pmax = ̄Qmax + AT ̄PmaxA − AT ̄PmaxB( ̄Rmax + BT ̄PmaxB)−1BT ̄PmaxA, (cid:113) (cid:13) ̄Rmax + BT ̄PmaxB(cid:13) D = (cid:13) λmax( ̄Pmax) λmin( ̄Qmin) , η = β = min0≤t≤T −2 λmin(Qt), γ = α maxt 2 (cid:107)K∗ (cid:13), CK = (cid:13) λmax( ̄Pmax) , α = max 0≤i≤t−1 0≤t≤T −2 α+β , ST (z) = (cid:80)T −1 (cid:107)(A+BK)n(cid:107) (q+ε)n max( ̄Pmax) λ2 λmin( ̄Qmin) , C = i+1A), λmax(ATPi+1|tA)}, (cid:13)Kt|t+W − K(cid:13) (cid:13) 2, α2 = (cid:13) , q = ρ(A+BK)+ε, and 0 ≤ ε < 1−ρ(A+BK). (cid:13)( ̄Rmin + BT ̄QminB)−1(cid:13) (cid:13) {λmax(ATP ∗ t − K(cid:107)2, Cf = maxn≥0 t=0 zt, α1 = maxt 1 − λmin( ̄Qmin) (cid:13) ̄RmaxBT(cid:13) 2 (cid:13) (cid:13) Proof See Appendix A. Remark 2 For any z ∈ [0, 1) there exists an Λ ∈ R, such that limT →∞ ST (z) = Λ. Consequently, RegretT ({ut}T −2 t=0 ) = 0, which implies that the control sequence described by (14) yields limT →∞ T sublinear regret. Remark 3 Let F ( ̄x0, A, B, T, ̄Rmax, ̄Rmin, ̄Qmax, ̄Qmin, K) denote the right hand side (RHS) of (15). By stating almost identical lemmas to Lemmas 8 and 9 using the bounds given in Assumption 1 instead of the cost matrices sequence extrema values, one can arrive at a regret bound in terms of these bounds analogous to (15): RegretT ({ut}T −2 t=0 ) ≤ F ( ̄x0, A, B, T, Rmax, Rmin, Qmax, Qmin, K). In the following proposition, we state a condition in terms of the bounds given in Assumption 1 and the cost matrices sequence extrema where it is guaranteed that the bound given in the above theorem is smaller than that of (Zhang et al., 2021, Theorem 1, Equation (15)). Obviously, there might be other conditions, exploration of which is left to future work. Proposition 4 Adopt the hypothesis of Theorem 1. If λ10 max(Qmax) ≥ (cid:20) (1 + α1+α2 5 1 1−η2 ) + (1−γ)2 )( min( ̄Rmin)λ4 (C2 Kλ2 10C2 f q2(q−ηγ)2(q−η)2(1−η2)(1−η2γ2)(1−q2) (cid:21) min( ̄Qmin))−16(cid:107)A(cid:107)2(cid:107)B(cid:107)2(cid:107)B ̄R−1 minBT(cid:107)2 , (16) where Qmax is given in Assumption 1, then the RHS of inequality in (Zhang et al., 2021, Theorem 1, Equation (15)) is greater than the RHS of inequality (5) in Theorem 1. 6 REGRET ANALYSIS OF ONLINE LQR CONTROL Proof See Appendix B. The RHS of (16) is independent of the matrices Qmin, Qmax, Rmin, Rmax given in Assumption 1. On the other hand, the upper bound of regret for control decisions that generated by (Zhang et al., 2021, Algorithm 1) does depend on these values and even if the actual sequence of the cost matrices remain bounded away from these bounds, the method still explicitly uses the bounds and this is a potential source of conservatism. 3.2. Regret Analysis in the Presence of Disturbances k=0 is the available sequence of disturbances to the decision maker. The result presented in the following theorem address Problem 1 case b). Note that at time t, {wk}t In this case, we still consider a policy π(*, *) as given by (14) with the only difference that xt|t+W is obtained by solving the following optimisation problem: (cid:16) {xj|t+W }T −1 j=0 , {uj|t+W }T −2 j=0 (cid:17) = ({ξi}T −1 argmin i=0 ,{υi}T −2 i=0 ) subject to Jt+W ({ξi}T −1 i=0 , {υi}T −2 i=0 ) ξi+1 = Aξi + Bυi + wi ξi+1 = Aξi + Bυi for i > t, for 0 ≤ i ≤ t, ξ0 = ̄x0. (17) Theorem 5 Consider the system defined by (1). For a given time horizon T ≥ 2 and preview window length 0 ≤ W ≤ T − 2. Suppose that at time 0 ≤ t ≤ T − 2 the control input ut is generated by policy π(*, *) as given by (14). Under Assumption 1, the expected regret defined by (10) satisfies ExpectedRegretT ({ut}T −2 t=0 ) ≤ CERT γ2W (18) where CER is a positive scalar and γ is given in Theorem 1. Proof See Appendix C. In the next section, we investigate the performance of the proposed algorithm for different scenarios. 4. Numerical Simulations In this section, we numerically demonstrate the performance of the proposed algorithm. To this end, define ΦT,W := RegretT ({u(cid:48) t=0 is generated from (Zhang et al., 2021, Algorithm 1) and {ut}T −2 t=0 is generated by the policy described in (14), under preview window length of W . t=0 ) − RegretT ({ut}T −2 t=0 ), where {u(cid:48) t}T −2 t}T −2 4.1. Linearized Inverted Pendulum Consider the following linearized inverted pendulum system (Franklin et al., 2020, Chapter 2.13): xt+1 = 1  0 0 0 0 −0.1818   0 1  0 −18.1818 31.1818 0 0 2.6727 0 0     xt + 7     0 1.8182 0 4.5455     ut. (19) REGRET ANALYSIS OF ONLINE LQR CONTROL Figure 1: Performance measure ΦT,W for simulated systems. (a) ΦT,W for disturbance-free linearized in- (b) ΦT,W for disturbance-free random con- verted pendulum system trollable systems (c) ΦT,W for linearized inverted pendulum (d) ΦT,W for random controllable system with system with disturbances disturbances In the following experiments, the preview horizon W ranges from 0 to 19 and the time horizon T ranges from 19 to 500. The cost matrices are chosen uniformly satisfying by Assumption 1 with Qmin = 8 × 103I4×4, Qmax = 3.2 × 104I4×4, Rmin = 2 × 103, and Rmax = 9.8 × 104. The fixed controller from (14) is chosen by placing the poles at the location of (1, 6, 4, 3) × 10−3. We repeat the experiment in 200 trials. Figure 2(a)subfigure demonstrate ΦT,W , under preview window length from 0 to 19 and time horizon from 19 to 500. As the preview window length greater than 2, our method outperforms (Zhang et al., 2021, Algorithm 1). 4.2. Random Linear Systems In this experiment, the linear system is randomly chosen where all elements of A and B are drawn uniformly within the range of (0, 10) and ensure the pairs of (A, B) are controllable. The setting of preview window length, time horizon, cost matrices and the pole location for the control matrix K from (14) are identical as what we have chosen in Section 4.1. The plot in Figure 2(b)subfigure demonstrates the subtraction between the regret of control decision generated by (Zhang et al., 2021, Algorithm 1) and the regret of control decision generated by our proposed method, by averaging the 8 REGRET ANALYSIS OF ONLINE LQR CONTROL regret over 200 trials. As the preview window length exceed 4, our method outperforms (Zhang et al., 2021, Algorithm 1). The plots from Figure 2(a)subfigure and 2(b)subfigure demonstrate that, as the preview window length exceeds the rank of the system, which is the least number of steps that require to steer the state of the system to a designated state, the proposed method outperforms the method from Zhang et al. (2021). 4.3. Linear Systems with disturbances The following experiments repeat the ones considered in Section 4.1 and 4.2, using the system defined in (19) and in the presence of disturbance wt ∼ N (0, 25I4×4). The setting of the preview window length, time horizon, cost matrices and the pole location for the control matrix K are identical as what we have chosen from the experiment in Section 4.1. The method of finding xt|t+W and ut|t+W can be referred to Remark 3.2. The plots in Figures 2(c)subfigure and 2(d)subfigure depict the average value of ΦT,W after 200 random trials. 5. Conclusions and Future Work This paper propose a new control policy that achieves constant dynamic regret where the avail- able information of cost matrices are sequentially reviewed as time step increases. The proposed method and consequently its regret have been demonstrated to be, contrary to the state-of-the-art, independent of the ex ante upper and lower bound of the cost matrices. To exhibit the effect such independence, a sufficient condition is provided under which the regret upper bound of the proposed method is guaranteed to be smaller that the one from (Zhang et al., 2021, Theorem 1). This paper leads to many interesting research direction which are briefly discussed below. It would be inter- esting to devise a methodology for selecting a time-varying feedback gain matrix in in (14) instead of a fixed K in order to further minimise the regret. Moreover, one can extend the algorithm to the case of time-varying At and Bt for the system matrices and via differential dynamic programming for nonlinear dynamics with control constraints, and establish new dynamic regret. References Mohammad Akbari, Bahman Gharesifard, and Tamas Linder. Logarithmic regret in online linear quadratic control using Riccati updates. Mathematics of Control, Signals, and Systems, April 2022. ISSN 0932-4194, 1435-568X. Brian D. O. Anderson and John B. Moore. Optimal Control: Linear Quadratic Methods. Courier Corporation, February 2007. ISBN 978-0-486-45766-6. Tomas Bj ̈ork, Mariana Khapko, and Agatha Murgoci. Time-Inconsistent Control Theory with Fi- nance Applications. Springer Finance. Springer International Publishing, Cham, 2021. ISBN 978-3-030-81842-5 978-3-030-81843-2. doi: 10.1007/978-3-030-81843-2. Xianzhong Chen, Mohsen Heidarinejad, Jinfeng Liu, and Panagiotis D. Christofides. Distributed economic MPC: Application to a nonlinear chemical process network. Journal of Process Con- trol, 22(4):689–699, April 2012. ISSN 0959-1524. 9 REGRET ANALYSIS OF ONLINE LQR CONTROL Alon Cohen, Avinatan Hassidim, Tomer Koren, Nevena Lazic, Yishay Mansour, and Kunal Talwar. Online Linear Quadratic Control. arXiv:1806.07104 [cs, stat], June 2018. arXiv: 1806.07104. Gene F Franklin, Abbas Emami-Naeini, and J. David Powell. Feedback control of dynamic sys- tems Gene F. Franklin, Stanford University, J. David Powell, Stanford University, Abbas Emami- Naeini, SC Solutions, Inc. Pearson, New York, NY, eighth edition, global edition edition, 2020. ISBN 1-292-27452-2. Publication Title: Feedback control of dynamic systems. Matthew Hampsey, Pieter van Goor, Tarek Hamel, and Robert Mahony. Exploiting Differ- ent Symmetries for Trajectory Tracking Control with Application to Quadrotors, July 2022. arXiv:2207.04782 [cs, eess]. Ali Jadbabaie, Alexander Rakhlin, Shahin Shahrampour, and Karthik Sridharan. Online Optimiza- tion : Competing with Dynamic Comparators. arXiv:1501.06225 [cs, math, stat], January 2015. arXiv: 1501.06225. Samir Kouro, Patricio Cortes, Ren ́E Vargas, Ulrich Ammann, and Jos ́E Rodriguez. Model Predictive Control-A Simple and Powerful Method to Control Power Converters. IEEE Transactions on Industrial Electronics, 56(6):1826–1838, June 2009. ISSN 1557-9948. Conference Name: IEEE Transactions on Industrial Electronics. Karl Krauth, Stephen Tu, and Benjamin Recht. Finite-time Analysis of Approximate Policy Itera- tion for the Linear Quadratic Regulator. arXiv:1905.12842 [cs, math, stat], May 2019. arXiv: 1905.12842. Yang Liu, Jian Feng Yang, Ren De Qi, and Ning Ning Meng. Nonlinear control of active power filter based on LQR control. Journal of Physics: Conference Series, 1748(5):052061, January 2021. ISSN 1742-6596. Publisher: IOP Publishing. Nicoleta Radneantu. Making the Invisible Visible: the Intangible Assets Recognition, the Valuation and Reporting in Romania. Annals of the University of Petrosani, Economics, 9:6–6, January 2009. Venkatraman Renganathan, Iman Shames, and Tyler H. Summers. Towards Integrated Perception and Motion Planning with Distributionally Robust Risk Constraints. IFAC-PapersOnLine, 53(2): 15530–15536, January 2020. ISSN 2405-8963. Shai Shalev-Shwartz. Online learning and online convex optimization. Number 4:2 in Foundations and trends in machine learning. Now, Boston, 2012. ISBN 978-1-60198-546-0. M. Vukov, S. Gros, G. Horn, G. Frison, K. Geebelen, J. B. Jørgensen, J. Swevers, and M. Diehl. Real-time nonlinear MPC and MHE for a large-scale mechatronic application. Control Engineer- ing Practice, 45:64–78, December 2015. ISSN 0967-0661. Tyler Westenbroek, David Fridovich-Keil, Eric Mazumdar, Shreyas Arora, Valmik Prabhu, S. Sas- try, and Claire Tomlin. Feedback Linearization for Uncertain Systems via Reinforcement Learn- ing. pages 1364–1371, May 2020. Runyu Zhang, Yingying Li, and Na Li. On the Regret Analysis of Online LQR Control with Pre- dictions. In 2021 American Control Conference (ACC), pages 697–703, May 2021. 10 REGRET ANALYSIS OF ONLINE LQR CONTROL Martin Zinkevich. Online Convex Programming and Generalized Infinitesimal Gradient Ascent. 2, April 2003. Appendix A. Proof of Theorem 1 Before stating the proof of the theorem we introduce the necessary propositions and lemmas. Proposition 6 Let Qi|t+W := Ri|t+W := (cid:40) if i ≤ t + W Qi Qt+W if i > t + W , (cid:40) if i ≤ t + W Ri Rt+W if i > t + W . For 0 ≤ t ≤ T − 1, 0 ≤ i ≤ T − 2 the analytical solution of control sequence described at (13) is given by PT −1|t+W = Qt|t+W , Pi|t+W = ATPi+1|tA + Qi|t + ATPi+1|tBKi|t, Ki|t+W := −(Ri|t+W + BTPi+1|t+W B)−1BTPi+1|t+W A, ui|t+W = Ki|t+W xi|t+W , xi+1|t+W = Axi|t+W + Bui|t+W . The control sequence that minimize the cost in (5) can be found by setting t = T − 1. The above proposition is a consequence of (Anderson and Moore, 2007, Chapter 2.4). The next lemma states that the matrices Pi|t described in the above proposition are upper and lower bounded if the cost matrices Qi and Ri are upper and lower bounded. Lemma 7 For 0 ≤ t, i ≤ T − 1, under Assumption 1, there exists a positive definite matrix ̄Pmax such that Qmin (cid:22) ̄Qmin (cid:22) Pi|t (cid:22) ̄Pmax. The proof of the above lemma is similar to the proof in (Zhang et al., 2021, Appendix D, Proposition 11). Based on the previous proposition and lemma, the following lemmas reveals the upper bound of matrix norm for Pi|t0 −Pi|t and Ki|t −Ki|t0 for any 0 ≤ i ≤ t ≤ t0 ≤ T −1. These upper bounds can infer the exponential stability of control matrices Ki|t and Ki|t0 described in Proposition 6. Lemma 8 For any 0 ≤ i ≤ t ≤ t0 ≤ T − 1, the following hold: (cid:13) (cid:13)Pi|t − Pi|t0 (cid:13) (cid:13) ≤ max( ̄Pmax) λ2 λmin( ̄Qmin) γt+1−i, and (cid:13) (cid:13)Ki|t − Ki|t0 (cid:13) (cid:13) ≤ CKγt−i. 11 REGRET ANALYSIS OF ONLINE LQR CONTROL Proof Before proceeding with the proof, we first define δ∞(*, *) as δ∞(X, Y ) := (cid:107) log(X − 1 2 Y X 1 2 )(cid:107), for positive semi-definite matrices X and Y . Since Qi, Ri, Pi|t0, Pi|t are positive definite, by (Krauth et al., 2019, Lemma D.2), we have that δ∞(Pi|t, Pi|t0) = δ∞(Qt + ATP 1 2 i+1|t0 1 2 i+1|t(I + P (I + P 1 2 i+1|t0 i+1|tBR−1 + BR−1 1 2 δ∞((P −1 i+1|t0 BR−1 t BTP )−1P 1 2 i+1|t0 A, 1 2 i+1|t0 1 2 1 2 t BTP t BT)−1, (P −1 i+1|t)−1P i+1|tA) i+1|t + BR−1 t BT)−1) δ∞(Pi+1|t0, Pi+1|t) ≤ γδ∞(Pi+1|t0, Pi+1|t). Qt + ATP α α + β α α + β ≤ ≤ Furthermore, we have δ∞(Pi|t0, Pi|t) ≤ γt−i+1δ∞(Pt+1|t0, Pt+1|t). Based on (Zhang et al., 2021, Lemma 6), we can further deduce the last step above to δ∞(Pi|t0, Pi|t) ≤ γt−i+1 log( (cid:124) λmax( ̄Pmax) λmin( ̄Qmin) (cid:123)(cid:122) c:= ). (cid:125) Based on (Zhang et al., 2021, Lemma 7), we can conclude that (cid:107)Pi|t0 − Pi|t(cid:107) ≤ λmax( ̄Pmax) δ∞(Pi|t0, Pi|t) ec − 1 c ec − 1 c ≤ λmax( ̄Pmax) c ≤ λmax( ̄Pmax)(ec − 1) max( ̄Pmax) ≤ γt−i+1 λ2 λmin( ̄Qmin) . The last step of inequality above is a consequence of the inequality eax − 1 ≤ aex for 0 ≤ a ≤ 1 and x ≥ 0. Furthermore, since (cid:107)Ki|t − Ki|t0(cid:107) = (cid:107) − (Ri + BTPi+1|tB)−1BTPi+1|tA + (Ri + BTPi+1|t0B)−1BTPi+1|t0A(cid:107). Let G1 = (Ri + BTPi+1|tB), G2 = (Ri + BTPi+1|t0B). We rearrange the above equations as (cid:107)Ki|t −Ki|t0(cid:107) = (cid:107)G−1 = (cid:107)G−1 ≤ (cid:107)G−1 = (cid:107)G−1 ≤ (cid:107)G−1 1 BTPi+1|t − G−1 1 G−1 2 G−1 2 G−1 2 G−1 2 G2BTPi+1|t − G−1 1 G−1 1 (cid:107)(cid:107)(G1G2)(G−1 1 G−1 1 (cid:107)(cid:107)((G1G2)(G−1 1 (cid:107)((cid:107)(G1G2 − G2G1)G−1 2 BTPi+1|t0(cid:107) 2 G−1 2 )G2BTPi+1|t − G1BTPi+1|t0(cid:107) 2 )−I)G2BTPi+1|t + G2BTPi+1|t − G1BTPi+1|t0(cid:107) 1 BTPi+1|t(cid:107) + (cid:107)G2BTPi+1|t − G1BTPi+1|t0(cid:107)) 1 G1BTPi+1|t0(cid:107) 12 REGRET ANALYSIS OF ONLINE LQR CONTROL ≤ (cid:107)G−1 2 G−1 1 (cid:107)(cid:107)G2BTPi+1|t − G1BTPi+1|t0(cid:107). (20) The last two steps from the above is due to G1, G2 being symmetric matrices, being a G1G2 −G2G1 is skew symmetric matrix, and the fact that the induced 2-norm of a skew symmetric matrix is 0. Moreover, (cid:13) (cid:13)(Ri + BT Pi+1|t0B)BTPi+1|t − (Ri + BTPi+1|tB)BTPi+1|t0 (cid:13) (cid:13) (cid:13) (cid:13) ≤ (cid:107)RiBT(Pi+1|t − Pi+1|t0)(cid:107) + (cid:107)B(cid:107)(cid:107)Pi+1|t0(BBT)Pi+1|t − Pi+1|t(BBT)Pi+1|t0(cid:107) ≤ (cid:107)RiBT(cid:107)(cid:107)Pi+1|t − Pi+1|t0(cid:107). (21) Thus, substituting (21) in (20), we have (cid:107)Ki|t − Ki|t0(cid:107) ≤ (cid:107)G−1 2 G−1 1 (cid:107)(cid:107) ̄RmaxBT(cid:107)(cid:107)Pi+1|t − Pi+1|t0(cid:107) max( ̄Pmax) λ2 λmin( ̄Qmin) 1 (cid:107)(cid:107) ̄RmaxBT(cid:107) γt−i ≤ (cid:107)G−1 2 G−1 ≤ (cid:107)( ̄Rmin + BT ̄QminB)−1(cid:107)2(cid:107) ̄RmaxBT(cid:107) max( ̄Pmax) λ2 λmin( ̄Qmin) γt−i = CKγt−i. Lemma 9 For time horizon T , suppose 0 ≤ t0 ≤ t1 ≤ t ≤ T − 2. Suppose C and η are given in Theorem 1. Then, (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) t1(cid:89) i=t0 (cid:13) (cid:13) (cid:13) (A + BKi|t) (cid:13) (cid:13) ≤ Cηt1−t0+1. This lemma can be proved following the same steps as those found in the proof of (Zhang et al., 2021, Appendix E,Proposition 2). The next lemma establishes the bound of the distance between the state that generated by control law at (13) and the optimal state that generated by (6), together with the the differences between the control defined at (6) and (13). Lemma 10 For t ≥ 1, the norm of the difference between the state vector xt generated by (14) and the optimal state vector x∗ t generated by control sequence (6) is (cid:107)xt −x∗ t (cid:107) ≤ C2CK(cid:107) ̄x0(cid:107)γW γ − 1 (ηt−1γ(γt −1)+Cf ( ηγ q ( qt−1 − (ηγ)t−1 q − ηγ )− η q ( qt−1 − ηt−1 q − η )). (22) Moreover, the norm of the difference between the predicted trajectory and the optimal trajectory at time t is given by (cid:13) (cid:13)xt|t+W − x∗ t (cid:13) (cid:13) ≤ C2CK(cid:107) ̄x0(cid:107)γW γ − 1 ηt−1γ(γt − 1). Proof Observe the dynamics of xt − x∗ t , we have xt − x∗ t = xt − xt|T −1 = xt − xt|t+W + xt|t+W − xt|T −1. 13 REGRET ANALYSIS OF ONLINE LQR CONTROL Define ωt := xt − xt|t+W , θi|p,q := xi|p − xi|q, where i ≤ p ≤ q ≤ T . Consequently, ω0 = 0, and ωt+1 = (A + BK)xt + B(Kt|t+W − K)xt|t+W − (A + BKt|t+W )xt|t+W + xt+1|t+W − xt+1|t+1+W = (A + BK)xt + B(Kt|t+W − K)xt|t+W − (A + BK + B(Kt|t+W − K))xt|t+W + xt+1|t+W − xt+1|t+W +1 = (A + BK)(xt − xt|t+W ) + xt+1|t+W − xt+1|t+1+W = (A + BK)ωt + θt+1|t+W,t+1+W = t+1 (cid:88) j=1 (A + BK)t+1−jθj|j−1+W,j+W . We now investigate the dynamics of θi|p,q. Note that θ0|p,q = 0, and θi+1|p,q = xi+1|p − xi+1|q = (A + BKi|p)xi|p − (A + BKi|q)xi|q = (A + BKi|p)(θi|p,q + xi|q) − (A + BKi|q)xi|q = (A + BKi|p)θi|p,q + B(Ki|p − Ki|q)xi|q. This implies that xi+1|p − xi+1|q = i (cid:88) (cid:18) i (cid:89) (cid:19) (A + BKm|p) B(Kn|p − Kn|q) n=0 m=n+1 (cid:18) n−1 (cid:89) (cid:19) (A + BKm|q) ̄x0. m=0 By Lemma 9, we can bound the product term by (cid:107) (cid:107) i (cid:89) (A + BKm|p)(cid:107) ≤ Cηi−n, m=n+1 n−1 (cid:89) (A + BKm|q)(cid:107) ≤ Cηn. m=0 (cid:107)B(Kn|p − Kn|q)(cid:107) ≤ CKγp−n. By Lemma 8, we have Thus, (cid:107)θi+1|p,q(cid:107) = (cid:107)xi+1|p − xi+1|q(cid:107) ≤ C2CK i (cid:88) t=0 ηiγp−t = C2CKγpηi i (cid:88) t=0 1 γt = C2CKγpηi 1 − 1 γ (1 − ( 1 γ )i+1). 14 REGRET ANALYSIS OF ONLINE LQR CONTROL Choosing i = t, p = t + W , and q = T − 1, results in Moreover, (cid:107)θt|t+W,T −1(cid:107) ≤ = C2CK(cid:107) ̄x0(cid:107)γt+W ηt−1 1 − ( 1 γ ) C2CK(cid:107) ̄x0(cid:107)ηt−1γW +1 γ − 1 (1 − ( 1 γ )t) (γt − 1). (cid:107)θi|i−1+W,i+W (cid:107) ≤ C2CK(cid:107) ̄x0(cid:107)γi−1+W ηi−1 1 − ( 1 γ ) (1 − ( 1 γ )i) = C2CK(cid:107) ̄x0(cid:107)ηi−1γW γ − 1 (γi − 1). Define μi,t = (cid:107)(A + BK)t−i(cid:107). Conclude the above, we have (cid:107)xt − xt|t+W (cid:107) ≤ t (cid:88) (cid:107)(A + BK)t−iθi|i−1+W,i+W (cid:107) i=1 C2CK(cid:107) ̄x0(cid:107)γW γ − 1 ≤ t (cid:88) i=1 μi,tηi(γi − 1). (23) (24) Thus, (cid:107)xt − x∗ t (cid:107) ≤ C2CK(cid:107) ̄x0(cid:107)γW γ − 1 (cid:18) t (cid:88) i=1 μi,tηi(γi − 1) + ηt−1γ(γt − 1) (cid:19) . (25) Let ρ(A + BK) < 1, for any given 1 − ρ(A + BK) > ε > 0, by Gelfand's formula, there exist a T (cid:48) > 0, such that for n > T (cid:48), we have |(cid:107)(A + BK)n(cid:107) 1 n − ρ(A + BK)| < ε. Thus, (cid:107)(A + BK)n(cid:107) 1 n < ρ(A + BK) + ε and that implies that (cid:107)(A + BK)n(cid:107) < (ρ(A + BK) + ε)n. Define Cf := max n≥0 (cid:107)(A + BK)n(cid:107) (q + ε)n , q := ρ(A + BK) + ε, we can conclude that, for every r ≥ s > 0 and ρ(A + BK) < 1, there exist a pair of Cf and 0 < q < 1 such that μs,r < (cid:107)(A + BK)r−s(cid:107) < Cf qr−s. 15 REGRET ANALYSIS OF ONLINE LQR CONTROL Thus, the upper bound of the difference between the state vector and the optimal state vector is given by (cid:107)xt − x∗ t (cid:107) ≤ (ηt−1γ(γt − 1) C2CK(cid:107) ̄x0(cid:107)γW γ − 1 ηγ q ( + Cf ( qt−1 − (ηγ)t−1 q − ηγ ) − η q ( qt−1 − ηt−1 q − η )). Lemma 11 (Zhang et al. (2021)) The regret defined by (5) can be written as RegretT ({ut}T −2 t=0 ) = T −1 (cid:88) t=0 (ut − ̄ut)T(Rt + BTP ∗ t+1B)(ut − ̄ut), where ̄ut = K∗ t xt. We also need the following elementary result. Lemma 12 For any a1, a2, a3 ∈ R, we have that (a1 + a2 + a3)2 ≤ 10 3 (a2 1 + a2 2 + a2 3). (26) Proof Note that, (a1+a2+a3)2 ≤ 2(a1+a2)2+2a2 1 + 4a2 4a2 1 + 2a2 Combining all the above inequalities, yields 3 and (a1 + a2 + a3)2 ≤ 2a2 2 + 4a2 3 ≤ 4a2 1+4a2 2 + 4a2 3. 2+2a2 3. Similarly, (a1+a2+a3)2 ≤ (a1 + a2 + a3)2 ≤ 4 + 4 + 2 3 The proof of theorem is given below. Proof of Theorem 1. Note that (a2 1 + a2 2 + a2 3) = 10 3 (a2 1 + a2 2 + a2 3). (cid:107)ut − ̄ut(cid:107)2 = (cid:107)Kxt + (Kt|t+W − K)xt|t+W − K∗ t ) − (K∗ = (cid:107)(Kt|t+W − K)(xt|t+W − x∗ t xt(cid:107)2 t − K)(xt − x∗ ≤ 10 3 ((cid:107)(Kt|t+W − K(cid:107)2(cid:107)xt|t+W − x∗ t (cid:107)2 + (cid:107)K∗ t ) + (K∗ t − K(cid:107)2(cid:107)xt − x∗ t − Kt|t+W )x∗ t (cid:107)2 + C2 t (cid:107)2 Kγ2W (cid:107)x∗ t (cid:107)2). (27) 16 REGRET ANALYSIS OF ONLINE LQR CONTROL The last inequality above is obtained from Lemma 12. By Lemma 10, we have that T −1 (cid:88) t=0 (cid:107)xt − x∗ t (cid:107)2 ≤ T −1 (cid:88) t=1 (cid:18) C2CK(cid:107) ̄x0(cid:107)γW γ − 1 (ηt−1γ(γt − 1) + Cf ( ηγ q ( qt−1 − (ηγ)t−1 q − ηγ ) − η q ( qt−1 − ηt−1 q − η (cid:19)2 )) ≤ 2( C2CK(cid:107) ̄x0(cid:107)γW +1 (γ − 1) )2 (cid:18) γ2ST (η2γ2) − 2γST (η2γ) (28) + ST (η2)) + 10C2 f 3 (ηγ)2ST (η2γ2) q2(q − ηγ)2 + + (( η q(q − η) − ηγ q(q − ηγ) (cid:19) η2ST (η2) q2(q − η)2 ) , )2ST (q2) and T −1 (cid:88) t=0 (cid:107)xt|t+W − x∗ t (cid:107)2 ≤ ( C2CK(cid:107) ̄x0(cid:107)γW +1 (γ − 1) )2 (cid:18) γ2ST (η2γ2) − 2γST (η2γ) + ST (η2) By Lemma 9, we have T −1 (cid:88) t=0 (cid:107)x∗ t (cid:107)2 = T −1 (cid:88) (cid:107) t (cid:89) (A + BK∗ i ) ̄x0(cid:107)2 ≤ (C2(cid:107) ̄x0(cid:107))2ST (η2). t=0 i=0 (cid:19) . (29) (30) Substitute (28), (29) and (30) in (27), by Lemma 11, the RegretT ({ut}T −2 by t=0 ) can be upper bounded RegretT ({ut}T −2 t=0 ) ≤ 10D 3 (cid:18) T −1 (cid:88) t=1 ( C2CK(cid:107) ̄x0(cid:107)γW +1 η(γ − 1) ηt(γt − 1)(cid:107)Kt|t+W − K(cid:107))2 t (cid:107)2 + (CKC2(cid:107) ̄x0(cid:107)γW )2ST (η2) (cid:18) (cid:19) + (cid:107)K∗ t − K(cid:107)2(cid:107)xt − x∗ ≤ 10Dγ2W (cid:107) ̄x0(cid:107)2 3 (cid:20) (α1 + α2)( C2CKγ (γ − 1) + ST (η2)) + 10C2 f 3 (ηγ)2ST (η2γ2) q2(q − ηγ)2 + + (( − ηγ q(q − ηγ) (cid:19) η2ST (η2) q2(q − η)2 ) )2 γ2ST (η2γ2) − 2γST (η2γ) η q(q − η) )2ST (q2) (cid:21) + (CKC2)2ST (η2) . (cid:4) Appendix B. Proof of Proposition 4 For the sake of clarity of presentation we drop the arguments of F and we use F (cid:48) to represent the RHS of (Zhang et al., 2021, Theorem 1, Equation (15)) in what follows. Note that (cid:48) F ≥ 4(cid:107) ̄x0(cid:107)2D(cid:107)A(cid:107)2(cid:107)B(cid:107)2λ10 max(Pmax)C4(cid:107)BR−1 min(Rmin)λ4 λ2 min(Qmin)(1 − η)2 minBT(cid:107)2(1 + (cid:107)BR−1 minBT(cid:107)2)(γW + ηW )2 17 REGRET ANALYSIS OF ONLINE LQR CONTROL ≥ 4(cid:107) ̄x0(cid:107)2D(cid:107)A(cid:107)2(cid:107)B(cid:107)2λ10 max(Qmax)C4(cid:107)B ̄R−1 min( ̄Qmin) min( ̄Rmin)λ4 λ2 minBT(cid:107)2γ2W , and F ≤ 10Dγ2W (cid:107) ̄x0(cid:107)2C4C2 K 3 (cid:20) (α1 + α2) + (cid:18) 10C2 f 3q2 ( (γ − 1)qη (q − ηγ)(q − η) )2 ≤ 10Dγ2W (cid:107) ̄x0(cid:107)2C4C2 K 3 (cid:20) (1 + Thus, if 1 1 − q2 + α1 + α2 (1 − γ)2 )( γ2 (1 − γ)2 η2 1 − η2 1 1 − η2 + (ηγ)2 (q − ηγ)2(1 − η2γ2) + η2 (q − η)2(1 − η2) (cid:19)(cid:21) 1 1 − η2 ) + 10C2 f q2(q − ηγ)2(q − η)2(1 − η2)(1 − η2γ2)(1 − q2) (cid:21) . λ10 max(Qmax) ≥ (cid:20) (1 + α1+α2 5 1 1−η2 ) + (1−γ)2 )( min( ̄Rmin)λ4 6(C2 Kλ2 10C2 f q2(q−ηγ)2(q−η)2(1−η2)(1−η2γ2)(1−q2) (cid:21) min( ̄Qmin))−1(cid:107)A(cid:107)2(cid:107)B(cid:107)2(cid:107)B ̄R−1 minBT(cid:107)2 then it follows that F ≤ F (cid:48). Appendix C. Proof of Theorem 5 , (cid:4) Lemma 11 holds regardless of the presence or the absence of the disturbances. Thus, ExpectedRegretT ({ut}T −2 t=0 ) = E( T −1 (cid:88) (ut − ̄ut)T(Rt + BTP ∗ t+1B)(ut − ̄ut)) t=0 T −1 (cid:88) t=0 ≤ D E((ut − ̄ut)T(ut − ̄ut)) = D T −1 (cid:88) t=0 E((cid:107)ut − ̄ut(cid:107)2). The state variable xn|q can be expressed as n−1 (cid:89) (A + BKj|q) ̄x0 + n−1 (cid:88) (cid:18) n−1 (cid:89) (cid:19) (A + BKj|q) wr. xn|q = j=0 r=0 j=r+1 With θi|p,q = xi|p − xi|q, we have that θi+1|p,q = (A + BKi|p)θi|p,q + B(Ki|p − Ki|q)xi|q i (cid:88) (cid:18) i (cid:89) = (cid:19) (A + BKm|p) B(Kn|p − Kn|q)xn|q. n=0 m=n+1 Next, we state two lemmas to help us bounding the expected regret. (31) (32) (33) Lemma 13 Consider the system in (1) with initial condition ̄x0 = 0. Suppose that for any t > 0, E(wt) = 0, E(wtwT is available to the control policy (14). Let {ut}T −2 policy (14) subject to (1). There exist a positive scalar CR2, the expected regret satisfies +. At any time t, disturbance sequence {wk}t k=0 t=0 denote the sequence that generate by control t ) = Wd for a Wd ∈ Sn ExpectedRegretT ({ut}T −2 t=0 ) ≤ CR2T γ2W . (34) 18 REGRET ANALYSIS OF ONLINE LQR CONTROL Proof Substituting (32) into (33) with ̄x0 = 0 and θi|p,q := xi|p − xi|q, we have that E((cid:107)xt|t+W − x∗ t (cid:107)2) = E((cid:107)θt|t+W,T −1(cid:107)2) (cid:18) t−1 t−1 (cid:89) (cid:88) n−1 (cid:88) ≤ E((cid:107) (A + BKm|t+W ) (cid:19) B(Kn|t+W − K∗ n) n=0 (cid:18) n−1 (cid:89) r=0 m=n+1 (cid:19) (A + BK∗ j ) wr(cid:107)2) j=r+1 (35) ≤ (C2CK)2γ2W η2tγ2t η2 t−1 (cid:88) t−1 (cid:88) n1−1 (cid:88) n2−1 (cid:88) n1=0 n2=0 r1=0 r2=0 E(wr1wT r2) γn1+n2ηr1+r2 := κwθ where κwθ = γ2W (Cκwθ +Lκwθ (ηt, γt, η2t, γ2t)), Cκwθ is a non-negative scalar and Lκwθ (ηt, γt, η2t, γ2t) is a linear combination of ηt, γt, η2t and γ2t. Following the same steps as in the proof of Lemma 10 in Appendix A, we have E((cid:107)xt − x∗ t (cid:107)2) ≤ E((cid:107) t−1 (cid:88) i−1 (cid:88) n−1 (cid:88) (A + BK)t−i (cid:18) i−1 (cid:89) (A + BKm|i−1+W ) (cid:19) i=1 n=0 r=0 m=n+1 B(Kn|i−1+W − K∗ n) (cid:18) n−1 (cid:89) (cid:19) (A + BK∗ j ) wr(cid:107)2) ≤ κwθ + 2(C2CK)2η2t (cid:124) j=r+1 t−1 (cid:88) t−1 (cid:88) t−1 (cid:88) t−1 (cid:88) n1−1 (cid:88) n2−1 (cid:88) i1=1 i2=1 n1=0 r2=0 r1=0 n2=0 (cid:123)(cid:122) κwx:= E(wr1wT r2))γi1+i2−n1−n2 ηr1+r2 (cid:125) (36) (37) and E((cid:107)x∗ t (cid:107)2) ≤ E((cid:107) t−1 (cid:88) (cid:18) t−1 (cid:89) (cid:19) (A + BK∗ j ) wr(cid:107)2) r=0 j=r+1 ≤ C4 t−1 (cid:88) t−1 (cid:88) r1=0 r2=0 E(wr1wT r2)η2t−r1−1η2t−r2−1 := κwx∗ where again κwx and κwx∗ are of the form γ2W (Cκwx + Lκwx(ηt, γt, η2t, γ2t)) and Cκwx∗ + Lκwx∗ (ηt, γt, η2t, γ2t), respectively, where Cκwx, Cκwx∗ are constants, Lκwx(ηt, γt, η2t, γ2t) and Lκwx∗ (ηt, γt, η2t, γ2t) are linear combinations of ηt, γt, η2t and γ2t. 19 REGRET ANALYSIS OF ONLINE LQR CONTROL Recall α1, α2 and D defined in Theorem 1. Similar to the proof of Theorem 1, there exist a positive scalar CR2 that the expected regret satisfies ExpectedRegretT ({ut}T −2 t=0 ) ≤ 10D 3 T −1 (cid:88) (α1 E((cid:107)xt|t+W − x∗ t (cid:107)2) + α2 E((cid:107)xt − x∗ t (cid:107)2) t=0 + C2 t (cid:107)2)) Kγ2W E((cid:107)x∗ T −1 (cid:88) ≤ 10D 3 t=0 (α1κwθ + α2κwx + C2 Kγ2W κwx∗) (38) ≤ CR2T γ2W . where the last inequality holds by substituting (35), (36), and (37) into (31). Lemma 14 For any ̄x0 ∈ Rn, consider the system define in (1) has initial condition of ̄x0. Suppose t ) = Wd for a Wd ∈ Sn that for any t > 0, E(wt) = 0, E(wtwT +. At any time t, disturbance sequence {wk}t t=0 denote the sequence that generate by control policy (14) under the constrain of (1). We have k=0 is available to the decision maker. Let {ut}T −2 ExpectedRegretT ({ut}T −2 t=0 ) ≤ RHS of inequality (15) + RHS of equality (34). Proof Let κθ, κω, κx, κx∗, and Fexp denote the RHS of (23), (24), (36), (30) and (34), respectively. Note that E((cid:107)xt|t+W − x∗ t (cid:107)2) = E((cid:107)θt|t+W,T −1(cid:107)2) t−1 (cid:88) (cid:18) t−1 (cid:89) ≤ E((cid:107) (A + BKm|t+W ) (cid:19) B(Kn|t+W − K∗ n)x∗ n(cid:107)2) n=0 m=n+1 t−1 (cid:88) (cid:18) t−1 (cid:89) ≤ E((cid:107) (A + BKm|t+W ) (cid:19) B(Kn|t+W − K∗ n) n=0 m=n+1 (cid:20) n−1 (cid:89) (A + BK∗ j ) ̄x0 + n−1 (cid:88) (cid:18) n−1 (cid:89) (cid:19) (A + BK∗ j ) wr (cid:21) (cid:107)2) j=0 r=0 j=r+1 (cid:19) t−1 (cid:88) (cid:18) t−1 (cid:89) ≤ (cid:107) (A + BKm|t+W ) B(Kn|t+W − K∗ n) n−1 (cid:89) (A + BK∗ j ) ̄x0(cid:107)2 n=0 m=n+1 t−1 (cid:88) n−1 (cid:88) (cid:18) t−1 (cid:89) + E((cid:107) (A + BKm|t+W ) (cid:19) n=0 r=0 m=n+1 B(Kn|t+W − K∗ n) (cid:18) n−1 (cid:89) (A + BK∗ j ) (cid:19) wr(cid:107)2) j=0 ≤ κθ + κwθ. j=r+1 20 (39) REGRET ANALYSIS OF ONLINE LQR CONTROL Similarly, E((cid:107)xt − x∗ t (cid:107)2) ≤ 2 E((cid:107)xt − xt|t+W (cid:107)2 + (cid:107)xt|t+W − x∗ t (cid:107)2) ≤ 2(κwθ + κθ) + 2 E((cid:107) t−1 (cid:88) i=1 (A + BK)t−iθi|i−1+W,i+W (cid:107)2) t−1 (cid:88) i−1 (cid:88) ≤ 2 E( (A + BK)t−i (cid:18) i−1 (cid:89) (A + BKm|i−1+W ) (cid:19) i=1 n=0 B(Kn|i−1+W − K∗ i−1 (cid:88) t−1 (cid:88) ≤ 2 E((cid:107) (A + BK)t−i m=n+1 n) + 2(κwθ + κθ) n)x∗ (cid:18) i−1 (cid:89) (A + BKm|i−1+W ) B(Kn|i−1+W − K∗ n) (cid:19) i=1 n=0 m=n+1 n−1 (cid:89) (A + BK∗ j ) ̄x0 + n−1 (cid:88) (cid:18) n−1 (cid:89) (cid:19) (A + BK∗ j ) wr(cid:107)2) + 2(κwθ + κθ) j=0 r=0 j=r+1 ≤ 2(κwθ + κθ) + 2(κω t−1 (cid:88) n−1 (cid:88) i−1 (cid:88) + E((cid:107) (A + BK)t−i (cid:18) i−1 (cid:89) (A + BKm|i−1+W ) (cid:19) i=1 n=0 r=0 B(Kn|i−1+W − K∗ n) (cid:18) n−1 (cid:89) m=n+1 (cid:19) (A + BK∗ j ) wr(cid:107)2) ≤ 2(κwθ + κθ) + 2(κω j=r+1 + (C2CK)2η2t t−1 (cid:88) t−1 (cid:88) t−1 (cid:88) t−1 (cid:88) n1−1 (cid:88) n2−1 (cid:88) i1=1 i2=1 n1=0 n2=0 r1=0 r2=0 E(wr1wT r2))γi1+i2−n1−n2 ηr1+r2 ) ≤ κx + κwx, the second step to the third step of inequality is by substituting (32) in (33). Moreover, E((cid:107)x∗ t (cid:107)2) ≤ E((cid:107) t−1 (cid:89) (A + BK∗ j ) ̄x0 + t−1 (cid:88) (cid:18) t−1 (cid:89) (A + BK∗ j ) (cid:19) wr(cid:107)2) j=0 r=0 j=r+1 t−1 (cid:89) ≤ (cid:107) (A + BK∗ j ) ̄x0(cid:107)2 + E((cid:107) t−1 (cid:88) (cid:18) t−1 (cid:89) (cid:19) (A + BK∗ j ) wr(cid:107)2) (40) (41) j=0 ≤ κx∗ + κwx∗. r=0 j=r+1 Substituting (39), (40) and (41) into (31), we have ExpectedRegretT ({ut}T −2 t=0 ) ≤ T −1 (cid:88) (α1 E((cid:107)xt|t+W − x∗ t (cid:107)2) 10D 3 t=0 + α2 E((cid:107)xt − x∗ t (cid:107)2) + C2 Kγ2W E((cid:107)x∗ t (cid:107)2)) 21 REGRET ANALYSIS OF ONLINE LQR CONTROL α1(κ1 + κθ) + α2(κx + κwx) T −1 (cid:88) ≤ 10D 3 t=0 + C2 ≤ F + Fexp. Kγ2W (κwx∗ + κx∗) Now, we are ready to proof Theorem 5. Proof Based on the expression of F and Fexp from Theorem 1 and Lemma 13, there exist positive scalars CR1 and CR2, such that F ≤ γ2W CR1 and Fexp ≤ γ2W T CR2 for T ≥ 2 and 0 ≤ W ≤ T − 2. By Lemma 14, for the control sequence {ut}T −2 t=0 generated by control policy (14), we have ExpectedRegretT ({ut}T −2 t=0 ) ≤ F + Fexp ≤ γ2W (CR1 + CR2T ). Let CER = CR1 + CR2, we have ExpectedRegretT ({ut}T −2 t=0 ) ≤ γ2W CERT. 22
http://arxiv.org/abs/2302.10409v1
2023-02-21T02:44:50
2023-02-21T02:44:50
Mean Parity Fair Regression in RKHS
We study the fair regression problem under the notion of Mean Parity (MP) fairness, which requires the conditional mean of the learned function output to be constant with respect to the sensitive attributes. We address this problem by leveraging reproducing kernel Hilbert space (RKHS) to construct the functional space whose members are guaranteed to satisfy the fairness constraints. The proposed functional space suggests a closed-form solution for the fair regression problem that is naturally compatible with multiple sensitive attributes. Furthermore, by formulating the fairness-accuracy tradeoff as a relaxed fair regression problem, we derive a corresponding regression function that can be implemented efficiently and provides interpretable tradeoffs. More importantly, under some mild assumptions, the proposed method can be applied to regression problems with a covariance-based notion of fairness. Experimental results on benchmark datasets show the proposed methods achieve competitive and even superior performance compared with several state-of-the-art methods.
[ "Shaokui Wei", "Jiayin Liu", "Bing Li", "Hongyuan Zha" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10409v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10409v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "stat.ML", "@scheme": "http://arxiv.org/schemas/atom" }
[ "stat.ML", "cs.LG" ]
Mean Parity Fair Regression in RKHS 3 2 0 2 b e F 1 2 ] L M . t a t s [ 1 v 9 0 4 0 1 . 2 0 3 2 : v i X r a Shaokui Wei Shenzhen Research Institute of Big Data The Chinese University of Hong Kong, Shenzhen Jiayin Liu School of Management and Economics The Chinese University of Hong Kong, Shenzhen Bing Li Department of Statistics Pennsylvania State University Hongyuan Zha School of Data Science The Chinese University of Hong Kong, Shenzhen Abstract We study the fair regression problem under the notion of Mean Parity (MP) fairness, which re- quires the conditional mean of the learned func- tion output to be constant with respect to the sen- sitive attributes. We address this problem by lever- aging reproducing kernel Hilbert space (RKHS) to construct the functional space whose mem- bers are guaranteed to satisfy the fairness con- straints. The proposed functional space suggests a closed-form solution for the fair regression prob- lem that is naturally compatible with multiple sensitive attributes. Furthermore, by formulating the fairness-accuracy tradeoff as a relaxed fair regression problem, we derive a corresponding regression function that can be implemented effi- ciently and provides interpretable tradeoffs. More importantly, under some mild assumptions, the proposed method can be applied to regression problems with a covariance-based notion of fair- ness. Experimental results on benchmark datasets show the proposed methods achieve competitive and even superior performance compared with several state-of-the-art methods. 1 INTRODUCTION As Machine Learning (ML) algorithms have been increas- ingly applied to solve real-world problems, such as employ- ment (Kodiyan, 2019), finance (Anshari et al., 2021), and healthcare (Gupta and Mohammad, 2017), the biases ex- hibited by ML are attracting attention from both industry Proceedings of the 26th International Conference on Artificial Intel- ligence and Statistics (AISTATS) 2023, Valencia, Spain. PMLR: Volume 206. Copyright 2023 by the author(s). and academia. Algorithmic fairness has therefore emerged as a new frontier for ML, of which the critical challenge is to design algorithms satisfying fairness constraints, thus mitigating or eliminating the potential discrimination on the basis of legally protected (sensitive) attributes such as race or gender. In recent years, substantial efforts on notions and algorithms of fairness in ML have generally centered on classification problems (Agarwal et al., 2018; Calders and Verwer, 2010; Huang and Vishnoi, 2019; Jiang et al., 2020; Zafar et al., 2019), while the problems of fair regression have received much less attention. In this paper, we focus on the general regression problem in reproducing kernel Hilbert spaces (RKHS) and propose a novel approach for fair regression by constructing the space of functions that satisfy the constraints of fairness. Specifically, we consider the unfairness in the mean re- sponses across different groups. Such unfairness exists broadly in many real-life problems including wage/payment gap (Oettinger, 1996; Barroso and Brown, 2021), employ- ment inequality (Center, 2016) and educational inequality (Darling-Hammond, 1998; Baker et al., 2014). To mitigate such unfairness, we adopt the Mean Parity (MP) fairness, a notion of group fairness aiming to achieve "equality on average", i.e., the average response of a regression function to the different groups is the same. By establishing the connection between the covariance op- erator and MP fairness, we show that the MP-fair functional space can be characterized by a set of orthonormal bases and derive a closed-form solution that minimizes the mean squared error (MSE). Under some mild assumptions, the proposed method can also be applied to regression problems subject to fairness criterion that urges the outcome of the regression function to be uncorrelated with the sensitive attributes. In addition, the proposed method is naturally compatible with multiple sensitive attributes and can be extended to a broad range of loss functions for regression using optimization techniques, e.g., gradient descent. Mean Parity Fair Regression in RKHS As it has been empirically observed that the fair model may suffer from a reduction in accuracy (Berk et al., 2017; Tan et al., 2020), we further generalize our method to consider the tradeoff between fairness and accuracy. By formulating the fairness-accuracy tradeoff as a relaxed fair regression problem, we derive a closed-form solution which is a simple combination of the optimal fair solution and the optimal least-squares solution, controlled by a single parameter. The proposed relaxed solution allows users to quantify and con- trol the cost of fairness in terms of MSE and enjoys good interpretability. Finally, we evaluate our methods on three real datasets and one synthetic dataset. The experimental results demonstrate that our solution can eliminate the dis- crimination in train data and effectively enforce fairness in test data. Also, experiments on the fairness-accuracy tradeoff show that our method performs on par with other approaches and provides precise control over MSE and fair- ness levels. Paper organization. The rest of the paper is organized as follows. Section 2 introduces notations and the formulation of our problem. In Section 3, we study the characterization of fair functional space in RKHS and provide a functional solution to the fair regression problem, after which we dis- cuss the tradeoff between fairness and accuracy. Section 4 presents some empirical evaluations of our methods. We discuss some related works in Section 5 and end with some conclusions and future directions in Section 6. The proofs, derivations, implementation details, and some additional experiments are left in Appendix. 2 PRELIMINARIES 2.1 Notations F F X ) and (ΩY , F Y is the Borel σ-filed on ΩY . Let ΩS = We first introduce some important notations and a more comprehensive table of notations can be found in Appendix , P) be a probability space. We consider the F. Let (Ω, random variables X and Y defined on measurable spaces Y ) where ΩY is a subset of R and (ΩX , k j=1 be F a finite set of k elements from which a random variable S takes values. We set X, S and Y to be the random variables for non-sensitive attributes, sensitive attributes and label/response respectively. In addition, we assume that P(s) > 0 for all s s(j) { ΩS. } × × → → X , i.e., φX (x) = κX ( R be a discrete kernel. We use R be a universal kernel and κS : Let κX : ΩX X to represent ΩS ΩS the RKHS generated by κX and denote its feature map by , x). Similarly, let φX : ΩX * S be the RKHS generated by κS with feature map φS. Let XS be the RKHS generated by the kernel κXS defined ΩS. Then, each H H on ΩXS × member of ΩS, and we denote the feature map of XS is a function g(x, s) where x ΩXS where ΩXS = ΩX ∈ XS by φXS. By ΩX , s → H H H × ∈ ∈ ΩX H the reproducing property of g XS at (x, s) can be written as H ∈ H XS, evaluating a function g(x, s) = φXS(x, s), g (cid:104) XS is the inner product in , XS (cid:105)H *(cid:105)H , (cid:104)* XS, we denote its orthogonal complement in ⊆ H where M H by M ⊥ such that M ⊥. Moreover, let XS = M represent the independence between random variables. XS. For a space XS ⊥⊥ H H ⊕ 2.2 Notions of fairness Our goal is to find the optimal fair regression function in XS that minimizes the mean squared error while main- XS, we consider the H taining fairness. For a function g Mean Parity 1 fairness, as defined below: ∈ H Definition 1 (Mean Parity). The subset fined by M P of G H XS de- M P = G g { XS : E [g(X, S) ∈ H S] = E [g(X, S)] } | is called the Mean Parity fair (MP-fair) class of functions. The above definition says that a function g is MP fair if the expectation of g(X, S) conditioning on S is constant across all sensitive groups. Besides MP-fairness, there are several other ways of defin- ing fairness. Here, we highlight the connection and dis- tinction between MP fairness and the other two notions of fairness. Demographic Parity (DP) fairness. A popular require- ment for fairness is g(X, S) S, i.e., the distribution of g(X, S) conditioning on S is the same, and the class of such functions is called Demographic Parity fair class (Feldman et al., 2015). ⊥⊥ To establish the relationship between MP fairness and DP fairness, we provide the following proposition: Proposition 1. Assume that the DP disparity (DPD) and the MP disparity (MPD) of function g are measured by DPD(g) = MPD(g) = (cid:88) s ΩS ∈ (cid:88) ΩS s ∈ S = s, g(X, S)) W1(g(X, S) | E(g(X, S) | S = s) | − E(g(X, S)) | where Volkmer, 2021) . W1 is the 1-Wasserstein distance (Frohmader and Then, MPD(g) DPD(g). ≤ 1also known as Mean Difference (Calders et al., 2013; ˇZliobait ̇e, 2017), Mean Distance (Komiyama and Shimao, 2017) or Discrim- ination Score (Calders and Verwer, 2010; Zemel et al., 2013; Raff et al., 2018). Shaokui Wei, Jiayin Liu, Bing Li, Hongyuan Zha Therefore, MP disparity is the lower bound of DP dispar- ity and achieving MP fairness is necessary to achieve DP fairness. Moreover, for binary classification problem with a binary S, MP fairness is equivalent to DP fairness. Covariance based (CB) fairness. Another widely used condition for fairness is the Covariance based (CB) fair- ness (Komiyama et al., 2018; Mary et al., 2019; P ́erez-Suay et al., 2017; Scutari et al., 2021), which requires the out- put of g to be uncorrelated with the sensitive attribute, i.e., Cov(g(X, S), S) = 0. By the definition of covariance, we can conclude that MP fairness implies that g(X, S) is uncorrelated with S. Thus, an MP-fair regression function is always CB-fair. More- over, MP fairness is equivalent to CB fairness under some assumptions, which will be discussed later. 2.3 Problem formulation Now, we introduce the formulation for the MP-fair regres- sion problem. Consider the general regression model Y = g(X, S) + (cid:15), XS and X, S are independent of the centered where g random noise (cid:15) ∈ H R and E(Y 2) . ≤ ∞ ∈ Then, we focus on the least-squares MP-fair regression task formulated as a constrained optimization problem S. Then, we define the covariance operator between S H and (X, S) as where ΣS(XS) = E [(φS(S) μS) (φXS(X, S) μXS)] , − represents the outer product in RKHS. ⊗ − ⊗ To characterize M P , we present the following assumption. Assumption 1. Assume that the following system of equa- tions G k (cid:88) j=1 ηj(φS(s(j)) − μS) = 0 S , H k (cid:88) j=1 ηj = 0 (2) ∈ { 1, . . . , k has exactly one solution, i.e., ηj = 0 for all j . } Note that the choice of κS can be independent of κXS and κX . Since the cardinality of ΩS is finite, Assumption 1 is quite mild. A typical choice for κS is to have linearly k φS(s(j)) j=1. For example, a poly- independent features { } nomial kernel with degree k 1 would satisfy Assumption R. The proof is given in Appendix C.4. 1 for ΩS − ⊂ Then, the following theorem provides insight into the char- acterization of Theorem 1. Under Assumption 1, operator ΣS(XS), that is, M P is the kernel of the M P . G G M P = ker(ΣS(XS)). G Based on Theorem 1, M P can be found using the relation G ker(ΣS(XS)) = ran(Σ(XS)S)⊥, g(X, S))2 min g E (Y s.t. g ∈ G − M P . (1) where ran(Σ(XS)S) can be characterized by the generalized eigenvalue problem (Hoegaerts et al., 2005; Sch ̈olkopf et al., 1998; Yuan and Cai, 2010). 3 FAIR REGRESSION UNDER MEAN PARITY G M P within In this section, we discuss how to solve Problem 1. To do so, we first develop a theory to characterize the MP-fair class XS. After that, we derive a closed- form solution by employing a projection operator P from M P and introduce a formulation to control the H fairness-accuracy tradeoff. At last, we discuss the perfor- mance guarantees of the derived solution and how to solve the MP-fair regression problem with other loss functions. XS onto H G 3.1 Characterization of MP-fair function space We begin by introducing some concepts. For Hilbert spaces H2 and a linear operator A : H1 → H2, we define the H1, kernel of A by ker(A) = ∈ H1 : Af = 0 f where { H2. Let ran(A) represent the 2 is the zero function in 0 H , which is the range of A. Let μXS set ∈ H1} be the kernel mean embedding of (X, S) in XS, which H is defined as μXS = E [κXS ( , (X, S))]. Similarly, let * μS = E [κS( , S)] be the kernel mean embedding of S in * Af : f { 2} H H S has finite dimension, Σ(XS)S is a finite rank op- Since erator. Let us say its rank is m S → H be any positive definite linear operator. Then, the first m eigenfunctions of Σ(XS)SAΣS(XS), say, θ1, . . . , θm, span ran(Σ(XS)S), that is, k. Let A : S H ≤ ker(ΣS(XS)) = span( θ1, . . . , θm { M P can be characterized by a set of eigenfunctions which allows us to construct an orthogonal )⊥. } Thus, G θ1, . . . , θm { } projection operator P from G H Denote a set of orthonormal bases of ran(Σ(XS)S) by , θ(cid:48)m} θ(cid:48)1, XS, the orthogonal { XS onto ran(Σ(XS)S)⊥ elimi- projection operator from nates the components of g in ran(Σ(XS)S). Thus, we can construct the following orthogonal projection operator . Given a function g ∈ H * * * H XS to M P . P = I m (cid:88) j=1 − θ(cid:48)j ⊗ θ(cid:48)j, where I : XS H XS is the identity operator. → H For simplicity, the detailed process to estimate P from a given dataset is left to Appendix B. Mean Parity Fair Regression in RKHS Remark. Consider the general CB fairness that seeks to remove the correlation between the sensitive feature map used for prediction and the predicted value. By the observa- tion that Cov(φS(S), g(X, S)) = ΣS(XS)g, ker(ΣS(XS)) is the space whose members are CB fair under the assump- tion that κXS is composed of κS and κX , e.g., κXS = κX + κS. Therefore, the results in the rest of this paper, except the interpretation of tradeoffs, can also be applied to fair regression with CB constraints. The detailed discussion is left to Appendix C.1. In particular, if both the above assumption and Assumption 1 are satisfied in XS, MP fairness is equivalent to CB fairness. H 3.2 Optimal fair regression function To find the optimal fair regression function, we introduce the optimality condition for Problem 1. Lemma 1. A function g∗ G 1 if and only if is an optimal solution for Problem E(Y g(X, S)) = E(g(X, S)g∗ G (X, S)) g ∀ M P . ∈ G By introducing the uncentralized covariance operator ̃Σ(XS)(XS) = E [(φXS(X, S) (φXS(X, S))] and a func- tion h = E(φXS(X, S)Y ), Lemma 1 tells us that g∗ is an G optimal solution for Problem 1 if and only if ⊗ h, g (cid:104) XS = ̃Σ(XS)(XS)g∗ G , g (cid:104) (cid:105)H ∈ G Given an orthogonal projection operator P from where g∗ H M P , a key insight is that g∗ G G obtained by solving the following problem = P g∗ H (cid:105)H XS g ∀ M P . XS to can be H XS = P h, g (cid:104) So, we reach the Proposition 2. P ̃Σ(XS)(XS)P g∗ H (cid:105)H (cid:104) , g XS (cid:105)H g ∀ XS, ∈ H Proposition 2. The optimal MP-fair regression function to Problem 1 is = P [P ̃Σ(XS)(XS)P ]†P h, g∗ G (3) where ( * (Groetsch, 1977; Wang et al., 2018). )† is the Moore-Penrose Inverse of an operator Note that if P is an identity operator, the solution 3 reduces = [ ̃Σ(XS)(XS)]†h, which is the least-squares regres- to g∗ G sion function in XS. H 3.3 Tradeoff between accuracy and fairness There are multiple ways of relaxing the MP-fair con- straint to control the accuracy-fairness tradeoff. One group of relaxed constraints is imposed on the overall unfairness, e.g., MPD(g) β ≤ for some positive real number β, but such constraints ignore the unfairness for individual group, which weak- ens their interpretability. Another group of relaxed ΣS(XS)g (cid:107) S ≤ β or (cid:107)H constraints is imposed on each sensitive group, from which we employ the following relaxed constraint − E(g∗(X, S))] E(g(X, S) S) | − E(g(X, S)) = α [E(g∗(X, S) S) | ∈ H (4) where g∗ is the least-squares regression function in XS and α [0, 1] is a scalar to control the level of unfairness. A larger α results in a higher level of unfairness and g is MP-fair if α = 0. Thus, the constraint 4 allows us to scale the unfairness of the least-squares regression function for each group by a scalar α and therefore provides good interpretability. More importantly, we will show that constraint 4 provides precise control of the accuracy-fairness tradeoff later. To move forward, we present the immediate corollary from Theorem 1. Corollary 1. Given g1, g2 ∈ H 1, E(g1(X, S) E(g1(X, S)) = E(g2(X, S) S) S) | | E(g2(X, S)) if and only if ΣS(XS)g1 = ΣS(XS)g2. XS, under Assumption − − By Corollary 1, it suffices to consider the following relaxed fair regression problem min E(Y s.t. ΣS(XS)g = αΣS(XS)g∗. g(X, S))2 − (5) G H M P XS = ⊥M P , a function g As ⊕ G written as g = gM P + gM P ⊥ where gM P gM P ⊥ to solving the Problem 5. XS can be M P and ⊥M P . Then, the following proposition is the key ∈ H ∈ G ∈ G Proposition 3. A function g ΣS(XS)g∗ if and only if gM P ⊥ = g∗M P ⊥ . ∈ H XS satisfies ΣS(XS)g = By Proposition 3, the optimal solution gα for Problem 5 is of the form gα = gα M P is the optimal solution to the following fair regression problem M P + αg∗M P ⊥ , where gα min M P ∈G g E (Y − αg∗M P ⊥(X, S) − g(X, S))2 . (6) + αg∗ Solving Problem 6 gives the following proposition. Proposition 4. The optimal solution of Problem 5 is gα = (1 α)g∗ G Let L(g) = E((Y g(X, S))2). By Proposition 4, the following equations allow us to precisely control the tradeoff between fairness and accuracy − − L(gα) = (1 α)2L(g∗ G ) + (1 (1 − − α)2)L(g∗) − MPD(gα) = αMPD(g∗). Remark. The detailed derivation for this subsection can be found in Appendix C.2. When MPD(g∗) > 0, the above equations indicate that L(gα) is a quadratic function of MPD(gα). Shaokui Wei, Jiayin Liu, Bing Li, Hongyuan Zha 3.4 Performance guarantee Besides the explicit expression, the optimal regression func- tion g∗ also enjoys a theoretical performance guarantee with G respect to MSE. Proposition 5. Under Assumption 1, the MSE of g∗ G bounded by is L(g∗ G ) ≤ L(g∗) + (cid:104) ̃Σ(XS)(XS)g∗M P ⊥ , g∗M P ⊥ where g∗ is the optimal regression function in XS , (cid:105)H XS. H In Proposition 5, the inequality can be obtained by in- troducing a non-optimal fair regression function P g∗. Note that g = 0 XS is always a fair regression, so E(Y 2). Since the term we can claim that L(g∗ ) ≤ G ̃Σ(XS)(XS)g∗M P ⊥, g∗M P ⊥ (cid:105)H XS measures the violation of (cid:104) fairness constraints by g∗, Proposition 5 shows that the MSE of fair regression function is bounded and the upper bound is related to the unfairness level of g∗. H 3.5 Extension So far we only consider the fair regression with squared loss function. However, the proposed method can also be applied to other differentiable loss functions in practice. Given a differentiable loss function (cid:96) and the training dataset = n xi, si, yi i=1, we consider the following fair regression { } problem D ˆg∗ G = arg min M P g ∈G (cid:88) i (cid:96)(yi, g(xi, si)). (7) By the Representer theorem (Sch ̈olkopf et al., 2001), the above problem is to find w∗ G that minimizes the following objective function subject to ΦXSw∗ G ∈ G M P J(w) = n (cid:88) i=1 (cid:96) (yi, φXS(xi, si), ΦXSw (cid:104) XS ) , (cid:105)H where ΦXS is the feature matrix of the training data. Given an estimated projection operator ˆP , we can first find w H = arg min w n (cid:88) i=1 (cid:96)(yi, (cid:104) φXS(xi, si), ˆP ΦXSw XS ) (cid:105)H by optimization techniques, e.g., gradient descent. Then, the solution to Problem 7 is ˆg∗ G = ˆP ΦXSw . H 4 EXPERIMENTS We adapt the experiment settings in Agarwal et al. (2019) to evaluate the proposed method on simulated and real-world datasets. The datasets are summarized below: (xi, si, yi) { n Synthetic dataset has n data points i=1 with } d-dimension non-sensitive attributes and e-dimension sen- sitive attributes. Specifically, we first generate xi (d+e)) and (cid:15)i ∼ (0d+e, I(d+e) ∼ N noise). Then, si is sampled uniformly at random N e. Next, we set yi = [xi, si]T w + (cid:15)i for 0.1, from linear regression and yi = sin([xi, si]T w) + (cid:15)i for nonlin- ear regression (kernel regression case). (0d, Id (0, ρ2 0.1 } d), w ∼ N − { × × Adult dataset (Kohavi et al., 1996) has 48,842 samples with 14 attributes. We aim to predict the probability that an individual's income exceeds $50k per year while we keep gender as the sensitive attribute. Our experiments evaluate all methods on a subset of the Adult dataset with 2,000 random samples. Law School dataset (Wightman, 1998) refers to the Law School Admissions Council's National Longitudinal Bar Passage Study with 20,649 samples. We aim is to predict a student's GPA (normalized to [0, 1]) while we keep race as the sensitive attribute. We convert the original race attributes to a single binary attribute, i.e., white or non-white. Our experiments evaluate all methods on a subset of the Law School dataset with 2,000 random samples. Communities & Crime (C&C) dataset (Redmond and Baveja, 2002) combines socio-economic, law enforcement, and crime data about communities in the US with 1,994 samples. We aim to predict the number of violent crimes per 100,000 population (normalized to [0, 1]) while we keep race as the sensitive attribute (whether the majority population of the community is white). In all experiments, we measure the loss of function g by the empirical MSE and the MP disparity by the sum of absolute mean difference (SMD) which is the empirical estimation of MPD(g) as defined below (cid:12) (cid:12) (cid:12) (cid:12) k (cid:88) (cid:80)n i=1 g(xi, si)I(si = s(j)) (cid:80)n j=1 I(si = s(j)) i=1 ) is the indicator function. SMD(g) = where I( * (cid:80)n i=1 g(xi, si) n (cid:12) (cid:12) (cid:12) (cid:12) , − For all datasets, we split the data into two parts, i.e., 80% for training and 20% for testing. We discuss the experi- ments on MP fairness in this section and postpone exper- iments on CB fairness, DP fairness and regression with other loss functions to Appendix E. The code is available at https://github.com/shawkui/MP Fair Regression. 4.1 Regression with single binary sensitive attribute We first consider regression with single binary sensitive attribute. We claim that MP fairness is equivalent to CB fairness in this setting with proof in Appendix A.7, which allows us to compare the proposed method against the state-of-the-art (SOTA) CB-fair algorithms for regression. Specifically, we compare our method with the ordinary least squares method (OLS), Fair Penalty Regression method Mean Parity Fair Regression in RKHS Figure 1: Results of linear regression with single binary sensitive attribute. Figures in the first row show the MSE of different methods, whereas the figures in the second row show the SMD of different methods. The legends FKR-1 and FKR-3 stand for FKR method with regularizer coefficients 10 and 1,000 respectively. Similarly, FPR-1 and FPR-3 stand for FPR method with regularizer coefficients 10 and 1,000 respectively. We also show the experiment results for kernel regression in Appendix E.1. (FPR), Fair Kernel Learning method (FKR, P ́erez-Suay et al. (2017)), and Nonconvex Regression with Fairness Con- straints method (NRFC, Komiyama et al. (2018)) in terms of MSE and SMD, where FKR and NRFC are the SOTA al- gorithms designed for CB fairness. For regularization-based methods, i.e., FPR and FKR, we evaluate them twice with regularization coefficients 10 (FPR-1, FKR-1) and 1, 000 (FPR-3, FKR-3) respectively. More details of the baselines and experiment settings can be found in Appendix D.1. The experiment results are summarized in Figure 1, from which we see that the proposed method can consistently enforce the MP-fair constraint, and its performance is supe- rior to regularization-based methods and competitive with NRFC. Notably, our method can completely remove the algorithmic discrimination on conditional mean for train data. Supplemental Figure 5 shows our method achieves a smaller MSE than NRFC in kernel regression when both of them reach MP-fairness in train data. 4.2 Tradeoff between fairness and accuracy Figure 2: Results of the fairness-accuracy tradeoff. The first row presents the experiment results for train data whereas the second row shows the experiment results for test data. We now test the proposed method in Section 3.3 on control- ling the accuracy-fairness tradeoff, following the setting in Section 4.1. Note that different baselines adopt different metrics and no- tions for such tradeoff and we only evaluate them in terms of MSE and SMD. For this purpose, we test the regularization- based methods with fairness regularizer coefficients from 0 to 106 while for NRFC and the proposed method, we evaluate them with the fairness level parameters from 0 to 1. The curves of the fairness-accuracy tradeoff are shown in Figure 2. As discussed in Section 3.3, the MSE climbs when stricter fairness constraints are imposed. In Figure 2, the curve of our method coincides with the curves of FKR and FPR, and performs better than the curve of NRFC. When SMD is approaching 0, all methods receive almost the same MSE while NRFC has a higher MSE than other methods on the Communities & Crime dataset when weaker fairness constraints are imposed. A similar pattern can be found TrainTest246MSE1e−2SyntheticTrainTest1.21.41.61.81e−1AdultTrainTest0.80.91.01.11e−2Law SchoolTrainTest231e−2C&CTrainTest0.02.55.07.5SMD1e−1TrainTest0121e−1TrainTest0241e−2TrainTest01231e−1OLSFKR-1FKR-3FPR-1FPR-3NRFCOurs1234MSE×10−201234SMD×10−1Synthetic(Train)ModelFKRFPRNRFCOurs2.02.53.0MSE×10−20123SMD×10−1Community&Crime(Train)ModelFKRFPRNRFCOurs12345MSE×10−24567SMD×10−1Synthetic(Test)ModelFKRFPRNRFCOurs2.002.252.502.753.00MSE×10−2123SMD×10−1Community&Crime(Test)ModelFKRFPRNRFCOurs Shaokui Wei, Jiayin Liu, Bing Li, Hongyuan Zha Figure 3: Results of linear regression on Communities & Crime dataset with multiple binary sensitive attributes. Figures in the first row show the MSE of different methods whereas the figures in the second row show the SMD of different methods. The experiment on kernel regression shows similar results in Appendix E.1. in supplemental Figure 7 but NRFC and FKR achieve a slightly smaller test MSE sometimes. Although the curves are similar, our method enjoys better explainability and much lower complexity. Unlike other methods which need to solve the regression problem for each level of fairness, our method only solves the regression problem twice and produces a precise tradeoff between fairness and accuracy. 4.3 Regression with multiple sensitive attributes As aforementioned, our method can be naturally generalized to regression with multiple sensitive attributes as long as κS satisfies Assumption 1. In this experiment, we set κS to be a polynomial kernel and choose multiple binary sensitive attributes on the Communities & Crime dataset. The number of sensitive groups is k = 2r where r is the number of binary sensitive attributes. In this case, we consider only two baselines: FPR and the OLS since MP-fairness may be not equivalent to CB fairness. Figure 3 depicts the MSE and SMD for different numbers of sensitive attributes, from which we can see that our method can enforce fairness with different numbers of sensitive attributes. 4.4 Distribution of MP-fair response In this section, we visualize the distribution of response Y and the predicted response ˆY produced by our method on MP-fair regression problem to demonstrate the effect of MP-fairness. Specifically, we consider linear regression with single binary sensitive attribute S 0, 1 . Note that } to test our method on an extreme case, the synthetic dataset is generated following the linear regression setting with ∈ { Figure 4: Visualization of centralized response distribution. Both the normalized histograms (bins) and the estimated density (curves) are reported. Figures in the first row show the conditional distribution of response in the test dataset while the figures in the second row show the corresponding conditional distribution of the MP-fair predicted response. sensitive attribute drawn from uniformly so that the distributions of response in two groups are significantly different. 10, 10 } {− The results of the Synthetic test dataset and the Adult test dataset are summarized in Figure 4, from which we can see that the distribution of ˆY conditioning on the sensitive attribute S are similar to each other. This observation agrees with the experiment results in Appendix E.4 which says TrainTest234MSE1e−2k = 2TrainTest2341e−2k = 4TrainTest2341e−2k = 8TrainTest23451e−2k = 16TrainTest0123SMD1e−1TrainTest02461e−1TrainTest0.00.51.0TrainTest01OLSFPR-1FPR-3Ours−10010Response0.000.050.100.150.20DensitySyntheticS=1S=0−0.50.00.51.0Response051015AdultS=1S=0−505Prediction0.000.050.100.150.20DensityS=1S=0−2−101Prediction0.00.51.01.52.0S=1S=0 Mean Parity Fair Regression in RKHS that enforcing MP fairness can significantly reduce the DP disparity. 5 RELATED WORK Fair regression. Most prior work on fair regression ap- proximates the optimal fair regression function by data pre- processing or regularizers. Inspired by the two-stage least- squares method used in economics, Komiyama and Shimao (2017) propose a two-stage algorithm for linear regression that aims to remove the correlation in the dataset, and extend their work to control the level of fairness by employing a nonconvex optimization method (Komiyama et al., 2018). To provide a general framework for fair regression, Berk et al. (2017) introduce a family of fairness regularizers for linear regression problems which enjoy convexity and per- mit fast optimization. Similarly, Steinberg et al. (2020) and Mary et al. (2019) propose to measure the fairness using mutual information and Renyi maximum correlation coef- ficient respectively and incorporate the proposed criterion into regularized risk minimization framework. Recently, Scutari et al. (2021) propose a framework for estimating regression models subject to a user-defined level of fairness by introducing a ridge penalty for unfairness. Unlike those works, this paper focuses on the explicit solution to the MP-fair regression problem with both interpretability and theoretical performance guarantees. Several works are seeking the explicit solution to the fair regression problem. Calders et al. (2013) consider the fair linear regression problem with MP-constraints and provide a closed-form solution using the method of Lagrange multi- pliers. Based on the connection between least-squares fair regression under Demographic Parity and optimal transport theory, Chzhen et al. (2020) and Gouic et al. (2020) recently establish the general form of the optimal DP fair regres- sion function and propose a post-processing algorithm that transforms a base estimator of the regression function into a nearly fair one using random smoothing. In the work of Chzhen and Schreuder (2022), the authors consider learn- ing regression function satisfying α-relative DP fair con- straint and propose a framework that continuously interpo- lates between two extreme cases, which is similar to our fairness-accuracy tradeoff method. Other approaches to fair regression include optimization-based methods (Oneto et al., 2020), reduction-based methods (Agarwal et al., 2018), and adversary-based methods (Chi et al., 2021) under some notions of fairness. Unlike them, we focus on MP-fair regression problem in RKHS and derive a closed-form solu- tion by the characterization of fair functional space, which can be extended to covariance-based fairness and other loss functions. Kernel methods for algorithmic fairness. In recent years, kernel methods have drawn increasing attention from the algorithmic fairness community, which can be roughly categorized into two classes. The first class of work aims to employ the kernel method as a regularizer for fairness. P ́erez-Suay et al. (2017) present the fair kernel ridge re- gression formulation by incorporating the kernel Hilbert Schmidt independence criterion (KHSIC) as the regularizer on the dependence between the predictor and the sensitive attribute. Similarly, Kim and Gittens (2021) propose to learn fair low-rank tensor decompositions by regularizing the Canonical Polyadic Decomposition factorization with the KHSIC. Cho et al. (2020) develop a kernel density esti- mation (KDE) methodology for classification problems to quantify the fairness measure as a differentiable function and incorporate it as a regularizer. Another class of work aims to learn fair representation by leveraging kernel models. In Gr ̈unew ̈alder and Khaleghi (2021), the authors study the relaxed Maximum Mean Discrepancy (MMD) criterion and propose to generate new features that are minimally depen- dent on the sensitive features while closely approximating the non-sensitive ones. In Okray et al. (2019), the authors consider fair regression with binary sensitive attributes and propose to learn fair feature embeddings in kernel space by minimizing the mean discrepancy between the protected group and the unprotected group. In Tan et al. (2020), the authors leverage the classical sufficient dimension reduc- tion (SDR) framework to construct fair representations as subspaces of the RKHS under some criterion. Our method differs from those methods from two perspectives: we root in constructing the fair function space and aim to find the explicit solution to the MP fair regression problem. 6 CONCLUSION In this paper, we have proposed a novel approach for regres- sion under Mean Parity fairness which is appealing both theoretically and practically. By characterizing the space of fair regression functions, we derive a closed-form solution to the fair regression problem which has a simple implemen- tation in practice. The proposed fair function space can also be applied to regression under covariance-based fairness and other loss functions. In addition, our method allows users to control the fairness-accuracy tradeoff systemically and offers a simple interpretation. Experimental results sug- gest that our approach is promising for applications and improves fairness with multiple sensitive attributes. Limitations and future work. One important direction of future work, and a current challenge is the scalability of the proposed algorithm which is also a common limita- tion of kernel methods. We remark that many approaches have been proposed to reduce the computational cost of kernel-based algorithms by low-rank matrix approximation (El Alaoui and Mahoney, 2014; Kumar et al., 2009) or random projection (Cesa-Bianchi et al., 2015), which can also benefit our method. Another valuable direction is to apply our method to other kernel-based models such as Sup- Shaokui Wei, Jiayin Liu, Bing Li, Hongyuan Zha port Vector Machine (Noble, 2006) and Generalized Linear model (Nelder and Wedderburn, 1972). Other directions of interest include studying the generalization problem of fair algorithms and the characterization of the fair function space for more notions of fairness. References A. Agarwal, A. Beygelzimer, M. Dud ́ık, J. Langford, and H. Wallach. A reductions approach to fair classification. In International Conference on Machine Learning, pages 60–69. PMLR, 2018. A. Agarwal, M. Dud ́ık, and Z. S. Wu. Fair regression: Quantitative definitions and reduction-based algorithms. In International Conference on Machine Learning, pages 120–129. PMLR, 2019. M. Anshari, M. N. Almunawar, M. Masri, and M. Hrdy. Financial technology with AI-enabled and ethical chal- lenges. Society, pages 1–7, 2021. B. D. Baker, D. G. Sciarra, and D. Farrie. Is school funding fair? a national report card. Education Law Center, 2014. A. Barroso and A. Brown. Gender pay gap in us held steady in 2020. Pew Research Center, 2021. R. Berk, H. Heidari, S. Jabbari, M. Joseph, M. Kearns, A con- arXiv preprint J. Morgenstern, S. Neel, and A. Roth. vex framework for fair regression. arXiv:1706.02409, 2017. T. Calders and S. Verwer. Three naive bayes approaches for discrimination-free classification. Data Mining and Knowledge Discovery, 21(2):277–292, 2010. T. Calders, A. Karim, F. Kamiran, W. Ali, and X. Zhang. Controlling attribute effect in linear regression. In 2013 IEEE 13th International Conference on Data Mining, pages 71–80. IEEE, 2013. P. R. Center. On views of race and inequality, blacks and whites are worlds apart. Social and Demographic Trends, 2016. N. Cesa-Bianchi, Y. Mansour, and O. Shamir. On the com- plexity of learning with kernels. In Conference on Learn- ing Theory, pages 297–325. PMLR, 2015. J. Chi, Y. Tian, G. J. Gordon, and H. Zhao. Understand- ing and mitigating accuracy disparity in regression. In International Conference on Machine Learning, pages 1866–1876. PMLR, 2021. J. Cho, G. Hwang, and C. Suh. A fair classifier using ker- nel density estimation. Advances in Neural Information Processing Systems, 33:15088–15099, 2020. E. Chzhen and N. Schreuder. A minimax framework for quantifying risk-fairness trade-off in regression. The An- nals of Statistics, 50(4):2416–2442, 2022. L. Darling-Hammond. Unequal opportunity: Race and education. The Brookings Review, 16(2):28–32, 1998. A. El Alaoui and M. W. Mahoney. Fast randomized kernel methods with statistical guarantees. stat, 1050:2, 2014. M. Feldman, S. A. Friedler, J. Moeller, C. Scheidegger, and S. Venkatasubramanian. Certifying and removing dis- parate impact. In Proceedings of the 21th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pages 259–268, 2015. A. Frohmader and H. Volkmer. 1-wasserstein distance on the standard simplex. Algebraic Statistics, 12(1):43–56, 2021. T. L. Gouic, J.-M. Loubes, and P. Rigollet. Projec- tion to fairness in statistical learning. arXiv preprint arXiv:2005.11720, 2020. A. Gretton. Introduction to rkhs, and some simple kernel algorithms. Adv. Top. Mach. Learn. Lecture Conducted from University College London, 16:5–3, 2013. C. W. Groetsch. Generalized Inverses of Linear Operators: Representation and Approximation. Dekker, 1977. S. Gr ̈unew ̈alder and A. Khaleghi. Oblivious data for fairness with kernels. Journal of Machine Learning Research, 22 (208):1–36, 2021. M. Gupta and Q. Mohammad. Advances in AI and ML are reshaping healthcare. SAP News Center. Available online at: https://techcrunch. com/2017/03/16/advances- in-ai-and-ml-are-reshaping-healthcare/(Accessed Jun 20, 2018), 2017. L. Hoegaerts, J. A. Suykens, J. Vandewalle, and B. De Moor. Subset based least squares subspace regression in rkhs. Neurocomputing, 63:293–323, 2005. L. Huang and N. Vishnoi. Stable and fair classification. In International Conference on Machine Learning, pages 2879–2890. PMLR, 2019. R. Jiang, A. Pacchiano, T. Stepleton, H. Jiang, and S. Chi- appa. Wasserstein fair classification. In Uncertainty in Artificial Intelligence, pages 862–872. PMLR, 2020. H. Kadri, E. Duflos, P. Preux, S. Canu, and M. Davy. Nonlin- ear functional regression: a functional rkhs approach. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, pages 374–380. JMLR Workshop and Conference Proceedings, 2010. K. Kim and A. Gittens. Learning fair canonical polyadical decompositions using a kernel independence criterion. arXiv preprint arXiv:2104.13504, 2021. D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. E. Chzhen, C. Denis, M. Hebiri, L. Oneto, and M. Pon- til. Fair regression with wasserstein barycenters. arXiv preprint arXiv:2006.07286, 2020. A. A. Kodiyan. An overview of ethical issues in using ai systems in hiring with a case study of amazon's ai based hiring tool. Researchgate Preprint, 2019. Mean Parity Fair Regression in RKHS putational Learning Theory, pages 416–426. Springer, 2001. M. Scutari, F. Panero, and M. Proissl. Achieving fair- arXiv preprint ness with a simple ridge penalty. arXiv:2105.13817, 2021. D. Steinberg, A. Reid, S. O'Callaghan, F. Lattimore, L. Mc- Calman, and T. Caetano. Fast fair regression via efficient approximations of mutual information. arXiv preprint arXiv:2002.06200, 2020. Z. Tan, S. Yeom, M. Fredrikson, and A. Talwalkar. Learning fair representations for kernel models. In International Conference on Artificial Intelligence and Statistics, pages 155–166. PMLR, 2020. G. Wang, Y. Wei, and S. Qiao. Moore-penrose inverse of linear operators. In Generalized Inverses: Theory and Computations, pages 317–338. Springer, 2018. M. Welling. Kernel ridge regression. Max Welling's Class- notes in Machine Learning, pages 1–3, 2013. L. F. Wightman. Lsac national longitudinal bar passage study. lsac research report series. 1998. M. Yuan and T. T. Cai. A reproducing kernel hilbert space approach to functional linear regression. The Annals of Statistics, 38(6):3412–3444, 2010. M. B. Zafar, I. Valera, M. Gomez-Rodriguez, and K. P. Gummadi. Fairness constraints: A flexible approach for fair classification. The Journal of Machine Learning Research, 20(1):2737–2778, 2019. R. Zemel, Y. Wu, K. Swersky, T. Pitassi, and C. Dwork. Learning fair representations. In S. Dasgupta and D. McAllester, editors, Proceedings of the 30th Inter- national Conference on Machine Learning, volume 28 of Proceedings of Machine Learning Research, pages 325– 333, Atlanta, Georgia, USA, 17–19 Jun 2013. PMLR. URL https://proceedings.mlr.press/v28/ zemel13.html. I. ˇZliobait ̇e. Measuring discrimination in algorithmic deci- sion making. Data Mining and Knowledge Discovery, 31 (4):1060–1089, 2017. R. Kohavi et al. Scaling up the accuracy of naive-bayes classifiers: A decision-tree hybrid. In KDD, volume 96, pages 202–207, 1996. J. Komiyama and H. Shimao. Two-stage algorithm for fairness-aware machine learning. arXiv preprint arXiv:1710.04924, 2017. J. Komiyama, A. Takeda, J. Honda, and H. Shimao. Noncon- vex optimization for regression with fairness constraints. In International Conference on Machine Learning, pages 2737–2746. PMLR, 2018. S. Kumar, M. Mohri, and A. Talwalkar. Sampling techniques for the nystrom method. In Artificial intelligence and statistics, pages 304–311. PMLR, 2009. J. Mary, C. Calauzenes, and N. El Karoui. Fairness-aware learning for continuous attributes and treatments. In Inter- national Conference on Machine Learning, pages 4382– 4391. PMLR, 2019. J. A. Nelder and R. W. Wedderburn. Generalized linear models. Journal of the Royal Statistical Society: Series A (General), 135(3):370–384, 1972. W. S. Noble. What is a support vector machine? Nature Biotechnology, 24(12):1565–1567, 2006. G. S. Oettinger. Statistical discrimination and the early career evolution of the black-white wage gap. Journal of Labor Economics, 14(1):52–78, 1996. A. Okray, H. Hu, and C. Lan. Fair kernel regression via fair feature embedding in kernel space. In 2019 IEEE 31st International Conference on Tools with Artificial Intelligence (ICTAI), pages 1417–1421. IEEE, 2019. L. Oneto, M. Donini, and M. Pontil. General fair empirical risk minimization. In 2020 International Joint Confer- ence on Neural Networks (IJCNN), pages 1–8. IEEE, 2020. A. P ́erez-Suay, V. Laparra, G. Mateo-Garc ́ıa, J. Mu ̃noz- Mar ́ı, L. G ́omez-Chova, and G. Camps-Valls. Fair kernel In Joint European Conference on Machine learning. Learning and Knowledge Discovery in Databases, pages 339–355. Springer, 2017. E. Raff, J. Sylvester, and S. Mills. Fair forests: Regularized tree induction to minimize model bias. In Proceedings of the 2018 AAAI/ACM Conference on AI, Ethics, and Society, pages 243–250, 2018. M. Redmond and A. Baveja. A data-driven software tool for enabling cooperative information sharing among police departments. European Journal of Operational Research, 141(3):660–678, 2002. B. Sch ̈olkopf, A. Smola, and K.-R. M ̈uller. Nonlinear com- ponent analysis as a kernel eigenvalue problem. Neural Computation, 10(5):1299–1319, 1998. B. Sch ̈olkopf, R. Herbrich, and A. J. Smola. A generalized representer theorem. In International Conference on Com- Shaokui Wei, Jiayin Liu, Bing Li, Hongyuan Zha A PROOFS A.1 Proof of Proposition 1 Proof. By the fact that E(X) = (cid:82) ∞ (CDF) of X, we have 0 (1 − F (x))dx (cid:82) 0 − −∞ F (x)dx where F (X) is the cumulative distribution functions MPD(g) = (cid:88) s ΩS ∈ (cid:88) = s ΩS ∈ (cid:88) DPD(g) = S = s) | − E(g(X, S)) | E(g(X, S) | (cid:12) (cid:12) (cid:12) (cid:12) (cid:90) R S=s(t) (Fg(X,S) | (cid:12) (cid:12) Fg(X,S)(t))dt (cid:12) (cid:12) − W1(g(X, S) (cid:18)(cid:90) s ΩS ∈ (cid:88) = R ΩS s ∈ S = s, g(X, S)) | (cid:12) S=s(t) (cid:12)(Fg(X,S) | Fg(X,S)(t))(cid:12) (cid:12) dt (cid:19) − where Fg(X,S) S = s and g(X, S) respectively. S=s and Fg(X,S) are the CDF of g(X, S) | | By the Triangle inequality, we have (cid:12) (cid:12) (cid:12) (cid:12) (cid:90) R (Fg(X,S) | S=s(t) − (cid:12) (cid:12) Fg(X,S)(t))dt (cid:12) (cid:12) ≤ (cid:90) R (cid:12) (cid:12)(Fg(X,S) S=s(t) | − Fg(X,S)(t))(cid:12) (cid:12) dt s ∀ ∈ ΩS. (8) So, MPD(g) DPD(g) ≤ A.2 Proof of Theorem 1 Proof. By the definition of ker(ΣS(XS)), a function g is in ker(ΣS(XS)) if and only if For a function g XS, notice that ∈ H ΣS(XS)g = 0 S . H − μs) μXS)g] (φXS(X, S) ⊗ μXS, g ΣS(XS)g = EXS [(φS(S) − = EXS [ φXS(X, S) XS (φS(S) (cid:104) (cid:105)H − EXS(g(X, S)))(φS(S) = EXS [(g(X, S) − = ES [(EX (g(X, S) S) | (cid:16) EX (g(X, S) S = s(j)) | μs)] μs)] EXS(g(X, S))) (φS(S) P(S = s(j)) k (cid:88) − − − = − j=1 (By the definition of ) ⊗ (By the reproducing property) μs)] EXS(g(X, S)) (cid:17) (φS(s(j)) − μs) − and P(S = s(j)) (cid:16) k (cid:88) j=1 EX (g(X, S) S = s(j)) | − EXS(g(X, S)) (cid:17) = 0 where we use the reproducing property of Note that we assume P(S = s(j)) > 0 for all s(j) the fairness in practice. Then, under the Assumption 1 that the system of equations XS and the definition that (a b)c = H ∈ (cid:105)H ΩS since the sensitive attributes with zero probability don't influence ∈ H ⊗ (cid:104) b, c a for b, c (Gretton, 2013). k (cid:88) j=1 ηj(φS(s(j)) − μS) = 0 S , H k (cid:88) j=1 ηj = 0 (9) Mean Parity Fair Regression in RKHS has unique solution ηj = 0 for all j 1, . . . , k ∈ { , we can conclude that } EX (g(X, S) S) | − So, M P = ker(ΣS(XS)). G A.3 Proof of Lemma 1 ΣS(XS)g = 0 EXS(g(X, S)) = 0 S H g ∀ g ∀ ∈ M P ∈ G ker(ΣS(XS)). Proof. Recall that Problem 1 considers the following objective which is equivalent to E(Y − g(X, S))2, E(Y 2) − 2E(Y g(X, S)) + E(g(X, S))2. Denote the optimal regression function of Problem 1 by g∗ G function in M P and . Let ∆ be an arbitrary function in M P , then g(cid:48) = g∗ G G + ∆ is a G E((Y − g(cid:48)(X, S))2 = E(Y 2) 2E(Y g(cid:48)(X, S)) + E(g(cid:48)(X, S))2 (X, S))2 − g∗ G (X, S)∆(X, S)) + E(∆(X, S))2. 2E(Y ∆(X, S)) − = E(Y − + 2E(g∗ G Note that g∗ G is an optimal solution if and only if E((Y − g(cid:48)(X, S))2 E(Y g∗ G − ≥ (X, S))2 which is equivalent to 2E(Y ∆(X, S)) + 2E(g∗ G − (X, S)∆(X, S)) + E(∆(X, S))2 0 ≥ ∆ ∀ M P . ∈ G The above inequality holds if and only if 2E(Y ∆(X, S)) + 2E(g∗ G − (X, S)∆(X, S)) = 0 ∆ ∀ M P , ∈ G which is equivalent to otherwise, scaling ∆ by a proper scalar yields a contradiction. E(Y ∆(X, S)) = E(g∗ G (X, S)∆(X, S)) ∆ ∀ M P , ∈ G A.4 Proof of Corollary 1 Proof. Given g1, g2 ∈ H that is, under Assumption 1, XS, E(g1(X, S) S) | − E(g1(X, S)) = E(g2(X, S) S) | − E(g2(X, S)) indicates that g1− g2 ∈ G M P , Rewriting the above equation gives ΣS(XS)(g1 − g2) = 0 S . H ΣS(XS)g1 = ΣS(XS)g2. A.5 Proof of Proposition 3 Proof. A function g M P , we have G ∈ H XS satisfies ΣS(XS)g = ΣS(XS)g∗ if and only if ΣS(XS)(g ΣS(XS)(g − g∗) = ΣS(XS)(gM P − = ΣS(XS)(gM P ⊥ = 0 S . − H g∗M P ) + ΣS(XS)(gM P ⊥ g∗M P ⊥ ) As gM P ⊥ − g∗M P ⊥ ∈ G ⊥M P , the above equation holds if and only if gM P ⊥ = g∗M P ⊥ . g∗) = 0 S . By the definition of H g∗M P ⊥) − − Shaokui Wei, Jiayin Liu, Bing Li, Hongyuan Zha A.6 Proof of Proposition 5 Proof. To bound the MSE of g∗ G regression function in H L(g∗ G ) − L(g∗) , we introduce a sub-optimal fair regression function g(cid:48) = P g∗ where g∗ is the optimal XS. Then, the reduction of MSE are E(Y g∗(X, S))2 − − 2E(Y g(cid:48)(X, S)) + E(g(cid:48)(X, S))2 (cid:0) 2E(Y g∗(X, S)) + E(g∗(X, S))2(cid:1) − − 2E(Y g(cid:48)(X, S)) + E(g∗(X, S))2 2E(g∗(X, S)g(cid:48)(X, S)) + E(g∗(X, S))2 (By the optimal condition of g∗) (By the optimal condition of g∗) − − − L(g∗) g(cid:48)(X, S))2 L(g(cid:48)) ≤ = E(Y = = E(g(cid:48)(X, S))2 = E(g(cid:48)(X, S))2 = E(g(cid:48)(X, S) = E(g∗M P ⊥(X, S))2 = − − − g∗(X, S))2 (By g∗ = P g∗ + g∗M P ⊥ ) ̃Σ(XS)(XS)g∗M P ⊥ , g∗M P ⊥ (cid:104) XS . (cid:105)H Therefore, under Assumption 1, the MSE of g∗ G is bounded by L(g∗ G ) ≤ L(g∗) + (cid:104) ̃Σ(XS)(XS)g∗M P ⊥, g∗M P ⊥ XS . (cid:105)H (10) A.7 Proof in Example 1 In this section, we prove that when S is a binary random variable, κS(si, sj) = sisj satisfies Assumption 1. Proof. Without loss of generality, we assume that S . Since the following system of equations 0, 1 } ∈ { P(S = 1)) + η2(1 η1(0 − − P(S = 1)) = 0 η1 + η2 = 0, has a unique solution η1 = η2 = 0, Assumption 1 is satisfied. B IMPLEMENTATION In this section, we focus on the estimation of optimal regression function by solving the empirical approximation of n xi, si, yi Problem 1. Specifically, given the training dataset i=1, we seek the solution to the following regularized fair } { regression problem (Kadri et al., 2010; Hoegaerts et al., 2005), = D 1 n n (cid:88) (yi i=1 − min M P ∈G g g(xi, si))2 + λ g n (cid:107) , XS (cid:107)H (11) where λ 0 is a real number (regularization coefficient) to control the tradeoff between approximating properties and the smoothness of g. Note that when λ = 0, Problem 11 is the estimation of Problem 1, but it may be ill-posed depending on ≥ XS. H To solve Problem 11, we first show the empirical estimation of Σ(XS)S and how to estimate the eigenfunctions of Σ(XS)SAΣS(XS), which allows us to construct an orthogonal projection operator. After that, we derive the closed-form solution for Problem 11 which is the empirical estimation of the optimal fair regression function 3 when λ = 0. B.1 Empirical estimation of MP-fair function space Recall that the feature maps of 1 n XS and H j=1 φXS(xj, sj) and ̄φS(si) = φS(si) − (cid:80)n H (cid:80)n 1 n S are φXS and φS respectively. Let us define ̄φXS(xi, si) = φXS(xi, si) j=1 φS(sj). Then, the empirical estimation of Σ(XS)S is − ˆΣ(XS)S = 1 n n (cid:88) i=1 ̄φXS(xi, si) ̄φS(si). ⊗ Mean Parity Fair Regression in RKHS To simplify the derivation, we set A to be the identity operator and focus on ˆΣ(XS)S ˆΣS(XS). Define the feature matrix ΦXS and Gram matrix KXS as ΦXS = [φXS(x1, s1), . . . , φXS(xn, sn)]T KXS = ΦT XSΦXS, such that the ith column of ΦXS is φXS(xi, si) and the (i, j) entry of KXS is κXS((xi, si), (xj, sj)). Similarly, we denote the feature matrix and Gram matrix of S by ΦS and KS respectively. ̄φXS(xi, si) is a set of linearly independent feature maps which ensures that an eigenfunc- For simplicity, we assume that } { tion ˆθl is uniquely determined by a set of scalars. In case where are not linearly independent e.g., duplicated data samples, the following process can still be applied since we can get orthonormal bases by removing the duplicated eigenfunctions. By the observation that ran( ˆΣ(XS)S ˆΣS(XS)) is a subspace of span( φXS(xi, si) } { ˆΣ(XS)S ˆΣS(XS) can be written as the jth eigenfunction of ̄φXS(xi, si) { n i=1), } ˆθj = ΦXSaj or ˆθj = ̄ΦXS ̄aj j ∀ ∈ { 1, . . . , m where aj, ̄aj ∈ Rn are vectors of coefficients and ̄ΦXS = ΦXSH for H = In n × − The generalized eigenvalue ψj corresponding to ˆθj satisfies Writing the above equation as a matrix form yields ψj ˆθj = ˆΣ(XS)S ˆΣS(XS) ˆθj. ψj ̄aj = 1 n2 ̄KS ̄KXS ̄aj, , } 1 n 1n × n (Sch ̈olkopf et al., 1998). where ̄KS = HKSH and ̄KXS = HKXSH. n2 ̄KS ̄KXS and aj = H ̄aj. Since ˆΣ(XS)S ˆΣS(XS) is self-adjoint, the first Thus, ̄aj is the eigenvector of the matrix 1 m eigenfunctions are orthogonal. So, we can normalize the eigenfunctions to construct a set of orthonormal bases of ran( ˆΣ(XS)S). A more detailed derivation can be found in Appendix C.3. B.2 Construction of projection operator With some abuse of notation, we denote a set of orthonormal bases of ran(Σ(XS)S) by ˆθ1, where ˆθj = ΦXSaj to avoid complicated symbols. Given a function g { } * * * operator from following orthogonal projection operator and its estimation by * * * XS, the orthogonal projection XS onto ran(Σ(XS)S)⊥ eliminates the components of g in ran(Σ(XS)S). Thus, we can construct the θ1, { ∈ H , ˆθm , θm H } P = I m (cid:88) j=1 − θj ⊗ θj, ˆP = I m (cid:88) j=1 − ˆθj ˆθj ⊗ (12) M P is G m (cid:88) (cid:104) j=1 g, ˆθj XS (cid:105)H ˆθj = ΦXSP c, where I : XS H XS is the identity operator. → H So, the estimation of P can be written as Note that given g = ΦXSc, the projection of g on ˆP g = g − where P = (In n × − (cid:80)m j=1 amaT mKXS). Shaokui Wei, Jiayin Liu, Bing Li, Hongyuan Zha B.3 Estimation of fair regression function Given an orthogonal projection operator estimation ˆP , the optimal solution to Problem 11 is ˆg∗ G obtained by solving the following problem = ˆP ˆg∗ H where ˆg∗ H can be (cid:16) yi 1 n − (cid:104) min XS ∈H g φXS(xi, si), ˆP g (cid:17)2 (cid:105) + λ n (cid:13) ˆP g (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) XS H By the Representer theorem (Sch ̈olkopf et al., 2001), ˆg minimize the following objective function H is of the form ˆg H = ΦXSw . H for w H ∈ Rn. So, it suffices to J(w) =wT P T KXSKXSP w 2Y T KXSP w + Y T Y + λwT P T KXSP w, − where Y = [y1, . . . , yn] is a vector in Rn. Since J(w) is convex, it has a minimizer. Setting ∂J ∂w to zero yields = (P T KXSKXSP + λP T KXSP )†P T KXSY . w H So, the optimal fair regression function is ˆg∗ G = ΦXSw∗ G where = P (P T KXSKXSP + λP T KXSP )†P T KXSY . w∗ G Example: fair linear regression. Consider the fair linear regression problem with single binary sensitive attribute. The kernels are κS(si, sj) = sisj κX (xi, xj) = xT i xj κXS((xi, si), (xj, sj)) = κS(si, sj) + κX (xi, xj). We prove that the above setting satisfies Assumption 1 in Appendix A.7, which implies that MP fairness is equivalent to CB fairness in this example. Let λ = 0. The optimal fair regression function is and the fitted value of Y is = ΦXSP (KXSP )†Y ˆg∗ G ˆY = KXSP (KXSP )†Y . C DERIVATIONS AND DISCUSSIONS C.1 Relation between MP fairness and CB fairness In this section, we discuss general CB fairness and its relation to MP fairness. We first provide the following assumption Assumption 2. Assume the κXS is composed of κS and κX . which is the assumption in ordinary kernelized regression problem where S and X are mapped to φS(S) and φX (X) respectively. As discussed in the work of Komiyama et al. (2018) and P ́erez-Suay et al. (2017), the general CB fairness seeks to remove the correlation between S and g(X, S) on the (possibly infinite) representation space. Specifically, the CB fairness requires that the regression function g S under Assumption 2. By the definition of Cov(φS(S), g(X, S)), we have XS achieves Cov(φS(S), g(X, S)) = 0 ∈ H H Cov(φS(S), g(X, S)) = E [(g(X, S) E(g(X, S)))(φS(S) μS)] − = E [ φXS(X, S) (cid:104) = E [(φS(S) = ΣS(XS)g, − − μS) ⊗ μXS, g − XS (φS(S) (cid:105)H (φXS(X, S) − μXS) − μS)] ] g (cid:105) (13) Mean Parity Fair Regression in RKHS where we use the reproducing property of derive this result. H XS and the definition that (a b)c = b, c (cid:104) (cid:105)H ⊗ a for b, c ∈ H (Gretton, 2013) to Equation 13 claims that a function g XS is CB-fair if and only if g is in ker(ΣS(XS)). Since the proposed method solves the fair regression problem by the characterization of ker(ΣS(XS)), it can also be applied to CB fairness under Assumption 2. In particular, if both Assumption 1 and Assumption 2 are satisfied, MP fairness is equivalent to CB fairness. ∈ H C.2 Derivation of equations in Section 3.3 Solving Problem 6 gives M P = P [P ̃Σ(XS)(XS)P ]†P (h gα α ̃Σ(XS,XS)g∗M P ⊥) − αP [P ̃Σ(XS)(XS)P ]†P ̃Σ(XS,XS)g∗M P ⊥ . = g∗ G − As g∗M P ⊥ = (I − P )g∗ where I is the identity operator, we have P [P ̃Σ(XS)(XS)P ]†P ̃Σ(XS,XS)g∗M P ⊥ = P [P ̃Σ(XS)(XS)P ]†P ̃Σ(XS,XS)g∗ P [P ̃Σ(XS)(XS)P ]†P ̃Σ(XS,XS)P g∗ − where the first term equals to g∗ G term equals to P g∗ since it's the optimal solution of ming by the property that (cid:104) g, ̃Σ(XS,XS)g∗ (cid:105)H E(P g∗ M P XS = g)2. ∈G − Therefore, we get gα M P = (1 α)g∗ G − + αP g∗. g, h (cid:104) XS for all g (cid:105)H XS, and the second ∈ H Alternatively, we can show the above equation using the fact that gα = g∗ when α = 1. Thus, the optimal solution to Problem 5 is gα = (1 + αg∗. α)g∗ G − Now, we turn to the MSE of gα. We have L(gα) = E(Y = E(Y = E((1 = E((1 − − − (1 gα(X, S))2 α)g∗ G g∗ G g∗ G − α)(Y α)(Y − − α)(Y − + 2E((1 = E((1 − + 2α(1 = (1 − − α)(Y − g∗ − G α)E((Y g∗ − G ) + (1 − α)2E(Y α)2L(g∗ G L(g∗)) = (1 − = α2(L(g∗ ) G α)2L(g∗ G − = (1 MPD(gα) = αMPD(g∗). − (X, S) αg∗(X, S))2 − − (X, S)) + α(Y (X, S)))2 + E(α(Y g∗ (X, S))(α(Y − G (X, S)))2 + E(α(Y (X, S))(Y − (X, S)))2 + (1 g∗ G − (1 α)2)L(g∗) − (1 − 2α(L(g∗ G ) − α)2)L(g∗) − − − ) + (1 (1 − g∗(X, S)))2 g∗(X, S)))2 − g∗(X, S)))) g∗(X, S)))2 − g∗(X, S))) α)2)E((Y − − g∗(X, S)))2 L(g∗)) + L(g∗ G ), (14) since E(Y (Y − g∗(X, S))) = E(Y g∗(X, S))2 and E(g∗ G − (X, S)(Y − g∗(X, S))) = 0. C.3 Estimating eigenfunctions and orthonormal bases Now we provide detailed derivation about finding the eigenfunctions of ˆΣ(XS)SA ˆΣS(XS). Recall that ˆΣ(XS)S = 1 n n (cid:88) i=1 ̄φXS(xi, si) ̄φS(si). ⊗ Shaokui Wei, Jiayin Liu, Bing Li, Hongyuan Zha Let A be the identity operator, and we get (cid:32) ˆΣ(XS)SA ˆΣS(XS) = n (cid:88) 1 n ̄φXS(xi, si) ̄φS(si) ⊗ (cid:33) (cid:32) 1 n n (cid:88) i=1 (cid:33) ̄φS(si) ⊗ ̄φXS(xi, si) = = = 1 n2 1 n2 1 n2 i=1 n (cid:88) n (cid:88) i=1 n (cid:88) j=1 n (cid:88) i=1 n (cid:88) j=1 n (cid:88) i=1 j=1 ̄φXS(xi, si) ⊗ ̄φS(si) ̄φS(sj) ⊗ ̄φXS(xj, sj) ̄φS(si), ̄φS(sj) (cid:104) S (cid:105)H ̄φXS(xi, si) ⊗ ̄φXS(xj, sj) ̄κS(si, sj) ̄φXS(xi, si) ̄φXS(xj, sj). ⊗ For simplicity, we assume that determined by a set of scalars. In case where process can still be applied since we can get orthonormal bases by removing the duplicated eigen functions. ̄φXS(xi, si) Since ˆΣ(XS)S ˆΣS(XS) is in ran( { i=1), the lth eigenfunction of ˆΣ(XS)S ˆΣS(XS) can be written as n } is a set of independent feature maps which ensures that ˆθl is uniquely are not independent e.g., duplicated data samples, the following ̄φXS(xi, si) } { ̄φXS(xi, si) { } By the definition of eigenfunction, we get Observe that ̄φXS(xi, si), (cid:104) n (cid:88) j=1 ̄alj ˆθl = n (cid:88) i=1 ̄ali ̄φXS(xi, si). ψl ˆθl = ˆΣ(XS)S ˆΣS(XS) ˆθl. (15) ̄φXS(xj, sj) XS = (cid:105)H n (cid:88) j=1 ̄alj ̄κXS ((xi, si), (xj, sj)) , where ̄κXS ((xi, si), (xj, sj)) is the (i, j) entry of the matrix ̄KXS = HKXSH with Gram matrix KXS and H = In n. Thus, we get 11n n− n × − × ˆΣ(XS)S ˆΣS(XS) ˆθl = 1 n2 n (cid:88) n (cid:88) i=1 j=1 βlj ̄κS(si, sj) ̄φXS(xi, si), where βlj = (cid:80)n By Equation 15, it suffices to solve r=1 ̄alr ̄κXS ((xj, sj), (xr, sr)). λl ̄ali = 1 n2 n (cid:88) j=1 ̄κS(si, sj) n (cid:88) r=1 ̄alr ̄κXS ((xj, sj)(xr, sr)) . Writing the above equation as a matrix equation yields ψl ̄al = 1 n2 ̄KS ̄KXS ̄al, where al = [ ̄al1, . . . , ̄aln ] is a column vector in Rn. Thus, al is the eigenvector of the matrix 1 n2 ̄KS ̄KXS. Let The lth eigenvector can be rewritten as al = H ̄al. ˆθl = n (cid:88) i=1 aliφXS(xi, si). Since ˆΣ(XS)S ˆΣS(XS) is self-adjoint, the first m eigenfunctions are orthogonal. So, we can normalize the eigenfunctions to construct a set of orthonormal bases of ran( ˆΣ(XS)S). C.4 Choice of kernel Mean Parity Fair Regression in RKHS For Mean Parity Fair Regression, the choice of κS is independent of κXS and κX as long as φS satisfies Assumption 1. Here we show that a polynomial kernel with degree k R, i.e., S is a scalar variable. 1 would satisfy Assumption 1 for ΩS − 1, i.e., κS(s1, s2) = (1 + s1s2)k − ⊆ 1. The feature map φS(s) is Consider a polynomial kernel with degree of k − where ci = (cid:113)(cid:0)k 1 − i Now we show that non-zero solution φS(s) = [c0, c1s, c2s2, 1sk 1] − , ck − * * * (cid:1) according to the binomial theorem. k φS(s(j)) j=1 is a set of linearly independent feature maps by showing the following problem has no } { k (cid:88) j=1 wjφS(s(j)) = 0 S H Equation 16 is equivalent to        ck c0 c1(s(1))1 c2(s(1))2 ... 1(s(1))k − 1 − ck c0 c1(s(2))1 c2(s(2))2 ... 1(s(2))k − 1 − ck c0 c1(s(3))1 c2(s(3))2 ... 1(s(3))k − 1 − * * * * * * * * * ... * * *        c0 c1(s(k))1 c2(s(k))2 ... 1(s(k))k − ck 1 − We can simplify the above problem to (16)        =         0 0   0   ...   0        w1 w2 w3 ... wk        1 (s(1))1 (s(1))2 ... (s(1))k − (cid:124) 1 (s(2))1 (s(2))2 ... (s(2))k − 1 1 1 (s(3))1 (s(3))2 ... (s(3))k (cid:123)(cid:122) V − 1 * * * * * * * * * ... * * * 1 (s(k))1 (s(k))2 ... (s(k))k − 1        (cid:125)               w1 w2 w3 ... wk Since the matrix V is a Vandermonde Matrix, it has determinant det(V ) = (cid:81) (s(j)   0 0     0     ...     0 s(i)) = 0. Therefore, the above = − problem has no non-zero solution and with degree k { 1 would satisfy Assumption 1 for scalar-valued S. φS(s(j)) k j=1 is a set of linearly independent features. Thus, a polynomial kernel } 1 ≤ i<j k ≤ − For sensitive attributes with non-scalar value, a modified polynomial kernel that first maps S to scalar value and then computes the features by the standard polynomial kernel can be well adopted. D EXPERIMENTS DETAILS D.1 Baselines The details of the baselines used in the experiments are summarized below: • Constant Prediction: a regression function with a constant outcome that minimizes the MSE. It achieves MP, DP and CB fairness. • Ordinary Least Squares: the standard linear regression model without regularizers. • Kernel Ridge Regression: the standard kernel regression (Welling, 2013) method with regularizers. • Fair Penalty Regression: a regression model with MP-fair regularizers. Derivation can be found in Appendix D.3. (cid:54) Shaokui Wei, Jiayin Liu, Bing Li, Hongyuan Zha • Fair Kernel Learning (P ́erez-Suay et al., 2017): a regularizer-based method aims to eliminate the covariance between the predicted value and the sensitive attributes. The implementation is borrowed from https://isp.uv.es/soft regression.html. • Nonconvex Regression with Fairness Constraints (Komiyama et al., 2018): a nonconvex optimization method aims to control the correlation between the predicted value and the sensitive attributes. Note that the optimization process is applied only when the target CB disparity is set to be larger than 0, otherwise, NRFC is reduced to a data preprocessing method. We adapt the official implementation from https://github.com/jkomiyama/fairregresion. • Reduction Based Algorithm (Agarwal et al., 2019): fairness for a randomized predictor using discretization. We adapt https://github.com/steven7woo/fair regression reduction. a reduction based method aims to achieve DP implementation from the official D.2 Experiment settings The detailed settings in each experiment are summarized below: • Data preprocessing. For all experiments, both response values in train data and test data are centralized using the mean of training response values. • Linear regression. For synthetic dataset, we choose n = 2, 000, d = 5 and e = 1 for regression with single sensitive attribute. The variance of noise ρ2 noise is set to be 0.1. For the proposed method and FPR, we set the kernel of sensitive attributes as the polynomial kernel. All methods focus on the unregularized least-squares problem, i.e, λ = 0. We test FKR with fairness regularizer coefficients 10 and 1, 000 which are represented by FKR-1 and FKR-3 respectively. Similarly, We test FPR with coefficients of fairness regularizer 10 and 1, 000 which are represented by FPR-1 and FPR-3 respectively. Note that for NRFC, it defaults to fit linear regression with intercept. So, when evaluating other methods, we add a column of ones to X to match the setting of NRFC. Other settings for the hyper-parameters in the baselines follow the default settings of their corresponding papers. We run each method 10 times. • Kernel regression. For the proposed method, we set κS to be polynomial kernel while all other kernels are set to be Radial Basis Function (RBF) Kernel with γ = 0.1. We focus on the regularized least-squares problem with λ = 1. Other settings for the hyper-parameters in the baselines are the same as the settings in the linear regression experiment. • Tradeoff. The proposed method is evaluated with α = [0, 1/50, 2/50, . . . , 1]. For FKR and FPR, we alter the coefficient of fairness regularizer from 0 to 106. Moreover, we run NRFC with ζ, the parameter for the level of fairness from 0 to 1. Note that except α, all other parameters need to be tuned carefully since the relation between fairness and accuracy is hard to interpret (sometimes a small change in the fairness parameter will make a dramatic change to the loss while sometimes the change is negligible). In particularly, the values of ζ concentrate in [0, 0.1] and even [0, 0.01]. For the regularizer coefficient of FKR and FPR, the values concentrate in [102, 104]. To make the figures clear, we plot a subset of experiment results in Figure 2 and Figure 7 by subsampling 1/5 of the results uniformly. • Multiple sensitive attributes. For regression with multiple sensitive attributes on the Communities and Crime dataset, we choose race, medIncome, householdsize and medFamInc as the sensitive attributes sequentially. For medIncome, householdsize and medFamInc, we convert them to binary attributes by whether their values are larger than 0.5. D.3 Fair penalty regression In this section, we derive an FPR model for MP fairness using the framework of P ́erez-Suay et al. (2017) which is used as a baseline in our experiment. For the FPR model, the key point is to find function Q(g(X, S), S) which measures the level of MP-fairness of a regression function. Notice that a function g XS satisfies MP fairness if and only if its projection onto M P is itself, i.e., g G − P g = 0 XS . So, we set H ∈ H Q(g(X, S), S) = P g g (cid:107) − XS (cid:107)H . Given the training dataset = { D xi, si, yi n i=1, we seek the solution of the following regularized optimization problem, } 1 n n (cid:88) (yi i=1 − min M P ∈G g g(xi, si))2 + λ g n (cid:107) XS + (cid:107)H ζ g n (cid:107) − P g . XS (cid:107)H (17) Mean Parity Fair Regression in RKHS where ζ ≥ 0 is the parameter to control the level of fairness. By the Representer theorem, the optimal solution g∗ is of the form ΦXSw. So, we need to solve the problem min M P ∈G g Y T Y − 2Y T KXSw + wT KXSKXSw + λwT KXSw + ζwT KXSAT KXSAKXSw, (18) where A = (cid:80)m j=1 ajaT j . Since the above problem is convex, its has a solution w = (cid:0)KXSKXS + λKXS + ζKXSAT KXSAKXS = (KXSKXS + λKXS + ζKXSAKXS)† KXSY . (cid:1)† KXSY E ADDITIONAL EXPERIMENT RESULTS E.1 Supplementary results for Section 4 In this section, we provide the supplementary experiment results for Section 4. In Figure 5, we compare different baselines in the kernel regression setting for single binary sensitive attribute. Figure 6 describes the performance of KRR, FPR and the proposed method in the setting of kernel regression for multiple sensitive attributes. In Figure 7, we summarize the experiment results for the fairness-accuracy tradeoff on different datasets. Figure 5: Results of kernel regression for all datasets with one binary sensitive attribute. Figures in the first row show the MSE of different methods whereas the figures in the second row show the SMD of different methods. The methods FKR-1 and FKR-3 stand for FKR method with regularizer coefficients 10 and 1000 respectively. And FPR-1 and FPR-3 stand for FPR method with regularizer coefficients 10 and 1000 respectively. TrainTest1.11.21.31.4MSE1e−1SyntheticTrainTest0.81.01.21.41e−1AdultTrainTest0.60.81.01e−2Law SchoolTrainTest2341e−2C&CTrainTest02SMD1e−2TrainTest0121e−1TrainTest0121e−2TrainTest01231e−1KRRFKR-1FKR-3FPR-1FPR-3NRFCOurs Shaokui Wei, Jiayin Liu, Bing Li, Hongyuan Zha Figure 6: Results of kernel regression on the Communities & Crime dataset with multiple binary sensitive attributes. Figures in the first row show the MSE of different methods whereas the figures in the second row show the SMD of different methods. Figure 7: Results of the tradeoff between fairness and accuracy. Figures in the first row show the experiment results on train data whereas the figures in the second row show the tradeoff in test data. In order to compare the results on different datasets, some results in Section 4 are repeated. We remark that both FKR and NRFC suffer from numerical instability with respect to MSE when fairness constraint is removed or strictly imposed which can be seen from experiment results on the Law School dataset. E.2 Experiments on constant baselines In this section, we evaluate the baseline with constant prediction equal to the mean of the labels. Since the "Constant Prediction" baseline can achieve perfect MP fairness in both train data and test data, we only compare the MSE of the "Constant Prediction" baseline and our method for simplicity. The experiment results are summarized in Table 1 and Table 2. The experiment results show that our method significantly outperforms the "Constant Prediction" baseline in all settings, as expected. We remark that for linear regression on the Synthetic dataset, the MSE of the "Constant Prediction" is about 77 higher × TrainTest234MSE1e−2k = 2TrainTest2341e−2k = 4TrainTest2341e−2k = 8TrainTest2341e−2k = 16TrainTest0123SMD1e−1TrainTest0241e−1TrainTest0.00.51.0TrainTest0.00.51.01.5KRRFPR-1FPR-3Ours24MSE1e−2024SMD1e−1Synthetic1.1251.1501.1751.200MSE1e−10121e−1Adult9.09.1MSE1e−301231e−2Law School2.02.53.0MSE1e−201231e−1C&C24MSE1e−246SMD1e−11.1001.1251.150MSE1e−1121e−19.69.8MSE1e−301231e−22.02.53.0MSE1e−21231e−1FKRFPRNRFCOurs than the MSE of our method since the MSE of "Constant Prediction" baseline is highly dependent on the scale of response. Mean Parity Fair Regression in RKHS Metric Method Constant MSE (Train) Constant MSE (Test) MSE (Train) Ours MSE (Test) Ours Adult Law School Communities & Crime Synthetic 0.1858 0.1839 0.1175 0.1327 ± ± ± ± Table 1: Experiment results on constant baselines for linear regression. ± ± ± ± ± ± ± ± 0.0544 0.0536 0.0313 0.0344 0.0010 0.0039 0.0009 0.0026 0.0016 0.0062 0.0018 0.0072 0.0002 0.0008 0.0002 0.0008 0.0101 0.0103 0.0092 0.0095 4.5342 4.6285 0.0585 0.0577 0.0450 0.1806 0.0081 0.0081 ± ± ± ± Metric Method Constant MSE (Train) Constant MSE (Test) MSE (Train) Ours MSE (Test) Ours Adult Law School Communities & Crime Synthetic 0.1858 0.1839 0.0913 0.1232 ± ± ± ± Table 2: Experiment results on constant baselines for kernel regression. ± ± ± ± ± ± ± ± 0.0101 0.0103 0.0050 0.0093 0.0002 0.0008 0.0002 0.0010 0.0016 0.0062 0.0020 0.0076 0.0010 0.0039 0.0010 0.0034 0.0544 0.0536 0.0294 0.0332 0.1474 0.1476 0.1151 0.1202 0.0015 0.0061 0.0014 0.0060 ± ± ± ± E.3 Experiments on CB fair regression In this section, we show the experimental results of applying our method to CB fairness. The datasets and experiment settings are the same as in Section 4 except for the choice of κS for FPR in the proposed method. In this experiment, we choose κS under Assumption 2. We compare the proposed method with baselines in terms of MSE and the Norm of the covariance matrix, i.e., Norm of Cov = Cov(φS(S), g(X, S)) (cid:107) S . (cid:107)H Figure 8 describes the results for the linear regression case which shows that our method achieves almost the same performance as NRFC. In Figure 9, we can find that the MSE of our methods is much lower than the MSE of NRFC in the train data. However, our method receives higher MSE than NRFC in the test data, which shows an overfitting problem in this setting. A similar trend can be found with respect to the norm of covariance. Figure 8: Results of linear regression on the Communities & Crime dataset with multiple binary sensitive attributes. Figures in the first row show the MSE of different methods whereas the figures in the second row show the Norm of Cov of different methods. TrainTest234MSE×10−2k=2TrainTest234×10−2k=4TrainTest234×10−2k=8TrainTest234×10−2k=16TrainTest02468NormofCov×101TrainTest0.000.250.500.751.00×102TrainTest0.000.250.500.751.00×102TrainTest0.00.51.0×102OLSFKR-1FKR-3FPR-1FPR-3NRFCOurs Shaokui Wei, Jiayin Liu, Bing Li, Hongyuan Zha Figure 9: Results of kernel regression on the Communities & Crime dataset with multiple binary sensitive attributes. Figures in the first row show the MSE of different methods whereas the figures in the second row show the Norm of Cov of different methods. E.4 Experiments on DP fairness regression We also compare the performance of our method with a recent (in-processing) method for DP fairness, i.e., the reduction- based algorithm (RBA, Agarwal et al. (2018)). Note that RBA is designed to produce a DP-fair randomized predictor rather than a simple linear/kernel regression function. We test RBA under the setting of the linear regression with a single binary sensitive attribute, and the experiment results on two benchmark datasets are shown in Figure 10. Figure 10: Results under the setting of linear regression with a single binary sensitive attribute. In this experiment, we found that enforcing DP fairness helps to improve MP fairness and vice versa. However, as DP is a stronger notion of fairness, a DP-fair regression function has a significantly larger cost of fairness, i.e., a larger loss. Note that all algorithms suffer from distribution shifts in the test data, so both MSE, SMD, and DPD are higher in the testing phase. However, since DP fairness is stronger than MP fairness, RAB can achieve comparable and even lower SMD on the test dataset sometimes, even if our algorithm can eliminate MP unfairness in the train data. This motivates us to investigate the generalization problem for fair algorithms in our future work. We remark that our method is almost 200 faster than RBA in the above experiment. × TrainTest024MSE1e−2k = 2TrainTest0241e−2k = 4TrainTest0241e−2k = 8TrainTest0241e−2k = 16TrainTest02468Norm of Cov1e1TrainTest0.000.250.500.751.001e2TrainTest0.000.250.500.751.001e2TrainTest0.00.51.01e2OLSFKR-1FKR-3FPR-1FPR-3NRFCOursTrainTest1.11.21.31.41.5MSE1e−1AdultTrainTest012SMD1e−1AdultTrainTest0123DPD1e−1AdultTrainTest0.80.91.0MSE1e−2Law SchoolTrainTest01234SMD1e−2Law SchoolTrainTest024DPD1e−1Law SchoolOLSFKR-1FKR-3FPR-1FPR-3RBANRFCOurs E.5 Experiments on other loss functions Mean Parity Fair Regression in RKHS In this section, we evaluate the proposed method on other loss functions using gradient descent (Fair-GD). Specifically, we set the loss function to be Smooth L1 Loss, a commonly used loss function that is less sensitive to outliers than the MSE as it treats error as square only inside an interval. We evaluate Fair-GD in the setting of linear regression with single binary sensitive attribute and compare Fair-GD with the gradient descent (GD) algorithm to show its effect on enforcing fairness. 4. The results are In this experiment, we use Adam (Kingma and Ba, 2014) as our optimizer with a learning rate 1 summarized in Figure 11 and Figure 12, from which we can see that Fair-GD enjoys the same convergence rate as GD while consistently enforcing the fairness constraint. 10− × Figure 11: Results of Fair-GD with single binary sensitive attribute using Smooth L1 Loss (β = 0.1). Figures in the first row show the loss of different methods whereas the figures in the second row show the SMD of different methods. Figure 12: Results of Fair-GD with single binary sensitive attribute using Smooth L1 Loss (β = 1). Figures in the first row show the loss of different methods whereas the figures in the second row show the SMD of different methods. E.6 Visualization of distribution In this section, we provide the visualization of MP-fair response for all datasets as an extension to Figure 4. The results are summarized in Figure 13. 05001000Step10−1100LossSyntheticModelGDFair-GDPhaseTrainTest05001000Step100101102AdultModelGDFair-GDPhaseTrainTest05001000Step102103Law SchoolModelGDFair-GDPhaseTrainTest05001000Step10−1100101Communities & CrimeModelGDFair-GDPhaseTrainTest05001000Step10−710−510−310−1SMDModelGDFair-GDPhaseTrainTest05001000Step10−510−310−1ModelGDFair-GDPhaseTrainTest05001000Step10−310−1101ModelGDFair-GDPhaseTrainTest05001000Step10−610−410−2100ModelGDFair-GDPhaseTrainTest05001000Step10−210−1100LossSyntheticModelGDFair-GDPhaseTrainTest05001000Step100101102AdultModelGDFair-GDPhaseTrainTest05001000Step101102103Law SchoolModelGDFair-GDPhaseTrainTest05001000Step10−1100101C&CModelGDFair-GDPhaseTrainTest05001000Step10−510−2SMDModelGDFair-GDPhaseTrainTest05001000Step10−510−310−1ModelGDFair-GDPhaseTrainTest05001000Step10−2100102ModelGDFair-GDPhaseTrainTest05001000Step10−510−2ModelGDFair-GDPhaseTrainTest Shaokui Wei, Jiayin Liu, Bing Li, Hongyuan Zha Figure 13: Visualization of response and predicted MP-fair response. Figures in the first row and the third row show the conditional distribution of response variables in the training dataset and test dataset, respectively. Similarly, the figures in the second row and the fourth row show the conditional distribution of the predicted response variables in the training dataset and test dataset, respectively. E.7 Removing sensitive attributes In this section, we consider the case of removing the sensitive attributes from the regression function which is a good choice for mitigating unfairness. We remark that such a setting can be regarded as a special case of our general setting. By choosing a kernel κXS which ignores the input S, i.e., κXS(X, S) = κX (X), the proposed method can be adapted to fair regression without sensitive attributes. We evaluate the proposed method for regression without inputting sensitive attributes on the linear regression with binary sensitive attribute case and summarize the experiment results in Table 3. Note that we omit the SMD in the training dataset since it is zero in our experiments. The experiment results show that including the sensitive attribute in regression can help to reduce the MSE while removing the sensitive attribute may help to improve the testing fairness. F TABLE OF NOTATIONS We summarize the notations used throughout this paper in the following table. −20−10010Response0.000.050.100.15DensitySyntheticS=1S=0−0.50.00.51.0Response051015AdultS=1S=0−0.4−0.20.00.2Response012345Law SchoolS=1S=0−0.50.00.51.0Response01234Communities & CrimeS=1S=0−10−50510Prediction0.000.050.100.15DensityS=1S=0−1.0−0.50.00.51.01.5Prediction012345S=1S=0−0.10.00.10.2Prediction0.02.55.07.510.012.5S=1S=0−0.50.00.51.0Prediction01234S=1S=0−10010Response0.000.050.100.150.20DensityS=1S=0−0.50.00.51.0Response051015S=1S=0−0.4−0.20.00.20.4Response0246S=1S=0−0.50.00.51.0Response012345S=1S=0−505Prediction0.000.050.100.150.20DensityS=1S=0−2−101Prediction0.00.51.01.52.0S=1S=0−0.10.00.10.2Prediction05101520S=1S=0−2−101Prediction0.00.51.01.52.02.53.0S=1S=0S=1S=0 Mean Parity Fair Regression in RKHS Train Test MSE w/ S MSE w/o S MSE w/ S MSE w/ S SMD w/o S SMD w/o S Synthetic Adult Law School C&C 0.0584 0.1176 0.0092 0.0313 ± ± ± ± 0.0081 0.0018 0.0002 0.0009 2.2994 0.1203 0.0094 0.0375 ± ± ± ± 0.6630 0.0022 0.0002 0.0010 0.0577 0.1327 0.0095 0.0344 0.0081 0.0072 0.0008 0.0026 ± ± ± ± 2.4286 0.1350 0.0097 0.0402 ± ± ± ± 0.7560 0.0076 0.0008 0.0028 0.1508 0.0300 0.0055 0.0232 0.1348 0.0243 0.0034 0.0164 ± ± ± ± 0.1957 0.0355 0.0042 0.0187 ± ± ± ± 0.1235 0.0221 0.0033 0.0087 Table 3: Experiments on Mean Parity fair linear regression with (w/) and without (w/o) the sensitive attitude S. Table 4: Table of notations Notation Description/Definition ∆ Σ ˆΣ ̃Σ Φ Ω G M P An arbitrary function in The covariance operator The empirical estimation of Σ The uncentralized covariance operator The feature matrix of the data A set from which a random variable is chosen Borel σ-filed on Ω The expectation function The probability function Set of real numbers A MP-fair space A linear operator The cumulative distribution function of random variable The generalized objective function for regression problem The mean square loss function The projection operator The empirical estimation of P Random variable for sensitive attributes Random variable for non-sensitive attributes Random variable for label/response 1 H = In n 1n × The Gram matrix P = (In The vector of response in dataset The predicted value of Y The DP disparity The MP disparity A scalar in [0, 1] to control the accuracy-fairness tradeoff A real number Random noise The parameter for fairness penalty term A real number An (normalized) eigenfunction of Σ(XS)SAΣS(XS) Kernel function The regularization coefficient A kernel mean embedding Feature map Eigenvalue The empirically centralized feature map The weight vector for an (normalized) eigenfunction with respect to ΦXS The weight vector for an (normalized) eigenfunction with respect to ̄ΦXS j=1 amaT × (cid:80)m mKXS) − − × n n n F E P R M P G A F J L P ˆP S X Y H K P Y ˆY DPD MPD α β (cid:15) ζ η θ κ λ μ φ ψ ̄φ a ̄a Shaokui Wei, Jiayin Liu, Bing Li, Hongyuan Zha M P G GM P ⊥ Functions The least-squares regression function An optimal solution for Problem 1 The empirical estimation of g∗ G An optimal solution to Problem 5 The projection of g on The projection of g on A function defined as h = E(φXS(X, S)Y ) The cardinality of ΩS The rank of Σ(XS)S The number of training samples A realization of S A realization of X A realization of Y A weight vector A differentiable loss function The kernel of a linear operator The range of a linear operator The outer product The inner product The zero function in H The Moore-Penrose Inverse of an operator The indicator function The orthogonal complement of a space Independence between two random variables g, f g∗ g∗ G ˆg∗ G gα gM P gM P ⊥ h k m n s x y w (cid:96) ker ran *(cid:105) ⊗ , (cid:104)* 0 H † I( * ) ⊥ ⊥⊥
http://arxiv.org/abs/2302.10406v1
2023-02-21T02:42:03
2023-02-21T02:42:03
Time to Embrace Natural Language Processing (NLP)-based Digital Pathology: Benchmarking NLP- and Convolutional Neural Network-based Deep Learning Pipelines
NLP-based computer vision models, particularly vision transformers, have been shown to outperform CNN models in many imaging tasks. However, most digital pathology artificial-intelligence models are based on CNN architectures, probably owing to a lack of data regarding NLP models for pathology images. In this study, we developed digital pathology pipelines to benchmark the five most recently proposed NLP models (vision transformer (ViT), Swin Transformer, MobileViT, CMT, and Sequencer2D) and four popular CNN models (ResNet18, ResNet50, MobileNetV2, and EfficientNet) to predict biomarkers in colorectal cancer (microsatellite instability, CpG island methylator phenotype, and BRAF mutation). Hematoxylin and eosin-stained whole-slide images from Molecular and Cellular Oncology and The Cancer Genome Atlas were used as training and external validation datasets, respectively. Cross-study external validations revealed that the NLP-based models significantly outperformed the CNN-based models in biomarker prediction tasks, improving the overall prediction and precision up to approximately 10% and 26%, respectively. Notably, compared with existing models in the current literature using large training datasets, our NLP models achieved state-of-the-art predictions for all three biomarkers using a relatively small training dataset, suggesting that large training datasets are not a prerequisite for NLP models or transformers, and NLP may be more suitable for clinical studies in which small training datasets are commonly collected. The superior performance of Sequencer2D suggests that further research and innovation on both transformer and bidirectional long short-term memory architectures are warranted in the field of digital pathology. NLP models can replace classic CNN architectures and become the new workhorse backbone in the field of digital pathology.
[ "Min Cen", "Xingyu Li", "Bangwei Guo", "Jitendra Jonnagaddala", "Hong Zhang", "Xu Steven Xu" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10406v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10406v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.CL", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.CL", "cs.CV", "cs.LG", "eess.IV", "q-bio.QM" ]
Time to Embrace Natural Language Processing (NLP)-based Digital Pathology: Benchmarking NLP- and Convolutional Neural Network-based Deep Learning Pipelines Min Cen1, Xingyu Li2, Bangwei Guo1, Jitendra Jonnagaddala3*, Hong Zhang2*, Xu Steven Xu4* 1School of Data Science, University of Science and Technology of China 2Department of Statistics and Finance, School of Management, University of Science and Technology of China 3School of Population Health, UNSW Sydney, Kensington, NSW, Australia 4Clinical Pharmacology and Quantitative Science, Genmab Inc., Princeton, New Jersey, USA *Corresponding author. [email protected] (Jitendra Jonnagaddala), [email protected] (Hong Zhang), [email protected] (Xu Steven Xu) Conflict of interest statements:XSX is an employee of Genmab, Inc. Genmab did not provide any funding for this study. Main text: 2988 words. 1 Abstract Natural language processing (NLP)-based computer vision models, particularly vision transformers, have been shown to outperform convolutional neural network (CNN) models in many imaging tasks. However, most digital pathology artificial-intelligence models are based on CNN architectures, probably owing to a lack of data regarding NLP models for pathology images. In this study, we developed digital pathology pipelines to benchmark the five most recently proposed NLP models (vision transformer (ViT), Swin Transformer, MobileViT, CMT, and Sequencer2D) and four popular CNN models (ResNet18, ResNet50, MobileNetV2, and EfficientNet) to predict biomarkers in colorectal cancer (microsatellite instability, CpG island methylator phenotype, and BRAF mutation). Hematoxylin and eosin-stained whole-slide images from Molecular and Cellular Oncology and The Cancer Genome Atlas were used as training and external validation datasets, respectively. Cross-study external validations revealed that the NLP-based models significantly outperformed the CNN-based models in biomarker prediction tasks, improving the overall prediction and precision up to approximately 10% and 26%, respectively. Notably, compared with existing models in the current literature using large training datasets, our NLP models achieved state-of-the-art predictions for all three biomarkers using a relatively small training dataset, suggesting that large training datasets are not a prerequisite for NLP models or transformers, and NLP may be more suitable for clinical studies in which small training datasets are commonly collected. The superior performance of Sequencer2D suggests that further research and innovation on both transformer and bidirectional long short-term memory architectures are warranted in the field of digital 2 pathology. NLP models can replace classic CNN architectures and become the new workhorse backbone in the field of digital pathology. Key words: digital pathology, deep learning, colorectal cancer, biomarkers, natural language processing, convolutional neural network 3 1. Introduction Convolutional neural networks (CNNs), such as ResNet (He et al., 2016) and EfficientNet (Tan and Le, 2019), have served as the mainstream architecture for digital pathology, including tumor detection (Campanella et al., 2019; Pinckaers et al., 2021), subtyping (Lu et al., 2021; Wang et al., 2019; Zhu et al., 2021) and grading (Bulten et al., 2020; Shaban et al., 2020; Ström et al., 2020). CNNs have shown excellent performance in predicting molecular biomarkers using hematoxylin and eosin (H&E)-stained histopathological images. Yamashita et al. used MobileNetV2 to predict microsatellite instability (MSI) (Yamashita et al., 2021). Laleh et al.(2022) adopted EfficientNet and achieved outstanding performance in subtyping, gene mutation prediction, and biomarker prediction for four types of cancer. Natural language processing (NLP) has been dominant in the fields of speech recognition (Dong et al., 2018), synthesis (Li et al., 2019), text to speech translation (Vila et al., 2018), and natural language generation (Topal et al., 2021). The emergence of transformers (Vaswani et al., 2017) has started a new era of NLP. Inspired by the success of transformers, Dosovitskiy et al. (2020) proposed the vision transformer (ViT) for image analysis. Subsequently, various variants of the ViT have emerged and achieved state-of-the-art results, outperforming CNNs (Liu et al., 2021; Mehta and Rastegari, 2021; Zhai et al., 2022). Recently, Tatsunami and Taki (2022) proposed a sequencer using long short-term memory (LSTM), another type of NLP, and achieved competitive results with ViT on ImageNet classification and recognition tasks. However, NLP-based models are scarce in the field of digital pathology. Laleh et al. (2022) demonstrated that a ViT model outperforms some CNN architectures in different digital pathology tasks. Despite the perception that large training datasets are required for transformers, 4 our recent study demonstrated that Swin-T transformers achieve superior predictive performance in predicting microsatellite instability (MSI) and other biomarkers in colorectal cancer and are more robust than CNN models for small training sets (Guo et al., 2022a). However, Deininger et al. (2022) indicated that ViT models exhibit similar performances to ResNet18 but require more effort in training. Given the potential of NLP-based methods, although limited in terms of application in the current literature, the most recently developed NLP-based models must be fully and urgently investigated and compared in a clinical study setting (i.e., with only relatively small datasets available) to provide proper recommendations and guidance for digital pathology. In this study, we aimed to develop digital pathology pipelines to benchmark the five most recently proposed NLP models (ViT (Dosovitskiy et al., 2020), Swin Transformer (Swin-T) (Liu et al., 2021), MobileViT (Mehta and Rastegari, 2021), CMT (Guo et al., 2022b), and Sequencer2D (Tatsunami and Taki, 2022)) and four popular CNN models (ResNet18(He et al., 2016), ResNet50 (He et al., 2016), MobileNetV2 (Sandler et al., 2018), and EfficientNet (Tan and Le, 2019)) to predict key molecular pathways and gene mutations (i.e., MSI, BRAF mutation, and CpG island methylator phenotype [CIMP]) in colorectal cancer (CRC) using H&E-stained whole-slide images (WSIs). This study provides data to better understand the performance of advanced NLP models compared with that of popular CNN models in pathology prediction tasks and recommendations regarding preferred models in digital pathology. To the best of our knowledge, this is the first study to apply and evaluate advanced NLP models such as CMT, MobileViT, and Sequencer2D in digital pathology prediction tasks. 2. Methods 5 We developed five NLP-based and four CNN-based pipelines to predict molecular-level information, including the MSI status, BRAF mutation, and CIMP status. The prediction pipeline (Figure 1) comprises four modules: (a) image preprocessing, (b) tumor tissue selection, (c) tile-level score prediction using NLP- or CNN-based architectures, and (d) tile-level score aggregation. We compared the prediction performance model sizes and run times for all models. 2.1. Datasets The H&E-stained WSIs of patients with CRC from two study cohorts were used: Molecular and Cellular Oncology (MCO) and The Cancer Genome Atlas (TCGA). The MCO-CRC (Ward, 2015 #83) (Jonnagaddala et al., 2016) dataset consisted of patients who underwent curative resection for CRC between 1994 and 2010 in New South Wales, Australia, and is available through the SREDH Consortium (www.sredhconsortium.org, accessed on February 15, 2023. The ground-truth labels for the MSI status of the MCO dataset were determined using mismatch repair immunohistochemistry (IHC). BRAF mutations (V600E) were identified via IHC, PCR, or Sanger sequencing. The TCGA dataset (publicly available at https://portal.gdc.cancer.gov) is a multicenter study of patients with stage I–IV disease, primarily from the United States. Data from TCGA-COAD and TCGA-READ cohorts were used (hereafter referred to as TCGA-CRC-DX). The ground-truth labels of the MSI status, BRAF mutation, and CIMP status for TCGA-CRC-DX were obtained from Liu et al. (2018) Furthermore, for a better comparison with the existing literature, we used the same TCGA- CRC-DX sub-datasets for each biomarker as those used and published by Kather et al. (2020) and Bilal et al. (2021) (referred to hereafter as TCGA-CRC-DX). For patients with more than 6 one available WSI, one slide was randomly selected for each patient. Supplementary Table 1 lists the number of the patients' WSIs for each label that we used for training and testing. We selected the tiles of the tumor region using a nine-class tissue classifier based on the publicly available NCT-CRC-HE-100K and CRC-VAL-HE-7K (Guo et al., 2022a) datasets. Up to 500 tumor tiles were randomly selected per patient as tiles of interest for the downstream deep learning. 2.2. Image Preprocessing Following a procedure similar to that of Laleh et al. (2022), all WSIs were tessellated into small image tiles of 512 × 512 pixels at a resolution of 0.5 μm. The tiles were color normalized using the Macenko method (Macenko et al., 2009). Image tiles containing background or blurry images were automatically removed from the dataset during this process by the detected edge quantity (canny edge detection in Python's OpenCV package) (https://github.com/KatherLab/preProcessing). The image tiles were then resized to 224 × 224 pixels to fit the input of the networks. 2.3. NLP-Based Deep Learning Framework • Vision Transformer. ViT (Dosovitskiy et al., 2020) was proposed in 2020. It can account for long-range dependencies in images and incorporate more global information than CNNs. ViT divides an input image into multiple patches (16 × 16) and projects each patch into a fixed-length vector. ViT has achieved state-of-the-art results for a variety of computer vision tasks(Dosovitskiy et al., 2020). ViT was first adopted by Laleh et al. (2022) in digital pathology. The limitations of ViT include its large model size and high computing power requirements (Dosovitskiy et al., 2020). 7 • Swin Transformer. Unlike word tokens, which are the basic elements of processing in language transformers, visual elements can vary significantly in scale. Additionally, pixel resolutions in an image are much higher than those in text paragraphs. Therefore, Liu et al. (2021) proposed the Swin-T for constructing a hierarchical representation by gradually merging adjacent patches in deeper transformer layers. This allows Swin-T to easily utilize dense prediction and reduce the computational complexity from quadratic (ViT) to linear. We have shown that Swin-T can achieve excellent biomarker prediction using relatively small datasets (Guo et al., 2022a). • MobileViT. Owing to the demand for lightweight networks in mobile vision tasks, the transformer-based model MobileViT (Mehta and Rastegari, 2021) was proposed by Apple Inc. in 2021 to leverage the light weight of CNNs and global representation of ViT. MobileViT primarily comprises ordinary convolution, inverted residual blocks in MobileNetV2, MobileViT blocks, global pooling, and fully connected layers. A MobileViT block preserves the order of the patches and of each pixel in each patch. Moreover, MobileViT replaces matrix multiplication with a transformer to obtain global representations and has convolutional features. • CMT. CMT (Guo et al., 2022b) is a hybrid network leveraging the advantages of both CNNs and transformers. It introduces a convolution operation for fine-grained feature extraction and employs a unique module hierarchical extraction of local and global features. Most transformer-based models use a large convolution (such as the 16 × 16 convolution kernel in ViT) to cut the input image directly into non-overlapping tiles. However, this approach loses the 2D spatial features, edge information, and many details in the patch. 8 Therefore, CMT uses a structure formed by stacking multiple 3 × 3 convolutions to down sample and extract detailed features. CMT has achieved state-of-the-art accuracy in image classification (Guo et al., 2022b). • Sequencer2D. Sequencer2D (Tatsunami and Taki, 2022) uses LSTMs rather than self- attention layers, such as transformers, because an LSTM is more memory-economical and parameter-saving than a transformer. Sequencer2D takes non-overlapping tiles as input and processes them to a feature map; this feature map is then fed to bidirectional long short-term memory (BiLSTM) layers and a multi-layer perceptron with a linear classifier by a global average pooling layer at the top of the model. The BiLSTM architecture allows the vertical and horizontal axes to be parallel, which improves the accuracy and efficiency of the sequencer owing to the reduced sequence length, and yields a spatially meaningful receptive field. Sequencer2D has achieved competitive performance in image classification (Tatsunami and Taki, 2022). The Supplementary Materials and Methods section describes the CNN models. 2.4. Training, Testing and Hyperparameter Tuning All NLP- and CNN-based models were trained on the MCO-CRC dataset. Five-fold cross- validations were performed to select the optimal model. The models selected were then externally tested on the TCGA-CRC-DX dataset. Weighted cross-entropy loss and Adam optimizer were used to train the models. The initial learning rate of the models was set to 0.0001. Early stopping was used to avoid overfitting during training. 9 2.5. Statistical Analyses The predictive performance of the deep learning models was evaluated using the values of the area under the receiver operating curve (AUROC) to gauge the overall predictive performance and that of the area under the precision-recall curve (AUPRC) to gauge the precision. Bootstrapping (1,000×) was used to calculate the 95% confidence intervals (Cis) of the AUROC and AUPRC values. To compare the model run times, the training time for an epoch and prediction time (all patients in the TCGA-CRC-DX) for the MSI status were recorded. 3. Results 3.1. Predictive Performance MSI All NLP-based methods outperformed the CNN-based algorithms in predicting the MSI status regarding both the AUROC and AUPRC (Tables 1/2 and Figure 2). Among the NLP-based models, the MobileViT model achieved the lowest AUROC and AUPRC values (82.9% and 55.3%, respectively); however, these were higher than the highest AUROC (80.9%, ResNet50) and AUPRC (43.9%, MobilNetV2) values obtained by the CNN models tested. The CMT achieved a state-of-the-art performance with an AUROC of 90.6% (with a 95% CI of 86.2– 94.4%), which is almost 10% higher than that of the best-performing CNN-based model, that is, ResNet50 with an AUROC value of 80.9% (95% CI: 75.6–85.9%). In addition, the Swin-T, ViT, Sequencer2D and MobileViT models demonstrated competitive AUROC values in the MSI prediction, i.e., 86.8% (95% CI:80.8–92.1%), 86.3% (95% CI: 80.1–91.7%), 84.3% (95% 10 CI: 77.9–90.1%), and 82.9% (95% CI: 76.5–88.8%), respectively. The Swin-T model for the MSI produced the highest AUPRC value (69.7%), almost 26% higher than that of the best- performing CNN model (MobilNetV2; AUPRC = 43.9%). The CMT, ViT, and Sequencer2D models achieved similarly high AUPRC values, ranging from 65.6% to 68.4%. BRAF mutation Overall, the NLP-based models predicted BRAF mutations better than the CNN-based models. The Sequencer2D model achieved the highest AUROC (80.2%; 95% CI: 73.4–86.0%), followed by ViT (78.6%) and Swin-T (78.4%). The CMT model achieved the lowest AUROC (76.2%) among the NLP-based models. For the CNN-based methods, ResNet50 produced an AUROC (77.3%), which is on par with that of MobileViT. In terms of the AUPRC, Swin-T achieved the best precision (AUPRC = 43.2%; 95% CI: 30.8– 55.8%). Sequencer2D also achieved an outstanding AUPRC of 40.2% (95% CI: 29.3–55.3%), which was higher than that achieved by any of the CNN models tested. However, it should be noted that, compared with Swin-T and Sequencer2D, the MobileViT, CMT, and ViT models produced suboptimal precisions, with an AUPRC of approximately 35%. CIMP status The NLP models predicted the CIMP status better than the CNN models. Sequencer2D and Swin-T were the two best models for predicting CIMP, achieving AUROC values of 79.5% (95% CI: 71.9–86.0%) and 78.2% (95% CI: 70.3–85.0%), respectively. In contrast, the best 11 AUROC value yielded by a CNN-based model was 72.5% (95% CI: 64.4–80.4%) by EfficientNet. In addition, Sequencer2D achieved the highest precision in predicting the CIMP status, with an AUPRC of 60.3% (95% CI: 48.2%–72.7%). The Swin-T and ViT models also achieved excellent precision results (AUPRC = 53.7% and 53.9%, respectively). In contrast, the highest AUPRC achieved by a CNN-based model (45.6%; 95% CI: 32.6–59.3%; MobileNetV2) was 14.7% lower than that of Sequencer2D. 3.2. Relationships Between the Model Complexity, Predictive Performance, and Run Time The sizes of the CNN-based models were generally smaller than those of the NLP-based models (Figure 3). MobileNetV2, EfficientNet, and MobileViT are the most lightweight models (~4M parameters), whereas the ViT model has the most model parameters (85.8M). The model sizes of CMT and Sequencer2D are comparable to that of ResNet50 (approximately 25M). Swin-T has approximately 48.84M parameters, which is substantially lower than that of ViT. As expected, the model predictive performance (AUROC and AUPRC) generally correlated with the model complexity and size (Figure 3). The CMT and Sequencer2D models exhibited outstanding predictive performance, despite their relatively small sizes. Similarly, Swin-T consistently outperformed the largest and most complex tested model ViT and tended to provide an excellent precision. 12 A positive relationship was observed between the model size and training/prediction times (Figure 4). As a tradeoff between their better predictive performances, the NLP models generally require longer training and prediction times compared with those of the CNN models. Interestingly, the CMT model required a much longer training time than the larger ViT model, suggesting a higher level of model complexity compared to the other models. Similar training and prediction times were required for the Sequencer2D, Swin-T, and ViT models, despite the differences in their model sizes. Overall, Sequencer2D and Swin-T exhibited the highest efficiencies (i.e., the highest performance/complexity ratio) among all CNN- and NLP-based models tested. 4. Discussion H&E-stained WSIs are ubiquitously available for almost all cancer patients. Advances in artificial intelligence have led to significant progress in digital pathology analysis using H&E- stained WSIs, including the prediction of molecular characteristics, pathways, and clinical outcomes in cancer patients (Bilal et al., 2021; Echle et al., 2022; Ilse et al., 2018; Kather et al., 2019; Li et al., 2022a; Li et al., 2022b; Lu et al., 2021; Schmauch et al., 2020). However, to date, most digital pathology pipelines have been based on CNN architectures (Echle et al., 2020; Echle et al., 2022) despite the recent emergence of NLP-based models. NLP architectures are more flexible for learning long-range interactions in images, whereas CNN networks tend to be more rigid and focused on local features from nearby pixels (Dosovitskiy et al., 2020). NLP- based models, such as transformers, have been demonstrated to outperform CNNs in many computer vision tasks (Dosovitskiy et al., 2020; Liu et al., 2021; Tatsunami and Taki, 2022). 13 In this study, we benchmarked five advanced NLP models and four popular CNN models in terms of predicting the MSI status, BRAF mutation, and CIMP status in CRC patients. The external validation on the TCGA-CRC-DX dataset demonstrated that the NLP-based models significantly outperformed the CNN-based models. In particular, compared with the best- performing CNN-based model, the NLP-based models improved the AUROC in predicting the MSI status, BRAF mutation, and CIMP status by 9.7%, 2.9%, and 7.0%, respectively, while improving the AUPRC (precision) by 25.8%, 1.2%, and 14.7%, respectively. Furthermore, the Sequencer2D and Swin-T models exhibited a remarkable robustness for precision, providing the highest AUPRC values for all three biomarkers. The MSI status is critical in treating CRC patients, and immunotherapies such as pembrolizumab and nivolumab have been approved by health authorities to treat CRC patients with MSI-High (André et al., 2020; Marcus et al., 2019). In predicting the MSI status, the performance achieved by CMT is the best among all artificial-intelligence models reported, including the most recent state-of-the-art model reported by Echle et al. (2022) trained on a large, multicenter dataset (N = 7917; AUROC = 91%), which is much larger than the MCO- CRC dataset (N = 1138) used for training in this study. The current clinical gold-standard test for MSI is based on IHC (Hampel et al., 2008; Stjepanovic et al., 2019). We showed that the NLP models, particularly the CMT model, can serve as a testing tool for the MSI status, reduce the turnaround time, and save on expenses. In addition, the Sequencer2D model for the BRAF mutation and CIMP status achieved a state-of-the-art performance compared with all existing models in the current literature. Notably, the AUROC values achieved by Sequencer2D in our external, cross-cohort validation were even higher than those obtained by Bilal et al. (2021) from an intra-cohort validation (i.e., four-fold cross-validation) using the TCGA-CRC-DX dataset (AUROC = 79%). 14 The NLP models have certain limitations. We showed that NLP-based models are generally larger and more complex than CNN-based models; consequently, NLP models generally require longer training and prediction times compared with CNN models. Nevertheless, the most recent Sequencer2D model successfully reduced their size to a level comparable to that of ResNet50, while consistently outperforming the larger and more complex models such as the original ViT model. Overall, Sequencer2D and Swin-T demonstrated the highest performance/complexity ratio among all CNN- and NLP-based models tested. Finally, unlike transformers, Sequencer2D is built on a more traditional BiLSTM architecture. In our benchmarking experiments, Sequencer2D tended to exhibit similar or better prediction performance in terms of both AUROC and AUPRC compared with the transformer models, while requiring less training and prediction run times than the ViT, Swin-T, and CMT models. The success of Sequencer2D highlights the advantages of LSTM, as it may provide a novel and more feasible choice for digital pathology tasks and suggests that further research and innovation on BiLSTM architectures should be conducted in the fields of digital pathology and computer vision. Acknowledgements The work of MC, XL, BG and HZ was partially supported by National Natural Science Foundation of China (No. 12171451 and No. 72091212) and Anhui Center for Applied Mathematics. JJ is funded by the Australian National Health and Medical Research Council 15 (No. GNT1192469) who acknowledges the funding support received through the Research Technology Services at UNSW Sydney, Google Cloud Research (award# GCP19980904) and NVIDIA Academic Hardware grant programs. And the MCO_CRC dataset was provided by the SREDH Consortium's (downloaded from https//:www.sredhconsortium.org, accessed on 15 November 2022) Translational Cancer Bioinformatics working group. Author contributions statement XSX, MC and HZ contributed to design of the research. JJ, XSX, XL and MC contributed to data acquisition. MC, BG and XSX contributed to data analysis. XSX, MC, JJ and HZ wrote the manuscript; and all authors critically reviewed the manuscript and approved the final version. 16 References André, T., Shiu, K.-K., Kim, T.W., Jensen, B.V., Jensen, L.H., Punt, C., Smith, D., Garcia-Carbonero, R., Benavides, M., Gibbs, P., 2020. Pembrolizumab in microsatellite-instability–high advanced colorectal cancer. New England Journal of Medicine 383, 2207-2218. Bilal, M., Raza, S.E.A., Azam, A., Graham, S., Ilyas, M., Cree, I.A., Snead, D., Minhas, F., Rajpoot, N.M., 2021. Development and validation of a weakly supervised deep learning framework to predict the status of molecular pathways and key mutations in colorectal cancer from routine histology images: a retrospective study. The Lancet Digital Health 3, e763-e772. Bulten, W., Pinckaers, H., van Boven, H., Vink, R., de Bel, T., van Ginneken, B., van der Laak, J., Hulsbergen- van de Kaa, C., Litjens, G., 2020. Automated deep-learning system for Gleason grading of prostate cancer using biopsies: a diagnostic study. The Lancet Oncology 21, 233-241. Campanella, G., Hanna, M.G., Geneslaw, L., Miraflor, A., Werneck Krauss Silva, V., Busam, K.J., Brogi, E., Reuter, V.E., Klimstra, D.S., Fuchs, T.J., 2019. Clinical-grade computational pathology using weakly supervised deep learning on whole slide images. Nature medicine 25, 1301-1309. Deininger, L., Stimpel, B., Yuce, A., Abbasi-Sureshjani, S., Schönenberger, S., Ocampo, P., Korski, K., Gaire, F., 2022. A comparative study between vision transformers and CNNs in digital pathology. arXiv preprint arXiv:2206.00389. Dong, L., Xu, S., Xu, B., 2018. Speech-transformer: a no-recurrence sequence-to-sequence model for speech recognition, 2018 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP). IEEE, pp. 5884-5888. Dosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., Dehghani, M., Minderer, M., Heigold, G., Gelly, S., 2020. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929. Echle, A., Grabsch, H.I., Quirke, P., van den Brandt, P.A., West, N.P., Hutchins, G.G., Heij, L.R., Tan, X., Richman, S.D., Krause, J., 2020. Clinical-grade detection of microsatellite instability in colorectal tumors by deep learning. Gastroenterology 159, 1406-1416. e1411. Echle, A., Laleh, N.G., Quirke, P., Grabsch, H., Muti, H., Saldanha, O., Brockmoeller, S., van den Brandt, P., Hutchins, G., Richman, S., 2022. Artificial intelligence for detection of microsatellite instability in colorectal cancer-a multicentric analysis of a pre-screening tool for clinical application. ESMO open 7, 100400. Guo, B., Li, X., Jonnagaddala, J., Zhang, H., Xu, X.S., 2022a. Predicting microsatellite instability and key biomarkers in colorectal cancer from H&E-stained images: Achieving SOTA predictive performance with fewer data using Swin Transformer. arXiv preprint arXiv:2208.10495. Guo, J., Han, K., Wu, H., Tang, Y., Chen, X., Wang, Y., Xu, C., 2022b. Cmt: Convolutional neural networks meet vision transformers, Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12175-12185. Hampel, H., Frankel, W.L., Martin, E., Arnold, M., Khanduja, K., Kuebler, P., Clendenning, M., Sotamaa, K., Prior, T., Westman, J.A., 2008. Feasibility of screening for Lynch syndrome among patients with colorectal cancer. Journal of Clinical Oncology 26, 5783. He, K., Zhang, X., Ren, S., Sun, J., 2016. Deep residual learning for image recognition, Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770-778. Ilse, M., Tomczak, J., Welling, M., 2018. Attention-based deep multiple instance learning, International conference on machine learning. PMLR, pp. 2127-2136. 17 Jonnagaddala, J., Croucher, J.L., Jue, T.R., Meagher, N.S., Caruso, L., Ward, R., Hawkins, N.J., 2016. Integration and analysis of heterogeneous colorectal cancer data for translational research, Nursing Informatics 2016. IOS Press, pp. 387-391. Kather, J.N., Heij, L.R., Grabsch, H.I., Loeffler, C., Echle, A., Muti, H.S., Krause, J., Niehues, J.M., Sommer, K.A., Bankhead, P., 2020. Pan-cancer image-based detection of clinically actionable genetic alterations. Nature cancer 1, 789-799. Kather, J.N., Pearson, A.T., Halama, N., Jäger, D., Krause, J., Loosen, S.H., Marx, A., Boor, P., Tacke, F., Neumann, U.P., 2019. Deep learning can predict microsatellite instability directly from histology in gastrointestinal cancer. Nature medicine 25, 1054-1056. Laleh, N.G., Muti, H.S., Loeffler, C.M.L., Echle, A., Saldanha, O.L., Mahmood, F., Lu, M.Y., Trautwein, C., Langer, R., Dislich, B., 2022. Benchmarking weakly-supervised deep learning pipelines for whole slide classification in computational pathology. Medical image analysis 79, 102474. Li, N., Liu, S., Liu, Y., Zhao, S., Liu, M., 2019. Neural speech synthesis with transformer network, Proceedings of the AAAI Conference on Artificial Intelligence, pp. 6706-6713. Li, X., Cen, M., Xu, J., Zhang, H., Xu, X.S., 2022a. Improving feature extraction from histopathological images through a fine-tuning ImageNet model. Journal of Pathology Informatics 13, 100115. Li, X., Jonnagaddala, J., Cen, M., Zhang, H., Xu, S., 2022b. Colorectal cancer survival prediction using deep distribution based multiple-instance learning. Entropy 24, 1669. Liu, Y., Sethi, N.S., Hinoue, T., Schneider, B.G., Cherniack, A.D., Sanchez-Vega, F., Seoane, J.A., Farshidfar, F., Bowlby, R., Islam, M., 2018. Comparative molecular analysis of gastrointestinal adenocarcinomas. Cancer cell 33, 721-735. e728. Liu, Z., Lin, Y., Cao, Y., Hu, H., Wei, Y., Zhang, Z., Lin, S., Guo, B., 2021. Swin transformer: Hierarchical vision transformer using shifted windows, Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 10012-10022. Lu, M.Y., Williamson, D.F., Chen, T.Y., Chen, R.J., Barbieri, M., Mahmood, F., 2021. Data-efficient and weakly supervised computational pathology on whole-slide images. Nature biomedical engineering 5, 555-570. Macenko, M., Niethammer, M., Marron, J.S., Borland, D., Woosley, J.T., Guan, X., Schmitt, C., Thomas, N.E., 2009. A method for normalizing histology slides for quantitative analysis, 2009 IEEE international symposium on biomedical imaging: from nano to macro. IEEE, pp. 1107-1110. Marcus, L., Lemery, S.J., Keegan, P., Pazdur, R., 2019. FDA Approval Summary: Pembrolizumab for the Treatment of Microsatellite Instability-High Solid Tumors. Clinical Cancer Research 25, 3753-3758. Mehta, S., Rastegari, M., 2021. Mobilevit: light-weight, general-purpose, and mobile-friendly vision transformer. arXiv preprint arXiv:2110.02178. Pinckaers, H., Bulten, W., van der Laak, J., Litjens, G., 2021. Detection of prostate cancer in whole-slide images through end-to-end training with image-level labels. IEEE Transactions on Medical Imaging 40, 1817-1826. Sandler, M., Howard, A., Zhu, M., Zhmoginov, A., Chen, L.-C., 2018. Mobilenetv2: Inverted residuals and linear bottlenecks, Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4510-4520. Schmauch, B., Romagnoni, A., Pronier, E., Saillard, C., Maillé, P., Calderaro, J., Kamoun, A., Sefta, M., Toldo, S., Zaslavskiy, M., 2020. A deep learning model to predict RNA-Seq expression of tumours from whole slide images. Nature communications 11, 1-15. 18 Shaban, M., Awan, R., Fraz, M.M., Azam, A., Tsang, Y.-W., Snead, D., Rajpoot, N.M., 2020. Context-aware convolutional neural network for grading of colorectal cancer histology images. IEEE transactions on medical imaging 39, 2395-2405. Stjepanovic, N., Moreira, L., Carneiro, F., Balaguer, F., Cervantes, A., Balmaña, J., Martinelli, E., 2019. Hereditary gastrointestinal cancers: ESMO Clinical Practice Guidelines for diagnosis, treatment and follow- up. Annals of Oncology 30, 1558-1571. Ström, P., Kartasalo, K., Olsson, H., Solorzano, L., Delahunt, B., Berney, D.M., Bostwick, D.G., Evans, A.J., Grignon, D.J., Humphrey, P.A., 2020. Artificial intelligence for diagnosis and grading of prostate cancer in biopsies: a population-based, diagnostic study. The Lancet Oncology 21, 222-232. Tan, M., Le, Q., 2019. Efficientnet: Rethinking model scaling for convolutional neural networks, International conference on machine learning. PMLR, pp. 6105-6114. Tatsunami, Y., Taki, M., 2022. Sequencer: Deep LSTM for Image Classification. arXiv preprint arXiv:2205.01972. Topal, M.O., Bas, A., van Heerden, I., 2021. Exploring transformers in natural language generation: Gpt, bert, and xlnet. arXiv preprint arXiv:2102.08036. Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A.N., Kaiser, Ł., Polosukhin, I., 2017. Attention is all you need. Advances in neural information processing systems 30. Vila, L.C., Escolano, C., Fonollosa, J.A., Costa-Jussa, M.R., 2018. End-to-End Speech Translation with the Transformer, IberSPEECH, pp. 60-63. Wang, X., Chen, H., Gan, C., Lin, H., Dou, Q., Tsougenis, E., Huang, Q., Cai, M., Heng, P.-A., 2019. Weakly supervised deep learning for whole slide lung cancer image analysis. IEEE transactions on cybernetics 50, 3950-3962. Yamashita, R., Long, J., Longacre, T., Peng, L., Berry, G., Martin, B., Higgins, J., Rubin, D.L., Shen, J., 2021. Deep learning model for the prediction of microsatellite instability in colorectal cancer: a diagnostic study. The Lancet Oncology 22, 132-141. Zhai, X., Kolesnikov, A., Houlsby, N., Beyer, L., 2022. Scaling vision transformers, Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12104-12113. Zhu, M., Ren, B., Richards, R., Suriawinata, M., Tomita, N., Hassanpour, S., 2021. Development and evaluation of a deep neural network for histologic classification of renal cell carcinoma on biopsy and surgical resection slides. Scientific reports 11, 1-9. 19 Table 1: Performance statistics (AUROC) for external validation for TCGA-CRC-DX dataset. Patient-level AUROC with a 95% confidence interval obtained via bootstrapping (1,000×) calculated for nine models in predicting MSI, BRAF mutation, and CIMP. Green rows indicate the NLP-based models other rows indicate CNN-based models. Best results are in bold. The two rightmost columns list the model structure category and number of model parameters, respectively. CIMP (N=235) Architecture # of Params External validation on TCGA-CRC- DX ResNet18 ResNet50 MobileNetV2 EfficientNet MSI (N=425) 78.5 (72.6-84.1) 80.9 (75.6-85.9) 79.1 (72.9-85.0) 77.3 (70.7-83.8) BRAF mutation (N=500) 72.7 (64.4-79.6) 77.3 (69.9-83.9) 76.6 (68.1-83.8) 74.2 (65.7-81.9) 69.9 (61.3-77.5) 65.0 (56.6-73.2) 66.2 (56.8-74.7) 72.5 (64.4-80.4) CNN CNN CNN CNN ViT 86.3 78.6 75.2 Transformer Swin-T MobileViT CMT Sequencer2D (80.1-91.7) (71.5-84.6) (67.4-82.2) 86.8 (80.8-92.1) 82.9 (76.5-88.8) 90.6 (86.2-94.4) 84.3 (77.9-90.1) 78.4 (71.4-84.7) 77.8 (71.4-83.8) 76.2 (68.4-82.9) 80.2 (73.4-86.0) 78.2 (70.3-85.0) 71.8 (64.3-78.5) 71.1 (63.4-77.4) 79.5 (71.9-86.0) CNN + Transformer CNN + Transformer CNN + Transformer BiLSTM 11.18M 23.51M 2.23M 4.01M 85.8M 48.84M 4.94M 24.98M 27.27M 20 Table 2: Performance statistics (AURPC) for external validation for TCGA-CRC-DX dataset. Patient-level AUPRC with a 95% confidence interval obtained via bootstrapping (1,000×) calculated for nine models in predicting MSI, BRAF mutation, and CIMP. Green rows indicate the NLP-based models, and other rows indicate CNN-based models. Best results are in bold. The two rightmost columns list the model structure category and number of model parameters, respectively. External validation on TCGA-CRC- DX ResNet18 MSI (N=425) BRAF mutation (N=500) CIMP (N=235) 38.6 (27.8-51.5) 30.1 (20.5-44.3) 43.6 (32.0-58.0) ResNet50 41.8 37.5 (30.8-55.1) (26.8-52.0) MobileNetV2 EfficientNet ViT Swin-T 43.9 (32.0-57.1) 41.2 (30.0-55.3) 68.4 (57.2-78.8) 69.7 (59.0-79.1) 37.3 (26.6-51.1) 45.6 (32.6-59.3) 39.0 (27.8-54.3) 35.8 (24.6-49.4) 41.4 (30.7-55.8) 35.0 (24.9-49.7) 53.9 (41.6-66.4) 43.2 (30.8-55.8) 53.7 (41.1-67.9) MobileViT 55.3 33.8 44.7 CMT Sequencer2D (41.9-68.7) (24.3-47.8) (32.6-58.4) 66.9 (54.6-79.7) 65.6 (53.4-77.3) 33.7 (23.9-46.3) 40.0 (29.5-52.9) 40.2 (29.3-55.3) 60.3 (48.2-72.7) Architecture # of Params CNN CNN CNN CNN Transformer CNN + Transformer CNN + Transformer CNN + Transformer BiLSTM 11.18M 23.51M 2.23M 4.01M 85.8M 48.84M 4.94M 24.98M 27.27M 21 Figures Figure 1: Pipelines for predicting of MSI, BRAF mutation, and CIMP in CRC. MCO-CRC and TCGA-CRC-DX were used to train and test for prediction of molecular biomarkers in CRC (i.e., MSI, BRAF mutation, and CIMP). The whole-slide images were tessellated into non-overlapping tiles of 512 × 512 pixels at a resolution of 0.5 μm. The resulting tiles were then resized to 224 × 224 pixels and color normalized. Tumor tissues (tiles) were subsequently selected by a Swin-T-based tissue-type classifier. Up to 500 tumor tiles were randomly selected for each slide. Five NLP-based models (in orange) and four CNN-based models (in blue) were trained to predict tile-level biomarkers. Models with a red star represent models that are applied in digital pathology the first time. The predictive slide labels were obtained via tile score aggregation. Figure 2: Comparison of the AUROCs and AUPRCs for all models in external validation on the TCGA-CRC-DX cohort. AUROCs and AUPRCs of the nine tested models (ResNet18, ResNet50, MobileNetV2, EfficientNet, ViT, Swin-T, MobileViT, CMT, and Sequencer2D) for prediction of MSI, BRAF mutation, and CIMP on the external validation dataset. Color of the circular bar represents the number of parameters. Figure 3: Relationships between the predictive performance and model size of all models. AUROC and AUPRC are plotted against the number of parameters of the nine models for external validation of MSI, BRAF mutation, and CIMP on the TCGA-CRC-DX dataset. Color of symbols represents the model type (CNN, transformer, BiLSTM). Size of symbols represents number of parameters. Figure 4: Relations between training/prediction efficiency and model size of all models for MSI prediction. Training and prediction times are plotted against number of parameters. The training time for an epoch (training set = MCO-CRC) and prediction time (for all patients in the TCGA-CRC-DX dataset) for the MSI status are recorded. Color of symbols represents the type of model (CNN, transformer, BiLSTM). Size of symbols represents number of parameters. 22 Figure 1. 23 Figure 2. 24 Figure 3. 25 Figure 4. 26 Time to Embrace Natural Language Processing (NLP)-based Digital Pathology: Benchmarking NLP- and Convolutional Neural Network-based Deep Learning Pipelines Supplementary Materials and Methods Supplementary Tables Supplementary Figures Supplementary Methods Convolutional neural network (CNN)-based deep learning models • ResNet18 and ResNet50. Residual networks (ResNet) (He et al., 2016) are among the most representative and widely used CNNs in the field of digital pathology (Echle et al., 2022; Hekler et al., 2020; Reenadevi et al., 2021). A residual block is implemented using a shortcut connection, through which the input and output of the block are added. This operation can significantly increase the training speed of the model and improve the training effect without introducing additional parameters or calculations into the network. Furthermore, the residual block can effectively solve the degradation problem in deep networks. In our study, we used ResNet18 and ResNet50 to construct our prediction pipelines. • MobileNetV2. MobileNetV2 (Sandler et al., 2018) is a lightweight model based on an inverted residual structure. The main characteristic of this structure is that its input and output are thin bottleneck layers, unlike in traditional residual models (He et al., 2016). Traditional nonlinear modules are replaced with lightweight depth-wise convolutions in the intermediate expansion layer to prevent nonlinearities and build more efficient models. In 2021, Yamashita et al. (2021) adopted MobileNetV2 to predict microsatellite instability in patients with colorectal cancer (CRC) in digital pathology; it demonstrated excellent performance in a cross-cohort validation experiment. • EfficientNet. EfficientNet (Tan and Le, 2019) was proposed in 2019 to improve the balance between the network depth, width, and resolution. EfficientNet is based on mobile applications and is similar to MnasNet, a multi-objective neural network architecture that searches for both accuracy and FLOPS. The main building block of EfficientNet is the mobile inversion bottleneck (MBConv). Laleh et al. (2022) used the EfficientNet series. 27 Supplementary Tables Table S1: Number of entire side images of CRC patients regarding molecular-level information prediction. For all biomarkers (microsatellite instability [MSI], BRAF mutation, and CpG island methylator phenotype [CIMP]), the number of entire-slide images in Molecular and Cellular Oncology (MCO)-CRC (for training) and The Cancer Genome Atlas (TCGA)-CRC (for testing) are listed. Slide Label Microsatellite instability (MSI-H vs MSI-L/MSS) BRAF mutation (Mutational vs Wild type) CpG island methylator phenotype (CIMP-H vs CIMP-L/None CRC CIMP) MCO-CRC (training) 1138 (166:972) 1026 (117:909) 364 (153:211) TCGA-CRC (testing) 425 (61:364) 500 (57:443) 235 (54:181) 28 Supplementary Figures Figure S1: MobileViT, CMT, and Sequencer2D structures for predicting tile-level biomarkers. Concrete structures of MobileViT, CMT, and Sequencer2D are used to predict the tile-level scores. For MobileViT, tiles should be first resized to 256 × 256 pixels. The gray boxes indicate the main blocks of the three models. Blocks with a red star indicate major parts based on the NLP module. 29 Figure S2: Predictive performances of external validation of microsatellite instability (MSI) prediction in the TCGA-CRC cohort. Receiver operating characteristic curves (ROCs) are computed for prediction of MSI. Red-shaded areas represent the 95% confidence interval (CI) calculated via bootstrapping (1,000×). Values in the lower right of each plot indicate mean area under the receiver operating characteristic curve (AUROC; 95% CI). (a) ResNet18 (b) ResNet50 (c) MobileNetV2 (d) EfficientNet (e) ViT (f) Swin-T (g) MobileViT (h) CMT (i) Sequencer2D 30 Figure S3: Predictive performance of external validation of BRAF mutation prediction in the TCGA-CRC cohort. ROCs are computed for prediction of BRAF mutation. Red- shaded areas represent the 95% CI calculated via bootstrapping (1,000×). Values in the lower right of each plot indicate mean area under the receiver operating characteristic curve (AUROC; 95% CI). (a) ResNet18 (b) ResNet50 (c) MobileNetV2 (d) EfficientNet (e) ViT (f) Swin-T (g) MobileViT (h) CMT (i) Sequencer2D 31 Figure S4: Predictive performance of external validation of CIMP prediction in the TCGA-CRC cohort. ROCs are computed for prediction of CIMP. Red-shaded areas represent the 95% CI calculated via bootstrapping (1,000×). Values in the lower right of each plot indicate mean area under the receiver operating characteristic curve (AUROC; 95% CI). (a) ResNet18 (b) ResNet50 (c) MobileNetV2 (d) EfficientNet (e) ViT (f) Swin-T (g) MobileViT (h) CMT (i) Sequencer2D 32 Echle, A., Laleh, N.G., Quirke, P., Grabsch, H., Muti, H., Saldanha, O., Brockmoeller, S., van den Brandt, P., Hutchins, G., Richman, S., 2022. Artificial intelligence for detection of microsatellite instability in colorectal cancer-a multicentric analysis of a pre-screening tool for clinical application. ESMO open 7, 100400. He, K., Zhang, X., Ren, S., Sun, J., 2016. Deep residual learning for image recognition, Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770-778. Hekler, A., Kather, J.N., Krieghoff-Henning, E., Utikal, J.S., Meier, F., Gellrich, F.F., Upmeier zu Belzen, J., French, L., Schlager, J.G., Ghoreschi, K., 2020. Effects of label noise on deep learning-based skin cancer classification. Frontiers in medicine 7, 177. Laleh, N.G., Muti, H.S., Loeffler, C.M.L., Echle, A., Saldanha, O.L., Mahmood, F., Lu, M.Y., Trautwein, C., Langer, R., Dislich, B., 2022. Benchmarking weakly-supervised deep learning pipelines for whole slide classification in computational pathology. Medical image analysis 79, 102474. Reenadevi, R., Sathiya, T., Sathiyabhama, B., 2021. Breast cancer histopathological image classification using augmentation based on optimized deep ResNet-152 structure. Annals of the Romanian Society for Cell Biology 25, 5866-5874. Sandler, M., Howard, A., Zhu, M., Zhmoginov, A., Chen, L.-C., 2018. Mobilenetv2: Inverted residuals and linear bottlenecks, Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4510-4520. Tan, M., Le, Q., 2019. Efficientnet: Rethinking model scaling for convolutional neural networks, International conference on machine learning. PMLR, pp. 6105-6114. Yamashita, R., Long, J., Longacre, T., Peng, L., Berry, G., Martin, B., Higgins, J., Rubin, D.L., Shen, J., 2021. Deep learning model for the prediction of microsatellite instability in colorectal cancer: a diagnostic study. The Lancet Oncology 22, 132-141. 33
http://arxiv.org/abs/2302.10400v1
2023-02-21T02:20:01
2023-02-21T02:20:01
An Efficient Two-stage Gradient Boosting Framework for Short-term Traffic State Estimation
Real-time traffic state estimation is essential for intelligent transportation systems. The NeurIPS 2022 Traffic4cast challenge provides an excellent testbed for benchmarking short-term traffic state estimation approaches. This technical report describes our solution to this challenge. In particular, we present an efficient two-stage gradient boosting framework for short-term traffic state estimation. The first stage derives the month, day of the week, and time slot index based on the sparse loop counter data, and the second stage predicts the future traffic states based on the sparse loop counter data and the derived month, day of the week, and time slot index. Experimental results demonstrate that our two-stage gradient boosting framework achieves strong empirical performance, achieving third place in both the core and the extended challenges while remaining highly efficient. The source code for this technical report is available at \url{https://github.com/YichaoLu/Traffic4cast2022}.
[ "Yichao Lu" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10400v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10400v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 0 0 4 0 1 . 2 0 3 2 : v i X r a An Efficient Two-stage Gradient Boosting Framework for Short-term Traffic State Estimation Yichao Lu Layer 6 AI [email protected] Abstract Real-time traffic state estimation is essential for intelligent transportation sys- tems. The NeurIPS 2022 Traffic4cast challenge provides an excellent testbed for benchmarking short-term traffic state estimation approaches. This techni- cal report describes our solution to this challenge. In particular, we present an efficient two-stage gradient boosting framework for short-term traffic state esti- mation. The first stage derives the month, day of the week, and time slot index based on the sparse loop counter data, and the second stage predicts the future traffic states based on the sparse loop counter data and the derived month, day of the week, and time slot index. Experimental results demonstrate that our two-stage gradient boosting framework achieves strong empirical performance, achieving third place in both the core and the extended challenges while remain- ing highly efficient. The source code for this technical report is available at https://github.com/YichaoLu/Traffic4cast2022. 1 Introduction Short-term traffic state estimation is a crucial task in intelligent transportation systems with many practical downstream applications [39, 42, 25, 24, 17]. The NeurIPS 2022 Traffic4cast challenge 1 provides an excellent testbed for evaluating the performance of short-term traffic state estimation approaches. Given only one hour of sparse loop counter data, the task is to predict the traffic state for all road segments 15 minutes into the future. For the core challenge, the task is to predict the congestion classifications for all road segments. For the extended challenge, the task is to predict the expected time of arrival along super-segments. Most state-of-the-art short-term traffic state estimation approaches employ graph neural networks to capture the complex spatio-temporal dependencies among traffic flows [13, 51, 4, 28, 21]. However, the complexity of urban road networks imposes enormous computational and resource challenges. Therefore, this technical report explores an efficient alternative to graph neural networks for short- term traffic state estimation. In particular, we present a two-stage gradient boosting framework. The advantage of gradient boosting decision trees over neural networks is its high efficiency and the ability to handle missing values without imputation [49, 50, 32, 33, 31, 37]. The first stage derives the month, day of the week, and time slot index based on the sparse loop counter data, and the second stage predicts the future traffic states based on the sparse loop counter data and the derived month, day of the week, and time slot index. The intuition behind the two-stage approach is as follows. We observe strong seasonality and time trends in traffic flows [27, 56]. Figure 1 shows the relation between average volume and the time slot index for a sample loop counter in London in the Traffic4cast 2022 training data. Dissecting the task of traffic state estimation into two stages not only harnesses the information within auxiliary labels but also facilitates the second stage model to capture the time patterns in traffic flows. 1https://www.iarai.ac.at/traffic4cast/challenge/ Figure 1: The relation between average volume and the time slot index for a sample loop counter in London in the Traffic4cast 2022 training data. Experimental results on the NeurIPS 2022 Traffic4cast challenge leaderboards demonstrate that our two-stage gradient boosting framework achieves strong empirical performance, achieving third place in both the core and the extended challenges while remaining highly efficient. The whole pipeline can be trained in less than 3 hours on a single NVIDIA GeForce RTX 2080 Super Mobile GPU. 2 Approach The presented two-stage gradient boosting framework is based on two highly efficient implementations of the gradient boosting decision trees algorithm: eXtreme Gradient Boosting (XGBoost) [11] and Light Gradient Boosting Machine (LightGBM) [22]; see Figure 2. The first stage derives the month, day of the week, and time slot index based on the sparse loop counter data. The second stage predicts the future traffic states based on the sparse loop counter data, the road graph attributes, and the predictions from the first stage. The advantage of using a two-stage framework is that it explicitly exploits the strong seasonality and time trends observed in traffic flows; see Figure 1. As such, the second stage model can better capture the time patterns related to traffic congestion and expected time of arrival. 2.1 First Stage In the first stage, we use the volume counts for the nodes in the entire road graph as features. We predict the month, day of the week, and time slot index based on the sparse loop counter data. Models based on gradient boosting decision trees are particularly suitable for the first stage task since the loop counter data is sparse and there are many missing values. Tree-based methods can handle missing values by using surrogate splits, thus eliminating the need of imputation. In addition, decision trees are generally more robust to outliers. 2 Figure 2: The relation between average volume and the time slot index for a sample loop counter in London in the Traffic4cast 2022 training data. We use three separate models for the first stage, as gradient boosting decision trees do not directly support learning multiple targets. All three prediction tasks are modelled as a regression problem, where we optimize the model using L2 loss. The final prediction for the first stage is based on an ensemble of XGBoost and LightGBM models trained separately for each city. We average the predictions from XGBoost and LightGBM models and round the averaged prediction to the nearest integer. 2.2 Second Stage In the second stage, we apply different models for each challenge since the applicability of gradient boosting decision trees in multi-task learning is limited as opposed to neural networks [7, 8, 36, 32]. At the core of the second stage is extensive feature engineering primarily based on target enconding. Target encoding (TE) calculates the conditional probabilities of the targets given sets of categorical features, which has been demonstrated to be effective in a wide range of machine learning tasks [34, 49, 50, 32, 44, 14, 33, 31, 30, 37, 26]. 2.2.1 Core Challenge For the core challenge, we engineered a number of features capturing the road network characteristics and traffic dynamics. The list of features we have used in the core challenge and their importance scores are presented in Table 1. We can see that the target encodings (TE) of different congestion classes (cc) are among the most important features. For the core challenge, target encoding refers to the fraction of each congestion class in the training set. We apply Bayesian smoothing to reduce overfitting, where the empirical means are the fraction of each congestion class for all road graph edges in the training set; see Equation 1. T Ecc([Categories]) = Count([Categories]) ∗ meancc([Categories]) + w ∗ meancc Count([Categories]) + w (1) In Equation 1, Count([Categories] refers to the number of observations for Categories, meancc is the empirical mean for the congestion class cc, and the pseudocount w > 0 is a smoothing parameter which we set to 20. We train XGBoost and LightGBM using masked cross-entropy loss on congestion classes, which is the same as metric used in the challenge: where (cid:96)(ˆy, y) = N (cid:88) n=1 1 n=1wyn * 1{yn (cid:54)= ignore_index} ΣN ln, ln = −wyn log ˆyn,yn + ε c=0 ˆyn,c + ε ΣC−1 * 1{yn (cid:54)= ignore_index} (2) (3) 3 Table 1: The list of features and their importance scores (core challenge). # Description TE of cc yellow given the time slot index TE of cc green given the time slot index and whether the date is a weekend TE of cc red given the time slot index TE of cc green given the time slot index The importance of the highway within the road network TE of cc red given the time slot index and whether the date is a weekend TE of cc yellow given the time slot index and whether the date is a weekend TE of cc red given whether the date is a weekend 1 2 3 4 5 6 7 8 Whether the date is a weekend 9 10 TE of cc yellow given whether the date is a weekend 11 The time slot index 12 Month 13 TE of cc green given the time slot index and day of the week 14 TE of cc green given day of the week 15 TE of cc red given day of the week 16 Day of the week 17 Whether the road graph edge can only be used in one direction by vehicles 18 Numerical mapping of the OSM highway class 19 TE of cc red given the time slot index and day of the week 20 TE of cc red 21 TE of cc green given whether the date is a weekend 22 Whether the road graph edge runs in a tunnel 23 TE of cc yellow given day of the week 24 Edge speed (km per hour) 25 Maximum legal speed limit 26 TE of cc yellow 27 TE of cc green 28 Number of node hops to get to the closes vehicle counter in the graph 29 Number of traffic lanes on the road graph edge 30 Edge length in meters 31 Unique identifier of the source node 32 Unique identifier of the sink node 33 Unique identifier of the road graph edge 34 Number of incoming edges for the sink node 35 Number of outgoing edges for the source node 36 Number of incoming edges for the source node 37 Number of outgoing edges for the sink node 38 TE of cc yellow given the time slot index and day of the week 39 The volume count for the target node 15 minutes in the past 40 The volume count for the source node 15 minutes in the past 41 The volume count for the target node 45 minutes in the past 42 The volume count for the target node 60 minutes in the past 43 The volume count for the source node 60 minutes in the past 44 The volume count for the source node 45 minutes in the past 45 The volume count for the target node 30 minutes in the past 46 The volume count for the source node 30 minutes in the past Score 674.99 432.00 301.92 181.96 166.05 135.27 134.05 118.69 114.36 64.03 55.28 52.22 46.05 45.41 41.98 41.39 39.22 34.11 33.58 31.34 29.81 27.98 24.75 21.54 20.31 19.80 18.83 17.44 14.22 13.69 12.98 12.82 12.27 12.04 11.97 11.78 11.77 10.74 8.32 8.24 8.06 8.06 8.02 7.90 7.58 7.55 In Equation 2 and Equation 3, ˆy ∈ RN ×C is the predicted probabilities for each congestion class, N y ∈ {0, ..., C − 1}N is the target, and wc = 1{yi=c} refers to the class weight that is obtained by calculating the empirical mean for each congestion class. C ∈ N is the number of congestion classes, N ∈ N is the number of samples, ε ∈ R+ is a small constant to prevent overflow, and ignore_index ∈ C ∪ {⊥} specifies whether a target value is ignored or not. |C|*ΣN i=1 The final prediction for the core challenge is made by an ensemble of XGBoost and LightGBM models, trained separately for each city. 4 Table 2: The list of features and their importance scores (extended challenge). # Description Smoothed TE given the time slot index and day of the week Unique identifier of the supersegment Smoothed TE given the time slot index The time slot index TE given the time slot index and day of the week 1 2 3 4 5 6 Month 7 8 9 10 TE for the supersegment 11 Day of the week 12 TE given whether the date is a weekend 13 Whether the date is a weekend 14 15 TE given the time slot index and whether the date is a weekend TE given day of the week TE given the time slot index Number of nodes in the supersegment Smoothed TE given the time slot index and whether the date is a weekend Score 228374728.6 76275475.3 44789850.5 7016971.0 5319797.0 3703889.9 3033482.3 2704734.8 2693478.1 1884798.9 1871912.3 1080182.0 935208.7 804695.4 510518.6 2.2.2 Extended Challenge For the extended challenge, we only use LightGBM since XGBoost does not support the direct optimization of the L1 loss (as of v1.6.2). Unlike conventional gradient boosting methods that work as gradient descent in function space, XGBoost works as Newton-Raphson in function space, and uses a second order Taylor approximation in the loss function to connect to Newton Raphson method [11]. XGBoost therefore requires smooth objectives to compute the first- and second-order derivative statistics of the loss. On the other hand, L1 loss, also known as mean absolute error (MAE), is not continuously twice differentiable. Thus the direct optimization of the MAE metric is not possible in XGBoost. We experimented with approximating the L1 loss with Huber loss in XGBoost, but could not achieve good performance. The list of features we have used in the extended challenge and their importance scores are presented in Table 2. For the extended challenge, target encoding (TE) refers to the average Expected Times of Arrival (ETA) for each supersegment: T Eeta([Categories]) = 1 N N (cid:88) i=1 ET Ai([Categories]) (4) We also use smoothed TE, where we use a weighted average of ETAs in the nearby time window to reduce overfitting: Smoothed_T Eeta(t) = T Eeta(t) + (cid:80)4 i=1 [T Eeta(t − i) + T Eeta(t + i)] ∗ (i + 1)4 1 + (cid:80)4 i=1(i + 1)4 ∗ 2 (5) The intuition behind smoothed TE is that, the ETAs should be similar within a short time window for any super-segment. Smoothing the target encoding of the ETAs can help prevent overfitting due to outliers. The feature importance scores in Table 2 also demonstrate that smoothed TE is more effective than the non-smoothed counterpart. For the extended challenge, the task is to predict the ETAs along super-segments. The dynamic speed data obtained from GPS probes is used to derive travel times on the edges of the graph, which are then summed up to derive super-segment ETAs. We experimented with predicting the travel times on the edges of the graph, and then manually summing up the predicted travel times for all edges in the super-segment to estimate super-segment ETA. This results in degraded performance, presumably because using super-segments helps make the ETAs derived from the underlying speed data more robust to data outliers. 5 Table 3: Leaderboard results for the core challenge and the extended challenge. Core challenge Extended challenge Rank Team Score Rank Team Score 1 2 3 4 5 ustc-gobbler Bolt oahciy (ours) GongLab AP_DE 0.84310793876648 0.84966790676117 0.85041532913844 0.85603092114131 0.87350843350093 1 2 3 4 5 ustc-gobbler TSE oahciy (ours) Bolt discovery 58.4997215271 59.782447814941 61.22274017334 61.254610697428 62.296744028727 2.3 Implementation Details For each city, we randomly select two weeks as the validation set to mimic the distribution of the test set. During training, we use the leave-one-out strategy for target encoding, where the conditional probabilities of the targets are calculated ignoring the targets in the same day to prevent target leakage. During inference, we use all available target values for target encoding. We use the same hyperparameters in both stages. For XGBoost, we set max_depth to be 5, eta (learning rate) to be 0.01, which limits the growth of the trees during training. We set subsample to be 0.5, colsample_bytree to be 0.9, and colsample_bylevel to be 0.9 to reduce the risk of overfitting. In addition, tree_method is set to be gpu_hist to use GPU acceleration. The rest of the hyperparameters are set to the default values for XGBoost. For LightGBM, we set learning_rate to be 0.1 and use the default values for the rest of the hyperparameters. For both XGBoost and LightGBM, we train until the validation score does not improve for 1,000 rounds. This helps estimate the number of rounds that XGBoost and LightGBM require to achieve optimal performance on the held-out set. After that, we retrain the models using both the training set and the validation set for the estimated number of rounds to achieve the optimal performance. 3 Experiments The final leaderboard results on the core and the extended challenges are presented in Table 3. Our two-stage gradient boosting framework achieves third place in both challenges, demonstrating its excellent accuracy, generalizability, and transferability. We further examine the performance of our two-stage gradient boosting framework by conducting a comparative analysis against three alternative methods, namely the multilayer perceptron (MLP), graph neural network (GNN), and the single-stage alternative. We report the leaderboard performance and the training time for each approach in Table 4. We observe that approaches based on gradient boosting decision trees are much more efficient than neural networks based approaches and, at the same time, achieve comparable performance. GNN can outperform MLP while at the cost of much longer training time. Comparing the two-stage framework against the single-stage alternative, we can see that the two-stage framework significantly improves the performance and is only marginally slower than the single-stage model. This is because the first stage model is relatively lightweight and introduces little computational overhead. To study the effect of the first stage errors on the second stage performance, we comapre the validation performance of the second stage model using the predictions from the first stage model against the same model using the ground truth date and time; see Table 5. We can see that when the ground truth date and time information is given, the second stage model can achieve significantly better performance, since it prevents errors from being propagated from the first stage to the second stage. 4 Discussion In this challenge, we use the two-stage pipeline because the time of the entries in the test set is not provided as a feature. In a real-world production system, however, the date and the time for the prediction of interest are very easy to obtain. Therefore real-world production systems should directly use the second stage model to avoid the propagation of errors from the first stage to the second stage. 6 Table 4: Leaderboard results and training time for different approahces. Core challenge Extended challenge Approach Score Time (minutes) Approach Score Time (minutes) MLP GNN Single-stage Two-stage 0.85685 0.85204 0.85483 0.85041 197 1174 95 114 MLP GNN Single-stage Two-stage 61.39940 61.24305 61.31830 61.22274 172 679 28 47 Due to the limit of computational resources, in this challenge, we did not use (graph) neural network- based approaches. Graph neural networks (GNNs) have emerged as a promising short-term traffic state estimation technique due to their ability to model complex spatial dependencies and dynamics [28]. GNNs can capture the non-linear interactions between road segments and effectively handle spatio-temporal data, making them suitable for short-term traffic state estimation tasks [5]. The effectiveness of our engineered features when using XGBoost and LightGBM demonstrates that they successfully capture traffic dynamics and time patterns. To further boost the performance of traffic state estimation, we can try adding these engineered features into a deep learning-based framework and ensemble the prediction from deep learning models with the prediction from the gradient boosting approaches. In our two-stage gradient boosting framework, the first and second stage models are trained separately. We have observed that the errors made by the first stage models can significantly impact the perfor- mance of the second stage models. Meanwhile, the predictions from the second stage models (the congestion class and the expected time of arrival) have a very strong dependence on the predictions from the first stage models (the month, day of the week, and time slot index). It is, therefore, possible to apply co-training strategies [2, 41] or coevolutionary algorithms [43, 18, 35] during the training of the first stage and second stage models, where the predictions from both stages are iteratively refined in a multi-phase fahsion. 5 Related Work Short-term traffic state estimation is essential in transportation management as it provides valuable insights into traffic flow patterns and enables better decision-making for commuters and transportation agencies. In recent years, there has been an increasing interest in short-term traffic state estimation due to its potential to improve traffic safety, reduce travel time, and minimize environmental impacts [3]. Traditionally, short-term traffic state estimation models have relied on classic statistical learning methods such as autoregressive integrated moving average (ARIMA) [16], wavelet transform [20], and radial basis function network [54]. However, with the success of deep neural networks in capturing complex dependencies and non-linearities in large datasets, researchers have shifted their attention towards utilizing deep neural networks [39, 55, 58, 25, 59, 9, 24, 17]. To model the dynamics of a complex traffic system, a common approach is to represent it as a sequence of movie frames, where each pixel corresponds to the traffic intensity at a certain block of area, and each frame summarizes a discrete time bin, thus casting traffic forecasting as a video prediction task [58, 25, 59, 24, 17]. Early works focused on using convolutional neural networks (CNNs), which are primarily used for visual tasks such as image classification and object detection. To model temporal relationships, a common practice is to concatenate the sequence of frames along the channel dimension and apply 2-dimensional CNNs [57]. Another approach uses 3-dimensional CNNs, where convolution and pooling operations are performed spatio-temporally [60, 1]. Researchers have also explored the potential of recurrent neural networks (RNNs) to capture temporal dependencies [47]. However, vanilla RNNs suffer from gradient vanishing and exploding problems, and popular variants such as the Long Short-Term Memory (LSTM) [19] and the Gated Recurrent Unit (GRU) [12] are often used. State-of-the-art traffic forecasting models have also employed a hybrid of CNN and RNN layers as the underlying architecture, allowing the model to simultaneously exploit the ability of CNN units to model spatial relationships and the potential of RNN units to capture temporal dependencies [45, 46, 29, 58, 59]. 7 Table 5: The effect of the first stage errors on the second stage performance. Core challenge Extended challenge Score ∆ Score ∆ Prediction Ground truth 0.853078 0.842203 - 61.24775 1.27% 58.03751 - 5.24% While CNNs and RNNs are effective in modeling data with an underlying Euclidean or grid-like structure, they fail to capture the complex graph structures in transportation systems such as the road network [23, 15, 51]. To address this limitation, graph neural networks (GNNs) have recently shown exceptional performance in a variety of traffic flow prediction tasks due to their ability to capture spatial dependencies presented in the form of non-Euclidean graph structures [10, 31, 28, 21, 26]. Additionally, it has been demonstrated that GNNs can effectively learn properties given by the underlying road network, which improves the generalization performance when making predictions on previously unseen cities [40]. Finally, Transformer-based models have emerged as a powerful tool for short-term traffic state estimation [6, 52, 53]. These models are designed to process sequential data, making them a natural fit for time-series forecasting problems [38, 37]. One of the key advantages of Transformer-based models is their ability to model long-range dependencies between time steps. This is achieved through the use of self-attention, which allows the model to focus on relevant parts of the input sequence while ignoring irrelevant information [48]. 6 Conclusion We present an efficient two-stage gradient boosting framework for short-term traffic state estimation. Experimental results on the NeurIPS 2022 Traffic4cast challenge demonstrate that our two-stage gra- dient boosting approach achieves excellent accuracy, generalizability, transferability, and computation efficiency. References [1] K. Bayoudh, F. Hamdaoui, and A. Mtibaa. Transfer learning based hybrid 2d-3d cnn for traffic sign recognition and semantic road detection applied in advanced driver assistance systems. Applied Intelligence, 51:124–142, 2021. [2] A. Blum and T. Mitchell. Combining labeled and unlabeled data with co-training. In Proceedings of the eleventh annual conference on Computational learning theory, pages 92–100, 1998. [3] A. Boukerche and J. Wang. Machine learning-based traffic prediction models for intelligent transportation systems. Computer Networks, 181:107530, 2020. [4] K.-H. N. Bui, J. Cho, and H. Yi. Spatial-temporal graph neural network for traffic forecasting: An overview and open research issues. Applied Intelligence, pages 1–12, 2021. [5] K.-H. N. Bui, J. Cho, and H. Yi. Spatial-temporal graph neural network for traffic forecasting: An overview and open research issues. Applied Intelligence, 52(3):2763–2774, 2022. [6] L. Cai, K. Janowicz, G. Mai, B. Yan, and R. Zhu. Traffic transformer: Capturing the continuity and periodicity of time series for traffic forecasting. Transactions in GIS, 24(3):736–755, 2020. [7] O. Chapelle, P. Shivaswamy, S. Vadrevu, K. Weinberger, Y. Zhang, and B. Tseng. Multi-task learning for boosting with application to web search ranking. In Proceedings of the 16th ACM SIGKDD international conference on Knowledge discovery and data mining, pages 1189–1198, 2010. [8] O. Chapelle, P. Shivaswamy, S. Vadrevu, K. Weinberger, Y. Zhang, and B. Tseng. Boosted multi-task learning. Machine learning, 85:149–173, 2011. [9] C. Chen, K. Li, S. G. Teo, X. Zou, K. Li, and Z. Zeng. Citywide traffic flow prediction based on multiple gated spatio-temporal convolutional neural networks. ACM Transactions on Knowledge Discovery from Data (TKDD), 14(4):1–23, 2020. 8 [10] C. Chen, K. Li, S. G. Teo, X. Zou, K. Wang, J. Wang, and Z. Zeng. Gated residual recurrent graph neural networks for traffic prediction. In Proceedings of the AAAI conference on artificial intelligence, volume 33, pages 485–492, 2019. [11] T. Chen and C. Guestrin. Xgboost: A scalable tree boosting system. In Proceedings of the 22nd acm sigkdd international conference on knowledge discovery and data mining, pages 785–794, 2016. [12] J. Chung, C. Gulcehre, K. Cho, and Y. Bengio. Empirical evaluation of gated recurrent neural networks on sequence modeling. arXiv preprint arXiv:1412.3555, 2014. [13] Z. Cui, K. Henrickson, R. Ke, and Y. Wang. Traffic graph convolutional recurrent neural network: A deep learning framework for network-scale traffic learning and forecasting. IEEE Transactions on Intelligent Transportation Systems, 21(11):4883–4894, 2019. [14] C. Deotte, B. Liu, B. Schifferer, and G. Titericz. Gpu accelerated boosted trees and deep neural networks for better recommender systems. In Proceedings of the Recommender Systems Challenge 2021, pages 7–14. 2021. [15] F. Diehl, T. Brunner, M. T. Le, and A. Knoll. Graph neural networks for modelling traffic participant interaction. In 2019 IEEE Intelligent Vehicles Symposium (IV), pages 695–701. IEEE, 2019. [16] H. Dong, L. Jia, X. Sun, C. Li, and Y. Qin. Road traffic flow prediction with a time-oriented In 2009 Fifth International Joint Conference on INC, IMS and IDC, pages arima model. 1649–1652. IEEE, 2009. [17] C. Eichenberger, M. Neun, H. Martin, P. Herruzo, M. Spanring, Y. Lu, S. Choi, V. Konyakhin, N. Lukashina, A. Shpilman, et al. Traffic4cast at neurips 2021-temporal and spatial few- shot transfer learning in gridded geo-spatial processes. In NeurIPS 2021 Competitions and Demonstrations Track, pages 97–112. PMLR, 2022. [18] N. García-Pedrajas, C. Hervás-Martínez, and J. Muñoz-Pérez. Covnet: a cooperative coevolu- tionary model for evolving artificial neural networks. IEEE Transactions on Neural Networks, 14(3):575–596, 2003. [19] S. Hochreiter and J. Schmidhuber. Long short-term memory. Neural computation, 9(8):1735– 1780, 1997. [20] D.-R. Huang, J. Song, D.-C. Wang, J.-Q. Cao, and W. Li. Forecasting model of traffic flow based on arma and wavelet transform. Jisuanji Gongcheng yu Yingyong(Computer Engineering and Applications), 42(36):191–194, 2006. [21] W. Jiang and J. Luo. Graph neural network for traffic forecasting: A survey. Expert Systems with Applications, page 117921, 2022. [22] G. Ke, Q. Meng, T. Finley, T. Wang, W. Chen, W. Ma, Q. Ye, and T.-Y. Liu. Lightgbm: A highly efficient gradient boosting decision tree. Advances in neural information processing systems, 30, 2017. [23] T. N. Kipf and M. Welling. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016. [24] M. Kopp, D. Kreil, M. Neun, D. Jonietz, H. Martin, P. Herruzo, A. Gruca, A. Soleymani, F. Wu, Y. Liu, et al. Traffic4cast at neurips 2020? yet more on theunreasonable effectiveness of gridded geo-spatial processes. In NeurIPS 2020 Competition and Demonstration Track, pages 325–343. PMLR, 2021. [25] D. P. Kreil, M. K. Kopp, D. Jonietz, M. Neun, A. Gruca, P. Herruzo, H. Martin, A. Soleymani, and S. Hochreiter. The surprising efficiency of framing geo-spatial time series forecasting as a video prediction task–insights from the iarai traffic4cast competition at neurips 2019. In NeurIPS 2019 Competition and Demonstration Track, pages 232–241. PMLR, 2020. [26] M. Krenn, L. Buffoni, B. Coutinho, S. Eppel, J. G. Foster, A. Gritsevskiy, H. Lee, Y. Lu, J. P. Moutinho, N. Sanjabi, et al. Predicting the future of ai with ai: High-quality link prediction in an exponentially growing knowledge network. arXiv preprint arXiv:2210.00881, 2022. [27] L. Li, X. Su, Y. Zhang, Y. Lin, and Z. Li. Trend modeling for traffic time series analysis: An integrated study. IEEE Transactions on Intelligent Transportation Systems, 16(6):3430–3439, 2015. 9 [28] M. Li and Z. Zhu. Spatial-temporal fusion graph neural networks for traffic flow forecasting. In Proceedings of the AAAI conference on artificial intelligence, volume 35, pages 4189–4196, 2021. [29] Y. Li, R. Yu, C. Shahabi, and Y. Liu. Diffusion convolutional recurrent neural network: Data- driven traffic forecasting. arXiv preprint arXiv:1707.01926, 2017. [30] Y. Lu. Learning to transfer for traffic forecasting via multi-task learning. arXiv preprint arXiv:2111.15542, 2021. [31] Y. Lu. Predicting research trends in artificial intelligence with gradient boosting decision trees and time-aware graph neural networks. In 2021 IEEE International Conference on Big Data (Big Data), pages 5809–5814. IEEE, 2021. [32] Y. Lu, C. Chang, H. Rai, G. Yu, and M. Volkovs. Learning effective visual relationship detector on 1 gpu. arXiv preprint arXiv:1912.06185, 2019. [33] Y. Lu, C. Chang, H. Rai, G. Yu, and M. Volkovs. Multi-view scene graph generation in videos. In International Challenge on Activity Recognition (ActivityNet) CVPR 2021 Workshop, volume 3, page 2, 2021. [34] Y. Lu, R. Dong, and B. Smyth. Context-aware sentiment detection from ratings. In Research and Development in Intelligent Systems XXXIII: Incorporating Applications and Innovations in Intelligent Systems XXIV 33, pages 87–101. Springer, 2016. [35] Y. Lu, R. Dong, and B. Smyth. Coevolutionary recommendation model: Mutual learning between ratings and reviews. In Proceedings of the 2018 World Wide Web Conference, pages 773–782, 2018. [36] Y. Lu, R. Dong, and B. Smyth. Why i like it: multi-task learning for recommendation and explanation. In Proceedings of the 12th ACM Conference on Recommender Systems, pages 4–12, 2018. [37] Y. Lu, Z. Gao, Z. Cheng, J. Sun, B. Brown, G. Yu, A. Wong, F. Pérez, and M. Volkovs. Session-based recommendation with transformers. In Proceedings of the Recommender Systems Challenge 2022, pages 29–33. 2022. [38] Y. Lu, H. Rai, J. Chang, B. Knyazev, G. Yu, S. Shekhar, G. W. Taylor, and M. Volkovs. Context- aware scene graph generation with seq2seq transformers. In Proceedings of the IEEE/CVF international conference on computer vision, pages 15931–15941, 2021. [39] Y. Lv, Y. Duan, W. Kang, Z. Li, and F.-Y. Wang. Traffic flow prediction with big data: A deep learning approach. IEEE Transactions on Intelligent Transportation Systems, 16(2):865–873, 2014. [40] H. Martin, D. Bucher, Y. Hong, R. Buffat, C. Rupprecht, and M. Raubal. Graph-resnets for short-term traffic forecasts in almost unknown cities. In NeurIPS 2019 Competition and Demonstration Track, pages 153–163. PMLR, 2020. [41] X. Ning, X. Wang, S. Xu, W. Cai, L. Zhang, L. Yu, and W. Li. A review of research on co-training. Concurrency and computation: practice and experience, page e6276, 2021. [42] N. G. Polson and V. O. Sokolov. Deep learning for short-term traffic flow prediction. Trans- portation Research Part C: Emerging Technologies, 79:1–17, 2017. [43] M. A. Potter and K. A. De Jong. Evolving neural networks with collaborative species. In Summer Computer Simulation Conference, pages 340–345. SOCIETY FOR COMPUTER SIMULATION, ETC, 1995. [44] B. Schifferer, G. Titericz, C. Deotte, C. Henkel, K. Onodera, J. Liu, B. Tunguz, E. Oldridge, G. De Souza Pereira Moreira, and A. Erdem. Gpu accelerated feature engineering and training for recommender systems. In Proceedings of the Recommender Systems Challenge 2020, pages 16–23. 2020. [45] X. Shi, Z. Chen, H. Wang, D.-Y. Yeung, W.-K. Wong, and W.-c. Woo. Convolutional lstm network: A machine learning approach for precipitation nowcasting. Advances in neural information processing systems, 28, 2015. [46] X. Shi, Z. Gao, L. Lausen, H. Wang, D.-Y. Yeung, W.-k. Wong, and W.-c. Woo. Deep learning for precipitation nowcasting: A benchmark and a new model. Advances in neural information processing systems, 30, 2017. 10 [47] C. Ulbricht. Multi-recurrent networks for traffic forecasting. In AAAI, pages 883–888, 1994. [48] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017. [49] M. Volkovs, H. Rai, Z. Cheng, G. Wu, Y. Lu, and S. Sanner. Two-stage model for automatic playlist continuation at scale. In Proceedings of the ACM Recommender Systems Challenge 2018, pages 1–6. 2018. [50] M. Volkovs, A. Wong, Z. Cheng, F. Pérez, I. Stanevich, and Y. Lu. Robust contextual models for in-session personalization. In Proceedings of the Workshop on ACM Recommender Systems Challenge, pages 1–5, 2019. [51] X. Wang, Y. Ma, Y. Wang, W. Jin, X. Wang, J. Tang, C. Jia, and J. Yu. Traffic flow prediction via spatial temporal graph neural network. In Proceedings of the web conference 2020, pages 1082–1092, 2020. [52] M. Xu, W. Dai, C. Liu, X. Gao, W. Lin, G.-J. Qi, and H. Xiong. Spatial-temporal transformer networks for traffic flow forecasting. arXiv preprint arXiv:2001.02908, 2020. [53] H. Yan, X. Ma, and Z. Pu. Learning dynamic and hierarchical traffic spatiotemporal features with transformer. IEEE Transactions on Intelligent Transportation Systems, 23(11):22386–22399, 2021. [54] W. Yang, D. Yang, Y. Zhao, and J. Gong. Traffic flow prediction based on wavelet transform and radial basis function network. In 2010 International Conference on Logistics Systems and Intelligent Management (ICLSIM), volume 2, pages 969–972. IEEE, 2010. [55] H. Yi, H. Jung, and S. Bae. Deep neural networks for traffic flow prediction. In 2017 IEEE international conference on big data and smart computing (BigComp), pages 328–331. IEEE, 2017. [56] Y. Yin and P. Shang. Forecasting traffic time series with multivariate predicting method. Applied Mathematics and Computation, 291:266–278, 2016. [57] B. Yu, H. Yin, and Z. Zhu. St-unet: A spatio-temporal u-network for graph-structured time series modeling. arXiv preprint arXiv:1903.05631, 2019. [58] W. Yu, Y. Lu, S. Easterbrook, and S. Fidler. Crevnet: Conditionally reversible video prediction. arXiv preprint arXiv:1910.11577, 2019. [59] W. Yu, Y. Lu, S. Easterbrook, and S. Fidler. Efficient and information-preserving future frame prediction and beyond. In International Conference on Learning Representations, 2020. [60] S. Zhang, L. Zhou, X. Chen, L. Zhang, L. Li, and M. Li. Network-wide traffic speed forecasting: 3d convolutional neural network with ensemble empirical mode decomposition. Computer- Aided Civil and Infrastructure Engineering, 35(10):1132–1147, 2020. 11
http://arxiv.org/abs/2302.10392v1
2023-02-21T01:40:32
2023-02-21T01:40:32
From seeing to remembering: Images with harder-to-reconstruct representations leave stronger memory traces
Much of what we remember is not due to intentional selection, but simply a by-product of perceiving. This raises a foundational question about the architecture of the mind: How does perception interface with and influence memory? Here, inspired by a classic proposal relating perceptual processing to memory durability, the level-of-processing theory, we present a sparse coding model for compressing feature embeddings of images, and show that the reconstruction residuals from this model predict how well images are encoded into memory. In an open memorability dataset of scene images, we show that reconstruction error not only explains memory accuracy but also response latencies during retrieval, subsuming, in the latter case, all of the variance explained by powerful vision-only models. We also confirm a prediction of this account with 'model-driven psychophysics'. This work establishes reconstruction error as a novel signal interfacing perception and memory, possibly through adaptive modulation of perceptual processing.
[ "Qi Lin", "Zifan Li", "John Lafferty", "Ilker Yildirim" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10392v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10392v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "q-bio.NC", "@scheme": "http://arxiv.org/schemas/atom" }
[ "q-bio.NC", "cs.LG" ]
3 2 0 2 b e F 1 2 ] C N . o i b - q [ 1 v 2 9 3 0 1 . 2 0 3 2 : v i X r a From seeing to remembering: Images with harder-to-reconstruct representations leave stronger memory traces Qi Lina,d,1,g, Zifan Lib,e, John Laffertyb,c,f,g, Ilker Yildirima,b,c,f,g aDepartment of Psychology, Yale University, bDepartment of Statistics and Data Science, Yale University, cWu Tsai Institute, Yale University, dCenter for Brain Science, RIKEN, eThese authors contributed equally. fThese authors jointly supervised this work. gCorrespondence should be addressed to these authors. Abstract Much of what we remember is not due to intentional selection, but simply a by-product of per- ceiving. This raises a foundational question about the architecture of the mind: How does perception interface with and influence memory? Here, inspired by a classic proposal relating perceptual pro- cessing to memory durability, the level-of-processing theory, we present a sparse coding model for compressing feature embeddings of images, and show that the reconstruction residuals from this model predict how well images are encoded into memory. In an open memorability dataset of scene images, we show that reconstruction error not only explains memory accuracy but also response latencies during retrieval, subsuming, in the latter case, all of the variance explained by powerful vision-only models. We also confirm a prediction of this account with 'model-driven psychophysics'. This work establishes reconstruction error as a novel signal interfacing perception and memory, possibly through adaptive modulation of perceptual processing. Introduction So much of what we remember is not the result of intentional selection, but rather the result of simply perceiving. How are perceptual experiences cast into memory? And how does perceiving exert control over remembering? These are fundamental questions in the study of the mind with multiple lines of empirical and theoretical studies designed to uncover the interface between per- ception and memory (e.g., [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]). A striking illustration of the extent to which perception influences memory is the recent demonstration of 'memorability', the finding that some images are systematically more memorable than others across observers [12, 13]. Forma- tion of new visual memory traces must recruit both visual and memory-related functions, but the computational basis of how they interact to produce memory traces remains poorly understood. Existing computational accounts, inspired by the demonstration of image memorability, largely consider models that involve vision-only computations, such as the deep convolutional neural net- works (DCNN) trained for image classification [14, 15, 16, 17]. These studies have established a quantitative relationship between the summary statistics derived from the later stages of these networks (e.g., the magnitude of activations of a given layer) and memorability scores of images. Interestingly, this effect is also observed neurally: the population response magnitude of the inferior temporal cortex neurons tracks the memorability scores of the presented images. However, these vision-only models do not attempt to formalize processes responsible for transforming percepts into memories and thus remain incomplete as computational accounts of how perceptual processing relates to memory traces. A classic psychological account, the 'level-of-processing' theory of Craik and Lockart [3], has attempted to directly address this interface - proposing that a memory trace is a by-product of the perceptual analysis of the incoming sensory signals and that a 'deeper' analysis is associated with better retention in memory. However, this framework, including a specification of what determines the depth (or level) of perceptual processing [18, 19, 20], remains largely qualitative and non- computational. To date, all empirical demonstrations of the level-of-processing effect rely on the use of an orientating task (as reviewed in [21]), completely missing the automatic nature of perceptual processing. In fact, work investigating how orientating tasks interact with image memorability has demonstrated that the effect of such orienting tasks is independent of memorability [22]. A computational form of the level-of-processing theory must take into account perceptual processing more rigorously and address how its depth can be modulated on an image-by-image basis. By addressing the elemental computations thought to be underlying memory – compression [23] and reconstruction [24, 25] –, we present a new computational model that yields a stimulus- driven, quantitative measure for how perceptual processing can impact memory formation. This model combines the vision-only models mentioned above with a sparse coding framework (SPC), a classic architecture used for compressing information in both computational neuroscience (e.g., [26, 27, 28, 29]) and machine learning (e.g., [30, 31, 32, 33]). Our model operates on the activations evoked by natural scene images in a DCNN trained to categorize scenes and objects [34, 35] and learns how to reconstruct these evoked activations. When considered over the entire space of signals to be compressed, reconstruction error, measured as the difference between the signals recovered from compressed codes and the uncompressed signal, provides a benchmark for evaluating different codes for lossy compression [36, 37, 38, 39]. We hypothesize that reconstruction error provides the necessary computational substrate for gauging and modulating the level of perceptual analysis [3], and thus impacts memory strengths. In particular, the reconstruction error resulting from the sparse coding model provides a principled signal to determine how much more processing might be warranted on an image-by-image basis. Ide- ally, a valid computational account addressing the perception-to-memory interface should capture different aspects of memory behavior, targeting not just the accuracy of retrieval, but also system- atic variance in terms of latencies during retrieval (i.e., response time), in addition to predicting measurable new phenomena. Across three studies, this work aspires to this ideal by testing our sparse coding model's ability to capture novel aspects of how sensory signals are transformed into memory, above and beyond what can already be explained by vision-only models. In Studies 1 and 2, we focus on two well- established and complimentary measures of memory strength: memory accuracy and response times during retrieval [40]. To this end, we relate the reconstruction errors of images (obtained using the sparse coding model) to their memorability scores and response times measured in a large scene memorability dataset[12] while taking into account what can be explained by a standard DCNN trained for image classification (VGG-16; [34]). We find that reconstruction error explains addi- tional variance in both memory accuracy (Study 1) and response times (Study 2), subsuming all of the variance explained by other models in the latter case. In Study 3, we then turn to 'model-driven psychophysics' and predict that the architectural differences between the sparse coding model and DCNNs would be paralleled in the brain as temporally and functionally distinct processes. In a pre-registered experiment, we manipulate the encoding times in a rapid serial visual presentation (RSVP) paradigm and observe that images with large reconstruction error benefit more from longer encoding times, while controlling for DCNN-driven memorability effects. Together, these results establish compression-based reconstruction error as a previously unrecognized driver of memorabil- 2 ity, and suggest a mechanism in which such reconstruction error modulates the depth of encoding of the incoming visual inputs. Results Figure 1: Schematic representation of how reconstruction errors are quantified using a sparse coding model (SPC). The sparse coding model example shown here is based on Layer 7 of a deep convolutional neural network (DCNN) trained for image classification - the second fully-connected layer from the VGG-16 network; [34]. (B) Example images that are easy and hard for the SPC to reconstruct. The numbers above the original images are the memorability scores (hit rates - false alarm rates) as measured in [12]. Efficient compression of sensory activations by minimizing reconstruction error To model the process of compressing sensory activations underlying our visual experiences, we built a sparse coding model (in short, SPC) to reconstruct the activations in a given layer of a DCNN pretrained to classify images of scenes and objects[34] based on the commonly used VGG-16 architecture[35]. The SPC model (see Fig. 1A for a schematic) consists of three layers: an input layer of 1000 units, an intermediate layer of 500 units for recoding the inputs, and a reconstruction layer of 1000 units for reproducing the input. We sampled 7 layers (ranging from early to late) from the VGG architecture and trained a separate sparse coding model for each of these DCNN layers. Because the dimensionality of DCNN layers is typically very high, we designed the input layer of the SPC (and thus, the reconstruction layer) to consist of 1000 units randomly sampled from the corresponding DCNN layer. This design also ensured that the number of parameters to be trained in the SPC model remains constant despite the fact that the dimensionality of layers varies across the DCNN architecture. Our SPC model is trained to reconstruct the DCNN activations evoked by natural scene images (10263 images in total) from a publicly available dataset [12], allowing the model to learn an efficient code for reconstructing DCNN activations for complex visual inputs. Critically, unlike the training of DCNN where the goal is to maximize classification accuracy, the objective of SPC training is to minimize the reconstruction error (the Euclidean distance between the reproduced and original activations, subject to a sparsity term on the intermediate recoding layer; see Fig. 1A and Methods). 3 Largereconstruction errorSmallreconstruction errorDCNN trained for image classification (VGG-16)Input layer: Activations in DCNN UnitsIntermediate layer:Activations in sparse codes Sparse coding model (SPC)ABInformation flowReconstruction layer ^Reconstruction error^||||2 Study 1: Images with larger reconstruction error are more memorable After training, sparse coding yields substantial variability in how well individual images can be reconstructed (see Fig. S1). In Fig. 1B, we show example images that are easy and hard for a representative SPC model (trained on the Layer 7 activations in the DCNN) to reconstruct. We observe that the hard-to-reconstruct images tend to be more object-centered or contain humans, relative to the easy-to-reconstruct images. Interestingly, such image attributes have been related to memorability behavior in earlier work [12, 41]. In fact, even from this subset of images selected solely based on their reconstruction error, we observe that hard-to-reconstruct images are often more memorable (memorability scores1 indicated above each image). Based on these observations, we hypothesize that the images that are harder to reconstruct are also more memorable. To establish this prediction quantitatively, we focused on the 2221 target images with available memorability scores measured in [12]. For each of the 2221 target images, we obtained a recon- struction error from each of the 7 trained SPC models. Then for each SPC model, we correlated the resulting reconstruction errors and memorability scores of the corresponding images. As shown in Fig. 2A (left panel), reconstruction errors from all sampled layers in SPC were significantly related images with larger reconstruction error are more memorable. Layers 5 (conv5) to memorability: and 7 (fc2) showed the strongest effects. Since the SPC models were trained based on the activations from a feedforward VGG-16 DCNN pretrained to classify scenes and objects [34], we next wanted to understand the extent to which the resulting reconstruction errors are just capturing the same variance in memorability as previous measures derived from purely feedforward architectures (e.g., [14, 16, 17]). To this end, we derived a predictor from the DCNN network by sampling the same 7 layers as the ones used for training the SPC models. Following [16], for each layer and target image, we calculated the distinctiveness as the Euclidean distance between each target image and its nearest neighbor with respect to the DCNN's feature space at this layer. Replicating similar results [14], we found that distinctiveness in the DCNN across all sampled layers was significantly related to memorability, with the later layers (Layers 5-7) showing the strongest effects (see Fig. 2B, left panel). After establishing that both reconstruction error and distinctiveness are significantly correlated with memorability, we next asked: does reconstruction error capture additional variance in memora- bility, above and beyond what was already explainable by the DCNN's feature hierarchy optimized for image classification? To address this question, we chose distinctiveness from Layer 5 as our primary measure of distinctiveness since it showed the highest correlation with memorability (Fig. 2B, left panel). We then compared distinctiveness at that layer to reconstruction error as well as another standard measure also derived from bottom-up feature hierarchy that shows correlation with memorability: the L2-Norm of activations in a DCNN layer given an image [14]2. First, we observed that although distinctiveness and reconstruction error were correlated (r = 0.82), this correlation was not perfectly co-linear and it was significantly less than the correlation between the two DCNN-derived measures, distinctiveness and L2-norm (r = .99; Williams' t test: p < .001; see Fig. S3). These results suggest that the SPC model and the DCNN might capture different aspects 1The memorability score of a given image is calculated as hit rate minus false alarm rate measured in [12]. Hit rate is calculated as the proportion of observers who correctly indicated that the image was repeated when the image was shown a second time to these participants. False alarm rate is calculated as the proportion of observers who incorrectly indicated that the image was repeated when the image was shown for the first time to these observers. In other words, a higher score means an image is more memorable after accounting for general familiarity. 2We found that distinctiveness was always better correlated with memorability scores and these correlations were more robust to the specific choice of layer, relative to L2-Norm (Fig. S2), further justifying our choice of distinctiveness instead of L2-Norm. 4 Figure 2: Images with large reconstruction error are more memorable. (A) Pearson's r between memorability and reconstruction error and partial Pearson's r after accounting for distinctiveness. (B) Pearson's r between memora- bility and distinctiveness and partial Pearson's r after accounting for reconstruction error. Error bars represent 95% confidence intervals from 1000 bootstrapping iterations. ***: p < .001, **: p < .01, *: p < .05. P values have been corrected for multiple comparisons with Bonferroni correction (α = 0.05/14). 5 ABReconstruction error from sparse coding modelDistinctiveness from VGG-16Partial correlation (after residualizing distinctivenss)Full correlationPartial correlation (after residualizing reconstruction error)Full correlation of the computations underlying the memorability behavior. Second, we performed partial regression analysis to directly test for the unique contribution of reconstruction error to explaining memorability. Specifically, we residualized Layer 5 distinctiveness (i.e., the DCNN layer that is most predictive of behavior under distinctiveness) from both mem- orability and reconstruction error. We found that indeed reconstruction error residuals continue to explain significant variance in memorability (Fig. 2A, right panel): reconstruction error from Layers 5 and 7 in SPC was still significantly correlated with memorability, after accounting for what can be explained solely by distinctiveness. Even though we are primarily interested in evaluating whether reconstruction error can explain additional variance, for completeness, we also ran a similar analysis by regressing out Layer 5 recon- struction error (which is the most predictive reconstruction error measure of memorability of all the layers) from both memorability and distinctiveness. As shown in Fig. 2B (right panel), distinctive- ness from Layers 3-7 also remained predictive of memorability after controlling for reconstruction error, again suggesting that distinctiveness and reconstruction error are capturing separable aspects of the variance in memorability. Together, these results demonstrate that images with harder-to-reconstruct DCNN activations are more memorable and that reconstruction error makes additional contribution to image memo- rability, above and beyond distinctiveness. Study 2: Images with larger reconstruction error are recognized faster during retrieval Previous work that explicitly manipulates the depth of encoding with different orienting tasks has found that a deeper level of encoding is associated with faster reaction times during retrieval (e.g., [42, 43, 22]). Thus, if our results from Study 1 have to do with a mechanism in which reconstruction error modulates the depth of encoding, then we predict that harder-to-reconstruct images will be retrieved more quickly. To this end, we analyzed the response time data from the correct recognition trials in [12] (see Methods on details on data inclusion criteria). Indeed, we found that reconstruction errors from all 7 layers in our sparse coding model were negatively correlated with response times during retrieval (Fig. 3A, left panel), such that harder-to-reconstruct images are faster to retrieve. We observed a similar pattern, albeit to a lesser degree and only for Layers 3-6, when we tested distinctiveness (Fig. 3B, left panel). To dissociate the contributions of reconstruction error and distinctiveness to explaining the variance in response times during retrieval, we again used partial regressions as in Study 1. We focused on model layers where we observed a significant correlation in the full corre- lation analysis and therefore did not perform partial correlation for Layers 2 and 7 distinctiveness. In the SPC model, the negative relationship between response times and reconstruction error on Layers 5-7 remained significant after we regressed out Layer 6 distinctiveness (the most predictive measure of response times in the DCNN) from both response times and reconstruction errors. On the contrary, distinctiveness decoupled from behavior (Layers 3-6) after we regressed out Layer 7 reconstruction errors (the most predictive measure of response times in the SPC model) from both response times and distinctiveness. These results demonstrate the specificity of the relationship between reconstruction error and response time during retrieval. That is, although both larger distinctiveness and larger reconstruc- tion error predict higher recognition accuracy, only reconstruction error predicts retrieval efficiency. Beyond a mere measure of visual processing, this finding is consistent with our hypothesis that the magnitude of reconstruction error directly modulates the process, in particular the depth, of encoding percepts into memory. 6 Figure 3: Images with large reconstruction error are recognized faster during retrieval. (A) Pearson's r between response times during retrieval and reconstruction error and partial Pearson's r after accounting for distinctiveness. (B) Pearson's r between response times during retrieval and distinctiveness and partial Pearson's r after accounting for reconstruction error. Note that partial correlation was only performed if the full correlation turned out to be statistically significant. Therefore, in the bottom right plot, there were no partial correlation results for Layers 2 and 7 distinctiveness. Error bars represent 95% confidence intervals from 1000 bootstrapping iterations. ***: p < .001, **: p < .01, *: p < .05. P values have been corrected for multiple comparisons with Bonferroni correction (α = 0.05/14). 7 ABReconstruction error from sparse coding modelDistinctiveness from VGG-16Partial correlation (after residualizing distinctivenss)Full correlationPartial correlation (after residualizing reconstruction error)Full correlation Study 3: Images with larger reconstruction error benefit more from longer encoding times Studies 1 and 2 revealed reconstruction error as a novel source of image memorability and retrieval efficiency. These results suggest that reconstruction error might be modulating the process of encoding itself, in terms of how deeply an image should be encoded, and thus yielding these measurable relationships in a publicly available dataset. To further establish that reconstruction error is associated with a functionally distinct set of computations in the mind and brain, beyond the vision-only computations implemented in the non-linear feature hierarchies trained for image classification captured in distinctiveness, we turn to a prediction made by our modeling framework and test it in a 'model-driven psychophysics' experiment in Study 3. Our logic is that images whose activations are harder to reconstruct and thus require a deeper level of processing will fetch additional mental resources, manifested as longer encoding times and increased memory accuracy ([3]). Therefore, we predict that the memory for images with higher reconstruction errors will benefit more from longer encoding times. To test this possibility, we start by sampling images with divergent profiles of distinctiveness and reconstruction error. Following Study 1 which focuses on memory accuracy, we used Layer 5 distinctiveness as our primary measure of distinctiveness and then selected Layer 7 reconstruction error from the SPC model as our primary measure of reconstruction error as this measure captures the largest amount of additional variance in memorability after accounting for distinctiveness (Par- tial Pearson's r = 0.16, p < .001; Fig. 2A right panel)3. After settling on the primary measures of distinctiveness and reconstruction error, we then sampled four different groups of 48 images each: images with 1) large distinctiveness and large reconstruction error, 2) large distinctiveness and small reconstruction error, 3) small distinctiveness and large reconstruction error, and 4) small distinctiveness and small reconstruction error. 'Large' is defined as falling within top 30 percentile of the target measure (distinctiveness or reconstruction error) and 'small' is defined as bottom 30 percentile. See Fig. 4 for example images in each of the four groups. We adopted a within-participant design with 2 distinctiveness levels (Large vs. Small) × 2 reconstruction error levels (Large vs. Small) × 3 encoding durations (34, 84 or 167 ms). Each of the resulting 12 conditions was presented as a separate block for each participant. During each block, half of the trials were target-present trials (i.e., the test image was presented in the RSVP stream) whereas the other half were target-absent trials (i.e., the test image was not presented in the RSVP stream). On each trial, participants first saw an RSVP stream of images (see Fig. 5A; following the trial structure of [44]). Then they were shown a test image and had to indicate whether the test image was presented in the RVSP stream or not. The experiment design and sample size were pre-registered (https://aspredicted.org/MFM R22). 45 participants completed the experiment online via Prolific. We calculated hit rate 4 for each of the 12 conditions (see Fig. 5B). In Fig. 5B, we can see that although memory accuracy for all images increased with longer encoding times, images with larger reconstruction error benefited more from the longer encoding times (as indicated by the steeper slopes). A three-way repeated measures ANOVA confirmed these qualitative observations: In addition to the main effects of reconstruction error, distinctiveness, and encoding duration, there was a significant interaction between reconstruction error and encoding duration. That is, images with large reconstruction error significantly benefited more from longer 3To make sure that the Layer 7 reconstruction error is not just capturing the memorability driven by Layer 7 distinctiveness, we also tested including both Layer 5 and Layer 7 distinctiveness measures in the partial regression model. Even under this stringent way of controlling for distinctiveness, Layer 7 reconstruction error continued to significantly capture additional variance in memorability (Partial Pearson's r = 0.08, p < .001). 4Target images were never used as foils in this RSVP experiment so we could not calculate false alarm rates for them. 8 Figure 4: Example images from each of the four groups with different Distinctiveness-Reconstruction Error profiles. encoding duration, relative to images with small reconstruction error (see Table S1). To directly measure the effect of reconstruction error on memory , we compared regression slopes relating encoding times to hit rates between the images with large vs. small reconstruction error. We bootstrapped the difference of these regression slopes between reconstruction error levels ( βLargeRE −βSmallRE) separately for each distinctiveness level and sequential pair of encoding times (Early: 34 ms vs. 84 ms; Late: 84 ms vs. 167 ms; see Methods). This analysis not only confirmed that images with larger reconstruction error indeed benefit more from longer encoding times, but also revealed a finer-grained temporal picture of this effect: As shown in Fig. 5C, for images with large distinctiveness, the memory benefit of large reconstruction error was observed earlier (i.e., when encoding time was increased from 34 ms to 84 ms; mean ∆β = 0.020, p = .045), whereas for images with small distinctiveness, this reconstruction error benefit was only observed later (i.e., when encoding time was increased from 84 ms to 167 ms; mean ∆β = 0.022, p = .001). Although Study 3 was conceived to reveal the differential effects of distinctiveness and recon- struction error in a categorical design (e.g., Large Distinctiveness and Small Reconstruction Error), next we turned to a finer-grained analysis to ask whether the ability of these models to predict be- havior depends on time. We predict that if the memory benefit of reconstruction error is the result of deeper processing and thus requires more time to complete the computation, reconstruction error should account for more and more variance in memory as exposure time increases. To this end, for each duration, we correlated the behavioral hit rates at the level of individual images with their corresponding distinctiveness and reconstruction error. Indeed, as shown in Fig. 5D, we observed that the correlations between reconstruction error and hit rate increase monotonically as a function of exposure time (p < .001 from 1000 bootstrapping iterations; see Methods) whereas this pattern is absent for distinctiveness (p = .526 from 1000 bootstrapping iterations; see Methods). Together, these behavioral results further demonstrate that reconstruction error contributes to memorability by modulating encoding depth such that the memory benefit driven by reconstruc- tion error only manifests itself when given enough encoding time. Moreover, distinctiveness- and reconstruction error-driven memorability effects exhibit differential temporal profiles and thus are likely to reflect functionally distinct processes in the mind and brain. 9 LargeDistinctiveness Large Reconstruction ErrorSmall Reconstruction ErrorSmall Distinctiveness Figure 5: Images with harder-to-reconstruct representations benefit more from longer encoding times. (A) An ex- ample trial from the RSVP experiment. (B) Hit rates for each of the four image groups. Error bars represent 95% confidence interval from 1000 bootstrapping iterations. (C) Difference between the regression slopes of hit rate vs. time across images with large vs. small reconstruction error, conducted separately for each sequential pair of encoding times (indicated by colors; also highlighted in panel B, x-axis) and distinctiveness level. Distributions represent the slope differences from 1000 bootstrapping iterations. ***: p <= .001, *: p < .05. (D) Pearson's r between distinc- tiveness/reconstruction error and hit rates across different presentation times. Error bars represent 95% confidence interval from 1000 bootstrapping iterations. Discussion We present a computational model that combines sparse coding with recent vision models based on deep convolutional neural networks and gives rise to a new quantitative measure – i.e., compression-based reconstruction error – of how perception modulates the strength of memory traces. In Studies 1 and 2, we show that reconstruction error predicts both memory accuracy and 10 AB+500 ms200 ms200 msTarget Present? 1 for Yes, 0 for No400 msUntil response (max 10 s)TimeTarget can only be at Position 2, 3, 4 or 5Presentation time can be 34 ms, 84 ms or 167 msCDistinctivenessReconstruction ErrorDCorrelation with MemorabilityLarge DistinctivenessLarge Recon. ErrorLarge DistinctivenessSmall Recon. ErrorSmall DistinctivenessLarge Recon. ErrorSmall DistinctivenessSmall Recon. Error response times at the level of individual images. Critically, reconstruction error explains additional variance in both aspects of memory performance, beyond what can be explained by vision-only mod- els (e.g., [14, 16]) – including capturing all of the model-explained variance in response times. To further demonstrate that the modulation of memorability due to reconstruction error reflects a sep- arate process relative to vision-only models, we run an RSVP experiment and show that the effects of distinctiveness and reconstruction error on memorability have distinct temporal profiles: Mem- ory performance increases to a more substantial degree for images that are harder to reconstruct (controlling for distinctiveness). Finally, as exposure time increases, allowing a deeper analysis of the relevant scene features when necessary, reconstruction error becomes increasingly predic- tive of memory whereas the effect of distinctiveness stays more or less constant across durations. Together, these results not only establish compression-based reconstruction error as a previously unrecognized driver of memorability, but also suggest a perception to memory interface in which such reconstruction error modulates the encoding depth of incoming visual inputs. A signal for modulating depth of encoding By formalizing the interface between perception and memory with the sparse coding model, our work puts the level-of-processing theory in a new light. In the original and revised versions of the theory ([3, 45, 20]), encoding depth has always been conceptualized as a continuum. Yet to date all empirical demonstrations of the effect of encoding depth on memory remain qualitative, through manipulating encoding depth with different orienting tasks (e.g., paying attention to the physical vs. semantic property of the stimuli; for a review, see [21]). By demonstrating that reconstruction error, at the level of images, predicts memory accuracy, response latency during retrieval and the need for more encoding time, we suggest that reconstruction error can serve as an indication of the resource-rational depth of encoding, filling in a longstanding explanatory gap in the theory. Multiple mechanisms are possible for how how reconstruction error can affect perceptual process- ing, leading to deeper or shallower analysis, and thus memory strength. One possibility is suggested by the predictive coding framework [46], one version of which suggests the existence of predictive autoencoders that could compute the compressibility and reconstruction error of incoming infor- mation (e.g., [47]). Another possibility is related to the idea of 'analysis-by-synthesis', which posits the reconstruction of sensory activations via a process of 'synthesis' to be part of perceptual pro- cessing [48, 49, 50, 51]. The current study suggests that such a synthesis process may also provide a learning signal for memory. Our results also join recent modeling work (e.g., [28, 52, 53]) to suggest the computational motif of sparse coding as a useful mechanism to formalize memory-related com- putations in the brain. Future work can build on our framework to explore models that integrate compression and different forms of iterative processing guided by reconstruction error, and evaluate them as accounts of how percepts are cast into memory traces. A candidate for exploring the neurocomputational basis of the subsequent memory effect Decades of work in neuroimaging have clearly demonstrated that neural processing during per- ceptual encoding has a profound impact on what will later be remembered (e.g., the subsequent memory effect: [54, 55, 1]). Compared to items later forgotten, remembered items elicit greater activation in higher-level visual regions, frontoparietal attention regions and the medial temporal lobe [56] and higher pattern similarity across repetitions ([57, 58, 2]). However, the computational processing that underlies these neural signals measured at the interface between perception and memory has been elusive. The empirical success of our SPC model in explaining multiple aspects of memory behavior suggests reconstruction error a plausible quantitative covariate to explain aspects of the neural signals underlying the subsequent memory effect. Future work should also explore how reconstruction error may selectively covary with activations from certain brain regions (e.g., 11 frontoparietal regions and medial temporal lobe) vs. others (e.g., visual regions) to help elicit com- putational processes supported by these brain regions. Beyond its role in driving memorability, reconstruction error can provide a more general priority signal that can be useful across multiple domains of cognition. These include the broader range of memory-related processes such as retrieval [24, 25], modulation of learning during development [59], and guiding the deployment of visual attention beyond bottom-up salience. Finally, our study also showcases the utility of 'model-driven psychophysics'. Computational modeling allows us to generate quantitative predictions about behavioral performance and in turn, behavioral phenomena can help constrain and arbitrate between different models. Methods Studies 1 and 2 Dataset The dataset we used is from [12]. The dataset includes 2222 target images (with memorability scores measured from human observers; memorability score = hit rate - false alarm rate) and 8042 filler images (without memorability scores). For the reaction time (RT) measure, we only included RTs during the correctly recognized (i.e., hit) trials. After excluding outliers (+/- 2.5 standard deviations from the mean RT of all the correct trials), we averaged the remaining RTs for each target image to obtain one single measure of RT for the target image. The dataset covers a wide range of outdoor and indoor scenes. After removing duplicate images (i.e., images with different indices but identical content), we are left with 2221 target images and 8038 filler images. Quantifying distinctiveness We used the VGG-16 network trained for classifying both objects and scenes [34]. The model is trained to make 1365-way classification consisting of both object and scene categories (by merg- ing the 1000 classes from ImageNet and the 365 classes from Places365-Standard). We used the Keras[60] implementation of this model (https://github.com/GKalliatakis/Keras-VGG16-places365). We then sampled 7 layers across the hierarchy of the network to capture visual features at each layer. The 7 layers were maxpooling 1-5 and fully connected(fc) 1-2. For simplicity, we referred to these layers as Layer 1-7 in the manuscript. To quantify distinctiveness, we first passed all the images (resized from 256 × 256 to 227 × 227) in the Isola dataset (both targets and fillers) through the VGG-16 and extracted activation patterns across the 7 layers. Following our previous work [16], for each layer, we calculated distinctiveness as the Euclidean distance between each target image and its nearest neighbor (among all target and filler images) with respect to the feature space defined by the given layer. We also considered an alternative measure for quantifying DCNN network activations that was shown to be predictive of memorability scores (L2-Norm; [14]). We found that both approaches yielded highly similar results (see Fig. S1). So we report results based on the nearest neighbor approach in the manuscript. Quantifying reconstruction error Sparse Coding. A separate SPC model was trained for each of the 7 layers of the VGG-16 network [34]. SPC involves using linear combinations of a limited number of codewords (i.e., a codebook) to reconstruct inputs. To do so, we used LCA (locally competitive algorithm) [31] to implement sparse coding, which is a state-of-the-art method but computationally intensive algorithm. Main source of computational cost arises from the dimensionality of the inputs to be reconstructed. Thus, for the sake of computational tractability, we randomly sample d = 1000 columns from 12 the flattened feature activations for each layer. The training objective is then to reconstruct the resulting 1000−dimensional feature vectors. In the language of SPC, this means that the dimension of each codeword is 1000.5 Training SPC also requires a regularizer λ for controlling how many codewords can be used to reconstruct a given feature vector. We choose λ = 0.001 based on a simple grid search to minimize reconstruction error. Because this regularization term is sensitive to the scale of feature vectors, and because we wished to use the same λ for all layers, we applied a pre-processing step where we scaled feature vectors to be reconstructed using a layer-specific constant. This pre-processing step ensured that the same value of λ worked equally well for all layers. 6 Finally, we choose the codebook size (i.e., the number of codewords available to use for reconstructing a given input) to be n = 500. This codebook size is a reasonable trade-off between the computational cost of a large codebook in LCA and the reconstruction error incurred: setting smaller ns significantly increases reconstruction error. As mentioned above, a separate SPC model was trained for each layer of the VGG-16 network using all images in the Isola dataset, including both target images and filler images 7. We used 800 iterations to train each model, where in each iteration a random batch of 50 images are used as training inputs. In each iteration, model weights are updated at most 500 times in an inner- loop, or less if the weights converged for the batch. To quantify reconstruction error, we calculated the Euclidean distance between the reconstructed 1000-dimensional vectors and the input 1000- dimensional activation vectors for each image. Evaluating relative contribution of distinctiveness and reconstruction error to memorability and response times We performed partial regression to evaluate the relative contributions of distinctiveness and reconstruction error to memorability/response times. More specifically, we first perform a simple linear regression (with intercept) that regresses the memorability scores/response times on distinc- tiveness and obtain residual r1. Then, we perform another simple linear regression (with intercept) that regresses the reconstruction error on distinctiveness and obtain residual r2. Finally, we cor- relate r1 and r2, and report statistics from this correlation. We also performed the same set of analyses to control for reconstruction error. Study 3 Participants We recruited 65 participants via Prolific (www.prolific.co). As specified in our pre-registration (https://aspredicted.org/MFM R22), we excluded participants who did not complete all 12 blocks of the experiment (N = 19) or who did complete all 12 blocks but did not give a response on over 10% of the trials on any given block (N = 1). Our final sample included 45 participants. The memory performance of all 45 participants was above chance (all d' >0). 5We ensured that at this codeword length, the resulting reconstruction error measures were similar regardless of which 1000 units were randomly sampled and used to train SPC. 6Note that this pre-processing only affects absolute magnitude of reconstruction errors within a layer, but does not affect relative order among the images with respect to that layer. For our study, the relevant metric is these relative differences of reconstruction errors, instead of the otherwise arbitrary absolute reconstruction error magnitudes. 7We also tried training only on the filler images and the resulting reconstruction errors for the target images were largely the same (average r = 0.94). 13 Stimuli To investigate the roles distinctiveness and reconstruction error play in determining memorabil- ity, we sampled four groups of 48 target images each, with divergent profiles of distinctiveness and reconstruction error: 1) images with large distinctiveness and large reconstruction error, 2) images with large distinctiveness and small reconstruction error, 3) images with small distinctiveness and large reconstruction error, and 4) images with small distinctiveness and small reconstruction error. To sample these images, we started with using layer 5 nearest-1 neighbor distinctiveness as our distinctiveness measure because this yielded the highest correlation with the memorability scores (see Fig. 2A right panel). Then based on the partial regression results, we selected layer 7 recon- struction error from the sparse coding model as the reconstruction measure because it explained largest proportion of variance in memorability score beyond layer 5 distinctiveness (see Fig. 2B). In other words, we bench-marked distinctiveness and reconstruction error using the 'best' performing combination. Using these benchmarks, we designated images in the top and bottom 30 percentile out of all the images (including targets and fillers) as 'large' and 'small' in terms of each measure (distinctiveness/reconstruction error). For each of the four image groups, we then sampled the 48 target images with the most extreme values considering both measures (e.g., for the large distinc- tiveness and large reconstruction error group, we sampled the 48 images with the largest sum of both percentiles; for the large distinctiveness and small reconstruction error group, we sampled the 48 images with the largest difference between the distinctiveness percentile and the reconstruction error percentile). In addition to the 192 target images sampled in the way described above, we also randomly sampled 2304 images from the fillers in the Isola dataset to use as fillers in our experiment. Design We adopted a within-participant 2 distinctiveness levels (High vs. Low) × 2 reconstruction error levels (High vs. Low) × 3 encoding durations (34, 84 or 167 ms) design. Each condition was presented as a separate block (i.e., 12 blocks in total, randomized across participants). During each block, half of the trials were target-present trials (i.e., the test image was presented in the RSVP stream) whereas the other half were target-absent trials (i.e., the test image was not presented in the RSVP stream). Trial order was randomized. Each block consists of 32 trials. Procedure Participants first completed a practice block of 20 trials with images not used in the actual experiment and all the practice images were presented for 167 ms each. At the end of each practice trial, they received feedback on whether their response was correct or not. After the practice block, participants were instructed to press the space bar to begin each experimental block and no feedback was given during the experimental blocks. Given the importance of timing for our experiment, images were pre-loaded at the beginning of each block to minimize the processing times during trial presentation. On each trial (following the trial structure of [44], see Fig. 3B), participants first saw a 500- ms fixation cross, followed by a 200-ms blank screen. Then they saw a stream of 6 scene images presented back to back. Each image was shown for 34, 84 or 167 ms, depending on the block. If this was a target-present trial, the target image can be presented as the 2nd, 3rd, 4th, or 5th image in the RSVP stream (fully counter-balanced). After the RSVP stream, there was another 200-ms blank screen, followed by the test image, which was presented for 400 ms. Participants had a maximum of 10 seconds to respond either Yes (Press '1') or N (Press '0'). After the participant made a response, the next trial would start. 14 Analysis The primary measure of interest is hit rate (percentage of correctly recognized target present tri- als), calculated separately for each of the 12 within-participant conditions. To assess the effect of en- coding times as a function of reconstruction accuracy, we conducted a three-way repeated-measures ANOVA with the dependent variable being hit rate and the three factors being distinctiveness, reconstruction error (RE) and encoding durations (Time). To further investigate how the interaction between distinctiveness, reconstruction error and encoding times affects memory, we ran bootstrapping analysis to resample the participants with replacement and only analyze trials where the encoding times are 34 ms and 84 ms (Early) or 84 ms and 167 ms (Late). For each participant, we first separated the trials into large and small distinctiveness. For each distinctiveness level, we fit two different linear regression models where Time was included as the predictor and hit rate as the dependent variable: one for images with large RE and the other for those with small RE. We then subtracted the fitted beta for Time for images with small RE from that for images with large RE. We next averaged this beta difference for all the participants in each bootstrapped sample. If our hypothesis holds, the slope for the linear regression model for large RE should be steeper than that for small RE and therefore the mean beta difference should be larger than 0. The bootstrapping procedure was repeated 1000 times and p value was calculated as the number of iterations where the mean beta difference is small than 0 (i.e., went against our hypothesis). The pre-registered analysis described above treated distinctiveness and reconstruction error as categorical variables and aggregated images into separate categories. In the following analysis, we aimed to test if the time-dependent effect of reconstruction error on memory also would hold when we evaluated the contributions of distinctiveness and reconstruction error to memorability of images presented at different exposure times in a continuous manner across all the target images. For each duration, we calculated the correlation between distinctiveness/reconstruction error and hit rate across all target images, respectively. To test statistical significance, we again ran bootstrapping analysis to resample the participants with replacement. For each iteration, we calculated correlations between distinctiveness/reconstruction error with hit rate across the three durations. We then fit two separate linear regression models, one for distinctiveness and the other for reconstruction error, to relate duration to correlation values. If our hypothesis holds, we should expect the the beta for the reconstruction error model is positive whereas the beta for the distinctiveness model should not be consistently positive. The bootstrapping procedure was repeated 1000 times and p value was calculated as the number of iterations where the beta is small than 0 (i.e., went against our hypothesis), separately for the reconstruction error model and the distinctiveness model. Code and Data Availability Codes and data have been deposited on Github (https://github.com/CNCLgithub/ReconMem). References [1] A. D. Wagner, D. L. Schacter, M. Rotte, W. Koutstaal, A. Maril, A. M. Dale, B. R. Rosen, R. L. Buckner, Building memories: remembering and forgetting of verbal experiences as predicted by brain activity, Science 281 (5380) (1998) 1188–1191. [2] G. Xue, The neural representations underlying human episodic memory, Trends in Cognitive Sciences 22 (6) (2018) 544–561. 15 [3] F. I. Craik, R. S. Lockhart, Levels of processing: A framework for memory research, Journal of verbal learning and verbal behavior 11 (6) (1972) 671–684. [4] M. W. Schurgin, J. T. Wixted, T. F. Brady, Psychophysical scaling reveals a unified theory of visual memory strength, Nature human behaviour 4 (11) (2020) 1156–1172. [5] M. M. Chun, M. K. Johnson, Memory: Enduring traces of perceptual and reflective attention, Neuron 72 (4) (2011) 520–535. [6] C. A. Kurby, J. M. Zacks, Segmentation in the perception and memory of events, Trends in cognitive sciences 12 (2) (2008) 72–79. [7] S. E. Favila, H. Lee, B. A. Kuhl, Transforming the concept of memory reactivation, Trends in Neurosciences 43 (12) (2020) 939–950. [8] J. Liu, H. Zhang, T. Yu, L. Ren, D. Ni, Q. Yang, B. Lu, L. Zhang, N. Axmacher, G. Xue, Transformative neural representations support long-term episodic memory, Science advances 7 (41) (2021) eabg9715. [9] A. Libby, T. J. Buschman, Rotational dynamics reduce interference between sensory and mem- ory representations, Nature neuroscience 24 (5) (2021) 715–726. [10] J. T. Serences, Neural mechanisms of information storage in visual short-term memory, Vision research 128 (2016) 53–67. [11] Y. Xu, Reevaluating the sensory account of visual working memory storage, Trends in Cognitive Sciences 21 (10) (2017) 794–815. [12] P. Isola, J. Xiao, D. Parikh, A. Torralba, A. Oliva, What makes a photograph memorable?, IEEE Transactions on Pattern Analysis and Machine Intelligence 7 (36) (2014) 1469–1482. [13] W. A. Bainbridge, P. Isola, A. Oliva, The intrinsic memorability of face photographs., Journal of Experimental Psychology: General 142 (4) (2013) 1323. [14] A. Jaegle, V. Mehrpour, Y. Mohsenzadeh, T. Meyer, A. Oliva, N. Rust, Population response magnitude variation in inferotemporal cortex predicts image memorability, Elife 8 (2019) e47596. [15] A. Khosla, A. S. Raju, A. Torralba, A. Oliva, Understanding and predicting image memorability at a large scale, in: Proceedings of the IEEE international conference on computer vision, 2015, pp. 2390–2398. [16] Q. Lin, S. R. Yousif, B. Scholl, M. M. Chun, Image memorability is driven by visual and conceptual distinctivenes, Journal of Vision 19 (10) (2019) 290c–290c. [17] M. A. Kramer, M. N. Hebart, C. I. Baker, W. A. Bainbridge, The features underlying the memorability of objects, bioRxiv (2022). [18] A. D. Baddeley, The trouble with levels: A reexamination of craik and lockhart's framework for memory research. (1978). [19] A. Treisman, The psychological reality of levels of processing, Levels of processing in human memory (2014) 301–330. 16 [20] F. I. Craik, Remembering: An activity of mind and brain, Annual Review of Psychology 71 (2020) 1–24. [21] L. S. Cermak, F. I. Craik, Levels of processing in human memory (PLE: Memory), Psychology Press, 2014. [22] W. A. Bainbridge, The resiliency of image memorability: A predictor of memory separate from attention and priming, Neuropsychologia 141 (2020) 107408. [23] C. J. Bates, R. A. Jacobs, Efficient data compression in perception and perceptual memory., Psychological review 127 (5) (2020) 891. [24] D. L. Schacter, Adaptive constructive processes and the future of memory., American Psychol- ogist 67 (8) (2012) 603. [25] P. Hemmer, M. Steyvers, A bayesian account of reconstructive memory, Topics in Cognitive Science 1 (1) (2009) 189–202. [26] B. A. Olshausen, D. J. Field, Emergence of simple-cell receptive field properties by learning a sparse code for natural images, Nature 381 (6583) (1996) 607–609. [27] B. A. Olshausen, D. J. Field, Sparse coding with an overcomplete basis set: A strategy employed by v1?, Vision research 37 (23) (1997) 3311–3325. [28] M. K. Benna, S. Fusi, Place cells may simply be memory cells: Memory compression leads to spatial tuning and history dependence, Proceedings of the National Academy of Sciences 118 (51) (2021) e2018422118. [29] M. S. Lewicki, Efficient coding of natural sounds, Nature neuroscience 5 (4) (2002) 356–363. [30] R. Zemel, G. E. Hinton, Developing population codes by minimizing description length, Ad- vances in neural information processing systems 6 (1993). [31] C. J. Rozell, D. H. Johnson, R. G. Baraniuk, B. A. Olshausen, Sparse coding via thresholding and local competition in neural circuits, Neural Comput. 20 (10) (2008) 2526–2563. doi: 10.1162/neco.2008.03-07-486. URL https://doi.org/10.1162/neco.2008.03-07-486 [32] D. E. Rumelhart, G. E. Hinton, R. J. Williams, Learning internal representations by error propagation, Tech. rep., California Univ San Diego La Jolla Inst for Cognitive Science (1985). [33] K. Gregor, Y. LeCun, Learning fast approximations of sparse coding, in: Proceedings of the 27th international conference on international conference on machine learning, 2010, pp. 399– 406. [34] B. Zhou, A. Lapedriza, A. Khosla, A. Oliva, A. Torralba, Places: A 10 million image database for scene recognition, IEEE transactions on pattern analysis and machine intelligence 40 (6) (2017) 1452–1464. [35] K. Simonyan, A. Zisserman, Very deep convolutional networks for large-scale image recognition, in: Y. Bengio, Y. LeCun (Eds.), 3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings, 2015. URL http://arxiv.org/abs/1409.1556 17 [36] T. Berger, Rate distortion theory: A mathematical basis for data compression, Prentice-Hall., 1971. [37] T. M. Cover, J. A. Thomas, Elements of Information Theory, John Wiley & Sons, 1991. [38] D. J. MacKay, Information Theory, Inference, and Learning Algorithms, Cambridge University Press, 2003. [39] G. E. Hinton, P. Dayan, B. J. Frey, R. M. Neal, The" wake-sleep" algorithm for unsupervised neural networks, Science 268 (5214) (1995) 1158–1161. [40] M. Kahana, G. Loftus, Response time versus accuracy in human memory, The nature of cog- nition (1999) 322–384. [41] Z. Bylinskii, P. Isola, C. Bainbridge, A. Torralba, A. Oliva, Intrinsic and extrinsic effects on image memorability, Vision research 116 (2015) 165–178. [42] A. Vincent, F. I. Craik, J. J. Furedy, Relations among memory performance, mental workload and cardiovascular responses, International Journal of Psychophysiology 23 (3) (1996) 181–198. [43] J. D. Ragland, S. T. Moelter, C. McGrath, S. K. Hill, R. E. Gur, W. B. Bilker, S. J. Siegel, R. C. Gur, Levels-of-processing effect on word recognition in schizophrenia, Biological psychiatry 54 (11) (2003) 1154–1161. [44] N. Broers, M. C. Potter, M. R. Nieuwenstein, Enhanced recognition of memorable pictures in ultra-fast rsvp, Psychonomic bulletin & review 25 (3) (2018) 1080–1086. [45] F. I. Craik, Levels of processing: Past, present... and future?, Memory 10 (5-6) (2002) 305–318. [46] K. Friston, S. Kiebel, Predictive coding under the free-energy principle, Philosophical transac- tions of the Royal Society B: Biological sciences 364 (1521) (2009) 1211–1221. [47] R. Rosenbaum, On the relationship between predictive coding and backpropagation, Plos one 17 (3) (2022) e0266102. [48] H. Barrow, J. Tenenbaum, Recovering intrinsic scene characteristics, Comput. Vis. Syst 2 (3-26) (1978) 2. [49] B. A. Olshausen, G. Mangun, M. Gazzaniga, Perception as an inference problem, MIT press Cambridge, MA, 2014. [50] A. Yuille, D. Kersten, Vision as bayesian inference: analysis by synthesis?, Trends in cognitive sciences 10 (7) (2006) 301–308. [51] D. Mumford, Neuronal architectures for pattern-theoretic problems, Large-scale neuronal the- ories of the brain (1994) 125–152. [52] A. M. Dubreuil, Y. Amit, N. Brunel, Memory capacity of networks with stochastic binary synapses, PLoS computational biology 10 (8) (2014) e1003727. [53] X. Wu, G. C. Mel, D. Strouse, B. W. Mel, How dendrites affect online recognition memory, PLoS computational biology 15 (5) (2019) e1006892. 18 [54] J. B. Brewer, Z. Zhao, J. E. Desmond, G. H. Glover, J. D. Gabrieli, Making memories: brain activity that predicts how well visual experience will be remembered, Science 281 (5380) (1998) 1185–1187. [55] K. A. Paller, A. D. Wagner, Observing the transformation of experience into memory, Trends in cognitive sciences 6 (2) (2002) 93–102. [56] H. Kim, Neural activity that predicts subsequent memory and forgetting: a meta-analysis of 74 fmri studies, Neuroimage 54 (3) (2011) 2446–2461. [57] G. Xue, Q. Dong, C. Chen, Z. Lu, J. A. Mumford, R. A. Poldrack, Greater neural pattern similarity across repetitions is associated with better memory, Science 330 (6000) (2010) 97– 101. [58] E. J. Ward, M. M. Chun, B. A. Kuhl, Repetition suppression and multi-voxel pattern similarity differentially track implicit and explicit visual memory, Journal of Neuroscience 33 (37) (2013) 14749–14757. [59] A. E. Stahl, L. Feigenson, Observing the unexpected enhances infants' learning and exploration, Science 348 (6230) (2015) 91–94. [60] F. Chollet, et al., Keras, https://keras.io (2015). 19 Effect DFn DFd F p Distinctiveness (Dist.) Reconstruction error (RE) Time Dist. × RE Dist. × Time RE × Time Dist. ×RE × Time 1 1 2 1 2 2 2 44 44 88 44 88 88 88 197.187 < .001 27.408 < .001 106.498 < .001 0.160 4.414 4.192 3.909 .015 .018 .024 η2 0.353 0.029 0.285 0.000 0.001 0.001 0.001 Table S1: To formally test how distinctiveness and reconstruction error influence the effect of encoding time on memory performance, we ran a three-way repeated-measures ANOVA with the dependent variable being hit rate and the three factors being distinctiveness (Dist), reconstruction error (RE) and encoding duration (Time). The table shows the results. As expected, there were main effects of distinctiveness, reconstruction error and encoding duration. More critically, we also saw an interaction between reconstruction error and encoding duration, meaning that images with large reconstruction error benefited even more from longer encoding times, relative to images with smaller reconstruction error. Interestingly, we also observed an interaction between distinctiveness and encoding duration and a three-way interaction between distinctiveness, reconstruction error and encoding duration. These interactions can arise from the differential time-courses of the memory benefit (see Fig. 5C) brought by large reconstruction error as a function of the distinctiveness levels. 20 Figure S1: The distributions of normalized reconstruction errors for the 2221 target images from the seven sparse coding models (each trained to reconstruct a different layer of VGG-16). 21 0200400600CountLayer = 1Layer = 2Layer = 30510Normalized_RELayer = 40510Normalized_RE0200400600CountLayer = 50510Normalized_RELayer = 60510Normalized_RELayer = 7 Figure S2: Correlations between memorability and two different measures derived from activation in VGG-16: Dis- tinctiveness (euclidean distance to nearest neighbor) and L2 Norm (L2 norm of the activation vector). 22 Figure S3: Pearson's correlations between different measures for Layer 5. Dist(Distinctiveness): euclidean distance to nearest neighbor. L2 Norm: L2 norm of the activation vector. RE SPC: reconstruction error from the sparse coding model. Statistical significance was assessed with Williams' t test (for two correlation values sharing one common variable on the same population). ***: p < .001 23 Pearson's correlation***
http://arxiv.org/abs/2302.10390v2
2023-03-15T15:44:37
2023-02-21T01:32:27
DrasCLR: A Self-supervised Framework of Learning Disease-related and Anatomy-specific Representation for 3D Medical Images
Large-scale volumetric medical images with annotation are rare, costly, and time prohibitive to acquire. Self-supervised learning (SSL) offers a promising pre-training and feature extraction solution for many downstream tasks, as it only uses unlabeled data. Recently, SSL methods based on instance discrimination have gained popularity in the medical imaging domain. However, SSL pre-trained encoders may use many clues in the image to discriminate an instance that are not necessarily disease-related. Moreover, pathological patterns are often subtle and heterogeneous, requiring the ability of the desired method to represent anatomy-specific features that are sensitive to abnormal changes in different body parts. In this work, we present a novel SSL framework, named DrasCLR, for 3D medical imaging to overcome these challenges. We propose two domain-specific contrastive learning strategies: one aims to capture subtle disease patterns inside a local anatomical region, and the other aims to represent severe disease patterns that span larger regions. We formulate the encoder using conditional hyper-parameterized network, in which the parameters are dependant on the anatomical location, to extract anatomically sensitive features. Extensive experiments on large-scale computer tomography (CT) datasets of lung images show that our method improves the performance of many downstream prediction and segmentation tasks. The patient-level representation improves the performance of the patient survival prediction task. We show how our method can detect emphysema subtypes via dense prediction. We demonstrate that fine-tuning the pre-trained model can significantly reduce annotation efforts without sacrificing emphysema detection accuracy. Our ablation study highlights the importance of incorporating anatomical context into the SSL framework.
[ "Ke Yu", "Li Sun", "Junxiang Chen", "Max Reynolds", "Tigmanshu Chaudhary", "Kayhan Batmanghelich" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10390v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10390v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.CV", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.CV", "cs.AI", "cs.LG" ]
3 2 0 2 r a M 5 1 ] V C . s c [ 2 v 0 9 3 0 1 . 2 0 3 2 : v i X r a DRASCLR: A SELF-SUPERVISED FRAMEWORK OF LEARNING DISEASE-RELATED AND ANATOMY-SPECIFIC REPRESENTATION FOR 3D MEDICAL IMAGES Ke Yu∗ School of Computing and Information University of Pittsburgh [email protected] Li Sun∗ Department of Electrical and Computer Engineering Boston University [email protected] Junxiang Chen Department of Biomedical Informatics University of Pittsburgh Max Reynolds Department of Biomedical Informatics University of Pittsburgh Tigmanshu Chaudhary Department of Biomedical Informatics University of Pittsburgh Kayhan Batmanghelich Department of Electrical and Computer Engineering Boston University ABSTRACT Large-scale volumetric medical images with annotation are rare, costly, and time prohibitive to acquire. Self-supervised learning (SSL) offers a promising pre-training and feature extraction solution for many downstream tasks, as it only uses unlabeled data. Recently, SSL methods based on instance discrimination have gained popularity in the medical imaging domain. However, SSL pre-trained encoders may use many clues in the image to discriminate an instance that are not necessarily disease-related. Moreover, pathological patterns are often subtle and heterogeneous, requiring the ability of the desired method to represent anatomy-specific features that are sensitive to abnormal changes in different body parts. In this work, we present a novel SSL framework, named DrasCLR, for 3D medical imaging to overcome these challenges. We propose two domain-specific contrastive learning strategies: one aims to capture subtle disease patterns inside a local anatomical region, and the other aims to represent severe disease patterns that span larger regions. We formulate the encoder using conditional hyper-parameterized network, in which the parameters are dependant on the anatomical location, to extract anatomically sensitive features. Extensive experiments on large-scale computer tomography (CT) datasets of lung images show that our method improves the performance of many downstream prediction and segmentation tasks. The patient-level representation improves the performance of the patient survival prediction task. We show how our method can detect emphysema subtypes via dense prediction. We demonstrate that fine-tuning the pre-trained model can significantly reduce annotation efforts without sacrificing emphysema detection accuracy. Our ablation study highlights the importance of incorporating anatomical context into the SSL framework. Keywords Self-supervised learning * Contrastive learning * Label-efficient learning * 3D Medical imaging data 1 Introduction While deep learning approaches have significantly advanced computer vision and many other fields [1, 2, 3], efforts to apply these advancements to medical image analysis are still hampered by the scarcity of large-scale annotated *These authors contributed equally to this work datasets. Annotating medical images requires domain expertise and is a laborious and costly process, especially for 3D volumetric medical data. However, massive amounts of unlabeled raw images have been collected and stored in hospitals' picture archiving and communication systems (PACS) for decades. Recently, self-supervised learning (SSL) has become increasingly popular as a way to alleviate the annotation burden by exploiting the readily available unlabeled data [4, 5, 6, 7]. However, unlike supervised approaches, which use experts' annotations (e.g., disease labels, lesion segmentation masks) as supervision, self-supervised models are trained with limited supervision derived from the data itself, making it far more difficult to identify disease-related features from the data. Furthermore, certain lesions (e.g., early-stage tumors) may occupy only a small region in high-resolution volumetric medical images, and their visual patterns may vary depending on where they are located in the body. Thus, the desired self-supervised learning algorithm should be sensitive enough to capture local anatomical deformities. In this research, we propose DrasCLR: a novel framework for self-supervised learning of disease-related and anatomy-specific representation of 3D medical imaging. DrasCLR learns a patch-based dense representation that conditionally depends on the anatomical location of the center voxel. We extensively evaluate our method on chest computed tomography (CT) imaging because of its prominent role in the prevention, diagnostics and treatment of lung diseases. Self-supervised learning methods aim to provide useful feature representations for downstream tasks without human supervision, which is typically achieved by optimizing the model to solve a proxy task. When designing a proxy task, the primary consideration is: what information in the data is important and what is not to the downstream tasks? Early self-supervised approaches use heuristic-based pretext tasks to learn representations invariant to transformations that do not change the semantic meaning of the target labels [8, 9, 10]. More recent contrastive learning approaches [11, 12] use instance discrimination task, which consider every instance as a class of its own and train deep neural networks to discriminate pairs of similar inputs (augmented views of the same instance) from a selection of dissimilar pairs (different instances). In this setting, data augmentation guided by prior knowledge often plays a vital role in preserving task-relevant information [13]. The sampling strategy for negative pairs is also crucial for the performance of contrastive learning methods. Recent studies [14, 15] show that hard negative sampling guided by domain knowledge helps in preventing trivial solutions and improving the alignment of extracted features with human semantics. Self-supervised representation learning of disease-related features in medical images is particularly challenging for two reasons. First, since disease-related features are often represented through subtle changes, an effective self-supervised learning method should be able to ignore large but irrelevant and non-informative information and focus on representing fine-grained features [16]. More specifically, this requires the encoder to be capable of representing small deviations from the appearance of normal anatomy. Second, because pathological tissues may only scatter in a few small regions, adequately representing local content is crucial for dense (voxel-level) prediction tasks such as anomaly detection and segmentation. Several self-supervised learning methods [17, 18, 19] have been developed to learn local representations of 3D medical images. These methods use sub-volumes sampled from random locations in the image as inputs and train a single encoder with parameters shared across all locations. However, disease types and their visual patterns are often associated with anatomical locations. For example, pulmonary emphysema can be divided into three major subtypes (i.e., centrilobular, paraseptal, and panlobular) based on their visual characteristics and anatomical locations within the lung [20]. A more sophisticated framework for learning local representations should incorporate anatomical locations as prior information to account for the spatial heterogeneity of anatomical and pathological patterns. In this research, we take inspiration from the aforementioned challenges and propose a novel contrastive learning framework for 3D medical imaging. In order to represent disease-related imaging features, we propose to combine two domain-specific contrasting strategies. The first strategy leverages the similarity across patients at the same anatomical location and aims to represent small disease patterns within a local (anchor) region. The second strategy takes advantage of anatomical similarities between the anchor and its nearby anatomical regions, with the goal of compensating for the first strategy by learning larger disease patterns that expand beyond the local region. We use small 3D patches to represent local anatomical regions. The effectiveness of both strategies depends on the difficulty of instance discrimination; as the anatomical similarity between the query and negative patches becomes greater, the encoder is forced to rely on subtle and disease-related features rather than normal anatomical features. To that end, we use image registration to obtain hard negative patches from different subjects that are anatomically best aligned to the query patch. In particular, we obtain point-by-point correspondence between image pairs by mapping them to the same anatomical atlas. The coordinates in the atlas image can then be viewed as a standard set of anatomical locations. To incorporate anatomical locations into learned representations, we further develop a novel 3D convolutional layer whose kernels are conditionally parameterized through a routing function that takes the coordinates in atlas space as inputs. We call our unified framework Disease-related anatomy-specific Contrastive Learning Representation (DrasCLR). The overview of our proposed approach is illustrated in Fig. 1. We conduct experiments on large-scale lung CT datasets. The results empirically show that our method outperforms baseline methods on both image-level and voxel-level tasks. Our code and pre-trained weights will be publicly available. In summary, the major contributions of this paper are: 2 Figure 1: Schematic diagram of DrasCLR. Left panel: We represent a volumetric image with a collection of 3D patches registered with distinctive anatomical landmarks defined in an atlas image. We develop an encoder that generates location-specific representation using the patch and location of associated anatomical landmark as inputs. Our contrastive learning framework comprises two objectives. Middle panel: The first one aims to learn local representation from a single patch. Right panel: The second one aims to learn representations of larger patterns across neighboring patches. Both contrasting strategies incentivize the encoder to learn disease-related features by using patches of similar anatomy as hard negative samples. 1. We propose a novel framework for contrastive learning of disease-related representation for 3D medical images. 2. We propose a novel 3D convolutional layer that encodes anatomical location-dependent information. 3. We extensively validate our model on large-scale lung CT datasets and show that our method outperforms existing baselines for a wide range of image-level tasks. 4. We demonstrate the application of our method for voxel-wise emphysema detection and show that using our pre-trained model can significantly cut annotation costs without compromising detection accuracy. The paper is organized as follows: we first briefly introduce the related works in Section 2. In Section 3, we present the details of our proposed methodology. Implementation details and experimental results are described in Sections 4 and 5. Finally, we discuss the key findings and limitations of our work in Section 6 followed by conclusions in Section 7. 2 Related Work We review related works in four areas: (1) self-supervised learning approaches, including pretext task-based methods and contrastive learning methods, (2) applications of self-supervised learning in medical image analysis, (3) self-supervised learning methods that exploit anatomical context in medical images, and (4) conditionally parameterized networks. 2.1 Self-supervised Learning Self-supervised learning has been shown to be an effective approach for learning semantically useful representations from large-scale unlabeled data without requiring human annotation [4, 5]. To generate supervisory signals from the data itself, a popular strategy is to present the model with various pretext tasks to solve. Commonly used pretext tasks include image inpainting [21], image colorization [9], relative position prediction [8], image jigsaw puzzle [22], patch cut and paste [23], temporal order verification [24], geometric transformation recognition [10], cross-modal correspondence [25, 26], and so on. These methods all have one thing in common: they build predictive-based pretext tasks using data's inherent structures, such as context similarity, spatial correlation, and temporal order. High-level semantic features are extracted in the process of accomplishing these tasks. 3 More recently, contrastive learning methods have emerged as one of the most popular self-supervised approaches due to their empirical success in computer vision [27, 28]. The objective of contrastive training is to push learned representations to be similar for positive (similar) pairs and dissimilar for negative (dissimilar) pairs. This task is called instance discrimination [29] and is often formulated using the InfoNCE loss [30, 31]. A variety of contrastive learning frameworks have been proposed, such as SimCLR [11], which uses the augmented view of the same input as positive samples and the augmented views of other samples in a minibatch as negative samples, and MoCo [12], which uses a slow moving average (momentum) encoder and a dictionary that stores old negative representations to enable constructing very large batches of negative pairs. We extend MoCo as our contrastive learning paradigm. Rather than using a global dictionary, we develop a conditional memory bank that maintains distinct dictionaries of negative representations for each anatomical location. The design of sampling strategies for positive and negative pairs is a key driver to the success of contrastive learning [32, 33]. Previous studies have demonstrated that encoders trained with harder negative pairs can represent more challenging features [14, 15, 34, 35, 36]. We create negative pairs from examples with highly similar local anatomy to force the model to solve instance discrimination using more subtle visual features (e.g. deviation from normal appealing tissues). 2.2 SSL Applications in Medical Imaging Self-supervised learning is particularly useful for medical imaging analysis, in which labels are expensive to collect. Several studies have shown the effectiveness of self-supervised approaches in a variety of medical imaging analysis tasks such as disease diagnosis [37, 38, 39], detection and localization [40, 41], image segmentation [18, 42, 43, 44], and image registration [45]. Contrastive learning frameworks have been employed to leverage large-scale, unlabeled medical imaging data to produce pre-trained models. For example, [46] adopted MoCo as a pre-training approach to obtain high-quality representations for detecting diseases in chest X-rays; [39] extended SimCLR to train robust representations for dermatology condition classification and thoracic disease classification by using the availability of multiple views of the same pathology from the same patients. Our contrastive learning framework is built upon MoCo and is specifically designed to learn voxel-level representations that are sensitive to local anatomical deformities. 2.3 Leveraging Anatomical Structure in SSL Medical images have consistent anatomy across patients, providing domain-specific cues for self-supervised repre- sentation learning. [47] introduced the Models Genesis, which learns image representation by recovering anatomical patterns from transformed sub-volumes extracted from CT images. [19] extended the Models Genesis framework by adding a self-classification objective to enable the encoder to learn common anatomical semantics at similar body locations across patients. [48] presented an anatomical position prediction task for learning segmentation features from cardiac magnetic resonance images. [18] enhanced SimCLR by integrating two domain-specific contrasting strategies: incentivizing similar representations for volumetric image slices coming from similar anatomical areas, and incentivizing distinctive local representations for different anatomical regions coming from the same image. Our approach differs from the reviewed methods in two aspects: (1) We use image registration to improve the alignment of anatomical structures across patients, and (2) We leverage local anatomical similarity to create hard negative samples to gain more information about tissue abnormalities. 2.4 Conditionally Parameterized Networks In comparison to conventional neural networks with fixed weights, conditionally parameterized networks have weights computed as a function of the inputs. One such network is hypernetwork [49], which is typically a small network that outputs weights for a primary network. It has been used in functional image representation [50] and hyperparameter optimization [51, 52, 53]. Another prominent conditional parameterization technique is CondConv [54], which creates convolutional kernels as a linear combination of experts with scalar weights dependent on input images. In our framework, the CondConv is modified to compute convolutional kernels as a function of the input anatomical locations. As a result, the learned representation at a given voxel depends on both its surrounding patch and its anatomical location. 3 Method We propose DrasCLR, a novel contrastive learning framework for 3D medical data. Our goal is to learn location-specific representations that are sensitive to tissue abnormalities. We start by aligning images to an anatomical atlas using image registration and treating the image of each patient as a collection of 3D patches centered at a common set of anatomical locations. Our contrasting strategies are motivated by two domain-specific similarity cues: one leverages the similarity between patients at the same anatomical location, and the second leverages the similarity between nearby anatomical 4 locations on the same image. In the following sections, we explain each component separately. The schematic diagram of the proposed method is shown in Fig. 1. The notations used in this paper are summarized in Table 1. Table 1: Important notations in this paper. Models e(*, *; θ1) Image encoder. g(*; θ2) MLP projection head. f (*, *; θ) Network composed of e and g, where θ = {θ1, θ2}. r(*) Routing function used in Loc-CondConv. Functions φ−1 i Transformation from the i-th image to the atlas space. Inverse transformation from atlas space to the i-th image. φi(*) (*) ̃t(*) Random augmentations. Variables Location of the j-th anatomical landmark in the atlas space. Location of the j-th anatomical landmark mapped in the i-th subject. Patch of the i-th subject centering at the j-th anatomical landmark. Representation of j-th patch in the i-th image used in downstream tasks. Representation of the i-th image used in downstream tasks. pj pj i xj i yj i yi qj i MoCo embedding of j-th patch in the i-th query image. k+ MoCo embedding of the positive sample. k− MoCo embedding of the negative sample. rl i MoCo embedding of l-th neighboring patch in the i-th image. N (j) Neighboring patches of the j-th patch. XAtlas The atlas image. 3.1 Anatomical Alignment via Image Registration We represent each volumetric image as a collection of 3D patches centered at a standard set of anatomical locations pre-defined on an anatomical atlas, with each patch corresponding to a distinct anatomical region of the lung. To align anatomical structures among patients, we first choose an image of a healthy subject to serve as the anatomical atlas, and then use image registration to obtain the subject-specific transformations that establish the point-by-point correspondence between the patients' images and the atlas image. Let XAtlas denote the atlas image, xi denote the image of patient i, the transformation φi is obtained by solving the optimization problem as follows: Sim(cid:0)φi(xi), XAtlas (cid:1) + Reg(φi), argmin φi (1) where Sim(*, *) is mutual information similarity function and Reg(φi) is a regularization term to ensure the transforma- tion is smooth. We perform the image registration using the Advanced Neuroimaging Tools (ANTs) [55]. After registration, we divide the lung region of the atlas image into J evenly spaced three-dimensional patches with some overlap and define the patches' centers as the anatomical landmarks, denoted by {pj}J j=1, where j is the patch index and each pj ∈ R3 is a coordinate in the Atlas space. We apply the inverse transformation φ−1 to locate the anatomical landmarks on each patient's image and extract the corresponding patches for training. Formally, each patient's image xi is partitioned into a set of patches {xj i ∈ Rd×d×d, i }J pj i = φ−1 (pj) and d is the dimension of patch. It is straightforward to show that patches with the same index across all patients correspond to the same anatomical region on the anatomical atlas: (pj)(cid:1) = pj. j=1, respectively, where xj j=1 centered at {pj (cid:0)φ−1 i }J i i (2) φi(pj i ) = φi i 3.2 Conditionally Parameterized Convolutional Layer Image patches from different anatomical locations have distinctive anatomical features and may be associated with different diseased tissue patterns. Standard convolutional layers that apply the same kernels throughout the entire 5 Figure 2: The architecture of the Loc-CondConv layer. The kernels W are conditionally parameterized for each anatomical location pj. The symbols αn denote the routing weights. x denotes the input from the previous layer. image may not be sufficient to accommodate spatial heterogeneity among patches at different locations. Inspired by CondConv [54], we propose Loc-CondConv, a location-dependent, conditionally parameterized convolutional layer. Instead of using static convolutional kernels, we compute convolutional kernels as a function of the anatomical location. In particular, we parameterize the kernels in Loc-CondConv as a linear combination of n convolutional kernels: W = α1W1 + * * * + αN WN , n=1 are the same-sized convolutional kernels as in the regular convolutional layer and {αn}N where {Wn}N n=1 are scalar weights computed via a routing function taking anatomical location as input. Specifically, we construct the routing function r(*) using a fully-connected layer followed by a Sigmoid activation function: (3) where pj is a coordinate in the Atlas space and Wr is a learnable weight matrix with dimension 3 × N , and σ represents the sigmoid function. Fig. 2 illustrates the architecture of Loc-CondConv. In the DrasCLR models, we replace all static convolutional layers with Loc-CondConv layers. r(pj) = σ(pj × Wr), (4) 3.3 Local Contrastive Loss i , xj In contrastive learning, the model is trained to discriminate pairs of positive inputs from a selection of negative pairs. Recent studies show that selecting harder negative pairs is critical for the success of contrastive learning [32, 34]. The anatomical similarity between patients in the same lung region provides domain-specific cues for selecting hard negatives. More specifically, after registration alignment, any pair of patches centered at the same anatomical landmark, e.g. xj v (i (cid:54)= v), have highly similar local anatomy, forcing the encoder to discriminate them using more subtle visual features, such as pathological tissues, rather than shortcuts, such as the overall anatomical background or boundaries. With this motivation, we propose a local contrasting strategy. Formally, given a patch xj i , we generate two augmented views ̃xj i ), where ̃t is random augmentations sampled from a set of transformations T . These two augmented patches are considered as a positive pair. Each negative sample ̃xj v) by randomly sampling a patch in the same anatomical region j from a different patient (v (cid:54)= i) and random augmentations ̃t ∼ T . We adopt the MoCo [12] as our contrastive learning paradigm. Specifically, we train two networks fθq , fθk to map the positive pair ( ̃xj v) to corresponding embeddings as follows: i ) and the negative pair ( ̃xj v is generated as ̃xj i = ̃t(xj v = ̃t(xj i , ̃xj i , pj; θq), k+ = f ( ̃xj i , pj; θk), k− = f ( ̃xj v, pj; θk), (5) i , ̃xj i = f ( ̃xj qj where θk = mθk + (1 − m)θq and m ∈ [0, 1) is a momentum coefficient. The network f (*, *; θq) is comprised of a feature extractor function e(*, *; θ1), which accepts both patches and their corresponding anatomical landmarks as inputs, and a multilayer perceptron (MLP) projection head g(*; θ2), which maps the patch representations to the space where contrastive loss is applied. The equation can be written as f (xj i , pj; θ1); θ2), where θq = {θ1, θ2}. i , pj; θq) = g(e(xj 6 Finally, the local contrastive loss per location is defined as: Lj l = − log exp(qj i * k+/τ ) + (cid:80)K− i * k+/τ ) exp(qj exp(qj i * k−/τ ) , (6) where K − denotes the number of negative pairs and τ denotes the temperature hyperparameter. 3.4 Neighboring Contrastive Loss The local contrastive loss incentivizes representations to be sensitive to tissue abnormalities within local anatomical regions. Pathological tissues, however, may expand beyond the borders of a single patch. We develop a complementary contrasting strategy - neighboring contrasting to allow the same encoder to learn disease patterns that may spread across multiple anatomical regions. For a given anatomical region j, we denote the indices of its (cid:96) nearest neighboring regions by N (j), its neighboring anatomical landmarks by {pl}(cid:96) i on the same image by {xl l∈N (j). The corresponding embeddings of the neighboring patches are given by: l∈N (j), and the neighboring patches of xj i}(cid:96) i = ̃t(xl where ̃xl sets, specifically, i) and ̃t ∼ T . Instead of constructing positive and negative pairs, we construct positive and negative i = f ( ̃xl rl i, pl; θq), l ∈ N (j), (7) positive set : negative set : (cid:110) { ̃xl (cid:110) i}(cid:96) l∈N (j), ̃xj i (cid:111) , (cid:111) { ̃xl i}(cid:96) l∈N (j), ̃xj v , v (cid:54)= i. The neighboring contrastive loss per location is define as: Lj n = − log (cid:80)N (j) l (cid:80)N (j) l exp(rl exp(rl i * k+/τ ) + (cid:80)N (j) l i * k+/τ ) (cid:80)K− k− exp(rl i * k−/τ ) , (8) where k+ and k− are the same as defined in Eqn. 5. Minimizing this loss forces the encoder to extract similar visual features of the disease spreading across the patch xj l∈N (j). Additionally, by selecting random patches in the same anatomical region as the hard negatives, the encoder is prevented from using mismatched anatomy as a shortcut to perform this instance discrimination task. i and its neighboring patches {xl i}(cid:96) 3.5 Overall Model We train our model end-to-end by minimizing the combined local contrastive loss and neighboring contrastive loss and looping through each anatomical landmark. The overall loss function per location is defined as: Lj = Lj l + Lj n. During inference time, the voxel-level representation can be obtained by: i = e(xj yj i , pj; θ1), (9) (10) where e(*, *; θ1) is the trained encoder with Loc-CondConv layers. The image-level representation yi is obtained by averaging the representations of patches across all the anatomical landmarks. Formally, the representation at the image level is given by: yi = 1 J J (cid:88) j=1 e(xj i , pj; θ1). (11) Note that, at the time of inference, pj can be any point inside the atlas space and is not restricted to the predefined anatomical landmarks. In our experiments, we obtain image-level representations using only predetermined anatomical markers for computational efficiency. 7 4 Implementation Details We begin by extracting the lung regions from each CT scan using the lung segmentation method proposed by [56]. We then choose the image of one healthy subject as the anatomical atlas and partition it into a grid of 3D patches with some overlap. This results in 581 patches, each with a size of 32 × 32 × 32, that fully cover the lung in the atlas image. Anatomical landmarks are defined as the centers of these 581 patches on the atlas coordinate system. We use the image registration toolkit ANTs [55] to obtain the forward and inverse affine transformations between each subject's (moving) image and the atlas (fixed) image. We construct the encoder e(*, *; θ1) using Loc-CondConv layers as the building blocks. Each Loc-CondConv layer contains N 3D-convolutional kernels with size 3 × 3 × 3 and is zero-padded on each side of the inputs by one pixel. We adopt batch normalization (BN) [57] and ELU [58] activation following each Loc-CondConv. For the projection head g(*; θ2), we adopt a 2-layer MLP with ReLU activation. We set the number of nearest neighbors used in the neighboring contrastive loss as 2 based on an ablation study (Sec. 5.4.3). We create data augmentations using MONAI [59] package. The data augmentation includes random affine transforms (applied in the order of rotation, translation, and scale), Gaussian noise, and random image contrast adjustments. We optimize the networks using SGD with momentum = 0.9 and weight decay = 10−4. The learning rate is set to be 10−2 and is updated using a cosine schedule. We choose the batch size of 128. Following the practice in MoCo-v2 [60], we set temperature τ to 0.2 and momentum coefficient to 0.999. Unlike regular MoCo, which uses a single dictionary for negative samples, we develop a conditional memory bank that maintains separate dictionaries for anatomical landmarks, each of which has a size of 4096. For training, we select negative samples from the corresponding dictionary, which stores patch embeddings from the same anatomical location as the query patch. We perform self-supervised pretraining on the full dataset using four NVIDIA Tesla V100 GPUs, each with 32GB memory, for 48 hours or 20 epochs, whichever comes first. 5 Experiments In this section, we take our DrasCLR pre-trained models and evaluate their performance in medical imaging tasks at both image and voxel levels. At the image level, we evaluate the effectiveness of the learned representation in disease phenotype prediction, disease severity classification, and survival analysis. At the voxel level, we first describe how our model can be used to produce voxel-wise segmentation masks. Using this approach, we then present the quantitative and qualitative results of subtype emphysema detection. Finally, we perform ablation studies to validate the importance of the proposed components in DrasCLR. 5.1 Datasets We conduct the experiments on two large-scale datasets of 3D medical images, including the COPDGene dataset [61] and the MosMed dataset [62]. We apply the same data preprocessing procedure for images in both datasets. We begin by re-sampling all images into 1mm3 isotropic resolution. We then threshold the Hounsfield Units (HU) to the intensity window of [−1024, 240] and normalize the intensity range to [−1, 1] by linear scaling. 5.1.1 COPDGene Dataset Chronic Obstructive Pulmonary Disease (COPD) is a chronic inflammatory lung disease that causes obstruction of lung airflow and is one of the leading causes of death worldwide. The COPDGene Study [61] is a multi-center observational study that collects imaging data, genetic biomarkers, and relevant phenotypes from a large cohort of subjects. In our study, we use a large set of 3D thorax CT images from 9,180 subjects for self-supervised pre-training. We use the spirometry measures, disease-related phenotypes, and survival status of the same cohort as the image-level labels in our experiments. On a subset of these CT scans, an experienced pulmonologist annotated the bounding boxes of subtypes of emphysema by clicking on locations surrounded by the pathological tissues [63, 64]. This procedure created 696 centrilobular emphysema bounding boxes from 153 subjects, and 243 paraseptal emphysema bounding boxes from 69 subjects. All these bounding boxes are of the same size (32mm3). We use this annotated subset to examine the performance of the DrasCLR pre-trained model for subtype emphysema detection. 5.1.2 MosMed Dataset The MosMed dataset contains 3D thorax CT images of 1,110 subjects from the municipal hospitals in Moscow, Russia [62]. Subjects in this dataset are classified into five grades ("Zero", "Mild", "Moderate", "Severe", and "Critical") based on COVID-19 related CT findings and physiological measures, such as body temperature, respiration rate, blood oxygen saturation level (SpO2) and so on. Triage decisions are made based on the severity levels of the 8 patients. For example, patients in the "Moderate" category only need to be followed up at home by a primary care physician, whereas patients in the "Critical" category are immediately transferred to the intensive care unit. We use the CT images in MosMed for model pre-training and use COVID-19 severity grades as classification labels in downstream analysis. 5.2 Image Level Evaluation To assess how much disease-related information is preserved by the proposed method, we use the learned image- level representation to predict a wide range of clinical variables measured at the subject level, such as spirometry measurements, disease phenotypes, disease staging, and patients' survival rates. 5.2.1 COPD Phenotype Prediction We begin by performing self-supervised pre-training with DrasCLR on the COPDGene dataset. Then, we use the learned image-level representations in downstream prediction tasks in a linear readout fashion. In particular, we train linear regression models to predict two pulmonary function measures on the log scale, which are percent predicted values of Forced Expiratory Volume in one second (FEV1pp) and its ratio with Forced vital capacity (FEV1/FVC). We use R2 scores as an evaluation metric for the regression analysis. In addition, we train multi-class logistic regression models to predict four categorical outcomes: (1) Global Initiative for Chronic Obstructive Lung Disease (GOLD) spirometric stage, a four-grade categorical variable indicating the severity of airflow limitation, (2) Centrilobular emphysema visual score (CLE), a six-grade categorical variable indicating the extent of emphysema in centrilobular, (3) Paraseptal emphysema visual score (Paraseptal), a three-grade categorical variable indicating the severity of paraseptal emphysema, and (4) Acute Exacerbation history (AE history), a binary variable indicating whether the patient has encountered at least one exacerbation event before enrolling in the study. For all classification tasks, we use accuracy as the evaluation metric. To account for human variability in annotation, for GOLD, CLE, and Paraseptal scores, we also report the proportion of times the predicted class fell within one class of the true score (denoted as 1-off ). We compare the performance of DrasCLR against both unsupervised and supervised approaches. The unsupervised baselines include: Models Genesis [47], MedicalNet [65], MoCo (3D version on the entire volume) [12], Context SSL [66], Divergence-based feature extractor [67], K-means algorithm applied to image features extracted from local lung regions [67], and Low Attenuation Area (LAA), a commonly used clinical descriptor. The supervised baselines include convolutional neural networks (CNN) that were separately trained to predict FEV1pp, GOLD and CLE scores using 2D slices as inputs (2D CNN) [68], and Subject2Vec [69], where a patch-based CNN model was first trained with FEV1 and FEV1/FVC as joint supervised information, and the learned image representations were then used in other prediction tasks. We perform five-fold cross-validation for all experiments and report the average results along with standard deviations. Table 2 shows that the DrasCLR pre-trained model outperforms unsupervised baseline models in all metrics, with the exception of 1-off accuracy for Paraseptal emphysema, where the difference is within one standard deviation. Our DrasCLR pre-trained model also outperforms the supervised baseline models, including Subject2Vec and 2D CNN, in terms of CLE, Paraseptal, and AE History predictions. For spirometry and COPD Staging, on which Subject2Vec were trained, the performance gap of our model is smaller compared to other unsupervised baseline models. Overall, these results suggest that image-level features extracted by the DrasCLR pre-trained model preserve richer information about COPD severity than other unsupervised baselines. When compared to supervised methods, our proposed method learns more generalizable features as it achieves higher predictive performance for a broader range of clinical variables, such as emphysema visual scores and AE history. 5.2.2 Survival Analysis of COPD Patients We evaluate the effectiveness of DrasCLR in survival analysis for the COPDGene population. We employ the Cox proportional hazards (CPH) model [70] to predict patients' survival using the learned image-level representations while controlling for five potential confounders, including age, gender, race, smoking status, and packyear (calculated by multiplying the number of packs of cigarettes smoked per day by the number of years the person has smoked). We compare the performance of features extracted by our method against: (1) hand-designed imaging features, (2) imaging features retrieved by other machine learning methods, and (3) relevant clinical features, such as spirometry measures and the BODE index [71]. The hand-designed imaging features include CT metrics of emphysema, gas trapping, average wall thickness of hypothetical airway, and wall area percentage of segmental airways [72]. All comparison baselines use the same CPH model and are controlled by including the same five confounding variables. We report the results in terms of time-dependent concordance index (C td), which estimates the model's risk ranking ability, at each of the censoring period quantiles. Table 3 shows that the survival model with our imaging features 9 Table 2: Results of phenotype prediction on the COPDGene dataset. We use R-Square for continuous measurements and accuracy for discrete scores. Results including the mean and standard deviation (mean±s.d.) are derived from 5-fold cross validation. Our DrasCLR model has the best or competitive performance on all phenotype prediction tasks when compared to seven unsupervised methods, and it generalizes better than the supervised method for predicting visual scores and AE history. Method Metric LAA-950 K-Means Divergence-based MedicalNet ModelsGenesis MoCo Context SSL 2D CNN Subject2Vec Ours Supervised Spirometry COPD Staging Visual scores Acuity logFEV1pp logFEV1/FVC GOLD GOLD 1-off CLE CLE 1-off Paraseptal Paraseptal 1-off AE History (cid:55) (cid:55) (cid:55) (cid:55) (cid:55) (cid:55) (cid:55) (cid:51) (cid:51) (cid:55) R-Square 0.44±.02 0.55±.03 0.58±.03 0.47±.10 0.58±.01 0.40±.02 0.62±.01 0.53 0.67±.03 0.63±.01 0.60±.01 0.68±.02 0.70±.02 0.59±.06 0.64±.01 0.49±.02 0.70±.01 - 0.74±.01 0.71±.01 55.8 57.3 58.9 57.0±1.3 59.5±2.3 52.7±1.1 63.2±1.1 51.1 65.4 65.0±.6 75.7 82.3 84.2 75.4±.9 82.9±1.3 67.6±1.4 83.6±.9 - 89.1 % Accuracy 32.9 - - 40.3±1.9 41.8±1.4 36.5±.7 50.4±1.3 - 40.6 77.7 - - 69.6±1.6 77.0±1.5 61.9±.9 81.5±1.1 60.4 74.7 33.3 - - 53.1±0.7 52.7±.5 52.5±1.4 56.2±1.1 - 52.8 87.6 - - 81.8±0.8 85.3±1.1 79.7±1.2 84.9±1.2 - 83.0 73.8 - - 78.7±1.3 77.8±.8 78.6±.9 78.8±1.3 76.9 85.6±.6 53.9±.8 86.3±.7 58.4±.8 87.0±.8 78.9±1.3 - indicates not reported. Some baseline methods only report mean value without standard deviation in original manuscript. The bold font is used to highlight the highest value for each column among all methods. The underline is used to highlight the highest value for each column among unsupervised methods. achieved concordance scores of 0.76, 0.75, and 0.74 at the 25th, 50th, and 75th quantiles, respectively, outperforming baselines with imaging-only features retrieved by Models Gensis [47], Subject2Vec [69] and the hand-designed model. In comparison to clinical features, our method outperformed spirometry measures (0.76 vs 0.74) for risk stratification of near-term events before the 25th quantile, slightly underperformed the BODE index (0.74 vs 0.75) at the 75th quantile of censoring time, and achieved comparable accuracy otherwise. We also developed survival models with combined imaging and clinical features. The bottom rows of Table 3 show that the model using both our imaging features and BODE index achieved the highest concordance scores of 0.78, 0.77, and 0.77 at the 25th, 50th, and 75th quantiles, respectively, demonstrating that the imaging representation learned by DrasCLR provides incremental predictive value for survival analysis of COPD patients. Table 3: Time-dependent concordance index on the COPDGene dataset. Results are averages over five runs with bootstrapped standard errors. Our DrasCLR model performs the best when compared to other imaging representation approaches, and it provides incremental predictive value to clinical features. Feature Method Imaging Clinical Hand-designed Models Genesis Subject2Vec Ours Spirometry BODE Imaging + Clinical Hand-designed + BODE Ours + Spirometry Ours + BODE Concordance Index t = 50th t = 75th t = 25th 0.74±0.02 0.72±0.02 0.72±0.02 0.76±0.02 0.74±0.02 0.76±0.01 0.76±0.02 0.77±0.02 0.78±0.01 0.73±0.01 0.7±0.01 0.72±0.01 0.75±0.01 0.75±0.01 0.75±0.01 0.76±0.01 0.76±0.00 0.77±0.01 0.74±0.01 0.72±0.01 0.72±0.03 0.74±0.01 0.74±0.01 0.75±0.00 0.76±0.01 0.76±0.01 0.77±0.00 5.2.3 COVID-19 Severity Prediction We first pre-train a model with DrasCLR on the CT scans in the MosMed dataset. Then, we freeze the encoder and train a linear classifier to predict the severity of COVID-19, a categorical variable with five grades. The DrasCLR pre-trained model is compared to unsupervised baseline models, including MedicalNet [65], Models Genesis [47], MoCo [12], Context SSL [66], and one supervised CNN model that uses entire 3D images as inputs (3D CNN). To evaluate classification performance, we perform five-fold cross-validation and report the average test accuracy along with standard deviations. 10 Table 4: Classification of 5-grade COVID-19 severity on the MosMed dataset. The results are the means and standard deviations of accuracy for 5-fold cross validation. Our DrasCLR model leads the best performance over both unsupervised and supervised approaches. Method 3D CNN MedicalNet Models Genesis MoCo Context SSL Ours w/o Neighbor Contrast Ours Supervised % Accuracy (cid:51) (cid:55) (cid:55) (cid:55) (cid:55) (cid:55) (cid:55) 61.2±3.5 62.1±3.3 62.0±3.5 62.1±3.3 65.3±3.2 62.6±2.4 65.4±2.5 Table 4 shows that the DrasCLR pre-trained model outperforms the unsupervised baseline models with the exception of ContextSSL, whose average test accuracy is close to ours (65.3 vs. 65.4). Both ContextSSL and our methods leverage the context between neighboring anatomical regions for representation learning. ContextSSL incorporates this information via a graph neural network, whereas our method uses a neighboring contrasting strategy. The ablation study results in Table 4's bottom rows show that leveraging anatomical context from large regions is useful for categorizing COVID-19 severity. With the neighboring contrastive loss, the COVID-19 severity prediction accuracy increases by 2.8%. Interestingly, we found that the supervised 3D CNN model performs the worst, suggesting that directly extracting features from the entire volume may have resulted in the loss of fine-grained information at local anatomy. It is also possible that the supervised model may not converge properly or becomes overfitted due to the small amount of training data. 5.3 Voxel Level Evaluation To show that the DrasCLR pre-trained model encodes fine-grained information at local anatomy, we demonstrate its ability to detect two subtypes of emphysema (i.e., centrilobular and paraseptal emphysema), which are prevalent in different pulmonary regions. We perform the experiments in three aspects. First, we conduct a quantitative evaluation for emphysema detection via voxel-wise classification. Second, we show the qualitative results of predicted emphysema masks for COPD patients at different stages. Third, we perform emphysema detection on a group of randomly selected subjects and show the relationship between the detected emphysema volume and the patient's COPD stage. In addition, we demonstrate that our method can reduce annotation efforts through transfer learning. 5.3.1 Emphysema Detection via Dense Classification We propose to use dense or voxel-level classification for emphysema detection. In particular, we first pre-train a model with DrasCLR on all CT scans from the COPDGene dataset. We then fine-tune the model in a binary classification task to discriminate between emphysema-annotated patches and healthy patches. The healthy patches are sampled from random subjects with the criteria that the subjects' GOLD scores are equal to zero, and no centrilobular or paraseptal emphysema is found based on their image-level visual scores. We have evaluated two fine-tuning schemes: (1) employing the pre-trained encoder as a fixed feature extractor and training a new linear classifier (named as linear readout), and (2) appending a linear classifier to the pre-trained encoder and fine-tuning all layers in the network (named as full fine-tuning). During inference time, the fine-tuned model is used to perform voxel-wise classification of emphysema. For a given patch, the detection is positive if 25% voxels within it have a predicted probability of emphysema greater than 0.5; otherwise, the detection is negative. Table 5 presents the quantitative performance of our method and selected baselines for emphysema detection. Under the linear readout scheme, we compare the performance of our model to logistic regression models using patch-level LAA features and learned features from Models Genesis [47]. Under the full fine-tuning scheme, we compare our model's performance to a patch-based CNN that is trained on the same set of patches from scratch. The results in Table 5 show that, compared to unsupervised baselines, our method achieves superior F1 scores for both centrilobular and paraseptal emphysema detection under linear readout. Through full fine-tuning, our method achieves the best emphysema detection performance across all evaluation metrics. To qualitatively demonstrate the outcomes of our method, we create voxel-wise emphysema segmentation for subjects at different stages of COPD. In particular, we first use the full fine-tuning model to estimate the probability of 11 Table 5: Evaluation for subtype emphysema detection. Results are the means and standard deviations (mean±s.d.) of F1, precision and recall scores for 5-fold cross validation. With linear readout, our DrasCLR outperforms unsupervised baselines. With full fine-funing, our DrasCLR outperforms the supervised baseline. Patch LAA Models Genesis Ours w/ Linear Readout Supervised (cid:55) (cid:55) (cid:55) Centrilobular Paraseptal F1 Precision Recall F1 Precision Recall 0.77±.03 0.71±.01 0.82±.03 0.94±.02 0.58±.02 0.75±.04 0.65±.04 0.93±.03 0.91±.02 0.70±.06 0.67±.03 0.82±.03 0.83±.06 0.64±.16 0.73±.05 Patch-based CNN Ours w/ Full Fine-tuning The bold font is used to highlight the highest value for each column among all methods. The underline is used to highlight the highest value for each column among unsupervised methods. 0.82±.04 0.99±.01 0.89±.05 0.99±.01 0.92±.01 0.97±.01 0.91±.03 0.98±.01 0.77±.05 0.99±.02 (cid:51) (cid:51) 0.61±.09 0.82±.23 0.95±.01 0.88±.02 1.00±.00 emphysema in a sliding-window fashion with a step size of 1 voxel. We then use a 0.5 threshold to map voxels with emphysema probability greater than or equal to the threshold to 1 and all other voxels to 0. Fig. 3 shows the predicted segmentation masks of two subtypes of emphysema of varying COPD stage in coronal and 3D views. We find that as the COPD severity increase (higher GOLD score), the volume of detected emphysema region increases in both subtypes. Furthermore, segmentation masks of GOLD scores 1 and 2 show a clear heterogeneity in the regional distribution of emphysema in the lung between these two subtypes. The regions of predicted segmentation are consistent with the clinical definition of emphysema subtypes, where centrilobular emphysema is commonly described as an abnormal enlargement of airspaces centered on the respiratory bronchiole [73] and paraseptal emphysema refers to emphysematous change adjacent to a pleural surface [74]. Finally, we analyze the correlation between the total emphysema detected in 3D images and the subjects' COPD stages. In particular, we randomly select 500 subjects from the COPDGene dataset and use the fully fine-tuned model to make voxel-wise emphysema classification on their CT scans. Then, we aggregate all voxels in a CT scan to determine the fraction of voxels with a predicted probability of emphysema greater than 0.5. The box plots in Fig. 4 represent the distributions of detected emphysema proportion against GOLD scores, as well as the group with preserved ratio impaired spirometry (PRISm). Subplots of both centrilobular and paraseptal emphysema show positive correlations between the detected emphysema and patient's COPD severity. 5.3.2 Improve Annotation Efficiency via Transfer Learning Transfer learning makes use of the knowledge of underlying data structure learned by the pre-trained models and has been demonstrated to be beneficial in medical imaging analysis, where the amount of annotated data is often limited. We simulate the scenarios of using a subset of annotated data to investigate the power of our method in transfer learning. Specifically, we fine-tune the DrasCLR pre-trained model by starting with 10% annotated emphysema patches and gradually increasing the amount of annotations by 10% in subsequent experiments. Fig. 5 shows the results of transfer learning on two target tasks. The performance of centrilobular detection learning from scratch with the entire dataset can be surpassed using DrasCLR with only 50% of the dataset, hence doubling the annotation efficiency. The performance of paraseptal detection learning from scratch with the entire dataset can be surpassed using DrasCLR with only 20% of the dataset, thus improving the annotation efficiency by five times. These results demonstrate how DrasCLR can significantly reduce the cost of manual image annotation, ultimately leading to more label-efficient deep learning. 5.4 Ablation Study In this section, we conduct ablation experiments to validate the effects of several DrasCLR components. 5.4.1 Design Choices for Incorporating Anatomical Location We demonstrate the effects of various designs for incorporating anatomical location information into DrasCLR. Specifically, we compare the following four approaches: (1) No conditioning, which uses a standard CNN to extract features from image patches without taking their anatomical locations into account; (2) Concatenation [66], which concatenates the features from the last layer of the standard CNN with patch location and then fuses them through fully connected layers; (3) HyperNetwork [49], which uses a separate neural network that takes an anatomical location as input to generate weights in the standard CNN; (4) A CNN consists of our proposed Loc-CondConv layers. All models 12 Figure 3: Examples of predicted dense emphysema binary masks for subjects with different GOLD scores. The top three rows show the predicted regions of centrilobular emphysema, and the bottom three rows show the predicted regions of paraseptal emphysema. The intensity range is set as [-1060, -825] to better illustrate the emphysema. The predicted emphysema regions are plotted in red, and the lung regions are plotted in blue. As the severity of COPD increases (higher GOLD score), the detected region increases in both subtypes of emphysema. In addition, the predicted emphysema regions correspond to the clinical description of their subtypes. 13 GOLD 0GOLD 1GOLD 3GOLD 4PRISmPRISmGOLD 0GOLD 3GOLD 4amesyhpmE ralubolirtneClatpesaraPamesyhpmEGOLD 1GOLD 2GOLD 2 Figure 4: Comparison of predicted volume proportion of centrilobular (left) and paraseptal (right) emphysema for subjects with different GOLD scores. A higher GOLD score indicates a more severe stage of COPD. The results show that with an increasing GOLD score, the predicted emphysema volume proportion in CT scan becomes higher. Figure 5: Results of fine-tuning with different amounts of data. We perform evaluations for centrilobular (left) and paraseptal (right) emphysema detection. Compared to the model fine-tuned with full data from scratch (random initialization), the DrasCLR pre-trained model only needs 50% and 20% annotated data to achieve the same performance for centrilobular and paraseptal emphysema detection, respectively. in this ablation experiment are trained using only local contrastive loss. As shown in Table. 6, the simple concatenation approach outperforms the standard CNN in three image-level tasks, suggesting that including anatomical location enriches the learned representations and enhances the performance of the downstream analysis. Furthermore, Table. 6 shows that the CNN with Loc-CondConv layers achieves the best performances in all target tasks, demonstrating it is a superior design for incorporating anatomical location information. 5.4.2 Impact of Anatomical Location for Disease Detection We have thus far validated the importance of anatomical location as well as the effectiveness of Loc-CondConv layer for image-level prediction tasks. To investigate whether anatomical location is an important factor in representing fine-grained local features, we explore the impact of perturbing the input locations of DrasCLR on the performance of emphysema detection. In particular, instead of extracting features from a given patch using its correct anatomical location as input, we extract features from the patch using a random location in the lung. We employ a linear readout fine-tuning scheme on the same set of patches as described in Section 5.3.1. As shown in Table 7, by using random anatomical locations as inputs, the detection accuracy drops by 6% and 16% for centrilobular and paraseptal emphysema, respectively, showing statistically significant decreases (p-value< 0.005, one-sided two sample t-test). The results indicate that the DrasCLR pre-trained encoder is sensitive to anatomical locations and captures anatomy-specific features. 14 10%(110)20%(221)30%(331)40%(442)50%(553)Percentage of finetuning data (Number of finetuning samples)0.750.800.850.900.95F1 scoreCentrilobular emphysemaDrasCLRTrain from scratch w/ full dataDrasCLR w/ full data10%(38)20%(76)30%(115)40%(153)50%(192)Percentage of finetuning data (Number of finetuning samples)0.650.700.750.800.850.900.951.00F1 scoreParaseptal emphysemaDrasCLRTrain from scratch w/ full dataDrasCLR w/ full data Table 6: Ablation study for how to incorporate anatomical location. We report R-Square for logFEV1pp, accuracy scores for the GOLD and CLE scores. The mean and standard deviation values are calculated via 5-fold cross-validation. Method logFEV1pp GOLD CLE No conditioning Concatenation HyperNetwork Loc-CondConv (Ours) 0.57±.04 0.60±.01 0.60±.01 0.62±.02 61.8±1.1 62.5±1.0 58.6±1.7 63.4±1.0 48.0±.9 49.2±1.1 44.1±1.3 50.3±.9 Table 7: Sensitivity of the pre-trained DrasCLR model to anatomical location perturbation. The results are the means and standard deviations of emphysema detection accuracy for 5-fold cross validation. Subtype Random location Patch location Centrilobular emphysema Paraseptal emphysema 73.3±2.6 56.4±4.1 79.2±1.4 72.1±4.3 5.4.3 Neighboring Contrastive Loss In this experiment, we investigate the effect of neighboring contrastive loss as well as the impact of the number of neighbors used. We pre-train DrasCLR models with no neighboring contrast as well as with different numbers of neighbors. Using a linear readout scheme, we benchmark the performance of the pre-trained models in downstream image-level tasks. As shown in Table 8, the incorporation of spatial context from neighboring patches enhances the performance of image-level tasks in most situations. The improvement is particularly notable in the prediction of the centrilobular visual score, which ranges from 5% to 8% depending on the number of neighbors. This is likely due to the fact that CLE grades are determined by the extent to which the lung's center is damaged by the disease, and the neighboring contrasting strategy encourages the learning of common disease patterns that span multiple anatomical regions. 6 Discussions 6.1 Does DrasCLR learn disease-related features? In this paper, we propose a novel self-supervised method, DrasCLR to learn disease-related representation of 3D medical images. Medical images have recurring and similar anatomy across patients. While previous self-supervised methods [47, 19] used this knowledge to learn common anatomical representation, our method uses this knowledge to create hard negative samples in contrastive learning. As a result, our method is more sensitive to tissue abnormalities and can encode more disease-related information. As seen in Table 2, our method demonstrates excellent performance in predicting a wide range of clinical variables, such as spirometry measures and COPD phenotypes, which are closely associated with the degree of lung impairments in COPD patients. Emphysema is a hallmark of COPD. However, visually assessing emphysema at CT is time-consuming and subject to human variability. Our method demonstrates superior performance for this task and may provide a data-driven way of quantifying the visual score of emphysema from CT imaging. Moreover, as evidenced by Table 3, imaging features learned by our method add incremental value to the BODE index for survival analysis in COPD patients, suggesting that our method is capable of capturing complementary risk factors from CT imaging. In addition to the evaluation on the COPD cohort, we demonstrate, as shown in Table 4, that DrasCLR can learn robust features associated with COVID-19 severity. The ability to represent disease-related information from medical images in an unsupervised manner is particularly useful during pandemic outbreaks, when labeled data is rarely available. 6.2 Does DrasCLR extract location-specific features? A conventional convolutional layer is designed to be transitionally invariant. However, pathological patterns tend to be heterogeneous across locations in the human body, and an one-size-fits-all design may not be sufficient to learn the variety of tissue abnormalities at different anatomical locations. In this paper, we incorporate anatomical context into 15 Table 8: Ablation study for neighboring contrastive loss. We report R-Square for logFEV1pp, accuracy scores for GOLD and CLE scores. The mean and standard deviation values are calculated via 5-fold cross-validation. Method logFEV1pp logFEV1pp/FVC CLE No Neighboring Contrast # Neighbors = 1 # Neighbors = 2 (Ours) # Neighbors = 3 0.62±.02 0.61±.01 0.63±.01 0.63±.01 0.69±.02 0.70±.01 0.71±.01 0.71±.01 50.3±0.9 53.0±1.3 53.9±0.8 52.5±0.5 representation learning via two components in DrasCLR. First, image registration is used to provide a unified anatomical coordinate system, and all images are aligned to the atlas. Second, a novel Loc-CondConv layer is introduced to have modifiable weights that are conditionally dependent on anatomical location. We have explored different ways to incorporate anatomical location into representation learning. As seen in Table 6, the Loc-CondConv layer is superior to simple concatenation and hypernetwork. To further validate the effect of our design, we investigate the impact of perturbing the input locations of DrasCLR on emphysema detection. As shown in Table. 7, the emphysema detection accuracy decreases when random location is used, demonstrating that lack of correct anatomical context is detrimental. 6.3 Why do we choose sliding-window based approach for emphysema segmentation? The most well-known architecture for medical image segmentation is U-Net [75], which is composed of opposing convolution and deconvolution layers, and spatial information is provided through skip connections to each decoder layer to recover fine-grained details. However, training U-Net requires the data to have complete pixel/voxel-level annotation, which is difficult to obtain. The emphysema annotation in the COPDGene dataset was collected as bounding boxes by a physician clicking on regions surrounding by pathological tissues, thus the annotation is not complete at the voxel level. Our method can leverage these partially annotated images and produce voxel-wise emphysema classification in a sliding-window fashion. Moreover, the DrasCLR pre-trained model is capable of utilizing spatial information by modifying kernels' weights based on the input anatomical location. As illustrated by Fig. 3, our method can produce high-quality emphysema segmentation in which the regional distribution of detected emphysema matches with the clinical description of emphysema subtypes. The box plots in Fig. 4 show quantitative evidence that the detected emphysema volume correlates with the subjects' COPD stages. 7 Conclusion In this paper, we present a novel method for anatomy-specific self-supervised representation learning on 3D medical images. We propose two domain-specific contrasting strategies to learn disease-related representations, including a local contrasting loss to capture small disease patterns and a neighboring contrasting loss to learn anomalies spanning across larger anatomical regions. In addition, we introduce a novel conditional encoder for location-specific feature extraction. The experiments on multiple datasets demonstrate that our proposed method is effective, generalizable, and can be used to improve annotation efficiency for supervised learning. Acknowledgments This work was partially supported by NIH Award Number 1R01HL141813-01 and NSF 1839332 Tripod+X. We are grateful for the computational resources provided by Pittsburgh SuperComputing grant number TG-ASC170024. References [1] Athanasios Voulodimos, Nikolaos Doulamis, Anastasios Doulamis, and Eftychios Protopapadakis. Deep learning for computer vision: A brief review. Computational intelligence and neuroscience, 2018, 2018. [2] Li Liu, Wanli Ouyang, Xiaogang Wang, Paul Fieguth, Jie Chen, Xinwang Liu, and Matti Pietikäinen. Deep learning for generic object detection: A survey. International journal of computer vision, 128(2):261–318, 2020. 16 [3] Samira Pouyanfar, Saad Sadiq, Yilin Yan, Haiman Tian, Yudong Tao, Maria Presa Reyes, Mei-Ling Shyu, Shu- Ching Chen, and Sundaraja S Iyengar. A survey on deep learning: Algorithms, techniques, and applications. ACM Computing Surveys (CSUR), 51(5):1–36, 2018. [4] Longlong Jing and Yingli Tian. Self-supervised visual feature learning with deep neural networks: A survey. IEEE transactions on pattern analysis and machine intelligence, 43(11):4037–4058, 2020. [5] Kriti Ohri and Mukesh Kumar. Review on self-supervised image recognition using deep neural networks. Knowledge-Based Systems, 224:107090, 2021. [6] Chenyu You, Weicheng Dai, Lawrence Staib, and James S Duncan. Bootstrapping semi-supervised medical image segmentation with anatomical-aware contrastive distillation. arXiv preprint arXiv:2206.02307, 2022. [7] Chenyu You, Weicheng Dai, Fenglin Liu, Haoran Su, Xiaoran Zhang, Lawrence Staib, and James S Duncan. Mine your own anatomy: Revisiting medical image segmentation with extremely limited labels. arXiv preprint arXiv:2209.13476, 2022. [8] Carl Doersch, Abhinav Gupta, and Alexei A Efros. Unsupervised visual representation learning by context prediction. In Proceedings of the IEEE international conference on computer vision, pages 1422–1430, 2015. [9] Richard Zhang, Phillip Isola, and Alexei A Efros. Colorful image colorization. In European conference on computer vision, pages 649–666. Springer, 2016. [10] Spyros Gidaris, Praveer Singh, and Nikos Komodakis. Unsupervised representation learning by predicting image rotations. arXiv preprint arXiv:1803.07728, 2018. [11] Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In International conference on machine learning, pages 1597–1607. PMLR, 2020. [12] Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9729–9738, 2020. [13] Yonglong Tian, Chen Sun, Ben Poole, Dilip Krishnan, Cordelia Schmid, and Phillip Isola. What makes for good views for contrastive learning? Advances in Neural Information Processing Systems, 33:6827–6839, 2020. [14] SouYoung Jin, Aruni RoyChowdhury, Huaizu Jiang, Ashish Singh, Aditya Prasad, Deep Chakraborty, and Erik Learned-Miller. Unsupervised hard example mining from videos for improved object detection. In Proceedings of the European Conference on Computer Vision (ECCV), pages 307–324, 2018. [15] Sangryul Jeon, Dongbo Min, Seungryong Kim, and Kwanghoon Sohn. Mining better samples for contrastive learning of temporal correspondence. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1034–1044, 2021. [16] Olle G Holmberg, Niklas D Köhler, Thiago Martins, Jakob Siedlecki, Tina Herold, Leonie Keidel, Ben Asani, Johannes Schiefelbein, Siegfried Priglinger, Karsten U Kortuem, and Fabian J Theis. Self-supervised retinal thickness prediction enables deep learning from unlabelled data to boost classification of diabetic retinopathy. Nature Machine Intelligence, 2(11):719–726, 2020. [17] Zongwei Zhou, Vatsal Sodha, Md Mahfuzur Rahman Siddiquee, Ruibin Feng, Nima Tajbakhsh, Michael B Gotway, and Jianming Liang. Models genesis: Generic autodidactic models for 3d medical image analysis. In International Conference on Medical Image Computing and Computer-Assisted Intervention, pages 384–393. Springer, 2019. [18] Krishna Chaitanya, Ertunc Erdil, Neerav Karani, and Ender Konukoglu. Contrastive learning of global and local features for medical image segmentation with limited annotations. Advances in Neural Information Processing Systems, 33:12546–12558, 2020. [19] Fatemeh Haghighi, Mohammad Reza Hosseinzadeh Taher, Zongwei Zhou, Michael B Gotway, and Jianming Liang. Transferable visual words: Exploiting the semantics of anatomical patterns for self-supervised learning. IEEE transactions on medical imaging, 40(10):2857–2868, 2021. [20] Benjamin M Smith, John HM Austin, John D Newell Jr, Belinda M D'Souza, Anna Rozenshtein, Eric A Hoffman, Firas Ahmed, and R Graham Barr. Pulmonary emphysema subtypes on computed tomography: the mesa copd study. The American journal of medicine, 127(1):94–e7, 2014. [21] Deepak Pathak, Philipp Krahenbuhl, Jeff Donahue, Trevor Darrell, and Alexei A Efros. Context encoders: Feature learning by inpainting. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 2536–2544, 2016. 17 [22] Mehdi Noroozi and Paolo Favaro. Unsupervised learning of visual representations by solving jigsaw puzzles. In European Conference on Computer Vision, pages 69–84. Springer, 2016. [23] Chun-Liang Li, Kihyuk Sohn, Jinsung Yoon, and Tomas Pfister. Cutpaste: Self-supervised learning for anomaly In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern detection and localization. Recognition, pages 9664–9674, 2021. [24] Ishan Misra, C Lawrence Zitnick, and Martial Hebert. Shuffle and learn: unsupervised learning using temporal order verification. In European Conference on Computer Vision, pages 527–544. Springer, 2016. [25] Bruno Korbar, Du Tran, and Lorenzo Torresani. Cooperative learning of audio and video models from self- supervised synchronization. Advances in Neural Information Processing Systems, 31, 2018. [26] Relja Arandjelovic and Andrew Zisserman. Look, listen and learn. In Proceedings of the IEEE International Conference on Computer Vision, pages 609–617, 2017. [27] Ishan Misra and Laurens van der Maaten. Self-supervised learning of pretext-invariant representations. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 6707–6717, 2020. [28] Kuang-Huei Lee, Anurag Arnab, Sergio Guadarrama, John Canny, and Ian Fischer. Compressive visual represen- tations. Advances in Neural Information Processing Systems, 34, 2021. [29] Zhirong Wu, Yuanjun Xiong, Stella X Yu, and Dahua Lin. Unsupervised feature learning via non-parametric instance discrimination. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 3733–3742, 2018. [30] Michael Gutmann and Aapo Hyvärinen. Noise-contrastive estimation: A new estimation principle for unnormal- ized statistical models. In Proceedings of the thirteenth international conference on artificial intelligence and statistics, pages 297–304. JMLR Workshop and Conference Proceedings, 2010. [31] Aaron Van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv e-prints, pages arXiv–1807, 2018. [32] Nikunj Saunshi, Orestis Plevrakis, Sanjeev Arora, Mikhail Khodak, and Hrishikesh Khandeparkar. A theoretical analysis of contrastive unsupervised representation learning. In International Conference on Machine Learning, pages 5628–5637. PMLR, 2019. [33] Yonglong Tian, Dilip Krishnan, and Phillip Isola. Contrastive multiview coding. In European conference on computer vision, pages 776–794. Springer, 2020. [34] Joshua Robinson, Ching-Yao Chuang, Suvrit Sra, and Stefanie Jegelka. Contrastive learning with hard negative samples. arXiv preprint arXiv:2010.04592, 2020. [35] Yannis Kalantidis, Mert Bulent Sariyildiz, Noe Pion, Philippe Weinzaepfel, and Diane Larlus. Hard negative mixing for contrastive learning. Advances in Neural Information Processing Systems, 33:21798–21809, 2020. [36] Joshua Robinson, Li Sun, Ke Yu, Kayhan Batmanghelich, Stefanie Jegelka, and Suvrit Sra. Can contrastive learning avoid shortcut solutions? Advances in Neural Information Processing Systems, 34, 2021. [37] Saeed Shurrab and Rehab Duwairi. Self-supervised learning methods and applications in medical imaging analysis: A survey. arXiv preprint arXiv:2109.08685, 2021. [38] Xiaomeng Li, Xiaowei Hu, Xiaojuan Qi, Lequan Yu, Wei Zhao, Pheng-Ann Heng, and Lei Xing. Rotation-oriented collaborative self-supervised learning for retinal disease diagnosis. IEEE Transactions on Medical Imaging, 40(9):2284–2294, 2021. [39] Shekoofeh Azizi, Basil Mustafa, Fiona Ryan, Zachary Beaver, Jan Freyberg, Jonathan Deaton, Aaron Loh, Alan Karthikesalingam, Simon Kornblith, Ting Chen, Vivek Natarajan, and Mohammad Norouzi. Big self-supervised models advance medical image classification. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pages 3478–3488, October 2021. [40] Nima Tajbakhsh, Yufei Hu, Junli Cao, Xingjian Yan, Yi Xiao, Yong Lu, Jianming Liang, Demetri Terzopoulos, and Xiaowei Ding. Surrogate supervision for medical image analysis: Effective deep learning from limited quantities of labeled data. In 2019 IEEE 16th International Symposium on Biomedical Imaging (ISBI 2019), pages 1251–1255. IEEE, 2019. [41] Jianbo Jiao, Richard Droste, Lior Drukker, Aris T Papageorghiou, and J Alison Noble. Self-supervised representa- tion learning for ultrasound video. In 2020 IEEE 17th International Symposium on Biomedical Imaging (ISBI), pages 1847–1850. IEEE, 2020. [42] Aiham Taleb, Winfried Loetzsch, Noel Danz, Julius Severin, Thomas Gaertner, Benjamin Bergner, and Christoph Lippert. 3d self-supervised methods for medical imaging. Advances in Neural Information Processing Systems, 33:18158–18172, 2020. 18 [43] Tobias Ross, David Zimmerer, Anant Vemuri, Fabian Isensee, Manuel Wiesenfarth, Sebastian Bodenstedt, Fabian Both, Philip Kessler, Martin Wagner, Beat Müller, Hannes Kenngott, Stefanie Speidel, Annette Kopp-Schneider, Klaus Maier-Hein, and Lena Maier-Hein. Exploiting the potential of unlabeled endoscopic video data with self-supervised learning. International journal of computer assisted radiology and surgery, 13(6):925–933, 2018. [44] Jiuwen Zhu, Yuexiang Li, Yifan Hu, Kai Ma, S Kevin Zhou, and Yefeng Zheng. Rubik's cube+: A self-supervised feature learning framework for 3d medical image analysis. Medical image analysis, 64:101746, 2020. [45] Hongming Li and Yong Fan. Non-rigid image registration using self-supervised fully convolutional networks without training data. In 2018 IEEE 15th International Symposium on Biomedical Imaging (ISBI 2018), pages 1075–1078. IEEE, 2018. [46] Hari Sowrirajan, Jingbo Yang, Andrew Y Ng, and Pranav Rajpurkar. Moco pretraining improves representation and transferability of chest x-ray models. In Medical Imaging with Deep Learning, pages 728–744. PMLR, 2021. [47] Zongwei Zhou, Vatsal Sodha, Jiaxuan Pang, Michael B Gotway, and Jianming Liang. Models genesis. Medical image analysis, 67:101840, 2021. [48] Wenjia Bai, Chen Chen, Giacomo Tarroni, Jinming Duan, Florian Guitton, Steffen E Petersen, Yike Guo, Paul M Matthews, and Daniel Rueckert. Self-supervised learning for cardiac mr image segmentation by anatomical position prediction. In International Conference on Medical Image Computing and Computer-Assisted Intervention, pages 541–549. Springer, 2019. [49] David Ha, Andrew Dai, and Quoc V Le. Hypernetworks. arXiv preprint arXiv:1609.09106, 2016. [50] Sylwester Klocek, Łukasz Maziarka, Maciej Wołczyk, Jacek Tabor, Jakub Nowak, and Marek ́Smieja. Hypernet- work functional image representation. In International Conference on Artificial Neural Networks, pages 496–510. Springer, 2019. [51] Andrew Brock, Theodore Lim, James M Ritchie, and Nick Weston. Smash: one-shot model architecture search through hypernetworks. arXiv preprint arXiv:1708.05344, 2017. [52] Jonathan Lorraine and David Duvenaud. Stochastic hyperparameter optimization through hypernetworks. arXiv preprint arXiv:1802.09419, 2018. [53] Andrew Hoopes, Malte Hoffmann, Bruce Fischl, John Guttag, and Adrian V Dalca. Hypermorph: amortized hyperparameter learning for image registration. In International Conference on Information Processing in Medical Imaging, pages 3–17. Springer, 2021. [54] Brandon Yang, Gabriel Bender, Quoc V Le, and Jiquan Ngiam. Condconv: Conditionally parameterized convolutions for efficient inference. Advances in Neural Information Processing Systems, 32, 2019. [55] Nicholas J Tustison, Philip A Cook, Arno Klein, Gang Song, Sandhitsu R Das, Jeffrey T Duda, Benjamin M Kandel, Niels van Strien, James R Stone, James C Gee, and Brain B Avants. Large-scale evaluation of ants and freesurfer cortical thickness measurements. Neuroimage, 99:166–179, 2014. [56] Johannes Hofmanninger, Forian Prayer, Jeanny Pan, Sebastian Röhrich, Helmut Prosch, and Georg Langs. Automatic lung segmentation in routine imaging is primarily a data diversity problem, not a methodology problem. European Radiology Experimental, 4(1):1–13, 2020. [57] Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International conference on machine learning, pages 448–456. PMLR, 2015. [58] Djork-Arné Clevert, Thomas Unterthiner, and Sepp Hochreiter. Fast and accurate deep network learning by exponential linear units (elus). arXiv preprint arXiv:1511.07289, 2015. [59] MONAI Consortium. MONAI: Medical Open Network for AI, 3 2020. [60] Xinlei Chen, Haoqi Fan, Ross Girshick, and Kaiming He. Improved baselines with momentum contrastive learning. arXiv preprint arXiv:2003.04297, 2020. [61] Elizabeth A Regan, John E Hokanson, James R Murphy, Barry Make, David A Lynch, Terri H Beaty, Douglas Curran-Everett, Edwin K Silverman, and James D Crapo. Genetic epidemiology of copd (copdgene) study design. COPD: Journal of Chronic Obstructive Pulmonary Disease, 7(1):32–43, 2011. [62] SP Morozov, AE Andreychenko, NA Pavlov, AV Vladzymyrskyy, NV Ledikhova, VA Gombolevskiy, Ivan A Blokhin, PB Gelezhe, AV Gonchar, and V Yu Chernina. Mosmeddata: Chest ct scans with covid-19 related findings dataset. arXiv preprint arXiv:2005.06465, 2020. [63] Peter J Castaldi, Raúl San José Estépar, Carlos S Mendoza, Craig P Hersh, Nan Laird, James D Crapo, David A Lynch, Edwin K Silverman, and George R Washko. Distinct quantitative computed tomography emphysema patterns are associated with physiology and function in smokers. American journal of respiratory and critical care medicine, 188(9):1083–1090, 2013. 19 [64] Carlos S Mendoza, George R Washko, James C Ross, Alejandro A Diaz, David A Lynch, James D Crapo, Edward K Silverman, Begoña Acha, Carmen Serrano, and R San José Estépar. Emphysema quantification in a multi-scanner hrct cohort using local intensity distributions. In 2012 9th IEEE International Symposium on Biomedical Imaging (ISBI), pages 474–477. IEEE, 2012. [65] Sihong Chen, Kai Ma, and Yefeng Zheng. Med3d: Transfer learning for 3d medical image analysis. arXiv preprint arXiv:1904.00625, 2019. [66] Li Sun, Ke Yu, and Kayhan Batmanghelich. Context matters: Graph-based self-supervised representation learning for medical images. In Proceedings of the... AAAI Conference on Artificial Intelligence. AAAI Conference on Artificial Intelligence, volume 35, pages 4874–4882. NIH Public Access, 2021. [67] Jenna Schabdach, William M Wells, Michael Cho, and Kayhan N Batmanghelich. A likelihood-free approach for characterizing heterogeneous diseases in large-scale studies. In International Conference on Information Processing in Medical Imaging, pages 170–183. Springer, 2017. [68] Germán González, Samuel Y Ash, Gonzalo Vegas-Sánchez-Ferrero, Jorge Onieva Onieva, Farbod N Rahaghi, James C Ross, Alejandro Díaz, Raúl San José Estépar, and George R Washko. Disease staging and prognosis in smokers using deep learning in chest computed tomography. American journal of respiratory and critical care medicine, 197(2):193–203, 2018. [69] Sumedha Singla, Mingming Gong, Siamak Ravanbakhsh, Frank Sciurba, Barnabas Poczos, and Kayhan N Batmanghelich. Subject2vec: generative-discriminative approach from a set of image patches to a vector. In International Conference on Medical Image Computing and Computer-Assisted Intervention, pages 502–510. Springer, 2018. [70] David R Cox. Regression models and life-tables. Journal of the Royal Statistical Society: Series B (Methodologi- cal), 34(2):187–202, 1972. [71] Bartolome R Celli, Claudia G Cote, Jose M Marin, Ciro Casanova, Maria Montes de Oca, Reina A Mendez, Victor Pinto Plata, and Howard J Cabral. The body-mass index, airflow obstruction, dyspnea, and exercise capacity index in chronic obstructive pulmonary disease. New England Journal of Medicine, 350(10):1005–1012, 2004. [72] Fernando J Martinez, Gregory Foster, Jeffrey L Curtis, Gerard Criner, Gail Weinmann, Alfred Fishman, Malcolm M DeCamp, Joshua Benditt, Frank Sciurba, Barry Make, Zab Mohsenifar, Philip Diaz, Eric Hoffman, Robert Wise, and NETT Research Group. Predictors of mortality in patients with emphysema and severe airflow obstruction. American journal of respiratory and critical care medicine, 173(12):1326–1334, 2006. [73] JG Leopold and J Gough. The centrilobular form of hypertrophic emphysema and its relation to chronic bronchitis. Thorax, 12(3):219, 1957. [74] BE Heard, V Khatchatourov, H Otto, NV Putov, and L Sobin. The morphology of emphysema, chronic bronchitis, and bronchiectasis: definition, nomenclature, and classification. Journal of clinical pathology, 32(9):882, 1979. [75] Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pages 234–241. Springer, 2015. 20
http://arxiv.org/abs/2302.10371v1
2023-02-21T00:17:24
2023-02-21T00:17:24
Variance-Dependent Regret Bounds for Linear Bandits and Reinforcement Learning: Adaptivity and Computational Efficiency
Recently, several studies (Zhou et al., 2021a; Zhang et al., 2021b; Kim et al., 2021; Zhou and Gu, 2022) have provided variance-dependent regret bounds for linear contextual bandits, which interpolates the regret for the worst-case regime and the deterministic reward regime. However, these algorithms are either computationally intractable or unable to handle unknown variance of the noise. In this paper, we present a novel solution to this open problem by proposing the first computationally efficient algorithm for linear bandits with heteroscedastic noise. Our algorithm is adaptive to the unknown variance of noise and achieves an $\tilde{O}(d \sqrt{\sum_{k = 1}^K \sigma_k^2} + d)$ regret, where $\sigma_k^2$ is the variance of the noise at the round $k$, $d$ is the dimension of the contexts and $K$ is the total number of rounds. Our results are based on an adaptive variance-aware confidence set enabled by a new Freedman-type concentration inequality for self-normalized martingales and a multi-layer structure to stratify the context vectors into different layers with different uniform upper bounds on the uncertainty. Furthermore, our approach can be extended to linear mixture Markov decision processes (MDPs) in reinforcement learning. We propose a variance-adaptive algorithm for linear mixture MDPs, which achieves a problem-dependent horizon-free regret bound that can gracefully reduce to a nearly constant regret for deterministic MDPs. Unlike existing nearly minimax optimal algorithms for linear mixture MDPs, our algorithm does not require explicit variance estimation of the transitional probabilities or the use of high-order moment estimators to attain horizon-free regret. We believe the techniques developed in this paper can have independent value for general online decision making problems.
[ "Heyang Zhao", "Jiafan He", "Dongruo Zhou", "Tong Zhang", "Quanquan Gu" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10371v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10371v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "math.OC", "stat.ML" ]
3 2 0 2 b e F 1 2 ] G L . s c [ 1 v 1 7 3 0 1 . 2 0 3 2 : v i X r a Variance-Dependent Regret Bounds for Linear Bandits and Reinforcement Learning: Adaptivity and Computational Efficiency Heyang Zhao∗ Jiafan He† Dongruo Zhou‡ Tong Zhang § Quanquan Gu¶ Abstract Recently, several studies (Zhou et al., 2021a; Zhang et al., 2021b; Kim et al., 2021; Zhou and Gu, 2022) have provided variance-dependent regret bounds for linear contextual bandits, which interpolates the regret for the worst-case regime and the deterministic reward regime. However, these algorithms are either computationally intractable or unable to handle unknown variance of the noise. In this paper, we present a novel solution to this open problem by proposing the first computationally efficient algorithm for linear bandits with heteroscedastic noise. Our algorithm is adaptive to the unknown variance of noise and achieves an (cid:101)O(d k + d) regret, where σ2 k is the variance of the noise at the round k, d is the dimension of the contexts and K is the total number of rounds. Our results are based on an adaptive variance-aware confidence set enabled by a new Freedman-type concentration inequality for self-normalized martingales and a multi-layer structure to stratify the context vectors into different layers with different uniform upper bounds on the uncertainty. (cid:113)(cid:80)K k=1 σ2 Furthermore, our approach can be extended to linear mixture Markov decision processes (MDPs) in reinforcement learning. We propose a variance-adaptive algorithm for linear mixture MDPs, which achieves a problem-dependent horizon-free regret bound that can gracefully reduce to a nearly constant regret for deterministic MDPs. Unlike existing nearly minimax optimal algorithms for linear mixture MDPs, our algorithm does not require explicit variance estimation of the transitional probabilities or the use of high-order moment estimators to attain horizon-free regret. We believe the techniques developed in this paper can have independent value for general online decision making problems. 1 Introduction The Multi-Armed Bandits (MAB) problem has been persistently studied since 1933 (Thompson, 1933; Robbins, 1952; Cesa-Bianchi and Fischer, 1998; Auer et al., 2002). In the past decades, a variety ∗Department of Computer Science, University of California, Los Angeles, CA 90095, USA; e- amil:[email protected] †Department of Computer Science, University of California, Los Angeles, CA 90095, USA; e-mail: [email protected] ‡Department of Computer Science, University of California, Los Angeles, CA 90095, USA; e-mail: [email protected] §‡Google Research and The Hong Kong University of Science and Technology; e-mail:[email protected] ¶Department of Computer Science, University of California, Los Angeles, CA 90095, USA; e-mail: [email protected] 1 of bandit algorithms have been developed under different settings, emerging their practicality in assorted real world tasks such as online advertising (Li et al., 2010), clinical experiments (Villar et al., 2015) and resource allocations (Lattimore et al., 2015), to mention a few. For a thorough review of bandit algorithms, please refer to Bubeck and Cesa-Bianchi (2012); Lattimore and Szepesvári (2020). To deal with an excessive number of arms, contextual linear bandits (Auer, 2002; Abe et al., 2003; Li et al., 2010), where each arm is associated with a context vector and the expected reward is a linear function of the context vector, have garnered a lot of attention. Numerous studies have attempted to design algorithms to achieve the optimal regret bound for linear bandits (Chu et al., 2011; Abbasi-Yadkori et al., 2011). Despite the achievement of minimax-optimal regret bounds in various settings, they only quantify the performance of a specific algorithm under the worst-case scenario. However, in the noiseless scenario (i.e., the variance of the noise equal 0), the learner only requires (cid:101)O(d) regret to recover the underlying coefficients of the linear function. This motivates a series of work on variance-dependent regret for linear bandits (Zhou et al., 2021a; Zhang et al., 2021b; Zhou and Gu, 2022; Zhao et al., 2022), which bridges the gap between the worst-case constant-variance regime (i.e., noisy case) and the deterministic regime (i.e., noiseless case). In these works, the regret bounds depend on the variance of noise at each round, i.e., {σ2 where K is the total number of rounds. Unfortunately, all these prior approaches are either computationally inefficient or non-adaptive, meaning the agent must possess prior knowledge of the variance to learn the reward function. As a result, none of the existing algorithms are practical enough for real-world use, despite being designed for better performance in reality. Therefore, an open question arises: i }K i=1 Can we design computationally tractable algorithms for linear bandits with heteroscedastic noise to obtain a variance-dependent regret bound without prior knowledge on the noise? 1.1 Our Contributions k=1σ2 (cid:113)(cid:80)K k + d(cid:1), where σ2 In this paper, we answer this question affirmatively by proposing the first computationally efficient algorithm for heteroscedastic linear bandits with unknown variance and attaining a regret bound scales as (cid:101)O(cid:0)d is the variance of the noise at the round k, d is the dimension of the contexts and K is the total number of rounds. Our result is significant in the sense that it is minimax optimal in both the deterministic case and the worst case. When there is no noise, the above regret degenerates to (cid:101)O(d), which corresponds to the benign regime. In the worst case when the noise is R-sub-Gaussian, the above regret reduces to (cid:101)O(dR K + d), which matches the minimax regret bound proved in Abbasi-Yadkori et al. (2011). Please refer to Table 1 for a comparison between our result and the previous results in linear contextual bandits. Our algorithm and its analysis rely on the following new techniques. √ k • We propose a new Freedman-type concentration inequality for vector-valued self-normalized martingales, which is applicable to the heteroscedastic random variables. This strictly generalizes the previous Bernstein-type concentration inequality (Theorem 4.1, Zhou et al. 2021a) for vector- valued self-normalized martingales with homoscedastic random variables. • We employ a multi-layer structure to partition the observed context vectors according to their elliptical norm. Different from the classic SupLinUCB algorithm (Chu et al., 2011), we use carefully 1For the deterministic-case, the variance at stage k ∈ [K] satisfies σk = 0. The regret guarantee is the same as the general case for variance-unaware algorithms. 2 Table 1: Comparison between different algorithms for stochastic linear contextual bandits. d, K, {σk}k∈[K] are the dimension of context vectors, the number of rounds and the variance of noise at round k ∈ [K]. The last column indicates whether the corresponding algorithm requires the variance information to achieve variance-dependent regret. Algorithm Regret (General-Case) Regret (Deterministic-Case)1 Efficiency Variances ConfidenceBall2 (Dani et al., 2008) OFUL (Abbasi-Yadkori et al., 2011) Weighted OFUL (Zhou et al., 2021a) Weighted OFUL+ (Zhou and Gu, 2022) VOFUL (Zhang et al., 2021b) VOFUL2 (Kim et al., 2021) SAVE (Theorem 2.3) √ (cid:101)O(d K) K) √ (cid:101)O(d (cid:113)(cid:80)K d (cid:16) (cid:101)O k=1 σ2 k + √ (cid:17) dK (cid:16) (cid:101)O (cid:113)(cid:80)K d k=1 σ2 (cid:16) (cid:16) (cid:101)O (cid:101)O d4.5 d1.5 (cid:113)(cid:80)K k=1 σ2 (cid:113)(cid:80)K k=1 σ2 (cid:16) (cid:101)O (cid:113)(cid:80)K d k=1 σ2 (cid:17) k + d k + d5(cid:17) k + d2(cid:17) (cid:17) k + d √ (cid:101)O(d K) K) √ dK) (cid:101)O(d √ (cid:101)O( (cid:101)O(d) (cid:101)O(d2) (cid:101)O(d5) (cid:101)O(d) Yes Yes Yes Yes No No N/A N/A Known Known Unknown Unknown Yes Unknown designed weights within each layer to ensure that all the reweighted context vectors in the same layer have a uniform elliptical norm. • Equipped with the new concentration inequality, we design a new adaptive variance-aware exploration strategy. Specifically, we adopt a self-adaptive confidence set whose radius is updated at each round based on the 'square loss' incurred by the online estimator. Furthermore, we apply our novel techniques to episodic Markov decision processes, where the agent interacts with the environment by taking actions and observing states and rewards generated by the unknown dynamics over time. We focus on linear mixture MDPs (Jia et al., 2020; Ayoub et al., 2020; Zhou et al., 2021b) in this paper, whose transition dynamic is assumed to be a linear combination of d basic transition models. For linear mixture MDPs, both minimax optimal horizon- dependent regret (Zhou et al., 2021a) and horizon-free regret (Zhang et al., 2021b; Kim et al., 2021; Zhou and Gu, 2022) have been achieved. We propose an algorithm named UCRL-AVE and derive a tight problem-dependent regret bound that has no explicit polynomial dependency on neither the number of episodes K nor the planing horizon H. Our regret bound gracefully degrades to the nearly minimax optimal horizon-free regret bound achieved by Zhou and Gu (2022) in the worst case. See Table 2 for a comparison between our regret bound with the previous results regarding linear mixture MDPs. 1.2 Related Work Problem-dependent regret in RL. Most of the performance guarantees for episodic MDPs have been focused on worst-case regret bounds. However, some works have achieved problem-dependent regret, which holds in various scenarios, as demonstrated by studies such as Zanette and Brunskill (2019); Simchowitz and Jamieson (2019); Jin et al. (2020a); He et al. (2021a); Dann et al. (2021); Xu 3 Table 2: Comparison of our variance-dependent regret with existing regret bounds for linear mixture MDPs. H, d, K, are the horizon of the underlying MDP, the dimension of the feature vectors and is defined in Section 3 to characterize the randomness of MDPs. It is the number of episodes. Var∗ K shown later in Section 3 that our variance-dependent regret degrades to (cid:101)O(d K + d2) in the worst case, which matches the nearly minimax optimal horizon-free regret in linear mixture MDPs. √ Algorithm UCRL-VTR (Ayoub et al., 2020; Jia et al., 2020) UCRL-VTR+ (Zhou et al., 2021a) VarLin (Zhang et al., 2021b) VarLin2 (Kim et al., 2021) HF-UCRL-VTR+ (Zhou and Gu, 2022) UCRL-AVE (Theorem 2.3) Regret (General-Case) Variance-Dependent Assumption Efficiency √ (cid:101)O(d H 3K) √ K √ (cid:101)O( d2H 3 + dH 4 +d2H 3 + d3H 2) √ (cid:16) K + d9(cid:17) d4.5 (cid:101)O (cid:101)O(d K + d2) √ √ (cid:101)O(d K + d2) K + d2(cid:17) (cid:16) (cid:101)O d(cid:112)Var∗ No No No No No Yes Homogeneous (cid:80)H h=1 rh ≤ H Inhomogeneous (cid:80)H h=1 rh ≤ H Homogeneous (cid:80)H h=1 rh ≤ 1 Homogeneous (cid:80)H h=1 rh ≤ 1 Homogeneous (cid:80)H h=1 rh ≤ 1 Homogeneous (cid:80)H h=1 rh ≤ 1 Yes Yes No No Yes Yes et al. (2021); Wagenmaker et al. (2022). These results can be broadly categorized into two groups. The first group is first-order regret in RL, which was originally proposed by Zanette and Brunskill (2019) and later extended to the linear MDP setting by Wagenmaker et al. (2022). The second group is gap-dependent regret guarantees, which have been studied for both tabular MDPs (Simchowitz and Jamieson, 2019; Xu et al., 2021; Dann et al., 2021) and linear MDPs/linear mixture MDPs (He et al., 2021a). We also notice that a concurrent work by Zhou et al. (2023) considers variance-dependent bound in tabular MDPs. Our paper utilizes the same definition of trajectory-based total variance as Zhou et al. (2023), which characterizes the randomness of an episodic MDP. Horizon-free regret in tabular RL. RL is considered to be more challenging than contextual bandits due to the non-trivial planning horizon and uncertain state transitions. Jiang and Agarwal (2018) conjectured that any algorithm seeking an (cid:15)-optimal policy for tabular RL, where the total reward is bounded by 1, would require a sample complexity with a polynomial dependence on the planning horizon H. However, this conjecture was disproven by Wang et al. (2020a), who introduced a horizon-free algorithm with a sample complexity of (cid:101)O(|S|5|A|4(cid:15)−2polylog(H)) that only has a polylogarithmic dependence on H. Zhang et al. (2021a) then proposed a near-optimal algorithm with a regret of O(((cid:112)|S||A|K + |S|2|A|)polylog(H)) and a similar sample complexity. Later, Li et al. (2022) and Zhang et al. (2022) presented algorithms with sample complexity guarantees that are independent of H. Heteroscedastic linear bandits. The worst-case regret of linear bandits has been extensively studied (Auer, 2002; Dani et al., 2008; Li et al., 2010; Chu et al., 2011; Abbasi-Yadkori et al., 2011; Li et al., 2019). Recently, there is a series of works considering a heteroscedastic variant of the classic linear bandit problem where the noise distribution is assumed to vary over time. Kirschner and Krause (2018) is the first to formally propose linear bandit model with heteroscedastic noise. In their setting, the noise at round k ∈ [K] is assumed to be σk-sub-Gaussian. Some recent works relaxed the sub-Gaussian assumption in the sense that the noise at the k-th round is assumed to instead of σk-sub-Gaussian (Zhou et al., 2021a; Zhang et al., 2021b; Kim et al., be of variance σ2 k 4 2021; Zhou and Gu, 2022; Dai et al., 2022). Among these works, Zhou et al. (2021a) and Zhou and Gu (2022) considered known-variance case where σk is observed by the learner after the k-th round, while Zhang et al. (2021b); Kim et al. (2021) proposed statistically efficient but computationally inefficient algorithms for the unknown-variance case. Dai et al. (2022) considered a more specific model, heteroscedastic sparse linear bandits, and proposed a general framework which converts any heteroscedastic linear bandit algorithm to an algorithm for heteroscedastic sparse linear bandits. RL with linear function approximation. There is a huge body of literature on RL with linear function approximation (Jiang et al., 2017; Dann et al., 2018; Yang and Wang, 2019; Jin et al., 2020b; Wang et al., 2020b; Du et al., 2019; Sun et al., 2019; Zanette et al., 2020a,b; Weisz et al., 2021; Yang and Wang, 2020; Modi et al., 2020; Ayoub et al., 2020; Zhou et al., 2021a; He et al., 2021a; Zhou and Gu, 2022). Several types of assumptions on the linear structure of the underlying MDPs have been made in these works, including the linear MDP assumption (Yang and Wang, 2019; Jin et al., 2020b; Hu et al., 2022; He et al., 2022a; Agarwal et al., 2022), the low Bellman-rank assumption (Jiang et al., 2017), the low inherent Bellman error assumption (Zanette et al., 2020b), and the linear mixture MDP assumption (Modi et al., 2020; Jia et al., 2020; Ayoub et al., 2020; Zhou et al., 2021a). In this paper, we focus on linear mixture MDPs, where the transition probability function is assumed to be a linear function of a known feature mapping over the state-action-next-state triplet. Recently, there is a line of works attaining horizon-free regret bounds (Zhang et al., 2021b; Kim et al., 2021; Zhou and Gu, 2022) for linear mixture MDPs, which are most related to our work. √ Notation We use lower case letters to denote scalars, and use lower and upper case bold face letters to denote vectors and matrices respectively. We denote by [n] the set {1, . . . , n}. For a vector x ∈ Rd and a positive semi-definite matrix Σ ∈ Rd×d, we denote by (cid:107)x(cid:107)2 the vector's Euclidean norm and define (cid:107)x(cid:107)Σ = x(cid:62)Σx. For x, y ∈ Rd, let x(cid:12)y be the Hadamard (componentwise) product of x and y. For two positive sequences {an} and {bn} with n = 1, 2, . . . , we write an = O(bn) if there exists an absolute constant C > 0 such that an ≤ Cbn holds for all n ≥ 1 and write an = Ω(bn) if there exists an absolute constant C > 0 such that an ≥ Cbn holds for all n ≥ 1. We use (cid:101)O(*) to further hide the polylogarithmic factors. We use 1{*} to denote the indicator function. For a, b ∈ R satisfying a ≤ b, we use [x][a,b] to denote the truncation function x * 1{a ≤ x ≤ b} + a * 1{x < a} + b * 1{x > b}. 2 Variance-Aware Learning for Heteroscedastic Linear Bandits In this section, we propose a computationally efficient variance-aware algorithm, dubbed SAVE (Suplin + Adaptive Variance-aware Exploration), for stochastic linear contextual bandits and present its theoretical guarantees. SAVE does not require the knowledge of the noise variance (or its upper bound), making it adaptable to varying levels of noise variance. 2.1 Problem Setup We consider a heteroscedastic variant of the classic linear contextual bandit problem (Zhou et al., 2021a; Zhang et al., 2021b). Let K be the total number of rounds. At each round k ∈ [K], the interaction between the agent and the environment is as follows: (1) the environment generates an arbitrary decision set Dk ⊆ Rd where each element represents a feasible action that can be selected by the agent; (2) the agent observes Dk and selects ak ∈ Dk; and (3) the environment generates the stochastic noise (cid:15)k at round k and reveal the stochastic reward rk = (cid:104)θ∗, ak(cid:105) + (cid:15)k to the agent. We 5 assume that there exists a uniform bound A > 0 for the (cid:96)2 norm of the feasible actions, i.e., for all k ∈ [K], a ∈ Dk, it holds that (cid:107)a(cid:107)2 ≤ A. Following Zhou et al. (2021a), we assume the following condition on the random noise (cid:15)k at each round k: P (|(cid:15)k| ≤ R) = 1, E[(cid:15)k|a1:k, (cid:15)1:k−1] = 0, E[(cid:15)2 k|a1:k, (cid:15)1:k−1] = σ2 k. (2.1) Without loss of generality, we assume that the size of Dk is finite and is bounded by |D| for all k ∈ [K]. If the size of Dk is infinite, we can use standard covering argument to convert it to be finite. The goal of the agent is to minimize the cumulative regret defined as follows: Regret(K) = (cid:88) k∈[K] 2.2 Technical Challenges (cid:0)(cid:104)a∗ k, θ∗(cid:105) − (cid:104)ak, θ∗(cid:105)(cid:1), where a∗ k = argmax (cid:104)a, θ∗(cid:105). a∈Dk (2.2) The key technical challenge we face is to provide a tight upper bound of (cid:104)a∗ k, θ∗(cid:105) − (cid:104)ak, θ∗(cid:105). The classical approach is to use the optimism-in-the-face-of-uncertainty principle (Abbasi-Yadkori et al., 2011), and construct a confidence set Ck which includes θ∗ w.h.p., then upper bound (cid:104)a∗ k, θ∗(cid:105) with (cid:104)ak, θk(cid:105), where θk ∈ Ck. Starting from here, there are two main approaches to bound (cid:104)ak, θk − θ∗(cid:105) for heteroscedastic linear bandits. The first approach bounds (cid:104)ak, θk − θ∗(cid:105) with (cid:107)ak(cid:107) (cid:107)θk − θ∗(cid:107) (cid:98)Σk by Cauchy-Schwarz inequality. (cid:98)Σ−1 k (cid:98)Σk (cid:98)Σk is known. and (cid:107)θ∗ − (cid:98)θk(cid:107) . Then they bound (cid:107)θk − θ∗(cid:107) Zhou et al. (2021a); Zhou and Gu (2022) constructed Ck as an ellipsoid centering at (cid:98)θk, which is the solution to a weighted linear regression problem over the past contexts ai, and their weight is based on the upper bound of the variance of heteroscedastic noise σ2 k (cid:98)Σk by (cid:107)θk − (cid:98)θk(cid:107) separately, each of which can be bounded properly by using the self-normalized concentration inequalities proposed in Zhou et al. (2021a); Zhou and Gu (2022). However, as we have mentioned before, their approach is limited to the case where an upper bound of σ2 k The second approach (Zhang et al., 2021b; Kim et al., 2021) follows the test-based framework. Instead of constructing Ck as an ellipsoid centering at a least square estimator (cid:98)θk for each round k, Zhang et al. (2021b); Kim et al. (2021) constructed Ck as the intersection of a series of sub-confidence sets denoted by different tests, where each test represents a constraint over a potential direction of the action ak. The limitation of their approach is that, in order to have a uniform upper bound on (cid:104)ak, θk − θ∗(cid:105), they have to cover all possible directions of ak, which leads to an exp(d) number of test sets by the standard covering argument. This makes the computational time of their test-based algorithms depend on d exponentially, which is computationally inefficient. 2.3 A New Freedman-Type Concentration Inequality for Vector-Valued Mar- tingales To tackle the above technical challenges posed by both weighted linear regression and test-based approach, we seek to develop a new Freedman-type concentration inequality for vector-valued self-normalized martingales with heteroscedastic noise (i.e., non-uniform variance). Theorem 2.1. Let {Gk}∞ be a filtration, and {xk, ηk}k≥1 be a stochastic process such that k=1 xk ∈ Rd is Gk-measurable and ηk ∈ R is Gk+1-measurable. Let L, σ, λ, (cid:15) > 0, μ∗ ∈ Rd. For k ≥ 1, let 6 yk = (cid:104)μ∗, xk(cid:105) + ηk, where ηk, xk satisfy E[ηk|Gk] = 0, |ηk| ≤ R, k (cid:88) i=1 E[η2 i |Gi] ≤ vk, for ∀ k ≥ 1 For k ≥ 1, let Zk = λI + (cid:80)k i=1 xix(cid:62) i i=1 yixi, μk = Z−1 k bk, and , bk = (cid:80)k (cid:112) βk = 16ρ vk log(4k2/δ) + 6ρR log(4k2/δ), where ρ ≥ supk≥1 (cid:107)xk(cid:107)Z−1 k−1 . Then, for any 0 < δ < 1, we have with probability at least 1 − δ that, ∀k ≥ 1, (cid:13) (cid:13) (cid:80)k i=1xiηi (cid:13) (cid:13)Z−1 k ≤ βk, (cid:107)μk − μ∗(cid:107)Zk ≤ βk + √ λ(cid:107)μ∗(cid:107)2. Theorem 2.1 can be viewed as an extension of Freedman's inequality (Freedman, 1975) from scalar-valued martingales to vector-valued self-normalized martingales. Though Zhou et al. (2021a) proposed Bernstein-type concentration inequalities for vector-valued martingales (Theorem 4.1, Zhou et al. 2021a), their inequality relies on a uniform upper bound on the variance of random variables, E[η2 i |Gi]. In contrast, the upper bound provided i.e., (cid:107)μk − μ∗(cid:107)Zk ≤ (cid:101)O(σ d + R), where σ2 ≥ supk≥1 , which is of the order (cid:101)O((cid:112)d/k) under certain by Theorem 2.1 depends on the maximum of (cid:107)xk(cid:107)Z−1 conditions (Carpentier et al., 2020). For these cases, our upper bound for (cid:107)μk − μ∗(cid:107)Zk scales as (cid:101)O((cid:112)d * vk/k + R * (cid:112)d/k), which is more fine-grained and strictly tighter than the previous upper bounds when k ≥ d. √ k−1 2.4 The Proposed Algorithm Equipped with the new Freedman-type concentration inequality, we will design a new algorithm that is adaptive to the unknown variance of noise. 2.4.1 SupLin with Adaptive Variance-Aware Exploration As discussed in the last subsection, in order to exploit Theorem 2.1 effectively in the heteroscedastic linear bandits setting, we need the uncertainty/bonus term (cid:107)ak(cid:107) to be small, where (cid:98)Σk−1 is the covariance matrix of ak. However, such a term is in the order of O(1) in the worst case. Our algorithm partition the observed contexts into different layers such that the uncertainty of the contexts within each layer is small. Our algorithm is displayed in Algorithm 1, namely SAVE. (cid:98)Σ−1 k−1 Overall algorithm structure In general, Algorithm 1 shares a similar multi-layer structure as SupLinUCB in Chu et al. (2011). Algorithm 1 maintains L context sets Ψk,(cid:96), (cid:96) ∈ [L] at the k-th round. The goal of Algorithm 1 at the k-th round is to select ak which maximizes (cid:104)a, θ∗(cid:105). Since θ∗ is unknown, the selection process is based on L number of estimates of θ∗, which we denote them by (cid:98)θk,(cid:96), (cid:96) ∈ [L]. (cid:98)θk,(cid:96) is the solution to some regression problem over contexts in Ψk,(cid:96) and their corresponding rewards. Starting from (cid:96) = 1, the decision set Ak,(cid:96) will keep 'shrinking' by eliminating all a ∈ Ak,(cid:96) which are unlikely to be the maximizer of (cid:104)a, θ∗(cid:105) (notably, since θ∗ is unknown, here θ∗ needs to be replaced by (cid:98)θk,(cid:96), as displayed in Line 11). The elimination process will not stop until emerges. Then Algorithm 1 will either select the action some action a with large uncertainty (cid:107)a(cid:107) (cid:98)Σ−1 k,(cid:96) 7 Algorithm 1 SupLin + Adaptive Variance-aware Exploration (SAVE) Require: α > 0, and the upper bound on the (cid:96)2-norm of a in Dk(k ≥ 1), i.e., A. 1: Initialize L ← (cid:100)log2(1/α)(cid:101). 2: Initialize the estimators for all layers: (cid:98)Σ1,(cid:96) ← 2−2(cid:96) *I, (cid:98)b1,(cid:96) ← 0, (cid:98)θ1,(cid:96) ← 0, Ψk,(cid:96) ← ∅, (cid:98)β1,(cid:96) ← 2−(cid:96)+1 for all (cid:96) ∈ [L]. 3: for k = 1, . . . , K do 4: Observe Dk. Let Ak,1 ← Dk, (cid:96) ← 1. 5: 6: while ak is not specified do 7: if (cid:107)a(cid:107) (cid:98)Σ−1 k,(cid:96) ≤ α for all a ∈ Ak,(cid:96) then 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: Choose ak ← argmaxa∈Ak,(cid:96) (cid:104)a, (cid:98)θk,(cid:96)(cid:105) + (cid:98)βk,(cid:96)(cid:107)a(cid:107) Keep the same index sets at all layers: Ψk+1,(cid:96)(cid:48) ← Ψk,(cid:96)(cid:48) for all (cid:96)(cid:48) ∈ [L]. and observe rk. (cid:98)Σ−1 k,(cid:96) else if (cid:107)a(cid:107) (cid:98)Σ−1 k,(cid:96) Ak,(cid:96)+1 ← (cid:8)a ∈ Ak,(cid:96) ≤ 2−(cid:96) for all a ∈ Ak,(cid:96) then (cid:12) (cid:12)(cid:104)a, (cid:98)θk,(cid:96)(cid:105) ≥ maxa(cid:48)∈Ak,(cid:96)(cid:104)a(cid:48), (cid:98)θk,(cid:96)(cid:105) − 2 * 2−(cid:96) (cid:98)βk,(cid:96) (cid:9). else Choose ak such that (cid:107)ak(cid:107) > 2−(cid:96) and observe rk. Compute the weight: wk ← 2−(cid:96)/(cid:107)ak(cid:107) . (cid:98)Σ−1 k,(cid:96) Update the index sets: Ψk+1,(cid:96) ← Ψk,(cid:96) ∪ {k} and Ψk+1,(cid:96)(cid:48) ← Ψk,(cid:96)(cid:48) for (cid:96)(cid:48) ∈ [L]\{(cid:96)}. (cid:98)Σ−1 k,(cid:96) end if (cid:96) ← (cid:96) + 1. end while For (cid:96) ∈ [L] such that Ψk+1,(cid:96) (cid:54)= Ψk,(cid:96), update the estimators as follows: (cid:98)Σk+1,(cid:96) ← (cid:98)Σk,(cid:96) + w2 kaka(cid:62) k , (cid:98)bk+1,(cid:96) ← (cid:98)bk,(cid:96) + w2 k * rkak, (cid:98)θk+1,(cid:96) ← (cid:98)Σ−1 k+1,(cid:96)(cid:98)bk+1,(cid:96). Compute the adaptive confidence radius (cid:98)βk+1,lfor the next round according to (2.3). For (cid:96) ∈ [L] such that Ψk+1,(cid:96) = Ψk,(cid:96), let (cid:98)Σk+1,(cid:96) ← (cid:98)Σk,(cid:96), (cid:98)bk+1,(cid:96) ← (cid:98)bk,(cid:96), (cid:98)θk+1,(cid:96) ← (cid:98)θk,(cid:96), (cid:98)βk+1,(cid:96) ← (cid:98)βk,(cid:96). 21: end for a with a large uncertainty (Line 13 to Line 15), or the action which maximizes the upper confidence bound of estimated reward if there is no action with a large uncertainty (Line 8 to Line 9). The context set Ψk,(cid:96) will be updated by adding k into it only when ak enjoys a large uncertainty. Construction of the estimate (cid:98)θk,(cid:96) The first difference between our algorithm and SupLinUCB is the construction of the estimate (cid:98)θk,(cid:96). Unlike the unweighted ridge regression estimator applied in SupLinUCB, we employ a weighted ridge-regression estimator as follows ∀k ∈ [K] and (cid:96) ∈ [L], (cid:98)θk,(cid:96) = argmin θ∈Rd (cid:88) i∈Ψk,(cid:96) w2 i (cid:0)ri − (cid:104)θ, ai(cid:105)(cid:1)2 + 2−2(cid:96)λ(cid:107)θ(cid:107)2 2, where the weight wi is chosen such that for ∀(cid:96) ∈ [L] and i ∈ Ψk,(cid:96), (cid:107)wiai(cid:107) = 2−(cid:96). We explain here why we want to adopt such a weighted regression scheme. In particular, the estimate (cid:98)θk,(cid:96) (cid:98)Σ−1 i,(cid:96) 8 can be regarded as μk in Theorem 2.1. By our construction of wi, we can ensure that the context xi in Theorem 2.1, which is wiai here, enjoys a uniform upper bound on the uncertainty, i.e., is in the order of O(2−(cid:96)), which (cid:107)xi(cid:107)Z−1 (cid:98)Σk,(cid:96) is tighter than the vanilla bound O(1) deduced by previous works. ≤ 2−(cid:96). Such a result can further imply that (cid:107) (cid:98)θk,(cid:96) − θ∗(cid:107) i Remark 2.2. It is worth noting that weighted ridge-regression technique has been used in het- eroscedastic bandit setting (Kirschner and Krause, 2018; Zhou et al., 2021a; Zhou and Gu, 2022) for the known variance case. The most related work to ours is Zhou et al. (2021a), which applies (cid:0)ri − (cid:104)θ, ai(cid:105)(cid:1)2 + λ(cid:107)θ(cid:107)2 the following weighted ridge-regression estimator θk = argminθ∈Rd 2, weight is introduced to normalize the variance of noise. Our weight wi, in contrast, is where the 1/σ2 i set to reweight the feature vectors such that they have the same elliptical norm (cid:107)ai(cid:107) . Weighted ridge-regression technique has also been applied to other bandit settings such as linear multi-resource allocation (Lattimore et al., 2015) and corruption-robust linear bandits (He et al., 2022b). In (cid:1) to balance the effect of particular, He et al. (2022b) adopts a similar weight wi = O(cid:0)1/(cid:107)ai(cid:107)1/2 (cid:98)Σ−1 i adversarial corruption and stochastic noise. Nevertheless, the specific bandit problems they are solving are quite different from ours. (cid:80)k−1 i=1 (cid:98)Σ−1 i,(cid:96) 1 σ2 i Adaptive variance-aware exploration According to previous discussion, we can bound the estimation error of (cid:98)θk,(cid:96) following Theorem 2.1, which leads to a confidence bound of θ∗, i.e., i + 2−(cid:96)R)}. This can be used in the arm selection {θ : (cid:107)θ − (cid:98)θk,(cid:96)(cid:107) step (Line 8 and Line 11). However, such a confidence set requires the knowledge of variances σ2 i with their empirical estimator. In detail, since apriori. To address this issue, we need to replace σ2 i i = E[(ri − (cid:104)θ∗, ai(cid:105))2|a1:i−1, (cid:15)1:i−1], we simply use an one-point plug-in estimator (ri − (cid:104) (cid:98)θk,(cid:96), ai(cid:105))2. σ2 With such an estimator, we define the confidence radius βk+1,(cid:96) at round k + 1 and layer (cid:96) as ≤ (cid:101)O(2−(cid:96) * (cid:113)(cid:80) i σ2 i∈Ψk,(cid:96) w2 (cid:98)Σk,(cid:96) βk+1,(cid:96) := 16 * 2−(cid:96) (cid:114)(cid:16) 8(cid:100)Vark+1,(cid:96) + 6R2 log(4(k + 1)2L/δ) + 2−2(cid:96)+4(cid:17) log(4k2L/δ) + 6 * 2−(cid:96)R log(4k2L/δ) + 2−(cid:96)+1, (2.3) where (cid:100)Vark+1,(cid:96) := (cid:40)(cid:80) w2 i i∈Ψk+1,(cid:96) R2 |Ψk+1,(cid:96)| , (cid:0)ri − (cid:104) (cid:98)θk+1,(cid:96), ai(cid:105)(cid:1)2, 2(cid:96) ≥ 64(cid:112)log (4(k + 1)2L/δ) otherwise. We would like to emphasize that although our used one-point estimator (ri − (cid:104) (cid:98)θk,l, ai(cid:105))2 might for some round i, the weighted summation of the be an inaccurate estimator of the target σ2 i one-point estimators (cid:80) w2 i (ri − (cid:104)θk,l, ai(cid:105))2 actually serves as a sufficiently accurate estimator of the total variance (cid:80) w2 . That is because our employed weight can effectively 'calibrate' the term (ri − (cid:104)θk,l, ai(cid:105))2 and reduce its error, leading to an accurate estimate when these terms are summed together. i σ2 i 2.4.2 Computational Complexity At each round k ∈ [K], the learner executes the arm elimination step (Line 11 in Algorithm 1) for O(L) times, and then applies Sherman-Morrison formula (Golub and Van Loan, 2013) and matrix 9 (cid:18) (cid:80) multiplication to update the estimator in O(d2) time (Line 19). Note that we need to compute the confidence radius at each round in Line 19, which will take O(k) time if we compute it directly. However, we can compute (cid:100)Vark+1,(cid:96) by (cid:100)Vark+1,(cid:96) = (cid:80) wiriai + (cid:19) (cid:98)θk+1,(cid:96), where the first term can be computed in O(1) time at each round, (cid:98)θ(cid:62) k+1,(cid:96) the second term can be computed in O(d) time by maintaining the prefix sum of wiri * ai and the third term can be computed in O(d2) time by maintaining the value of the weighted covariance matrix. By adding these steps together, we can conclude that the time complexity of Algorithm 1 is O(K|D|Ld2). k+1,(cid:96) * (cid:80) i − 2 (cid:98)θ(cid:62) i aia(cid:62) i i∈Ψk+1,(cid:96) i∈Ψk+1,(cid:96) i∈Ψk+1,(cid:96) i r2 w2 w2 2.5 Regret Bounds We provide the regret guarantee of Algorithm 1 in the following theorem. Theorem 2.3. Suppose that for all k ≥ 1 and all a ∈ Dk, (cid:107)a(cid:107)2 ≤ A, (cid:107)θ∗(cid:107)2 ≤ 1, (cid:104)a, θ∗(cid:105) ∈ [−1, 1]. If {βk,(cid:96)}k≥1,(cid:96)∈[L] is defined in (2.3) and α = 1/(R * K3/2), then the cumulative regret of Algorithm 1 is bounded as follows with probability at least 1 − 3δ: Regret(K) = (cid:101)O (cid:18) (cid:118) (cid:117) (cid:117) (cid:116) d K (cid:88) k=1 (cid:19) σ2 k + dR + d . . Remark 2.4. If we treat R as a constant, the regret can be simplified as (cid:101)O Compared with Weighted OFUL+ (Zhou and Gu, 2022), our algorithm achieves the same order of regret guarantee and does not require any prior knowledge about the variance σk. Compared with to VOFUL2 (Kim et al., 2021), our SAVE algorithm improves the regret from (cid:101)O (cid:113)(cid:80)K k=1 σ2 d1.5 k + d2(cid:17) k=1 σ2 (cid:16) (cid:16) (cid:113)(cid:80)K d (cid:17) k + d (cid:16) (cid:113)(cid:80)K d (cid:17) k + d k=1 σ2 . Furthermore, VOFUL2 needs to perform the arm elimination for each possible (cid:101)O direction μ in the d-dimension unit ball, which requires an exponential computational time (See the discussion in Section 2.2). Remark 2.5. Consider the deterministic reward setting where σk = 0 holds for all round k ∈ [K]. If we treat R as a constant, then Theorem 2.3 suggests an (cid:101)O(d) regret guarantee, which matches the Ω(d) lower bound up to logarithmic factors (Chu et al., 2011). 3 Variance-Aware Learning for Linear Mixture MDPs In this section, we apply the techniques developed in Section 2 to reinforcement learning, and propose a variance-aware algorithm for linear mixture MDPs. 3.1 Problem Setup Episodic MDPs. A time-homogenous episodic MDP (Puterman, 2014) is denoted by a tuple M = M (S, A, H, r, P). Here, S is the state space, A is a finite action space, H is the planning horizon (i.e., length of each episode), r : S × A → [0, 1] is a deterministic reward function, P(s(cid:48)|s, a) is the transition probability function denoting the probability of transition from state s to state s(cid:48) 10 Algorithm 2 UCRL-AVE Require: Regularization parameter λ > 0, α > 0, B, an upper bound on the (cid:96)2-norm of θ∗. 1: Set L = (cid:100)log2(1/α)(cid:101). 2: Initialize: (cid:98)Σ0,H+1,(cid:96) ← 2−2(cid:96)λ * I, (cid:98)b0,H+1,(cid:96) ← 0, (cid:98)θ1,(cid:96) ← 0 for all (cid:96) ∈ [L]. 3: for k = 1, . . . , K do Vk,H+1(*) ← 0. 4: 5: Update the current estimators: (cid:98)Σk,1,(cid:96) ← (cid:98)Σk−1,H+1,(cid:96), (cid:98)bk,1,(cid:96) ← (cid:98)bk−1,H+1,(cid:96), (cid:98)θk,(cid:96) ← (cid:98)Σ−1 k,1,(cid:96)(cid:98)bk,1,(cid:96) for all (cid:96) ∈ [L]. Compute (cid:98)βk,(cid:96) according to (3.4). for h = H, . . . , 1 do r(*, *) + (cid:10) Qk,h(*, *) ← min πk(*, h) ← argmaxa∈A Qk,h(*, a), Vk,h(*) ← maxa∈A Qk,h(*, a). (cid:98)θk,(cid:96), φVk,h+1(*, *)(cid:11) + (cid:98)βk,(cid:96) 1, min(cid:96)∈[L] (cid:110) (cid:104) (cid:13)φVk,h+1(*, *)(cid:13) (cid:13) (cid:13) (cid:98)Σ−1 k,1,(cid:96) (cid:105)(cid:111) . 6: 7: 8: 9: 14: 15: 16: 17: 18: 19: 20: 21: . end for 10: 11: Observe sk 1 12: for h = 1, . . . H do Take action ak (cid:110) 13: Lk,h ← h ← πk(sk (cid:13) (cid:13)φVk,h+1(sk h, h) and observe sk (cid:12) h)(cid:13) h, ak (cid:12) (cid:96) ∈ [L] (cid:12) (cid:40) Lk,h = ∅ L + 1, min (Lk,h) , otherwise (cid:13)Σ−1 k,h,(cid:96) . h+1 . ≥ 2−(cid:96)(cid:111) . Set (cid:96)k,h ← if (cid:96)k,h (cid:54)= L + 1 then wk,h ← 2−(cid:96)k,h/(cid:13) (cid:13)φVk,h+1(sk . h)(cid:13) h, ak (cid:13)Σ−1 k,h,(cid:96)k,h k,hφVk,h+1(sk k,hVk,h+1(sk (cid:98)Σk,h+1,(cid:96)k,h ← (cid:98)Σk,h,(cid:96)k,h + w2 (cid:98)bk,h+1,(cid:96)k,h ← (cid:98)bk,h,(cid:96)k,h + w2 h, ak h)φVk,h+1(sk h, ak h+1)φVk,h+1(sk h, ak h). h)(cid:62). end if (cid:98)Σk,h+1,(cid:96) ← (cid:98)Σk,h,(cid:96), (cid:98)bk,h+1,(cid:96) ← (cid:98)bk,h,(cid:96) for all (cid:96) ∈ [L] and (cid:96) (cid:54)= (cid:96)k,h. end for 22: 23: end for under action a. A policy π : S × [H] → A is a function which maps a state s and the stage number h to an action a. For any policy π and stage h ∈ [H], we define the following action-value function Qπ h (s) as follows h(s, a) and value function V π (cid:20) H (cid:88) h(s, a) = r(s, a) + E Qπ h(cid:48)=h+1 r(cid:0)sh(cid:48), π(sh(cid:48), h(cid:48))(cid:1) (cid:12) (cid:12) sh = s, ah = a (cid:12) (cid:12) (cid:21) , V π h (s) = Qπ h(s, π(s, h)), and the optimal where sh(cid:48)+1 ∼ P(*|sh(cid:48), ah(cid:48)). We further define the optimal value function V ∗ h action-value function Q∗ h(s, a). In addition, for any h (s) and Q∗ h function V : S → R, we denote [PV ](s, a) = Es(cid:48)∼P(*|s,a)V (s(cid:48)). Therefore, for each stage h ∈ [H] and policy π, we have the following Bellman equation, as well as the Bellman optimality equation: h(s, a) = maxπ Qπ h (s) = maxπ V π as V ∗ Qπ h(s, a) = r(s, a) + [PV π h+1](s, a), Q∗(s, a) = r(s, a) + [PV ∗ h+1](s, a), H+1(*) = V ∗ where V π its actions throughout the episode. At each stage h ∈ [H], the agent observes the state sk h H+1(*) = 0. At the beginning of episode k, the agent chooses a policy π to guide , chooses 11 an action by the policy π and observes the next state with sk h+1 ∼ P(*|sk h, ak h). Following previous work on horizon-free regret in linear mixture MDPs (Zhang et al., 2021b; Kim et al., 2021; Zhou and Gu, 2022), we consider the setting where the total reward (i.e., return of an episode) is bounded by 1. Assumption 3.1. For any policy π, let (sh, ah)H be one trajectory following π, then h=1 (cid:88) h∈[H] r(sh, ah) ≤ 1 almost surely. For simplicity, let [VV ] (s, a) = (cid:2)PV 2(cid:3) (s, a) − ([PV ] (s, a))2 denote the conditional variance of V conditioned on (s, a). We define the following instance-dependent quantity: K (cid:88) Var∗ K = H (cid:88) [VV ∗ h+1](sk h, ak h). (3.1) k=1 h=1 The quantity (3.1) characterizes the stochasticity of the MDP under the optimal policy. For a deterministic MDP where the transition function is deterministic , we have Var∗ K = 0. Similar quantities have been considered in Maillard et al. (2014); Zanette and Brunskill (2019), and the same quantity has been proposed by a concurrent work (Zhou et al., 2023) on tabular RL. Linear Mixture MDPs. We consider a special MDP class called linear mixture MDPs. Definition 3.2 (Episodic linear mixture MDPs, Jia et al. 2020; Ayoub et al. 2020). An episodic MDP M(S, A, H, r, P) is a homogeneous, episodic B-bounded linear mixture MDP if there exists vectors θ∗ ∈ Rd with (cid:107)θ∗(cid:107)2 ≤ B and φ(*|*, *) satisfying (3.2), such that for each (s, a) ∈ S × A, s(cid:48) ∈ S and stage h ∈ [H], P(s(cid:48)|s, a) = (cid:10)φ(s(cid:48)|s, a), θ∗(cid:11). Moreover, φ satisfies that for any bounded function V : S → [0, 1] and any tuple (s, a) ∈ S × A, (cid:107)φV (s, a)(cid:107)2 ≤ 1, where φV (s, a) := (cid:88) s(cid:48)∈S φ(s(cid:48)|s, a)V (s(cid:48)). (3.2) The goal of the agent is to minimize the following cumulative regret at the first K rounds: Regret(K) = (cid:88) k∈[K] (cid:2)V ∗ 1 (sk 1) − V πk 1 (sk 1)(cid:3). 3.2 The Proposed Algorithm We present an adaptive variance-aware algorithm named UCRL with Adaptive Variance-Aware Exploration (UCRL-AVE) in Algorithm 2. The backbone of our algorithm is the value-targeted- regression scheme proposed by UCRL-VTR (Jia et al., 2020; Ayoub et al., 2020). In detail, Algorithm 2 aims to estimate the optimal value function Q∗ by Qk,h, utilizing the Bellman optimal equation. h Since PVk,h+1 is not attractable (P is unknown), Algorithm 2 uses the fact that PVk,h+1(s, a) = (cid:104)φVk,h+1(s, a), θ∗(cid:105) is a linear function of the feature φVk,h+1(s, a), and estimates PVk,h+1(s, a) by a plug-in estimator (cid:104)φVk,h+1(s, a), (cid:98)θk(cid:105), where (cid:98)θk is the estimate of θ∗. Then UCRL-VTR computes Qk,h by the upper confidence bound of the empirical estimator with truncation (Line 8). The main difference between Algorithm 2 and UCRL-VTR is the construction of (cid:98)θk: instead of using a single estimate, Algorithm 2 maintains L estimates (cid:98)θk,(cid:96), constructed on a multi-layer structure of feature vectors. We highlight several important technical innovations here. 12 Multi-layer structure of feature vectors. We first demonstrate how Algorithm 2 utilizes L number of estimates (cid:98)θk,(cid:96) to build the value function estimate Qk,h, then we show how Algorithm 2 updates (cid:98)θk,(cid:96) accordingly. Algorithm 2 constructs Qk,h as the minimum of L optimistic estimates computed by (cid:104) (cid:98)θk,(cid:96), φVk,h+1(cid:105). The minimum step makes the estimate Qk,h tighter than that in UCRL-VTR. Similar to Algorithm 1, (cid:98)θk,l is the solution to some regression problem over the features φV (s, a) and their corresponding target values. For simplicity, we define the following subsets of [K] × [H]: Ψk,(cid:96) = {(i, h) ∈ [k − 1] × [H]|(cid:96)i,h = (cid:96)} , for k ∈ [K + 1], (cid:96) ∈ [L + 1], (3.3) (sk h, ak which represents the indices of feature vectors in layer (cid:96) at the beginning of round k. Note that (cid:98)θk,(cid:96) h) is added to the feature set Ψk,(cid:96). The rule that whether to will be updated if the feature φV k add such a feature or not is based on the uncertainty of φV k h) within the feature set Ψk,(cid:96), which is similar to the multi-layer structure adopted by He et al. (2021b) for uniform-PAC bounds in linear MDPs. Finally, (cid:98)θk,(cid:96) is computed as the solution to the weighted regression problem over the feature set Ψk,(cid:96), where the weight wk,h is selected to guarantee that (cid:13) = 2−(cid:96)k,h, similar to that in Algorithm 1. (cid:13)wk,hφVk,h+1(sk h, ak h, ak (cid:13)Σ−1 h)(cid:13) k,h,(cid:96)k,h (sk h+1 h+1 Adaptive variance-aware exploration. Similar to Algorithm 1, we will also face the problem to construct a confidence set of θ∗ without knowing the variance of value functions Vk,h+1. Here we take the same approach: to replace the variance of Vk,h+1, P[Vk,h+1 − PVk,h+1]2 with its one-point empirical estimate (Vi,h+1(si h)(cid:105))2. In detail, the confidence radius is: h+1) − (cid:104) (cid:98)θk,l, φVi,h+1(si (cid:113)(cid:0)8(cid:100)Vark,(cid:96) + 8 log(4k2H 2L/δ) + 2−2(cid:96)+5 * λB2(cid:1) log(4k2H 2L/δ) h, ai (cid:98)βk,(cid:96) := 16 * 2−(cid:96) + 6 * 2−(cid:96) log(4k2H 2L/δ) + 2−(cid:96) λ * B, (3.4) √ where (cid:100)Vark,(cid:96) = (cid:40) 8 (cid:80) |Ψk,(cid:96)|, (i,h)∈Ψk,(cid:96) w2 i,h (cid:0)Vi,h+1(si h+1) − (cid:104) (cid:98)θk,(cid:96), φVi,h+1(si h, ai h)(cid:105)(cid:1)2 , 2(cid:96) ≥ 64(cid:112)log(4k2H 2L/δ), otherwise. We can adopt the method discussed in Subsection 2.4.2 to compute (cid:100)Vark,(cid:96) in an efficient way. We call the construction of the confidence set along with its radius (cid:98)βk,(cid:96) as adaptive variance-aware exploration. Compared with UCRL-VTR+ (Zhou et al., 2021a) and HF-UCRL-VTR+ (Zhou and Gu, 2022), our algorithm does not need to estimate the conditional variance using another ridge regression estimator on the second-order moment of value functions. Furthermore, in contrast to HF-UCRL-VTR+ (Zhou and Gu, 2022), our algorithm does not explicitly estimate the high-order moments of value functions. Thus, our algorithm is much simpler. It is also worth noting that the multi-layer structure in Algorithm 2 is an alternative of the SupLinUCB-type design in Algorithm 1. Since linear bandits can be seen as a special case of linear mixture MDPs, Algorithm 2 implies another algorithm for heteroscedastic linear bandits, which enjoys the same regret guarantee as Algorithm 1. 3.3 Regret Bounds We provide the regret guarantee of Algorithm 2 in the following theorem. 13 Theorem 3.3. Set (cid:98)βk,(cid:96) as in (3.4), α = 1/(KH)3/2 and λ = 1/B2 in Algorithm 2. Then with probability at least 1 − (4(cid:100)log2 2HK(cid:101) + 9)δ , the regret of Algorithm 2 is bounded by: Regret(K) = (cid:101)O (cid:16) d(cid:112)Var∗ K + d2(cid:17) . Corollary 3.4. Under the same conditions as Theorem 3.3, with probability at least 1−(4(cid:100)log2 2HK(cid:101)+ 10)δ, the regret of Algorithm 2 is bounded by: Regret(K) = (cid:101)O(cid:0)d √ K + d2(cid:1). Remark 3.5. Our regret given by Theorem 3.3 is variance-dependent, which means that the regret of UCRL-AVE is smaller when the conditional variance of the optimistic value function is smaller. In the deterministic case where all the transitions in the MDP is deterministic, our regret reduces to (cid:101)O(d2), with only a logarithmic dependence on K. Additionally, the regret in Corollary 3.4 matches the regret of HF-UCRL-VTR+ proposed by Zhou and Gu (2022), which is the worst-case regret and matches the minimax lower bound (Zhou and Gu, 2022). 4 Conclusion and Future Work In this paper, we consider variance-aware learning in linear bandits and linear mixture MDPs. We propose a computationally efficient algorithm SAVE for heteroscedastic linear bandits, which achieves a variance-dependent regret, matching the minimax regret bounds in both the worst case and the deterministic reward case. For linear mixture MDPs, we further extend our techniques and propose an algorithm dubbed UCRL-AVE, attaining a tighter problem-dependent horizon-free regret bound. We leave for future work the generalization of our work to RL with nonlinear function approximation. A Proof of Theorem 2.1 Proof. For simplicity, we introduce the following definitions: d0 = 0, dk = k (cid:88) i=1 xiηi, q0 = 0, qk = (cid:107)dk(cid:107)Z−1 k , Ik = 1{0 ≤ s ≤ k, qs ≤ βs}, where k ≥ 1 and we further define β0 = 0, E0 = 1. According to these definitions, the term qk can be upper bounded by the following decomposition: k = (dk−1 + xkηk)(cid:62)Z−1 q2 = d(cid:62) k−1Z−1 k dk−1 + 2ηkx(cid:62) k (dk−1 + xkηk) k Z−1 k dk−1 (cid:125) (cid:123)(cid:122) I1,k + η2 (cid:124) (cid:124) kx(cid:62) k Z−1 (cid:123)(cid:122) I2,k k xk (cid:125) ≤ q2 k−1 + I1,k + I2,k, (A.1) where the inequality holds since Zk = Zk−1 + xkx(cid:62) inversion lemma, we have the following equation: k (cid:23) Zk−1. For the term I1,k, from the matrix I1,k = 2ηk (cid:18) k Z−1 x(cid:62) k−1dk−1 − 14 xkZ−1 k−1xkx(cid:62) 1 + (cid:107)xk(cid:107)2 k Z−1 k−1dk−1 (cid:19) Z−1 k−1 (cid:107)xk(cid:107)2 k Z−1 x(cid:62) k−1dk−1 (cid:19) Z−1 k−1 1 + (cid:107)xk(cid:107)2 Z−1 k−1 (cid:18) = 2ηk = 2ηk * k Z−1 x(cid:62) k−1dk−1 − k−1dk−1 k Z−1 x(cid:62) 1 + (cid:107)xk(cid:107)2 Z−1 k−1 . Taking a summation over the term I1,k with respect to the indicator function Ek−1, we have the following equation: k (cid:88) i=1 I1,i * Ii−1 = 2 k (cid:88) i=1 ηi * i−1di−1 i Z−1 x(cid:62) 1 + (cid:107)xi(cid:107)2 Z−1 i−1 Ii−1. (A.2) Now, we can derive an upper bound for this summation by Freedman's inequality. In detail, for each round i ∈ [k], we have (cid:12) (cid:12) (cid:12) ηi * (cid:12) (cid:12) i−1di−1 i Z−1 x(cid:62) 1 + (cid:107)xi(cid:107)2 Z−1 i−1 Ii−1 (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) ≤ R (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:107)xi(cid:107)Z−1 i−1 (cid:107)di−1(cid:107)Z−1 i−1 1 + (cid:107)xi(cid:107)2 Z−1 i−1 (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) Ii−1 ≤ R (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) βi−1 (cid:107)xi(cid:107)Z−1 1 + (cid:107)xi(cid:107)2 i−1 Z−1 i−1 (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) ≤ Rβkρ, where the first inequality holds due to Cauchy-Schwarz inequality, the second inequality holds due to the definition of indicator function Ei−1 and the last inequality holds due to ρ ≥ (cid:107)xi(cid:107)Z−1 . In addition, for each round i ∈ [k], we have i−1 (cid:34) E ηi * i−1di−1 i Z−1 x(cid:62) 1 + (cid:107)xi(cid:107)2 Z−1 i−1 (cid:35) (cid:12) (cid:12) Gk (cid:12) (cid:12) Ii−1 = 0, and the summation of variance is upper bounded by (cid:34)(cid:18) E ηi * k (cid:88) i=1 i−1di−1 i Z−1 x(cid:62) 1 + (cid:107)xi(cid:107)2 Z−1 i−1 Ii−1 (cid:35) (cid:19)2(cid:12) (cid:12) (cid:12) Gi (cid:12) (cid:12) = ≤ ≤ k (cid:88) i=1 k (cid:88) i=1 (cid:33)2 Ii−1 E[η2 i |Gi] i−1di−1 (cid:32) i Z−1 x(cid:62) 1 + (cid:107)xi(cid:107)2 (cid:32) (cid:107)xi(cid:107)Z−1 i−1 Z−1 i−1 (cid:107)di−1(cid:107)Z−1 i−1 Ii−1 (cid:33)2 E[η2 i |Gi] 1 + (cid:107)xi(cid:107)2 Z−1 i−1 (cid:33)2 k (cid:88) (cid:32) (cid:107)xi(cid:107)Z−1 i−1 βi−1 i=1 1 + (cid:107)xi(cid:107)2 Z−1 i−1 E[η2 i |Gi] E[η2 i |Gi] k (cid:88) ≤ β2 kρ2 i=1 kρ2vk. ≤ β2 where the first inequality holds due to Cauchy-Schwarz inequality, the second inequality holds due to the definition of indicator function Ei−1, the third inequality holds due to ρ ≥ (cid:107)xi(cid:107)Z−1 and the last inequality holds due to (cid:80)k i−1 E[η2 i |Gi] ≤ vk. i=1 15 Therefore, using Freedman's inequality, for any k ≥ 1, with probability 1 − δ/(4k2), we have I1,i * Ii−1 ≤ 2 2β2 kρ2vk log(4k2/δ) + 4/3 * Rβkρ log(4k2/δ) (cid:113) k (cid:88) i=1 ≤ ≤ 1 4 3 4 k + 32 (cid:0)ρ2vk log(4k2/δ)(cid:1) + β2 1 4 k + 9R2ρ2[log(4k2/δ)]2 β2 β2 k, where the first inequality holds due to Lemma D.4 and the second inequality holds due to Young's inequality. After taking a union bound for all k > 1, it can then be further deduced that with probability 1 − δ/2, for all k ≥ 1, we have k (cid:88) i=1 I1,i * Ii−1 ≤ 3 4 β2 k. (A.3) For simplicity, let EI1 through the following calculation: be the events that (A.3) holds. Then we bound the summation of I2,k over k t (cid:88) i=1 I2,k ≤ k (cid:88) i=1 i ρ2 = ρ2vk + ρ2 η2 k (cid:88) i=1 (cid:2)η2 i − E[η2 i |Gi](cid:3), (A.4) where the first inequality holds due to ρ ≥ (cid:107)xi(cid:107)Z−1 using Freedman's inequality in Lemma D.4. Notice that, for each round i ∈ [k], we have . Still, we can bound the second term in (A.4) i−1 (cid:104)(cid:0)E[η2 E i |Gi] − η2 i (cid:12) (cid:12)E(cid:2)η2 (cid:1)2|Gi i |Gi](cid:3) − η2 i (cid:105) = (cid:0)E[η2 (cid:12) (cid:12) ≤ R2, E i |Gi](cid:1)2 (cid:104)(cid:0)E[η2 i |Gi] − η2 i (cid:105) (cid:1)|Gi = 0, −2E[η2 i |Gi] * E[η2 i |Gi] + E[η4 i |Gi] ≤ R2E[η2 i |Gi], According to Freedman's Inequality, for any k, with probability 1 − δ/(4k2), we have k (cid:88) i=1 (cid:0)η2 i − E[η2 i |Gi](cid:1) ≤ (cid:112) 2R2 log(4k2/δ)vk + 2/3 * R2 log(4k2/δ). (A.5) Taking a union bound over all round k ≥ 1, with probability at least 1 − δ/2, for all k ≥ 1, we have k (cid:88) i=1 I2,k ≤ ρ2vk + ρ2 k (cid:88) (cid:2)η2 i − E[η2 i |Gi](cid:3) i=1 (cid:112) ≤ ρ2vk + ρ2R ≤ 3 (cid:0)ρ2vk log(4k2/δ)(cid:1) + 2R2ρ2[log(4k2/δ)]2 2vk log(4k2/δ) + * ρ2 * R2 log(4k2/δ) 2 3 ≤ 1 4 β2 k. (A.6) where the first inequality holds due to (A.4), the second inequality holds due to (A.5) and the third be the events that (A.6) holds. inequality holds due to Young's inequality. For simplicity, let EI2 16 holds, whose probability is no less than In the remaining proof, we assume that events EI1 1 − δ by the union bound. Under this situation, for any round k ≥ 0, if Ii−1 = 1 holds for all i ∈ [k], then according to (A.1), we have and EI2 k+1 (cid:88) i=1 k+1 (cid:88) qk+1 ≤ = I1,i + k+1 (cid:88) i=1 I2,i I1,i * Ii−1 + k+1 (cid:88) i=1 I2,i i=1 ≤ β2 k+1, . This result indicates that where the last inequality holds due to the definition of events EI1 Ek+1 = 1. Therefore, by induction, we can deduce that with probability at least 1 − δ, for all k ≥ 1, we have and EI2 (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) k (cid:88) i=1 xiηi (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)Z−1 k ≤ βk. Furthermore, the estimation error between underlying vector μ∗ and estimator μk can be upper bounded by: (cid:107)μk − μ∗(cid:107)Zk = (cid:107)Z−1 k bk − Z−1 k Zkμ∗(cid:107)Zk k (cid:88) i=1 xix(cid:62) i μ∗ − λZ−1 k μ∗ (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)Zk xi(yi − x(cid:62) i μ∗) − λZ−1 k μ∗ (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)Zk √ λ(cid:107)μ∗(cid:107)2 + = = ≤ k k (cid:88) (cid:13) (cid:13) k bk − Z−1 Z−1 (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) Z−1 (cid:13) (cid:13) k (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13) (cid:13)Z−1 λ(cid:107)μ∗(cid:107)2, k (cid:88) xiηi i=1 i=1 √ k ≤ βk + where the first equality follows from the definition of μk, the second equality holds due to the definition of Zk and the first inequality holds by triangle inequality with the fact that Zk (cid:23) λI. Thus, we complete the proof of Theorem 2.1. B Proofs from Section 2 B.1 Proof of Theorem 2.3 Lemma B.1. Suppose that (cid:107)θ∗(cid:107)2 ≤ 1. In Algorithm 1, with probability at least 1 − δ, the following statement holds for all round k ≥ 1 and layer (cid:96) ∈ [L]: (cid:107) (cid:98)θk,(cid:96) − θ∗(cid:107) (cid:98)Σk,(cid:96) ≤ 16 * 2−(cid:96) (cid:115) (cid:88) i∈Ψk,(cid:96) w2 i σ2 i log(4k2L/δ) + 6 * 2−(cid:96)R log(4k2L/δ) + 2−(cid:96)+1. 17 For simplicity, we denote Econf as the event such that the result in Lemma B.1 holds in the remaining section. Proof. We first consider a fixed layer (cid:96) ∈ [L]. Suppose that k is an arbitrary round satisfying k ∈ = 2−(cid:96). Ψk+1,(cid:96). Notice that in Line 14 (Algorithm 1), we introduce weight wk to guarantee (cid:107)wkak(cid:107) Then we can applying Theorem 2.1 for the layer (cid:96). In detail, for each k ∈ ΨK+1,(cid:96), we have (cid:98)Σ−1 k,(cid:96) (cid:107)wkak(cid:107) (cid:98)Σ−1 k,(cid:96) = 2−(cid:96), E[w2 k(cid:15)2 k|Fk] ≤ w2 k E[(cid:15)2 k|Fk] ≤ w2 kσ2 k, |wk(cid:15)k| ≤ |(cid:15)k| ≤ R, where the last inequality holds due to the fact that wk = 2−(cid:96)/(cid:107)ak(cid:107) 2.1, we can deduce that with probability at least 1 − δ/L, for all round k ∈ ΨK+1,(cid:96), (cid:98)Σ−1 k,(cid:96) ≤ 1. According to Theorem (cid:107) (cid:98)θk,(cid:96) − θ∗(cid:107) (cid:98)Σk,(cid:96) ≤ 16 * 2−(cid:96) (cid:115) (cid:88) i∈Ψk,(cid:96) w2 i σ2 i log(4k2L/δ) + 6 * 2−(cid:96)R log(4k2L/δ) + 2−(cid:96)+1. Finally, after taking a union bound for all layer (cid:96) ∈ [L], we complete the proof of B.1. Lemma B.2. Suppose that the event Econf defined in Lemma B.1 occurs. If { (cid:98)βk,(cid:96)}k≥1,(cid:96)∈[L] satisfies (cid:98)βk,(cid:96) ≥ 16 * 2−(cid:96) (cid:115) (cid:88) w2 i σ2 i log(4k2L/δ) + 6 * 2−(cid:96)R log(4k2L/δ) + 2−(cid:96)+1, i∈Ψk,(cid:96) then for all k ≥ 1 and (cid:96) ∈ [L] such that Ak,(cid:96) exists, we have a∗ Proof. Fix an arbitrary round k. If layer (cid:96) = 1, then a∗ (cid:96) > 1, we prove lemma B.2 by induction. Assume that a∗ Ak,(cid:96)1+1 exists. k ∈ Ak,(cid:96). k ∈ Dk = Ak,(cid:96) trivially holds. Then for layer holds for some (cid:96)1 ∈ Z+ and k ∈ Ak,(cid:96)1 By Lemma B.1, for all a ∈ Ak,(cid:96)1 (cid:12) (cid:12) (cid:12)(cid:104)a, (cid:98)θk,(cid:96)1(cid:105) − (cid:104)a, θ∗(cid:105) (cid:12) (cid:12) (cid:12) ≤ (cid:107)a(cid:107) , we have (cid:13) (cid:13) (cid:13) (cid:98)θk,(cid:96)1 − θ∗(cid:13) (cid:13) (cid:13) (cid:98)Σk,(cid:96)1 ≤ (cid:98)βk,(cid:96)(cid:107)a(cid:107) , (cid:98)Σ−1 k,(cid:96)1 (B.1) (cid:98)Σ−1 k,(cid:96)1 where the first inequality holds due to Cauchy-Schwarz inequality and the last inequality holds due to the definition of events Econf . According to Line 10 of Algorithm 1, Ak,(cid:96)1+1 exists only if . Therefore, the sub-optimality gap in (B.1) can be further (cid:107)a(cid:107) bounded as follows: ≤ 2−(cid:96)1 holds for all a ∈ Ak,(cid:96)1 (cid:98)Σ−1 k,(cid:96)1 For short, let amax = argmaxa(cid:48)∈Ak,(cid:96)1 (cid:12) (cid:12)(cid:104)a, (cid:98)θk,(cid:96)1(cid:105) − (cid:104)a, θ∗(cid:105) (cid:12) (cid:12) (cid:12) (cid:12) ≤ (cid:98)βk,(cid:96)(cid:107)a(cid:107) (cid:98)Σ−1 k,(cid:96)1 (cid:104)a(cid:48), (cid:98)θk,(cid:96)1(cid:105). Then for the optimal action a∗ ≤ 2−(cid:96)1 * (cid:98)βk,(cid:96)1. k ∈ Ak,l1 (B.2) , we have (cid:104)a∗ = (cid:104)a∗ (cid:104)a(cid:48), (cid:98)θk,(cid:96)1(cid:105) k, (cid:98)θk,(cid:96)1(cid:105) − max a(cid:48)∈Ak,(cid:96)1 k, (cid:98)θk,(cid:96)1(cid:105) − (cid:104)amax, (cid:98)θk,(cid:96)1(cid:105) (cid:12) (cid:12)(cid:104)a∗ k, θ∗(cid:105) − (cid:104)amax, θ∗(cid:105) − (cid:12) ≥ (cid:104)a∗ k, (cid:98)θk,(cid:96)1(cid:105) − (cid:104)a∗ (cid:12) k, θ∗(cid:105) (cid:12) (cid:12) − (cid:12) (cid:12)(cid:104)amax, (cid:98)θk,(cid:96)1(cid:105) − (cid:104)amax, θ∗(cid:105) (cid:12) (cid:12) (cid:12) (cid:12) ≥ −2−(cid:96)1+1 * (cid:98)βk,(cid:96)1, where the last inequality holds due to (B.2) with the fact that (cid:104)a∗ k, θ∗(cid:105) ≥ (cid:104)amax, θ∗(cid:105). Therefore, according to the Line 11 (Algorithm 1), the optimal action θ∗ ∈ Ak,(cid:96)1+1. Therefore, by induction, we complete the proof of Lemma B.2 18 Lemma B.3. Suppose for all k ≥ 1 and all a ∈ Dk, we have (cid:107)a(cid:107)2 ≤ A, (cid:107)θ∗(cid:107)2 ≤ 1. If Econf occurs and {βk,(cid:96)}k≥1,(cid:96)∈[L] satisfies the requirement in Lemma B.2, then for all (cid:96) ∈ [L]\{1}, the regret incurred by the index set ΨT +1,(cid:96) is bounded as follows : (cid:88) (cid:0)(cid:104)a∗ τ , θ∗(cid:105) − (cid:104)aτ , θ∗(cid:105)(cid:1) ≤ (cid:101)O (cid:16) d * 2(cid:96) * (cid:98)βK,(cid:96)−1 (cid:17) . τ ∈ΨK+1,(cid:96) Proof. For all round τ ∈ ΨK+1,(cid:96), we can deduce that aτ , a∗ to Line 11 of Algorithm 1, we have τ ∈ Aτ,(cid:96) by Lemma B.2. Also, according Besides, from Line 10 and the round τ ∈ ΨK+1,(cid:96), we have (cid:104)a∗ τ , (cid:98)θτ,(cid:96)−1(cid:105) − (cid:104)aτ , (cid:98)θτ,(cid:96)−1(cid:105) ≤ 2−(cid:96)+2 (cid:98)βτ,(cid:96)−1. (cid:107)aτ (cid:107) (cid:98)Σ−1 τ,(cid:96)−1 ≤ 2−(cid:96)+1, (cid:107)a∗ τ (cid:107) (cid:98)Σ−1 τ,(cid:96)−1 ≤ 2−(cid:96)+1. We further compute (cid:104)a∗ τ , θ∗(cid:105) − (cid:104)aτ , θ∗(cid:105) ≤ (cid:104)a∗ ≤ (cid:104)a∗ τ , (cid:98)θτ,(cid:96)−1(cid:105) + (cid:12) (cid:12)(cid:104)a∗ (cid:12) τ , (cid:98)θτ,(cid:96)−1 − θ∗(cid:105) (cid:12) (cid:12) (cid:12) − (cid:104)aτ , (cid:98)θτ,(cid:96)−1(cid:105) + (cid:12) (cid:12) (cid:12)(cid:104)aτ , (cid:98)θτ,(cid:96)−1 − θ∗(cid:105) (cid:12) (cid:12) (cid:12) (cid:13) (cid:13) τ , (cid:98)θτ,(cid:96)−1(cid:105) − (cid:104)aτ , (cid:98)θτ,(cid:96)−1(cid:105) + (cid:107)a∗ τ (cid:107) (cid:13) (cid:98)θτ,(cid:96)−1 − θ∗(cid:13) (cid:98)Σ−1 ≤ 2−(cid:96)+2 * (cid:98)βτ,(cid:96)−1 + 2−(cid:96)+1 * (cid:98)βτ,(cid:96)−1 + 2−(cid:96)+1 * (cid:98)βτ,(cid:96)−1 = 8 * 2−(cid:96) * (cid:98)βτ,(cid:96)−1, (cid:13) (cid:13) (cid:98)Στ,(cid:96)−1 + (cid:107)aτ (cid:107) (cid:98)Σ−1 τ,(cid:96)−1 (cid:13) (cid:13) (cid:13) (cid:98)θτ,(cid:96)−1 − θ∗(cid:13) (cid:13) (cid:13) (cid:98)Στ,(cid:96)−1 τ,(cid:96)−1 (B.3) (B.4) (B.5) where the second inequality holds due to Cauchy-Schwarz inequality and the last inequality holds due to Lemma B.1, (B.3) and (B.4). Taking the summation over τ ∈ ΨK+1,(cid:96), we have (cid:88) τ ∈ΨK+1,(cid:96) (cid:0)(cid:104)a∗ τ , θ∗(cid:105) − (cid:104)aτ , θ∗(cid:105)(cid:1) ≤ 8 * 2−(cid:96) * (cid:98)βK,(cid:96)−1 |ΨK+1,(cid:96)| ≤ 8 * 2(cid:96) * (cid:98)βK,(cid:96)−1 * (cid:88) (cid:107)wk * ak(cid:107)2 (cid:98)Σ−1 k,(cid:96) ≤ 8 * 2(cid:96) * (cid:98)βK,(cid:96)−1 * 2d log 1 + 22(cid:96)K * A2/d (cid:17) , k∈ΨK+1,(cid:96) (cid:16) where the first inequality holds due to (B.5), the second inequality holds since for all round k ∈ Ψk+1,(cid:96), the weight wk satisfies (cid:107)wkak(cid:107) = 2−(cid:96), and the last inequality holds due to Lemma D.2. (cid:98)Σ−1 k,(cid:96) Lemma B.4. Let weight wi be defined in Algorithm 1. With probability at least 1 − 2δ, for all k ≥ 1, (cid:96) ∈ [L], the following two inequalities hold simultaneously: (cid:88) w2 i σ2 i ≤ 2 (cid:88) w2 i (cid:15)2 i + 14 3 R2 log(4k2L/δ), i∈Ψk+1,(cid:96) (cid:88) i∈Ψk+1,(cid:96) w2 i (cid:15)2 i ≤ i∈Ψk+1,(cid:96) 3 (cid:88) 2 i∈Ψk+1,(cid:96) w2 i σ2 i + R2 log(4k2L/δ). 7 3 19 i∈Ψk+1,(cid:96) (cid:3) = 0, For simplicity, we denote Evar as the event such that the two inequalities in Lemma B.4 holds. Proof. We first consider a fixed layer (cid:96) ∈ [L]. For the gap between (cid:80) w2 i σ2 i and (cid:80) i∈Ψk+1,(cid:96) w2 i (cid:15)2 i , according to the definition, we have (cid:88) i∈Ψk+1,(cid:96) E (cid:2)w2 i ((cid:15)2 i − σ2 i )2|a1:i, r1:i−1 (cid:3) ≤ i∈Ψk+1,(cid:96) for ∀i ≥ 1, E (cid:2)(cid:15)2 i − σ2 (cid:88) i |a1:i, r1:i−1 E (cid:2)w2 i (cid:15)4 i |a1:i, r1:i−1 (cid:3) ≤ R2 (cid:88) w2 i σ2 i , i∈Ψk+1,(cid:96) where the first inequality holds due to Var[x] ≤ E[x2] and the second inequality holds due to |(cid:15)i| ≤ R and E (cid:2)(cid:15)2 and taking a union bound for all k ≥ 1 , with probability at least 1 − 2δ/L, for all k ≥ 1, the following inequality holds . Applying Freedman's inequality (Lemma D.4) with {(cid:15)2 i |a1:i, r1:i−1 i }i∈Ψk+1,(cid:96) (cid:3) = σ2 i (cid:88) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) i∈Ψk+1,(cid:96) w2 i (σ2 (cid:12) (cid:12) (cid:12) i − (cid:15)2 i ) (cid:12) (cid:12) (cid:12) ≤ ≤ (cid:115) 2R2 (cid:88) i∈Ψk+1,(cid:96) w2 i σ2 i log(4k2L/δ) + 2 3 * 2R2 log(4k2L/δ) 1 2 (cid:88) i∈Ψk+1,(cid:96) w2 i σ2 i + R2 log(4k2L/δ), 7 3 where the last inequality holds due to Young's inequality. Rearranging the above inequality, we conclude that P(Evar) ≥ 1 − 2δ by applying union bound over all (cid:96) ∈ [L]. Thus, we complete the proof of Lemma B.4. Lemma B.5. Suppose that (cid:107)θ∗(cid:107)2 ≤ 1. Let weight wi be defined in Algorithm 1. On the event Econf and Evar (defined in Lemma B.1, B.4), for all k ≥ 1, (cid:96) ∈ [L] such that 2(cid:96) ≥ 64(cid:112)log (4(k + 1)2L/δ), we have the following inequalities: (cid:88) i∈Ψk+1,(cid:96) w2 i σ2 i ≤ 8 (cid:88) (cid:16) w2 i ri − (cid:104) (cid:98)θk+1,(cid:96), ai(cid:105) (cid:17)2 + 6R2 log(4(k + 1)2L/δ) + 2−2(cid:96)+4, (cid:88) w2 i i∈Ψk+1,(cid:96) i∈Ψk+1,(cid:96) (cid:16) ri − (cid:104) (cid:98)θk+1,(cid:96), ai(cid:105) (cid:17)2 ≤ 3 2 (cid:88) i∈Ψk+1,(cid:96) w2 i σ2 i + R2 log(4k2L/δ) + 2−2(cid:96). 7 3 Proof. Let (cid:96) be an arbitrary index in [L]. By the definition of events Evar, we have (cid:88) i∈Ψk+1,(cid:96) w2 i σ2 i ≤ 2 ≤ 4 + (cid:88) i∈Ψk+1,(cid:96) (cid:88) w2 i (cid:15)2 i + 14 3 R2 log(4k2L/δ) (cid:16) w2 i ri − (cid:104) (cid:98)θk+1,(cid:96), ai(cid:105) (cid:17)2 (cid:88) + 4 (cid:104) w2 i (cid:15)i − (cid:16) ri − (cid:104) (cid:98)θk+1,(cid:96), ai(cid:105) (cid:17)(cid:105)2 i∈Ψk+1,(cid:96) 14 3 R2 log(4k2L/δ), i∈Ψk+1,(cid:96) (B.6) where the last inequality holds due to (a + b)2 ≤ 2a2 + 2b2. In addition, the gap between (cid:15)i and ri − (cid:104) (cid:98)θk+1,(cid:96), ai(cid:105) can be upper bounded by (cid:17)(cid:105)2 (cid:16) (cid:104) (cid:88) w2 i (cid:15)i − ri − (cid:104) (cid:98)θk+1,(cid:96), ai(cid:105) i∈Ψk+1,(cid:96) 20 (cid:88) (cid:16) w2 i (cid:104) (cid:98)θk+1,(cid:96) − θ∗, ai(cid:105) (cid:17)2 i∈Ψk+1,(cid:96) (cid:88) (cid:16) (cid:98)θk+1,(cid:96) − θ∗(cid:17)(cid:62) (wiai) * (wiai)(cid:62) (cid:16) (cid:98)θk+1,(cid:96) − θ∗(cid:17) i∈Ψk+1,(cid:96) (cid:16) (cid:98)θk+1,(cid:96) − θ∗(cid:17)(cid:62) (cid:115) (cid:88) 16 * 2−(cid:96) (cid:16) (cid:98)Σk+1,(cid:96) (cid:16) (cid:98)θk+1,(cid:96) − θ∗(cid:17) i log(4(k + 1)2L/δ) + 6 * 2−(cid:96)R log(4(k + 1)2L/δ) + 2−(cid:96)+1(cid:17)2 w2 i σ2 , (B.7) = = ≤ ≤ i∈Ψk+1,(cid:96) where the first inequality holds due to (cid:98)Σk+1,(cid:96) (cid:23) w2 Lemma B.1. From (B.7), when 2(cid:96) ≥ 64(cid:112)log (4(k + 1)2L/δ), we have i aia(cid:62) i and the last inequality holds due to (cid:88) (cid:104) w2 i (cid:15)i − (cid:16) ri − (cid:104) (cid:98)θk+1,(cid:96), ai(cid:105) (cid:17)(cid:105)2 i∈Ψk+1,(cid:96) ≤ 1 8 (cid:88) i∈Ψk+1,(cid:96) w2 i σ2 i + 2 (cid:16) 6 * 2−(cid:96)R log(4(k + 1)2L/δ) + 2−(cid:96)+1(cid:17)2 . (B.8) where the inequality holds due to (B.7) with the fact that (a + b)2 ≤ 2a2 + 2b2. Substituting (B.8) into (B.6), we have (cid:88) i∈Ψk+1,(cid:96) w2 i σ2 i ≤ 4 (cid:88) (cid:16) w2 i ri − (cid:104) (cid:98)θk+1,(cid:96), ai(cid:105) (cid:17)2 (cid:88) + 4 (cid:104) w2 i (cid:15)i − (cid:16) ri − (cid:104) (cid:98)θk+1,(cid:96), ai(cid:105) (cid:17)(cid:105)2 i∈Ψk+1,(cid:96) R2 log(4k2L/δ) (cid:16) w2 i ri − (cid:104) (cid:98)θk+1,(cid:96), ai(cid:105) (cid:17)2 + 1 2 (cid:88) w2 i σ2 i i∈Ψk+1,(cid:96) i∈Ψk+1,(cid:96) 14 3 (cid:88) + ≤ 4 i∈Ψk+1,(cid:96) (cid:16) + 2 6 * 2−(cid:96)R log(4(k + 1)2L/δ) + 2−(cid:96)+1(cid:17)2 (cid:88) (cid:17)2 (cid:16) w2 i ri − (cid:104) (cid:98)θk+1,(cid:96), ai(cid:105) ≤ 8 + 14 3 R2 log(4k2L/δ) + 6R2 log(4(k + 1)2L/δ) + 2−2(cid:96)+4, i∈Ψk+1,(cid:96) where the last inequality holds due to the fact that x ≤ x/2 + y implies x ≤ 2y. Thus, we complete the proof of the first part of Lemma B.5. For the second part, note that θk+1,(cid:96) is the minimizer of the following weighted ridge regression θk+1,(cid:96) ← arg min θ∈Rd (cid:88) w2 i (cid:0)ri − (cid:104)θ, ai(cid:105)(cid:1)2 + 2−2(cid:96)(cid:107)θ(cid:107)2 2. i∈Ψk+1,(cid:96) Thus, we have (cid:88) (cid:16) w2 i i∈Ψk+1,(cid:96) ri − (cid:104) (cid:98)θk+1,(cid:96), ai(cid:105) (cid:17)2 (cid:88) ≤ i∈Ψk+1,(cid:96) w2 i (cid:0)ri − (cid:104)θ∗, ai(cid:105)(cid:1)2 + 2−2(cid:96)(cid:107)θ∗(cid:107)2 2 ≤ (cid:88) i∈Ψk+1,(cid:96) 21 w2 i (cid:15)2 i + 2−2(cid:96), where the second inequality holds due to (cid:107)θ∗(cid:107)2 ≤ 1. Combining the result in Lemma B.4, we can further conclude that (cid:88) (cid:16) w2 i i∈Ψk+1,(cid:96) ri − (cid:104) (cid:98)θk+1,(cid:96), ai(cid:105) (cid:17)2 ≤ ≤ Thus, we complete the proof of Lemma B.5. (cid:88) w2 i (cid:15)2 i + 2−2(cid:96) i∈Ψk+1,(cid:96) 3 (cid:88) 2 i∈Ψk+1,(cid:96) w2 i σ2 i + R2 log(4k2L/δ) + 2−2(cid:96). 7 3 Proof of Theorem 2.3. Applying a union bound on event Econf and Evar defined in Lemma B.1 and B.4, we have P (Econf ∩ Evar) ≥ 1 − 3δ. In the remaining proof, we suppose that Econf , Evar hold 2 log2 log (cid:0)4(K + 1)2L/δ(cid:1)(cid:101) + 8. By Lemma B.3 and Lemma simultaneously. For simplicity, let (cid:96)∗ = (cid:100) 1 B.5, we have for all (cid:96) ∈ [L]\[(cid:96)∗], (cid:98)βK,(cid:96)−1 ≥ 16 * 2−((cid:96)−1) (cid:115) (cid:88) i∈ΨK,(cid:96)−1 which further implies w2 i σ2 i log(4K2L/δ) + 6 * 2−(cid:96)R log(4K2L/δ) + 2−(cid:96), (cid:88) τ ∈ΨK+1,(cid:96) ((cid:104)a∗ τ , θ∗(cid:105) − (cid:104)aτ , θ∗(cid:105)) ≤ (cid:101)O (cid:16) d * 2(cid:96) * (cid:98)βK,(cid:96)−1 (cid:17)  d (cid:118) (cid:117) (cid:117) (cid:116) K (cid:88) k=1 K (cid:88)  d (cid:118) (cid:117) (cid:117) (cid:116) k=1 ≤ (cid:101)O ≤ (cid:101)O (cid:16) w2 k rk − (cid:104) (cid:98)θK+1,(cid:96), ak(cid:105) (cid:17)2 + R2 + 1 + R    σ2 k + dR + d  , (B.9) where the first inequality holds due to Lemma B.3, the second inequality holds due to (2.3) and the last inequality follows from Lemma B.5. For each round k ∈ [K]\ (cid:16)(cid:83) that the while loop in Algorithm 1 stops. Therefore, we have (cid:96)∈[L] ΨK+1,(cid:96) (cid:17) := ΨK+1,L+1, we set (cid:96)k as the value of layer (cid:96) such (cid:88) (cid:0)(cid:104)a∗ k, θ∗(cid:105) − (cid:104)ak, θ∗(cid:105)(cid:1) ≤ (cid:88) (cid:16) (cid:17) (cid:104)ak, (cid:98)θk,(cid:96)k (cid:105) + (cid:98)βk,(cid:96)k * α − (cid:104)ak, θ∗(cid:105) k∈[K]\((cid:83) (cid:96)∈[L] ΨK+1,(cid:96)) ≤ ≤ (cid:98)βk,(cid:96)k * α + α * (cid:107)θ∗ − (cid:98)θk,(cid:96)k (cid:107) (cid:17) (cid:98)Σk,(cid:96)k k∈ΨK+1,L+1 (cid:88) (cid:16) k∈ΨK+1,L+1 (cid:88) k∈ΨK+1,L+1 2α * (cid:98)βk,(cid:96)k where the first inequality holds due to the selection rule of action ak (Line 8 in Algorithm 1) with (Lemma B.2), the second inequality holds due Lemma B.1, Lemma B.5 and the fact that a∗ k ∈ Ak,(cid:96)k ≤ K * (cid:101)O (1/K) = (cid:101)O(1), (B.10) 22 to Cauchy-Schwarz inequality, the third inequality follows from Lemma B.1 and the last inequality follows from the definition of α. Finally, for layer (cid:96) ∈ [(cid:96)∗] and round τ ∈ ΨK+1,(cid:96), we have (cid:88) (cid:0)(cid:104)a∗ τ , θ∗(cid:105) − (cid:104)aτ , θ∗(cid:105)(cid:1) ≤ 2 |ΨK+1,(cid:96)| = 22(cid:96)+1 (cid:88) τ ∈ΨK+1,(cid:96) τ ∈ΨK+1,(cid:96) (cid:107)wτ aτ (cid:107)2 (cid:98)Στ,(cid:96) ≤ (cid:101)O(d), (B.11) where the first inequality holds since the reward is in the range [−1, 1], the equation follows from = 2−(cid:96) holds for all τ ∈ ΨK+1,(cid:96) and the last inequality follows from Lemma the fact that (cid:107)wτ aτ (cid:107) D.2 with the fact that 2(cid:96)∗ ≤ 128(cid:112)log(4(K + 1)2L/δ) is bounded by a logarithmic term. Putting (B.9), (B.10), (B.11) together, we have (cid:98)Στ,(cid:96) Regret(K) ≤ (cid:101)O d  (cid:118) (cid:117) (cid:117) (cid:116) K (cid:88)  σ2 k + dR + d  . Thus, we complete the proof of Theorem 2.3. k=1 C Proofs from Section 3 For k ∈ [K], h ∈ [H], let Fk,h be the σ-algebra generated by the random variables representing the state-action pairs up to and including those that appear stage h of episode k. More specifically, Fk,h is generated by s1 1, a1 1, a2 s2 1, . . . , s1 1, . . . , s2 1, ak sk 1, . . . , sk H , a1 H , a2 H , H , h, a1 h, a2 h, . . . , s1 h, . . . , s2 ... h, ak h . For simplicity, we define the following indicator sequence I k h for all (k, h) ∈ [K] × [H] : I k h = 1 (cid:110) ∀(cid:96) ∈ [L], det (cid:16) (cid:98)Σk,h,(cid:96) (cid:17) / det (cid:16) (cid:98)Σk,1,(cid:96) (cid:17) (cid:111) . ≤ 4 (C.1) For each 1 ≤ h1 ≤ h2 ≤ H, since (cid:98)Σk,h2,(cid:96) (cid:23) (cid:98)Σk,h1,(cid:96), the indicator function is monotonic (e.g., ). In addition, the following lemma provides an upper bound for the number of episodes I k h1 when the determinant of covariance matrix grows sharply. ≤ I k h2 Lemma C.1. If the indicator function I k h is defined as in (C.1), then for each k ∈ [K], we have k (cid:88) (1 − I i H ) ≤ i=1 dL 2 log λ + kH/d λ + dL2. Proof. For all layer (cid:96) ∈ [L], let D(cid:96) be the set of indices i ∈ [k] such that (cid:16) det (cid:98)Σi+1,1,(cid:96) (cid:17) / det (cid:16) (cid:98)Σi,1,(cid:96) (cid:17) > 4. 23 According to the update rule of Σk,1,(cid:96), Σk+1,1,(cid:96) (cid:23) Σk,1,(cid:96) holds for all episode k ∈ [K]. Therefore, we have det( (cid:98)Σk+1,1,(cid:96))/ det( (cid:98)Σ1,1,(cid:96)) = k (cid:89) i=1 (cid:16) det (cid:98)Σi+1,1,(cid:96) (cid:17) / det (cid:16) (cid:98)Σi,1,(cid:96) (cid:17) ≥ 4|D(cid:96)|, (C.2) where the inequality holds due to the definition of set D(cid:96). In addition, the determinant of matrices (cid:98)Σk+1,1,(cid:96) and (cid:98)Σ1,1,(cid:96) is bounded by: det( (cid:98)Σk+1,1,(cid:96)) ≤ (tr(Σk+1,1,(cid:96))/d)d ≤ (2−2(cid:96)λ + kH/d)d, det( (cid:98)Σ1,1,(cid:96)) = (cid:0)2−2(cid:96) * λ(cid:1)d, where the first inequality holds since (cid:98)Σk+1,1,(cid:96) (cid:23) 0, the last inequality holds due to wk,i ≤ 1 and (cid:107)φVi,h+1(si h)(cid:107)2 ≤ 1. Combining these results, it holds that h, ai |D(cid:96)| ≤ log4 (cid:18) (λ + 22(cid:96)kH/d)d λd (cid:19) ≤ d 2 log2 λ + 22(cid:96)kH/d λ ≤ d 2 log2 λ + kH/d λ + d * (cid:96). Finally, according to the definition of D(cid:96) and indicator function I k h , we have k (cid:88) (1 − I i H ) ≤ i=1 |D(cid:96)| ≤ dL 2 log2 λ + kH/d λ + dL2. (cid:88) (cid:96)∈[L] Thus, we complete the proof of Lemma C.1. Lemma C.2. Let ΨK+1,(cid:96) be defined in (3.3). Then for all layer (cid:96) ∈ [L], it holds that |ΨK+1,(cid:96)| ≤ 2d log (cid:0)1 + KH/(2−2(cid:96)dλ)(cid:1). Proof. By the definition of wk,h in Algorithm 2, (cid:88) (k,h)∈ΨK+1,(cid:96) (cid:107)wk,hφVk,h+1(sk h, ak h)(cid:107)2 (cid:98)Σ−1 k,h,(cid:96) = |ΨK+1,(cid:96)| * 2−2(cid:96). On the other hand, by Lemma D.2, we have (cid:88) (k,h)∈ΨK+1,(cid:96) (cid:107)wk,hφVk,h+1(sk h, ak h)(cid:107)2 (cid:98)Σ−1 k,h,(cid:96) ≤ 2d log 2−2(cid:96)dλ + KH 2−2(cid:96)dλ . Combining these results, we further conclude that |ΨK+1,(cid:96)| ≤ 2 * d log (cid:0)1 + KH/(2−2(cid:96)dλ)(cid:1). Thus, we complete the proof of Lemma C.1. C.1 High-Probability Events For simplicity, we define the stochastic transition noise (cid:15)k,h and variance σk,h as follows: (cid:15)k,h = Vk,h+1(sk h+1) − (cid:68) 24 θ∗, φVk,h+1(sk h, ak h) (cid:69) , σk,h = (cid:113) [VVk,h+1] (sk h, ak h). With these notations, we further define the following high-probability events: Ec = (cid:110) ∀k ≥ 1, (cid:96) ∈ [L], (cid:107) (cid:98)θk,(cid:96) − θ∗(cid:107) (cid:98)Σk,1,(cid:96) ≤ 16 * 2−(cid:96) (cid:115) (cid:88) w2 i,hσ2 i,h log(4k2H 2L/δ) (i,h)∈Ψk,(cid:96) √ λ * B (cid:111) , + 6 * 2−(cid:96) log(4k2H 2L/δ) + 2−(cid:96)   (cid:88) w2 i,h (cid:12) (cid:12)(cid:15)2 i,h − σ2 i,h  (i,h)∈Ψk,(cid:96) Evar(cid:48) = ∀k ≥ 1, (cid:12) (cid:12) ≤ 1 2 (cid:88) (i,h)∈Ψk,(cid:96) w2 i,hσ2 i,h + log (cid:0)4k2H 2/δ(cid:1) 7 3    . (C.3) (C.4) (C.5) Lemma C.3. Let Ec be defined in (C.4). Then we have P(Ec) ≥ 1 − δ. Proof. From the definition of (cid:96)k,h and wk,h in Algorithm 2, we can deduce that for all k ∈ [K], h ∈ [H], (cid:13) ≤ 2−(cid:96)k,h. According to Theorem 2.1, for layer (cid:96) ∈ [L], we have with (cid:13)wk,hφVk,h+1(sk (cid:13) (cid:98)Σ−1 probability at least 1 − δ/L, for all k ∈ [K]: h, ak h)(cid:13) k,h,(cid:96)k,h (cid:107) (cid:98)θk,(cid:96)(cid:107) (cid:98)Σk,1,(cid:96) ≤ 16 * 2−(cid:96) (cid:115) (cid:88) (i,h)∈Ψk,(cid:96) w2 i,hσ2 i,h log(4k2H 2L/δ) + 6 * 2−(cid:96) log(4k2H 2L/δ) + 2−(cid:96) √ λB. After applying a union bound over (cid:96) ∈ [L], we complete the proof of Lemma C.3. Lemma C.4. Let Evar(cid:48) be defined in (C.5). We have P(Evar(cid:48)) ≥ 1 − 2δ. Proof. By the definition of V and Definition 3.2, we have E[(cid:15)2 k,h|Fk,h] = σ2 k,h, P(|(cid:15)k,h| ≤ 1) = 1. Equivalent as the proof of Lemma B.4, we can prove that with probability at least 1 − 2δ, for all episode k ≥ 1 and layer (cid:96) ∈ [L], (cid:88) w2 i,h (cid:12) (cid:12)(cid:15)2 i,h − σ2 i,h (cid:12) (cid:12) ≤ (i,h)∈Ψk,(cid:96) 1 2 (cid:88) (i,h)∈Ψk,(cid:96) which completes the proof of Lemma C.4. C.2 Proof of Optimism w2 i,hσ2 i,h + log (cid:0)4k2H 2L/δ(cid:1) , 7 3 Lemma C.5. Let wk,h be defined in Algorithm 2. On the event Ec and Evar(cid:48), for all k ≥ 1, (cid:96) ∈ [L] such that 2(cid:96) ≥ 64(cid:112)log(4k2H 2L/δ), the following inequalities hold: (cid:88) w2 i,hσ2 i,h ≤ 8 (cid:88) (cid:16) w2 i,h Vi,h+1(si h+1) − (cid:10) (i,h)∈Ψk,(cid:96) (i,h)∈Ψk,(cid:96) (cid:98)θk,(cid:96), φVi,h+1(si h, ai h)(cid:11)(cid:17)2 (cid:88) (cid:16) w2 i,h (i,h)∈Ψk,(cid:96) Vi,h+1(si h+1) − (cid:10) + 8 log(4k2H 2L/δ) + 2−2(cid:96)+5 * λB2, (cid:88) (cid:98)θk,(cid:96), φVi,h+1(si h, ai h)(cid:11)(cid:17)2 ≤ 3 2 (i,h)∈Ψk,(cid:96) w2 i,hσ2 i,h + 2−2(cid:96)λB2 + 7 3 log (cid:0)4k2H 2L/δ(cid:1) . 25 Proof. Let (cid:96) be an arbitrary layer in [L]. According to the definition of event Evar(cid:48), we have (cid:88) (i,h)∈Ψk,(cid:96) w2 i,hσ2 i,h ≤ 2 (cid:88) w2 i,h(cid:15)2 i,h + 14 3 log (cid:0)4k2H 2L/δ(cid:1) (i,h)∈Ψk,(cid:96) (cid:88) ≤ 4 (cid:16) w2 i,h Vi,h+1(si h+1) − (cid:10) (cid:98)θk,(cid:96), φVi,h+1(si h, ai h)(cid:11)(cid:17)2 (i,h)∈Ψk,(cid:96) (cid:88) + 4 (i,h)∈Ψk,(cid:96) (cid:104) w2 i,h (cid:15)i,h − (cid:16) Vi,h+1(si h+1) − (cid:10) + 14 3 log (cid:0)4k2H 2L/δ(cid:1) , (cid:98)θk,(cid:96), φVi,h+1(si h, ai h)(cid:11)(cid:17)(cid:105)2 (C.6) where the last inequality holds due to the fact (a + b)2 ≤ 2a2 + 2b2. Then we consider the second term and we have (cid:88) w2 i,h (cid:104) (cid:15)i,h − (cid:16) Vi,h+1(si h+1) − (cid:10) (i,h)∈Ψk,(cid:96) (cid:98)θk,(cid:96), φVi,h+1(si h, ai h)(cid:11)(cid:17)(cid:105)2 (cid:88) w2 i,h (cid:16)(cid:10)θ∗ − (cid:98)θk,(cid:96), φVi,h+1(si h)(cid:11)(cid:17)2 h, ai (i,h)∈Ψk,(cid:96) (cid:88) (cid:16) w2 i,h θ∗ − (cid:98)θk,(cid:96) (cid:17)(cid:62) φVi,h+1(si h, ai h)φVi,h+1(si h, ai h)(cid:62) (cid:16) (cid:17) θ∗ − (cid:98)θk,(cid:96) (i,h)∈Ψk,(cid:96) (cid:13) (cid:13)θ∗ − (cid:98)θk,(cid:96) (cid:13)  16 * 2−(cid:96) (cid:13) 2 (cid:13) (cid:13) (cid:98)Σk,(cid:96) (cid:115) (cid:88) w2 i,hσ2 i,h log(4k2H 2L/δ) + 6 * 2−(cid:96) log(4k2H 2L/δ) + 2−(cid:96) √ λ * B  2  , (C.7) = = ≤ ≤ (i,h)∈Ψk,(cid:96) h)(cid:62) and weight wi,h ≤ 1, the last where the inequality holds due to (cid:98)Σk,(cid:96) (cid:23) φVi,h+1(si equality follows from the definition of Ec. In addition, from (C.7), when 2(cid:96) ≥ 64(cid:112)log(4k2H 2L/δ), h)φVi,h+1(si h, ai h, ai (cid:88) w2 i,h (cid:104) (cid:15)i,h − (cid:16) Vi,h+1(si h+1) − (cid:10) (cid:98)θk,(cid:96), φVi,h+1(si h, ai h)(cid:11)(cid:17)(cid:105)2 (i,h)∈Ψk,(cid:96) 1 8 ≤ (cid:88) ≤ 1 8 (i,h)∈Ψk,(cid:96) (cid:88) (i,h)∈Ψk,(cid:96) w2 i,hσ2 i,h + 2 (cid:16) 6 * 2−(cid:96) log(4k2H 2L/δ) + 2−(cid:96) √ (cid:17)2 λ * B w2 i,hσ2 i,h + log(4k2H 2L/δ) + 2−2(cid:96)+2 * λB2, (C.8) where the first inequality and the second inequality hold due to the fact that (a + b)2 ≤ 2a2 + 2b2. Substituting (C.8) into (C.6), we have (cid:88) w2 i,hσ2 i,h ≤ 4 (cid:88) (cid:16) w2 i,h Vi,h+1(si h+1) − (cid:10) (i,h)∈Ψk,(cid:96) (i,h)∈Ψk,(cid:96) 26 (cid:98)θk,(cid:96), φVi,h+1(si h, ai h)(cid:11)(cid:17)2 + 1 2 ≤ 8 (cid:88) w2 i,hσ2 i,h + 4 log(4k2H 2L/δ) + 2−2(cid:96)+4 * λB2 (i,h)∈Ψk,(cid:96) (cid:88) w2 i,h (cid:16) Vi,h+1(si h+1) − (cid:10) (cid:98)θk,(cid:96), φVi,h+1(si h, ai h)(cid:11)(cid:17)2 (i,h)∈Ψk,(cid:96) + 8 log(4k2H 2L/δ) + 2−2(cid:96)+5 * λB2, where the last inequality holds due to the fact that x ≤ x/2 + y implies x ≤ 2y. Thus, we complete the proof of the first inequality in this lemma. Note that (cid:98)θk,(cid:96) is the minimizer of (cid:98)θk,(cid:96) ← arg min θ∈Rd (cid:88) w2 i,h (i,h)∈Ψk,(cid:96) and we have (cid:0)Vi,h+1(si h+1) − (cid:104)θ, φVi,h+1(si h, ai h)(cid:105)(cid:1)2 + 2−2(cid:96)λ(cid:107)θ(cid:107)2 2, (cid:88) (cid:16) w2 i,h Vi,h+1(si h+1) − (cid:10) (cid:98)θk,(cid:96), φVi,h+1(si h, ai h)(cid:11)(cid:17)2 (i,h)∈Ψk,(cid:96) (cid:88) ≤ w2 i,h (cid:0)Vi,h+1(si h+1) − (cid:10)θ∗, φVi,h+1(si h, ai h)(cid:11)(cid:1)2 + 2−2(cid:96)λ(cid:107)θ∗(cid:107)2 2 ≤ ≤ (i,h)∈Ψk,(cid:96) (cid:88) w2 i,h(cid:15)2 i,h + 2−2(cid:96)λB2 (i,h)∈Ψk,(cid:96) 3 (cid:88) 2 (i,h)∈Ψk,(cid:96) w2 i,hσ2 i,h + 2−2(cid:96)λB2 + log (cid:0)4k2H 2L/δ(cid:1) , 7 3 where the first inequality holds due to the definition of (cid:98)θk,(cid:96), the second inequality holds due to (cid:107)θ∗(cid:107) ≤ B and the last inequality follows from the definition of Evar(cid:48). Therefore, we complete the proof of Lemma C.5. Lemma C.6. Let value function Qk,h, Vk,h and confidence radius (cid:98)βk,(cid:96) be defined in Algorithm 2. Suppose that λ = 1/B2 in Algorithm 2. Then, on the event Evar(cid:48) ∩ Ec, for any (k, h) ∈ [K] × [H], we have [PVk,h+1](sk h) ≤ Vk,h(sk h, ak h). Proof. From the definition of event Evar(cid:48) and Lemma C.5, we can deduce that (cid:98)βk,(cid:96) ≥ 16 * 2−(cid:96) (cid:118) (cid:117) (cid:117) (cid:116) k (cid:88) i=1 i log(4k2H 2L/δ) + 6 * 2−(cid:96) log(4k2H 2L/δ) + 2−(cid:96) σ2 √ λ * B. Therefore, by the definition of Ec, we have According to Algorithm 2, we have ∀k ≥ 1, (cid:96) ∈ [L], (cid:107) (cid:98)θk,(cid:96) − θ∗(cid:107) ≤ (cid:98)βk,(cid:96). (cid:98)Σk,1,(cid:96) Vk,h(sk h) = min (cid:26) (cid:26) 1, min (cid:96)∈[L] r(sk h, ak h) + (cid:68) (cid:98)θk,(cid:96), φVk,h+1(sk h, ak h) (cid:69) + (cid:98)βk,(cid:96) 27 (cid:13) (cid:13)φVk,h+1(sk (cid:13) (cid:13) h, ak (cid:13) h) (cid:13) (cid:98)Σ−1 k,1,(cid:96) (C.9) (cid:27)(cid:27) (cid:26)(cid:68) (cid:110)(cid:68) ≥ min (cid:26) (cid:26) 1, min (cid:96)∈[L] ≥ min 1, min (cid:96)∈[L] = [PVk,h+1](sk h, ak h), (cid:98)θk,(cid:96), φVk,h+1(sk h, ak h) θ∗, φVk,h+1(sk h, ak h) (cid:69)(cid:111)(cid:27) (cid:69) + (cid:98)βk,(cid:96) (cid:13) (cid:13)φVk,h+1(sk (cid:13) h, ak h) (cid:13) (cid:13) (cid:13) (cid:98)Σ−1 k,1,(cid:96) (cid:27)(cid:27) where the first inequality holds due to r(sk h) > 0, the second one follows from (C.9), the last equality holds due to the definition of linear mixture MDPs and the fact that Vk,h+1(s) ≤ 1 for all s ∈ S. Thus, we complete the proof of Lemma C.6. h, ak Lemma C.7. Let value function Qk,h, Vk,h and confidence radius (cid:98)βk,(cid:96) be defined in Algorithm 2. Suppose that λ = 1/B2 in Algorithm 2. Then, on the event Evar(cid:48) ∩ Ec, for any (s, a, k, h) ∈ S × A × [K] × [H], we have Q∗ h(s, a) ≤ Qk,h(s, a) and V ∗ h (s) ≤ Vk,h(s). Proof. From the definition of event Evar(cid:48) and Lemma C.5, we can deduce that (cid:98)βk,(cid:96) ≥ 16 * 2−(cid:96) (cid:118) (cid:117) (cid:117) (cid:116) k (cid:88) i=1 i log(4k2H 2L/δ) + 6 * 2−(cid:96) log(4k2H 2L/δ) + 2−(cid:96) σ2 √ λ * B. Therefore, by the definition of Ec, we have ∀k ≥ 1, (cid:96) ∈ [L], (cid:107) (cid:98)θk,(cid:96) − θ∗(cid:107) ≤ (cid:98)βk,(cid:96). (cid:98)Σk,1,(cid:96) (C.10) Consider an arbitrary episode k ∈ [K] in the remaining proof. following inequalities Q∗ h(s, a) ≤ Qk,h(s, a), V ∗ (s, a) ∈ S × A, (cid:96) ∈ [L] and stage h − 1, we have If for some stage h > 1, the h (s) ≤ Vk,h(s) hold for all (s, a) ∈ S × A, then for any h−1(s, a) = r(s, a) + (cid:10)θ∗, φV ∗ Q∗ (s, a)(cid:11) ≤ r(s, a) + (cid:10)θ∗, φVk,h(s, a)(cid:11) ≤ r(s, a) + (cid:10) h ≤ r(s, a) + (cid:10) (cid:98)θk,(cid:96), φVk,h(s, a)(cid:11) + (cid:13) (cid:98)θk,(cid:96), φVk,h(s, a)(cid:11) + (cid:98)βk,(cid:96) (cid:13) (cid:98)θk,(cid:96) − θ∗(cid:13) (cid:13) (cid:98)Σk,1,(cid:96) (cid:13)φVk,h(s, a)(cid:13) (cid:13) (cid:13) (cid:98)Σ−1 k,1,(cid:96) , (cid:13)φVk,h(s, a)(cid:13) (cid:13) (cid:13) (cid:98)Σ−1 k,1,(cid:96) where the first inequality holds by our assumption that V ∗ h (s) ≤ Vk,h(s), the second inequality holds due to Cauchy-Schwarz inequality and the last inequality follows from (C.10). By the arbitrariness h−1(s, a) ≤ Qk,h−1(s, a) holds for all state-action pair (s, a), which indicates of layer (cid:96), we have Q∗ that V ∗ H+1(*) ≤ Vk,H+1(*) holds trivially for stage h−1(s) ≤ Vk,h−1(s) holds for all s ∈ S. Since 0 = V ∗ H + 1, we complete the proof of Lemma C.7 by induction. C.3 Sum of Bellman Errors Lemma C.8. Let (cid:98)βk,(cid:96), Vk,h, φVk,h+1 Then on the event Evar(cid:48) ∩ Ec, we have be defined in Algorithm 2 and set λ = 1/B2, α = 1/(KH)3/2. K (cid:88) H (cid:88) k=1 h=1 I k h max (cid:110)(cid:2)Vk,h(sk h) − r(sk h, ak h) − [PVk,h+1](sk h, ak h)(cid:3), 0 (cid:111) ≤ (cid:101)O d  (cid:118) (cid:117) (cid:117) (cid:116) K (cid:88) H (cid:88)  σ2 k,h + d  . k=1 h=1 28 Proof. For simplicity, let (cid:96)∗ be the smallest (cid:96) in L such that 2(cid:96) ≥ 64(cid:112)log (4K2H 2L/δ). According to Algorithm 2, we have Vk,h(sk h) = min (cid:26) (cid:26) 1, min (cid:96)∈[L] r(sk h, ak h) + (cid:68) (cid:98)θk,(cid:96), φVk,h+1(sk h, ak h) (cid:69) + (cid:98)βk,(cid:96) (cid:13) (cid:13)φVk,h+1(sk (cid:13) (cid:13) h, ak (cid:13) h) (cid:13) (cid:98)Σ−1 k,1,(cid:96) Therefore, we have K (cid:88) H (cid:88) I k h max (cid:110)(cid:2)Vk,h(sk h) − r(sk h, ak h) − [PVk,h+1](sk h, ak (cid:111) h)(cid:3), 0 (cid:27)(cid:27) . (C.11) k=1 h=1 K (cid:88) H (cid:88) ≤ ≤ ≤ k=1 K (cid:88) h=1 H (cid:88) k=1 h=1 L+1 (cid:88) (cid:20) I k h min (cid:96)∈[L] (cid:26)(cid:68) (cid:98)θk,(cid:96) − θ∗, φVk,h+1(sk h, ak h) (cid:69) + (cid:98)βk,(cid:96) (cid:13) (cid:13)φVk,h+1(sk (cid:13) (cid:13) h, ak (cid:13) h) (cid:13) (cid:98)Σ−1 k,1,(cid:96) (cid:27) (cid:21) [0,2] I k h min (cid:26) (cid:26) 2, min (cid:96)∈[L] 2 (cid:98)βk,(cid:96) (cid:13) (cid:13)φVk,h+1(sk (cid:13) (cid:13) h, ak (cid:13) h) (cid:13) (cid:98)Σ−1 k,1,(cid:96) (cid:27)(cid:27) (cid:88) (cid:26) I k h min 2, 2 (cid:98)βk,(cid:96)−1 (cid:13) (cid:13)φVk,h+1(sk (cid:13) (cid:13) h, ak (cid:13) h) (cid:13) (cid:98)Σ−1 k,1,(cid:96)−1 (cid:27) + 2 (cid:96)∗ (cid:88) (cid:96)=1 |ΨK+1,(cid:96)|, (C.12) (cid:96)=(cid:96)∗+1 (k,h)∈ΨK+1,(cid:96) where the first inequality holds due to the definition of value function Vk,h(sk h), the second inequality holds due to Cauchy-Schwarz inequality with event Ec and the last inequality holds since indicator function I k h ≤ 1. By the definition of indicator function I k h and Lemma D.3, we further have (cid:13) (cid:13)φVk,h+1(sk (cid:13) (cid:13) h, ak (cid:13) h) (cid:13) (cid:98)Σ−1 k,1,(cid:96)k,h−1 ≤ 2 (cid:13) (cid:13)φVk,h+1(sk (cid:13) (cid:13) h, ak (cid:13) h) (cid:13) (cid:98)Σ−1 k,h,(cid:96)k,h−1 where the last inequality follows from the definition of (cid:96)k,h in Algorithm 2. Substituting (C.13) into (C.12), we have ≤ 2 * 2−(cid:96)k,h+1, (C.13) K (cid:88) H (cid:88) k=1 h=1 I k h max (cid:110)(cid:2)Vk,h(sk h) − r(sk h, ak h) − [PVk,h+1](sk h, ak h)(cid:3), 0  2−(cid:96) * 2−(cid:96) (cid:118) (cid:117) (cid:117) (cid:116) K (cid:88) H (cid:88) k=1 h=1  k,h + 2−2(cid:96) σ2  + 2 L+1 (cid:88) ≤ |ΨK+1,(cid:96)| * (cid:101)O (cid:96)=(cid:96)∗+1  ≤ (cid:101)O d (cid:118) (cid:117) (cid:117) (cid:116) K (cid:88) H (cid:88)  σ2 k,h + d  , (cid:111) (cid:96)∗ (cid:88) (cid:96)=1 |ΨK+1,(cid:96)| k=1 h=1 where the first inequality follows from the definition of (cid:98)βk,(cid:96) in Algorithm 2 and Lemma C.5, the last inequality holds due to Lemma C.2 and the definition of L. Thus, we complete the proof of Lemma C.8. 29 C.4 Quantities in MDP In this subsection, we define the following quantities: We use ˇVk,h(s) to denote the estimation error between the optimistic value function and the actually optimal value function, and use (cid:101)Vk,h(s) to denote the sub-optimality gap of policy πk at stage h: ˇVk,h(s) = Vk,h(s) − V ∗ h (s) − V πk (cid:101)Vk,h(s) = V ∗ h (s), h (s), ∀s ∈ S, (k, h) ∈ [K] × [H] ∀s ∈ S, (k, h) ∈ [K] × [H] We use Q0, Sm, ˇSm, (cid:101)Sm to represent the total variances of optimal value function V ∗ order value functions (V 2m ): k,h+1, ˇV 2m k,h+1, (cid:101)V 2m k,h+1 h+1 K (cid:88) k=1 K (cid:88) k=1 K (cid:88) k=1 K (cid:88) Sm = ˇSm = (cid:101)Sm = Q0 = H (cid:88) [VV 2m k,h+1](sk h, ak h), h=1 H (cid:88) [V ˇV 2m k,h+1](sk h, ak h), h=1 H (cid:88) [V (cid:101)V 2m k,h+1](sk h, ak h), h=1 H (cid:88) [VV ∗ h+1](sk h, ak h), (C.14) (C.15) and 2m-th (C.16) (C.17) (C.18) (C.19) where Q0 is introduced as a shorthand for Var∗ K functions (V 2m k,h+1, (cid:101)V 2m k,h+1, ˇV 2m stochastic transition noise as follows: k,h+1 for simplicity. In addition, for 2m-th order value ) and optimistic value function Vk,h, we denote the summation of k=1 h=1 [[PV 2m k,h+1](sk h, ak h) − V 2m k,h+1(sk [[P ˇV 2m k,h+1](sk h, ak h) − ˇV 2m k,h+1(sk [[P (cid:101)V 2m k,h+1](sk h, ak h) − (cid:101)V 2m k,h+1(sk (cid:12) (cid:12) (cid:12) h+1)] (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) h+1)] (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) h+1)] (cid:12) (cid:12) , , , k=1 K (cid:88) (cid:12) K (cid:12) (cid:88) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) k=1 K (cid:88) k=1 K (cid:88) Am = ˇAm = (cid:101)Am = R0 = H (cid:88) h=1 H (cid:88) h=1 H (cid:88) h=1 H (cid:88) I k h max (cid:110)(cid:2)Vk,h(sk h) − r(sk h, ak h) − [PVk,h+1](sk h, ak (cid:111) h)(cid:3), 0 . (C.20) (C.21) (C.22) (C.23) k=1 h=1 Finally, we use the quantity G to denote the number of episodes when the determinant of covariance matrix grows sharply: K (cid:88) (1 − I k H ), G = k=1 30 (C.24) is defined in (C.1). For the above quantities, we only consider m ∈ [M ] where indicator function I k h where M := (cid:100)log2 2HK(cid:101). Now, we introduce the following lemmas to build the connection between these quantities. To construct the connections and upper bounds of the quantities above, our proof in this subsection follows the previous approaches proposed by Zhang et al. (2021b) and Zhou and Gu (2022), but with a more fine-grained analysis to remove explicit K-dependence. Lemma C.9. Let ˇSm, Am, R0, G be defined in (C.17), (C.20), (C.23), (C.24). On the event Evar(cid:48) ∩ Ec, we have the following inequalities for all m ∈ [M ]: Proof. Based on the definition of ˇSm, we compute ˇSm ≤ ˇAm+1 + G + 2m+1 * (R0 + G + A0). K (cid:88) H (cid:88) ˇSm = [V ˇV 2m k,h+1](sk h, ak h) k=1 h=1 K (cid:88) H (cid:88) k=1 h=1 K (cid:88) H (cid:88) k=1 h=1 = = (cid:20) [P ˇV 2m+1 k,h+1](sk h, ak h) − (cid:16) [P ˇV 2m k,h+1](sk h, ak h) (cid:17)2(cid:21) (cid:104) [P ˇV 2m+1 k,h+1](sk h, ak h) − ˇV 2m+1 k,h+1(sk h+1) K (cid:88) H (cid:88) (cid:105) + (cid:20) ˇV 2m+1 k,h (cid:16) (sk h) − k=1 h=1 [P ˇV 2m k,h+1](sk h, ak h) (cid:17)2(cid:21) . (C.25) For the second term, it can be further upper bounded by K (cid:88) H (cid:88) (cid:20) ˇV 2m+1 k,h (sk h) − (cid:16) [P ˇV 2m k,h+1](sk h, ak h) (cid:17)2(cid:21) k=1 h=1 K (cid:88) H (cid:88) ≤ (cid:20) ˇV 2m+1 k,h (sk h) − (cid:16) [P ˇVk,h+1](sk h, ak h) (cid:17)2m+1(cid:21) k=1 h=1 K (cid:88) ≤ 2m+1 H (cid:88) max (cid:110) ˇVk,h(sk h) − [P ˇVk,h+1](sK h , ak h), 0 (cid:111) k=1 K (cid:88) h=1 H (cid:88) ≤ 2m+1 I k h max (cid:110)(cid:2)Vk,h(sk h) − r(sk h, ak h) − [PVk,h+1](sk h, ak (cid:111) h)(cid:3), 0 k=1 h=1 K (cid:88) + 2m+1 (1 − I k H ) k=1 ≤ 2m+1R0 + 2m+1 H (cid:88) h=1 max (cid:110)(cid:2)Vk,h(sk h) − r(sk h, ak h) − [PVk,h+1](sk h, ak h)(cid:3), 0 K (cid:88) (1 − I k H ) k=1 H (cid:88) h=1 (cid:2)Vk,h+1(sk h+1) − [PVk,h+1](sk h, ak h)(cid:3) + 2m+1 K (cid:88) (1 − I k H ) H (cid:88) (cid:16) Vk,h(sk h) − Vk,h+1(sk (cid:17) h+1) k=1 h=1 ≤ 2m+1 * (R0 + G + A0), where the first inequality holds due to (cid:111) (C.26) (cid:16) [P ˇV 2m k,h+1](sk h, ak h) (cid:17)2 (cid:16) ≥ [P ˇV 2m−1 k,h+1](sk h, ak h) (cid:17)4 (cid:16) ≥ * * * ≥ [P ˇVk,h+1](sk h, ak h) (cid:17)2m+1 , 31 the second inequality follows from the fact that ax − bx ≤ x max{a − b, 0} for a, b ∈ [0, 1] and x ≥ 1, the third inequality follows from the monotonicity of indicator function I k and the definition of h function ˇVk,h, the fourth holds since r(sk h) ≥ 0 and the last inequality holds due to Lemma C.6. h, ak Substituting (C.26) into (C.25), we have ˇSm ≤ ˇAm+1 + G + 2m+1 * (R0 + G + A0). Thus, we complete the proof of Lemma C.9. Lemma C.10. Let Am, Q0, ˇSm be defined in (C.20), (C.19), (C.17). Then with probability at least 1 − 2δ, we have A0 ≤ 2 (cid:113) (Q0 + ˇS0) log(1/δ) + (2/3) * log(1/δ). For simplicity, we denote the corresponding event by Er1 . Proof. Applying the Freedman's inequality in Lemma D.4, we have with probability at least 1 − 2δ, A0 = (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) K (cid:88) H (cid:88) k=1 h=1 (cid:2)[PVk,h+1](sk h, ak h) − Vk,h+1(sk h+1)(cid:3) (cid:118) (cid:117) (cid:117) (cid:116)2 ≤ (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) K (cid:88) H (cid:88) k=1 h=1 σ2 k,h log(1/δ) + 2 3 log(1/δ), (C.27) where the variance σk,h is defined in (C.3). For variance σk,h, we further have k,h = [VVk,h+1](sk σ2 h, ak h) ≤ 2[VV ∗ h+1](sk h, ak h) + 2[V ˇVk,h+1](sk h, ak h), (C.28) where the inequality holds due to the fact that Var(x + y) ≤ 2 Var(x) + 2 Var(y). Substituting (C.28) into (C.27), we complete the proof of Lemma C.10. Lemma C.11. Let ˇAm, ˇSm be defined in (C.20), (C.17). With probability at least 1 − 2(M + 1)δ, for all m ∈ [M ] ∪ {0}, we have ˇAm ≤ (cid:113) 2 ˇSm log(1/δ) + 4 3 * log(1/δ). We denote the corresponding event by Er2 Proof. Note that for all state s, ˇVk,h(s) = Vk,h(s) − V ∗ in Lemma D.4, we have with probability at least 1 − 2δ: . h (s) ∈ [−1, 1]. Applying Freedman's inequality ˇAm ≤ (cid:113) 2 ˇSm log(1/δ) + 4 3 * log(1/δ), for each m ∈ [M ]. Thus, we complete the proof of Lemma C.11 by using a union bound over m ∈ [M ]. Lemma C.12. Let Am, Q0, ˇAm, R0, G be defined in (C.20), (C.19), (C.21), (C.23), (C.24). On the event Er1 ∩ Evar(cid:48) ∩ Ec, we have A0 ≤ 4 (cid:113)(cid:0)Q0 + ˇA1 + G + 2(R0 + G)(cid:1) log(1/δ) + 10 * log(1/δ). 32 Proof. According to Lemma C.9 and Lemma C.10, we have (cid:113) A0 ≤ 2 (Q0 + ˇS0) log(1/δ) + (2/3) * log(1/δ) (cid:113)(cid:0)Q0 + ˇA1 + G + 2(R0 + G + A0)(cid:1) log(1/δ) + (2/3) * log(1/δ) (cid:113)(cid:0)Q0 + ˇA1 + G + 2(R0 + G)(cid:1) log(1/δ) + (2/3) * log(1/δ) + 2(cid:112)2A0 log(1/δ) (cid:113)(cid:0)Q0 + ˇA1 + G + 2(R0 + G)(cid:1) log(1/δ) + 10 * log(1/δ), ≤ 2 ≤ 2 ≤ 4 where the first inequality holds due to Lemma C.9, the second inequality holds due to C.10 and the last inequality holds due to x ≤ a x + b ⇒ x ≤ a2 + 2b. Thus, we complete the proof of Lemma C.12. √ Lemma C.13. Let Am, G, R0 be defined in (C.20), (C.24), (C.23). On the event Er2 ∩ Evar(cid:48) ∩ Ec, we have ˇA1 ≤ 4(cid:112)(R0 + 2G + A0) log(1/δ) + 11 log(1/δ). Proof. By the definition of Er2 in Lemma C.11, we have 4 3 Substituting the bound of ˇSm in Lemma C.9 into (C.29), 2 ˇSm log(1/δ) + ˇAm ≤ (cid:113) * log(1/δ). (C.29) ˇAm ≤ (cid:113) 2 (cid:0) ˇAm+1 + 2m+1 * (R0 + 2G + A0)(cid:1) log(1/δ) + 4 3 * log(1/δ). Applying Lemma D.5, we have ˇA1 ≤ max (cid:110) 11 log(1/δ), 4(cid:112)(R0 + 2G + A0) log(1/δ) + 2 log(1/δ) (cid:111) ≤ 4(cid:112)(R0 + 2G + A0) log(1/δ) + 11 log(1/δ). Thus, we complete the proof of Lemma C.13. Lemma C.14. Let Am, G, R0, Q0 be defined in (C.20), (C.24), (C.23), (C.19). On the event Er1 ∩ Er2 ∩ Evar(cid:48) ∩ Ec, we have A0 ≤ 132 log(1/δ) + 28(cid:112)R0 log(1/δ) + 40(cid:112)G log(1/δ) + 8(cid:112)Q0 log(1/δ). Proof. We compute A0 ≤ 4 (cid:113)(cid:0)Q0 + G + 2(R0 + G)(cid:1) log(1/δ) + 10 * log(1/δ) + 4 (cid:113)(cid:0)Q0 + G + 2(R0 + G)(cid:1) log(1/δ) + 2 ˇA1 + 12 log(1/δ) (cid:113) ≤ 4 ≤ 8(cid:112)(R0 + 2G + A0) log(1/δ) + 34 log(1/δ) + 4(cid:112)(Q0 + G + 2(R0 + G)) log(1/δ) ≤ 132 log(1/δ) + 28(cid:112)R0 log(1/δ) + 40(cid:112)G log(1/δ) + 8(cid:112)Q0 log(1/δ), ˇA1 log(1/δ) where the first inequality follows from Lemma C.12, the second inequality holds due to the fact that 2ab ≤ a2 + b2, the third inequality holds due to Lemma C.13 and the last inequality holds due to the fact that x ≤ a x + b ⇒ x ≤ a2 + 2b. Thus, we complete the proof of Lemma C.14. √ 33 Lemma C.15. Let (cid:101)Sm, Am, R0, G be defined in (C.18), (C.20), (C.23), (C.24). On the event Evar(cid:48) ∩ Ec, we have the following inequalities for all m ∈ [M ]: (cid:101)Sm ≤ (cid:101)Am+1 + G + 2m+1 * (R0 + G + A0). Proof. Based on the definition of (cid:101)Sm, we compute K (cid:88) H (cid:88) (cid:101)Sm = [V (cid:101)V 2m k,h+1](sk h, ak h) k=1 h=1 K (cid:88) H (cid:88) k=1 h=1 K (cid:88) H (cid:88) k=1 h=1 = = (cid:20) [P (cid:101)V 2m+1 k,h+1](sk h, ak h) − (cid:16) [P (cid:101)V 2m k,h+1](sk h, ak h) (cid:17)2(cid:21) (cid:104) [P (cid:101)V 2m+1 k,h+1](sk h, ak h) − (cid:101)V 2m+1 k,h+1(sk h+1) K (cid:88) H (cid:88) (cid:105) + (cid:20) (cid:101)V 2m+1 k,h (cid:16) (sk h) − k=1 h=1 [P (cid:101)V 2m k,h+1](sk h, ak h) (cid:17)2(cid:21) , (C.30) For the second term, we further have K (cid:88) H (cid:88) (cid:20) (cid:101)V 2m+1 k,h (cid:16) (sk h) − [P (cid:101)V 2m k,h+1](sk h, ak h) (cid:17)2(cid:21) k=1 h=1 K (cid:88) H (cid:88) ≤ (cid:20) (cid:101)V 2m+1 k,h (cid:16) (sk h) − [P (cid:101)Vk,h+1](sk h, ak h) (cid:17)2m+1(cid:21) k=1 h=1 K (cid:88) ≤ 2m+1 H (cid:88) max (cid:110) (cid:101)Vk,h(sk h) − [P (cid:101)Vk,h+1](sk h, ak h), 0 (cid:111) k=1 K (cid:88) h=1 H (cid:88) I k h ≤ 2m+1 (cid:2)V ∗ h (sk h) − r(sk h, ak h) − [PV ∗ h+1](sk h, ak h)(cid:3) k=1 h=1 K (cid:88) + 2m+1 (1 − I k H ) k=1 H (cid:88) h=1 (cid:2)V ∗ h (sk h) − r(sk h, ak h) − [PV ∗ h+1](sk h, ak h)(cid:3) ≤ 2m+1R0 + 2m+1 ˇA0 + 2m+1 K (cid:88) (1 − I k H ) k=1 H (cid:88) h=1 (cid:2)Vk,h+1(sk h+1) − [PVk,h+1](sk h, ak h)(cid:3) + 2m+1 K (cid:88) (1 − I k H ) k=1 H (cid:88) (cid:16) h=1 Vk,h(sk h) − r(sk h, ak h) − Vk,h+1(sk (cid:17) h+1) ≤ 2m+1 * (R0 + G + A0 + ˇA0), where the first inequality holds since (cid:16) [P (cid:101)V 2m k,h+1](sk h, ak h) (cid:17)2 (cid:16) ≥ [P (cid:101)V 2m−1 k,h+1](sk h, ak h) (cid:17)4 (cid:16) ≥ * * * ≥ [P (cid:101)Vk,h+1](sk h, ak h) (cid:17)2m+1 (C.31) , the second inequality follows from the fact that ax − bx ≤ x max{a − b, 0} for a, b ∈ [0, 1] and x ≥ 1, the third inequality follows from the monotonicity of I k and the definition of function (cid:101)Vk,h, the h fourth inequality holds due to the definition of R0 and ˇA0, the last inequality follows from the fact that r(sk h, ak h) ≥ 0. 34 Substituting (C.31) into (C.30), we have (cid:101)Sm ≤ (cid:101)Am+1 + G + 2m+1 * (R0 + G + A0 + ˇA0). Thus, we complete the proof of Lemma C.15. Lemma C.16. Let (cid:101)Am, (cid:101)Sm be defined in (C.22), (C.18). With probability at least 1 − 2(M + 1)δ, for all m ∈ [M ] ∪ {0}, (cid:101)Am ≤ (cid:113) 2 (cid:101)Sm log(1/δ) + 4 3 * log(1/δ). We denote the corresponding event by Er3 . Proof. The proof is equivalent to the proof of Lemma C.11. Lemma C.17. Let Am, ˇAm, R0, G be defined in (C.20), (C.21), (C.23), (C.24). On the event Er1 ∩ Er2 ∩ Er3 ∩ Evar(cid:48) ∩ Ec, we have (cid:113) (cid:101)A1 ≤ 4 (cid:101)A0 ≤ 2 (R0 + 2G + A0 + ˇA0) log(1/δ) + 11 * log(1/δ), (cid:113) (R0 + 2G + A0 + ˇA0) log(1/δ) + 7 * log(1/δ). Proof. By Lemma C.15 and Lemma C.16, we have for all m ∈ [M ] ∪ {0}, (cid:114) 2 (cid:101)Am ≤ (cid:16) (cid:17) (cid:101)Am+1 + 2m+1 * (R0 + 2G + A0 + ˇA0) log(1/δ) + 4 3 * log(1/δ). (C.32) Applying Lemma D.5, we have (cid:26) (cid:101)A1 ≤ max 11 log(1/δ), 4 (cid:113) (R0 + 2G + A0 + ˇA0) log(1/δ) + 2 log(1/δ) (cid:27) (cid:113) (R0 + 2G + A0 + ˇA0) log(1/δ) + 11 log(1/δ). ≤ 4 By (C.32), it can be further deduced that (cid:115) (cid:101)A0 ≤ 18 log(1/δ) + 4 (cid:18)(cid:113) R0 + 2G + A0 + ˇA0 + (cid:112)log(1/δ) (cid:19)2 (cid:112)log(1/δ) + 4 3 * log(1/δ) (cid:113) ≤ 2 (R0 + 2G + A0 + ˇA0) log(1/δ) + 7 * log(1/δ). Thus, we complete the proof of Lemma C.17. Lemma C.18. Let Q0, Sm be defined in (C.19), (C.16). With probability at least 1 − δ, it holds that We denote the corresponding event by Er4 . Q0 ≤ 2 (cid:101)S0 + (cid:101)O(K). 35 Proof. By the definition of Q0, we have Q0 ≤ 2 (cid:101)S0 + 2 K (cid:88) H (cid:88) [VV πk h+1](sk h, ak h). Note that for all k ∈ [K], k=1 h=1 (C.33) E{(sh,ah)}h∈[H]∼πk (cid:34) H (cid:88) [VV πk h+1](sh, ah) h=1 (cid:35) = Var{(sh,ah)}h∈[H]∼πk (cid:34) H (cid:88) h=1 r(sh, ah) − V πk (cid:35) 1 (sk 1) ≤ 1, (C.34) where the last inequality holds due to the fact that (cid:80)H variance is upper bounded by: h=1 r(sh, ah), V πk 1 (sk 1) ∈ [0, 1]. In addition, the H (cid:88) h=1 Var (cid:104) [VV πk h+1](sk h)(cid:12) h, ak (cid:12)Fk,1 [VV πk h+1](sk h, ak h) (cid:21) (cid:17)2 (cid:12) (cid:12)Fk,1 (cid:104) [VV πk h+1](sk h)(cid:12) h, ak (cid:12)Fk,1 (cid:105) (cid:105) ≤ H (cid:88) E (cid:20)(cid:16) h=1 H (cid:88) h=1 ≤ ≤ 1, 1 * E where the last inequality holds due to (C.34). By Freedman's inequality (Lemma D.4), with probability at least 1 − δ/K, H (cid:88) [VV πk h+1](sk h, ak h) ≤ 1 + (cid:112)2 log(K/δ) + 2/3 * log(K/δ). h=1 Using a union bound over k ∈ [K], we can conclude that with probability at least 1 − δ, K (cid:88) H (cid:88) [VV πk h+1](sk h, ak h) ≤ (cid:101)O(K). (C.35) Thus, we complete the proof of Lemma C.18 by substituting (C.35) into (C.33). k=1 h=1 C.5 Regret Analysis Proof of Theorem 3.3. We prove this theorem on the event Er1 ∩ Er2 ∩ Er3 ∩ Ec ∩ Evar(cid:48), which occurs with probability at least 1 − (4M + 9)δ by Lemmas C.10, C.11, C.16, C.3, C.4. On these events, we have the following decomposition of Regret(K), Regret(K) = ≤ K (cid:88) k=1 K (cid:88) k=1 (cid:104) 1 (sk V ∗ 1) − V πk (cid:105) 1 (sk 1) (cid:104) Vk,1(sk 1) − V πk 1 (sk 1) (cid:105) 36 (cid:104) Vk,h(sk I k h h) − Vk,h+1(sk (cid:105) h+1) − K (cid:88) k=1 V πk 1 (sk 1) + G h * r(sk I k h, ak h) + K (cid:88) H (cid:88) k=1 h=1 I k h (cid:104) Vk,h(sk h) − r(sk h, ak h) − [PVk,h+1](sk (cid:105) h, ak h) K (cid:88) H (cid:88) k=1 K (cid:88) h=1 H (cid:88) ≤ = k=1 h=1 K (cid:88) H (cid:88) + (cid:104) I k h [PVk,h+1](sk h, ak h) − Vk,h+1(sk (cid:105) h+1) k=1 h=1 ≤ R0 + A0 + G + K (cid:88) (cid:32) H (cid:88) h=1 k=1 (cid:124) (cid:33) r(sk h, ak h) − V πk 1 (sk 1) (cid:123)(cid:122) I1 , (cid:125) − K (cid:88) k=1 V πk 1 (sk 1) + G where the first inequality holds due to Lemma C.7, the second inequality holds due to the monotonicity of indicator function I k h , the last inequality holds due to I k h ≤ 1 and r(sk h) ≥ 0. h, ak For the term I1, we have K (cid:88) (cid:32) H (cid:88) k=1 h=1 r(sk h, ak h) − V πk 1 (sk 1) (cid:33) = = k=1 K (cid:88) h=1 H (cid:88) (cid:104) k=1 h=1 K (cid:88) H (cid:88) (cid:104) V πk h (sk h) − [PV πk h+1](sk (cid:105) h, ak h) − K (cid:88) k=1 V πk 1 (sk 1) V πk h+1(sk h+1) − [PV πk h+1](sk (cid:105) h, ak h) ≤ |A0| + | ˇA0| + | (cid:101)A0|, (C.36) where the inequality holds due to |x + y + z| ≤ |x| + |y| + |z|. For the term R0, according to Lemma C.8, we have  d (cid:118) (cid:117) (cid:117) (cid:116) K (cid:88) H (cid:88)  σ2 h,k + d  k=1 h=1 (cid:19) ˇS0 + d (cid:18) d(cid:112)Q0 + d (cid:18) d(cid:112)Q0 + d (cid:113) (cid:113) (cid:113) (cid:18) d(cid:112)Q0 + d d(cid:112)Q0 + d2(cid:17) (cid:16) R0 ≤ (cid:101)O ≤ (cid:101)O ≤ (cid:101)O ≤ (cid:101)O ≤ (cid:101)O ˇA1 + G + R0 + A0 + d (cid:19) G + R0 + (cid:112)Q0 + (cid:112) R0 + d (cid:19) , (C.37) where the first inequality follows from Lemma C.8, the second inequality follows from the definition of ˇS0 and Q0, the third inequality holds due to Lemma C.9, the fourth inequality is obtained by applying Lemma C.13 and C.14, the last inequality follows from the fact that x ≤ a x + b ⇒ x ≤ a2 + 2b and the upper bound of G in Lemma C.1. √ For the term A0, by Lemma C.14, we have A0 ≤ 132 log(1/δ) + 28(cid:112)R0 log(1/δ) + 40(cid:112)G log(1/δ) + 8(cid:112)Q0 log(1/δ). 37 Putting everything together, we have Regret(K) ≤ (cid:101)O (cid:16) d(cid:112)Q0 + d2(cid:17) . Thus, we complete the proof of Theorem 3.3. Corollary C.19. Under the same condition of Theorem 3.3, with probability at least 1−(4M +10)δ, the regret of Algorithm 2 is bounded by: Regret(K) ≤ (cid:101)O (cid:16) √ d K + d2(cid:17) . Proof. We prove this corollary on the event Er1 ∩ Er2 ∩ Er3 ∩ Er4 ∩ Ec ∩ Evar(cid:48), which occurs with probability at least 1 − (4M + 10)δ by Lemmas C.10, C.11, C.16, C.18, C.3, C.4. in Lemma C.18, we have By the definition of Er4 Q0 ≤ 2S0 + (cid:101)O(K) ≤ 2 (cid:101)A1 + G + 2(R0 + G + A0) + (cid:101)O(K) (R0 + 2G + A0 + ˇA0) log(1/δ) + 22 * log(1/δ) + G + 2(R0 + G + A0) + (cid:101)O(K) (cid:16) d(cid:112)Q0 + d2 + K (cid:17) (cid:113) ≤ 8 ≤ (cid:101)O ≤ (cid:101)O(K + d2), where the second inequality follows from Lemma C.15, the third inequality holds due to C.17, the fourth inequality is derived by Lemma C.14, Lemma C.13, (C.37) and omitting the lower order terms, the last inequality holds due to the fact that x ≤ a x + b ⇒ x ≤ a2 + 2b. √ By Theorem 3.3, we can obtain Regret(K) ≤ (cid:101)O(d(cid:112)Q0 + d2) ≤ (cid:101)O(d √ K + d2). Thus, we complete the proof of Corollary 3.4. D Auxiliary Lemmas Lemma D.1 (Azuma-Hoeffding inequality, Cesa-Bianchi and Lugosi 2006). Let {xi}n be a martingale difference sequence with respect to a filtration {Gi} satisfying |xi| ≤ M for some constant M , xi is Gi+1-measurable, E[xi|Gi] = 0. Then for any 0 < δ < 1, with probability at least 1 − δ, we have i=1 n (cid:88) i=1 xi ≤ M (cid:112)2n log(1/δ). Lemma D.2 (Lemma 11, Abbasi-Yadkori et al. 2011). For any λ > 0 and sequence {xk}K for k ∈ [K], define Zk = λI + (cid:80)k−1 have k=1 ⊂ Rd . Then, provided that (cid:107)xk(cid:107)2 ≤ L holds for all k ∈ [K], we i=1 xix(cid:62) i K (cid:88) k=1 min (cid:8)1, (cid:107)xk(cid:107)2 Z−1 k (cid:9) ≤ 2d log (cid:0)1 + KL2/(dλ)(cid:1). 38 Lemma D.3 (Lemma 12, Abbasi-Yadkori et al. 2011). Suppose A, B ∈ Rd×d are two positive definite matrices satisfying that A (cid:23) B, then for any x ∈ Rd, (cid:107)x(cid:107)A ≤ (cid:107)x(cid:107)B * (cid:112)det(A)/ det(B). Lemma D.4 (Freedman 1975). Let M, v > 0 be fixed constants. Let {xi}n {Gi}i be a filtration so that for all i ∈ [n], xi is Gi-measurable, while almost surely be a stochastic process, i=1 E [xi|Gi−1] = 0, |xi| ≤ M, n (cid:88) i=1 E[x2 i |Gi−1] ≤ v. Then for any δ > 0, with probability at least 1 − δ, we have n (cid:88) i=1 xi ≤ (cid:112)2v log(1/δ) + 2/3 * M log(1/δ). Lemma D.5 (Lemma 2, Zhang et al. 2021a). Let λ1, λ2, λ4 > 0, λ3 ≥ 1, and i(cid:48) = log2 λ1. Let (cid:112)ai+1 + 2i+1λ3 + λ4 hold for any a1, a2, * * * , ai(cid:48) be non-negative reals such that ai ≤ λ1 and ai ≤ λ2 1 ≤ i ≤ i(cid:48). Then we have that (cid:40)(cid:18) a1 ≤ max λ2 + (cid:113) λ2 2 + λ4 (cid:19)2 (cid:112) , λ2 (cid:41) 8λ3 + λ4 . References Abbasi-Yadkori, Y., Pál, D. and Szepesvári, C. (2011). Improved algorithms for linear stochastic bandits. In NIPS, vol. 11. Abe, N., Biermann, A. W. and Long, P. M. (2003). Reinforcement learning with immediate rewards and linear hypotheses. Algorithmica 37 263–293. Agarwal, A., Jin, Y. and Zhang, T. (2022). Vo q l: Towards optimal regret in model-free rl with nonlinear function approximation. arXiv preprint arXiv:2212.06069 . Auer, P. (2002). Using confidence bounds for exploitation-exploration trade-offs. Journal of Machine Learning Research 3 397–422. Auer, P., Cesa-Bianchi, N. and Fischer, P. (2002). Finite-time analysis of the multiarmed bandit problem. Machine learning 47 235–256. Ayoub, A., Jia, Z., Szepesvari, C., Wang, M. and Yang, L. (2020). Model-based reinforcement learning with value-targeted regression. In International Conference on Machine Learning. PMLR. Bubeck, S. and Cesa-Bianchi, N. (2012). Regret analysis of stochastic and nonstochastic multi-armed bandit problems. arXiv preprint arXiv:1204.5721 . Carpentier, A., Vernade, C. and Abbasi-Yadkori, Y. (2020). The elliptical potential lemma revisited. arXiv preprint arXiv:2010.10182 . Cesa-Bianchi, N. and Fischer, P. (1998). Finite-time regret bounds for the multiarmed bandit problem. In ICML, vol. 98. Citeseer. 39 Cesa-Bianchi, N. and Lugosi, G. (2006). Prediction, learning, and games. Cambridge university press. Chu, W., Li, L., Reyzin, L. and Schapire, R. (2011). Contextual bandits with linear payoff functions. In Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics. JMLR Workshop and Conference Proceedings. Dai, Y., Wang, R. and Du, S. S. (2022). Variance-aware sparse linear bandits. arXiv preprint arXiv:2205.13450 . Dani, V., Hayes, T. P. and Kakade, S. (2008). Stochastic linear optimization under bandit feedback. In COLT. Dann, C., Jiang, N., Krishnamurthy, A., Agarwal, A., Langford, J. and Schapire, R. E. (2018). On oracle-efficient pac rl with rich observations. Advances in neural information processing systems 31. Dann, C., Marinov, T. V., Mohri, M. and Zimmert, J. (2021). Beyond value-function gaps: Improved instance-dependent regret bounds for episodic reinforcement learning. In Neural Information Processing Systems. Du, S. S., Kakade, S. M., Wang, R. and Yang, L. F. (2019). Is a good representation sufficient for sample efficient reinforcement learning? arXiv preprint arXiv:1910.03016 . Freedman, D. A. (1975). On tail probabilities for martingales. JSTOR. Golub, G. H. and Van Loan, C. F. (2013). Matrix computations. JHU press. He, J., Zhao, H., Zhou, D. and Gu, Q. (2022a). Nearly minimax optimal reinforcement learning for linear markov decision processes. arXiv preprint arXiv:2212.06132 . He, J., Zhou, D. and Gu, Q. (2021a). Logarithmic regret for reinforcement learning with linear function approximation. In International Conference on Machine Learning. PMLR. He, J., Zhou, D. and Gu, Q. (2021b). Uniform-pac bounds for reinforcement learning with linear function approximation. Advances in Neural Information Processing Systems 34 14188–14199. He, J., Zhou, D., Zhang, T. and Gu, Q. (2022b). Nearly optimal algorithms for linear contextual bandits with adversarial corruptions. arXiv preprint arXiv:2205.06811 . Hu, P., Chen, Y. and Huang, L. (2022). Nearly minimax optimal reinforcement learning with linear function approximation. In International Conference on Machine Learning. PMLR. Jia, Z., Yang, L., Szepesvari, C. and Wang, M. (2020). Model-based reinforcement learning with value-targeted regression. In Learning for Dynamics and Control. PMLR. Jiang, N. and Agarwal, A. (2018). Open problem: The dependence of sample complexity lower bounds on planning horizon. In Conference On Learning Theory. PMLR. Jiang, N., Krishnamurthy, A., Agarwal, A., Langford, J. and Schapire, R. E. (2017). Contextual decision processes with low bellman rank are pac-learnable. In International Conference on Machine Learning. PMLR. 40 Jin, C., Krishnamurthy, A., Simchowitz, M. and Yu, T. (2020a). Reward-free exploration for reinforcement learning. In International Conference on Machine Learning. PMLR. Jin, C., Yang, Z., Wang, Z. and Jordan, M. I. (2020b). Provably efficient reinforcement learning with linear function approximation. In Conference on Learning Theory. PMLR. Kim, Y., Yang, I. and Jun, K.-S. (2021). Improved regret analysis for variance-adaptive linear bandits and horizon-free linear mixture mdps. arXiv preprint arXiv:2111.03289 . Kirschner, J. and Krause, A. (2018). Information directed sampling and bandits with het- eroscedastic noise. In Conference On Learning Theory. PMLR. Lattimore, T., Crammer, K. and Szepesvári, C. (2015). Linear multi-resource allocation with semi-bandit feedback. Advances in Neural Information Processing Systems 28. Lattimore, T. and Szepesvári, C. (2020). Bandit algorithms. Cambridge University Press. Li, L., Chu, W., Langford, J. and Schapire, R. E. (2010). A contextual-bandit approach to personalized news article recommendation. In Proceedings of the 19th international conference on World wide web. Li, Y., Wang, R. and Yang, L. F. (2022). Settling the horizon-dependence of sample complexity in reinforcement learning. In 2021 IEEE 62nd Annual Symposium on Foundations of Computer Science (FOCS). IEEE. Li, Y., Wang, Y. and Zhou, Y. (2019). Nearly minimax-optimal regret for linearly parameterized bandits. In Conference on Learning Theory. PMLR. Maillard, O.-A., Mann, T. A. and Mannor, S. (2014). How hard is my mdp?" the distribution- norm to the rescue". Advances in Neural Information Processing Systems 27. Modi, A., Jiang, N., Tewari, A. and Singh, S. (2020). Sample complexity of reinforcement learning using linearly combined model ensembles. In International Conference on Artificial Intelligence and Statistics. PMLR. Puterman, M. L. (2014). Markov decision processes: discrete stochastic dynamic programming. John Wiley & Sons. Robbins, H. (1952). Some aspects of the sequential design of experiments. Bull. Amer. Math. Soc. 58 527–535. Simchowitz, M. and Jamieson, K. G. (2019). Non-asymptotic gap-dependent regret bounds for tabular mdps. In Neural Information Processing Systems. Sun, W., Jiang, N., Krishnamurthy, A., Agarwal, A. and Langford, J. (2019). Model-based rl in contextual decision processes: Pac bounds and exponential improvements over model-free approaches. In Conference on learning theory. PMLR. Thompson, W. R. (1933). On the likelihood that one unknown probability exceeds another in view of the evidence of two samples. Biometrika 25 285–294. 41 Villar, S. S., Bowden, J. and Wason, J. (2015). Multi-armed bandit models for the optimal design of clinical trials: benefits and challenges. Statistical science: a review journal of the Institute of Mathematical Statistics 30 199. Wagenmaker, A. J., Chen, Y., Simchowitz, M., Du, S. and Jamieson, K. (2022). First-order regret in reinforcement learning with linear function approximation: A robust estimation approach. In International Conference on Machine Learning. PMLR. Wang, R., Du, S. S., Yang, L. and Kakade, S. (2020a). Is long horizon rl more difficult than short horizon rl? Advances in Neural Information Processing Systems 33 9075–9085. Wang, Y., Wang, R., Du, S. S. and Krishnamurthy, A. (2020b). Optimism in reinforcement learning with generalized linear function approximation. In International Conference on Learning Representations. Weisz, G., Amortila, P. and Szepesvári, C. (2021). Exponential lower bounds for planning in mdps with linearly-realizable optimal action-value functions. In Algorithmic Learning Theory. PMLR. Xu, H., Ma, T. and Du, S. (2021). Fine-grained gap-dependent bounds for tabular mdps via adaptive multi-step bootstrap. In Conference on Learning Theory. PMLR. Yang, L. and Wang, M. (2019). Sample-optimal parametric q-learning using linearly additive features. In International Conference on Machine Learning. Yang, L. and Wang, M. (2020). Reinforcement learning in feature space: Matrix bandit, kernels, and regret bound. In International Conference on Machine Learning. PMLR. Zanette, A., Brandfonbrener, D., Brunskill, E., Pirotta, M. and Lazaric, A. (2020a). Frequentist regret bounds for randomized least-squares value iteration. In International Conference on Artificial Intelligence and Statistics. PMLR. Zanette, A. and Brunskill, E. (2019). Tighter problem-dependent regret bounds in reinforcement learning without domain knowledge using value function bounds. In International Conference on Machine Learning. PMLR. Zanette, A., Lazaric, A., Kochenderfer, M. and Brunskill, E. (2020b). Learning near optimal policies with low inherent bellman error. In International Conference on Machine Learning. PMLR. Zhang, Z., Ji, X. and Du, S. (2021a). Is reinforcement learning more difficult than bandits? a near-optimal algorithm escaping the curse of horizon. In Conference on Learning Theory. PMLR. Zhang, Z., Ji, X. and Du, S. (2022). Horizon-free reinforcement learning in polynomial time: the power of stationary policies. In Conference on Learning Theory. PMLR. Zhang, Z., Yang, J., Ji, X. and Du, S. S. (2021b). Improved variance-aware confidence sets for linear bandits and linear mixture mdp. Advances in Neural Information Processing Systems 34 4342–4355. 42 Zhao, H., Zhou, D., He, J. and Gu, Q. (2022). Bandit learning with general function classes: Heteroscedastic noise and variance-dependent regret bounds. arXiv preprint arXiv:2202.13603 . Zhou, D. and Gu, Q. (2022). Computationally efficient horizon-free reinforcement learning for linear mixture mdps. In Advances in Neural Information Processing Systems. Zhou, D., Gu, Q. and Szepesvari, C. (2021a). Nearly minimax optimal reinforcement learning for linear mixture markov decision processes. In Conference on Learning Theory. PMLR. Zhou, D., He, J. and Gu, Q. (2021b). Provably efficient reinforcement learning for discounted mdps with feature mapping. In International Conference on Machine Learning. PMLR. Zhou, R., Zhang, Z. and Du, S. S. (2023). Sharp variance-dependent bounds in reinforcement learning: Best of both worlds in stochastic and deterministic environments. arXiv preprint arXiv:2301.13446 . 43
http://arxiv.org/abs/2302.10364v3
2023-06-20T08:53:12
2023-02-20T23:51:33
Gaussian processes at the Helm(holtz): A more fluid model for ocean currents
Given sparse observations of buoy velocities, oceanographers are interested in reconstructing ocean currents away from the buoys and identifying divergences in a current vector field. As a first and modular step, we focus on the time-stationary case - for instance, by restricting to short time periods. Since we expect current velocity to be a continuous but highly non-linear function of spatial location, Gaussian processes (GPs) offer an attractive model. But we show that applying a GP with a standard stationary kernel directly to buoy data can struggle at both current reconstruction and divergence identification, due to some physically unrealistic prior assumptions. To better reflect known physical properties of currents, we propose to instead put a standard stationary kernel on the divergence and curl-free components of a vector field obtained through a Helmholtz decomposition. We show that, because this decomposition relates to the original vector field just via mixed partial derivatives, we can still perform inference given the original data with only a small constant multiple of additional computational expense. We illustrate the benefits of our method with theory and experiments on synthetic and real ocean data.
[ "Renato Berlinghieri", "Brian L. Trippe", "David R. Burt", "Ryan Giordano", "Kaushik Srinivasan", "Tamay Özgökmen", "Junfei Xia", "Tamara Broderick" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10364v3", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10364v3", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "stat.ME", "@scheme": "http://arxiv.org/schemas/atom" }
[ "stat.ME", "cs.LG", "physics.ao-ph", "stat.AP", "stat.ML" ]
3 2 0 2 n u J 0 2 ] E M . t a t s [ 3 v 4 6 3 0 1 . 2 0 3 2 : v i X r a Gaussian Processes at the Helm(holtz): A More Fluid Model for Ocean Currents Renato Berlinghieri 1 Brian L. Trippe 2 David R. Burt 1 Ryan Giordano 1 Kaushik Srinivasan 3 Tamay ̈Ozg ̈okmen 4 Junfei Xia 4 Tamara Broderick 1 Abstract Given sparse observations of buoy velocities, oceanographers are interested in reconstructing ocean currents away from the buoys and identify- ing divergences in a current vector field. As a first and modular step, we focus on the time-stationary case – for instance, by restricting to short time periods. Since we expect current velocity to be a continuous but highly non-linear function of spa- tial location, Gaussian processes (GPs) offer an attractive model. But we show that applying a GP with a standard stationary kernel directly to buoy data can struggle at both current reconstruc- tion and divergence identification, due to some physically unrealistic prior assumptions. To better reflect known physical properties of currents, we propose to instead put a standard stationary ker- nel on the divergence and curl-free components of a vector field obtained through a Helmholtz decomposition. We show that, because this de- composition relates to the original vector field just via mixed partial derivatives, we can still perform inference given the original data with only a small constant multiple of additional computational ex- pense. We illustrate the benefits of our method with theory and experiments on synthetic and real ocean data. 1. Introduction Ocean currents are key to the global distribution of water, heat, and nutrients. To better understand ocean currents, scientists are interested in two tasks: (1) reconstructing ocean currents at different locations and (2) identifying di- 1Department of Electrical Engineering and Computer Science, Massachusetts Institute of Technology 2Department of Statistics, Columbia University 3Department of Atmospheric and Oceanic Sciences, UCLA 4Department of Ocean Sciences, Rosenstiel School of Marine and Atmospheric Science, University of Mi- ami. Correspondence to: Renato Berlinghieri <[email protected]>. Proceedings of the 40 th International Conference on Machine Learning, Honolulu, Hawaii, USA. PMLR 202, 2023. Copyright 2023 by the author(s). 1 vergences in the current vector field. Reconstructing ocean currents accurately can facilitate weather forecasting, mar- itime navigation, and forecasting of oil spill dispersion. And current divergences are important to identify since they are responsible for the transport of biomass, carbon, and nutri- ents – with implications for ecosystem management, climate, and the fishing industry (D'Asaro et al., 2018). With these tasks in mind, researchers release and track GPS-tagged buoys in the ocean ( ̈Ozg ̈okmen, 2012; D'Asaro et al., 2017). It remains to choose an appropriate method to reconstruct currents and their divergences from buoy data. Gonc ̧alves et al. (2019) and Lodise et al. (2020) proposed modeling buoy velocities in the latitude and longitude directions ac- cording to independent Gaussian processes (GPs) with stan- dard spatiotemporal kernels (e.g., squared exponential ker- nels). In our work, we focus on the spatial aspects of this task and assume the velocity field is stationary in time. Even under this simplification, an independent spatial GP prior on the velocities is a natural choice due to its ability to han- dle the sparsity of buoy observations on the ocean surface and its assumption that currents vary continuously but in a nonlinear fashion. We call such a model the velocity GP. However, in what follows, we show that there remains sub- stantial room for improvement. In simulated cases where we have access to ground truth, we observe that the velocity GP approach can fail to complete vortices or fail to connect currents when buoys are observed sparsely. And while we show how to derive divergence estimates for the velocity GP, we also find that these estimates often fail to capture the true divergence when it is known in simulations or real data. To address these issues, we propose to more directly model known behaviors from fluid dynamics. Scientists know that the motion of a volume element of a continuous fluid medium in two dimensions consists of (i) expansion or con- traction in two orthogonal directions, (ii) rotation about an instantaneous axis, and (iii) translation. A Helmholtz decom- position (Bhatia et al., 2013; Arfken & Weber, 1999) from fluid dynamics lets us decompose the vector field of ocean currents into a divergent component (or curl-free, measur- ing expansion, contraction, and translation) and a rotational component (or divergence-free, measuring rotation).1 1The divergent component is called curl-free and the rotational Gaussian Processes at the Helm(holtz) By contrast to the standard approach, we model the diver- gent and rotational components (rather than the velocity components) with independent GP priors. The resulting Helmholtz GP prior offers several conceptual advantages. For one, oceanographers expect the two components to have substantially different magnitudes and length scales; it is straightforward to encode these differences with a Helmholtz GP. By contrast, we prove that the velocity GP implies an a priori belief that the divergent and rotational components have the same magnitude. Second, we expect correlation between the longitudinal and latitudinal com- ponents of a current, which the Helmholtz GP exhibits – and the velocity GP lacks by construction. Finally, the Helmholtz GP is agnostic to the (arbitrary) choice of refer- ence frame, while the velocity GP is not necessarily. We demonstrate that the Helmholtz GP is amenable to prac- tical inference. Since (i) the Helmholtz decomposition is based on partial (mixed) derivatives, and (ii) the derivative of a GP is a GP, we show that our prior choice implies a tractable GP prior on the current itself. Therefore, we can still perform inference given the original data with no ex- tra approximation. And our method suffers no increase in computational complexity relative to the velocity GP. Finally, we demonstrate the superior performance of the Helmholtz GP at the current-reconstruction task and divergence-estimation task (as well as vorticity estima- tion) in a variety of experiments on simulated and real data. Code is available at https://github.com/ renatoberlinghieri/Helmholtz-GP. Related work. The Helmholtz decomposition has been used for visualization and physical interpretation of an oceano- graphic field (Rocha et al., 2016; Zhang et al., 2018; 2019; Han & Huang, 2020; B ̈uhler et al., 2014; Caballero et al., 2020). But these methods assume the velocity vector field is known on a grid whereas our goal is to reconstruct the vector field from sparse observations. Prior work in atmospheric statistics used a Helmholtz decomposition to perform re- gression on the residuals of a physical model (Daley, 1985; Hollingsworth & L ̈onnberg, 1986); this approach would give the same mean prediction2 as the Helmholtz GP if the same covariance function were used. However, to estimate the covariance function, the authors rely on a series repre- sentation and binning procedure; without hand-tuning that depends on the data and physics of the system (e.g., for determining the number of coefficients), this procedure can result in covariance functions that are not positive definite. component is called divergence-free because their curl and diver- gence are zero everywhere, respectively. See Proposition B.5. 2Here and throughout, we use the word prediction in the ma- chine learning sense; it describes the task of making informed guesses about unseen data points using a trained model and need not imply looking forward in time. 2 Researchers have developed GP kernels to capture curl- or divergence-free fields (Narcowich & Ward, 1994; Lowitzsch, 2002; Fuselier, 2007; Macˆedo & Castro, 2010; Alvarez et al., 2012). Macˆedo & Castro (2010) propose using convex com- binations of such kernels. However, these works do not pro- pose methods for recovering the weighting of the two com- ponents and do not empirically test recovery of the compo- nents when the weighting is unknown – the case of interest in the oceans problem. Wahlstr ̈om et al. (2013); Wahlstr ̈om (2015); Solin et al. (2018) use curl- and divergence-free kernels for electromagnetic fields. Wahlstr ̈om (2015) pro- poses independent GP priors on the terms in a Helmholtz decomposition. But the authors assume direct access to noisy observations of each of the divergence-free and curl- free components separately – whereas we aim to recover the individual components from noisy observations of their sum. Moreover, Wahlstr ̈om (2015) constrains the two com- ponents to have the same prior magnitudes and length scales, but these quantities can be expected to vary substantially between components in ocean currents. Finally, Greydanus & Sosanya (2022) extended Hamiltonian Neural Networks (Greydanus et al., 2019) to model both curl- and divergence- free dynamics simultaneously. Although the prediction prob- lem is similar, the authors test their method only on low- resolution data available on a dense grid. In our experiments on (sparse) buoy data in Section 5 and Appendix I, we find that their method often produces predictions that are less accurate and less physically plausible. In sum, then, it is not clear from existing work that diver- gence and vorticity can be usefully or practically recovered when observations come from a general (noisy) vector field that is neither curl- nor divergence-free. Moreover, there is no existing guidance on how to use a Helmholtz GP in prac- tice for identifying divergences or making predictions from such noisy vector-field observations, and no information is available on how a Helmholtz GP compares to a velocity GP on these tasks – either empirically or theoretically. We discuss related work further in Appendix A. 2. Background In what follows, we first describe the problem setup. Then we establish necessary notation and concepts from the Helmholtz decomposition and Gaussian processes. m )⊤ m , x(2) (xm, ym) { m=1. Here xm = (x(1) M } Problem Statement. We consider a dataset D of M obser- R2 vations, represents the location of a buoy, typically a longitude and latitude pair. We treat xm as a column vector. And ym = (y(1) R2 gives the corresponding longitu- dinal and latitudinal velocities of the buoy (the drifter trace). , we consider ym as a sparse noisy For m } observation of a 2-dimensional vector field, F : R2 R2, mapping spatial locations into longitudinal and latitudinal m , y(2) 1, . . . , M m )⊤ ∈ { → ∈ ∈ Gaussian Processes at the Helm(holtz) velocities, F (xm) = (F (1)(xm), F (2)(xm))⊤. We assume that the velocity field is stationary in time, and so F is not a function of time. Our primary goals are (1) prediction of the field F at new locations, not observed in the training data, and (2) estimation of the divergence, itself a function of location and which we define next as part of the Helmholtz decomposition. Secondarily, we are interested in recovering vorticity, another functional of F described below. Table 1. Terms and notation around the divergence and vorticity. Φ grad Φ δ = div(grad Φ) Ψ rot Ψ ζ = curl(rot Ψ) potential function divergent velocity divergence stream function rotational velocity vorticity The Helmholtz Decomposition. The motion of a volume element of a fluid, such as the ocean, can be decomposed into a divergent velocity and a rotational velocity. Definition 2.1 (Helmholtz decomposition, Bhatia et al., 2013). A twice continuously differentiable and compactly R2 can be expressed as the supported vector field F : R2 sum of the gradient of a scalar potential Φ : R2 R, called the potential function, and the vorticity operator of another scalar potential Ψ : R2 R, called the stream function: → → → = grad Φ (cid:124) (cid:123)(cid:122) (cid:125) divergent velocity + rot Ψ (cid:124) (cid:123)(cid:122) (cid:125) rotational velocity (1) F (cid:124)(cid:123)(cid:122)(cid:125) ocean flow where grad Φ := (cid:21) (cid:20)∂Φ/∂x(1) ∂Φ/∂x(2) and rot Ψ := (cid:21) (cid:20) ∂Ψ/∂x(2) ∂Ψ/∂x(1) − . (2) The divergence of F (denoted δ) and the vorticity of F (denoted ζ) are the identity matrix in p dimensions. We use 0 to denote the zero element in any vector space. ∈ → → Before defining our prior, we review Gaussian processes R2 represent two input vectors. As- (GPs). Let x, x′ sume that we want to model a P -dimensional function G : R2 RP , G(x) = (G(1)(x), . . . , G(P )(x))⊤. A P - output GP on covariate space R2 is determined by a mean RP , μ(x) = (μ(1)(x), . . . , μ(P )(x))⊤, function μ : R2 and a positive definite kernel function k : R2 RP ×P . We use k(x, x′)i,j to denote the (i, j)th output of k(x, x′). (μ, k) We say that G is GP distributed and write G ∼ GP R2×N , and if for any N N , for any vector of indices (p1, . . . , pN ) 1, . . . , P (G(pn)(xn))N n=1 is an N -dimensional Gaussian random variable with mean vector (μ(pn)(xn))N n=1 and covariance matrix with (i, j)th entry k(xi, xj)pi,pj . See Alvarez et al. (2012) for a review of multi-output GPs. N, for any (x1, . . . , xN ) ∈ ∈ { R2 → × ∈ } δ := div(F ) := ζ := curl(F ) := + ∂F (1) ∂x(1) ∂F (1) ∂x(2) − ∂F (2) ∂x(2) ∂F (2) ∂x(1) = = ∂2Φ ∂2x(1) ∂2Ψ ∂2x(2) + + (3) ∂2Φ ∂2x(2) ∂2Ψ ∂2x(1) . (4) Velocity Gaussian Process. In spatial data analysis, com- monly μ is chosen to be identically 0. And a conventional choice for k would be an isotropic kernel3 separately in each output dimension. That is, for any x, x′ R2, ∈ In Equation (3), div(F ) depends only on Φ because div(rot Ψ) = 0. In other words, the rotational velocity is divergence-free. Similarly, in Equation (4), curl(F ) de- pends only on Ψ because curl(grad Φ)) = 0. In other words, the divergent velocity is curl-free. We review the grad, rot, div, and curl operators – and explore the equa- tions above in more detail – in Appendix B. We summarize the various terms in Table 1. In Appendix C, we present a graphical illustration of a Helmholtz decomposition of a selected vector field, and we further discuss the importance of divergence and vorticity within ocean currents. Bayesian Approach and Gaussian Process Prior. In what follows, we will take a Bayesian approach to inferring F . In particular, we assume a likelihood, or noise model, relating the observed buoy velocities to the field F : ym = F (xm) + εm, εm ind ∼ N (0, σ2 obsI2), 1 m ≤ ≤ M, (5) ind for some σ2 ∼ vations. Here and throughout, we use Ip obs > 0 and independent ( ) noise across obser- Rp×p to denote ∈ kvel(x, x′) = (cid:20)k(1)(x, x′) 0 (cid:21) 0 k(2)(x, x′) . (6) where k(1) and k(2) are isotropic kernels. We call this choice the velocity GP to emphasize that the independent priors are directly on the observed velocities. A standard kernel choice for k(i), i 1, 2 , is the squared exponential kernel, } ∈ { k(i) SE (x, x′) = σ2 i exp (cid:0) x 1 2 ∥ − − x′ ∥ 2/l2 2 i (cid:1) . (7) The velocity GP with squared exponential kernels for each component (henceforth, the SE-velocity GP) has four hy- , the signal variance σ2 i > 0 1, 2 perparameters: for i } determines the variation of function values from their mean in the ith output dimension, and li > 0 controls the length scale on which the function varies. ∈ { 3We say a kernel k is isotropic if there exists some κ : R+ → R such that for any x and x′ in R2, k(x, x′) = κ(∥x − x′∥). 3 Gaussian Processes at the Helm(holtz) 3. Gaussian Processes at the Helm(holtz) Instead of putting separate GP priors with isotropic kernels on the two components of F as in the velocity GP, we propose to put separate GP priors with isotropic kernels on the Helmholtz scalar potentials Φ and Ψ. In this section, we describe our model and how to retrieve the quantities of interest from it. In the next section, we describe its conceptual strengths over the velocity GP, which we see empirically in Section 5. Our Helmholtz GP prior. To form our new Helmholtz GP prior, we put independent GP priors on the Helmholtz stream and potential functions: Φ ∼ GP (0, kΦ) and Ψ ∼ GP (0, kΨ), (8) where we take kΦ and kΨ to be isotropic kernels. When these kernels are chosen to be squared exponentials (Equa- tion (7)), we call our model the SE-Helmholtz GP. The SE-Helmholtz GP has four parameters: lΦ and σ2 Φ for kΦ, and lΨ and σ2 Ψ for kΨ. We could use any two kernels such that sample paths of the resulting GPs are almost surely con- tinuously differentiable (so that F in Equation (1) is well- defined and continuous). Generally, we will want to be able to consider divergences and vorticities of the implied pro- cess, which will require sample paths of the implied process to be at least twice-continuously differentiable. For the latter condition to hold, it is sufficient for kΦ(0, x) and kΨ(0, x) to have continuous mixed partial derivatives up to order five; see Lindgren (2012, Theorem 2.09 & Section 7.2). First, we check that our prior yields a GP prior over the vector field F . Proposition 3.1. Let F be an ocean current vector field de- fined by potential and stream functions that are independent (0, kΨ), and distributed as Φ where kΦ and kΨ are such that Φ and Ψ have almost surely continuously differentiable sample paths. Then (0, kΦ) and Ψ ∼ GP ∼ GP F = grad Φ + rot Ψ where, for x, x′ to ∈ R2, i, j ∈ (0, kHelm), (9) ∼ GP 1, 2, kHelm(x, x′)i,j is equal ∂2kΦ(x, x′) ∂x(i)∂(x′)(j) + ( − 1)1{i̸=j} ∂2kΨ(x, x′) ∂x(3−i)∂(x′)(3−j) . (10) Our proof in Appendix E relies on two observations: (i) the Helmholtz decomposition is based on partial (mixed) derivatives and (ii) the derivative of a GP is a GP; see, e.g., Rasmussen & Williams (2005, Chapter 9.4), and Adler (1981, Theorem 2.2.2). Making predictions. To make predictions using our Helmholtz GP, we need to choose the hyperparameter val- ues and then evaluate the posterior distribution of the ocean current given those hyperparameters. We choose the GP hyperparameters by maximizing the log marginal likelihood of the training data. To write R2×M be the ma- that marginal likelihood, we let Xtr ∈ trix with mth column equal to xm. We define Ytr = (y(1) R2M . We extend the M )⊤ definition of the mean and kernel function to allow for ar- bitrary finite collections of inputs. In particular, for X = R2×N ′ (x1, . . . , xN ) , R2×N and X′ = (x′ 1 , . . . , y(1) 1 , . . . , y(2) M , y(2) 1, . . . , x′ N ′) ∈ ∈ ∈ μ(X) = k(X, X′) = and (cid:19) (cid:18)μ(1)(X) μ(2)(X) (cid:18)k(X, X′)1,1 k(X, X′)2,1 (cid:19) k(X, X′)1,2 k(X, X′)2,2 (11) (12) 1, 2 ∈ { ∈ { ∈ { , n } 1, . . . , N , μ(i)(X) is an where (a) for i } N -dimensional column vector with nth entry μ(i)(xn), and , n′ 1, 2 (b) for i, j , n , ∈ { } } N ′ matrix with (n, n′)th entry k(X, X′)i,j is an N k(xn, x′ n′)i,j. With this notation, we denote the covari- ance of the training data with itself, under the full model including noise, as Ktrtr = k(Xtr, Xtr) + σ2 obsI2M . Then the log marginal likelihood is 1, . . . , N ′ 1, . . . , N ∈ { × } log p(Ytr 1 2 | trK −1 Xtr) = log N 1 log 2 trtrYtr YT = − − (Ytr; 0, Ktrtr) Ktrtr | | − 2M 2 log 2π, (13) where takes the determinant of its matrix argument. We provide details of our optimization procedure in Section 5. | * | With hyperparameter values in hand, we form probabilistic predictions using the posterior of the GP. In particular, the posterior mean forms our prediction at a new set of points, and the posterior covariance encapsulates our uncertainty. ∈ to x⋆ the current. We gather R2×N , with nth column equal Consider N new (test) locations at which we would them in like to predict Xte n. We denote the covariance of various training and test- ing combinations as: Ktetr = k(Xte, Xtr) and Ktete = k(Xte, Xte). Then a posteriori after ob- the 2N -long vector serving the training data D, N ))⊤ N ), . . . , F (2)(x⋆ 1), . . . , F (1)(x⋆ (F (1)(x⋆ describing the current at the test locations has a normal distribution with mean and covariance 1) . . . , F (2)(x⋆ μF |D = KtetrK −1 KF |D = Ktete trtrYtr, KtetrK −1 trtrK ⊤ tetr. − (14) (15) For more details, see Rasmussen & Williams (2005, Section 2.2). Note that these formulas can be used to evaluate poste- rior moments of the velocity field for either the Helmholtz GP (setting k = kHelm) or the velocity GP (with k = kvel). Recovering divergence and vorticity. We next show how to recover the posterior distributions on the divergence and 4 Gaussian Processes at the Helm(holtz) vorticity scalar fields given a posterior on the current field F . We can estimate divergence and vorticity at any location by using the posterior mean at that point, and we can report un- certainty with the posterior variance. Note that our formulas recover divergence and vorticity for either our Helmholtz GP or the velocity GP. (μ, k) be a two-output Gaus- Proposition 3.2. Let F ∼ GP sian process with almost surely continuously differentiable sample paths. Then, for x, x′ R2, ∈ δ = div F ζ = curl F (div μ, kδ) (curl μ, kζ) ∼ GP ∼ GP where kδ(x, x′) = (cid:88) ∂2k(x, x′)i,j ∂x(i)∂x(j) 1)i+j ∂2k(x, x′)i,j ∂x(3−i)∂x(3−j) . (i,j)∈{1,2}2 (cid:88) ( − (i,j)∈{1,2}2 kζ(x, x′) = (16) (17) (18) (19) We provide the proof for Proposition 3.2 in Appendix F. Computational Cost. Since the latitude and longitude out- puts are correlated under the Helmholtz GP, it generally has a higher computational cost than the velocity GP. We establish that the extra cost is no worse than a small factor. Proposition 3.3. Take M training data points. Let Cvel(M ) and Chelm(M ) be the computational costs for evaluating the log marginal likelihood (Equation (13)) via Cholesky or QR factorization algorithms for the velocity GP and Helmholtz GP, respectively. If we assume worst-case scaling 4. for these algorithms, limM→∞ Chelm(M )/Cvel(M ) ≤ Ktrtr | The cost of computing the log marginal likelihood is domi- nated by the cost of solving the linear system K −1 trtrYtr and . Both of these costs computing the log determinant | in turn arise primarily from the cost of factorizing Ktrtr. Let CF(s) be the cost of factorizing a square matrix with s rows with Cholesky or QR factorization. Due to the two (corre- lated) outputs, the cost of the Helmholtz GP is dominated by CF(2M ). In the velocity GP, the two outputs are uncorre- lated and can be handled separately, so the cost is dominated by 2CF(M ). Therefore, limM→∞ Chelm(M )/Cvel(M ) ≤ CF(2M )/(2CF(M )). When factorizing the matrix costs (0, 3], c > 0, the result follows by CF(s) Equation (26). Standard Cholesky and QR factorization algorithms satisfy the condition with p = 3 in the worst case (Golub & Van Loan, 2013, p. 164, 249). csp for p ∼ ∈ In Appendix G we provide similar computational results for the task of prediction and discuss nuances of how any of these results may change in the presence of special structure. 5 4. Advantages of the Helmholtz prior We next describe three key advantages of the Helmholtz GP prior over the velocity GP prior: (1) more physically realistic prior assumptions reflecting the relative magnitude and length scales of the divergence and vorticity, (2) more physically realistic correlation of the longitudinal and latitu- dinal velocities of current at any point, and (3) equivariance to reference frame. Prior magnitude of the divergence and vorticity. In real ocean flows, except at small-scale frontal features, the diver- gence is known a priori to have both a substantively different magnitude and different length scale relative to the vorticity (Barkan et al., 2019). In what follows, we argue that the Helmholtz GP is able to capture the relative contributions of divergence and vorticity directly in the prior – whereas the velocity GP does not have this direct control. Φ and σ2 On the magnitude side, the divergence is known to con- tribute much less to the current than the vorticity contributes. If we consider a SE-Helmholtz GP, the signal variance hy- perparameters σ2 Ψ control the magnitude of Φ and Ψ; as a direct consequence of the linearity of the diver- gence δ and vorticity ζ in Φ and Ψ (Equations (3) and (4)), the marginal variances of δ and ζ scale linearly with σ2 Φ and σ2 Ψ, respectively. The model can therefore directly and separately control the magnitude of the rotational and diver- gence components. A similar argument can be applied to more general Helmholtz GPs with parameters controlling the magnitude of Φ and Ψ. By contrast, the velocity GP provides no such control. In fact, for any isotropic choice of k(1) and k(2) we show that the resulting velocity GP must assume the same variance on the divergence and vorticity in the prior. Proposition 4.1. Let k(1) and k(2) be isotropic kernels R2. Take F (1) with inputs x, x′ (0, k(1)) and F (2) (0, k(2)) independent. Suppose k(1) and k(2) are such that F (1), F (2) have almost surely continuously dif- ferentiable sample paths. Let δ and ζ be defined as in Equa- tions (3) and (4). Then for any x, Var[δ(x)] = Var[ζ(x)]. ∼ GP ∼ GP ∈ The proof of Proposition 4.1 appears in Appendix H.1. Prior length scales of the divergence and vorticity. The divergence and vorticity are also known to operate on very different length scales in real ocean flows. Vorticity op- erates over long length scales, whereas divergence tends to be more localized. Similarly to the argument above, the Helmholtz GP allows control over the length scale in each of its components, which directly control the length In particular, if scale of the divergence and vorticity. R, kΦ(x, x′) = κ( x′ x ∥ then kδ(x, x′) = l−4η( /l) for another function ∥ R that does not depend on l; see Appendix H.2. η : R+ /l), for some κ : R+ ∥ x ∥ → x′ − − → Gaussian Processes at the Helm(holtz) Table 2. Green identifies the lowest RMSE. Dark green indicates the RMSE is at least two times smaller than the next best model. VORTEX SMALL DIVERGENCE MEDIUM DIVERGENCE BIG DIVERGENCE DUFFING W/ SMALL DIVERGENCE DUFFING W/ MEDIUM DIVERGENCE DUFFING W/ BIG DIVERGENCE VELOCITY F VEL 0.72 1.25 0.19 0.10 2.05 0.60 0.22 D-HNN 0.54 0.67 0.55 0.19 2.14 1.65 1.63 HELM 0.24 1.11 0.17 0.04 0.96 0.19 0.41 DIVERGENCE δ VEL 0.22 1.45 0.33 0.12 0.95 0.50 0.17 D-HNN 0.87 4.14 1.32 0.27 1.89 1.15 1.10 HELM 0.0 2.62 0.39 0.05 0.94 0.14 0.08 VORTICITY ζ VEL 1.05 1.07 0.12 0.10 2.28 0.26 0.16 D-HNN 1.03 0.31 0.38 0.11 2.64 2.39 2.41 HELM 0.77 0.0 0.05 0.00 1.40 0.24 0.48 By contrast, the velocity GP requires setting the length scales of its priors in tandem, and it is unclear how to con- trol the length scales of the divergence and vorticity. Correlations between longitudinal and latitudinal current components. Ocean flows have correlation between longitudinal and latitudinal velocities at single locations and across different locations. For instance, within a vortex, the longitudinal velocity at six o'clock (relative to the center of the vortex) coincides with a zero latitudinal velocity at that same location, and also with a non-zero latitudinal velocity at three o'clock. Likewise, the occurrence of divergence at a given point induces a latitudinal velocity at six o'clock (with no longitudinal velocity), as well as a non-zero longitudinal velocity at three o'clock (with no latitudinal velocity). By modeling the divergence and vorticity directly, the Helmholtz prior induces correlation between the longitudinal and latitudinal components, which is absent in the velocity GP prior. Equivariance to reference frame. We now show the Helmholtz GP is agnostic to the choice of reference frame defined by longitude and latitude, but the velocity GP is not. Proposition 4.2. Let μF|D(Xte, Xtr, Ytr) denote the Helmholtz GP posterior mean for training data Xtr, Ytr and test coordinates Xte, and let R be an operator rotating coordinates and velocities about (0, 0). Then μF|D(RXte, RXtr, RYtr) = RμF|D(Xte, Xtr, Ytr). (20) Proposition 4.2 formalizes that it is equivalent to either (1) rotate the data and then predict using the Helmholtz GP or (2) predict using the Helmholtz GP and rotate the prediction. The proof of Proposition 4.2 is given in Appendix H.3. The equivariance property in Proposition 4.2 need not hold in general for velocity GP priors. Proposition 4.3. For isotropic component kernels and zero prior mean, the velocity GP is reference-frame equivariant if and only if the kernels for each component are equal. See Appendix H.4 for the proof. Intuitively, if the kernels are equal, both the prior and likelihood (and therefore the entire ∼ GP model) are isotropic, and so there is no special reference frame. For intuition in the other direction, consider the following counterexample. Let F (1) (0, k(1)) for some non-identically zero isotropic k(1). And F (2) = 0, a trivial isotropic prior. Take any data Xtr, Ytr, Xte, and a positive (counterclockwise) 90◦ rotation. Due to the trivial prior in the second coordinate, the posterior in the second coordinate has mean μ(2) F|D(Xte, Xtr, Ytr) = 0. If we rotate the data first, the posterior in the second coordinate is still zero, and generally the posterior in the first coordinate will be nontrivial. But if we first compute the posterior and then rotate the mean, the posterior in the first coordinate will now be zero instead, and the posterior in the second coordinate will be nonzero. Therefore, the equality in Equation (20) will not hold for this velocity GP. 5. Experimental Results We next empirically compare the SE-Helmholtz GP and SE-velocity GP. We find that the SE-Helmholtz GP yields better current predictions as well as better divergence (and vorticity) identification, across a variety of simulated and real data sets. We also compare to dissipative Hamiltonian neural networks (D-HNNs) (Greydanus & Sosanya, 2022) in Table 2 and Appendix I but find that the GP methods generally perform better. Data. The real datasets we use consist of drifter traces of GPS-tagged buoys in the ocean. While oceanographers have some knowledge that allows a rough assessment of the real data, only in simulations do we have access to ground truth currents, divergences, and vorticities. Therefore, we run a variety of simulations with current vector fields reflecting known common ocean behaviors. We simulate buoy trajec- tories by initializing buoys at a starting point and allowing the current field to drive their motion. See Appendix I for more details of our setup in each specific simulation. Performance. In what follows, we emphasize visual com- parisons both because the distinctions between methods are generally clear and because it is illuminating to visually pick out behaviors of interest. We also provide root mean 6 Gaussian Processes at the Helm(holtz) Figure 1. First column: ground truth predictions (upper) and divergence (lower). Second column: current predictions. Third column: divergence estimates. Fourth column: posterior divergence z-values. squared error (RMSE) comparisons in Table 2. However, we note that the RMSE can be expected to vary as one changes either the ocean area or the densities (or more generally locations) of test points, and both of these choices must always be somewhat arbitrary. 2, σ2 1, l2, σ2 Φ, lΦ, σ2 Ψ, lΨ, σ2 Algorithmic details. In our comparisons, each full model including an SE-Helmholtz GP prior or an SE-velocity GP prior has five hyperparameters: σ2 obs and l1, σ2 obs, respectively. In each case, we fit the log of the hyperparameters by maximizing the marginal likelihood using Adam (Kingma & Ba, 2015). We opti- mize in the log-scale and then exponentiate the optimal values to ensure positivity of the hyperparameters. We run each experiment until the log marginal likelihood changes by less than 10−4, which occurs in fewer than 2000 itera- tions for all experiments. With the exception of the GLAD data (which presents special difficulties that we describe in Appendix I.3), we found that results were not sensitive to initialization. To train the D-HNN, we ran the code from Greydanus & Sosanya (2022). More algorithmic details are provided individually for each experiment in Appendix I. 5.1. Simulated experiments We focus on simulations of key ocean behaviors of inter- est to oceanographers: vortices, concentrated divergences, and combinations thereof. As a summary across simu- lation experiments in Table 2, we see that – for predic- tions, divergence estimates, and vorticity estimates – the SE-Helmholtz GP is most accurate by RMSE on a majority of tasks, often by a substantial factor. We next examine indi- vidual experiments more closely; all simulated experiments are described in detail in Appendix I.1. 7 Vortex with zero divergence. First, we consider a vor- tex with no divergence. The SE-Helmholtz GP is better at predicting the current and identifying the lack of divergence. In a vortex, water particles rotate around a central point. The black arrows in the upper left plot of Figure 1 show the ground-truth vector field at test points, with longitude on the horizontal axis and latitude on the vertical axis. Red arrows show our simulated buoy trajectories, which we give to all methods as training data. See Appendix I.1.1 for additional details of the setup and results. The second column in Figure 1 shows predictions from the SE-Helmholtz GP (upper) and SE-velocity GP (lower) at the test points. The red arrows are still the training data. Despite having access to data only from one side of the vortex, the SE-Helmholtz GP is able to reconstruct the full vortex. The SE-velocity GP is not. The ground truth divergence is identically 0 throughout the domain and depicted in the lower left plot. The third column shows divergence estimates from the SE-Helmholtz GP (up- per) and SE-velocity GP (lower) on the same color scale. The fourth column helps us understand if either posterior is reporting a nonzero divergence. In particular, for each point we plot a "z-value": precisely, the posterior mean at that point divided by the posterior standard deviation. One might, for instance, conclude that a method has detected a nonzero divergence if the magnitude of the z-value is greater than 1. From the third column, we conclude that the SE-Helmholtz GP estimate of the divergence is closer to the ground truth of zero than the SE-velocity GP. From the fourth column, we see that neither method concludes nonzero divergence, but the SE-Helmholtz GP posterior is more concentrated near zero. LatitudeF,groundtruthF,HelmholtzGPδ,HelmholtzGPδ(z-value),HelmholtzGPLongitudeLatitudeδ,groundtruthLongitudeF,VelocityGPLongitudeδ,VelocityGPLongitudeδ(z-value),VelocityGP-0.20.00.2-1.0-0.50.00.51.0-0.20.00.2-0.20.00.2-1.0-0.50.00.51.0CurrentBuoy Gaussian Processes at the Helm(holtz) Figure 2. First column: ground truth predictions (upper) and divergence (lower). Second column: current predictions. Third column: divergence estimates. Fourth column: posterior divergence z-values. Duffing oscillator with areas of concentrated divergence. We next simulate a classic example called a Duffing oscil- lator, and we add two areas of divergence; the ground truth current appears in the upper left plot of Figure 2, and the ground truth divergence appears in the lower left. The simu- lated buoy trajectories appear in red. See Appendix I.1.4 for further details on setup and results. We see in the second column that the SE-Helmholtz GP (upper) is largely able to reconstruct the two vortices in the Duffing oscillator (upper left), though it struggles with the upper right current. By contrast, the SE-velocity GP does not connect the currents continuously across the two sides of the space, in disagreement with conservation of momentum. Again, the third column depicts divergence estimates from both methods, and the fourth column depicts z-values. In this case, both methods accurately recover the two ar- eas of divergence. In Appendix I.1.4 and Figures 10 to 12, we experiment with smaller and larger areas of di- vergence with the Duffing oscillator. In Appendix I.1.3, we isolate areas of divergence without the Duffing oscil- lator. Across the six experiments involving regions of di- vergence, the SE-Helmholtz GP typically outperforms the SE-velocity GP in detecting these regions – often by a sub- stantial margin, as shown in Table 2. In these same ex- periments, the SE-Helmholtz GP similarly outperforms the SE-velocity GP at predicting the velocity field. A note on vorticity. Although we have not focused on vorticity estimation in the main text, generally we find su- perior performance on this task from the SE-Helmholtz GP relative to the SE-velocity GP (and D-HNNs), similar to divergence estimation. See the righthand side of Table 2 for an RMSE comparison, and see Appendix I for a visual comparison. For example, the SE-Helmholtz GP can pre- dict zero vorticity when there is no vorticity, whereas the SE-velocity GP and D-HNN fail in this task (Figures 7 to 9). 5.2. Real-data experiments Although ground truth currents and divergences are not avail- able for real data, we can still assess performance against oceanographers' expert knowledge. LASER data. The LAgrangian Submesoscale ExpeRiment (D'Asaro et al., 2017) was performed in the Gulf of Mex- ico in 2016. The full dataset spans two winter months and more than 1000 buoys; see Appendix I.2 for details. We focus on a particular spatial area and 2-hour time span in which oceanographers expect to see a particular conver- gent front. Time information within this range is discarded. We are left with 19 buoys. When recorded spatial coor- dinates overlap across data points, we observe that both the SE-Helmholtz GP and the SE-velocity GP treat all data as noise. While this issue merits further investigation and model development, for now we downsample across time to form the final data sets here. The left column of Figure 3 shows the current predictions using the SE-Helmholtz GP (upper) and SE-velocity GP (lower). Red arrows show the observed buoy data, with 55 total observations across all buoys. The black arrows show the current posterior means at test locations. The two sets of predictions are qualitatively very similar. The second column shows the divergence predictions for the SE-Helmholtz GP (upper) and SE-velocity GP (lower); the third column shows the z-values for the respective posterior distributions. The SE-Helmholtz GP predicts a negative di- vergence area (light blue diagonal) that agrees with the area 8 LatitudeF,groundtruthF,HelmholtzGPδ,HelmholtzGPδ(z-value),HelmholtzGPLongitudeLatitudeδ,groundtruthLongitudeF,VelocityGPLongitudeδ,VelocityGPLongitudeδ(z-value),VelocityGP0.05.0-5.00.05.00.05.00.05.0-5.00.05.0CurrentBuoy Gaussian Processes at the Helm(holtz) Figure 3. First column: current predictions. Second column: divergence estimates. Third column: posterior divergence z-values. where oceanographers expect a convergent front. By con- trast, the SE-velocity GP does not identify any divergence. We find that the discrepancy between the SE-Helmholtz GP and the SE-velocity GP observed in Figure 3 depends on the amount of data. When we double the amount of data from that in Figure 3 (by downsampling less), we find that both methods are able to recover the same convergent front; see Appendix I.2 and Figure 14. This finding then also corrobo- rates that the convergent front in fact does exist and looks like the posterior detection by the SE-Helmholtz GP in Fig- ure 3. In that way, the finding further lends support to the superior performance of the SE-Helmholtz GP in Figure 3. GLAD data. The Grand Lagrangian Deployment (GLAD) experiment ( ̈Ozg ̈okmen, 2012) was conducted near the Deepwater Horizon site and Louisiana coast in July 2012. The full dataset consists of over 300 buoys. Unlike the win- ter LASER data, the summer GLAD data faces additional challenges from regular oscillations due to wind (rather than current); see Appendix I.3 for more details. Rather than ac- count for these oscillations, for the moment we ameliorate their effect by downsampling considerably both in time and across buoys. We are left with 85 observations. The current predictions between the SE-Helmholtz GP and SE-velocity GP are generally quite similar (Figures 15 and 16). Although in this case we do not have any ground truth from oceanographers in advance, some features of the SE-Helmholtz GP prediction seem more realistic from physical intuition: namely, the downturn in the lower left region of the plot and the vortex in the upper left region of the plot. We also note that the SE-Helmholtz GP and SE-velocity GP predict substantially different divergences: respectively, zero and nonzero. To check that our SE-Helmholtz GP method is computation- ally reasonable, we run on a larger subset of the GLAD data with 1200 data points. We find that it takes less than 10 minutes to optimize the hyperparameters, form predictions, and estimate the divergences at the test points. 6. Discussion and Future Work We have demonstrated the conceptual and empirical ad- vantages of our Helmholtz GP relative to the velocity GP. A number of challenges remain. While we have focused on the purely spatial case for modularity, in general we expect currents to change over time, and it remains to ex- tend our method to the spatiotemporal case – which we be- lieve should be straightforward. Moreover, Gonc ̧alves et al. (2019); Lodise et al. (2020) used more complex kernels with two length scales per dimension in their spatiotemporal ex- tension of the velocity GP. From known ocean dynamics, we expect that in fact two length scales would be appropriate in the Helmholtz GP for modeling the vorticity – but unnec- essary for the divergence. While our independent Gaussian noise model is standard in spatiotemporal modeling – and shared by Gonc ̧alves et al. (2019); Lodise et al. (2020) – our real-data experimentation suggests that a better noise model might account for short-term wind oscillations and other noise patterns distinctive to oceans. Acknowledgements The authors are grateful to the Office of Naval Research for partial support under grant N00014-20-1-2023 (MURI ML-SCOPE). Renato Berlinghieri and Tamara Broderick were also supported in part by an NSF CAREER Award, and Tamay ̈Ozg ̈okmen was supported in part by RSMAES, the University of Miami. 9 LatitudeF,HelmholtzGPδ,HelmholtzGPδ(z-value),HelmholtzGPLongitudeLatitudeF,VelocityGPLongitudeδ,VelocityGPLongitudeδ(z-value),VelocityGP-0.10.00.1-2.00.02.0-0.10.00.1-2.00.02.0CurrentBuoy Gaussian Processes at the Helm(holtz) References Adler, R. The Geometry of Random Fields. Society for Industrial and Applied Mathematics, 1981. Alvarez, M. A., Rosasco, L., and Lawrence, N. D. Kernels for vector-valued functions: A review. Foundations and Trends in Machine Learning, 4(3):195–266, 2012. Arfken, G. B. and Weber, H. J. Mathematical methods for physicists, 1999. Barkan, R., Molemaker, M. J., Srinivasan, K., McWilliams, J. C., and D'Asaro, E. A. The role of horizontal diver- gence in submesoscale frontogenesis. Journal of Physical Oceanography, 49(6):1593–1618, 2019. Bhatia, H., Norgard, G., Pascucci, V., and Bremer, P.-T. The Helmholtz-Hodge decomposition-a survey. IEEE Transactions on Visualization and Computer Graphics, 19(8):1386–1404, 2013. B ̈uhler, O., Callies, J., and Ferrari, R. Wave–vortex decom- position of one-dimensional ship-track data. Journal of Fluid Mechanics, 756:1007–1026, 2014. Caballero, A., Mulet, S., Ayoub, N., Manso-Narvarte, I., Davila, X., Boone, C., Toublanc, F., and Rubio, A. Inte- gration of HF radar observations for an enhanced coastal mean dynamic topography. Frontiers in Marine Science, pp. 1005, 2020. Daley, R. The analysis of synoptic scale divergence by a statistical interpolation procedure. Monthly weather review, 113(6):1066–1080, 1985. Daley, R. Atmospheric data analysis. Number 2. Cambridge university press, 1993. D'Asaro, E., Guigand, C., Haza, A., Huntley, H., Nov- ̈Ozg ̈okmen, T., and Ryan, E. Lagrangian surface drifters, (laser) URL elli, G., submesoscale interpolated to 15-minute intervals, 2017. https://data.gulfresearchinitiative. org/data/R4.x265.237:0001. experiment D'Asaro, E. A., Shcherbina, A. Y., Klymak, J. M., Mole- maker, J., Novelli, G., Guigand, C. M., Haza, A. C., Haus, B. K., Ryan, E. H., Jacobs, G. A., Huntley, H. S., Lax- ague, N. J. M., Chen, S., Judt, F., McWilliams, J. C., Barkan, R., Kirwan, A. D., Poje, A. C., and ̈Ozg ̈okmen, T. M. Ocean convergence and the dispersion of flotsam. Proceedings of the National Academy of Sciences, 115 (6):1162–1167, 2018. Fuselier, Jr., E. J. Refined error estimates for matrix-valued radial basis functions. PhD thesis, Texas A&M Univer- sity, 2007. 10 Golub, G. H. and Van Loan, C. F. Matrix computations. JHU press, 2013. Gonc ̧alves, R. C., Iskandarani, M., ̈Ozg ̈okmen, T., and Thacker, W. C. Reconstruction of submesoscale velocity field from surface drifters. Journal of Physical Oceanog- raphy, 49(4), 2019. Greydanus, S. and Sosanya, A. Dissipative Hamiltonian neural networks: Learning dissipative and conservative dynamics separately. arXiv preprint arXiv:2201.10085, 2022. Greydanus, S., Dzamba, M., and Yosinski, J. Hamiltonian neural networks. Advances in Neural Information Pro- cessing Systems, 32, 2019. Han, L. and Huang, R. X. Using the Helmholtz decompo- sition to define the Indian Ocean meridional overturning streamfunction. Journal of Physical Oceanography, 50 (3), 2020. Hollingsworth, A. and L ̈onnberg, P. The statistical struc- ture of short-range forecast errors as determined from radiosonde data. part i: The wind field. Tellus A: Dy- namic Meteorology and Oceanography, 38(2):111–136, 1986. Kingma, D. P. and Ba, J. Adam: A method for stochastic optimization. In International Conference on Learning Representations (ICLR), 2015. Lindgren, G. Stationary stochastic processes: theory and applications. CRC Press, 2012. Lodise, J., ̈Ozg ̈okmen, T., Gonc ̧alves, R. C., Iskandarani, M., Lund, B., Horstmann, J., Poulain, P.-M., Klymak, J., Ryan, E. H., and Guigand, C. Investigating the formation of submesoscale structures along mesoscale fronts and estimating kinematic quantities using Lagrangian drifters. Fluids, 5(3), 2020. Lowitzsch, S. Approximation and interpolation employing divergence-free radial basis functions with applications. Texas A&M University, 2002. Macˆedo, I. and Castro, R. Learning divergence-free and curl- free vector fields with matrix-valued kernels. Technical report, Instituto Nacional de Matem ́atica Pura e Aplicada, 2010. Narcowich, F. J. and Ward, J. D. Generalized hermite inter- polation via matrix-valued conditionally positive definite functions. Mathematics of Computation, 63(208):661– 687, 1994. Novelli, G., Guigand, C. M., Cousin, C., Ryan, E. H., Lax- ague, N. J., Dai, H., Haus, B. K., and ̈Ozg ̈okmen, T. M. Gaussian Processes at the Helm(holtz) A biodegradable surface drifter for ocean sampling on a massive scale. Journal of Atmospheric and Oceanic Technology, 34(11):2509–2532, 2017. ̈Ozg ̈okmen, T. CARTHE: GLAD experiment CODE-style drifter trajectories (lowpass filtered, 15 minute interval records), northern Gulf of Mexico near DeSoto Canyon, July-October 2012. Gulf of Mexico Research Initiative, 10:N7VD6WC8, 2012. Rasmussen, C. E. and Williams, C. K. I. Gaussian processes for machine learning. MIT Press, 2005. Rocha, C. B., Chereskin, T. K., Gille, S. T., and Menemenlis, D. Mesoscale to submesoscale wavenumber spectra in Drake Passage. Journal of Physical Oceanography, 46 (2):601–620, 2016. Solin, A., Kok, M., Wahlstr ̈om, N., Sch ̈on, T. B., and S ̈arkk ̈a, S. Modeling and interpolation of the ambient magnetic field by Gaussian processes. IEEE Transactions on robotics, 34(4):1112–1127, 2018. Srinivasan, K., Barkan, R., and McWilliams, J. C. A forward energy flux at submesoscales driven by frontogenesis. Journal of Physical Oceanography, 53(1):287–305, 2023. Vallis, G. K. Atmospheric and oceanic fluid dynamics. Cam- bridge University Press, 2017. Wahlstr ̈om, N. Modeling of magnetic fields and extended ob- jects for localization applications. PhD thesis, Link ̈oping University Electronic Press, 2015. Wahlstr ̈om, N., Kok, M., Sch ̈on, T. B., and Gustafsson, F. Modeling magnetic fields using Gaussian processes. In 2013 IEEE International Conference on Acoustics, Speech and Signal Processing, pp. 3522–3526. IEEE, 2013. Yaremchuk, M. and Coelho, E. F. Filtering drifter trajecto- ries sampled at submesoscale resolution. IEEE Journal of Oceanic Engineering, 40(3):497–505, 2014. Zhang, C., Wei, H., Liu, Z., and Fu, X. Characteristic ocean flow visualization using Helmholtz decomposition. In 2018 Oceans-MTS/IEEE Kobe Techno-Oceans (OTO), pp. 1–4. IEEE, 2018. Zhang, C., Wei, H., Bi, C., and Liu, Z. Helmholtz–Hodge decomposition-based 2D and 3D ocean surface current visualization for mesoscale eddy detection. Journal of Visualization, 22, 01 2019. 11 Gaussian Processes at the Helm(holtz) Appendix Table of Contents A Related Work B Divergence, Gradient, and Curl Operators in 2D C Helmholtz Decomposition in the Ocean D Optimal Interpolation vs. Gaussian Processes E Helmholtz Gaussian Process Prior F Divergence and Vorticity of A Gaussian Process G Computational Costs for evaluating Helmholtz GP Posterior H Benefits of the Helmholtz GP: additional information and supplemental proofs H.1 Equality of marginal variances of vorticity and divergence with independent velocity priors . H.2 Conservation of length scales across kΦ vs. kδ (and kΨ vs. kζ) . . . . . . . . . . . . . . . . H.3 Equivariance of Helmoltz GP predictions . . . H.4 Non-Equivariance of Velocity GP predictions . I Experimental Results I.1 Simulated Experiments . . . I.2 Real-world data 1: LASER . I.3 Real-world data 2: GLAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 13 14 14 16 17 18 19 19 20 21 23 24 24 43 47 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A. Related Work In what follows, we present related work in more detail. We first describe in more detail the differences between our work and that of Gonc ̧alves et al. (2019); Lodise et al. (2020). Then we discuss why we chose to put our priors on the Helmholtz decomposition, rather than an alternative decomposition. Velocity GP vs. the GP of Gonc ̧alves et al. (2019); Lodise et al. (2020). Gonc ̧alves et al. (2020); Lodise et al. (2020) used many of the components of the velocity GP that we describe in the main text, but their prior was substantially more complex than the velocity GP. Like the velocity GP, they focused on a GP prior with a squared exponential covariance function. Unlike the velocity GP as described in the main text here, their squared exponential prior included not only terms in each of the longitude and latitude directions, but also a term in the time direction. Each term has its own length scale. As a second principle difference, their covariance was in fact a sum of two such squared exponential kernels – introducing a total of 6 length scales (one for longitude, latitude, and time in each of the two kernels), 2 signal variances, and a single noise variance. They mention also trying 3 kernels (instead of 2), but it appears all their results were reported for 2 kernels. We have here tried to take a modular approach to examine the squared exponential prior on its own, so our velocity GP should not be seen as a direct reflection of the performance of the Gonc ̧alves et al. (2019); Lodise et al. (2020) covariance function. 12 Gaussian Processes at the Helm(holtz) Why we focused on the Helmholtz decomposition. The Helmholtz decomposition is a widely recognized dynamically significant method for dissecting the oceanic velocity field. An alternative – albeit related – decomposition that sees frequent use is the Geostrophic-Ageostrophic (G-Ag hereinafter) decomposition (Vallis, 2017), which relies on the dominance of geostrophic balance at large spatial and time scales in the ocean. Though not directly related to our current work here, we discuss it briefly to provide a holistic oceanographic context to our choice of the Helmholtz decomposition. The Helmholtz decomposition is defined through exact linear operators into velocity components that are orthogonal complements and can be separated easily, allowing priors to be placed on the underlying potentials; the G-Ag decomposition, however, can be derived only by first eliminating the Ageostrophic flow (which represents faster, smaller scales) through an ad hoc time smoothing of drifter velocities using a multi-day filter. The G-Ag components are notably not orthogonal complements and consequently have to be separately estimated through a velocity GP, leading to a more complex modeling pipeline with additional physical hyperparameters (like the smoothing time) that are not easily determined. While there is a measure of correspondence between the geostrophic and rotational components, and the ageostrophic and divergent components, the lack of precision in defining the G-Ag components makes the Helmholtz a natural modeling pathway. Recent oceanographic studies (Barkan et al., 2019; Srinivasan et al., 2023) showing that the Helmholtz decomposition is directly relevant to the dynamics of oceanic components at smaller spatial scales of around O(1 km) offer further justification for our present choice. B. Divergence, Gradient, and Curl Operators in 2D In this section we provide some background for the Helmholtz decomposition in 2D. In the first part, we provide definitions for grad, div, curl, and rot operators. In Proposition B.5 we then characterize a property of vector fields obtained combining these operators. Consider a scalar-valued differentiable function f : R2 value at point x is the vector whose components are the partial derivatives of f at x. Formally, R. The gradient of f is the vector-valued function f whose → ∇ grad f (x) := (cid:35) (cid:34) ∂f (x) ∂x(1) ∂f (x) ∂x(2) = i ∂f (x) ∂x(1) + j ∂f (x) ∂x(2) where i and j are the standard unit vectors in the direction of the x(1) and x(2) coordinates. From this rewriting, one can note that taking the gradient of a function is equivalent to taking a vector operator (cid:19) , called del: ∇ = i ∇ ∂ ∂x(1) ∂ + j ∂x(2) ≡ (cid:18) ∂ ∂x(1) , ∂ ∂x(2) Using this operator, two operations on vector fields can be defined. Definition B.1. Let A function divF : A R2 be an open subset and let F : A R, defined by → ⊂ → R2 be a vector field. The divergence of F is the scalar div F (x) := ( ∇ * F )(x) = R2 be an open subset and let F : A + ∂F (2) ∂x(2) ∂F (1) ∂x(1) R2 be a vector field. The curl of F is the scalar function Definition B.2. Let A curlF : A R, defined by ⊂ → curlF (x) := → ∂F (1) ∂x(2) − ∂F (2) ∂x(1) Note that this curl definition follows directly from the definition of curl in three dimensions, where this quantity describes infinitesimal circulation. In the 3D world, curl and divergence are enough to characterize the Helmholtz decomposition. For the 2D version, however, we need to characterize an additional operator - which we call rot operator - that plays the role of the standard curl operator in the 3D version. In 2D, the rot formally requires the introduction of a third unit vector, k that is orthogonal to the plane containing, i and j. Definition B.3. Let f : R2 R be a scalar field. The rot of f is the vector field k f, defined by → rot f (x) k ≡ × ∇ f = (cid:21) (cid:20) ∂f ∂x(2) −∂f ∂x(1) = i ∂f ∂x(2) − j 13 × ∇ ∂f ∂x(1) Gaussian Processes at the Helm(holtz) where i and j represents, respectively, the standard unit vectors in the direction of the x(1) and x(2) coordinates; k is the unit vector orthogonal to the plane containing i and j satisfying the identities, k i and k i = j. j = × − × ≡ (0, 0, Ψ(x)); equivalently A = Ψk. Given this observation, it can be shown that Thus the rot operator can be thought of as a π/2 rotation of the grad operator. The precise reason why we need the introduction of a separate rot operator in 2D is because of a hidden peculiarity that the stream function, Ψ is actually the only non-zero component of a 3D vector potential field, A(x), but that non-zero component is along the k direction, A 3D is the direct 3D extension of the 2D operator defined above. The ideas of gradient, divergence, rot, and curl lead to the following characterization of vector fields. Definition B.4. A vector field F : A incompressible (or divergence-free) if the divergence is zero, divF = 0. Proposition B.5. Let f be a scalar field and R2 is called rotation-free (or curl-free) if the curl is zero, curlF = 0, and it is called 2 the class of functions whose second derivatives exist and are continuous. Ψ, where A = k × ∇ → ∇ ∇ ∇ × 3D C 1. If f is 2. If f is C C 2, then curl(grad f ) = 0. Every gradient of a scalar field is rotation free. 2, then div(rot f ) = 0. Every rot transformation of a scalar field is incompressible. Proof. For (1), we have the following: curl(grad f ) = curl (cid:35) (cid:34) ∂f (x) ∂x(1) ∂f (x) ∂x(2) = ∂f (x)/∂x(1) ∂x(2) ∂f (x)/∂x(2) ∂x(1) − = 0. For (2): div(rot f ) = div (cid:35) (cid:34) ∂f (x) ∂x(2) −∂f (x) ∂x(1) = ∂f (x)/∂x(2) ∂x(1) + − ∂f (x)/∂x(1) ∂x(2) = 0. For more material on vector calculus, we refer the reader to Arfken & Weber (1999). C. Helmholtz Decomposition in the Ocean In what follows we relate the Helmholtz decomposition to ocean currents. In the first part, we provide intuition of how divergence and vorticity are significant in the context of oceanography. Next, in Figure 4, we present a visual representation of the Helmholtz decomposition and highlight the relevant aspects. The divergence and vorticity of the ocean flow are relevant for oceanographic studies. Divergence characterizes fronts – small structures with spatial scales on the order of 0.1-10 km and temporal scales on the order of 1-100h. These are associated with strong vertical motions comprised of a narrow and intense downwelling (flow into the ocean from the surface) and broad, diffuse upwelling (flow from depths to the surface). The strong downwelling regions play a crucial role in air-sea fluxes (including uptake of gases into the ocean) and for biological productivity, since floating particles in the ocean (that include plankton and algae) are concentrated at these fronts. On the other hand, vorticity characterizes eddies, larger structures that usually evolve over a long timescale. These account for kinetic energy in the ocean, which makes them a crucial part of global balances of energy, momentum, heat, salt, and chemical constituents (such as carbon dioxide). In Figure 4 we provide visual intuition on how the Helmholtz theorem decomposes a vector field (ocean flow) into a divergent velocity field and a rotation velocity field. In this plot, one can see that from the divergence we can read areas of downwelling/sink (arrows pointing inwards to a single point) and upwelling/source (arrows pointing outwards from a single point). The vorticity, instead, characterizes rotational elements of the vector field, e.g., vortices/eddies in our ocean setting. D. Optimal Interpolation vs. Gaussian Processes Optimal interpolation is a powerful and widely used technique for the analysis of atmospheric data. The technique is only optimal under strong assumptions, and is therefore instead often referred to as statistical interpolation (Daley, 1993). 14 Gaussian Processes at the Helm(holtz) Figure 4. Helmholtz decomposition of vector field F . Left: original vector field F . Top-right: divergence component of Helmholtz decomposition of F . Bottom-right: vorticity component of Helmholtz decomposition of F . We formulate the statistical interpolation algorithm following Daley (1993, Section 4.2). We are interested in modeling a variable y = f (x), where x represent the 2D spatial coordinates of a point. For simplicity, assume f : R2 R is a univariate function. The multivariate statistical interpolation algorithm is very similar. See Chapter 5 in Daley (1993). → 1, . . . , K, where we observe the variable of interest directly, fO(xk), and some other We have some locations xk, k locations xi, i 1, . . . , I, where we want to infer (interpolate) the value of the function of interest, fA(xi). Moreover, there might be some background knowledge about this function (e.g. a climate model providing a first guess), that we denote by fB(xk) and fB(xi). We assume a linear relationship between the observations and the function we want to model (note that this does not imply the modeled function is linear in the spatial locations). Then ∈ ∈ fA(xi) = fB(xi) + K (cid:88) i=1 Wik(fO(xk) fB(xk)) − (21) − where K is the number of locations where we observe the variable of interest, and Wik is the weight given to the residual fB(xk) when interpolating at xi. Finally, let the true value of the function at points xi and xk be fT (xi) and fO(xk) fT (xk), respectively. Define ̄Wi to be the column vector of length K of weights, ̄Bi the column vector of length K whose elements are E[(fB(xk) fT (xi))], and B and O the background and observation error covariance matrices, − respectively. That is, for k, l fT (xk))(fB(xi) − 1, . . . , K , ∈ { } Bk,l = E[(fB(xk) Ok,l = E[(fO(xk) fT (xk))(fB(xl) fT (xk))(fO(xl) fT (xl))], fT (xl))]. − − − − Then, assuming that (i) the background and the observations are unbiased and (ii) that the correlation between background and observation error is zero, with some algebra it can be shown that the optimal weights satisfy [B + O] ̄Wi = ̄Bi We refer the reader to Section 4.2 in Daley (1993) for details on this derivation. This is the same as applying a least square approach on the residuals obtained by subtracting the background model estimates from the observations. Now assume that we do not have any background knowledge (fB(xi) = fB(xk) = 0) and we do not know the ground truth. (0, ̃K). Assuming that Instead, we model it with a Gaussian process with zero mean and covariance function ̃K, fT ∼ GP 15 the model is well-specified and the observation noise is σ2 obs, we have Gaussian Processes at the Helm(holtz) ̄Bi,k = E(fT (xi), fT (xk)) = ̃K(xi, xk) Bk,l = E(fT (xk), fT (xl)) = ̃K(x, x)k,l Ok,l = E(fO(xk) fT (xk), fO(xl) − fT (xl)) = σ2 obs − where by ̃K(x, x) we mean the I weights are × I matrix formed by evaluating the ̃K on all pairs of observed locations. So the optimal ̄Wl,k = I (cid:88) i=1 [ ̃K(x, x) + σ2 obsI]−1 l,i ̃K(xi, xk), These weights lead to exactly the same predictions as when doing standard Gaussian process regression. Therefore, we can see Gaussian process regression as a specific case of statistical interpolation, where we do not include any background knowledge (corresponding to a zero mean prior), and we do not have access to the ground truth function. We then choose a covariance function that encodes physical intuition of how the underlying system behaves, and estimate parameters from data (for example, by maximum likelihood). Daley (1993, Section 4.3) provides a detailed discussion of the choice of covariance functions in the oceanographic and atmospheric literature. E. Helmholtz Gaussian Process Prior In this section, we state and prove Proposition 3.1 from the main text. Proposition 3.1. Let F be an ocean current vector field defined by potential and stream functions that are independent (0, kΨ), where kΦ and kΨ are such that Φ and Ψ have almost surely and distributed as Φ continuously differentiable sample paths. Then (0, kΦ) and Ψ ∼ GP ∼ GP where, for x, x′ R2, i, j ∈ ∈ 1, 2, kHelm(x, x′)i,j is equal to F = grad Φ + rot Ψ (0, kHelm), ∼ GP ∂2kΦ(x, x′) ∂x(i)∂(x′)(j) + ( − 1)1{i̸=j} ∂2kΨ(x, x′) ∂x(3−i)∂(x′)(3−j) . (9) (10) Proof. We obtain the result in two steps. First, we argue that under the assumptions of the proposition, F is distributed as a Gaussian process and so may be characterized through its mean and covariance function. Second, we show F has mean zero, and the proposed covariance kernel. To see that F is a Gaussian process, observe that it is the sum of linear transformations of two independent Gaussian processes. This follows from the fact that grad and rot are linear operators on any vector space of differentiable functions, and because kΦ and kΨ are chosen to have almost surely continuously differentiable sample paths. Therefore, gradΦ and rotΨ are two independent GPs, and so F is a Gaussian process as well. We next turn to the mean and covariance functions. By linearity of expectation, E[F ] = E [grad Φ] + E [curl Ψ] = grad EΦ + curl EΨ = 0, where the last line follows from the assumption that Φ and Ψ both have mean 0 everywhere. It remains to calculate the covariance function. Since Φ and Ψ are assumed independent we compute the covariance as the sum of covariances for 16 Gaussian Processes at the Helm(holtz) grad Φ and curl Ψ. Consider two points x and x′. Cov [(grad Φ)(x), (grad Φ)(x′)] = Cov (cid:33)(cid:35) (cid:34)(cid:32) ∂Φ(x) ∂x(1) ∂Φ(x) ∂x(2) (cid:16) ∂Φ(x) (cid:33) , (cid:32) ∂Φ(x′) ∂(x′)(1) ∂Φ(x′) ∂(x′)(2) (cid:17) ∂x(1) , ∂Φ(x′) ∂x(2) , ∂Φ(x′) ∂(x′)(1) ∂(x′)(1) (cid:16) ∂Φ(x) Cov (cid:17) Cov  Cov  Cov     ∂2kΦ(x, x′) ∂x(1)∂(x′)(1) ∂2kΦ(x, x′) ∂x(2)∂(x′)(1) ∂2kΦ(x, x′) ∂x(1)∂(x′)(2)   ∂2kΦ(x, x′)  ∂x(2)∂(x′)(2) , = = (cid:17)  (cid:17)  (cid:16) ∂Φ(x) (cid:16) ∂Φ(x) ∂(x′)(2) ∂x(1) , ∂Φ(x′) ∂x(2) , ∂Φ(x′)  ∂(x′)(2) where exchange of integration and differentiation to obtain the final matrix is permissible by the almost surely continuously differentiable sample paths assumption. Similarly, Cov [(rot Ψ)(x), (rot Ψ))(x′)] = Cov (cid:33)(cid:35) , (cid:32) ∂Ψ(x′) ∂(x′)(2) ∂Ψ(x′) ∂(x′)(1) (cid:17) (cid:33) (cid:34)(cid:32) ∂Ψ(x) ∂x(2) ∂Ψ(x) ∂x(1) − − (cid:16) ∂Ψ(x) ∂x(2) , ∂Ψ(x′) ∂x(1) , ∂Ψ(x′) ∂(x′)(2) ∂Ψ(x) ∂(x′)(2) (cid:17) Cov (cid:16) Cov Cov Cov − ∂2kΨ(x, x′) ∂x(2)∂(x′)(2) ∂2kΨ(x, x′) ∂x(1)∂(x′)(2) − − ∂2kΨ(x, x′) ∂x(2)∂(x′)(1) ∂2kΨ(x, x′) ∂x(1)∂(x′)(1)    .       = = ∂Ψ(x′) ∂(x′)(1) (cid:17) (cid:16) ∂Ψ(x) ∂x(2) , − (cid:16) ∂Ψ(x) ∂x(1) , ∂Ψ(x′)  ∂(x′)(1) (cid:17)   The desired expression for kHelm is obtained by taking the sum of these two matrices. F. Divergence and Vorticity of A Gaussian Process In this section, we state and prove Proposition 3.2 from the main text. Proposition 3.2. Let F sample paths. Then, for x, x′ (μ, k) be a two-output Gaussian process with almost surely continuously differentiable R2, ∼ GP ∈ where δ = div F ζ = curl F kδ(x, x′) = (cid:88) (div μ, kδ) (curl μ, kζ) ∼ GP ∼ GP ∂2k(x, x′)i,j ∂x(i)∂x(j) 1)i+j ∂2k(x, x′)i,j ∂x(3−i)∂x(3−j) . (i,j)∈{1,2}2 (cid:88) ( (i,j)∈{1,2}2 − kζ(x, x′) = (16) (17) (18) (19) Proof. By the assumption that the sample paths are almost surely continuously differentiable, div F and curl F are well- defined. Since the image of a Gaussian process under a linear transformation is a Gaussian processes both div F and curl F are Gaussian processes. It remains to compute the moments. The expectation can be calculated via linearity, E(div F ) = div(EF ) = div μ, E(curl F ) = curl(EF ) = curl μ. 17 (22) (23) Gaussian Processes at the Helm(holtz) We next turn to the covariance. Define the centered process G = F curl G are centered Gaussian processes with the covariance functions kδ and kζ respectively. R2. Unpacking the definition of div, Consider two points x, x′ (cid:20)(cid:18) ∂G(1)(x) ∂G(2)(x) ∂x(2) ∂x(1) kδ(x, x′) = E ∂G(2)(x′) ∂(x′)(2) + + − ∈ (cid:19)(cid:21) μ. By Equation (22) and Equation (23), div G and (cid:19) (cid:18) ∂G(1)(x′) ∂(x′)(1) (cid:21) ∂G(j)(x′) ∂(x′)(j) (cid:88) = (i,j)∈{1,2}2 E (cid:20) ∂G(i)(x) ∂x(i) (cid:88) = (i,j)∈{1,2}2 ∂2k(x, x′)i,j ∂x(i)∂(x′)(j) , where exchange of integration and differentiation in the final line is permissible given that the sample paths are almost surely continuously differentiable. Similarly, kζ(x, x′) = E (cid:20)(cid:18) ∂G(1)(x) ∂x(2) − = (cid:88) ( (i,j)∈{1,2}2 − 1)i+jE (cid:19) (cid:18) ∂G(1)(x′) ∂G(2)(x) ∂x(1) (cid:20) ∂G(i)(x) ∂x(3−i) ∂(x′)(2) − (cid:21) ∂G(j)(x′) ∂(x′)(3−j) (cid:19)(cid:21) ∂G(2)(x′) ∂(x′)(1) (cid:88) == ( − (i,j)∈{1,2}2 1)i+j ∂2k(x, x′)i,j ∂x(3−i)∂(x′)(3−j) . G. Computational Costs for evaluating Helmholtz GP Posterior In this section, we provide a bound for the cost of computing velocity predictions using the Helmholtz GP. We also discuss in more detail the assumption of using a Cholesky factorization or QR decomposition. Proposition G.1. Suppose we have observed M training data points and would like to predict the current at N new (test) locations. Assume we use a Cholesky or QR factorization, together with solving the system of equations with back-substitution. Let Cvel(M, N ) be the total worst-case4 computational cost for evaluating both the posterior mean (Equation (14)) and covariance (Equation (15)) for the velocity GP. Let and Chelm(M, N ) be the analogous total cost for the Helmholtz GP. Then lim M,N→∞ Chelm(M, N )/Cvel(M, N ) 4 ≤ (24) where M and N can tend to infinity at arbitrary, independent rates. Proof. Recall that the posterior mean and covariance can be obtained by solving KtetrK −1 − KtetrK −1 trtrK ⊤ tetr, respectively Equations (14) and (15). To compute the mean we (A) compute a Cholesky (or QR) 2M matrix, (B) perform a back-solve of a 2M dimensional system of equations, and (C) compute factorization of a 2M N 2M -dimensional inner products. To compute the covariance we (D) compute a Cholesky (or QR) factorization of a 2M 2M matrix, (E) perform a back-solve of N distinct 2M dimensional systems of equations, (F) compute an (2N 2N ) matrix-multiplication, and (G) subtract 2N trtrYtr and computing Ktete 2N matrices. × 2M ) (2M × × × × × We first argue that it suffices to consider steps A and D separately from the remaining steps. In particular, for non-negative numbers I i=1 and ai { } bi { I i=1, we observe that } (cid:80)I (cid:80)I i=1 ai i=1 bi ≤ max ai bi . (25) 4As in the main text, we assume that the computation incurs the worst-case cost of a Cholesky factorization or QR decomposition. If the matrices involved have special structure, the cost might be much less than the worst-case. 18 Gaussian Processes at the Helm(holtz) For our purposes, let a1 be the cost of steps A and D in the Helmholtz GP computation, and let a2 be the cost of steps B, C, E, F, and G in the Helmholtz GP computation. Analogously, define b1 and b2 for the velocity GP computation. The proof of Proposition 3.3 already showed that a1/b1 is asymptotically bounded above by 4. By Equation (25), then, it suffices to separately check a2/b2. Next, we will use the following observation to focus on the asymptotically dominant terms of a2 and b2, respectively. Consider some index n un with all terms bounded away from zero, sn and tn . For rn → ∞ ∼ ∼ rn sn ∼ tn un . (26) Among steps B, C, E, F, and G, the dominant costs are due to performing the triangular back-substitution (step E) and the matrix-matrix multiplication (step F) used to compute the covariance. We can again consider these two steps separately due to Equation (25). First consider back-substitution. Given a t (square) lower triangular system of equations of dimension s, the cost of solving ts2 floating-point operations (Golub & Van Loan, 2013, Section 3.1.2). When this system with back-substitution is 2M and Ktrtr = LL⊤ (or QR) of shape evaluating posteriors with the Helmholtz GP, we have Ktetr of shape 2N 8N M 2. For 2M the velocity GP, we can exploit the fact that the two outputs are uncorrelated and can be handled separately, so the cost 4N M 2. Therefore, and again using Equation (26), the ratio of the costs of the back-substitution of back-substitution is algorithm is asymptotically 2. 2M . So back-substitution in the case of the Helmholtz GP incurs cost (in floating point operations) ∼ × ∼ × ∼ Once back-substitution has been performed, matrix-multiplication must be performed. Using textbook matrix-multiplication leads to the same considerations as back-substitution. In all the steps used to compute the posterior moments, we see that the cost of the Helmholtz GP is not (asymptotically) more than 4 times the cost of the velocity GP, and the result follows. Simplifying structure. In Propositions 3.3 and G.1, we have made the assumption that users are solving a linear system or computing a log determinant with a general and standard choice, such as a Cholesky factorization or QR decomposition. We expect essentially the same result to hold for any other general method for computing these quantities. However, if there is special structure that can be used to solve the linear system or compute the log determinant more efficiently, that might change the bounds we have found here. Conversely, we are immediately aware of special structure that we can expect to always apply in the application to modeling current. And any such structure would likely also require special algorithmic development and coding. H. Benefits of the Helmholtz GP: additional information and supplemental proofs In what follows, we provide additional information on the benefits of using the Helmholtz GP. In Appendix H.1 we state and prove Proposition 4.1, showing how with independent velocity priors we obtain equal marginal variances for vorticity and divergence. In Appendix H.2 we provide more intuition on the result that length scales are conserved across kΦ vs. kδ and across kΨ vs. kζ. Finally, in Appendix H.3 we state and prove Proposition 4.2 about the equivariance of Helmholtz GP predictions. H.1. Equality of marginal variances of vorticity and divergence with independent velocity priors Proposition 4.1. Let k(1) and k(2) be isotropic kernels with inputs x, x′ R2. Take F (1) ∼ (0, k(2)) independent. Suppose k(1) and k(2) are such that F (1), F (2) have almost surely continuously differentiable GP sample paths. Let δ and ζ be defined as in Equations (3) and (4). Then for any x, Var[δ(x)] = Var[ζ(x)]. ∼ GP ∈ (0, k(1)) and F (2) Proof. Because k(1) and k(2) are assumed to be isotropic we may write for any x, x′ R2 ∈ k(1)(x, x′) = κ1( x ∥ − x′ ∥ 2) and k(2)(x, x′) = κ2( x ∥ − x′ 2) ∥ for some κ1, κ2 : R+ → R. Because isotropy implies stationarity, it suffices to consider the variance at any a single point, 19 and so we consider x = x′ = (0, 0). By assumption, we have Gaussian Processes at the Helm(holtz) F ∼ GP (cid:19) (cid:18)(cid:18)0 0 (cid:18)k(1) 0 , (cid:19)(cid:19) 0 k(2) By Proposition 3.2, the induced divergence and vorticity are Gaussian processes with mean 0 and covariances kδ(x, x′) = kζ(x, x′) = ∂2k(1)(x, x′) ∂x(1)∂(x′)(1) ∂2k(1)(x, x′) ∂x(2)∂(x′)(2) + + ∂2k(2)(x, x′) ∂x(2)∂(x′)(2) ∂2k(2)(x, x′) ∂x(1)∂(x′)(1) respectively. Then, we can compute the variance at x = x′ = (0, 0) by Var[δ(0, 0)] = = = = (cid:12) (cid:12)x=0,x′=0 + ∂2k(1)(x, x′) ∂x(1)∂(x′)(1) 2) x′ ∂2κ1( x ∥ ∥ ∂x(1)∂(x′)(1) ∂ ∂x(1) 2(κ′′ 2κ′ 1( − 2)x(1))(cid:12) ( x ∥ − ∥ 1 (0) + κ′′ 2 (0)) (cid:12) (cid:12)x=0,x′=0 + − (cid:12) (cid:12)x=0,x′=0 ∂2k(2)(x, x′) ∂x(2)∂(x′)(2) ∂2κ2( x ∥ ∥ ∂x(2)∂(x′)(2) x′ − 2) (cid:12) (cid:12)x=0,x′=0 (cid:12)x=0 + ∂ ∂x(2) ( − 2κ′ 2( ∥ x ∥ 2)x(2))(cid:12) (cid:12)x=0 Consequently, we have that for any x R2, Var[δ(x)] = ∈ − The computation is similar for the vorticity. We have that 2(κ′ 1(0) + κ′ 2(0)). Var[ζ(0, 0)] = = = = ∂2k((1)(x, x′) ∂x(2)∂(x′)(2) 2) x′ ∂2κ1( x ∥ ∥ ∂x(2)∂(x′)(2) ∂ ∂x(2) 2(κ′′ 2κ′ ( x 1( − ∥ ∥ 1 (0) + κ′′ 2 (0)) − − (cid:12) (cid:12)x=0,x′=0 + (cid:12) (cid:12)x=0,x′=0 + (cid:12) (cid:12)x=0,x′=0 ∂2k((2)(x, x′) ∂x(1)∂(x′)(1) ∂2κ2( ∥ x′ 2) x ∥ ∂x(1)∂(x′)(1) − (cid:12) (cid:12)x=0,x′=0 2)x(1))(cid:12) (cid:12)x=0 + ∂ ∂x(1) ( 2κ′ 2( − 2)x(2))(cid:12) ∥ (cid:12)x=0 x ∥ Therefore for any x proof. ∈ R2, Var[ζ(x)] = − 2(κ′ 1(0) + κ′ 2(0)), and we see Var[ζ(x)] = Var[δ(x)]. This completes the H.2. Conservation of length scales across kΦ vs. kδ (and kΨ vs. kζ) This subsection provides a derivation of the claim that if kΦ(x, x′; l) = κ( ∥ kδ Helm(x, x′; l) = l−4η( is identical KΨ and kζ /l) for some η : R+ x ∥ Helm. → x′ − ∥ R, then R that does not depend on l. The relationship (argument to see it) /l), for some κ : R+ → x′ − x ∥ We may see the claim to be true by expanding out the dependencies of kδ Helm on kΦ and kΨ, seeing that they involve fourth order partial derivatives, and applying a change of variables four times; each change of variables contributes one factor of l−1. Helm and kζ 20 Gaussian Processes at the Helm(holtz) In particular, (cid:18) (cid:18) kδ Helm = kζ Helm = ∂4 ∂(x(2))2∂((x′)(2))2 ∂4 ∂(x(2))2∂((x′)(2))2 + + ∂4 ∂(x(2))2∂((x′)(1))2 ∂4 ∂(x(2))2∂((x′)(1))2 + + ∂4 ∂(x(1))2∂((x′)(2))2 ∂4 ∂(x(1))2∂((x′)(2))2 + + ∂4 ∂(x(1))2∂((x′)(1))2 ∂4 ∂(x(1))2∂((x′)(1))2 (cid:19) (cid:19) kΦ and (27) kΨ. Consider first the potential function and divergence. If kΦ(x, x′) = κ( ), then any second order mixed partial x ∥ ∥ ∂2 lx′ ∂x∂x′ kΦ(x, x′) = l−2 /l) = derivative may be written through a change of variables (x to x/l) as ∥ l−2 ∂2 x′ x ∂x∂x′ κ( Helm we have that if − ∥ kΦ(x, x′) = κ( x ∥ /l). Analogously, when we differentiate four times rather than twice to obtain kδ ∥ x′ − /l) for some η that does not depend on l. ∥ /l), for some κ, then kδ Helm = l−4η( ∂2 ∂lx∂lx′ κ( lx ∥ x ∥ x′ x′ − − − ∥ H.3. Equivariance of Helmoltz GP predictions Proposition 4.2. Let μF|D(Xte, Xtr, Ytr) denote the Helmholtz GP posterior mean for training data Xtr, Ytr and test coordinates Xte, and let R be an operator rotating coordinates and velocities about (0, 0). Then μF|D(RXte, RXtr, RYtr) = RμF|D(Xte, Xtr, Ytr). (20) To prove the proposition, it is helpful to distinguish between random variables and the values they take on. We use boldface to denote the random variables, for example Ytr. When a random variable Ytr takes a value Y we write Ytr = Y. N )⊤], then The rotation operator R is characterized by a 2 RXtr = [R(x(1) N )⊤] = [((Rx1)(1), (Rx1)(2))⊤, . . . , ((RxN )(1), (RxN )(2))⊤], where we denote by (Rx)(1) the rotated first coordinate, and (Rx)(2) the rotated second coordinate. When the input is flattened, as in the case of Ytr or μF |D, the R operator is applied as follows: (1) unflatten the vector to get it in the same form as Xtr, then (2) apply the operator R as specified above, and finally (3) flatten the output vector to go back to the original Ytr shape. Our proof relies on kΦ and kΨ being isotropic kernels. 2 rotation matrix; if Xtr = [(x(1) 1 )⊤, . . . , R(x(1) 1 )⊤, . . . , (x(1) N , x(2) N , x(2) 1 , x(2) 1 , x(2) × Lemma H.1 (Invariance of the likelihood). Suppose F is distributed as a Helmholtz GP, and there are M observations (cid:0)[F (1)(X), F (2)(X)]⊤, Ktrtr(X, X)(cid:1), where I2M denotes the identity matrix of size 2M . Then Ytr the marginal likelihood of the observations is invariant to rotation. That is, for any 2 2 rotation matrix R, F, Xtr = X ∼ N | × p(Ytr = Y | Xtr = X) = p(Ytr = RY Xtr = RX). | Proof. By assumption, kΦ is stationary and so, for any two locations x and x′ in R2 we may write kΦ(x, x′) = κ( x ∥ for some function κ : R+ R. Following Appendix C, we may write the induced covariance for gradΦ as → x′ ) ∥ − Cov [(grad Φ)(x), (grad Φ)(x′)] = =         ∂2kΦ(x, x′) ∂x(1)∂(x′)(1) ∂2kΦ(x, x′) ∂x(2)∂(x′)(1) ∂2κ( x′ ) x ∥ ∥ ∂x(1)∂(x′)(1) ∂2κ( ) x ∥ ∥ ∂x(2)∂(x′)(1) x′ − −     ∂2kΦ(x, x′) ∂x(1)∂(x′)(2) ∂2kΦ(x, x′) ∂x(2)∂(x′)(2) x′  − ∂2κ( ) x ∥ ∥ ∂x(1)∂(x′)(2)   ∂2κ( ) x  ∂x(2)∂(x′)(2) , ∥ ∥ − x′ Similarly, we may compute Cov [(grad Φ)(Rx), (grad Φ)(Rx′)] through a change of variables (x to Rx) as 21 Gaussian Processes at the Helm(holtz) Cov [(grad Φ)(Rx), (grad Φ)(Rx′)] = =         ∂2kΦ(Rx, Rx′) ∂x(1)∂(x′)(1) ∂2kΦ(Rx, Rx′) ∂x(2)∂(x′)(1) ∂2κ( Rx ∥ Rx′ ∂x(1)∂(x′)(1) Rx′ ∂x(2)∂(x′)(1) ∂2κ( ∥ Rx − − ) ∥ ) ∥ ∂2kΦ(Rx, Rx′) ∂x(1)∂(x′)(2) ∂2kΦ(Rx, Rx′) ∂x(2)∂(x′)(2)     ∂2κ( ∥ − Rx Rx′ ∂x(1)∂(x′)(2) Rx′ ∂x(2)∂(x′)(2) Rx ∥ − ∂2κ( ) ∥ ) ∥ ,     and see that Cov [(grad Φ)(x), (grad Φ)(x′)] = RCov [(grad Φ)(Rx), (grad Φ)(Rx′)])R⊤. = R⊤Cov [(grad Φ)(x), (grad Φ)(x′)] R Similarly, IM )Cov [(grad Φ)(RX), (grad Φ)(RX)] (R⊤ for a collections of M locations X we have that Cov [(grad Φ)(X), (grad Φ)(X)] = (R IM ), where ⊗ ⊗ denotes the Kronecker product. ⊗ An identical argument (up to a change in the sign of off-diagonal terms) can be used to derive the induced covariance for rotΨ, Cov [(rot Ψ)(x), (rot Ψ)(x′)]. We obtain Cov [(rot Ψ)(x), (rot Ψ)(x′)] = RCov [(rot Ψ)(Rx), (rot Ψ)(Rx′)] R⊤ and Cov [(rot Ψ)(X), (rot Ψ)(X)] = (R IM )Cov [(rot Ψ)(RX), (rot Ψ)(RX)] (R⊤ ⊗ IM ). ⊗ Together, this implies that if we write the covariance of M vector velocity training observations Ytr at X as Ktrtr(X, X) : = Var[Ytr Xtr = X] | = kHelm(X, X) + σ2 = Cov [(grad Φ)(X), (grad Φ)(X)] + Cov [(rot Ψ)(X), (rot Ψ)(X)] + σ2 obsI2M obsI2M then Ktrtr(X, X) = (R ⊗ IM )Ktrtr(RX, RX)(R⊤ IM ) ⊗ As a result, for any R, Y and X we may compute the log likelihood according to the likelihood model as log p(Ytr = RY as desired. Xtr = RX) | = log N M log(2π) = − − 1 2 log((R ⊗ (RY ; 0, Ktrtr(RX, RX)) 1 2 log Ktrtr(RX, RX) | | − IM )Y )⊤ [Ktrtr(RX, RX)]−1 ((R = M log(2π) − − = log p(Ytr = Y log 1 Ktrtr(X, X) 2 | Xtr = X), 1 2 | − | IM )Y ) ⊗ log Y ⊤Ktrtr(X, X)−1Y Lemma H.2 (Invariance of the conditionals). The conditionals distributions of the Helmoltz GP are invariant to rotation. That is, for any 2 2 rotation matrix R, × p(Yte = Yte | =p(Yte = RYte Xte = Xte, Xtr = Xtr, Ytr = Ytr) Xte = RXte, Xtr = RXtr, Ytr = RYtr) | 22 Proof. The lemma is obtained by applying Bayes' rule and Lemma H.1 as Gaussian Processes at the Helm(holtz) p(Yte = RYte Xte = RXte, Xtr = RXtr, Ytr = RYtr) p(Yte = RYte, Xte = RXte, Xtr = RXtr, Ytr = RYtr) | te, Xte = RXte, Xtr = RXtr, Ytr = RYtr)dRY ′ te = (cid:82) p(Yte = RY ′ = (cid:82) p(Yte = Y ′ = p(Yte = Yte | p(Yte = Yte, Xte = Xte, Xtr = Xtr, Ytr = Ytr) te, Xte = Xte, Xtr = Xtr, Ytr = Ytr)dY ′ te Xte = Xte, Xtr = Xtr, Ytr = Ytr). Proof of the equivariance proposition: We now prove the proposition. Recall that μF |D(Xte, Xtr, Ytr) = E[Yte | Xte = Xte, Ytr = Ytr, Xtr = Xtr]. Therefore, for any R, we may compute μF |D(RXte, RXtr, RYtr) as μF |D(RXte, RXtr, RYtr) = E[Yte Xte = RXte, Ytr = RYtr, Xtr = RXtr] | (cid:90) (cid:90) (cid:90) = = = Yte p(Yte = Yte | Xte = RXte, Ytr = RYtr, Xtr = RXtr)dYte RYte p(Yte = RYte | Xte = RXte, Ytr = RYtr, Xtr = RXtr)dYte RYte p(Yte = Yte | Xte = Xte, Ytr = Ytr, Xtr = Xtr)dYte = E[RYte | = RμF |D(Xte, Xtr, Ytr) Xte = Xte, Ytr = Ytr, Xtr = Xtr] Where in the third line we perform a change of variables, noting that The final line is a result of linearity of expectation and the definition of μF |D, and provides the desired equality. = 1. The fourth line follows from Lemma H.2. R | | H.4. Non-Equivariance of Velocity GP predictions In this appendix, we show that the velocity GP requires special constraints to exhibit reference-frame equivariance, and these constraints force an undesirable coupling of divergence and vorticity length scales. Proposition 4.3. For isotropic component kernels and zero prior mean, the velocity GP is reference-frame equivariant if and only if the kernels for each component are equal. Proof. We first show that if the velocity GP is reference-frame equivariant and has isotropic kernels for each component, then the kernels for the two velocity components are equal. In order to show this, it suffices to show that the prior R2 is not equivariant, as this is the posterior given the empty dataset. Let F )(cid:3)T by stacking F ( . Rotational invariance of the prior is equivalent to the condition that for an * arbitrary 2-dimensional rotation matrix R, R−1F (R ), where equality is in distribution for an entire sample path. * Consider a 90 degree rotation of the coordinate axis. In the case of a 90 degree rotation, by isotropy of the kernels, )]T . Considering each coordinate of R−1F (R ) = R−1F ( R−1F (R ), equality in distribution to F implies ), F1( * * * ) = F (1)( that F (2)( ) in distribution, and so the two components must have the same kernel. * * GP (0, k) be a function from R2 ) = (cid:2)F (1)( * ) = [F2( * ), F (2( * ) = F ( * → ∼ * We next show that if the two kernels are equal, then the velocity GP is rotationally equivariant. By Lemma H.2, it suffices to show there exist kernels kΦ, kΨ such that the prior is equal in distribution to a Helmholtz GP with these kernels. Let F denote a zero mean velocity GP with kernels k(1) = k(2). Let F ′ denote a Helmholtz GP with kernels kΦ = kΨ, and kΦ(x, x′) = (cid:82) x(1) k(2)(s, s′)dsds′. Applying Proposition 3.1 and the fundamental theorem of calculus, we see the covariance functions of F and F ′ are equal, and since F and F ′ are zero mean Gaussian processes, they are therefore equal in distribution. k(1)(s, s′)dsds′ + (cid:82) x(2) (cid:82) (x′)(1) s=0 (cid:82) (x′)(2) s=0 s′=0 s′=0 23 I. Experimental Results Gaussian Processes at the Helm(holtz) In this section, we provide more details on our experimental results. The section is organized in three parts. Appendix I.1 focuses on experiments with simulated data. Appendix I.2 focuses on experiments with real data from the LASER experiment (D'Asaro et al., 2017). Appendix I.3 focuses on real data from the GLAD experiment ( ̈Ozg ̈okmen, 2012). In each section, we have one subsection for each experiment. These subsections provide simulation details (e.g., what is the underlying vector field, and how we generated the buoys trajectories), model fitting details (e.g., hyperparameter optimization), and results. At the end of each subsection, we include a figure with these results. All the figures have the same structure. The first column represents ground truths. Second, third and fourth columns contain, respectively, SE-Helmholtz GP, SE-velocity GP, and D-HNN results. The first two rows represent results for the velocity prediction task: row 1 shows reconstructed velocity fields, row 2 differences from ground truth. Rows 3, 4, and 5 are about divergence: first divergence predictions, then standard deviation and z-values for the two GP models. Finally, rows 6, 7, and 8 concern vorticity: vorticity predictions, standard deviation and z-values for the two GP models. See Figure 5 for an example. For real data experiments, where we do not have ground truths, we omit the first column and the second row, i.e., all plots involving comparisons with ground truth quantities. See Figure 13 for an example. For the simulated experiments, all root mean square errors are evaluated on the grids used to simulate the experiment. Specific grids are discussed in the "simulation details" paragraph of each individual experiments subsection. More explicitly, the root mean square error is calculated as, RMSE = (cid:115) 1 L | | (cid:88) x∈L F (x) ∥ − ˆF (x) 2 2 ∥ (28) where F (x) denotes the simulated vector field, ˆF (x) denotes the predictions of a given model and L is the grid used to simulate the vector field. Initialization In all experiments except the GLAD data, we initialize our parameters such that log lΦ = 0, log σΦ = 0, log lΨ = 1, log σΨ = 2. We describe the special difficulties of the GLAD data in Appendix I.3. In all other cases, we found that results were not sensitive to initialization. 2 and likewise log l1 = 0, log σ1 = 0, log l2 = 1, log σ2 = 1, log σ2 1, log σ2 obs = obs = − − − − I.1. Simulated Experiments We focus on simulations of key ocean behaviors of interest to oceanographers: vortices, straight currents, concentrated divergences, and combinations thereof. I.1.1. SIMULATED EXPERIMENT 1: SINGLE VORTEX A single vortex in the ocean is a fluid flow pattern in which water particles rotate around a central point, with the flow pattern resembling a spiral. These vortices can occur due to a variety of factors such as the wind, currents, and tides. Single ocean vortices, also known as ocean eddies, can have a significant impact on ocean circulation and can transport heat, salt, and nutrients across vast distances. They can also affect the distribution of marine life. The vortex constructed has zero divergence and constant vorticity. Simulation details. To simulate a vortex vector field in a two dimensional space, we first define a grid of points L of size 17 x 17, equally spaced over the interval [ L, we compute the vortex longitudinal and latitudinal velocities by: 1, 1]. For each point x = (x(1), x(2)) 1, 1] − × − ∈ [ F (1)(x) = F (2)(x) = x(1) − x(2) From these equations we obtain that the divergence of the vortex is 0 for any x = (x(1), x(2)) L: ∈ δ(x) = div F = * ∂F (1) ∂x(1) + ∂F (2) ∂x(2) = 0 + 0 = 0 24 Gaussian Processes at the Helm(holtz) and the vorticity is -2 for any x = (x(1), x(2)) L: ∈ ζ(x) = curl F = * ∂F (1) ∂x(2) − ∂F (2) ∂x(1) = 1 − − 1 = 2 − In our simulated experiment, we then use this vector field to simulate buoys trajectories, i.e. the evolution of buoys positions and velocities across time. In doing so, we make an implicit stationarity assumption about the vector field. That is, we assume that across the total time where we want to simulate buoys trajectories, the vector field remains the same. Then we fix starting positions for the desired amount of buoys, in this case 4. We set these to be just on one side of the vortex, to evaluate the ability of the models to reconstruct the full vortex by having access to observations covering only a portion of it. We pick the total time (here 1) for which we observe the trajectories, and the amount of time steps at which we want to observe the buoys trajectories (here 2), to split the total time. To find the trajectories, we solve the velocity-time ordinary differential equation, dx/dt = F , where d/dt represents the time-derivative operator. Once we obtain the evolution of buoys' locations, we obtain the corresponding velocities by doing a linear interpolation of the underlying vortex field. By doing this interpolation, we end up with our simulated dataset, consisting in this case of 8 observations. Model fitting. We are interested in evaluating the models' capabilities of reconstructing the full vortex, and capturing the underlying divergence and vorticity structure. To do so, we consider test locations corresponding to the grid L, so that we can compare our results with the ground truth, for velocities, divergence, and vorticity. To fit the SE-Helmholtz GP, we initialize the hyperparameters as explained in the Initialization paragraph at the start of this appendix: lΦ = 1, σΦ = 1, lΨ = 2.7, σΨ = 0.368, σ2 obs = 0.135. The objective function of our optimization routine is the log marginal likelihood from Equation (5). We optimize the parameter using the gradient-based algorithm Adam (Kingma & Ba, 2015). Note that we optimize the hyperparameters in the log-scale. That is, we consider as parameters in the optimization step log lΦ, log σΦ, log lΨ, log σΨ, and log σ2 obs, and we exponentiate these when evaluating the log marginal likelihood. In doing so, we ensure that the optimal parameters are positive, as needed in this model. We run the optimization routine until the algorithm reaches convergence. In this case, the convergence criterion is the difference of log marginal likelihood in two consecutive optimization steps being less than 10−4. This convergence is achieved in less than 1000 iterations. The optimal hyperparameters are: lΦ = 1.1131, σΦ = 0.0342, lΨ = 1.5142, σΨ = 0.8884, σ2 obs = 0.1597. The same optimization routine is performed for the SE-velocity GP. In this case, the initial hyperparameters are l1 = 1, σ1 = 1, l2 = 2.7, σ2 = 0.368, σ2 obs = 0.1759. For both optimization routines, we tried different initial parametrizations, and the results agree substantially both in terms of RMSEs and visual reconstruction. Finally, to train the D-HNN model, we run the training routine provided in Greydanus & Sosanya (2022) code. obs = 0.135. The optimal hyperparameters are: l1 = 1.6191, σ1 = 0.9710, l2 = 2.7183, σ2 = 0.5811, σ2 Results. We show the results in Figure 5. For each of the plots, the horizontal and vertical axes represent, respectively, latitude and longitude. The first row represents the ground truth simulated vector field (left), and the reconstruction using the SE-Helmholtz GP (center-left), the SE-velocity GP (center-right) and the D-HNN (right). Red arrows are the observed buoy data, black arrows show the predicted current at test locations. We can see how our method predicts a full vortex covering the spatial domain, whereas the SE-velocity GP predicts a smooth curve with much longer length scale, that does not resemble the ground truth. The D-HNN prediction looks more similar to a vortex, but still not as good as the SE-Helmholtz GP. To support this claim we also show differences from the ground truth in the second row. Finally, note that the RMSE for the SE-Helmholtz GP is 0.24, whereas for the SE-velocity GP it is 0.72 and for the D-HNN is 0.54. In the third row, we analyze the divergence. The left box shows the constantly zero ground truth. Our model prediction (center-left) correctly captures this behavior, whereas the SE-velocity GP (center-right) predicts an irregular pattern not resembling the truth. The same happens for D-HNN (right box). In the fourth row we show the standard deviation of divergence predictions for the two GP models, and we can see how the SE-Helmholtz GP is very certain that there is no divergence, whereas the uncertainty for the SE-velocity GP predictions is higher. Finally, in the fifth row, we show the z-values for the divergence prediction, defined as the ratio between the mean and the standard deviation. This is a measure of how far from zero the prediction is, measured in terms of standard deviation. Some standard cut-off values for this 1 and +1, and one usually concludes that the prediction is significantly different (in the sense of one standard quantity are deviation) from 0 if the corresponding z-value is beyond these thresholds. By using this indicator, we conclude that none of the two predictions are significantly far from zero, so both models are accurate in predicting zero divergence, but our prediction is more precise, in the sense that the mean is closer to the real value and the uncertainty is lower. This is confirmed by looking at RMSEs: 0.0 for the SE-Helmholtz GP, 0.22 for SE-velocity GP, and 0.87 for the D-HNN. − 25 Gaussian Processes at the Helm(holtz) Finally, in the last three rows we analyze results for the vorticity. The left box shows the constant (-2) ground truth. The SE-Helmholtz GP (center-left) predicts that the vorticity is around that value, especially in the center of the vortex, whereas in the corners the behavior is not as good. The SE-velocity GP (center-right) performs much worse also here, by predicting vorticity very close to zero, or positive, on almost all the spatial domain. The D-HNN (right box) predicts negative vorticity in most of the domain, but the pattern is very irregular. In the second-to-last row we show the standard deviation of divergence predictions for the two GP models, and we can see how the range of uncertainties on this task is more similar than before, meaning that there are areas where both models are not very confident. Still, if we look at the z-values in the last row, combined with the prediction plots, we see our model is better at predicting the magnitude and size of the vorticity area. In terms of RMSEs, we have 0.77 for the SE-Helmholtz GP, 1.05 for the SE-velocity GP, and 1.03 for the D-HNN. In general, in this experiment we have shown that when working with this very simple underlying vector field, our model behaves better than the alternatives. In particular, we have seen how the prediction of the vortex is very accurate for the SE-Helmholtz GP, whereas the two other models are more off (and this is reflected in the respective RMSEs). In terms of divergence, our model predicts with certainty that there is no divergence, whereas the SE-velocity GP approach is less precise (by predicting non-zero divergence with high uncertainty). Finally, we saw how in terms of vorticity our model is the only one able to understand that there is a non-zero vorticity: even if the prediction is not perfect, it is still significantly better than all the other models. 26 Gaussian Processes at the Helm(holtz) Figure 5. Single vortex. First column: ground truths. Second column: SE-Helmholtz GP results. Third column: SE-velocity GP results. Fourth column: D-HNN results. 27 −0.250.000.25−0.250.000.25−0.250.000.25−0.250.000.250.20.40.20.4−0.50.00.5−0.50.00.5−2−1−2−1−2−1−2−10.40.60.80.40.60.8−4−2−4−2CurrentBuoy Gaussian Processes at the Helm(holtz) I.1.2. SIMULATED EXPERIMENT 2: VORTEX ADJACENT TO STRAIGHT CURRENT This task elaborates on the previous one by splitting the spatial domain in two regions: the upper region has a single vortex, and the lower region has a constant and straight flow from left to right. The velocity field is discontinuous at the boundary, and therefore the divergence and vorticity are not defined as fields along this line. In general, though, if we were to consider a smaller sub-region containing the boundary on the lefthand side (where the vortex has downward velocity), we expect such a sub-region to have a negative flux. Analogously, if we were to consider a sub-region containing the boundary on the righthand side (where the vortex has upward velocity), we would expect that sub-region to have a positive flux. Since the divergence and vorticity fields are not defined everywhere, it is not obvious what the desired behavior is in terms of recovering these fields. Due to this ambiguity, we do not report the results of this experiment in the main text. However, these discontinuities are reminiscent of fronts, which are of substantial interest to oceanographers, so we include this experiment in this appendix for completeness and in case it spurs future advancements. Simulation details. To simulate such a vortex vector field, we first define a grid of points L of size 25 x 50, equally spaced 1, 2]. We can see this grid as composed of two subgrids L1 and L2, each of dimension 25 x 25, over the interval [ with L1 representing the top grid and L2 the lower one. Next, for each point x = (x(1), x(2)) L1, we compute the vortex as done in Appendix I.1.1: [ − 1, 1] × − ∈ F (1)(x) = F (2)(x) = x(1) − x(2) and we still have δ(x) = 0 and ζ(x) = 2 for any x = (x(1), x(2)) − L1. ∈ For each point x ∈ L2, we simulate a constant field with the following equations: F (1)(x) = 0.7 F (2)(x) = 0. The divergence and vorticity for each x L2 are δ(x) = 0 and ζ(x) = 0. ∈ As done for the previous experiment, we then use this vector field to simulate buoys trajectories making the stationarity assumption. Here we consider 7 buoys, covering the full region, observed for a total time of 0.5 and 2 time steps. We reconstruct the buoys trajectories by solving the ODE and interpolating as specified before. By doing this interpolation, the simulated dataset consists of 14 observations. Model fitting. We fit the three models with the routine specified in Appendix I.1.1. To fit the SE-Helmholtz GP, we initialize the hyperparameters as follows: lΦ = 1, σΦ = 1, lΨ = 2.7, σΨ = 0.368, σ2 obs = 0.135. The optimal hyperparameters are: lΦ = 3.8698, σΦ = 0.0885, lΨ = 1.2997, σΨ = 0.9773, σ2 obs = 0.0609. The same optimization routine is performed for the SE-velocity GP. In this case, the initial hyperparameters are l1 = 1, σ1 = 1, l2 = 2.7, σ2 = 0.368, σ2 obs = 0.0087. For both optimization routines, we tried different initial parametrizations, and the results agree substantially both in terms of RMSEs and visual reconstruction. obs = 0.135. The optimal hyperparameters are: l1 = 0.9397, σ1 = 1.0755, l2 = 2.7183, σ2 = 0.5528, σ2 Results. We show the results in Figure 6. As before, for each of the plots, the horizontal and vertical axes represent, respectively, latitude and longitude. The first row represents the ground truth simulated vector field (left), and the reconstruction using the SE-Helmholtz GP (center-left), the SE-velocity GP (center-right) and the D-HNN (right). Red arrows are the observed buoy data, black arrows show the predicted current at test locations. We can see how our method predicts accurately the vortex structure, whereas it has some problems in the lower right corner, and smooths out the discontinuity at the boundary. The SE-velocity GP is accurate as well for the vortex part, but has a significant issue in the lower subgrid: the current flows from left to right, then gets interrupted, and then restarts in a different direction. This behavior goes against the idea that currents are continuous (by conservation of momentum). The D-HNN predictions look very similar to the SE-Helmholtz GP. In the second row we include the differences from the ground truth, and these show as well that SE-Helmholtz GP and D-HNN are accurate, whereas the SE-velocity GP has issues in the lower part of the grid. The RMSE for the SE-Helmholtz GP is 0.30, whereas for the SE-velocity GP it is 0.49 and for the D-HNN is 0.28. 28 Gaussian Processes at the Helm(holtz) In the third row, we analyze the divergence. The left box shows the constantly zero ground truth except for at the boundary line, where the divergence is undefined. Our model captures the zero divergence outside the boundary line, but does not estimate any divergence at or around the boundary line. The SE-velocity GP (center-right) estimates an irregular pattern. The D-HNN divergence estimate has the perhaps desirable property that it is negative on the left side and positive on the right side, which might lead to reasonable predictions of flux into and out of regions containing the boundary between the straight current and vortex. As it is unclear what a reasonable approximation to the divergence is when the divergence is concentrated on a line, we do not report RMSE on this example. Finally, in the last three rows we analyze results for the vorticity. The left box shows the ground truth, again ignoring the boundary line where the vorticity is undefined. Here both the GP models' predictions look very similar. Both predict that there is a negative vorticity area in the top grid, and a close-to-zero vorticity area in the lower grid. The D-HNN vorticity estimates in the upper and lower regions are similar to those of the GPs. Also the D-HNN estimate suggests a crisper boundary than the GP approaches do. In the standard deviation and z-value plots, we see that both GP models seem quite certain about the existence of a negative vorticity at least in part of the upper region. We again do not report RMSE for vorticity in this example as the vorticity is not well-defined over the entire region we consider. In summary, in this experiment we showed a situation in which the SE-Helmholtz GP is at least as good as the other two models in predicting the velocity field. It is not entirely clear what desirable reconstruction of the divergence and vorticity field is, as they are not defined on the boundary of the two regions, and the models show substantially different properties. Finally, we note that this field violates the modeling assumptions made by the the two GP models (particularly continuity) and further modeling innovation is likely needed to improve fidelity in examples like this one. 29 Gaussian Processes at the Helm(holtz) Figure 6. Vortex adjacent to straight current. First column: ground truths. Second column: SE-Helmholtz GP results. Third column: SE-velocity GP results. Fourth column: D-HNN results. 30 −101−101−101−1010.51.00.51.0−505−505−4−202−4−202−4−202−4−2020.250.500.750.250.500.75−20−100−20−100CurrentBuoy Gaussian Processes at the Helm(holtz) I.1.3. SIMULATED EXPERIMENT 3: AREAS OF CONCENTRATED DIVERGENCE For this experiment, we consider three different scenarios, differing only in the size of the divergence area. In each of these, we observe 5 buoys, each for 2 time steps. For all the scenarios, the two models perform very well. We show the results in Figures 7 to 9. Both models reconstruct the velocity field well, see Table 2 for more details. Moreover, this field has no vorticity and divergence that peaks at the center of the region and slowly decreases in a circular way. This behavior is captured by both models in an accurate way. We conclude that in this important simulated experiment our model is at least as good as the SE-velocity GP approach. A vector field with a single diffuse area of divergence simulates the behavior of an ocean fluid flow in which the water particles are spreading out from a particular region. This behavior can be caused by a variety of factors, such as the movement of warm and cold water masses, or the mixing of fresh and salt water, and can lead to increase in nutrient concentration and high primary production and biodiversity. The fluid particles in this area are not rotating in a circular motion as in a vortex, but instead moving away from each other, resulting in a decrease in density and velocity. Simulation details. To simulate a vector field with a divergence area in a two dimensional space, we first define a grid of 2, 2]. The point (0, 0) represents the center of the points L of size 20 x 20, equally spaced over the interval [ divergence area. To obtain a vector field with divergence area around this point, for each point x = (x(1), x(2)) L, we can compute the longitudinal and latitudinal velocities by: [ − 2, 2] × − ∈ F (1)(x) = F (2)(x) = x(1) bd + R2 x(2) bd + R2 d(x) d(x) with Rd(x) = ((x(1))2 + (x(2))2 being the distance from the center of divergence, and bd a parameter governing the size of the area of divergence. Larger bd implies larger area, but also smaller value at the center. Intuitively, this parameter measures how diffuse the divergence around a center point is. This intuition can be confirmed by computing the actual divergence value: δ(x) = div F = * ∂F (1) ∂x(1) + ∂F (2) ∂x(2) = For the vorticity instead we have bd + (x(1))2 (bd + R2 − d(x))2 (x(2))2 bd + (x(1))2 + (x(2))2 − (bd + R2 d(x))2 = 2bd (bd + R2 d(x))2 . ζ(x) = curl F = * ∂F (1) ∂x(2) − ∂F (2) ∂x(1) = − 2(x(1))(x(2)) (bd + R2 d(x))2 + 2(x(1))(x(2)) (bd + R2 d(x))2 = 0. The goals for each model then are to (1) reconstruct the velocity field in an accurate way, (2) predict that there is a divergent area and its size, and (3) predict zero vorticity. Finally note that in this experiment, we propose three different scenarios, where the only difference is how diffuse the divergence areas are. Specifically, we run three different experiments with bsmall = 0.4, bmedium = 2, and bbig = 15. As before, our observations are simulated buoy trajectories. For each scenario the simulation part is the same. We simulate 5 buoys, starting in the non-divergent areas, observed for a total time of 3, and we consider 2 time steps. Overall we have 10 observations. As usual, to get these trajectories we solve the velocity-time ODE and interpolate. Model fitting. For each of the three scenarios, we fit the three models with the routine specified in Appendix I.1.1. The hyperparameter initialization for both GPs is always the same across the three different scenarios: lΦ = 1, σΦ = 1, lΨ = 2.7, σΨ = 0.368, σ2 obs = 0.135 for the SE-Helmholtz GP, l1 = 1, σ1 = 1, l2 = 2.7, σ2 = 0.368, σ2 obs = 0.135 for the SE-velocity GP. We provide the optimal hyperparameters for each scenario in the corresponding subsections. Result: small divergence area, bsmall = 0.5. The optimal hyperparameters in this scenario are the following: • lΦ = 1.1314, σΦ = 1.9422, lΨ = 5.3132, σΨ = 0.1864, σ2 obs = 0.1821 for the SE-Helmholtz GP 31 • l1 = 0.5078, σ1 = 1.6570, l2 = 2.7183, σ2 = 1.8658, σ2 obs = 0.1396 for the SE-velocity GP. Gaussian Processes at the Helm(holtz) In Figure 7 we show the results of this scenario. As before, for each of the plots, the horizontal and vertical axes represent, respectively, latitude and longitude. The first row represents the ground truth simulated vector field (left), and the reconstruction using the SE-Helmholtz GP (center-left), the SE-velocity GP (center-right) and the D-HNN (right). Red arrows are the observed buoy data, black arrows show the predicted current at test locations. All three models have some problems in reconstructing the underlying field. The two GPs are particularly problematic, because they predict constant strong current that abruptly stops in regions where there are no buoys. The predictions are particularly bad for the SE-velocity GP, which fails to understand the direction and size of the current in most of the region. The D-HNN prediction is the one that looks better here, but it is still problematic in the sense that far away from the buoys the current starts to rotate. The plots in the second row showing the difference from the ground truth show that all these models provide poor performances on this task. In terms of RMSE, we have 1.11 for the SE-Helmholtz GP, 1.25 for the SE-velocity GP, and 0.67 for the D-HNN, confirming that our model performs much better. In the third row, we analyze the divergence. The left box shows the divergence structure of this field. As described in the preamble, since bd is small, we have a small area of divergence with big magnitude. The two GP models identify this area. The SE-velocity GP is more accurate in predicting the size of the divergence area. The SE-Helmholtz GP predicts that there is a divergence area in the middle and gets the correct magnitude, but predicts it to be larger than it actually is. If we consider the z-value plots, we can see that this intuition is confirmed: the SE-velocity GP predicts only a small area to have significant non-zero divergence, whereas our model overestimates the size of this area. The prediction of the D-HNN is less accurate. In terms of RMSEs, we have 2.62 for the SE-Helmholtz GP, 1.45 for the SE-velocity GP, and 4.14 for the D-HNN. In the last three rows of the plot we have, as usual, the vorticity analysis. The left box shows the ground truth. Here the SE-Helmholtz GP perfectly predicts zero vorticity, and the D-HNN is almost correct too. The SE-velocity GP, on the contrary, predicts very irregular vorticity, with very high uncertainty. If we consider the z-value plots, we see there is one region (in the center) where the vorticity is predicted to be non-zero in a significant manner. This is a problematic behavior that the SE-velocity GP has and our model has not. We have 0.0 RMSE for the SE-Helmholtz GP, 1.07 for the SE-velocity GP, and 0.31 for the D-HNN. Result: medium divergence area, bsmall = 5. The optimal hyperparameters in this scenario are the following: • lΦ = 1.9387, σΦ = 1.2387, lΨ = 2.3894, σΨ = 0.2192, σ2 obs = 0.0675 for the SE-Helmholtz GP • l1 = 1.6067, σ1 = 0.8181, l2 = 2.7183, σ2 = 0.9859, σ2 obs = 0.0742 for the SE-velocity GP. Figure 8 shows the results of this scenario. In the top part we have as always the velocity predictions. Since the divergence area is more diffuse, both the velocity of the current and the lengthscale of variation are smaller, in the sense that there are less sharp deviations. Compared to the previous scenario, this property of the field makes the prediction task easier for all three models. In particular, the SE-Helmholtz GP and SE-velocity GP predict a field that almost resembles identically the ground truth. The D-HNN still has some issues, specifically it predict some rotations far away from the observations. This behavior can be seen by looking at the difference from ground truth in the second row. We have the following RMSEs: 0.17 for the SE-Helmholtz GP, 0.19 for the SE-velocity GP, and 0.55 for the D-HNN. For the divergence, by looking at the ground truth plot on the left, we see the area of divergence is now more diffuse, and the magnitude is lower. Both the SE-Helmholtz GP and the SE-velocity GP predict this area accurately, both in terms of size and magnitude (they both predict this area to be a bit larger than it actually is). The D-HNN picks up divergence in a very irregular way. In terms of uncertainty, both GP models are more certain about their predictions around the buoys, and the z-values reflect this behavior: the area where the divergence is significantly different from zero (z-value above 1) is almost identical to the actual ground truth. The RMSEs are: 0.39 for the SE-Helmholtz GP, 0.33 for the SE-velocity GP, 1.32 for the D-HNN. For the vorticity, we observe that the performances of all models are now worse. The SE-Helmholtz GP still predicts vorticity very close to zero almost everywhere, but not exactly zero as before. The predictions for the SE-velocity GP still look less accurate and irregular. The D-HNN performance is very poor. In terms of uncertainty, the SE-Helmholtz GP has low uncertainty about its prediction, and this leads to an area where there is significantly non-zero vorticity (in terms of 32 Gaussian Processes at the Helm(holtz) z-value). This behavior is somehow problematic, but note that the predicted mean is in absolute value very close to zero in that area too. The z-value for the SE-velocity GP is as in the previous scenario, predicting significantly non-zero divergence in an area where the mean is quite distant from zero. Again, this is a very undesirable behavior. The RMSEs are: 0.05 for the SE-Helmholtz GP, 0.12 for the SE-velocity GP, 0.38 for the D-HNN. Result: big divergence area, bsmall = 15. We finally study the last scenario, with the big area of divergence. The optimal hyperparameters in this scenario are the following: • lΦ = 3.3732, σΦ = 0.8362, lΨ = 14.7644, σΨ = 0.0659, σ2 obs = 0.0074 for the SE-Helmholtz GP • l1 = 2.3456, σ1 = 0.3376, l2 = 2.7183, σ2 = 0.3355, σ2 obs = 0.0055 for the SE-velocity GP. In Figure 9 we show the results of this scenario. Here the divergence areas are even more diffuse, and this seems to help a lot the SE-Helmholtz GP predictions but not so much the other methods. For the velocity prediction task, the three models produce predictions that are close to the truth. It is clear, however, that the predictions of the SE-Helmholtz GP are more precise, whereas both the SE-velocity GP and D-HNN predict some rotational shapes that should not be there. This result is confirmed by the RMSE: 0.04 for the SE-Helmholtz GP, 0.10 for the SE-velocity GP, and 0.19 for the D-HNN. In terms of divergence, predictions for the two GP models are similar, but our model is slightly better at predicting the full size of the region, with low uncertainty. The D-HNN prediction is again poor. The z-values show how in the central area, both models significantly predict non-zero divergence, but further away in the corners z-values get closer and closer to zero. This behavior is due to the distribution of the buoys' observations. The RMSEs are: 0.05 for the SE-Helmholtz GP, 0.12 for the SE-velocity GP, and 0.27 for the D-HNN. Finally, if we consider the vorticity, we can see how here the SE-Helmholtz GP is superior to the other two methods, as in the two previous scenarios. It is able to detect that there is no vorticity, with very low uncertainty. The SE-velocity GP, on the contrary, predicts non-zero positive vorticity in the left side of the plot, and non-zero negative vorticity in the right side. These predictions are with low uncertainty and hence significant, as can be seen by looking at the z-values plot (most of the domain has z-values beyond the thresholds +1 and -1). The prediction with D-HNN is in similar to the SE-velocity GP one. The RMSEs are: 0.0 for the SE-Helmholtz GP, 0.10 for the SE-velocity GP, and 0.11 for the D-HNN. In general, we saw how in these experiment the SE-Helmholtz GP is at least as good as the other two methods in almost all the velocity prediction tasks, as good as the SE-velocity GP for the divergence tasks, and remarkably better in predicting that there is no vorticity. 33 Gaussian Processes at the Helm(holtz) Figure 7. Small area of divergence. First column: ground truths. Second column: SE-Helmholtz GP results. Third column: SE-velocity GP results. Fourth column: D-HNN results. 34 01001001001024240102001020−202−202−202−2022424−0.50.00.51.0−0.50.00.51.0CurrentBuoy Gaussian Processes at the Helm(holtz) Figure 8. Medium area of divergence. First column: ground truths. Second column: SE-Helmholtz GP results. Third column: SE-velocity GP results. Fourth column: D-HNN results. 35 0120120120120.20.40.60.20.40.60102001020−0.20.00.2−0.20.00.2−0.20.00.2−0.20.00.20.20.40.60.20.40.60101CurrentBuoy Gaussian Processes at the Helm(holtz) Figure 9. Big area of divergence. First column: ground truths. Second column: SE-Helmholtz GP results. Third column: SE-velocity GP results. Fourth column: D-HNN results. 36 0.00.20.40.60.00.20.40.60.00.20.40.60.00.20.40.60.050.100.050.1001020300102030−0.10.00.1−0.10.00.1−0.10.00.1−0.10.00.10.050.100.050.10−202−202CurrentBuoy Gaussian Processes at the Helm(holtz) I.1.4. SIMULATED EXPERIMENT 4: DUFFING OSCILLATOR WITH AREAS OF CONCENTRATED DIVERGENCE The Duffing oscillator is a nonlinear dynamic system that can be used to study the dynamics of oceanic phenomena such as tides and currents. In this experiment, we add to this system a divergence area on the left region and a convergence area on the right one. See top-left plot in Figure 10. In this way we obtain a field that has both divergence (positive on the right, negative on the left), and vorticity (for the underlying Duffing system). Simulation details. To simulate a Duffing oscillator in a two dimensional space, we first define a grid of points L of size 30 x 30, equally spaced over the interval [ 4, 4] L, we compute the Duffing longitudinal and latitudinal velocities by: 4, 4]. Next, for each point x = (x(1), x(2)) × − − ∈ [ ̃F (1)(x) = x(2) ̃F (2)(x) = (x(1) 0.1 ∗ − (x(1))3) (1 + 0.1 cos(50 π/4)). ∗ ∗ ∗ On top of this field we add a divergent field at location ( 3, 0), using equations: − D(1)(x) = D(2)(x) = (x(1) ( 3)) − − bd + R2 d(x) x(2) bd + R2 c(x) 3))2 + (x(2) 0)2 being the distance from the center of divergence, and bd a parameter governing with Rd(x) = (x(1) the size of the area of divergence. Larger bd implies larger area, but also smaller value at the center. It can be seen as a parameter measuring how diffuse the divergence around a center point is. We also have a convergent field around (3, 0), determined by the equations: ( − − − with Rc(x) = (x(1) up these three quantities: − 3)2 + (x(2) C (1)(x) = C (2)(x) = (x(1) 3) − bc + R2 d(x) (x(2)) bc + R2 c(x) − − 0)2, the distance from the center of convergence. To get the full velocity field, we sum − F (1)(x) = ̃F (1)(x) + D(1)(x) + C (1)(x) F (2)(x) = ̃F (2)(x) + D(2)(x) + C (2)(x). In this system, the divergence and vorticity do not have a simple form, but can be calculated. For the sake of our divergence analysis, it is sufficient to say that there are two areas of interest, around the center of divergence and convergence. In this experiment, we propose three different scenarios, where the only difference is how diffuse the divergence areas are. For simplicity, we assume b = bc = bd, and we run three different experiments with bsmall = 0.5, bmedium = 5, and bbig = 15. As done before, to predict currents, divergence, and vorticity we simulate buoys. For each scenario the simulation part is the same. We first simulate 3 buoys, starting in the non-divergent areas, observed for a total time of 5, and 2 time steps. We then simulate 4 additional buoys, starting around the divergent areas, for a total time of 5, and 4 time steps. That is, we make observations coarser for buoys in these regions. Overall we have 22 observations. As usual, to get these observations we solve the velocity-time ODE and interpolate. Model fitting. For each of the three scenarios, we fit the three models with the routine specified in Appendix I.1.1. The hyperparameter initialization for both GPs is the same across the three different scenarios: lΦ = 1, σΦ = 1, lΨ = obs = 0.135 for the SE-Helmholtz GP, l1 = 1, σ1 = 1, l2 = 2.7, σ2 = 0.368, σ2 2.7, σΨ = 0.368, σ2 obs = 0.135 for the SE-velocity GP. We provide the optimal hyperparameters for each scenario in the corresponding subsections. Result: small divergence area, bsmall = 0.5. The optimal hyperparameters in this scenario are the following: 37 Gaussian Processes at the Helm(holtz) • lΦ = 0.6335, σΦ = 0.3734, lΨ = 3.9115, σΨ = 6.9294, σ2 obs = 0.0083 for the SE-Helmholtz GP • l1 = 0.7212, σ1 = 1.8767, l2 = 2.7183, σ2 = 1.1361, σ2 obs = 0.0084 for the SE-velocity GP. In Figure 10 we show the results of this scenario. As before, for each of the plots, the horizontal and vertical axes represent, respectively, latitude and longitude. The first row represents the ground truth simulated vector field (left), and the reconstruction using the SE-Helmholtz GP (center-left), the SE-velocity GP (center-right) and the D-HNN (right). Red arrows are the observed buoy data, black arrows show the predicted current at test locations. First of all, we can see how our method predicts accurately the duffing structure in the left part of the plot, whereas has some issues in the right one, where we have the convergence area. The SE-velocity GP prediction is more problematic: the correct current is predicted around the buoys, but farther away the prediction goes to zero, reverting to the prior mean. This is a problematic behavior, e.g., because it predicts very non-continuous currents. The D-HNN prediction is problematic as well: the current looks more continuous, but the general shape is very different from the ground truth. This behavior can be seen well from the second row, the comparison to the ground truth. In terms of RMSE, we have 0.96 for the SE-Helmholtz GP, 2.05 for the SE-velocity GP, and 2.14 for the D-HNN, confirming that our model performs much better. In the third row, we analyze the divergence. The left box shows the divergence structure of this field. There is a small area with very positive divergence on the left, and a small area with very negative divergence on the right. The two GP models are good at identifying these areas. At the same time, they both predict some other areas of divergence around the observed buoys. Nonetheless, if we consider the z-value plots (on the fifth row) we can see how the z-values for both models are very high in the two areas of divergence, meaning that there is a strongly significant non-zero mean in those areas, as desired. The D-HNN predicts a quite different divergence structure. The RMSEs are: 0.94 for the SE-Helmholtz GP, 0.95 for the SE-velocity GP, and 1.89 for the D-HNN. Finally, in the last three rows we analyze results for the vorticity. The left box shows the ground truth. Here the SE-Helmholtz GP prediction looks more accurate than the other two. Nonetheless, even our model is not fully able to capture the full vorticity structure. The predictions for the SE-velocity GP look particularly problematic because it is highly affected by the location of the buoys, and that is reflected in the uncertainty and z-values plots. The D-HNN predicts a very different field on this task as well. The RMSEs are: 1.40 for the SE-Helmholtz GP, 2.28 for the SE-velocity GP, and 2.64 for the D-HNN. Result: medium divergence area, bsmall = 5. The optimal hyperparameters in this scenario are the following: • lΦ = 1.2029, σΦ = 0.1666, lΨ = 3.3679, σΨ = 9.5514, σ2 obs = 0.0112 for the SE-Helmholtz GP • l1 = 6.7677, σ1 = 4.5316, l2 = 2.7183, σ2 = 23.3219, σ2 obs = 0.0305 for the SE-velocity GP. Figure 11 shows the results of this scenario. In the top part we have as always the velocity predictions. In this case, the ground truth field is very similar to before, but the divergence areas are more diffuse, and hence the current has generally longer lengthscale of variation (that is, the deviations are less sharp). This feature helps the predictions for all three methods. We can see indeed how now the three models produce predictions that are closer to the truth than before. Still, by looking at the difference from ground truth plots, we can see that the prediction of our model is slightly better than the SE-velocity GP, and significantly better than the D-HNN. We have the following RMSEs: 0.19 for the SE-Helmholtz GP, 0.60 for the SE-velocity GP, and 1.65 for the D-HNN. These confirm what can see visually in the plots. In terms of divergence, by looking at the the ground truth plot on the left, one can immediately notice how the areas of divergence are now more diffuse, and the magnitudes are lower. The SE-Helmholtz GP predicts accurately the two areas, with some noise in the central region. The SE-velocity GP is less accurate, but overall understand that there are these two areas. The D-HNN fails in identifying the two regions. It is interesting to observe the z-value plots in this experiment: for the SE-Helmholtz GP, the z-values are very high in the two desired areas, meaning that our model is very certain about divergence being different from zero in those areas. For the SE-velocity GP, the z-values still look good, just less accurate than for our model. The RMSEs are: 0.14 for the SE-Helmholtz GP, 0.50 for the SE-velocity GP, and 1.15 for the D-HNN. Finally, we consider the vorticity. Here the two GP models agree significantly on the shape of their predictions, and they are both very similar to the ground truth. This result is reflected in the RMSEs: 0.24 for the SE-Helmholtz GP, 0.26 for the SE-velocity GP. The prediction for the D-HNN is far from the truth (RMSE 2.39). The uncertainty is lower close to 38 Gaussian Processes at the Helm(holtz) the data for both GP models. In general, both GP models seem to work well in recovering divergence and vorticity in this scenario. The SE-Helmholtz GP is superior for the divergence, the SE-velocity GP for the vorticity. Result: big divergence area, bsmall = 15. The optimal hyperparameters in this scenario are the following: • lΦ = 2.9194, σΦ = 0.4599, lΨ = 3.2411, σΨ = 10.1815, σ2 obs = 0.0137 for the SE-Helmholtz GP • l1 = 7.3457, σ1 = 4.0581, l2 = 2.7183, σ2 = 24.7519, σ2 obs = 0.0202 for the SE-velocity GP. In Figure 12 we show the results of this scenario. Here the divergence areas are even more diffuse, and the overall field ends up having longer lengthscale of variation. The results on velocity predictions, divergence, and vorticity are aligned with the medium size scenario. For the velocity prediction task, the three models produce predictions that are close to the truth. Now the two GP models are similar, as can be seen in the difference from the truth plots, and they are both significantly better than the D-HNN. This result is confirmed by the RMSEs: 0.41 for the SE-Helmholtz GP, 0.22 for the SE-velocity GP, and 1.63 for the D-HNN. In terms of divergence, the SE-Helmholtz GP accurately predicts the two areas of divergence, still with some noise in the central region. The SE-velocity GP is less accurate, especially in the top right region, but overall understand that there are these two areas. The D-HNN prediction is poor. As in the past experiment, it is interesting to observe the z-value plots: both GP models have very high z-values in the areas of divergence, proving their ability to capture the locations of these. The RMSEs are: 0.08 for the SE-Helmholtz GP, 0.17 for the SE-velocity GP, 1.10 for the D-HNN. Finally, also if we consider the vorticity, the results are similar to the previous scenario. Predictions are good for the two GPs, with meaningful z-values. Now the SE-velocity GP predictions align almost perfectly with the ground truth, and this is reflected in the lower RMSE (0.16 vs. 0.48 for the SE-Helmholtz GP). The D-HNN still fails to predict structure precisely (2.41 RMSE) In summary, with this experiment we showed that the SE-Helmholtz GP is generally better than the other models in predicting the underlying velocity field (significantly better in the first scenario). In terms of divergence and vorticity, we do not see a large difference compared to the SE-velocity GP: both models are very good; SE-Helmholtz GP is slightly better for the divergence and SE-velocity GP is slightly better for the vorticity. This behavior is very interesting, showing how both models are able to predict a complex divergence pattern (more complex than the previous experiment). 39 Gaussian Processes at the Helm(holtz) Figure 10. Duffing with small area of divergence. First column: ground truths. Second column: SE-Helmholtz GP results. Third column: SE-velocity GP results. Fourth column: D-HNN results. 40 05050505123123−505−505−2024−2024−2024−20241231230.02.55.07.50.02.55.07.5CurrentBuoy Gaussian Processes at the Helm(holtz) Figure 11. Duffing with medium area of divergence. First column: ground truths. Second column: SE-Helmholtz GP results. Third column: SE-velocity GP results. Fourth column: D-HNN results. 41 −10−10−10−100.250.500.750.250.500.75−20−10010−20−100100240240240240.250.500.750.250.500.75050100050100CurrentBuoy Gaussian Processes at the Helm(holtz) Figure 12. Duffing with big area of divergence. First column: ground truths. Second column: SE-Helmholtz GP results. Third column: SE-velocity GP results. Fourth column: D-HNN results. 42 −0.50−0.250.000.25−0.50−0.250.000.25−0.50−0.250.000.25−0.50−0.250.000.250.20.40.60.20.40.6−10010−100100240240240240.250.500.750.250.500.75050100050100CurrentBuoy I.2. Real-world data 1: LASER Gaussian Processes at the Helm(holtz) The LAgrangian Submesoscale ExpeRiment, or LASER (Novelli et al., 2017), was performed in the Gulf of Mexico in January-February 2016. Around 10 million data points were retrieved from more than 1000 near-surface biodegradable CODE-type ocean drifters (drogued at a depth of one meter) tracked in real-time using SPOT GPS units. These data were then preprocessed as described in Yaremchuk & Coelho (2014). Finally, since satellite data can have errors and positions of buoys sometimes jump an unrealistic amount, oceanographers removed some bad points that were visible by eye. The preprocessed data are available at https://data.gulfresearchinitiative.org/data/R4.x265.237:0001 (D'Asaro et al., 2017). In our analysis, we use locations and velocities of buoys as they appear in this dataset. The main goal of the experiment was to obtain data to understand the submesoscale ocean currents in the open ocean environment near the DeSoto Canyon, as well as how oil or other pollutants might be transported via these currents. In our analysis, we consider a subsample of the LASER data, in an area where the oceanographers expect a convergent front to be (from visual inspection of drifter data). This particular structure in the ocean happens when there are two different masses of water that collide and cause the formation of an area where water sinks. This behavior could happen when two water masses with different temperatures and/or salinities meet, or when water masses from different directions go towards the same area, such as the meeting of warm equatorial water and cold polar water. These fronts are very important for understanding ocean circulation and weather patterns, and can also be a source of nutrients for marine life. To study this structure, we consider two experiments: in the first one, we run our model on a small subset of buoys from this region, collapsing the time dimension and downsampling the observations. To confirm our finds, we then run our models on a dataset that contains more buoys and observations, still from that region. I.2.1. LASER, CONVERGENT FRONT, SPARSE In this analysis, we consider 19 buoys, observed every fifteen minutes over a two hour time horizon. By downsampling by a factor of 3 and collapsing the time dimension, we obtain 55 observations. In these data, oceanographers expect to see a clear convergent front in the left region of the spatial domain. Model fitting. The optimization routine is exactly the same that we do for the simulated experiments: gradient-based Adam algorithm until convergence or a sufficient amount of iterations has elapsed. For the initial hyperparameters, we have tried various alternatives, and found out that the predictions do not change significantly. Hence, for coherence, we stick to the usual initialization done for synthetic data, i.e., lΦ = 1, σΦ = 1, lΨ = 2.7, σΨ = 0.368, σ2 obs = 0.135 for the SE-Helmholtz GP, and l1 = 1, σ1 = 1, l2 = 2.7, σ2 = 0.368, σ2 obs = 0.135 for the SE-velocity GP. The optimal hyperparameters obtained are: lΦ = 1.6032, σΦ = 0.0496, lΨ = 13.3272, σΨ = 1.6392, σ2 obs = 0.0232 for the SE-Helmholtz GP, and l1 = 8.3149, σ1 = 0.1384, l2 = 2.7183, σ2 = 0.1318, σ2 obs = 0.0276 Results. We show the results in Figure 13. The top row shows the predictions for the three models. As before, red arrows are the observed buoy data. The black arrows show the current posterior means at test locations. The test locations are 400 points evenly sparse on a 20 x 20 grid that covers the full range of latitude and longitude of our buoys' observations. The three models produce very similar results: a quasi-constant flow towards the south-west area of the region. There is a slight difference in prediction for the region where buoys seem to converge (SE-velocity GP and D-HNN do not predict different current around there, SE-Helmholtz GP predicts a more converging behavior). This difference is clear when we look at the posterior divergence plots, in the second row. Our model predicts a negative divergence area (in light-blue) in the area where the oceanographers expect a convergent front. On the contrary, the SE-velocity GP predicts no divergence on the whole spatial domain. This is a very important difference, showing how our model can perform better in recovering this very important property of the ocean. Note that this same intuition is confirmed if we look at the fourth row, where we have z-value plots for both models: the z-values for the SE-Helmholtz GP around the expected convergent front are strongly negative, meaning that the divergence there is significantly non-zero, as desired. For the vorticity, we just have very small values, almost zero, for both models. Unfortunately, there is no oceanographic knowledge to predict the vorticity far away from the observed drifter traces, and therefore we can not conclude anything related to this point. 43 I.2.2. LASER, CONVERGENT FRONT, FULL Gaussian Processes at the Helm(holtz) To further validate the result on the divergence, we consider the same buoys floating over a nine hour time horizon, downsampled by a factor of 3, obtaining 240 observations. We fit our models by performing the usual optimization routine, and we plot the results in Figure 14. In the top row we show the prediction results. For all the models, the predictions around the buoy agree almost perfectly with predictions from the sparse experiment for the SE-Helmholtz GP; further away models, are more conservative and closer to the prior. The divergence plots in the second row are of the most interest. The prediction according to SE-velocity GP changes remarkably relative to the past experiment. Now it matches closely the Helmholtz result, and both methods detect the convergent front. This result shows the strength of our model in being more data efficient, a very desirable property for a GP model. 44 Gaussian Processes at the Helm(holtz) Figure 13. LASER sparse. First column: SE-Helmholtz GP results. Second column: SE-velocity GP results. Third column: D-HNN results. 45 −0.050.000.05−0.050.000.05−0.050.000.050.010.020.030.040.010.020.030.04−202−202−0.02−0.010.000.010.02−0.02−0.010.000.010.02−0.02−0.010.000.010.020.0060.0080.0100.0060.0080.010−202−202predictedcurrentsbuoys'locations Gaussian Processes at the Helm(holtz) Figure 14. LASER complete. First column: SE-Helmholtz GP results. Second column: SE-velocity GP results. Third column: D-HNN results. 46 −0.10−0.050.000.05−0.10−0.050.000.05−0.10−0.050.000.050.020.040.060.020.040.06−2.50.02.55.07.5−2.50.02.55.07.5−0.10−0.050.000.050.10−0.10−0.050.000.050.10−0.10−0.050.000.050.100.020.040.060.020.040.06−4−2024−4−2024predictedcurrentsbuoys'locations Gaussian Processes at the Helm(holtz) I.3. Real-world data 2: GLAD The Grand Lagrangian Deployment (GLAD) experiment ( ̈Ozg ̈okmen, 2012) is another experiment conducted in the northern Gulf of Mexico in July 2012. More than 300 custom-made buoys (of the same type as in the LASER experiment) were deployed near the Deepwater Horizon site and Louisiana coast. This experiment was originally intended to help advance research in understanding the spread and dispersion of oil after the Deepwater Horizon tragedy. Researchers have been using this dataset to study interactions among ocean flows, the levels of influence on transport that large and small flows have, and the size of oil spread at which large flows dominate. Since the GLAD experiment was conducted in the summer time with a shallow 20-meter surface mixed layer for the buoys, the wind has a very strong impact on the trajectories, creating a lot of oscillations. These oscillations are due to a balance of forces due to wind forcing and Earth's rotation, and get amplified during summer time. Filtering these oscillations is a very complicated task, so this wind-induced motions represent a true problem for buoys that are used for measuring oceanographic parameters. Note that we do not see these issues with the LASER data, because that was a winter experiment, where the surface layer is 100-meter deep and devoid of these oscillations. Model fitting. To deal with this issue, we consider a limited subset of our dataset. We take drifter traces of 12 buoys, observed hourly over a four days time horizon. We collapse the time dimension and downsample these traces by a factor 50, obtaining 85 observations. In terms of optimization routine, we follow very similarly what done in all the other experiments. The only difference is that here different hyperparameter optimization led to different prediction plots for some combinations. In our final results, we decided to stick to the hyperparameter initialization for which both the SE-Helmholtz GP and the SE-velocity GP results were visually more appealing. These are lΦ = 12.18, σΦ = 0.135, lΨ = 7.4, σΨ = 3, σ2 obs = 0.135 for the SE-Helmholtz GP, l1 = 2.7, σ1 = 1, l2 = 2.7, σ2 = 1, σ2 obs = 0.135 for the SE-velocity GP. The optimal hyperparameters obtained after the optimization routine are lΦ = 45.6840, σΦ = 0.0362, lΨ = 80.1871, σΨ = 13.5514, σ2 obs = 0.1739 for the SE-velocity GP. obs = 0.1715 for the SE-Helmholtz GP, and l1 = 72.5835, σ1 = 0.2622, l2 = 2.7183, σ2 = 0.1354, σ2 Results. In these data, we expect to see a continuous current with no sharp deviations (i.e., lengthscale of variation is long), with few smaller vortices distributed across the region. Unfortunately, here there is no explicit divergence structure that oceanographers expect, so any conclusion from the divergence and vorticity plots is difficult to verify. We show the results of the experiments in Figure 15. We have the predictions in the first row. As before, red arrows are the observed buoy data. The black arrows show the current posterior means at test locations. First of all, the D-HNN model makes physically implausible predictions, likely due to the sparse nature of the data on a large domain. For the GP models, both prediction plots look reasonable, but there are two regions of interest showing important issues with the SE-velocity GP. Consider the bottom right corner. Despite evidence of a strong current making a u-turn, the standard approach shows an abrupt drop in current away from observed data. Our method, on the contrary, predicts a strong current connecting across drifters, in accordance with the continuity of currents (the idea that when a fluid is in motion, it must move in such a way that mass is conserved). This behavior is very problematic. Consider then the top-left corner. Flow behavior around the observations suggests that there might be a vortex in that region. The standard approach shows none. With the SE-Helmholtz GP, instead, we can see the expected vortex between the two lines of current. To further prove our point, we increase the number of observations to 1200, by decreasing the downsampling factor, and we re-fit the two models with the same optimization routine. The velocity prediction results are included in the first row of Figure 16. Here we can see that our model starts being affected by the oscillations in the data, predicting currents with shorter lengthscale of variation. But also it is still able to reconstruct a continuous current, also far away from the observations, with some vortices with shorter length scale. For the SE-velocity GP, the discontinuity issues increase significantly, and the model is still unable to detect vortices. These are two strong motivations to believe the SE-Helmholtz GP provides a better alternative for this task. The prediction of the D-HNN remains poor. In terms of divergence and vorticity reconstruction on the sparse dataset, the SE-Helmholtz GP predicts very small divergence almost everywhere, and vorticity coherent with the buoys trajectories. The SE-velocity GP, instead, predicts a reasonable vorticity field, but the divergence shows irregular patterns that look more suspicious. See the second and third blocks in Figure 15 for a visual comparison. By looking at the data, we can see how there are regions on the left where buoys observations seem to be more affected by the oscillations. The SE-velocity GP is more influenced by this noise than our model, and hence predicts divergence areas around the buoys. This claim can be validated by looking at the plots when the dataset size increases. See the second and third blocks in Figure 16. Here, both models seem to be affected more 47 Gaussian Processes at the Helm(holtz) by the oscillations, but the SE-Helmholtz GP still predicts divergence closer to zero, whereas the SE-velocity GP predicts divergence areas around each conglomerate of buoys in the region. Therefore, we can conclude that our model is at least as good as the SE-velocity GP. Note that we cannot say anything stronger, because there is no expert knowledge suggesting that the SE-Helmholtz GP behavior is the expected one. 48 Gaussian Processes at the Helm(holtz) Figure 15. GLAD sparse. First column: SE-Helmholtz GP results. Second column: SE-velocity GP results. Third column: D-HNN results. 49 −0.004−0.0020.0000.002−0.004−0.0020.0000.002−0.004−0.0020.0000.0020.0010.0020.0030.0010.0020.003−101−101−0.015−0.010−0.0050.0000.005−0.015−0.010−0.0050.0000.005−0.015−0.010−0.0050.0000.0050.0020.0030.0040.0050.0020.0030.0040.005−4−2024−4−2024predictedcurrentsbuoys'locations Gaussian Processes at the Helm(holtz) Figure 16. GLAD complete. First column: SE-Helmholtz GP results. Second column: SE-velocity GP results. Third column: D-HNN results. 50 −0.020.000.02−0.020.000.02−0.020.000.020.0050.0100.0150.0200.0250.0050.0100.0150.0200.025−2024−2024−0.050.000.050.10−0.050.000.050.10−0.050.000.050.100.010.020.030.040.010.020.030.04−505−505predictedcurrentsbuoys'locations Gaussian Processes at the Helm(holtz) 51
http://arxiv.org/abs/2302.10363v2
2023-06-23T01:26:36
2023-02-20T23:44:30
Transformed Distribution Matching for Missing Value Imputation
We study the problem of imputing missing values in a dataset, which has important applications in many domains. The key to missing value imputation is to capture the data distribution with incomplete samples and impute the missing values accordingly. In this paper, by leveraging the fact that any two batches of data with missing values come from the same data distribution, we propose to impute the missing values of two batches of samples by transforming them into a latent space through deep invertible functions and matching them distributionally. To learn the transformations and impute the missing values simultaneously, a simple and well-motivated algorithm is proposed. Our algorithm has fewer hyperparameters to fine-tune and generates high-quality imputations regardless of how missing values are generated. Extensive experiments over a large number of datasets and competing benchmark algorithms show that our method achieves state-of-the-art performance.
[ "He Zhao", "Ke Sun", "Amir Dezfouli", "Edwin Bonilla" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10363v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10363v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG" ]
Transformed Distribution Matching for Missing Value Imputation He Zhao 1 Ke Sun 1 Amir Dezfouli 1 Edwin V. Bonilla 1 3 2 0 2 n u J 3 2 ] G L . s c [ 2 v 3 6 3 0 1 . 2 0 3 2 : v i X r a Abstract We study the problem of imputing missing values in a dataset, which has important applications in many domains. The key to missing value imputa- tion is to capture the data distribution with incom- plete samples and impute the missing values ac- cordingly. In this paper, by leveraging the fact that any two batches of data with missing values come from the same data distribution, we propose to im- pute the missing values of two batches of samples by transforming them into a latent space through deep invertible functions and matching them dis- tributionally. To learn the transformations and im- pute the missing values simultaneously, a simple and well-motivated algorithm is proposed. Our algorithm has fewer hyperparameters to fine-tune and generates high-quality imputations regardless of how missing values are generated. Extensive experiments over a large number of datasets and competing benchmark algorithms show that our method achieves state-of-the-art performance1. 1. Introduction In practice, real-world data are usually incomplete and con- sist of many missing values. For example, in the medical domain, the health record of a patient may have consid- erable missing items as not all of the characteristics are properly recorded or not all of the tests have been done for the patient (Barnard & Meng, 1999). In this paper, we are interested in imputing missing values in an unsu- pervised way (Van Buuren & Groothuis-Oudshoorn, 2011; Yoon et al., 2018; Mattei & Frellsen, 2019; Muzellec et al., 2020; Jarrett et al., 2022). Here the meaning of "unsuper- vised" is twofold: We do not know the ground truth of the missing values during training and we do not assume a specific downstream task. 1CSIRO's Data61, Australia. Correspondence to: He Zhao <[email protected]>. Proceedings of the 40 th International Conference on Machine Learning, Honolulu, Hawaii, USA. PMLR 202, 2023. Copyright 2023 by the author(s). 1Code at https://github.com/hezgit/TDM 1 The key to missing value imputation is how to model the data distribution with a considerable amount of missing values, which is a notoriously challenging problem. To address this challenge, existing approaches either choose to model the conditional data distribution instead (i.e., the distribution of one feature conditioned on the other fea- tures), such as in Heckerman et al. (2000); Raghunathan et al. (2001); Gelman (2004); Van Buuren et al. (2006); Van Bu- uren & Groothuis-Oudshoorn (2011); Liu et al. (2014); Zhu & Raghunathan (2015) or use deep generative models to capture the data distribution, such as in Gondara & Wang (2017); Ivanov et al. (2018); Mattei & Frellsen (2019); Naz- abal et al. (2020); Gong et al. (2021); Peis et al. (2022); Yoon et al. (2018); Li et al. (2018); Yoon & Sull (2020); Dai et al. (2021); Fang & Bao (2022); Richardson et al. (2020); Ma & Ghosh (2021); Wang et al. (2022). Alternatively, a recent interesting idea proposed by Muzellec et al. (2020) has found success, whose key insight is that any two batches of data (with missing values) come from the same data dis- tribution. Thus, a good method should impute the missing values to make the empirical distributions of the two batches matched, i.e., distributionally close to each other. This is a more general and applicable assumption that can be used in various data under different missing value mechanisms. In this paper, we refer to this idea as distribution matching (DM), the appealing property of which is that it bypasses modelling the data distribution explicitly or implicitly, a difficult task even without missing values. As the pioneering study, Muzellec et al. (2020) does DM by minimising the optimal transport (OT) distance whose cost function is the quadratic distance in the data space between data samples. However, real-world data usually exhibit complex geometry, which might not be captured well by the quadratic distance in the data space. This can lead to wrong imputations and poor performance. In this paper, we propose a new, straightforward, yet powerful DM method, which first transforms data samples into a latent space through a deep invertible function and then does dis- tribution matching with OT in the latent space. In the latent space, the quadratic distance of two samples is expected to better reflect their (dis)similarity under the geometry of the data considered. In the missing-value setting, learning a good transformation is non-trivial. We propose a simple and elegant algorithm that learns the transformations and Transformed Distribution Matching for Missing Value Imputation imputes the missing values simultaneously, which is well- motivated by the theory of OT and representation learning. The contributions of this paper include: 1) As DM is a new and promising line of research in missing value imputa- tion, we propose a well-motivated transformed distribution matching method, which significantly improves over pre- vious methods. 2) In practice, the ground truth of missing values is usually unknown, making it hard to fine-tune meth- ods with complex algorithms and many hyperparameters. We develop a simple and theoretically sound learning al- gorithm with a single loss and very few hyperparameters, alleviating the need for extensive fine-tuning. 3) We conduct extensive experiments over a large number of datasets and competing benchmark algorithms in multiple missing-value mechanisms and report comprehensive evaluation metrics. These experiments show that our method achieves state-of- the-art performance. 2. Background 2.1. Data with Missing Values Here we consider N data samples with D-dimensional fea- tures stored in matrix X ∈ RN ×D, where a row vector X[i, :] ∈ RD (1 ≤ i ≤ N ) represents the ith sample. The missing values contained in X are indicated by a binary mask M ∈ {0, 1}N ×D such that M [i, d] = 1 indicates that the dth feature of sample i is missing and M [i, d] = 0 otherwise. Moreover, we assign NaN (Not a Number) to the missing values and use the following Python/Numpy style matrix indexing X[M ] = NaN to denote the miss- ing data. Similarly, the observed data can be denoted as X[1 − M ], where 1N ×D is the matrix with the same di- mension as M filled with ones. The task of imputation is to fill X[M ] with the imputed values given the mask M and the observed values X[1 − M ]. In practice, three missing value patterns/mechanisms (i.e., ways of generating the mask) have been widely ex- plored (Rubin, 1976; 2004; Van Buuren, 2018; Seaman et al., 2013): missing completely at random (MCAR) where the missingness is independent of the data; missing at ran- dom (MAR) where the probability of being missing depends only on observed values; missing not at random (MNAR) where the probability of missingness then depends on the unobserved values. In MCAR and MAR, the missing value patterns are "ignorable" as it is unnecessary to model the distribution of missing values explicitly while MNAR can be a harder case where missing values may lead to important biases in data (Muzellec et al., 2020; Jarrett et al., 2022). 2.2. Optimal Transport which has been used in many problems, such as computer vision (Ge et al., 2021; Zhang et al., 2022), text analy- sis (Huynh et al., 2020; Zhao et al., 2021; Guo et al., 2022c), adversarial robustness (Bui et al., 2022), probabilistic (gener- ative) models (Vuong et al., 2023; Vo et al., 2023), and other machine learning applications (Nguyen et al., 2021; Guo et al., 2021; Nguyen et al., 2022; Guo et al., 2022a;b). Here we briefly introduce OT between two discrete distributions of dimensionality B and B′, respectively. Let α(X 1) := (cid:80)B j=1 bjδX 2[j,:], where X 1 ∈ RB×D and X 2 ∈ RB′×D denote the supports of the two distributions, respectively; a ∈ ∆B and b ∈ ∆B′ are two probability vectors; ∆B is the (B − 1)-dimensional probability simplex. The OT distance between α(X 1) and β(X 2) can be defined as: i=1 aiδX 1[i,:] and β(X 2) := (cid:80)B′ (cid:0)α(X 1), β(X 2)(cid:1) := inf dG ⟨P , G⟩, (1) P ∈U (a,b) >0 >0 P ∈ RB×B′ where ⟨*, *⟩ denotes the Frobenius dot-product; G ∈ RB×B′ is the cost matrix/function of the transport; ≥0 P ∈ RB×B′ is the transport matrix/plan; U (a, b) denotes the transport polytope of a and b, which is the polyhedral set of B × B′ matrices: U (a, b) := (cid:110) |P 1B′ = a, P T 1B = b ; and 1B is the N - dimensional column vector of ones. The cost matrix G con- tains the pairwise distance/cost between B and B′ supports, for which different distance metrics can be used. Specif- ically, if the cost is defined as the pairwise quadratic dis- tance: G[i, j] = ∥X 1[i, :] − X 2[j, :]∥2, where ∥*∥ is the Eu- clidean norm, the OT distance reduces to the p-Wasserstein (cid:0)α(X 1), β(X 2)(cid:1) = distance (p = 2 here), (cid:0)α(X 1), β(X 2)(cid:1). W 2 2 i.e., dG (cid:111) 3. Method 3.1. Previous Work: Optimal Transport for Missing Value Imputation Our method is motivated by Muzellec et al. (2020), the pio- neering method of distribution matching, recently proposed for missing value imputation. Consider two batches of data of X: X 1 and X 2 with batch size of B, both of which can contain missing values. The key insight is that a good method should impute the missing values in X 1 and X 2 so that the empirical distributions of them are matched. To do so, Muzellec et al. (2020) propose to minimise the OT distance2 between them in terms of the missing values. min X 1∪2[M 1∪2] W 2 2 (cid:0)μ(X 1), μ(X 2)(cid:1) , (2) where μ(X 1) = 1 i δX 1[i,:] denotes the empirical B measure associated to the B samples of X 1 (simi- (cid:80) Optimal transport (OT) provides sound and meaningful distances to compare distributions (Peyr ́e et al., 2019), 2The paper actually uses the Sinkhorn divergence (Genevay et al., 2018; Feydy et al., 2019), a surrogate divergence to OT. 2 Transformed Distribution Matching for Missing Value Imputation (a) Ground truth (b) OTImputer Figure 1. Two synthetic datasets (two rows) each of which is with 500 samples. (a) Ground truth: Blue points (60%) have no missing values and red points (40%) have one missing value on either coordinate (following MCAR). (b) The imputed values for the red points by OTImputer4, where the orange rectangle highlights the region of interest. larly for μ(X 2)); X 1∪2 denotes the union of X 1 and X 2, i.e., the unique data samples of the two batches; M 1∪2 denotes the union of M 1 and M 2, the mask of missing values in X 1∪2. To impute the missing values, one can take an iterative update of X 1∪2[M 1∪2] by gradient descent, e.g., RMSprop (Tiele- man et al., 2012): X 1∪2[M 1∪2] ← X 1∪2[M 1∪2] − (cid:0)μ(X 1), μ(X 2)(cid:1)(cid:1). We re- αRMSprop (cid:0)∇X 1∪2[M 1∪2]W 2 fer to this method as "OTImputer". i.e., 2 3.2. Motivations We now motivate the proposed method by giving a closer look at OTImputer. Lemma 3.1. For any given X 1 and X 2, we have: W 2 2 (cid:0)μ(X 1), μ(X 2)(cid:1) = min π 1 B B (cid:88) i=1 ∥X 1[i, :] − X 2[π(i), :]∥2, where the minimum is taken over all possible permutations π of the sequence (1, . . . , B), and π(i) is the permuted index of i with 1 ≤ π(i) ≤ B. Proof. It is a special case of Proposition 2 of Nguyen (2011). The above lemma shows that 2-Wasserstein distance be- tween two empirical distributions used in OTImputer is 4Note that Figure 1 is not directly comparable with Figure 2 in Muzellec et al. (2020) because the synthetic dataset is gener- ated differently, the missing value proportion is different, and the computation of OT is done differently. equivalent to the minimisation of a matching distance by finding the optimal permutation. In the missing value im- putation context, OTImputer finds the closest pairs of data samples in the two batches in terms of the quadratic distance in the data space (by the computation of 2-Wasserstein) and then tries the hardest to minimise their quadratic dis- tance to impute missing values (by the minimisation of 2-Wasserstein). Real-world data usually exhibit complex geometry, which can hardly be captured by the quadratic distance in the data space. Figure 1 shows the imputation results on two synthetic datasets. It can be seen that OTIm- puter incorrectly imputes a considerable amount of missing values within the orange rectangles. This is because these imputed samples have a small quadratic distance to others in the data space but they are not good imputations. Therefore, the quadratic distance in the data space is unable to reflect the data geometry. 3.3. Proposed Method In this paper, we introduce Transformed Distribution Matching (TDM), which carries out OT-based missing value imputation on a transformed space, where the distances between the transformed samples can reveal the similar- ity/dissimilarity between them better, respecting the under- lying geometry of the data. Specifically, we aim to learn a deep transformation parameterised by θ, fθ : RD′ → RD that projects a data sample x ∈ RD to a transformed one z ∈ RD′ : z := fθ(x). With a slight abuse of notation, we denote the batch-level transformation as Z = fθ(X) where fθ is applied to each sample (row vector) in X. Generalising Eq. (2), we learn fθ and the imputations by: LW (X 1, X 2), min X 1∪2[M 1∪2],θ LW (X 1, X 2) = W 2 2 (cid:0)f#μ(X 1), f#μ(X 2)(cid:1) , (3) (4) where f#μ(X) := μ(fθ(X)). If fθ is an isometry, then our TDM reduces to OTImputer (Muzellec et al., 2020). We provide more theoretical analysis of this loss in Section A of the appendix. The above optimisation is straightforward, however, simply minimising the Wasserstein loss can lead to model collaps- ing, meaning that no matter what the input sample is, fθ always transforms it into the same point in the latent space. It is easy to see that model collapsing is the trivial solution that minimises the Wasserstein distance between any two samples (or batches) (i.e., to be zero), regardless of how the missing values are imputed. To prevent model collapsing, we are inspired by the viewpoint of representation learning, where our method can be viewed to learn the latent represen- tation z from the data sample x with missing values in an unsupervised way. Representation learning based on mutual information (MI) has been shown promising in several do- mains (Oord et al., 2018; Bachman et al., 2019; Hjelm et al., 3 Transformed Distribution Matching for Missing Value Imputation (a) TDM (ours) (b) X with OOD noises (c) f1(X) (d) f1:2(X) (e) f1:3(X) Figure 2. (a) The imputed values for the red points by TDM, corresponding to the ground truth of Figure 1(a). (b) X with OOD noises (grey points). (c-e) The transformed points by different blocks of fθ. 2019; Tschannen et al., 2020), where it has been motivated by the InfoMax principle (Linsker, 1988). To avoid model collapsing, we propose to add a constraint to fθ such that it also maximises the MI I (X, fθ(X)). Thus, we define LMI(X) = −I (X, fθ(X)) , (5) and aim to learn θ by minimising both LW (X 1, X 2) and LMI(X 1) + LMI(X 2). Estimating the above MI in high-dimensional spaces has been known as a difficult task (Tschannen et al., 2020). Although several methods have been proposed to approx- imate the estimation, e.g., in Oord et al. (2018), they may inevitably add significant complexity and parameters to our method. Instead of maximising a tractable lower bound as in Oord et al. (2018); Poole et al. (2019), we propose a simpler approach that constrains fθ to be a smooth invertible map. Proposition 3.2. If fθ is a smooth invertible map, then fθ ∈ arg maxf ′ I (X, f ′(X)). Proof. By definition, we have I(X, f ′(X)) = H(X) − H(X|f ′(X)) where H(X) and H(X|f ′(X)) are the en- tropy and conditional entropy, respectively. As we consider X and f ′(X) as empirical random variables with finite supports of their samples, H(X|f ′(X)) ≥ 0. Therefore, I(X, f ′(X)) ≤ H(X) = I(X, X). If fθ is a smooth invertible map, it is known that: I(X, fθ(X)) = I(X, X) according to Eq. (45) of Kraskov et al. (2004). Therefore, I(X, fθ(X)) ≥ I(X, f ′(X)). Proposition 3.2 shows that fθ being invertible5 (i.e., fθ projects x to z and its inverse function f −1 projects z back to x) prevents model collapsing, without explicitly maximis- ing the mutual information. Accordingly, we implement fθ with invertible neural networks (INNs) (Dinh et al., 2014; θ 5One may also say that fθ is bijective or fθ is a diffeomor- phism (Papamakarios et al., 2021). 2017; Kingma & Dhariwal, 2018), which are approximators to invertible functions (Jacobsen et al., 2019; Gomez et al., 2017; Ardizzone et al., 2019; Kobyzev et al., 2020; Papa- makarios et al., 2021). Specifically, the INNs for fθ consists of a succession of T blocks, fθ = f1 ◦ f2 ◦ * * * fT , each of which is an invertible function6. Note that now we have D′ = D, meaning that the output and input dimensions are the same for fθ and every ft (1 ≤ t ≤ T ). For one block ft, whose input and output vectors are de- noted as yin ∈ RD and yout ∈ RD respectively, we imple- ment it as an affine coupling block by following Ardizzone et al. (2019), which consists of two complementary affine coupling layers (Dinh et al., 2017): yout 1:d = yin d+1:D = yin yout 1:d ⊙ exp (cid:0)g1(yin d+1:D)(cid:1) + h1(yin d+1:D ⊙ exp (cid:0)g2(yout 1:d)(cid:1) + h2(yout d+1:D), 1:d), (6) (7) 1:d, yin 1:d, yout where yin and yout are decomposed into two disjoint subsets, respectively: yin = [yin d+1:D] and yout = [yout d+1:D]; d is set to ⌊D/2⌋; ⊙ denotes the element- wise product. Moreover, g1, g2, h1 and h2 are neural net- works, each of which is implemented by a succession of fully connected layers with the SELU activation (Klambauer et al., 2017). In addition, the output of g1 and g2 is clamped by the arctan function. The implementation ensures that ft is invertible (Dinh et al., 2017) as proved in Section A.2 of the appendix. It is noticeable that our method is agnostic to the implementation of INNs and other coupling layers such as NICE (Dinh et al., 2014) and GLOW (Kingma & Dhariwal, 2018) can also be used as drop-in replacements. 3.4. When TDM Is Better? We believe that TDM outperforms OTImputer when the data exhibit complex geometry. To demonstrate this, Figure 2(a) shows the imputation of TDM on the same data shown in 6As f1, . . . , fT are invertible, so is fθ (Kobyzev et al., 2020) 4 Transformed Distribution Matching for Missing Value Imputation Figure 1, where it can be observed that the imputed values of TDM (with three blocks, i.e., T = 3) align with the data distribution significantly better than OTImputer. To demon- strate the learned transformed spaces, we feed the data with out-of-distribution (OOD) samples generated from a two- dimensional normal distribution shown in Figure 2(b) into the learned fθ of TDM with a succession of three blocks. Note that TDM is trained without these OOD noises. Fig- ures 2(c-e) show the latent space after the first (f1(X)), second (f1:2(X)), and third (final) (f1:3(X)) block, respec- tively. In the latent spaces, the in-domain samples are close to each other, and are well separated from the OOD samples. That explains why TDM does not have the false imputations as OTImputer, because the OOD samples are far away from the in-domain ones in terms of the quadratic distance in the latent spaces. This also demonstrates that TDM does not simply push all the points in the data space close to each other and model collapsing is avoided. In Figure 7 of the appendix, we show two additional synthetic datasets, whose geometry is simpler than the previous ones. In these simpler cases, one can see that OTImputer is able to correctly impute the missing values as TDM. This is because the quadratic distance in the data space used in OTImputer can capture the data geometry well. In these cases, TDM does not have to learn a complex series of transformations. Therefore, the transformed spaces of TDM look similar to the data space, i.e., is close to an isometry, which leads TDM to reduce to OTImputer. 3.5. Implementation Details As discussed before, we only need to minimise the Wasser- stein distance without explicitly maximising the mutual information, which requires fθ to be invertible, denoted as fθ ∈ F INN. Our final loss then becomes: min X 1∪2[M 1∪2],θ LW s.t. fθ ∈ F INN, (8) where θ consists of parameters of the neural networks g1, g2, h1, h2 used in every block of fθ. Computation of Wasserstein Distances The exact compu- tation of Wasserstein distances can be done by network sim- plex methods that take O(D3) (D is the feature dimension of X 1 and X 2) (Ahuja et al., 1995). Muzellec et al. (2020) uses Sinkhorn iterations (Cuturi, 2013) with the entropic regularisation to compute the 2-Wasserstein distances in O(D2 log D) (Altschuler et al., 2017; Dvurechensky et al., (cid:0)μ(X 1), μ(X 2)(cid:1) + 2018): ˆdG εr(P ), where r(P ) is the negative entropy of the transport plan and ε is set in an ad-hoc manner: 5% of the median dis- tance between initialised values in each dataset. We find that ε is critical to the imputation results and the ad-hoc setting may achieve sub-optimal performance. To avoid selecting ε, instead of Sinkhorn iterations, we use the network simplex (cid:0)μ(X 1), μ(X 2)(cid:1) := dG :Data X with missing values indicated by M Algorithm 1: TDM. Learnable parameters include miss- ing values X[M ] and parameters θ of f . input output :X with X[M ] imputed, fθ Initialise θ of f ; # Initialise missing values with noisy mean # X[M ] ← nanmean(X, dim=0) + N (0, 0.1) ; while Not converged do Sample two batches of B data samples X 1 and X 2; Feed X 1 and X 2 to fθ; for i = 1 . . . B, j = 1 . . . K do Compute G′[i, j]; # Quadratic cost function # end Compute LW ; Update the missing values X 1∪2[M 1∪2] and θ with gradient update; end method (Bonneel et al., 2011) efficiently implemented in the POT package (Flamary et al., 2021). Theoretically, the network simplex method has O(D3) complexity, however, Bonneel et al. (2011) reports it behaves in O(D2) in prac- tice. Unlike W2 used in TDM, neither ˆdG nor the Sinkhorn divergence (Genevay et al., 2018) used in Muzellec et al. (2020) is guaranteed to be a metric distance. that Computation of Gradients Recall in Eq. (1) OT/Wasserstein distances are computed by finding the op- timal transport plan P ∈ RB×B (B is the batch size in Eq. (8)). Given P , if a quadratic cost function is used, the gradient of LW in terms of fθ(X 1[i, :]) (X 1[i, :] is the ith sample of X 1) is (Cuturi & Doucet, 2014; Muzellec et al., 2020) : >0 ∂LW ∂fθ(X 1[i, :]) = B (cid:88) j=1 P [i, j] (cid:0)fθ(X 1[i, :]) − fθ(X 2[j, :])(cid:1) , with which, one can use backpropagation to update θ and the missing values in X 1[i, :]. The algorithm of our proposed method is shown in Algorithm 1. 4. Related Work As missing values are ubiquitous in many domains, missing value imputation has been an active research area (Little & Rubin, 2019; Mayer et al., 2019). Existing methods can be categorised differently from different aspects (Muzellec et al., 2020) such as the type of the missing variables (e.g., real, categorical, or mixed) the mechanisms of missing data (e.g., MCAR, MAR, or MNAR discussed in Section 2.1). In this paper, we focus on imputing real-valued missing data. Besides simple baselines such as imputation with mean/median/most-frequent values, we introduce the related 5 Transformed Distribution Matching for Missing Value Imputation Figure 3. MAE in the MCAR (top) and MAR (bottom) settings. work from the perspective of whether a method treats data features (i.e., the columns in data X ∈ RN ×D) separately or jointly, following Jarrett et al. (2022). Methods in the former category estimate the distributions of one feature conditioned on the other features and perform it- erative imputations for one feature at a time, such as in Heck- erman et al. (2000); Raghunathan et al. (2001); Gelman (2004); Van Buuren et al. (2006); Van Buuren & Groothuis- Oudshoorn (2011); Liu et al. (2014); Zhu & Raghunathan (2015). As each feature's conditional distribution may be different, these methods need to specify different models for them, which can be cumbersome in practice, especially when the missing values are unknown. In the latter category, methods learn a joint distribution of all the features explicitly or implicitly. To do so, various methods have been proposed, such as the ones based on matrix completion (Mazumder et al., 2010), (variational) autoencoders (Gondara & Wang, 2017; Ivanov et al., 2018; Mattei & Frellsen, 2019; Nazabal et al., 2020; Gong et al., 2021; Peis et al., 2022), generative adversarial nets (Yoon et al., 2018; Li et al., 2018; Yoon & Sull, 2020; Dai et al., 2021; Fang & Bao, 2022), graph neural networks (You et al., 2020; Vinas et al., 2021; Chen et al., 2022; Huang et al., 2022; Morales-Alvarez et al., 2022; Gao et al., 2023), normalising flows (Richardson et al., 2020; Ma & Ghosh, 2021; Wang et al., 2022), and Gaussian process (Dai et al., 2022). In addition to these two categories, several recent work proposes general refinements to existing imputation meth- ods. For example, Wang et al. (2021) introduces data aug- mentation methods to improve generative methods such as those in Yoon et al. (2018); Nazabal et al. (2020); Richard- son et al. (2020). Kyono et al. (2021) proposes causally- aware (Mohan et al., 2013) refinements to existing methods. Recently, Jarrett et al. (2022) proposes to automatically se- lect an imputation method among multiple ones for each feature, which shows improved results over individual meth- ods. Our method is a stand-alone approach and many of the above refinements can be applied to ours as well such as the data augmentation and causally-aware methods. Among the above works, the closest one to ours is OTIm- puter (Muzellec et al., 2020), whose differences from ours 6 CAQBBTWQPKYHSDGLPRCSACLT0.00.20.40.60.81.01.2MAETDMOTImputer (NS)OTImputer (SH)GAINMIWAEMCFlowEMFlowICEMissForestSoftImputeMIRACLECAQBBTWQPKYHSDGLPRCSACLT0.00.20.40.60.81.01.2MAETDMOTImputer (NS)OTImputer (SH)GAINMIWAEMCFlowEMFlowICEMissForestSoftImputeMIRACLE Transformed Distribution Matching for Missing Value Imputation have been comprehensively discussed. Muzellec et al. (2020) also introduces a parametric version of OTImputer trained in a round-robin fashion. The parametric algorithm does not work as well as the standard OTImputer and our method can be easily extended with the parametric algo- rithm if needed. Methods based on normalising flows, e.g., MCFlow (Richardson et al., 2020) and EMFlow (Ma & Ghosh, 2021) also use INNs for imputation. However, there are fundamental differences of TDM to them, the most sig- nificant one of which is that MCFlow and EMFlow can still be viewed as deep generative models using INNs as the encoder and decoder and their losses are still recon- struction losses or maximum likelihood in the data space, while ours uses a matching distance in the latent space as the loss. Going beyond missing value imputations, a recent work by Coeurdoux et al. (2022) proposes to learn sliced- Wasserstein distances with normalising flows, which we do not consider as a close related work to ours as the primary goal, motivation, and methodology are different. 5. Experiments 5.1. Experimental Settings Datasets Similar to many recent works (Yoon et al., 2018; Mattei & Frellsen, 2019; Muzellec et al., 2020; Jarrett et al., 2022), UCI datasets7 with different sizes are used in the experiments, the statistics of which are shown in Table 1 of the appendix. Each dataset is standardised by the scale function of sklearn8. Following Muzellec et al. (2020); Jarrett et al. (2022), we generate the missing value mask for each dataset with three mechanisms in four settings, which, to our knowledge, include all the cases used in the literature. Specifically, for MCAR, we generate the mask for each data sample by drawing from a Bernoulli random variable with a fixed parameter. For MAR, we first sample a subset of features (columns in X) that will not contain missing values and then we use a logistic model with these non-missing columns as input to determine the missing values of the remaining columns and we employ line search of the bias term to get the desired proportion of missing values. Finally, we also generate the masks with MNAR in two ways: 1) MNARL: Using a logistic model with the input masked by MCAR; 2) MNARQ: Randomly sampling missing values from the range of the lower and upper pth percentiles. For each of the four settings, we use 30% missing rate, sample 10 masks for one dataset with different random seeds (Jarrett et al., 2022), and report the mean and standard deviation (std) of the corresponding performance metric. Evaluation Metrics We evaluate the performance of a 7https://archive-beta.ics.uci.edu 8https://scikit-learn.org/stable/modules/ generated/sklearn.preprocessing.scale.html method by examining how close its imputation is to the ground-truth values, which is measured by the mean abso- lute error (MAE) and the root-mean-square error (RMSE). Following Muzellec et al. (2020), we also use the 2- Wasserstein distance, W 2 2 , between the imputed and the ground-truth distributions in the data space. Here W 2 2 is similar to the loss of OTImputer in Eq. (8) and the differ- ence is W 2 2 as a metric is computed over all the imputed and ground-truth samples9 while OTImputer minimises W 2 2 between two sampled batches. For all the three metrics, lower values indicate better performance. Although we do not assume a specific downstream task, we conduct the eval- uations of classification on the imputed data of different methods, whose settings are as follows: 1) We remove the datasets that do not have labels (e.g., parkinsons) or have binary labels (e.g., letter. In this case, the classification per- formance is almost the same regardless of how the missing values are imputed). 2) After the missing values are im- puted for a dataset, we train a support vector machine with the RBF kernel and auto kernel coefficient. We report the average accuracy of 5-fold cross-validations. 3) We report the mean and std of average accuracies in 10 runs of an imputation method with different random seeds. Settings of Our Method To minimise the loss in Eq. (8), we use RMSprop (Tieleman et al., 2012) as the optimiser with learning rate of 10−2 and batch size of 51210. Due to the simplicity of our method, there are only two main hyperparameters to set in terms of the architecture of the transformation. The first one is the number of INN blocks T . For the affine coupling layers (Dinh et al., 2017) in each transformation, we use three fully connected layers with SELU activation for each of h1, h2, g1, and g2. The size of each fully connected layer is set to K × D where D is the feature dimension of the dataset and K is the second hyper- parameter. We empirically find that T = 3 and K = 2 work well in practice and show the hyperparameter sensitivity in Appendix B. We train our method for 10,000 iterations and report the performance based on the last iteration, which is the same for all the OT-based methods. Baselines We compare our method against four lines of ten baselines. 1) Iterative imputation methods: ICE (Van Bu- uren & Groothuis-Oudshoorn, 2011) with linear/logistic models used in Muzellec et al. (2020); Jarrett et al. (2022); MissForest with random forests (Stekhoven & B ̈uhlmann, 2012). 2) Deep generative models: GAIN (Yoon et al., 2018)11 using generative adversarial networks (Goodfellow et al., 2020) where the generator outputs the imputations and the discriminator classifies the imputations in an element- 9Therefore, W 2 2 cannot be reported if the number of data points is too large. 10If the number of data samples N is less than 512, we use 2⌊N/2⌋, following Muzellec et al. (2020). 11https://github.com/jsyoon0823/GAIN 7 Transformed Distribution Matching for Missing Value Imputation Figure 4. MAE in the MNARL (top) and MNARQ (bottom) settings. wise fashion; MIWAE (Mattei & Frellsen, 2019)12 extend- ing the importance weighted autoencoders (Burda et al., 2016) for missing value imputation; MCFlow (Richardson et al., 2020)13 and EMFlow (Ma & Ghosh, 2021)14 extend- ing normalising flows for imputation. 3) Methods based on OT: OTImputer (SH), the original implementation of OTImputer (Muzellec et al., 2020)15 where OT distances are computed by Sinkhorn iterations; OTImputer (NS), the same to OTImputer (SH) except that the OT distances are computed by the network simplex methods with POT (Fla- mary et al., 2021). 4) Other methods: SoftImpute (Hastie et al., 2015) using matrix completion and low-rank SVD for imputation; MIRACLE (Kyono et al., 2021)16 introduc- 12https://github.com/pamattei/miwae 13https://github.com/trevor-richardson/ MCFlow 14https://openreview.net/attachment?id= bmGLlsX_iJl&name=supplementary_material 15https://github.com/BorisMuzellec/ MissingDataOT ing causal learning as a regulariser to refine imputations. For ICE and MissForest, we use the implementations in sklearn (Pedregosa et al., 2011)17 For SoftImpute, we use the implementation of Jarrett et al. (2022), which follows the original implementation. For the other methods, we use their original implementations (links of code listed above) with the best reported settings. 5.2. Results Now we show the MAE results18 in the four missing value settings in Figures 3 and 4. The results of RMSE and W 2 2 are shown in Figures 8 and 9 of the appendix. From these results, it can be observed that our proposed method, TDM, consistently achieves the best results in comparison with oth- ers in almost all the settings, metrics, and datasets. Specifi- cally, for OT-based methods, we can see that one may gain MIRACLE 17https://scikit-learn.org/stable/modules/ impute.html 16https://github.com/vanderschaarlab/ 18The empty results are due to the failure of running the code. 8 CAQBBTWQPKYHSDGLPRCSACLT0.00.20.40.60.81.01.2MAETDMOTImputer (NS)OTImputer (SH)GAINMIWAEMCFlowEMFlowICEMissForestSoftImputeMIRACLECAQBBTWQPKYHSDGLPRCSACLT0.00.20.40.60.81.01.2MAETDMOTImputer (NS)OTImputer (SH)GAINMIWAEMCFlowEMFlowICEMissForestSoftImputeMIRACLE Transformed Distribution Matching for Missing Value Imputation Figure 5. Classification accuracy in the MCAR setting. (a) glass (b) seeds (c) blood transfusion (d) anuran calls Figure 6. MAE over training iterations of TDM and OTImputer on four datasets in MCAR. The results are averaged over 10 runs. marginal yet consistent improvement in most cases by using the network simplex methods to compute the OT distance in the comparison between OTImputer (NS) and OTImputer (SH). With the help of the learned transformations, TDM sig- nificantly outperforms both OT methods. Note that shown in Eq. (2), OTImputer directly minimises the metric of W 2 2 between two batches in the data space. Alternatively, TDM minimises the Wasserstein distance in the transformed space. Interestingly, although TDM does not directly minimises W 2 2 in the data space, it outperforms OTImputer on W 2 2 (shown in the appendix). In the comparison with MCFlow and EMFlow that also use INNs as ours, their performance is not as good as TDM's. Figure 5 shows the classification accuracy with the imputed data by different approaches in the MCAR setting (the other settings are shown in Figure 10 of the appendix). We also report the accuracy on the ground-truth data as a reference. 9 From the results, it can be seen that TDM in general per- forms the best in the classification task, showing that good imputations do help with downstream tasks. Figure 6 shows the MAE over the training iterations of TDM and OTImputer on four datasets in the MCAR settings (the other metrics and settings are shown in Figures 17, 18, 19, and 20 of the appendix). It can be observed that TDM con- verges slightly slower than OTImputer as a function of the number of iterations, as TDM additionally learns the deep transformations. The average running time (seconds) per iteration for the two methods in the same computing environ- ment is as follows: glass: OTImputer (1.14), TDM (3.20); seeds: OTImputer (1.03), TDM (3.19); blood transfusion: OTImputer (2.39), TDM (3.35); anuran calls: OTImputer (2.33), TDM (4.06). The running time per iteration of TDM is about 2 to 3 times that of OTImputer. For larger datasets, the running time gap between the two appears to be smaller. In several datasets, e.g., glass, OTImputer exhibits overfit- ting, while TDM is more stable during training. 6. Conclusion We propose transformed distribution matching (TDM) for missing value imputation. TDM matches data samples in a transformed space, where the distance of two samples is expected to better reflect their (dis)similarity under the geometry of the data considered. The transformations are implemented with invertible neural networks to avoid model collapsing. By minimising the Wasserstein distance between the transformed samples, TDM learns the transformations and imputes the missing values simultaneously. Extensive experiments show that our method significantly improves over previous approaches, achieving state-of-the-art perfor- mance. The limitations of TDM include: 1) Due to the learning of neural networks, TDM is relatively slower than OTImputer. 2) TDM (OTImputer as well) does not work with categorical data. We leave the development of more efficient and applicable algorithms of TDM to future work. QBWQSDGLAC0.30.40.50.60.70.80.91.01.1Classification accuracyTDMOTImputer (NS)OTImputer (SH)GAINMIWAEMCFlowEMFlowICEMissForestSoftImputeMIRACLEGround-truth0200040006000800010000Iteration0.350.400.450.500.550.600.650.70MAEMethodOTImputerTDM0200040006000800010000Iteration0.20.30.40.50.60.70.8MAEMethodOTImputerTDM0200040006000800010000Iteration0.30.40.50.60.70.8MAEMethodOTImputerTDM0200040006000800010000Iteration0.30.40.50.60.70.8MAEMethodOTImputerTDM Transformed Distribution Matching for Missing Value Imputation References Ahuja, R. K., Magnanti, T. L., Orlin, J. B., and Reddy, M. Applications of network optimization. Handbooks in Operations Research and Management Science, 7:1–83, 1995. Altschuler, J., Niles-Weed, J., and Rigollet, P. Near-linear time approximation algorithms for optimal transport via sinkhorn iteration. In NeurIPS, 2017. Ardizzone, L., Kruse, J., Rother, C., and K ̈othe, U. Analyz- ing inverse problems with invertible neural networks. In ICLR, 2019. Bachman, P., Hjelm, R. D., and Buchwalter, W. Learning representations by maximizing mutual information across views. In NeurIPS, 2019. Barnard, J. and Meng, X.-L. Applications of multiple impu- tation in medical studies: from AIDS to NHANES. Sta- tistical methods in medical research, 8(1):17–36, 1999. Barthe, F. and Bordenave, C. Combinatorial Optimization Over Two Random Point Sets, pp. 483–535. Springer International Publishing, Heidelberg, 2013. Bonneel, N., Van De Panne, M., Paris, S., and Heidrich, W. Displacement interpolation using Lagrangian mass transport. In SIGGRAPH Asia, pp. 1–12, 2011. Bui, A. T., Le, T., Tran, Q. H., Zhao, H., and Phung, D. A unified Wasserstein distributional robustness framework for adversarial training. In ICLR, 2022. Burda, Y., Grosse, R. B., and Salakhutdinov, R. Importance weighted autoencoders. In ICLR, 2016. Dai, Z., Bu, Z., and Long, Q. Multiple imputation with neural network Gaussian process for high-dimensional incomplete data. In ACML, 2022. Dinh, L., Krueger, D., and Bengio, Y. NICE: Non-linear arXiv preprint independent components estimation. arXiv:1410.8516, 2014. Dinh, L., Sohl-Dickstein, J., and Bengio, S. Density estima- tion using Real NVP. In ICLR, 2017. Dvurechensky, P., Gasnikov, A., and Kroshnin, A. Com- putational optimal transport: Complexity by accelerated gradient descent is better than by Sinkhorn's algorithm. In ICML, pp. 1367–1376, 2018. Fang, F. and Bao, S. FragmGAN: Generative adversar- ial nets for fragmentary data imputation and prediction. arXiv preprint arXiv:2203.04692, 2022. Feydy, J., S ́ejourn ́e, T., Vialard, F.-X., Amari, S.-i., Trouv ́e, A., and Peyr ́e, G. Interpolating between optimal transport and MMD using Sinkhorn divergences. In AISTATS, pp. 2681–2690, 2019. Flamary, R., Courty, N., Gramfort, A., Alaya, M. Z., Bois- bunon, A., Chambon, S., Chapel, L., Corenflos, A., Fatras, K., Fournier, N., Gautheron, L., Gayraud, N. T., Janati, H., Rakotomamonjy, A., Redko, I., Rolet, A., Schutz, A., Seguy, V., Sutherland, D. J., Tavenard, R., Tong, A., and Vayer, T. POT: Python optimal transport. JMLR, 22(78): 1–8, 2021. Gao, Z., Niu, Y., Cheng, J., Tang, J., Xu, T., Zhao, P., Li, L., Tsung, F., and Li, J. Handling missing data via max- entropy regularized graph autoencoder. In AAAI, 2023. Chen, K., Liang, X., Zhang, Z., and Ma, Z. GEDI: A graph- based end-to-end data imputation framework. arXiv preprint arXiv:2208.06573, 2022. Ge, Z., Liu, S., Li, Z., Yoshie, O., and Sun, J. OTA: Optimal transport assignment for object detection. In CVPR, pp. 303–312, 2021. Coeurdoux, F., Dobigeon, N., and Chainais, P. Learning optimal transport between two empirical distributions with normalizing flows. In ECML PKDD, 2022. Gelman, A. Parameterization and Bayesian modeling. Jour- nal of the American Statistical Association, 99(466):537– 545, 2004. Cuturi, M. Sinkhorn distances: Lightspeed computation of optimal transport. In NeurIPS, 2013. Cuturi, M. and Doucet, A. Fast computation of Wasserstein barycenters. In ICML, pp. 685–693, 2014. Dai, Z., Bu, Z., and Long, Q. Multiple imputation via gener- ative adversarial network for high-dimensional blockwise In 2021 20th IEEE Interna- missing value problems. tional Conference on Machine Learning and Applications (ICMLA), pp. 791–798, 2021. Genevay, A., Peyr ́e, G., and Cuturi, M. Learning generative models with Sinkhorn divergences. In AISTATS, pp. 1608– 1617, 2018. Gomez, A. N., Ren, M., Urtasun, R., and Grosse, R. B. The reversible residual network: Backpropagation without storing activations. In NeurIPS, 2017. Gondara, L. and Wang, K. Multiple imputation us- arXiv preprint ing deep denoising autoencoders. arXiv:1705.02737, 280, 2017. 10 Transformed Distribution Matching for Missing Value Imputation Gong, Y., Hajimirsadeghi, H., He, J., Durand, T., and Mori, G. Variational selective autoencoder: Learning from partially-observed heterogeneous data. In AISTATS, pp. 2377–2385, 2021. Goodfellow, I., Pouget-Abadie, J., Mirza, M., Xu, B., Warde-Farley, D., Ozair, S., Courville, A., and Bengio, Y. Generative adversarial networks. Communications of the ACM, 63(11):139–144, 2020. Kingma, D. P. and Dhariwal, P. Glow: Generative flow with invertible 1x1 convolutions. In NeurIPS, 2018. Klambauer, G., Unterthiner, T., Mayr, A., and Hochreiter, S. Self-normalizing neural networks. NeurIPS, 30, 2017. Kobyzev, I., Prince, S. J., and Brubaker, M. A. Normalizing flows: An introduction and review of current methods. IEEE TPAMI, 43(11):3964–3979, 2020. Guo, D., Tian, L., Zhang, M., Zhou, M., and Zha, H. Learning prototype-oriented set representations for meta- learning. In ICLR, 2021. Kraskov, A., St ̈ogbauer, H., and Grassberger, P. Estimating mutual information. Physical review E, 69(6):066138, 2004. Guo, D., Li, Z., Zhao, H., Zhou, M., and Zha, H. Learning to re-weight examples with optimal transport for imbalanced classification. In NeurIPS, 2022a. Guo, D., Tian, L., Zhao, H., Zhou, M., and Zha, H. Adap- tive distribution calibration for few-shot learning with hierarchical optimal transport. In NeurIPS, 2022b. Guo, D., Zhao, H., Zheng, H., Tanwisuth, K., Chen, B., Zhou, M., et al. Representing mixtures of word em- beddings with mixtures of topic embeddings. In ICLR, 2022c. Hastie, T., Mazumder, R., Lee, J. D., and Zadeh, R. Matrix completion and low-rank SVD via fast alternating least squares. JMLR, 16(1):3367–3402, 2015. Heckerman, D., Chickering, D. M., Meek, C., Rounthwaite, R., and Kadie, C. Dependency networks for inference, collaborative filtering, and data visualization. JMLR, 1 (Oct):49–75, 2000. Hjelm, R. D., Fedorov, A., Lavoie-Marchildon, S., Grewal, K., Bachman, P., Trischler, A., and Bengio, Y. Learning deep representations by mutual information estimation and maximization. In ICLR, 2019. Huang, B., Zhu, Y., Usman, M., Zhou, X., and Chen, H. Graph neural networks for missing value classification in a task-driven metric space. TKDE, 2022. Huynh, V., Zhao, H., and Phung, D. OTLDA: A geometry- aware optimal transport approach for topic modeling. In NeurIPS, volume 33, pp. 18573–18582, 2020. Ivanov, O., Figurnov, M., and Vetrov, D. Variational autoen- coder with arbitrary conditioning. In ICLR, 2018. Kyono, T., Zhang, Y., Bellot, A., and van der Schaar, M. MIRACLE: Causally-aware imputation via learning miss- ing data mechanisms. In NeurIPS, volume 34, pp. 23806– 23817, 2021. Li, S. C.-X., Jiang, B., and Marlin, B. MisGAN: Learning from incomplete data with generative adversarial net- works. In ICLR, 2018. Linsker, R. Self-organization in a perceptual network. Com- puter, 21(3):105–117, 1988. Little, R. J. and Rubin, D. B. Statistical analysis with missing data, volume 793. John Wiley & Sons, 2019. Liu, J., Gelman, A., Hill, J., Su, Y.-S., and Kropko, J. On the stationary distribution of iterative imputations. Biometrika, 101(1):155–173, 2014. Ma, Q. and Ghosh, S. K. EMFlow: Data imputation in latent space via em and deep flow models. arXiv preprint arXiv:2106.04804, 2021. Mattei, P.-A. and Frellsen, J. MIWAE: Deep generative modelling and imputation of incomplete data sets. In ICML, pp. 4413–4423, 2019. Mayer, I., Sportisse, A., Josse, J., Tierney, N., and Vialaneix, N. R-miss-tastic: A unified platform for missing values methods and workflows. arXiv preprint arXiv:1908.04822, 2019. Mazumder, R., Hastie, T., and Tibshirani, R. Spectral regu- larization algorithms for learning large incomplete matri- ces. JMLR, 11:2287–2322, 2010. Jacobsen, J.-H., Behrmann, J., Zemel, R., and Bethge, M. Excessive invariance causes adversarial vulnerability. In ICLR, 2019. Mohan, K., Pearl, J., and Tian, J. Graphical models for In NeurIPS, volume 26, inference with missing data. 2013. Jarrett, D., Cebere, B. C., Liu, T., Curth, A., and van der Schaar, M. HyperImpute: Generalized iterative imputa- tion with automatic model selection. In ICML, pp. 9916– 9937, 2022. Morales-Alvarez, P., Gong, W., Lamb, A., Woodhead, S., Jones, S. P., Pawlowski, N., Allamanis, M., and Zhang, C. Simultaneous missing value imputation and structure learning with groups. In NeurIPS, 2022. 11 Transformed Distribution Matching for Missing Value Imputation Muzellec, B., Josse, J., Boyer, C., and Cuturi, M. Missing data imputation using optimal transport. In ICML, pp. 7130–7140, 2020. Nazabal, A., Olmos, P. M., Ghahramani, Z., and Valera, I. Handling incomplete heterogeneous data using VAEs. Pattern Recognition, 107:107501, 2020. Nguyen, T., Le, T., Zhao, H., Tran, Q. H., Nguyen, T., and Phung, D. Most: Multi-source domain adaptation via optimal transport for student-teacher learning. In UAI, pp. 225–235, 2021. Nguyen, T., Nguyen, V., Le, T., Zhao, H., Tran, Q. H., and Phung, D. Cycle class consistency with distributional optimal transport and knowledge distillation for unsuper- vised domain adaptation. In UAI, pp. 1519–1529, 2022. Nguyen, X. Wasserstein distances for discrete measures and convergence in nonparametric mixture models. arXiv preprint arXiv:1109.3250v1, 2011. Oord, A. v. d., Li, Y., and Vinyals, O. Representation learn- ing with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018. Papamakarios, G., Nalisnick, E. T., Rezende, D. J., Mo- hamed, S., and Lakshminarayanan, B. Normalizing flows for probabilistic modeling and inference. JMLR, 22(57): 1–64, 2021. Pedregosa, F., Varoquaux, G., Gramfort, A., Michel, V., Thirion, B., Grisel, O., Blondel, M., Prettenhofer, P., Weiss, R., Dubourg, V., et al. Scikit-learn: Machine learning in python. JMLR, 12:2825–2830, 2011. Peis, I., Ma, C., and Hern ́andez-Lobato, J. M. Missing data imputation and acquisition with deep hierarchical models and Hamiltonian Monte Carlo. In NeurIPS, 2022. Peyr ́e, G., Cuturi, M., et al. Computational optimal trans- port: With applications to data science. Foundations and Trends® in Machine Learning, 11(5-6):355–607, 2019. Poole, B., Ozair, S., Van Den Oord, A., Alemi, A., and Tucker, G. On variational bounds of mutual information. In ICML, pp. 5171–5180, 2019. Raghunathan, T. E., Lepkowski, J. M., Van Hoewyk, J., Solenberger, P., et al. A multivariate technique for multi- ply imputing missing values using a sequence of regres- sion models. Survey methodology, 27(1):85–96, 2001. Richardson, T. W., Wu, W., Lin, L., Xu, B., and Bernal, E. A. MCFLOW: Monte Carlo flow models for data imputation. In CVPR, pp. 14205–14214, 2020. Rubin, D. B. Inference and missing data. Biometrika, 63(3): 581–592, 1976. Rubin, D. B. Multiple imputation for nonresponse in surveys, volume 81. John Wiley & Sons, 2004. Seaman, S., Galati, J., Jackson, D., and Carlin, J. What is meant by "missing at random"? Statistical Science, 28 (2):257–268, 2013. Stekhoven, D. J. and B ̈uhlmann, P. MissForest-non- parametric missing value imputation for mixed-type data. Bioinformatics, 28(1):112–118, 2012. Tieleman, T., Hinton, G., et al. Lecture 6.5-rmsprop: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural networks for machine learning, 4 (2):26–31, 2012. Tschannen, M., Djolonga, J., Rubenstein, P. K., Gelly, S., and Lucic, M. On mutual information maximization for representation learning. In ICLR, 2020. Van Buuren, S. Flexible imputation of missing data. CRC press, 2018. Van Buuren, S. and Groothuis-Oudshoorn, K. MICE: Mul- tivariate imputation by chained equations in r. Journal of statistical software, 45:1–67, 2011. Van Buuren, S., Brand, J. P., Groothuis-Oudshoorn, C. G., and Rubin, D. B. Fully conditional specification in mul- tivariate imputation. Journal of statistical computation and simulation, 76(12):1049–1064, 2006. Vinas, R., Zheng, X., and Hayes, J. A graph-based imputa- tion method for sparse medical records. arXiv preprint arXiv:2111.09084, 2021. Vo, V., Le, T., Vuong, L.-T., Zhao, H., Bonilla, E., and Phung, D. Learning directed graphical models with opti- mal transport. arXiv preprint arXiv:2305.15927, 2023. Vuong, T.-L., Le, T., Zhao, H., Zheng, C., Harandi, M., Cai, J., and Phung, D. Vector quantized Wasserstein auto-encoder. arXiv preprint arXiv:2302.05917, 2023. Wang, S., Li, J., Miao, H., Zhang, J., Zhu, J., and Wang, J. Generative-free urban flow imputation. In CIKM, pp. 2028–2037, 2022. Wang, Y., Li, D., Xu, C., and Yang, M. Missingness aug- mentation: A general approach for improving generative imputation models. arXiv preprint arXiv:2108.02566, 2021. Yoon, J., Jordon, J., and Schaar, M. GAIN: Missing data imputation using generative adversarial nets. In ICML, pp. 5689–5698, 2018. Yoon, S. and Sull, S. GAMIN: Generative adversarial multi- ple imputation network for highly missing data. In CVPR, pp. 8456–8464, 2020. 12 Transformed Distribution Matching for Missing Value Imputation You, J., Ma, X., Ding, Y., Kochenderfer, M. J., and Leskovec, J. Handling missing data with graph represen- tation learning. In NeurIPS, volume 33, pp. 19075–19087, 2020. Zhang, C., Cai, Y., Lin, G., and Shen, C. Deepemd: Dif- ferentiable earth mover's distance for few-shot learning. TPAMI, 2022. Zhao, H., Phung, D., Huynh, V., Le, T., and Buntine, W. Neural topic model via optimal transport. In ICLR, 2021. Zhu, J. and Raghunathan, T. E. Convergence properties of a sequential regression multiple imputation algorithm. Journal of the American Statistical Association, 110(511): 1112–1124, 2015. 13 Transformed Distribution Matching for Missing Value Imputation A. Theoretical Analysis A.1. Properties In this section, we discuss the basic properties of the proposed imputation method. Essentially, the loss of TDM is an empirical estimation of EW 2 2 (f#μ(X 1), f#μ(X 2)), (9) where E denotes the expectation wrt the random mini-batches X 1 and X 2 that are sampled independently. We assume each sample in each random mini-batch is sampled independently and identically based on the uniform distribution on {1, 2, * * * , N }. Proposition A.1. EW 2 2 (f#μ(X 1), f#μ(X 2)) ≥ EW 2 2 (f#μ(X 1), f#μ(X)), where f#μ(X) := 1 N (cid:80)N i=1 δfθ(X[i,:]) is the pushforward empirical measure with respect to all observed samples in X. Proof. We first show that μ → W 2 transport plan of μ1 (resp. μ2) is P1 (resp. P2). Then, λP1 + (1 − λ)P2 is a valid transport plan from μ to ν. We have 2 (μ, ν) is convex. Consider μ = λμ1 + (1 − λ)μ2, where λ ∈ (0, 1). The optimal W 2 2 (μ, ν) := inf P ∈U (μ,ν) ⟨P , G⟩ ≤ ⟨λP1 + (1 − λ)P2, G⟩ = λ⟨P1, G⟩ + (1 − λ)⟨P2, G⟩ = λW 2 2 (μ1, ν) + (1 − λ)W 2 2 (μ2, ν). By Jensen's inequality, EW 2 2 (f#μ(X 1), f#μ(X 2)) ≥ W 2 2 (f#μ(X 1), Ef#μ(X 2)). Based on our assumption, all samples in X 2 are sampled uniformly, and therefore Ef#μ(X 2) = 1 N N (cid:88) i=1 δfθ(X[i,:]) regardless of the minibatch size B. In summary, EW 2 2 (f#μ(X 1), f#μ(X 2)) ≥ EW 2 2 (f#μ(X 1), f#μ(X)). On the LHS the operator E(*) is taken with respect to the two random batches X 1 and X 2; on the RHS E(*) is with respect to X 1. The inequality in Proposition A.1 holds for some given X (with the missing entries imputed) and fθ. As learning goes on, both sides of the inequality change with the missing entries as well as θ, while the inequality is always valid regardless of how the missing values are set. Our loss is a surrogate of EW 2 2 (f#μ(X 1), f#μ(X)). During learning, our imputation method tries to make the local distribution f#μ(X 1) to be close to the global distribution f#μ(X). Similar lower- and upper-bounds for W1 (the 1-Wasserstein distance) between empirical measures appeared in Barthe & Bordenave (2013). We also have an upper bound of EW 2 Proposition A.2. ∀μ, 2 (f#μ(X 1), f#μ(X 2)) through the triangle inequality. EW 2 2 (f#μ(X 1), f#μ(X 2)) ≤ 4EW 2 2 (f#μ(X 1), μ). (10) Proof. The 2-Wasserstein distance is a metric distance and therefore satisfies the triangle inequality. We have ∀μ, X 1, X 2, W 2 2 (f#μ(X 1), f#μ(X 2)) ≤ (cid:0)W2(f#μ(X 1), μ) + W2(f#μ(X 2), μ)(cid:1)2 . 14 Transformed Distribution Matching for Missing Value Imputation Take the expectation wrt our random sampling protocol on both sides, and by noting that X 1 and X 2 are sampled independently, we get (cid:0)f#μ(X 1), f#μ(X 2)(cid:1) EW 2 2 ≤ E (cid:0)W2(f#μ(X 1), μ) + W2(f#μ(X 2), μ)(cid:1)2 = EW 2 2 (f#μ(X 1), μ) + EW 2 2 (f#μ(X 1), μ) + 2 (cid:0)EW2(f#μ(X 1), μ)(cid:1)2 = 2EW 2 . . 2 (f#μ(X 2), μ) + 2EW2(f#μ(X 1), μ) * EW2(f#μ(X 2), μ) As (cid:0)EW2(f#μ(X 1), μ)(cid:1)2 ≤ EW 2 2 (f#μ(X 1), μ), we have EW 2 2 (cid:0)f#μ(X 1), f#μ(X 2)(cid:1) ≤ 4EW 2 2 (f#μ(X 1), μ). Proposition A.2 is valid for an arbitrary measure μ. Let μ = ̄μ := arg min μ W 2 2 (cid:0)f#μ(X 1), μ(cid:1) (11) be the Wasserstein barycentre of the random measure f#μ(X 1). Then EW 2 which bounds the loss from above. 2 (f#μ(X 1), ̄μ) is the Wasserstein variance Given X, the random distance W2 (cid:0)f#μ(X 1), ̄μ(cid:1) is bounded. We have where R := max W2(f#μ(X 1), ̄μ) is a constant depending on fθ and the dataset X. Therefore 0 ≤ W2 (cid:0)f#μ(X 1), ̄μ(cid:1) ≤ R, var (cid:0)W2 (cid:0)f#μ(X 1), ̄μ(cid:1)(cid:1) ≤ 1 4 R2, where var(*) denotes the variance. By Proposition A.2 and the Popoviciu's inequality, we have EW 2 2 (cid:0)f#μ(X 1), f#μ(X 2)(cid:1) ≤ 4 (cid:0)EW2(f#μ(X 1), ̄μ)(cid:1)2 ≤ 4 (cid:0)EW2(f#μ(X 1), ̄μ)(cid:1)2 + 2var (cid:0)W2 (cid:0)f#μ(X 1), ̄μ(cid:1)(cid:1) + 1 2 R2. Hence, the (expected) loss is bounded above by the 2-Wasserstein distance between the random measure f#μ(X 1) and its center. It is therefore a variance-like measure. Proposition A.3. Let X 1, X 2 be independent random batches of size B, X 3, X 4 be independent random batches of size 2B, then EW 2 2 (f#μ(X 3), f#μ(X 4)) ≤ EW 2 2 (f#μ(X 1), f#μ(X 2)). If B = 1, then EW 2 2 (f#μ(X 1), f#μ(X 2)) = E∥fθ(X[i, :]) − fθ(X[j, :])∥2. (12) (13) Therefore, as the batch size B increases, the loss will decrease. Eventually, when B is sufficiently large, the distance between the two measures f#μ(X 1) and f#μ(X 2) will be close to zero as they both become close to f#μ(X). To prove the above proposition, we introduce the lemma below first. Lemma A.4. Let X 1 and X 2 (resp. X 3 and X 4) be multisets of the same size B (resp. B′). (B + B′)W 2 2 (μ(X 1 ∪ X 3), μ(X 2 ∪ X 4)) ≤ BW 2 2 (μ(X 1), μ(X 2)) + B′W 2 2 (μ(X 3), μ(X 4)). (14) 15 Transformed Distribution Matching for Missing Value Imputation Proof. By Lemma 3.1, BW 2 2 (cid:0)μ(X 1), μ(X 2)(cid:1) = min π B′W 2 2 (cid:0)μ(X 3), μ(X 4)(cid:1) = min π′ B (cid:88) ∥X 1[i, :] − X 2[π(i), :]∥2, i=1 B′ (cid:88) ∥X 3[j, :] − X 4[π′(j), :]∥2, j=1 where the minimum is taken over all possible permutations of (1, * * * , B) (resp. (1, * * * , B′) ). Denote the optimal permutation as π⋆ (resp. π′⋆). Then we can construct a permutation σ⋆ of the index set (1, * * * , B, B + 1, * * * , B + B′) by permuting (1, * * * , B) wrt π⋆ and permuting (B + 1, * * * , B + B′) wrt π′⋆. Thus we have (B + B′)W 2 2 (cid:0)μ(X 1 ∪ X 3), μ(X 2 ∪ X 4)(cid:1) = min σ B+B′ (cid:88) i=1 ∥(X 1 ∪ X 3)[i, :] − (X 2 ∪ X 4)[σ(i), :]∥2 B+B′ (cid:88) i=1 ∥(X 1 ∪ X 3)[i, :] − (X 2 ∪ X 4)[σ⋆(i), :]∥2 B (cid:88) ∥X 1[i, :] − X 2[π⋆(i), :]∥2 + B′ (cid:88) i=1 ∥X 3[i, :] − X 4[π′⋆(i), :]∥2 (cid:0)μ(X 1), μ(X 2)(cid:1) + B′W 2 2 (cid:0)μ(X 3), μ(X 4)(cid:1) . ≤ = i=1 = BW 2 2 The proof of Proposition A.3 is as follows. Proof. In Lemma A.4, let B′ = B, and take expectation on both sides of the inequality, then Proposition A.3 is immediate. If B = 1, the 2-Wasserstein distance between empirical measures becomes the Euclidean distance. A.2. Invertibility Analysis We rewrite Eq. 6 and Eq. 7 as 1:d ⊙ exp (cid:0)g1(yin d+1:D)(cid:1) + h1(yin z1:d = yin zd+1:D = yin yout 1:d = z1:d, yout d+1:D = zd+1:D ⊙ exp (g2(z1:d)) + h2(z1:d), d+1:D, d+1:D), where z is a D-dimensional intermediate vector. Both the mappings yin → z and z → yout are invertible (the inverse has a simple closed form (Dinh et al., 2017) and is omitted here), and therefore yin → yout is invertible. Note that yout triangular structure. i (the i'th dimension of yout) only depends on yin 1:i. The Jacobian of the mapping yin → yout has a lower A.3. Proof of Proposition 3.2 Proof. By definition, we have I(X, f ′(X)) = H(X) − H(X|f ′(X)) where H(X) and H(X|f ′(X)) are the entropy and conditional entropy, respectively. As we consider X and f ′(X) as empirical random variables with finite supports of their samples, H(X|f ′(X)) ≥ 0. Therefore, I(X, f ′(X)) ≤ H(X) = I(X, X). If fθ is a smooth invertible map, it is known that: I(X, fθ(X)) = I(X, X) (proof shown in Eq. (45) of Kraskov et al. (2004)). Therefore, I(X, fθ(X)) ≥ I(X, f ′(X)). 16 Transformed Distribution Matching for Missing Value Imputation (a) Ground truth (b) OTImputer (c) TDM (ours) (d) f1(X) (e) f1:2(X) (f) f1:3(X) Figure 7. Two synthetic datasets (two rows) each of which is with 500 samples. (a) Ground truth: Blue points (60%) have no missing values and red points (40%) have one missing value on either coordinate (following MCAR). (b) The imputed values for the red points by OTImputer. (c) The imputed values for the red points by TDM. (d-f) The transformed points by different blocks of fθ. Table 1. Dataset statistics Dataset N D Abbreviation california 20,640 qsar biodegradation 1,055 blood transfusion wine quality parkinsons yacht hydrodynamics seeds glass planning relax concrete slump anuran calls letter 748 4,898 195 308 210 214 182 103 7,195 20,000 8 41 4 11 23 6 7 9 12 7 22 16 CA QB BT WQ PK YH SD GL PR CS AC LT B. Hyperparameter Sensitivity To test the sensitivity of TDM to the two main hyperparameters T and K, we vary them from 1 to 4 and show the imputation metrics in Figure 11, 12, 13. It can be observed that increasing T improves the performance in general but comparing T = 4 with T = 3, the improvement becomes marginal and overfitting can also be observed in a few datasets, e.g., QB and AC. In addition, one can see that varying K does not have significant impact on the performance. We also report the sensitivity of our method to different batch sizes (128, 256, 512) in the comparison with OTImputer, shown in Figure 14, 15, 16. It can be seen that larger batch sizes in general give better performance of both TDM and OTImputer. 17 Transformed Distribution Matching for Missing Value Imputation Figure 8. From top to bottom: RMSE in the MCAR, MAR, MNARL, and MNARQ settings. 18 CAQBBTWQPKYHSDGLPRCSACLT0.00.20.40.60.81.01.2RMSETDMOTImputer (NS)OTImputer (SH)GAINMIWAEMCFlowEMFlowICEMissForestSoftImputeMIRACLECAQBBTWQPKYHSDGLPRCSACLT0.00.20.40.60.81.01.2RMSETDMOTImputer (NS)OTImputer (SH)GAINMIWAEMCFlowEMFlowICEMissForestSoftImputeMIRACLECAQBBTWQPKYHSDGLPRCSACLT0.00.20.40.60.81.01.2RMSETDMOTImputer (NS)OTImputer (SH)GAINMIWAEMCFlowEMFlowICEMissForestSoftImputeMIRACLECAQBBTWQPKYHSDGLPRCSACLT0.00.20.40.60.81.01.2RMSETDMOTImputer (NS)OTImputer (SH)GAINMIWAEMCFlowEMFlowICEMissForestSoftImputeMIRACLE Transformed Distribution Matching for Missing Value Imputation Figure 9. From top to bottom: W 2 2 in the MCAR, MAR, MNARL, and MNARQ settings. 19 BTWQPKYHSDGLPRCS0.00.20.40.60.81.01.21.41.6W22TDMOTImputer (NS)OTImputer (SH)GAINMIWAEMCFlowEMFlowICEMissForestSoftImputeMIRACLEBTWQPKYHSDGLPRCS0.00.20.40.60.81.01.21.41.6W22TDMOTImputer (NS)OTImputer (SH)GAINMIWAEMCFlowEMFlowICEMissForestSoftImputeMIRACLEBTWQPKYHSDGLPRCS0.00.20.40.60.81.01.21.41.6W22TDMOTImputer (NS)OTImputer (SH)GAINMIWAEMCFlowEMFlowICEMissForestSoftImputeMIRACLEBTWQPKYHSDGLPRCS0.00.20.40.60.81.01.21.41.6W22TDMOTImputer (NS)OTImputer (SH)GAINMIWAEMCFlowEMFlowICEMissForestSoftImputeMIRACLE Transformed Distribution Matching for Missing Value Imputation Figure 10. From top to bottom: Classification accuracy in the MAR, MNARL, and MNARQ settings. 20 QBWQSDGLAC0.30.40.50.60.70.80.91.01.1Classification accuracyTDMOTImputer (NS)OTImputer (SH)GAINMIWAEMCFlowEMFlowICEMissForestSoftImputeMIRACLEGround-truthQBWQSDGLAC0.30.40.50.60.70.80.91.01.1Classification accuracyTDMOTImputer (NS)OTImputer (SH)GAINMIWAEMCFlowEMFlowICEMissForestSoftImputeMIRACLEGround-truthQBWQSDGLAC0.30.40.50.60.70.80.91.01.1Classification accuracyTDMOTImputer (NS)OTImputer (SH)GAINMIWAEMCFlowEMFlowICEMissForestSoftImputeMIRACLEGround-truth Transformed Distribution Matching for Missing Value Imputation Figure 11. From top to bottom: MAE in the MCAR, MAR, MNARL, and MNARQ settings for TDM with different T and K. 21 CAQBBTWQPKYHSDGLPRCSACLT0.00.10.20.30.40.50.60.70.8MAETDM (T=1,K=2)TDM (T=2,K=2)TDM (T=3,K=2)TDM (T=4,K=2)TDM (T=2,K=1)TDM (T=2,K=3)TDM (T=2,K=4)CAQBBTWQPKYHSDGLPRCSACLT0.00.10.20.30.40.50.60.70.8MAETDM (T=1,K=2)TDM (T=2,K=2)TDM (T=3,K=2)TDM (T=4,K=2)TDM (T=2,K=1)TDM (T=2,K=3)TDM (T=2,K=4)CAQBBTWQPKYHSDGLPRCSACLT0.00.20.40.60.8MAETDM (T=1,K=2)TDM (T=2,K=2)TDM (T=3,K=2)TDM (T=4,K=2)TDM (T=2,K=1)TDM (T=2,K=3)TDM (T=2,K=4)CAQBBTWQPKYHSDGLPRCSACLT0.00.10.20.30.40.50.60.70.8MAETDM (T=1,K=2)TDM (T=2,K=2)TDM (T=3,K=2)TDM (T=4,K=2)TDM (T=2,K=1)TDM (T=2,K=3)TDM (T=2,K=4) Transformed Distribution Matching for Missing Value Imputation Figure 12. From top to bottom: RMSE in the MCAR, MAR, MNARL, and MNARQ settings for TDM with different T and K. 22 CAQBBTWQPKYHSDGLPRCSACLT0.00.20.40.60.81.0RMSETDM (T=1,K=2)TDM (T=2,K=2)TDM (T=3,K=2)TDM (T=4,K=2)TDM (T=2,K=1)TDM (T=2,K=3)TDM (T=2,K=4)CAQBBTWQPKYHSDGLPRCSACLT0.00.20.40.60.81.0RMSETDM (T=1,K=2)TDM (T=2,K=2)TDM (T=3,K=2)TDM (T=4,K=2)TDM (T=2,K=1)TDM (T=2,K=3)TDM (T=2,K=4)CAQBBTWQPKYHSDGLPRCSACLT0.00.20.40.60.81.0RMSETDM (T=1,K=2)TDM (T=2,K=2)TDM (T=3,K=2)TDM (T=4,K=2)TDM (T=2,K=1)TDM (T=2,K=3)TDM (T=2,K=4)CAQBBTWQPKYHSDGLPRCSACLT0.00.20.40.60.81.0RMSETDM (T=1,K=2)TDM (T=2,K=2)TDM (T=3,K=2)TDM (T=4,K=2)TDM (T=2,K=1)TDM (T=2,K=3)TDM (T=2,K=4) Transformed Distribution Matching for Missing Value Imputation Figure 13. From top to bottom: W 2 2 in the MCAR, MAR, MNARL, and MNARQ settings for TDM with different T and K. 23 BTWQPKYHSDGLPRCS0.00.20.40.60.81.0W22TDM (T=1,K=2)TDM (T=2,K=2)TDM (T=3,K=2)TDM (T=4,K=2)TDM (T=2,K=1)TDM (T=2,K=3)TDM (T=2,K=4)BTWQPKYHSDGLPRCS0.00.20.40.60.81.0W22TDM (T=1,K=2)TDM (T=2,K=2)TDM (T=3,K=2)TDM (T=4,K=2)TDM (T=2,K=1)TDM (T=2,K=3)TDM (T=2,K=4)BTWQPKYHSDGLPRCS0.00.10.20.30.40.50.60.70.8W22TDM (T=1,K=2)TDM (T=2,K=2)TDM (T=3,K=2)TDM (T=4,K=2)TDM (T=2,K=1)TDM (T=2,K=3)TDM (T=2,K=4)BTWQPKYHSDGLPRCS0.00.20.40.60.81.01.2W22TDM (T=1,K=2)TDM (T=2,K=2)TDM (T=3,K=2)TDM (T=4,K=2)TDM (T=2,K=1)TDM (T=2,K=3)TDM (T=2,K=4) Transformed Distribution Matching for Missing Value Imputation Figure 14. From top to bottom: MAE of TDM and OTImputer with batch size varied in MCAR, MAR, MNARL, and MNARQ. 24 CAQBBTWQPKYHSDGLPRCSACLT0.00.20.40.60.8MAETDM (128)OTImputer (128)TDM (256)OTImputer (256)TDM (512)OTImputer (512)CAQBBTWQPKYHSDGLPRCSACLT0.00.10.20.30.40.50.60.70.8MAETDM (128)OTImputer (128)TDM (256)OTImputer (256)TDM (512)OTImputer (512)CAQBBTWQPKYHSDGLPRCSACLT0.00.20.40.60.8MAETDM (128)OTImputer (128)TDM (256)OTImputer (256)TDM (512)OTImputer (512)CAQBBTWQPKYHSDGLPRCSACLT0.00.20.40.60.8MAETDM (128)OTImputer (128)TDM (256)OTImputer (256)TDM (512)OTImputer (512) Transformed Distribution Matching for Missing Value Imputation Figure 15. From top to bottom: RMSE of TDM and OTImputer with batch size varied in MCAR , MAR, MNARL, and MNARQ. 25 CAQBBTWQPKYHSDGLPRCSACLT0.00.20.40.60.81.0RMSETDM (128)OTImputer (128)TDM (256)OTImputer (256)TDM (512)OTImputer (512)CAQBBTWQPKYHSDGLPRCSACLT0.00.20.40.60.81.01.2RMSETDM (128)OTImputer (128)TDM (256)OTImputer (256)TDM (512)OTImputer (512)CAQBBTWQPKYHSDGLPRCSACLT0.00.20.40.60.81.01.2RMSETDM (128)OTImputer (128)TDM (256)OTImputer (256)TDM (512)OTImputer (512)CAQBBTWQPKYHSDGLPRCSACLT0.00.20.40.60.81.01.2RMSETDM (128)OTImputer (128)TDM (256)OTImputer (256)TDM (512)OTImputer (512) Transformed Distribution Matching for Missing Value Imputation Figure 16. From top to bottom: W 2 2 of TDM and OTImputer with batch size varied in MCAR , MAR, MNARL, and MNARQ. 26 BTWQPKYHSDGLPRCS0.00.20.40.60.81.01.2W22TDM (128)OTImputer (128)TDM (256)OTImputer (256)TDM (512)OTImputer (512)BTWQPKYHSDGLPRCS0.00.20.40.60.81.01.2W22TDM (128)OTImputer (128)TDM (256)OTImputer (256)TDM (512)OTImputer (512)BTWQPKYHSDGLPRCS0.00.20.40.60.81.01.21.41.6W22TDM (128)OTImputer (128)TDM (256)OTImputer (256)TDM (512)OTImputer (512)BTWQPKYHSDGLPRCS0.00.20.40.60.81.01.21.41.6W22TDM (128)OTImputer (128)TDM (256)OTImputer (256)TDM (512)OTImputer (512) Transformed Distribution Matching for Missing Value Imputation Figure 17. MAE and RMSE over training iterations of TDM and OTImputer on four datasets (from left to right: glass, seeds, blood transfusion, anuran calls) in MCAR. Figure 18. MAE and RMSE over training iterations of TDM and OTImputer on four datasets (from left to right: glass, seeds, blood transfusion, anuran calls) in MAR. Figure 19. MAE and RMSE over training iterations of TDM and OTImputer on four datasets (from left to right: glass, seeds, blood transfusion, anuran calls) in MNARL. 27 0200040006000800010000Iteration0.350.400.450.500.550.600.650.70MAEMethodOTImputerTDM0200040006000800010000Iteration0.20.30.40.50.60.70.8MAEMethodOTImputerTDM0200040006000800010000Iteration0.350.400.450.500.550.600.650.700.75MAEMethodOTImputerTDM0200040006000800010000Iteration0.30.40.50.60.70.8MAEMethodOTImputerTDM0200040006000800010000Iteration0.700.750.800.850.900.951.001.05RMSEMethodOTImputerTDM0200040006000800010000Iteration0.40.50.60.70.80.91.0RMSEMethodOTImputerTDM0200040006000800010000Iteration0.650.700.750.800.850.900.951.00RMSEMethodOTImputerTDM0200040006000800010000Iteration0.40.50.60.70.80.91.0RMSEMethodOTImputerTDM0200040006000800010000Iteration0.40.50.60.7MAEMethodOTImputerTDM0200040006000800010000Iteration0.20.40.60.81.0MAEMethodOTImputerTDM0200040006000800010000Iteration0.30.40.50.60.70.8MAEMethodOTImputerTDM0200040006000800010000Iteration0.30.40.50.60.70.8MAEMethodOTImputerTDM0200040006000800010000Iteration0.70.80.91.01.1RMSEMethodOTImputerTDM0200040006000800010000Iteration0.40.60.81.0RMSEMethodOTImputerTDM0200040006000800010000Iteration0.60.70.80.91.01.1RMSEMethodOTImputerTDM0200040006000800010000Iteration0.40.50.60.70.80.91.0RMSEMethodOTImputerTDM0200040006000800010000Iteration0.350.400.450.500.550.600.650.70MAEMethodOTImputerTDM0200040006000800010000Iteration0.20.30.40.50.60.70.80.9MAEMethodOTImputerTDM0200040006000800010000Iteration0.40.50.60.70.8MAEMethodOTImputerTDM0200040006000800010000Iteration0.30.40.50.60.70.8MAEMethodOTImputerTDM0200040006000800010000Iteration0.700.750.800.850.900.951.001.05RMSEMethodOTImputerTDM0200040006000800010000Iteration0.40.50.60.70.80.91.01.1RMSEMethodOTImputerTDM0200040006000800010000Iteration0.80.91.01.11.2RMSEMethodOTImputerTDM0200040006000800010000Iteration0.50.60.70.80.91.0RMSEMethodOTImputerTDM Transformed Distribution Matching for Missing Value Imputation Figure 20. MAE and RMSE over training iterations of TDM and OTImputer on four datasets (from left to right: glass, seeds, blood transfusion, anuran calls) in MNARQ. 28 0200040006000800010000Iteration0.350.400.450.500.550.600.650.70MAEMethodOTImputerTDM0200040006000800010000Iteration0.20.30.40.50.60.70.8MAEMethodOTImputerTDM0200040006000800010000Iteration0.350.400.450.500.550.600.650.700.75MAEMethodOTImputerTDM0200040006000800010000Iteration0.30.40.50.60.70.8MAEMethodOTImputerTDM0200040006000800010000Iteration0.650.700.750.800.850.900.951.001.05RMSEMethodOTImputerTDM0200040006000800010000Iteration0.40.50.60.70.80.91.0RMSEMethodOTImputerTDM0200040006000800010000Iteration0.650.700.750.800.850.900.951.001.05RMSEMethodOTImputerTDM0200040006000800010000Iteration0.40.50.60.70.80.91.0RMSEMethodOTImputerTDM
http://arxiv.org/abs/2302.10362v1
2023-02-20T23:41:14
2023-02-20T23:41:14
Heterogeneous Social Event Detection via Hyperbolic Graph Representations
Social events reflect the dynamics of society and, here, natural disasters and emergencies receive significant attention. The timely detection of these events can provide organisations and individuals with valuable information to reduce or avoid losses. However, due to the complex heterogeneities of the content and structure of social media, existing models can only learn limited information; large amounts of semantic and structural information are ignored. In addition, due to high labour costs, it is rare for social media datasets to include high-quality labels, which also makes it challenging for models to learn information from social media. In this study, we propose two hyperbolic graph representation-based methods for detecting social events from heterogeneous social media environments. For cases where a dataset has labels, we designed a Hyperbolic Social Event Detection (HSED) model that converts complex social information into a unified social message graph. This model addresses the heterogeneity of social media, and, with this graph, the information in social media can be used to capture structural information based on the properties of hyperbolic space. For cases where the dataset is unlabelled, we designed an Unsupervised Hyperbolic Social Event Detection (UHSED). This model is based on the HSED model but includes graph contrastive learning to make it work in unlabelled scenarios. Extensive experiments demonstrate the superiority of the proposed approaches.
[ "Zitai Qiu", "Jia Wu", "Jian Yang", "Xing Su", "Charu C. Aggarwal" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10362v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10362v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.SI", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.SI", "cs.LG" ]
3 2 0 2 b e F 0 2 ] I S . s c [ 1 v 2 6 3 0 1 . 2 0 3 2 : v i X r a JOURNAL OF LATEX CLASS FILES, VOL. 14, NO. 8, AUGUST 2015 1 Heterogeneous Social Event Detection via Hyperbolic Graph Representations Zitai Qiu, Jia Wu, Senior Member, IEEE, Jian Yang, Xing Su, Charu C. Aggarwal, Fellow, IEEE Abstract-Social events reflect the dynamics of society and, here, natural disasters and emergencies receive significant attention. The timely detection of these events can provide organisations and individuals with valuable information to reduce or avoid losses. However, due to the complex heterogeneities of the content and structure of social media, existing models can only learn limited information; large amounts of semantic and structural information are ignored. In addition, due to high labour costs, it is rare for social media datasets to include high-quality labels, which also makes it challenging for models to learn information from social media. In this study, we propose two hyperbolic graph representation-based methods for detecting social events from heterogeneous social media environments. For cases where a dataset has labels, we designed a Hyperbolic Social Event Detection (HSED) model that converts complex social information into a unified social message graph. This model addresses the heterogeneity of social media, and, with this graph, the information in social media can be used to capture structural information based on the properties of hyperbolic space. For cases where the dataset is unlabelled, we designed an Unsupervised Hyperbolic Social Event Detection (UHSED). This model is based on the HSED model but includes graph contrastive learning to make it work in unlabelled scenarios. Extensive experiments demonstrate the superiority of the proposed approaches. Index Terms-Social Event Detection, Graph Neural Networks, Hyperbolic Space, Contrastive Learning (cid:70) 1 Introduction E VEN are happenings in a community. They can be innocu- ous, such as a fair or town meeting, or they can have a significant harmful impact, such as a natural disaster or state of emergency [1]. Detecting these events of harmful impact is crucial because early detection can help organisations and individuals make timely responses to avoid danger and loss [2], [3]. The rapid development of social media has gradually replaced traditional TV and newspapers as a tool for people to obtain information about events. The data shows that, by February 2021, Facebook and Twitter had exceeded 2.8 billion monthly active users, and total active users in these social networks exceeded 390 million across more than 200 different countries [4]. Hence, many are defining events posted on social media, such as Facebook or Twitter, as social events [5]. And, for this reason, researchers have gradually shifted the focus of event detection to social event detection [6], [7], [8], [9]. The key idea of social event detection is text classification or clustering – that is, extracting relevant information from social media to represent a specific event [2], [5]. However, compared to detection with traditional news, there are several challenges in social event detection shown as follow [4], [7], [8], [10]: 1) The text describing social events are often short texts, not written by people, that frequently contain abbreviations, misspellings, and emojis. 2) Messages on social media include a large amount of heterogeneous content: users, times, places, entities, and so on. 3) The spread of social events is mainly caused by user mentions and retweets, which leads to the hierarchical and heterogeneous nature of social networks. 4) Social media data is generated continuously and dynamically, which is more difficult to analyse and use than offline datasets. • Z. Qiu, J. Wu, J. Yang and Xing Su are with the School of Computing, Macquarie University, Sydney, NSW 2109, Australia. E-mail: {zitai.qiu@students., jia.wu, jian.yang, xing.su2@hdr.}mq.edu.au • C. Aggarwal is with IBM T. J. Watson Research Center, New York, USA. E-mail: [email protected]. Manuscript received April 19, 2005; revised August 26, 2015. Fig. 1: Within a tree-like structure data, the distance between node A and node B is difficult to calculate in Euclidean space, but the distance between node A(cid:48) and node B(cid:48) is easy to calculate. Here, A(cid:48) and B(cid:48) are the projections of nodes A and B on hyperbolic space. Traditional social event detection techniques like LDA [11] mainly address the first challenge of social media. Generally, they use statistical methods to calculate the co-occurrence of words relating to a topic in short pieces of text [5]. However, word co-occurrence in short texts tends to be very sparse, which has hindered the ongoing development of topic detection models. Inspired by human understanding of short texts, Li and others [12] proposed a GPU-DMM model. GPU-DMM includes a pre-trained Word2Vec [13] model that provides semantic back- ground information, which enhances the model's performance. However, although traditional social event detection technology has achieved good results, it can be difficult for the models to capture word co-occurrence information because short texts do not include many words. Hence, in general, traditional models only focus on the semantic information of the message; they ignore the relevance of semantic and structural information discussed in 2) and 3). JOURNAL OF LATEX CLASS FILES, VOL. 14, NO. 8, AUGUST 2015 2 The key idea for addressing challenges 2) and 3) – het- erogeneity in content and structure – is how to learn helpful information from heterogeneous social media environments. We can model social media as a heterogeneous information network (HIN) [14], [15], [16]. Compared with homogeneous information networks, HIN contains multiple types of nodes and edges, which can integrate more information. However, due to heterogeneous complex content and structure of information networks, researchers cannot directly use them in traditional models. This is not only because of the need to incorporate het- erogeneous structural (graph) information consisting of multi- ple nodes and edges but also because of the need to consider the heterogeneous attributes or content associated with each node. To address challenges 2) and 3), PP-GCN [17] focuses on the heterogeneity of social media. It uses meta-path [18] to express the knowledge in heterogeneous information networks composed of social media. This better helps the model to learn the semantic and structural information in the network. Fur- thermore, to address challenge 4) – the dynamic nature of social media data – one state-of-the-art model, KPGNN [2], addresses all the challenges faced in social event detection. However, the focus of this model is on how the model can be applied to a constantly changing social media stream. Its ability to learn from heterogeneous information networks is not significantly improved compared to previous models. It still only learns limited social media information, ignoring rich semantic and structural information. Therefore, we believe that the premise of solving challenge 4) is to learn more helpful information from the heterogeneous social media environments. This will require overcoming the shortfalls of existing models, particularly since they can only learn small amounts of knowledge from social media. Meta-paths are currently the most common technique for researchers to learn information from heterogeneous informa- tion networks. Of the currently available methods, very classic models such as HAN [19] and MAGNN [20] have achieved competitive performance. However, the fatal disadvantage of meta-paths is that experienced personnel are required to design them [21]. For datasets with large amounts of data, artificially creating meta-paths is very time-consuming and challenging. Moreover, experiments [22] have shown that the meta-path method may have no practical effect, and it is not as good as the GCN [23] or GAT [24] for modelling isomorphic networks, assuming the appropriate parameter settings are being used. Additionally, because of the vast amounts of social media data – i.e., graphs with tens of thousands of points and complex relationships – it would be incredibly challenging and time- consuming to design meta-paths manually. Based on these shortcomings, we do not find the meta-path approach to be suitable for heterogeneous social media networks. As such, learning more information from heterogeneous information networks without using meta-paths remains a challenge. It is worth noting that all the social event detection models mentioned above ignore a very critical factor: the data structure of a large-scale social network. The data generated by social media is tree-like or hierarchical in structure [25]. The most significant characteristic of data with this type of structure is that it grows exponentially. However, due to the polynomial growth of Euclidean space, existing models for mapping social media data to Euclidean space do not express or capture tree- like structures well [26], [27]. As shown in Fig. 1, in Euclidean space, when the tree-like structure data gradually increases, the distance between the leaves becomes very close, which means that machine learning models cannot distinguish nodes at the leaf position. Inspired by geometric graph mining in hyperbolic space in recent years, we argue that because hyperbolic space also has an exponential growth property, it is more capable of capturing social media data than Euclidean space. However, the only existing hyperbolic space models are based on homo- geneous information networks. A hyperbolic space model needs to be created for heterogeneous information networks. To tackle the above challenges, we propose a social event detection model based on hyperbolic space representation. We call it Hyperbolic Social Event Detection (HSED). HSED incorporates Word2Vec to unify complex social information components into a homogeneous message graph to solve chal- lenges 1) and 2) while also further promoting the use of information. To solve challenge 3) and better express the structural information of the social media, HSED projects the homogeneous message graph generated in the previous step onto hyperbolic space. However, as mentioned, it can be very costly to label data. Hence, we also developed a variant of HSED called Unsupervised Hyperbolic Social Event Detection (UHSED), which includes graph contrastive learning. Thus, between the two models, our approach can be applied to multiple scenarios. The key contributions of this study are as follows: • This approach is the first to apply hyperbolic space to social event detection as a better way of representing social media data than Euclidean space. • • We designed a supervised model called HSED that con- verts heterogeneous social information into a homoge- neous message graph and employs hyperbolic space as a way to leverage social media data. For cases where the social media data is unlabelled, we designed an unsupervised model called UHSED, which is based on graph contrastive learning. Between these two models, our approach works with most social media datasets. Experiments demonstrate the competitive performance of our models and the superiority of hyperbolic space for tree-structured data. • 2 Related Work 2.1 Topic Detection-based Social Event Detection Models Today, social networks are ubiquitous. Social networks are a type of information network containing a great deal of rich content and a multitude of relationships, commonly modelled as a heterogeneous information network (HIN) [28]. However, most existing models for social event detection are based on homogeneous information networks [14], i.e., networks that only contain nodes and edges of the same type. These mod- els ignore the heterogeneity of nodes and edges [28], which can easily cause severe data loss. Therefore, more and more researchers in social event detection are focussing on learning from heterogeneous information networks where semantic and structural information can be captured in addition to counting the number of co-occurring words. Topic detection-based models and HIN-based social event detection models are the main offline social event detection JOURNAL OF LATEX CLASS FILES, VOL. 14, NO. 8, AUGUST 2015 models [4], [5]. Social media detection models based on topic detection, like LDA [11], focus on analysing short texts. Here, the topics in short pieces of text are captured by calculating the number of co-occurring words via mathematical statistics. How- ever, this method has a limitation in that word co-occurrence in short pieces of text can be very sparse. And, when there are not enough co-occurring words, it seriously affects the model's performance [5]. Therefore, inspired by the idea that people reading prose understand more than just the words given but also the meaning behind the words [5], i.e., the semantic information, researchers have turned to semantics to extract more knowledge from these brief parcels of data. Among the topic detection models, Word2Vec [13] is com- monly used to find semantically similar topic words in short texts through word vectors. For example, GPU-DMM [12] applies Word2Vec based on LDA and DMM [29] to provide the model with background information on word semantics, which improves the model's performance. However, although Word2Vec does provide some background information to the model, there is still too little keyword information in short text to be able to improve the model's performance. Additional helpful information needs to be learned from more aspects of the data. For example, SGNS [30] starts with the relationship between words. It learns the relationship between words, cap- tures the semantic relationship of the context of words, and, in so doing, makes up for the problem of keyword sparsity in short texts. However, topic detection models always ignore heterogeneity in social media networks and, hence, they ignore a great deal of semantic and structural information. Fig. 2: An illustrative example of a heterogeneous message graph: (a) A social message network containing three types of notes (e.g., user, message, and words) and four types of links (e.g., post, contain, mention, retweet). (b) The network schema of a social message network. (c) An example of a meta-path in a social message network. (d) An example of a meta-structure. 2.2 Heterogeneous Information Networks-based Social Event Detection Models In the social event detection models based on heterogeneous information networks, researchers model social messages as a heterogeneous information network. The most popular method of modelling is the meta-path [18]. Through these constructs, the models capture both semantic and structural information simultaneously, as shown in Fig. 2, resulting in data we call structural-semantic information. However, these meta-paths must be designed by experts. The limitation of the meta-path is that it sometimes cannot find the same points in different meta-paths [31]. Therefore, the meta-structure [31] can contain more information based on the meta-path, as shown in Fig. 2(d). The social event detection model PP-GCN [17] includes 3 a meta-schema based on meta-structure, which describes the semantic associations between social events. PP-GCN also in- corporates knowledge-based meta-paths where the similarity between different meta-paths is calculated to distinguish be- tween different events in the network. However, both the meta- paths and the meta-structures are artificially set, and with a substantial amount of data, the candidate meta-paths grow exponentially [31]. Consequently, artificially designing accurate and meaningful meta-paths and meta-structures for large-scale datasets is very difficult and time-consuming. Fig. 3: An example of tree-like structure data. (a) An example of tree-structured data expanding exponentially in Euclidean space. (b) Comparison of the distance between two nodes in hyperbolic space (blue) and Euclidean space (black). Notably, meta-paths and meta-structures capture a kind of structure-based semantic information, local information. The social network data is tree-structured [32], as shown in Fig. 3(a). Models using meta-paths or meta-structures may not capture the relationship between root and leaf. In addition, existing models embed nodes onto Euclidean space to capture features. When the data grows faster than the Euclidean space can expand to, the leaf parts of the tree structure will become very close, and the distance between them is infinitely based on zero. This makes it difficult for the model to distinguish the difference between them, as shown in Fig. 3(b). In general, existing social event detection models cannot make good use of the distances between structures in heterogeneous social information networks due to the above limitation of Euclidean space. 2.3 Hyperbolic Representation Learning Currently, most machine learning models choose Euclidean space as the main space for embedding learning due to its convenient distance computation and vector structure [32]. Although Euclidean spatial embeddings have been successful, most real-world graphs, such as social networks, exhibit tree- like structures [33]. Recent studies have shown that the Eu- clidean space with polynomial growth is not good at providing meaningful geometric representation for tree-structured data and that it can lead to significant distortions after embedding [34], [35]. Unlike Euclidean space, growth in hyperbolic space is exponential, just like growth with tree-structured data. Thus, hyperbolic space should be able to provide a more power- ful geometric representation of tree-structured data and, in so doing, reduce the distortion after embedding [32], [36]. However, there are no basic statistical algorithms, like vector addition and matrix multiplication, for hyperbolic space [32], UserMessageWordsPostContainMentionRetweet(a) An example of social message-based HIN(c) Network schema(d) Meta-structure(b) Meta-path(a)Tree-like structure data in Euclidean space(b) Distance in Euclidean space and hyperbolic space0.71.32.70.360.20.1Euclidean distanceHyperbolic distance JOURNAL OF LATEX CLASS FILES, VOL. 14, NO. 8, AUGUST 2015 [33]. Therefore, many machine learning algorithms, such as MLP and RNN, cannot be used in hyperbolic space. There are, however, some exceptions. HNN [32], for ex- ample, uses a simple neural network, such as an MLP or an RNN, with hyperbolic space. However, this framework only considers graph structures; it ignores the rich node features. Therefore, on the basis of HNN, HGCN [35] applied a more complex GCN model to hyperbolic space. Its main contribution is how to aggregate neighbour information in hyperbolic space. Combining the advantages of the above hyperbolic space mod- els, we can see that hyperbolic space can capture the distance information between nodes better than Euclidean space. How- ever, all these models only work with homogeneous information networks. This leads to our inability to directly apply them to heterogeneous social media. As mentioned above, hyperbolic space is a non-vector space. Although there are many methods for learning heterogeneous information network representation in Euclidean space, these methods cannot be directly used on hyperbolic space due to the problem of vector calculation. We need to redesign methods for learning representations of heterogeneous information networks in hyperbolic spaces to address the above challenges, but this is still an open problem. 2.4 Graph Contrastive Learning Graph Contrastive Learning (GCL) is currently the most popular technique for unsupervised representation learning. DGI [37] employs Deep Infomax [38] for graph learning and helps the model to learn by maximising the mutual information between the local structures and the global contexts as a pre-task. Based on DGI, GCC [39] compares different sub-graphs extracted from the original graph. GCC mainly learns by maximising the mutual information between sub-graphs as a pre-task. Unlike GCC, GraphCL [40] forms a graph as a negative sample through graph data enhancement, which compares the original and enhanced graphs to maximise the mutual information between them. 3 Preliminaries Our two models aim to capture the distances between nodes in tree-like social media data. To this end, the models embed features into hyperbolic space, which is a better way of repre- senting this type of data. To better understand our methods, Section 3.1 introduces some preliminary concepts associated with heterogeneous information networks; Section 3.2 deals with hyperbolic space; and Section 3.3 deals with hyperbolic graph representations. 3.1 Heterogeneous Information Network We defined a graph G = (V, E) as an information network. V denotes a set of nodes and E denotes a set of edges. Given a set of node types Tv and a set of edge types TE. When |Tv | > 1 or |TE | > 1, the information network is heterogeneous; otherwise, it is a homogeneous. Most machine-learning models embed features into Eu- clidean space to capture the information from the informa- tion network; however, as mentioned, Euclidean space cannot represent tree-like structure data well. Thus, in this study, we have selected hyperbolic space as the embedding space. The following sections outline the details of hyperbolic space. 4 3.2 Models of Hyperbolic Space In the past, researchers have proposed different models of hyperbolic space based on different usage scenarios, like the Poincaré ball model (cid:80), the Interior of the disk model (cid:73), the Hyperboloid model (cid:72) and the Jemisphere model (cid:74) [27]. This thesis mainly focuses on the Poincaré ball and the hyperboloid models based on their properties for this study. 3.2.1 The Poincaré Ball Model The Poincaré ball model can be adjusted via gradient-based optimisation [41]. (cid:80)d,K denotes the Poincaré ball model with a constant negative curvature of −K (K > 0) in d-dimensions: (cid:80)d,K := {x ∈ (cid:82)d : K (cid:107)x(cid:107)2 < 1}. (1) Given two nodes a, b in the Poincare ball model (cid:80)d,K , the induced distance between them can be calculated as: (cid:80) (a, b) = d K 1 ar cosh (cid:128) 1 + 2(cid:107)a−b(cid:107)2 (1−(cid:107)a(cid:107)2)(1−(cid:107)b(cid:107)2) (cid:138) , (2) where K = 1, (cid:107) * (cid:107) means the Euclidean norm and ar cosh(*) means the arc cosine function in hyperbolic space. 3.2.2 The Hyperboloid Model The properties of the hyperboloid model are simplicity and numerical stability [42]. The hyperboloid model is also called the Minkowski model because it can be defined by Minkowski's inner product [35], expressed as follow: 〈., .〉 M : (cid:82)d+1 × (cid:82)d+1 → (cid:82), 〈x, y〉 M := −x0 y0 + x1 y1 + . . . + xn yn. (3) (4) (cid:72)d,K denotes as the hyperboloid model with a constant negative curvature of −/K (K > 0) in d-dimensions: (cid:72)d,K := {x ∈ (cid:82)d+1 : 〈x, x〉 M = −K , x0 > 0}. (5) Given two nodes a, b in the hyperboloid model (cid:72)d,K , the induced distance between them can be calculated as: (cid:72) (a, b) = (cid:112) d K K * ar cosh(−〈a, b〉 M /K ). (6) 3.3 Hyperbolic Graph Representations The challenge in adopting a graph representation learning method for hyperbolic space is that hyperbolic space is not vector space [43]. Specifically, the vector processing procedure of graph representation learning models in Euclidean space does not work in hyperbolic space. The solution to leveraging these models is to map the embeddings from hyperbolic space to Euclidean space. We can transform embeddings from Euclidean space to hyperbolic space via an exponential map. We also can transform embeddings from hyperbolic space to Euclidean space via a logarithmic map. Note that the mapping between these hyperbolic and Euclidean spaces is bijective [35], which means that, for an infinite tangent space, there is a one-to-one corresponding point on the hyperbolic space. Here, we explain this mapping mechanism for our two models. JOURNAL OF LATEX CLASS FILES, VOL. 14, NO. 8, AUGUST 2015 5 3.3.1 The Poincaré Ball Model Representations To o: (cid:80)d,K denotes the Euclidean (tangent) space centred at point Let a ∈ (cid:80)d,K and a(cid:48) ∈ To (cid:80)d,K . The mapping from Eu- (cid:80)d,K → (cid:80)d,K , clidean space to hyperbolic space ex pK : To o and the mapping from hyperbolic space to Eudlicean space log K (cid:80)d,K . Thus we have: o : (cid:80)d,K → Tx ex pK o (a(cid:48)) = t anh((cid:112) K (cid:107)a(cid:48)(cid:107)) (cid:112) log K o (a) = ar t anh((cid:112) K (cid:107)a(cid:107)) (cid:112) log K o (ex pK o (a(cid:48))) = a(cid:48) . a(cid:48) K (cid:107)a(cid:48)(cid:107) a K (cid:107)a(cid:107) , , (7) (8) (9) 3.3.2 The Hyperboloid Model Representations To o: (cid:72)d,K denotes the tangent (Euclidean) space centred at point For x, y ∈ (cid:72)d,K and v ∈ To (cid:72)d,K , where v (cid:54)= 0 and x (cid:54)= y, we have: ex pK o (v) = cosh (cid:139) (cid:129) (cid:107)v(cid:107) (cid:112) K x + (cid:112) K * sinh (cid:129) (cid:107)v(cid:107) (cid:112) K (cid:139) v (cid:107)v(cid:107) , l og K o ( y) = d K (cid:72) (x, y) y + 1 K (cid:107) y + 1 K 〈x, y〉 〈x, y〉 M x M x(cid:107) . (10) (11) Therefore, based on the above transformation, the existing models in Euclidean space can be used to handle tasks in hyperbolic space. 4 Methodology 4.1 HSED: A Supervised Model for Social Event Detection 4.1.1 Overview Fig. 4: The framework of the HSED model. "HMG" denotes a homogeneous message graph. "H" denotes hyperbolic em- beddings after the hyperbolic encoder. "Z" denotes the final representations. Motivated by recent advancements in hyperbolic graph rep- resentation learning, we propose Hyperbolic Social Event De- tection (HSED) for heterogeneous social media environments. The framework of our proposed model, shown in Fig. 4, consists of three main components: 1) Data processing, which constructs a homogeneous information network G from the raw data while pre- serving the semantic and structural information. 2) Hyperbolic MLP encoder, which embeds G into hy- perbolic space to produce the feature embedding set H . Linear decoder, which transfers H from hyperbolic space to Euclidean space through a log mapping func- tion (Eq.8 or Eq.11) to support downstream tasks. Here, the downstream task is node classification. 3) 4.1.2 Data Processing Researchers cannot feed initial social media data directly into machine learning models. Therefore, the raw data needs to be processed to satisfy the conditions of the model. This is given that most hyperbolic graph representation learning models are based on homogeneous information networks. The challenge with data processing is transforming heterogeneous social networks into homogeneous ones while not ignoring the rich semantic and structural information that is also contained in the data. Therefore, to fully leverage the information available, social messages are modelled into heterogeneous information net- works (HINs) by the different types of entities in messages. However, not all entities in the message are essential. Inspirited by [2], [4], the features in a message most strongly related to events are location information, temporal information, and semantic information. Our heterogeneous social information Fig. 5: Social media data processing: (a) The original het- erogeneous message network generated by the raw message. The different node colours denote different entities. (b) The process of learning message features via Word2vec. (c) The homogeneous message network generated from Steps (a) and (b). network was formed from messages on Twitter, as shown in Fig. ∈ M , 5(a). Given a message mi from a message set M where mi we treat the words in the message mi and the message itself as different entities. For example, "m1" can be set as a message node. Based on the element in the message m1, "fire" and "bush" are selected as the word nodes; "Brisbane" is selected as the location node, and "10/03/2022" is set as the time node. The users mentioned in the messages or retweets are set as user nodes, e.g., "user1" and "user2". Then edges are added between the message node and the other nodes. This process is repeated for all messages in the dataset. Also, duplicate nodes are removed to build a heterogeneous message network that includes all node types. Note, however, that is difficult to directly use a machine learning model with a heterogeneous information network. So the next step is to transform the heterogeneous message network into a homogeneous message network. We realise that in social media such as Twitter, user mentions and retweets play an important role in the spread of information. This is characteristic of networks and data with tree-like structures Raw DataData ProcessingHyperbolic MLP EncoderLinear DecoderHClassifierZFeatures LearningHMGm1m2m3User1User2User310/03/2022"Brisbane",LOC"Sydney",LOC"New York",LOC08/05/2022...m110/03/2022"Brisbane",LOCFeatures(a) Original Heterogeneous Message Network(b) Words embedding via Word2vec(c) Homogeneous Message Networkm1m2m3user mentionFireBushFireBushRaw MessageMessage 1 (m1)Message 2 (m2)Message 3 (m3)...@user1 10 March, 2022. How's the bush fire in Brisbane?@user2@user3 8 May, 2022. Xxxxxx xxx xxxx New York xxx.@user2 10 March, 2022. Xxxxxx Sydney xxx. JOURNAL OF LATEX CLASS FILES, VOL. 14, NO. 8, AUGUST 2015 6 [44]. Given this, we set message nodes as the only type of node in the homogeneous message graph, with user mentions and retweets as links between messages, as shown in Fig. 5(c). To capture the semantic and time information, Word2Vec is used to learn the feature vectors of the semantic features of other nodes and to encode the timestamps into 2-dimensional vectors as time features. Then, the semantic and temporal are combined as message features, as shown in Fig. 5(b). The message features denoted as X = {xmi is the features of message mi. Thus, the homogeneous message graph can be expressed as G = (X , A), where A is the adjacency matrix of a homogeneous message network. ∈ M }, where xmi ∈ (cid:82)d |mi 4.1.3 Hyperbolic MLP Encoder and Linear Decoder To leverage the distance between nodes in tree-like data, hyperbolic space serves as the low-dimensional space for the embeddings needed to learn this information. Various hyper- bolic representation learning models have been developed by researchers, from the most straightforward model HNN [45] to some complex model like HGCN [35], HGNN [34], and HAT [43]. We note that a simple hyperbolic representation learning model has the same structure as a model designed for Euclidean space. The difference is that some of the processing is shifted to hyperbolic space. Inspired by HNN, our hyperbolic encoder is designed based on an MLP and a linear decoder. As previously mentioned, hyperbolic space is non-vector space. When an MLP is applied to hyperbolic space, traditional feature transforma- tions will not work. Therefore, the hyperbolic embeddings need to be mapped in Euclidean space to compute embedding vectors via a weight matrix and a bias translation. Feature transform for a feature set X in Euclidean space is shown as: E = σ(W X + b), (12) where, E is the embeddings in Euclidean space, with the activation function σ, weight matrix W and bias translation b. Let W be a N x N (cid:48) weight matrix, we have: W ⊗ X = ex pK o (W log K o (X )), for bias translation in hyperbolic space, we have: X ⊕ b = ex pK o (log K o (X ) + b), (13) (14) and the full feature transforms in hyperbolic space is: H = ex pK o (W ⊗ X ⊕ b))). (σ(log K o Given a graph G = (X , A), and a hyperbolic MLP decoder m(*) based on the above hyperbolic feature transform, we have: (cid:72) = m(G), (15) (16) H node classification as our downstream task, and so chose a linear decoder, denoted as d (*), to handle the transformation: or Z = d (H (cid:72)), Z = d (H (cid:80)), (18) (19) where Z is the set of final representations for the node classifi- cation task. 4.1.4 Classifier Our downstream task is more specifically multi-node classifi- cation. Hence, the HSED model includes softmax and cross- entropy loss. Given a representation set Z = {zi ∈ (cid:82)|1 ≤ i ≤ N }, where N is the total number of messages, plus S (*)as the softmax layer (*) as the cross-entropy loss, the loss can be calculated and LHS E D to update the model's parameters. The processes are as follows: Let zi ∈ Z, n ∈ N , we have: S (zi ) = ezi j=1 ez j (cid:80)n , l (cid:48) i = S (zi ), n (cid:88) LHS E D = − li logl (cid:48) i , (20) (21) (22) i=1 is the true label and l (cid:48) i where li pseudocode for the HSED model is given in Algorithm 1. is the predicted label. The Algorithm 1: HSED: Hyperbolic Social Event Detec- tion Input: A social message database M = {m1, ..., mn }; A set of labels {l0, l1, ..., ln encoder m(*); Linear decoder d (*) ;softmax layer S (*). };hyperbolic MLP Output: Set of social event labels {l (cid:48) 0, l (cid:48) 1, ..., l (cid:48) n }, where n is the number of classes. ∈ M do 1 for mi 2 Homogeneous message network G = (X , A) ← data processing (Section 4.1.2) ∈ X do 3 for xi 4 Hyperbolic embeddings hi Final representations zi Predict label l (cid:48) ) i = S (zi ) = m(xi ) = d (hi Cross-entropy loss LHS E D = − Update parameters n (cid:80) i=1 li logl (cid:48) i 5 6 7 8 or (cid:80) = m(G), H (17) (cid:72) means the hyperboloid model is used for the em- where, H (cid:80)means the Poincaré ball model is used for the bedding, and H embedding. The adjacency matrix A is not used in the HSED model, but it is used in the unsupervised variant of the model. Additionally, the embeddings in hyperbolic space cannot be directly used for downstream tasks. Rather, they need to be transformed into embeddings in Euclidean space. We chose 4.2 UHSED: An Unsupervised Model for Social Event Detec- tion 4.2.1 Overview High-quality datasets in social media data are rare given the cost of labelling. Hence, we devised a second model called Unsupervised Hyperbolic Social Event Detection (UHSED) that includes a contrastive learning technique to make our approach compatible with unlabelled datasets. The framework of the JOURNAL OF LATEX CLASS FILES, VOL. 14, NO. 8, AUGUST 2015 7 4.2.3 Hyperbolic GCN Encoder To fully leverage the power of graph contrastive learning, we developed a hyperbolic GCN encoder to replace the hyperbolic MLP encoder in the HSED model. Compared to a hyperbolic MLP encoder, a hyperbolic GCN encoder based on a GCN model can aggregate the information from neighbouring nodes to help the contrastive model capture mutual information. However, aggregation in hyperbolic space is different from aggregation in Euclidean space. An aggregation in Euclidean space at layer l would begin with a feature transform: el i = W l x l −1 i + bl . And, for neighbourhood aggregation, we would have: (cid:32) = σ x l i el i (cid:33) wi j el i , + (cid:88) j∈N (i) (23) (24) where, N (i) denotes the number of neighbourhoods for node i. Note that wi j can be computed by a few different mecha- nisms [23], [24]. Therefore, to aggregate a neighbourhood in hyperbolic space, we have: A(hi ) = ex pK hi (cid:32) (cid:88) j∈N (i) (cid:33) ) . wi j log K hi (h j (25) Hence, based on Eq. 23, Eq. 13 and Eq. 14, the message passing in a hyperbolic GCN can be expressed as follows: For the hyperbolic feature transform in layer l : hl i = (W ⊗ x l −1 i ) ⊕ bl , for the hyperbolic neighbourhood aggregation, we have: y l i = A(hl ) i. (26) (27) Thus, given a graph G = (X , A) and its data augmentation (cid:48) = (X (cid:48), A(cid:48)), plus a hyperbolic GCN encoder g (*) based on the G above hyperbolic message, we have: and H = g (G), (cid:48) = g (G (cid:48)). H (28) (29) 4.2.4 Contrastive Loss Function When we have the graph representation of positive and neg- ative samples. Before performing any downstream tasks, the hyperbolic embeddings need to be mapped to Euclidean space and a readout function R (*) needs to be used to summarise the node embeddings into graph-level representations. The hyperbolic embeddings can be mapped into Euclidean space via an ex p mapping: E = ex pK o (H ), (30) and (cid:48) = ex pK o Here, the readout function R (*) for embedding set E is (31) (H (cid:48)). E Fig. 6: The framework of the UHSED model. "H M G" denotes a homogeneous message graph. "H M G(cid:48)" denotes another ho- mogeneous message graph after graph data augmentation. "H, H (cid:48)" are the hyperbolic embeddings of the two HMGs after hyperbolic encoding. "Z, Z (cid:48)" are the final representations. UHSED model is shown in Fig.6. The framework is similar to the HSED model but it adds three more components: 1) Graph Data Augmentation, which creates a negative (cid:48) of the original graph G for sample and a graph G contrastive learning. 2) Hyperbolic GCN Encoder, which embeds G and G into the hyperbolic space to produce the patch embed- ding sets H and H (cid:48). (cid:48) 3) Contrastive Loss, which maximises the mutual infor- mation H and H (cid:48). 4.2.2 Graph Data Augmentation In the data augmentation process, contrastive learning is per- formed in addition to the same data processing as used for the HSED model. Existing contrastive learning methods can be di- vided into CV-based contrastive learning, NLP-based contrastive learning, and graph-based contrastive learning depending on the application the model is being used for. Given that our data is graph-based, UHSED uses graph contrastive learning. It is worth noting that data augmentation plays a vital role in contrastive learning. Researchers have proposed various data augmentation methods for different contrastive learning methods. As mentioned, the edges in social message networks hold vital structural information. Thus, only node-based data augmentation methods are considered in this study. The main node-based data augmentation methods are feature dripping, random masking, and feature corruption [37], [40]. Table 1 provides an overview of these methods. TABLE 1: Overview of graph data augmentation methods. Augmentation Type Description Feature dropping Random masking Feature corruption Nodes Nodes Nodes Randomly select nodes and delete all their features Random mask a certain percentage of features Disrupt the features corresponding to all nodes Given a homogeneous message graph G = (X , A), a negative (cid:48) = example is sampled through the graph data augmentation: G (X (cid:48), A(cid:48)). For all node-based data augmentations, X (cid:54)= X (cid:48) but A = A(cid:48). denoted as: Z = R (E), (cid:130) N (cid:88) 1 N i=1 R (E) = σ (cid:140) ei , (32) (33) Raw DataData ProcessingHMGHyperbolic GCNEncoderReadoutHZGraph AugmentationHMG'Hyperbolic GCNEncoderReadoutH'Z'Share EncoderShare ReadoutContrastiveLoss JOURNAL OF LATEX CLASS FILES, VOL. 14, NO. 8, AUGUST 2015 Algorithm 2: UHSED: Unsupervised Hyperbolic Social Event Detection Input: A social message database M = {m1, ..., mN }; Hyperbolic MLP set of labels {l0, l1, ..., ln encoder g (*); Graph data augmentation methodAU G(*); Readout function R (*); Contrastive loss function LU HSE D Output: A set of predicted social event labels (*). }; A }, where n is the number of classes. 1, ..., l (cid:48) n {l0, l (cid:48) ∈ M do 1 for mi 2 Homogeneous message network G = (X , A) ← data processing (Section 4.1.2) (cid:48) = AU G(G) 3 Negative sample G 4 Hyperbolic embeddings for two graph: H = g (G) and (cid:48) = g (G (cid:48)) H 5 Mapping hyperbolic embeddings into Euclidean space: (cid:48) = ex pK o E = ex pK o (H ) and E (H (cid:48)) ∈ E and e(cid:48) 6 Readout:Z = R (E) 7 for ei 8 ∈ E i ← LU HSE D LU HSE D Update parameters 1, ..., l (cid:48) 0, l (cid:48) 9 10 {l (cid:48) } ← classify E (cid:48) do (ei, e(cid:48) n i, Z) where ei ∈ E. Then, a discriminator D(*) [46] is used to maximise the mutual information, denoted as: D(ei, Z) = ρ (eiWZ) , where W denotes a learnable scoring matrix, and ρ is nonlinear logistic sigmoid. (34) A contrastive loss function LU HSE D the mutual information between Z and Z BCE loss, and so we have: (*) is defined to maximise (cid:48). Here we employ LU HS E D = 1 N + M (cid:32) N (cid:88) i=1 E[logD(ei, Z) + M (cid:88) j=1 (cid:48)[log(1 − D(e j, Z))] E . (35) (cid:33) Lastly, to detect the social events, a simple linear classifier (logistic regression) is used to classify the unsupervised training results E. The pseudocode for the UHSED model is given in Algorithm 2. 5 Experiments The experiments were designed to answer the following ques- tions: • Q1: Do the proposed approaches have superiority over the baseline models? (Sections 5.2.4, 5.3.4) • Q2: What is the impact of the hidden layers and their dimensionality on the proposed models? (Sections 5.2.5, 5.3.5) • Q3:Which data augmentation method is the most suit- able for the UHSED model? (Section 5.3.6) • Q4: Are hyperbolic spaces better for social media data than Euclidean spaces? (Section 5.4.1) • Q5: Which hyperbolic model performs better with social media data? (Section 5.4.2) • Q6: Does the tree-like structure of the Twitter dataset 8 5.1 Datasets Our model is mainly aimed at social media data, so we chose the Twitter [47] real-world public dataset as our primary dataset. However, since the Twitter dataset is a large-scale dataset, performing graph contrastive learning with it might lead to out- of-memory errors. Thus, we created a balanced mini-Twitter dataset based on the larger original dataset. Additionally, we experimented with the Cora [48] dataset, the Citeseer [48] dataset and the UHSED model to evaluate the efficacy of modelling in hyperbolic space. An overview of the datasets used is shown in Table 2. TABLE 2: The statistical information of datasets. Dataset for HSED Dataset Twitter Dataset mini-Twitter Cora Citeseer Num. of Classes Num. of Nodes Num. of Features 68,841 503 302 Datasets for UHSED Num. of Classes Num. of Nodes Num. of Features 3,000 2,708 3,327 302 1,433 3,703 15 7 6 5.2 Experiments on HSED in Supervised Scenarios This section presents the evaluations of our HSED model. Section 5.2.1 introduces the baseline models, and Section 5.2.2 outlines the experimental environment and the hyperparameter settings. The rest of this section provides the details of the experiments and answers research questions Q1 and Q2. 5.2.1 Baselines To evaluate the HSED model, we conducted comprehensive experiments with the Twitter dataset and compared the results to other models – some traditional and some start-of-art. The source code of the proposed HSED model can be found on Github1. The compared baselines include: • Word2vec [13] – a message representation learning model widely used in many social event detection mod- els. LDA [11] – a traditional topic detection model. Its statistical approach captures topic-related co-occurrence words in messages. • • WMD [49] – a similarity measurement method that de- tects social events by calculating the similarity between messages. • BERT [50] – a powerful language representation model that plays a key role in many start-of-the-art social event detection models. • KPGNN [2] – a social event detection model based on HINs. It mainly focuses on incremental social event detection, and its offline performance is slightly better than PP-GCN's. FinEvent [51] – a social event detection model based on incremental and cross-lingual social messages. It mainly applies reinforcement learning to improve the performance of social event detection. • hinder neighbour aggregation? (Section 5.4.3) 1. https://github.com/ZITAIQIU/HSED JOURNAL OF LATEX CLASS FILES, VOL. 14, NO. 8, AUGUST 2015 5.2.2 Parameter Settings To ensure reliable results, we ran each experiment five times, reporting the average results as final. The parameter settings for HSED are shown in Table 3. Hidden layer denotes the number of hidden layers. Hidden dimension stands for the dimensions of the hidden layers. Note that the training, test and validation rate were designed based on the offline experimental settings for KPGNN2. All the experiments with the HSED model were conducted on an NVIDIA V100 GPU with 12 24-core Intel Xeon Scalable 'Cascade Lake' processors. TABLE 3: HSED parameter settings. Parameter Hidden layer Hidden dimension Training rate Test rate Validation rate Learning rate Optimiser Activation function Value 2 512 70% 20% 10% 0.1 Adam ReLU 5.2.3 Evaluation Metrics In some baseline models that use clustering algorithms to cluster social events (like KPGNN), the labels predicted by the models will differ from the ground-truth label. Hence, standard accuracy metrics are not a suitable evaluation measure. Instead, we used the same evaluation metrics as the baseline models to measure the similarity between the predicted and the ground- truth labels to ensure a fair comparison. Namely, these were NMI [52], AMI [53], and ARI [53], which have been widely used to assess social event detection models [2], [17]. 5.2.4 HSED Model Performance Comparison (Answer Q1) The experimental results of the HSED model and the baseline models with the Twitter dataset are shown in Table 4. Overall, the HSED model outperformed the baseline models on every metric. We also found a high degree of agreement between the labels predicted by HSED and the ground-truth labels. However, none of the baseline models could capture enough information from the social networks to compete with HSED. For example, LDA only measures topic-related co-occurrence words in messages, while Word2Vec, WMD, and BERT only consider message embeddings. These models ignore the rich se- mantic and structural information in heterogeneous networks. Although KPGNN and FinEvent learn the heterogeneity of social media based on previous models, they ignore the fact that social media data is tree-structured. Particularly with such a large- scale dataset, they were not able to discern the differences between the leaves, as shown in Fig. 3. Thus, the baseline models only reached 80% NMI, 69% AMI and 48% ARI at the highest. By contrast, HSED considers both heterogeneity and the exponential growth of social media data. In view of this, the model was able to learn more information than the baseline models and so scored highest in all the metrics. 2. https://github.com/RingBDStack/KPGNN TABLE 4: Comparison experiment results of classification of all models. 9 Metrics Word2Vec LDA WMD BERT KPGNN FinEvent HSED (ours) NMI AMI ARI 0.44 0.13 0.02 0.29 0.04 0.01 0.65 0.50 0.06 0.64 0.44 0.07 0.70 0.52 0.22 0.80 0.69 0.48 0.96 0.83 0.94 5.2.5 The Impact of The Hidden Layers and Their Dimensionality on The HSED Model (Answer Q2) The HSED model is based on an MLP. Although the HSED model partly operates in hyperbolic space, it still has the number of hidden layers and the dimensionality of those layers as its hyperparameters. In this section, we study the impact of these two hyperparameters on the HSED model. We designed experiments to test the effects of these hyperparameters – the results of which are shown in Fig. 7. As the figure shows, the higher the number of dimensions at, say 256 or 512, the better the performance. With too few dimensions, i.e., 64, performance degraded. However, the dimensionality of the hidden layers is not the most critical factor affecting HSED's performance – the number of hidden layers is. With more than three hidden layers, HSED's performance degraded rapidly across all metrics. In addition, we also ex- plored the effect of changes in these two parameters on the model's training time. The results, appearing in Fig. 7(e), shows that neither parameter has much influence over training time. Therefore, for the best performance, one should include less than three hidden layers with each layer having a relatively high dimensionality. 5.3 Experiments on UHSED in Unsupervised Scenarios In this section, we evaluate the UHSED model. Section 5.3.1 introduces the baselines. Section 5.3.2 provides details of the experimental environment and hyperparameter settings. The rest of this section outlines the experiments and answers re- search questions Q1, Q2, and Q3 for the UHSED model. 5.3.1 Baselines To evaluate our UHSED model, we conduct comprehensive ex- periments with the mini-Twitter, Cora, and Citeseer datasets and compared the results with the current state-of-the-art models. The baselines included: • DGI [24] – a single-branch graph contrastive learning model. Negative samples are obtained through data augmentation or corrupting the original image. • GraphCL [40] – a dual-branch graph contrastive learn- ing model that augments the original graph twice to obtain two views. 5.3.2 Parameter Settings The parameter settings for UHSED are shown in Table 5. Hidden layer stands for the number of hidden layers in the UHSED model. Hidden dimension is the dimensionality of the hidden layers. Drop rate is the percentage of features or nodes that are dropped through data augmentation. Augmentation type is the method of graph data augmentation (see Table 1 for more details). All the experiments with the UHSED model were conducted on an NVIDIA V100 GPU with 12 24-core Intel Xeon Scalable 'Cascade Lake' processors. JOURNAL OF LATEX CLASS FILES, VOL. 14, NO. 8, AUGUST 2015 10 (a) ACC (b) NMI (c) AMI (d) ARI (e) Time Fig. 7: HSED with different hyperparameters. "dim" is the hidden dimension and "hl" is the hidden layer. TABLE 5: UHSED parameter settings. Parameter Value Hidden layer Hidden dimension Drop rate Learning rate Optimiser Activation function Augmentation method 1 512 10% 0.1 Adam ReLU Feature corruption TABLE 6: Comparison experiment results of classification of UHSED and baseline models. Methods mini-Twitter Cora Citeseer Micro-F1 Macro-F1 Micro-F1 Macro-F1 Micro-F1 Macro-F1 DGI GraghCL UHSED (ours) 0.1714 0.1517 0.5288 0.14129 0.1302 0.5266 0.8077 0.6993 0.8314 0.7922 0.6837 0.8203 0.6885 0.6377 0.7081 0.6518 0.5971 0.6458 5.3.3 Evaluation Metrics Since UHSED is an unsupervised learning model, we employed Micro-F1 and Macro-F1 to evaluate the accuracy of the detec- tion results following previous studies [24], [40]. 5.3.4 UHSED Model Performance Comparison (Answer Q1) The experimental results for the UHSED model and baselines with the mini-Twitter, Cora and Citeseer datasets are shown in Table 6. Overall, the UHSED model outperformed the base- line models. Initially, our experiments only included the mini- Twitter dataset. However, we noticed that all models returned relatively low scores. So, to rule out problems with the model's code, we added the Cora and Citeseer datasets for validation. On these two datasets, the models yielded typical performance. Therefore, we wondered whether the low scores were due to the tree-like structure of the Twitter dataset and whether perhaps this was hindering the neighbour aggregation process in the GCN. To this end, we undertook further experiments, discussing the results in Section 5.4.3. In addition, we noted that the DGI model outperformed the GraphCL model. Given that UHSED also has a single-branch architecture, this may indicate that a single-branch model is more suitable for graph contrastive learning. Regardless, the results make it clear that hyperbolic spaces do help the model to capture more information from tree-structured data. Section 5.4.1 provides a lengthier discussion on this phenomenon. 5.3.5 The Impact of The Hidden Layers and Their Dimensionality on The UHSED Model (Answer Q2) The UHSED model was developed from the HSED model. Thus, the same hyperparameters apply – being the number of hidden layers and their dimensionality. In this subsection, we explore the impact of these two hyperparameters on the UHSED model. The results are shown in Fig. 8. Like the HSED model, we note that the higher the number of dimensions, the better the performance. However, the number of hidden layers had a great impact on UHSED's performance with all datasets. From Fig. 8 (a), (b), (d), (e), (g) and (h), UHSED's scores drop rapidly with more than two hidden layers. The results for model training times are shown in Fig. 8 (c), (f) and (i). Obviously, the number of hidden layers has little effect on the training time, but with a dimensionality of larger than 256, training time proliferated for all datasets. Thus, we suggest an architecture with only one hidden layer for all datasets and no more than 256 dimensions for large-scale datasets. 5.3.6 Selection of data augmentation method in the UHSED Model (Answer Q3) The key idea behind contrastive learning is to generate negative samples through data augmentation. The UHSED model is com- patible with three graph data augmentation methods. Hence, in this section, we explore these different data augmentation methods, comparing them for their effectiveness. For these experiments, the drop rate of augmentation was set to 0.1, and the number of hidden dimensions was set to 512 with one hidden layer. The results are shown in Table 7. From the results, we can see that "Feature corruption" outperformed the other graph data augmentation methods. The reason is that this method only disrupts the order of the node features; it does not drop any features, whereas the other two data augmentation methods do drop some information. The "Feature dropping" method drops more feature information than the "Random masking" method, which resulted in the "Feature dropping" method getting lower scores than "Random masking". Furthermore, UHSED is a single-branch graph contrastive learn- ing model, and we believe that data augmentation methods that drop features may not be suitable for a contrastive learning model with a single-branch architecture. 5.4 Discussion In this section, we answer our remaining research questions. 5.4.1 Comparison of Model Performance in Hyperbolic Space and Euclidean Space (Answer Q4) To answer this question, we compared the HSED model with a variant of the HSED model that only embeds features in Eu- JOURNAL OF LATEX CLASS FILES, VOL. 14, NO. 8, AUGUST 2015 11 (a) Micro-F1 on mini-Twitter (b) Macro-F1 on mini-Twitter (c) Time on mini-Twitter (d) Micro-F1 on Cora (e) Macro-F1 on Cora (f) Time on Cora (g) Micro-F1 on Citeseer (h) Macro-F1 on Citeseer (i) Time on Citeseer Fig. 8: UHSED model with different hyperparameters. TABLE 7: Graph data augmentation analysis. Methods mini-Twitter Cora Citeseer Micro-F1 Macro-F1 Micro-F1 Macro-F1 Micro-F1 Macro-F1 Feature dropping Random masking Feature corruption 0.4215 0.4744 0.5288 0.3812 0.4668 0.5266 0.3249 0.7588 0.8314 0.1222 0.7489 0.8203 0.3976 0.6123 0.7081 0.3434 0.5747 0.6458 clidean space. The results are shown in Fig. 9(a). It is clear that, with the Twitter dataset, the HSED model that embeds features in hyperbolic space outperforms the Euclidean space variant of the model in all metrics, with an average improvement of 5%. The results for the UHSED model are shown in Fig. 10(a), (b). Here, we can see that hyperbolic space also improves the model's performance with all datasets. Overall, the experiments clearly demonstrate the effectiveness of modelling in hyperbolic space given tree-structured data. 5.4.2 Model Performance in Different Hyperbolic Space Models (Answer Q5) (a) Hyperbolic space analysis (b) Hyperbolic space models analysis Fig. 9: Hyperbolic space and their models analysis of the HSED model. (a) is the hyperbolic space analysis for the HSED model. "HSE DE" means the HSED model in Euclidean space. (b) is the hyperbolic space models' analysis for the HSED model. "HSE DP " means the HSED model embedding via the Poincaré ball model. "HSE DH " means the HSED model embedding via the Hyperboloid ball model. As mentioned, we applied two types of hyperbolic models – one being the Poincaré ball model, and the other being the hyperboloid model. This subsection explores the impact of these different hyperbolic models on our proposed models. The experimental results are shown in Fig. 9(b) and Fig. 10(c), (d). Overall, the differences between the hyperbolic models had 0.910.930.740.90.950.960.830.94ACCNMIAMIARI00.20.40.60.811.2ScoresHSEDHSEDE0.910.930.740.90.940.950.820.93ACCNMIAMIARI00.20.40.60.811.2ScoresHSEDPHSEDH JOURNAL OF LATEX CLASS FILES, VOL. 14, NO. 8, AUGUST 2015 12 (a) Micro-F1 (b) Macro-F1 (c) Micro-F1 (d) Macro-F1 Fig. 10: Hyperbolic space and their models analysis of the UHSED model. (a) and (b) represent the hyperbolic space analysis for the UHSED model. "U HSE DE" means the UHSED model in Euclidean space. (c) and (d) represent the hyperbolic models' analysis for the UHSED model. "U HSE DP " means the UHSED model embedding via the Poincaré ball model. "U HSE DH " means the UHSED model embedding via the Hyperboloid ball model. little effect on the proposed models. However, for the HSED model, the Poincaré ball model performed better than the hyperboloid model. The reason for this is that the researcher can adjust the Poincaré ball model using gradient optimisation. Because of this, the Poincaré ball model is more suitable for representation learning. 5.4.3 The Relationship Between Tree-like Structure and Neigh- bours' Aggregation (Answer Q6) Through the above experiments, we found an interesting phe- nomenon. The models based on GCNs do not perform well with the Twitter dataset. We speculate that this is because, as the data with a tree-like structure increases, the distance between neighbours becomes closer, which leads to a failure of the aggregation algorithm in the GCN. TABLE 8: Validating the impact of tree-structured data with GCNs (Results for the GCN-based models are marked in italic). Methods ACC NMI AMI ARI HSED MLP UHSED GCN 0.9354 0.8971 0.166 0.2552 0.951 0.9207 0.3062 0.3776 0.8189 0.7802 0.0182 0.0342 0.929 0.885 0.0922 0.1576 To verify our conjecture, we compared the classical MLP and GCN models with our proposed model and conducted experiments on the Twitter dataset. The results are shown in Table 8. Through these experiments, we confirmed that GCN- based models do not perform well on the Twitter dataset. Although hyperbolic space improves the models' performance, it does not affect the model as much as the model's structure. Therefore, we believe that tree-structured data does hinder the aggregation algorithm within GCN-based models. 5.4.4 Time Efficiency In this section, we explore the time efficiency of the baseline models and proposed models. We analyse the relationship between the number of epochs and model performance and compare the temporal performance of the baseline models and the proposed models on different datasets. The experimental results of the supervised model (HSED) and the unsupervised model (UHSED) are shown in Fig. 11, Table 9 and Table 10, respectively. (a) HSED model (b) UHSED model Fig. 11: Effect of epoch number on model performance. Fig. 11 shows the effect of model training time on model performance. It can be seen that the performance of the model becomes better as the epoch increases. However, it is not that the larger the number of epochs, the better. We can see that for the supervised model (HSED) when the number of epochs exceeds 100, the performance of the model increases slowly. For the unsupervised model (UHSED), the number of optimal epochs varies with the dataset. Therefore, we can clearly see that increasing the training time of the model can improve its performance, but it does not mean that the longer the training time, the better the model's performance. It has a peak, and the peak varies with the dataset. TABLE 9: HSED model time efficiency analysis. Metrics Word2Vec Time 306.1s LDA WMD 77.73s >24h BERT KPGNN 9784s 39.91s FinEvent >24h HSED (ours) 246.28s Table 9 and Table 10 show the time efficiency experiments of different models. For the supervised model (HSED), we can see that its time efficiency is better than most of the baseline models. The reason may be that some baseline models are not designed to be applied to big data strategies. Like WMD model needs to compare the similarity between each message before classifying the messages. It becomes very time-consuming when encountering larger datasets. The FinEvent model, on the other hand, combines data processing and training together, which will consume a lot of time in data processing when encountering large data sets, resulting in huge overall time consumption. For the unsupervised model (UHSED), its time efficiency is not much different from other baseline models for different 0.510.830.680.550.840.71mini-TwitterCoraCiteseer00.20.40.60.811.2Micro-F1 ScoresUHSEDUHSEDE0.510.810.60.540.830.65mini-TwitterCoraCiteseer00.20.40.60.811.2Macro-F1 ScoresUHSEDUHSEDE0.550.840.830.540.830.82mini-TwitterCoraCiteseer00.20.40.60.811.2Micro-F1 ScoresUHSEDPUHSEDH0.540.830.640.520.820.65mini-TwitterCoraCiteseer00.20.40.60.811.2Macro-F1 ScoresUHSEDPUHSEDH1050100200300500Epochs00.10.20.30.40.50.60.70.80.91PerformanceF1NMIARIAMI1050100200300500Epochs0.30.40.50.60.70.80.91Micro-F1mini-TwitterCoraCiteseer JOURNAL OF LATEX CLASS FILES, VOL. 14, NO. 8, AUGUST 2015 TABLE 10: UHSED model time efficiency analysis. Datasets DGI GraphGL UHSED (ours) mini-Twitter Cora Citeseer 58.94s 205.25s 680.29s 112.01s 86.43s 110.19s 225.6s 96.2s 370.4s datasets. It may be that they both adopt the same graph contrastive learning framework. From this point of view, the application of hyperbolic space has little effect on time effi- ciency, and the change in time is more likely due to the size of the data set and the distribution mechanism of the data. Overall, our proposed hyperbolic space-based models improve the performance of social event detection without sacrificing time efficiency. 6 Conclusion We proposed a Hyperbolic Social Event Detection model HSED for detecting social events in heterogenous social networks where the data is labelled, along with an unsupervised variant of the same model, UHSED, for cases where the social media data is unlabelled. This unsupervised model works around the high cost of labelling social media data by using graph contrastive learning to free the researcher from a dependency on labels. Both models preserve the rich semantic and structural information associated with heterogeneous social networks by first processing the data with Word2Vec, transforming the het- erogeneous social network into a homogeneous message graph. Then, unlike other social event detection models, the models focus on the tree-like structure of social media data, for the first time employing hyperbolic space instead of Euclidean space to capture valuable semantic and structural information. Experi- ments demonstrate the superiority of the proposed models for detecting social events in an offline fashion. Notably, our experiments found that large-scale tree- structured data hinders the neighbour aggregation functions in a GCN. Moreover, the UHSED model does not perform as well as the HSED model. However, given that offline social event detection is the basis of online social event detection, we plan to shift the basis of our unsupervised model from one based on aggregation functions to one based on an MLP in future work. Furthermore, we will also consider how to apply our model to dynamic social event detection. Acknowledgments This work was supported by the Australian Research Council Projects Nos. DE200100964, LP210301259, and DP230100899. References [2] [1] Q. Li, J. Li, J. Sheng, S. Cui, J. Wu, Y. Hei, H. Peng, S. Guo, L. Wang, A. Beheshti, and P. S. Yu, "A survey on deep learning event extraction: Approaches and applications," IEEE Transactions on Neural Networks and Learning Systems, pp. 1–21, 2022. Y. Cao, H. Peng, J. Wu, Y. Dou, J. Li, and P. S. Yu, "Knowledge- preserving incremental social event detection via heterogeneous gnns," in Proceedings of the Web Conference 2021, 2021, pp. 3383– 3395. [3] Q. Li, H. Peng, J. Li, J. Wu, Y. Ning, L. Wang, P. S. Yu, and Z. Wang, "Reinforcement learning-based dialogue guided event extraction to exploit argument relations," IEEE/ACM Transactions on Audio, Speech, and Language Processing, vol. 30, pp. 520–533, 2022. 13 [4] [5] [6] [7] I. Afyouni, Z. Al Aghbari, and R. A. Razack, "Multi-feature, multi- modal, and multi-source social event detection: A comprehensive survey," Information Fusion, vol. 79, pp. 279–308, 2022. Y. Huang, Q. Liao, Y. Jia, and Y. Wang, "Survey on social event detection," in 2021 IEEE Sixth International Conference on Data Science in Cyberspace (DSC). IEEE, 2021, pp. 159–165. J. Ren, L. Jiang, H. Peng, Z. Liu, J. Wu, and S. Y. Philip, "Evidential temporal-aware graph-based social event detection via dempster- shafer theory," in 2022 IEEE International Conference on Web Services (ICWS). P. Tijare and J. R. Prathuri, "A survey on event detection and prediction online and offline models using social media platforms," Materials Today: Proceedings, 2021. IEEE, 2022, pp. 331–336. [8] M. Fedoryszak, B. Frederick, V. Rajaram, and C. Zhong, "Real-time event detection on social data streams," in Proceedings of the 25th ACM SIGKDD international conference on knowledge discovery & data mining, 2019, pp. 2774–2782. J. Ren, L. Jiang, H. Peng, Y. Cao, J. Wu, P. S. Yu, and L. He, "From known to unknown: Quality-aware self-improving graph neu- ral network for open set social event detection," in Proceedings of the 31st ACM International Conference on Information & Knowledge Management, 2022, p. 1696–1705. [9] [10] J. Ren, H. Peng, L. Jiang, J. Wu, Y. Tong, L. Wang, X. Bai, B. Wang, and Q. Yang, "Transferring knowledge distillation for multilingual social event detection," CoRR, vol. abs/2108.03084, 2021. [11] D. M. Blei, A. Y. Ng, and M. I. Jordan, "Latent dirichlet allocation," JMLR, vol. 3, no. Jan, pp. 993–1022, 2003. [12] C. Li, H. Wang, Z. Zhang, A. Sun, and Z. Ma, "Topic modeling for short texts with auxiliary word embeddings," in Proceedings of SIGIR, 2016, pp. 165–174. [13] T. Mikolov, K. Chen, G. Corrado, and J. Dean, "Efficient esti- mation of word representations in vector space," arXiv preprint arXiv:1301.3781, 2013. [14] Y. Sun and J. Han, "Mining heterogeneous information networks: a structural analysis approach," Acm Sigkdd Explorations Newsletter, vol. 14, no. 2, pp. 20–28, 2013. [15] Q. Huang, J. Yu, J. Wu, and B. Wang, "Heterogeneous graph attention networks for early detection of rumors on twitter," in 2020 Interna- tional Joint Conference on Neural Networks, 2020, pp. 1–8. [16] Y. Wei, X. Fu, Q. Sun, H. Peng, J. Wu, J. Wang, and X. Li, "Heteroge- neous graph neural network for privacy-preserving recommendation," arXiv preprint arXiv:2210.00538, 2022. [17] H. Peng, J. Li, Q. Gong, Y. Song, Y. Ning, K. Lai, and P. S. Yu, "Fine- grained event categorization with heterogeneous graph convolutional networks," arXiv preprint arXiv:1906.04580, 2019. [18] Y. Sun, J. Han, X. Yan, P. S. Yu, and T. Wu, "Pathsim: Meta path- based top-k similarity search in heterogeneous information networks," Proceedings of the VLDB, vol. 4, no. 11, pp. 992–1003, 2011. [19] X. Wang, H. Ji, C. Shi, B. Wang, Y. Ye, P. Cui, and P. S. Yu, "Hetero- geneous graph attention network," in The world wide web conference, 2019, pp. 2022–2032. [20] X. Fu, J. Zhang, Z. Meng, and I. King, "Magnn: Metapath aggregated graph neural network for heterogeneous graph embedding," in Pro- ceedings of The Web Conference 2020, 2020, pp. 2331–2341. [21] Z. Zhong, C.-T. Li, and J. Pang, "Reinforcement learning enhanced het- erogeneous graph neural network," arXiv preprint arXiv:2010.13735, 2020. [22] Q. Lv, M. Ding, Q. Liu, Y. Chen, W. Feng, S. He, C. Zhou, J. Jiang, Y. Dong, and J. Tang, "Are we really making much progress? revisiting, benchmarking and refining heterogeneous graph neural networks," in Proceedings of the ACM SIGKDD, 2021, pp. 1150–1160. [23] T. N. Kipf and M. Welling, "Semi-supervised classification with graph convolutional networks," arXiv preprint arXiv:1609.02907, 2016. [24] P. Veliˇckovi ́c, G. Cucurull, A. Casanova, A. Romero, P. Lio, and Y. Ben- gio, "Graph attention networks," arXiv preprint arXiv:1710.10903, 2017. [25] A. B. Adcock, B. D. Sullivan, and M. W. Mahoney, "Tree-like structure in large social and information networks," in 2013 IEEE 13th Interna- tional Conference on Data Mining. IEEE, 2013, pp. 1–10. [26] H. Yang, H. Chen, S. Pan, L. Li, P. S. Yu, and G. Xu, "Dual space graph contrastive learning," in Proceedings of the ACM Web Conference 2022, 2022, pp. 1238–1247. [27] J. W. Cannon, W. J. Floyd, R. Kenyon, W. R. Parry et al., "Hyperbolic geometry," Flavors of geometry, vol. 31, no. 59-115, p. 2, 1997. [28] C. Shi, Y. Li, J. Zhang, Y. Sun, and S. Y. Philip, "A survey of heteroge- neous information network analysis," IEEE Transactions on Knowledge and Data Engineering, vol. 29, no. 1, pp. 17–37, 2016. JOURNAL OF LATEX CLASS FILES, VOL. 14, NO. 8, AUGUST 2015 14 [29] Z. Ma, P. K. Rana, J. Taghia, M. Flierl, and A. Leijon, "Bayesian estimation of dirichlet mixture model with variational inference," Pattern Recognition, vol. 47, no. 9, pp. 3143–3157, 2014. [30] T. Shi, K. Kang, J. Choo, and C. K. Reddy, "Short-text topic model- ing via non-negative matrix factorization enriched with local word- context correlations," in Proceedings of the 2018 World Wide Web Conference, 2018, pp. 1105–1114. [31] Z. Huang, Y. Zheng, R. Cheng, Y. Sun, N. Mamoulis, and X. Li, "Meta structure: Computing relevance in large heterogeneous information networks," in Proceedings of the ACM SIGKDD, 2016, pp. 1595–1604. [32] O. Ganea, G. Bécigneul, and T. Hofmann, "Hyperbolic entailment cones for learning hierarchical embeddings," in International Confer- ence on Machine Learning. PMLR, 2018, pp. 1646–1655. [33] W. Peng, T. Varanka, A. Mostafa, H. Shi, and G. Zhao, "Hyperbolic deep neural networks: A survey," arXiv preprint arXiv:2101.04562, 2021. [34] Q. Liu, M. Nickel, and D. Kiela, "Hyperbolic graph neural networks," Advances in Neural Information Processing Systems, vol. 32, 2019. [35] I. Chami, Z. Ying, C. Ré, and J. Leskovec, "Hyperbolic graph convo- lutional neural networks," Advances in neural information processing systems, vol. 32, 2019. [36] X. Fu, J. Li, J. Wu, Q. Sun, C. Ji, S. Wang, J. Tan, H. Peng, and S. Y. Philip, "ACE-HGNN: Adaptive curvature exploration hyperbolic graph neural network," in 2021 IEEE International Conference on Data Mining (ICDM). IEEE, 2021, pp. 111–120. [37] P. Velickovic, W. Fedus, W. L. Hamilton, P. Liò, Y. Bengio, and R. D. Hjelm, "Deep graph infomax." ICLR (Poster), vol. 2, no. 3, p. 4, 2019. [38] R. D. Hjelm, A. Fedorov, S. Lavoie-Marchildon, K. Grewal, P. Bach- man, A. Trischler, and Y. Bengio, "Learning deep representations by mutual information estimation and maximization," arXiv preprint arXiv:1808.06670, 2018. [39] J. Qiu, Q. Chen, Y. Dong, J. Zhang, H. Yang, M. Ding, K. Wang, and J. Tang, "GCC: Graph contrastive coding for graph neural network pre-training," in Proceedings of the ACM SIGKDD, 2020, pp. 1150– 1160. [40] Y. You, T. Chen, Y. Sui, T. Chen, Z. Wang, and Y. Shen, "Graph con- trastive learning with augmentations," Advances in Neural Information Processing Systems, vol. 33, pp. 5812–5823, 2020. [41] M. Nickel and D. Kiela, "Poincaré embeddings for learning hierarchical representations," Advances in neural information processing systems, vol. 30, 2017. [42] --, "Learning continuous hierarchies in the lorentz model of hy- perbolic geometry," in International Conference on Machine Learning. PMLR, 2018, pp. 3779–3788. [43] Y. Zhang, X. Wang, C. Shi, X. Jiang, and Y. Ye, "Hyperbolic graph attention network," IEEE Transactions on Big Data, vol. 8, no. 6, pp. 1690–1701, 2021. [44] T. Bian, X. Xiao, T. Xu, P. Zhao, W. Huang, Y. Rong, and J. Huang, "Rumor detection on social media with bi-directional graph convo- lutional networks," in Proceedings of the AAAI conference on artificial intelligence, vol. 34, no. 01, 2020, pp. 549–556. [45] O. Ganea, G. Bécigneul, and T. Hofmann, "Hyperbolic neural net- works," Advances in neural information processing systems, vol. 31, 2018. [46] A. v. d. Oord, Y. Li, and O. Vinyals, "Representation learning with con- trastive predictive coding," arXiv preprint arXiv:1807.03748, 2018. [47] A. J. McMinn, Y. Moshfeghi, and J. M. Jose, "Building a large-scale corpus for evaluating event detection on twitter," in Proceedings of the 22nd ACM international conference on Information & Knowledge Management, 2013, pp. 409–418. [48] P. Sen, G. Namata, M. Bilgic, L. Getoor, B. Galligher, and T. Eliassi-Rad, "Collective classification in network data," AI magazine, vol. 29, no. 3, pp. 93–93, 2008. [49] M. Kusner, Y. Sun, N. Kolkin, and K. Weinberger, "From word embed- dings to document distances," in International conference on machine learning. PMLR, 2015, pp. 957–966. [50] J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova, "Bert: Pre-training of deep bidirectional transformers for language understanding," arXiv preprint arXiv:1810.04805, 2018. [51] H. Peng, R. Zhang, S. Li, Y. Cao, S. Pan, and P. Yu, "Reinforced, incremental and cross-lingual event detection from social messages," IEEE Transactions on Pattern Analysis and Machine Intelligence, 2022. [52] P. A. Estévez, M. Tesmer, C. A. Perez, and J. M. Zurada, "Normalized mutual information feature selection," IEEE Transactions on neural networks, vol. 20, no. 2, pp. 189–201, 2009. [53] N. Xuan, V. Julien, S. Wales, and J. Bailey, "Information theoretic mea- sures for clusterings comparison: Variants, properties, normalization and correction for chance," 2010. Zitai Qiu is currently a Master of Research student at the School of Computing, Macquarie University, Syd- ney, Australia. He got his Master Degree from the Uni- versity of Queensland, Australia. His research interests mainly include: data mining; deep learning; social event detection and machine learning. Jia Wu (M'16) is currently the Research Director for the Centre for Applied Artificial Intelligence and the Direc- tor of HDR (Higher Degree Research) in the School of Computing at Macquarie University, Sydney, Australia. Dr Wu received his Ph.D. degree in computer sci- ence from the University of Technology Sydney, Aus- tralia. His current research interests include data min- ing and machine learning. Since 2009, he has pub- lished 100+ refereed journal and conference papers, including TPAMI, TKDE, TKDD, TNNLS, TMM, KDD, ICDM, WWW, and NeurIPS. Dr Wu has been serving as the Programme Committee Chair/Contest Chair/Publicity Chair/(Senior) Programme Committees for the prestigious data mining and artificial intelligence conferences for over 10 years, such as KDD, ICDM, WSDM, IJCAI, AAAI, WWW, NIPS, CIKM, SDM, etc. His research team was the recipient of ICDM'21 Best Student Paper Award, SDM'18 Best Paper Award in Data Science Track, IJCNN'17 Best Student Paper Award, and ICDM'14 Best Paper Candidate Award. Dr Wu is the Associate Editor of ACM Transactions on Knowledge Discovery from Data (TKDD) and Neural Networks. Dr Wu is a Senior Member of the IEEE. the CIKM'22 Best Paper Runner-Up Award, Jian Yang is a full professor at the School of Com- puting, Macquarie University. She received her PhD in Data Integration from the Australian National University in 1995. Her main research interests are: business process management; data science; social networks. Prof. Yang has published more than 200 journal and conference papers in international journals and con- ferences such as IEEE Transactions, Information Sys- tems, Data and Knowledge Engineering, VLDB, ICDE, ICDM, CIKM, etc. She is currently serving as an Ex- ecutive Committee for the Computing Research and Education Association of Australia. Xing Su received her M.Eng. degree in computer tech- nology from Lanzhou University, China in 2020. She is currently a Ph.D. candidate in School of Computing at Macquarie University, Australia. Her current research interests include misinformation detection, community detection, deep learning, and social network analysis. Charu Aggarwal (F'10) is a Distinguished Research Staff Member (DRSM) at the IBM T. J. Watson Re- search Center in Yorktown Heights, New York. He re- ceived the BS degree from IIT Kanpur, in 1993, and the PhD degree from the Massachusetts Institute of Technology, in 1996. He has since worked in the field of performance anal- ysis, databases, and data mining. He has served on the program committees of most major database/data mining conferences, and served as program vice-chair of SDM 2007, ICDM 2007, WWW 2009, and ICDM 2009. He served as an associate editor of the IEEE Transactions on Knowledge and Data Engineering from 2004 to 2008. He is an associate editor of the ACM Transactions on Knowledge Discovery from Data, an action editor of Data Mining and Knowledge Discovery, an associate editor of SIGKDD Explorations, and an associate editor of KAIS. He is a fellow of the IEEE and the ACM.
http://arxiv.org/abs/2302.10360v1
2023-02-20T23:30:23
2023-02-20T23:30:23
Optical Transformers
The rapidly increasing size of deep-learning models has caused renewed and growing interest in alternatives to digital computers to dramatically reduce the energy cost of running state-of-the-art neural networks. Optical matrix-vector multipliers are best suited to performing computations with very large operands, which suggests that large Transformer models could be a good target for optical computing. To test this idea, we performed small-scale optical experiments with a prototype accelerator to demonstrate that Transformer operations can run on optical hardware despite noise and errors. Using simulations, validated by our experiments, we then explored the energy efficiency of optical implementations of Transformers and identified scaling laws for model performance with respect to optical energy usage. We found that the optical energy per multiply-accumulate (MAC) scales as $\frac{1}{d}$ where $d$ is the Transformer width, an asymptotic advantage over digital systems. We conclude that with well-engineered, large-scale optical hardware, it may be possible to achieve a $100 \times$ energy-efficiency advantage for running some of the largest current Transformer models, and that if both the models and the optical hardware are scaled to the quadrillion-parameter regime, optical computers could have a $>8,000\times$ energy-efficiency advantage over state-of-the-art digital-electronic processors that achieve 300 fJ/MAC. We analyzed how these results motivate and inform the construction of future optical accelerators along with optics-amenable deep-learning approaches. With assumptions about future improvements to electronics and Transformer quantization techniques (5$\times$ cheaper memory access, double the digital--analog conversion efficiency, and 4-bit precision), we estimated that optical computers' advantage against current 300-fJ/MAC digital processors could grow to $>100,000\times$.
[ "Maxwell G. Anderson", "Shi-Yuan Ma", "Tianyu Wang", "Logan G. Wright", "Peter L. McMahon" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10360v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10360v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.ET", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.ET", "cs.LG", "cs.NE", "physics.app-ph", "physics.optics" ]
Optical Transformers Maxwell G. Anderson 1 , Shi-Yuan Ma 1 , Tianyu Wang 1 , Logan G. Wright 1 2 , Peter L. McMahon 1 3 Abstract 1. Introduction 3 2 0 2 b e F 0 2 ] T E . s c [ 1 v 0 6 3 0 1 . 2 0 3 2 : v i X r a The rapidly increasing size of deep-learning models has caused renewed and growing interest in alterna- tives to digital electronic computers that could dramati- cally reduce the energy cost of running state-of-the-art neural networks. Optical matrix-vector multipliers are best suited to performing computations with very large operands, which suggests that large Transformer models could be a good target for optical computing. To test this idea, we performed small-scale optical experiments with a prototype accelerator to demonstrate that Trans- former operations can run on optical hardware despite noise and errors. Using simulations, validated by our experiments, we then explored the energy efficiency of optical implementations of Transformers and identified scaling laws for model performance with respect to op- tical energy usage. We found that the optical energy per multiply-accumulate (MAC) scales as 1 d where d is the Transformer width, an asymptotic advantage over the constant per-MAC energy use of digital systems. We conclude that with well-engineered, large-scale op- tical hardware, it may be possible to achieve a 100× energy-efficiency advantage for running some of the largest current Transformer models, and that if both the models and the optical hardware are scaled to the quadrillion-parameter regime, optical computers could have a >8, 000× energy-efficiency advantage over state- of-the-art digital-electronic processors that achieve 300 fJ/MAC. We analyzed how these results motivate and in- form the construction of future optical accelerators along with optics-amenable deep-learning approaches. With assumptions about future improvements to electronics and Transformer quantization techniques (5× cheaper memory access, double the digital–analog conversion efficiency, and 4-bit precision), we estimated that opti- cal computers' advantage against current 300-fJ/MAC digital processors could grow to >100, 000×. 1School of Applied and Engineering Physics, Cornell University, Ithaca, NY 14853, USA 2NTT Physics & Informatics Laboratories, NTT Research, Inc., Sunnyvale, CA 94085, USA 3Kavli Institute at Cornell for Nanoscale Science, Cornell University, Ithaca, NY 14853, USA. Corre- spondence to: Peter L. McMahon <[email protected]>, Maxwell G. Anderson <[email protected]>. Deep learning models' exponentially increasing scale is both a key driver in advancing the state-of-the-art and a cause of growing concern about the energy usage, speed, and therefore practical- ity of massive-scale deep learning. In the past few years, it has been found in particular that Transformer (Vaswani et al., 2017) architectures significantly improve when sized up to billions or even trillions of parameters (Brown et al., 2020; Kaplan et al., 2020; Clark et al., 2022; Hoffmann et al., 2022; Treviso et al., 2022; Zhai et al., 2022), causing an exponential growth of deep learning compute usage (Sanh et al., 2019; Sevilla et al., 2022). These large-scale Transformers achieve ever more impressive re- sults in not only natural language processing, but also in other domains such as computer vision (Dosovitskiy et al., 2021; Liu et al., 2021b), graphs (Kim et al., 2022), and in multi-modal set- tings (Jaegle et al., 2021b;a; Radford et al., 2021; Ramesh et al., 2021; Yu et al., 2022; Reed et al., 2022), making them a popular but expensive solution for many tasks-digital hardware's energy efficiency (ie. per-flop or per-inference cost) has not kept up with the growing FLOP requirements of state-of-the-art deep learning models (Sevilla et al., 2022). They also have transfer learning capabilities (Radford & Narasimhan, 2018; Devlin et al., 2019; Radford et al., 2019; Brown et al., 2020; Lu et al., 2021; Dosovit- skiy et al., 2021), allowing them to easily generalize to specific tasks, in some cases in a zero-shot setting where no further training is necessary (Brown et al., 2020; Ramesh et al., 2021; Lewkowycz et al., 2022). These models' cost and generic machine learning abilities strongly motivate the development of hardware accelerators for efficient and fast inference. In digital electronics, there has already been much effort in creating hardware for deep learning such as GPUs, mobile accelerator chips, FPGAs, and large-scale AI-dedicated accelerator systems (Reuther et al., 2020; Graphcore, 2021; Cere- bras Systems, 2021; Andersch et al., 2022; Habana Labs, 2022). But there is also growing interest in analog computing, where, among various approaches (Sebastian et al., 2020), optical neural networks (ONNs) have been proposed as solutions that may offer superior efficiency and latency over neural-network implementa- tions on digital computers (Caulfield & Dolev, 2010; Wetzstein et al., 2020; Nahmias et al., 2020; Stark et al., 2020; Huang et al., 2021; Shastri et al., 2021). While these analog systems are subject to noise and error, neural network operations can be significantly cheaper when performed optically, often leaving the electrical over- head of loading the weights and data as the main cost, which is Optical Transformers amortized in large linear operations. Ideally, the scaling is asymp- totically better than digital systems in energy per MAC (Hamerly et al., 2019; Wang et al., 2022; Sludds et al., 2022; Nahmias et al., 2020). Thus, acceleration of very wide, large-scale models-such as Transformers-is especially promising. Here we show that Transformers increasingly leverage this scaling. To first demonstrate that Transformers may run on these systems despite their noise and error characteristics, we sampled opera- tions from a real Transformer for language modelling to run on a real spatial light modulator (SLM) based experimental system, and used the results to create a calibrated simulation of a full Transformer running optically. We simulated with systematic er- ror, noise, and imprecision of weights/inputs collected from these experiments and found that Transformers in these conditions still perform nearly as well as those running digitally. We summarize our key contributions as follows: • We demonstrated experimentally that linear operations in Transformers can be accurately run on real optical hardware, despite errors and noise. • Via simulation, we established scaling laws for the perfor- mance and total energy costs of optical Transformers versus the model size and optical energy usage. • We modeled the energy usage of a full ONN accelerator with a design based on our experiments and simulation. • We estimated an orders-of-magnitude energy consumption advantage of optics versus state-of-the-art GPUs. Figure 1. General scheme of an optical neural network (ONN) accel- erator. Data is encoded and fed into the network, and the output is subject to shot noise. There are many experimental realizations of ONN accel- erators such as Mach-Zehnder Interferometer meshes (Shen et al., 2017; Bogaerts et al., 2020), crossbar arrays (Mesaritakis et al., 2013; Feldmann et al., 2021), and wavelength-multiplexed micro-ring weight banks (Tait et al., 2015). In this work, we adopt the free-space multiplier (Wang et al., 2022; Spall et al., 2020; Hayasaki et al., 1992) (top right) to demonstrate Transformer operations in optical experiments and as an example for our simulations, but our findings about Transformers on optical systems apply broadly to many optical-accelerator architectures, including those depicted in the inset. While our experiments and simulations were based on specific hardware as a representative example, our scope here is more general. We are interested in understanding how uniquely optical energy scaling and noise relate to Transformer performance and architecture. As such nearly all our findings apply broadly to linear optical processors, irrespective of their underlying hardware implementation details. 2. Background and Related Work 2.1. Transformer Models Transformers are models for processing sequential data based on multi-head attention. Transformers consist of two-layer feed- forward blocks and multi-head attention (Figure 2) operations. Multi-head attention computes relationships between sequence elements by deriving query, key, and value sequences Q, K, V and computing dot products with a softmax nonlinearity in-between (Vaswani et al., 2017). Transformers also leverage modern design elements such as additive residual skip connections (He et al., 2016) and normalization layers (Ba et al., 2016). A defining feature of Transformers is that entire sequences may be processed in matrix-matrix products in parallel (instead of one token/input at a time). 2.2. Optical Accelerators There are myriad optical accelerator designs for deep learning. Despite their differences, the systems, including ours, have the following typical traits: Acceleration of Linear Operations Researchers have explored a wide variety of controllable optical systems (Figure 1) which ma- nipulate different types of optical modes to effectively implement arbitrary matrix-vector multiplications, vector-vector dot products (Shen et al., 2017; Andregg et al., 2019; Hamerly et al., 2019; Spall et al., 2020; Bogaerts et al., 2020; Wang et al., 2022), or convolutions (Wu et al., 2020; Feldmann et al., 2021; Miscuglio et al., 2020; Xu et al., 2021). These linear operations can be per- formed efficiently and are the bulk of computations needed in neural networks. Device Imprecision and Optical Shot Noise Optical systems are subject to noise in both the actual hardware and from photon detection. Detection of optical intensity in particular is subject to a phenomenon known as shot noise where the detected value is Poisson distributed. Notably, shot noise scales with the number of photons at the output of a dot product operation (ie. the accu- 2 DetectOpticalOutputOpticallyEncodedInputMach-ZehnderInterferometer MeshSpatially-MultiplexedFree-Space Propagation(Our Example System)Crossbar ArrayWavelength-MultiplexedMicro-Ring Weight BanksOptical Matrix-Vector Multiplication Engine Optical Transformers mulated sum of element-wise products): given vectors x and w, with the elements of x encoded as optical intensity, the output Y is distributed as: Y ∼ Poisson(w * x) (1) Thus, optical neural networks are subject to noise which effectively limits the number of distinguishable output levels based on the number of photons used. For other vector or weight encoding schemes such as amplitude or phase encoding, equation 1 should be modified, but the detection is still subject to shot noise. Efficient Photon Usage Shot noise, and therefore an optical dot product's signal-to-noise ratio (SNR, which serves as an effec- tive bit precision) is related to the mean number of photons at the output. The efficiency of photon usage therefore grows with increasing multiply-accumulate operations (MACs): ideally, if the size of a dot product doubles, then each element needs half the photons for roughly constant output precision. The SNR for the Poisson distribution is given by SNR(Y ) = E[Y ] (cid:112)Var[Y ] √ = w * x = (cid:112) E[Y ] (2) which explains this behavior: if the expected size of the output Y is held constant, then the SNR is the same, regardless of the dot product size. Work on ONNs has characterized behavior in various scenarios by considering large operations and the resultant scaling (Hamerly et al., 2019; Nahmias et al., 2020; Wang et al., 2022; Sludds et al., 2022). This efficient scaling is not a guarantee-the required number of photons may be influenced by a model architecture's activation/weight distributions, encoding schemes, precision re- quirements, etc. Optical Neural Network Energy Costs The energy cost of op- tical neural networks is broken down into the optical costs of performing MACs and the electrical costs of loading/detecting data, which are usually dominant. Consider a product between two matrices, A ∈ Rn×d, B ∈ Rd×k. Such a product results in loading (detecting) nd + dk (nk) scalars, and performing ndk MACs. If the energy to electrically load (detect) a scalar is Eload (Edet), and to perform a MAC optically is Eoptical, then the total energy is: transporting it is free optically. What remains is the amount of optical intensity to encode all of the copies, Eoptical, which ideally scales as 1/d. These properties make energy cost disproportional to the number of MACs, ndk. This is an asymptotic advantage over electronic systems: Edigital EONN ∼ min(n, d). Streaming Weights Versus Weights-In-Place There are two approaches for loading weights.Weights-in-place schemes involve loading them once, and re-using them for many inputs. Alter- natively, systems can employ streaming weights where at every computation the required weight matrix is loaded. Our experi- mental system is a weights-in-place scheme. For weights-in-place operations, the advantage scales as just Edigital EONN ∼ d. 2.3. Previous Optical Neural Network Architectures Previous work has considered deep learning models such as MLPs and convolutional networks on benchmark tasks like MNIST (Mis- cuglio et al., 2020; Wang et al., 2022), and simulations of larger convolutional models such as AlexNet (Krizhevsky et al., 2012) on more difficult datasets such as ImageNet (Hamerly et al., 2019). This begs the question of how well newer, larger models perform on optical systems. 3. Optical Transformers We designed models that are intentionally similar to other Trans- formers, with the goal of simulating their behavior (informed by some experimental measurements) and energy consumption on optical hardware. A summary of our approach and model is in Figure 2. 3.1. Architecture and Task We created optical Transformer models with a GPT2-like (Radford et al., 2019) architecture that replaces the GELU (Hendrycks & Gimpel, 2016) activation with ReLU6, which is known to improve low-precision model performance (Krizhevsky, 2010; Howard et al., 2017; Kim et al., 2021). For language modelling, we used the raw Wikitext-103 dataset (Merity et al., 2017). The models we simulated have 12 layers (consisting of multi-head attention and feed-forward blocks), operate on a context length of 1024 tokens, use 12 attention heads, and have embedding dimension d varying from 192 to 1536. The full details of the training technique, architecture, and hyperparameters are in Appendix A. E = (nd + dk)Eload + nkEdet + ndkEoptical (3) 3.2. Transformer Computations on Optical Hardware When both are present, efficient data transport and photon scaling cause optical systems to be asymptotically more efficient than digital electronic ones. Notice that regardless of the number of reuses, all data is only loaded once in Equation 3. That is, a vector only needs to be loaded once to be multiplied with many rows of a weight matrix. This is because copying a vector's data and We adopt as a representative example of an optical accelerator a spatial light modulator (SLM) based system which computes vector-vector dot products (Wang et al., 2022). Vectors are encoded on a display, and copies are shone through the SLM which has varying transmission corresponding to some data (ie. a weight matrix). The outputs of this operation-element-wise products- are collected at detectors as the resultant dot products (Figure 1, 3 Optical Transformers Figure 2. Optical Transformer evaluation: prototype hardware; simulator model; Transformer architecture. Bottom: typical Transformer architecture, but with ReLU6 activation. Top Left: experimental spatial light modulator (SLM)-based accelerator setup. From some layers-marked with a laser icon-we sampled dot products to run on real hardware. Top Middle: Linear operations, in light blue, run on a simulated accelerator with noise/error. Lookup tables (LUT) allow simulation using our setup's supported weight/activation values. Top right: our model of energy consumption for optical accelerators, based on assumptions and results from our experiment/simulations. The model accelerator system consists of random-access memory (RAM), a digital–analog converter (DAC), light modulation (MOD), amplification (AMP), an analog–digital converter (ADC), and an optical component that performs the computations. top right). We ran experiments using a real Transformer's (we used the base- sized model with d = 768) weights in order to characterize the behavior of the system. We collected lookup tables (LUTs)- mappings of how input levels affect the light-and used them to train a "LUT-aware" optical Transformer model to run on the setup. Because our experimental setup is incapable of running the full model due to size/time constraints, we instead sampled vector- vector dot products from different parts of the model (marked with laser icon, Figure 2). This allowed experiments to be run on data with the statistics of a typical model. The resultant noise model, lookup tables, and other details of the setup were used to build a calibrated, accurate simulation of the system, on which we ran full Transformer models and compared behavior with the experiment. The full details of the experiment, dot product sampling, and calibration are in Appendix B. 3.3. Simulation of Transformers on Optical Hardware Informed by our experiments, we constructed simulations of Trans- formers running on an optical accelerator. In particular we aimed to emulate the noise, error, and precision that we observed in order to understand how well full Transformers would perform when running on optical hardware. Hybrid Scheme Pure optical systems cannot easily compute activation or normalization functions. Thus we assumed they are computed digitally, and only simulated linear operations optically. Fortunately, the bulk of Transformer computations are within the layers that can be accelerated optically; even in smaller models, linear computations are the overwhelming majority (Section 4.3). Non-Negative Weights and Inputs An important limitation is that the display and SLM only support positive values. We worked around this by decomposing products into sums/differences of products with non-negative operands. Consider a product between matrices W and X. If we let W+ (X+) and W− (X−) be matrices with only the positive and negative elements of W (X) respectively, then: W X = W+X+ − |W−|X+ − W+|X−| + W−X− (4) The constraint of having all-positive data is present in many but not all optical neural network systems. Device Quantization Actual hardware in an optical setup may only have certain number of representable levels. To emulate this behavior, relevant quantization was applied to the input and weights of the simulated model, and we trained the model using quantization-aware training (Jacob et al., 2018)(QAT). For models 4 LinearLinearLinearLayerNormInput (n x d)Output (n x d)EmbeddingPositional EncodingSoftmaxMatMulAdd...MatMulLinear...LinearReLU6LinearAddLinearSoftmaxLayerNormMulti-Head Attention (MHA) LayerFeed-Forward (MLP) LayerEncoder LayerxL LayersQuantizeor LUTSample NoiseOutputInputExperiment-Informed Accelerator SimulationWeightsLight EncodingDetectionOptical Vector-Vector/Matrix-Vector MultiplicationExperimental AcceleratorONN System Energy ModelOptical ComputationRAMDACMODRAMADCAMPGPT2MT-NLGFuture ModelIncoming LightSLMCamera......Digital OperationRun Experimentallyxh Attention Heads Optical Transformers to run on hardware we used the LUTs. We trained with 8-bit quantization and kept an exponential moving average (EMA) of activation min/max values, or percentile-clipped them. The full details of the scheme are in Appendix A. Systematic Errors Real systems may also have systematic er- rors that limit their effective precision. These are issues like cross- talk or misalignment in spatially multiplexed systems like ours, defects in chip elements in integrated photonic systems, etc. We simulated such a constraint by adding Gaussian noise to simulated model outputs (Figure 2), scaled relative to the mean sizes of the outputs, as this was the noise behavior we observed in the experi- mental system. For example, we might simulate the Transformer with noise at each output equal to 5% of the mean output value. Optical Encoding and Shot Noise To simulate the optical com- putations we encoded the values of activation data as mean optical intensity. The outputs of our model were then subject to simu- lated shot noise (Figure 2), which differs from the "scale-relative- gaussian" systematic error. To do this, outputs were scaled by a number such that the average photon number per feature (pho- tons/MAC) was some target value. Each of these features was used as the mean of a Poisson distribution, from which a sample was drawn. The sampled outputs were then scaled back down to represent neuron values. 4. Results 4.1. Error Tolerance and Simulation Accuracy (Experiments Using Optical Hardware and Comparison to Simulation) We determined experimentally that Transformer operations are able to run on real hardware without severely degraded perfor- mance from systematic errors. In our experiments, as described in Section 3.2, we used high photon numbers and averaged results of multiple runs per dot product in order to eliminate noise, leaving only the hardware's systematic errors. In the bottom four panels of Figure 3 are the histograms of the experimental differences from correct values. The simulated noise distributions (dotted lines) match well with the experimental data, which confirms that they are an accurate representation of the real systematic error behavior. Figure 3 (top) is a map of the performance of the simulated model over different configurations of the mean-relative (in percent) noise at every layer of feed-forward and attention blocks. The model performs well with significant noise (experimental noise levels marked with stars), within 1 perplexity from noise-free perfor- mance unless the noise is very high. The model is more resilient to noise in the attention operations than in the linear layers. These results show that Transformers can run well when subject to the noise of a real accelerator system, and that our digital model of the system is a plausible approximation of how a real one might behave. While we found 8-bit precision to be stable for QAT, the optical Transformer can perform inference at lower precision, as implied Figure 3. Comparison of experimental noise and simulated Optical Transformer noise tolerance. Top: Simulated performance (Wikitext- 103 validation perplexity (PPL), shown as contours) versus percent mean- relative noise in feed-forward (FF) and attention (Attn) layers. Noise levels from experimental data marked with a star for dot products sampled from first and last Transformer encoder layers. Bottom: comparison of simulated noise model to error from experimental data. The Gaussian shape of the simulated noise models the experimental errors accurately. by its error tolerance. To study this further we conducted a simple ablation on the input and output precisions used at inference, on the 8-bit-QAT base-sized model with LUT. The details of this study are in Appendix C. 4.2. Optical Scaling Laws (Simulation) When systematic errors are not the limiting factor in performance, optical shot noise becomes relevant and limits a model's energy efficiency. To study how optical Transformers scale and behave with different optical resources available, we removed any sys- tematic error in our simulations, used the same EMA-style QAT (Jacob et al., 2018) (exponential moving averages maintained for 5 ExperimentExperimental ErrorSimulated NoiseFirst FFσ = 2.09%First Attentionσ = 5.65%20.25Last FFσ = 1.31%Last Attentionσ = 5.99% Optical Transformers Figure 4. Simulations of Optical Transformer behavior with varying photon usage. Left: Wikitext-103 validation-set perplexity (PPL) versus embedding dimension d and total photons used for a single inference (predicting next token in language modelling, or processing one sequence in a classification task). 8-bit digital model performance is shown with dashed lines. With sufficiently large numbers of photons, optical hardware can achieve the same perplexity as digital-electronic hardware, under the assumption that the optical hardware's precision is limited by photon shot noise. Middle: Percent change in perplexity from the perplexity achieved when using 104 photons per multiply-accumulate (MAC), versus photons-per-MAC. At 104 photons-per-MAC, the perplexity is approximately as good as one can achieve, so this plot shows how the perplexity degrades from ideal as one uses fewer photons-per-MAC; the plot exhibits truncated power-law scaling. Right: Scaling of number of photons needed for an Optical Transformer to achieve the same perplexity as an 8-bit digital-electronic processor, versus model size. min/max model statistics) for all models, and observed their be- havior with different photon budgets and simulated shot noise, as described in Section 3.3. Optical Transformers achieve language modelling performance close to their digital counterparts' when shot-noise-limited at mod- est photon budgets. The perplexities on the Wikitext-103 vali- dation set of various optical Transformer models simulated with different total photon usage (amount used for input data) are shown in Figure 4 (left). The curves illustrate a tradeoff: larger models need larger photon totals to function well, and there are different optimal model choices based on the photon budget. We define photons/MAC as the total photon budget (amount at input) divided by total MACs. The percentage difference from the performance at 10K photons/MAC (Figure 4, middle)-chosen to represent an ideal high-precision scenario-is roughly power-law scaled in photons/MAC for all models with truncation near 10K; better performance can be had with more photons, but with diminishing returns, and the performance matches or exceeds that of the 8-bit digital models' when the photon budget is not too low (∼ 102). The models use fewer photons/MAC as they scale, achieving the theoretical efficient scaling where the total per-dot-product photons needed is constant. To study how photon usage scales, we determined how many photons it takes to reach the performance of 8-bit digital models. These values, in Figure 4 (right), decrease nearly as 1 d -the total photons needed per dot product is constant (bottom dashed line). The Transformer architecture clearly takes advantage of efficient optical scaling with larger model sizes. In fact, smaller per-dot-product totals are required for the largest model, suggesting that larger Transformers may require less output precision. This is consistent with other work which found that precision requirements are constant or reduced with scale (Li et al., 2020). Meanwhile, the already low photon usage of the largest model suggests that models larger than our simulations (>10B parameters) may use <1 photon/MAC. This sub-photon operation works in optical systems (Wang et al., 2022; Sludds et al., 2022) and is in essence no different at all from operation at higher photon counts (since the number summed at detection is still high). These empirical scaling results are tied to our specific configura- tions and training strategies. Depending on the scales and dynamic ranges of inputs and weights, different amounts of photons may be transmitted to the output; the statistics of a model affect its efficiency. In Appendix H we explore a different scheme, but the effects of different methods remains an interesting topic for future work. 4.3. Estimated Energy Usage (Simulation) The efficient photon scaling trend we observed in Section 4.2 sug- gests that Transformers running on optical hardware could achieve significant energy efficiency advantages over running on digital hardware. To understand the efficiency of Transformers on optical hardware, we designed an ONN system based on current hardware that is like our experimental setup, with our measured precision and photon scaling. It is an inference system with in-place weights which are loaded once and reused forever, activations read from and written to SRAM for every layer, a 10 GHz light modulator ar- ray, and an optical "core" which can perform 10M multiplications per cycle (this can be thought of as a 10 megapixel SLM). The photon-per-MAC scaling versus model dimension is taken to be 6 Constant photons/MAC Constant dot-product total8-bit PPL Optical Transformers Figure 5. Estimated energy usage of Transformer models on optical hardware for a single inference (predicting the next token in language modelling, or processing one sequence in a classification task). Hypothetical future model designs are labelled FUTURE-*. Estimated energy/MAC for digital systems is based on (Reuther et al., 2020). Trend for energy usage in optical systems (blue) computed based on real models only. Inset: energy advantage of running on optics over estimated NVIDIA A100 usage. The advantage grows with the model compute. M = 106, G = 109, T = 1012, q = 1015 parameters. the 1/d scaling which we found was possible in our simulations, and we assumed that the model operates with 5-bit input precision, 8-bit weight precision, and 7-bit output precision, as determined by our study of low precision performance in Appendix C. We used this model to estimate the costs of running Transformers. We followed the approach in Section 2.2. For electrical energy we calculated the cost of loading and detecting every value in the operation of the model. For attention, weights-in-place is not possible, as the matrix products are between activation data. In this case, a different scheme which can load both operands dynamically (Hamerly et al., 2019) is desirable. In any case, this means that loading and encoding both operands must be counted towards the energy cost. In general, the electrical costs are composed of amplification, modulation, memory access, and digital/analog conversion. The calculation of optical energy is simple: the total number of MACs for a model was computed, and multiplied by the photons/MAC and energy of a photon. The photon usage was assumed to scale according to the constant-per-dot-product rule we verified in our simulations. In Appendix D we detail our method for estimating energy usage, and assumed quantities based on contemporary hardware. As models grow, running Transformers on optical hardware has a large and asymptotic efficiency advantage over running on digital hardware. In Figure 5 we chart estimates of the forward pass energy required for various models1, including a hypothetical family of large, dense Transformer models designed in a similar fashion, which we label FUTURE-*. These represent the sizes of models in ∼ 10-15 years if current design trends hold. For comparison, we also chart various digital systems (Reuther et al., 2020) in different performance regimes, and a hypothetical "next generation" GPU that can use ∼10 fJ/MAC. For small models, the optics-based system uses about the same energy, but eventually gains an advantage that scales asymptotically with the number of MACs. For the larger models, MT-NLG-530B and FUTURE- 4q, the optics-based approach would have ∼140× and ∼8500× energy advantages over the current state-of-the-art GPU (NVIDIA A100) respectively. Breaking down the sources of compute and energy costs in Transformer models running optically illustrates how aspects of model/system design affect energy usage. The breakdown of com- pute and energy costs by source is in Figure 6. We find that as 1The recent PaLM (Chowdhery et al., 2022) models used a modified architecture. For simpler comparison, we make our estimates using a model with GPT-like architecture but with the PaLM model dimensions, which we call PaLM-Like. 7 Optical Transformers models get larger the feed-forward layers require most of the com- putation, but that the energy of data access in attention is still very expensive. This is because of the need to save/load many atten- tion matrices from memory, and the fact that a weights-in-place scheme cannot be used for the matrix-matrix products because the products are between activations. In total, this means that attention layers have high energy costs for small amounts of computation. Existing model design trends have moved towards focusing much harder on feed-forward layers, and so for the largest real (and our hypothetical future) models the fraction of energy cost taken by attention is low. Finally, we note that the operations we assume run on digital computers-such as nonlinear functions, in gray-do not account for much of the total energy cost (though they too are a small fraction of the total compute). As a result the energy scaling of Transformer models is better than what only the favorable photon scaling and free data trans- port would predict; these trends in the design of real models have increasingly favored optics over time. Specifically, attention loads/stores a n × n attention matrix for each of the h attention heads. Since attention heads perform few computations per data access (and MLP layers perform many), models with more MLP compute per attention head have a larger overall ratio of computa- tion to energy usage; larger d h is more efficient. And real models are scaling d h over time: The largest GPT2 (Radford et al., 2019) uses d h = 64, while the larger GPT3 (Brown et al., 2020) variants h = 128. MT-NLG-530b (Smith et al., 2022) uses d use d h = 160. Finally, the recent PaLM (Chowdhery et al., 2022) models use significantly larger d h , up to 384. We further analyze what components of the system affect the energy costs in Appendix E. 5. Discussion The results given in Section 4.3 on optical Transformers' efficiency have implications for the design of future hardware and software systems that might run them. 5.1. Implications for Designing Optical-Neural-Network (ONN) Accelerators A functioning ONN system requires computation units (which we call cores) for performing MACs, detectors, modulators, and memory. We define a core as any component that can perform element-wise products with locally stored/maintained weights in parallel. For example, a 10-megapixel spatial light modulator (SLM)-which can perform 107 scalar multiplications at the same time, if one weight is stored per pixel-could be considered a core. The biggest challenge in creating ONN hardware is in having enough (or large enough) cores, as the number required to run a layer in a single pass scales quadratically with d (since they must maintain all the weights). In Appendix G we examine what specifications might be required to build such a large system. To deal with this enormous hardware requirement, it is possible to introduce new hardware-time-energy tradeoffs. One strategy for doing this is to split up the large weight matrix into several "chunks", and cycle through the chunks on the available cores, computing the MVMs, and collecting the results. This comes at the cost of latency, and requires energy to frequently reload inputs to be reused for more weights. In Appendix G we further explore the consequences of this tradeoff (compare to GPU in the similar case where multiple processors are required). Based on these findings and our energy calculations, we identify areas for future efforts in ONN hardware design: • Once matrix-matrix product operands exceed 104 × 104 in size the advantage is significant, and therefore a future ONN should implement at least this level of parallelism to achieve >100× efficiency improvements over current state-of-the-art GPUs (NVIDIA A100). Systems with many cores could run larger models even more efficiently. For example, a system with ∼3000 cores with 107 weights each could enable dense Transformer models with over 10 trillion parameters to run ∼1000x more efficiently than on a current state-of-the-art electronic processor with an efficiency of ∼300 fJ/MAC (such as an NVIDIA A100 GPU). • Given the assumptions we made about weight-maintenance costs in making our estimates (5.6 μW per weight; see Ap- pendix D), an Optical Transformer would need to operate in the regime where a single matrix-vector multiplication is performed every 0.1 nanoseconds (about 20 TFLOPs of throughput). Arrangements with larger or multiple cores could achieve very large throughput easily, and without data transport energy costs; A system with a hundred large (∼108 weights each) fully-utilized cores could, for example, reach ∼10–100 EFLOPs of throughput. • Compared to our assumptions (Appendix D, based on exist- ing component energy costs and Appendix G for hardware scale requirements), current ONN prototypes either operate at much lower clock rates or at much smaller scale. Thus while we have shown that a system using existing components may achieve our projected 100× advantage, building a full ONN system that is simultaneously fast, large-scale, and efficient is still an open challenge. • Many of the drawbacks and limitations of ONNs could be eliminated if future work finds an easy way to implement optical "memory" for re-reading data. • Weights-in-place (Section 2.2) is a good choice for large- scale neural network designs that are popular today, since their foundation is large linear operations repeated across many tokens/batches. • Because data access costs are the limiting factor in ONN effi- ciency, future improvements in CMOS technology (DAC, ADC, memory access costs in particular) will be greatly beneficial. For example, our future projection of halved 8 Optical Transformers Figure 6. Breakdown of energy costs for Optical Transformers. Left: fraction of total compute used by digital operations, attention (Attn) matrix- matrix multiplications (MM), and feed-forward (FF) components. Feed-forward layers account for most of the compute. Right: breakdown-of-costs for models by layer. The energy costs of attention operations is expensive. "Ele *" operations: electrical costs of loading (Ld), detecting (Dt), or both for data for the operation. Operations related to attention computation (ie. QK T and softmax( QKT√ )V , where dh is the embedding dimension for an dh attention head) are expensive for little compute. Functions computed digitally have their energy costs estimated as the cost of reading and writing to memory the required data. M = 106, G = 109, T = 1012, q = 1015 parameters. DAC/ADC costs and 4-bit inference would roughly double all of our energy advantage estimates. In Appendix F we com- bine this with the assumption that future memory access may be 5× cheaper to show that future optics-based systems might achieve energy advantages of >100, 000× running models the size of FUTURE-4q (over our 300-fJ/MAC state-of-the- art GPU estimate). Note that we are determining the future advantage against current hardware so that the projections can be compared to our estimates in Section 4.3; future electronics improvements would of course also advance the performance of digital systems, but it is clear at least that ONNs benefit from electronics improvements too, even if future GPUs might have advanced significantly from what exists today. Furthermore, since ONN accelerators' (running Transform- ers) energy consumption is never compute-dominated, they stand to benefit at least as much as digital systems from improvements to electronics for efficient data access. 5.2. Scalable Optical Deep Learning Much like how Transformer designs have become increasingly favorable for optics, new approaches for managing large mod- els might solve scalability problems for ONNs. For example, sparse-expert architectures (Fedus et al., 2022; Zoph et al., 2022) shard computations to different parts of the system, avoiding large input communication/reloading costs. Another example is the myriad research investigating how to run large models, including Transformers, at lower precision (Zafrir et al., 2019; Liu et al., 2021c; Bondarenko et al., 2021; Dettmers et al., 2022). This directly benefits ONNs as their energy costs are driven by data access, and cannot operate with high precision. So, while there are speed/energy tradeoffs and communication cost concerns in ONNs, research is already exploring solutions for the analogous problems in digital systems. A prospect for future work, though, is designing and scaling mod- els for optimal efficiency on optical hardware. Presently, there is plenty of work in exploring compute/time/cost tradeoffs on digital hardware, including derivation of sets of scaling laws for how to 9 FFAttn MMDigital Optical Transformers optimally grow models (Tan & Le, 2019; Zhai et al., 2022; Kaplan et al., 2020). For optics-based systems, energy costs per FLOP and per memory access are different and model statistics affect energy usage. Therefore, future work could focus on performing the same kinds of scaling and tradeoff analysis in the context of the new hardware, deriving trends and design patterns for future neural network architectures. We expect that these new trends might result in different recommendations for scaling width over depth, the use of activation functions which shape activation and weight distributions, and so on. For example, if a model is scaled with width, the compute scales quadratically with the amount of data ac- cesses, but only linearly with depth; a single-encoder-layer GPT3 (ie. a model with the same parameter count) running optically could be roughly 20× more efficient; a ∼1600× advantage over GPU instead of ∼80× in our estimations. The tradeoffs between the energy benefits of designing models this way and how well they perform on various tasks is also worth future investigation. Our results and insights on designing deep-learning models for, and running them on, optical hardware can be summarized as follows: • For executing Transformers, optical hardware has an asymp- totic efficiency advantage over digital electronics as model sizes increase - we have shown that Transformers executed optically have a per-MAC energy cost that scales as 1 d (or better) where d is the width of the model. This is not possible in digital systems, where energy per computation is typically constant. • The largest models today are already large enough to ben- efit significantly (>100× estimated efficiency gain running optically over NVIDIA A100 GPU). We project that optical accelerators could have a >8000× energy advantage when running future, larger models. • Many modern deep-learning strategies and architectures (such as Transformers) have implicitly or explicitly been designed to perform well on GPU-based systems by enabling greater parallelism and more efficient use of memory. In the past, models designs were such that operations could not eas- ily be run in parallel, but Transformers sought to make large models run efficiently by exploiting hardware's strengths in perform large, parallel, dense calculations, and improved in this aspect as they scaled. As a consequence, as Transformers (and other deep learning models) continue to be optimized for parallel digital electronic hardware, they will continue to become even more efficient on optical hardware. • Models that perform well at lower precision are maximally beneficial-they are easier to run on noisy, analog optical hardware, and minimize data access costs. • Architectures that perform more computations per data ac- cess will be most energy-efficient. Recent models with a stronger focus on linear operations (Tolstikhin et al., 2021; Liu et al., 2021a) could be promising for optical implementa- tion. More generally, an important direction for future work is to design neural-network architectures that are optimal for optical matrix-vector multipliers, for example by maximizing data reuse. 6. Summary and Conclusion We have demonstrated the ability of Transformer models to run accurately and efficiently on optical hardware through optical ex- periments and numerical simulations. We examined Transformers' scaling behavior with optics and used our findings to show that optical systems have a large and asymptotic energy advantage over digital ones that grows with the model size. For example, we showed that optical hardware may achieve an over 100× energy advantage when running the largest Transformer models today (∼500 billion parameters) and that larger, future Transformers (∼4 quadrillion parameters) may be realized with an >8000× op- tical energy advantage. We then explained how existing trends in the machine-learning community (such as optimizing Transformer designs for better parallelism, and building models that rely more heavily on multi-layer perceptrons within them (Tolstikhin et al., 2021)) are resulting in models that are increasingly better suited for optical hardware than the canonical Transformer model (Vaswani et al., 2017) and previous language models-they involve large, dense, linear calculations to saturate processors' compute capabil- ities without data-access bottlenecks. This is not a coincidence; in general, neural-network models that are designed to be more efficient on digital-electronic hardware by maximizing compute and parallelism per-data-access will be more efficient on optical hardware, where data-access costs are also a primary concern. We discussed what specifications optical hardware would need to meet to realize the projected energy-efficiency advantages for different model sizes. For example, to realize the 100× energy- efficiency advantage for current Transformer models, we project needing optical matrix-vector multipliers each capable of multiply- ing a 104 × 104-dimensional matrix with a 104-dimensional vector at a rate of 1 matrix-vector multiplication every 0.1 nanoseconds, with power consumption of roughly ∼1 pJ/bit for input/output data access and conversion. While existing components are capa- ble of this level of energy-efficiency, there is an open hardware systems-level challenge of making an optical neural network that is simultaneously big, fast, and efficient enough. We also dis- cussed how future architectural changes and improvements to electronics would further improve ONN efficiency-with better model quantization and assumptions about near-future hardware, future Transformers running on optical hardware could exceed a 100,000× energy advantage over current state-of-the-art ∼300- fJ/MAC digital electronics. The efficiency of digital-electronic neural-network accelerators is improving at a rate of ∼10× every 7 years (Shankar & Reuther, 2022), suggesting that even if the proposed optical hardware takes 10 years to develop, there should still be a several-orders-of-magnitude benefit to using optics for neural-network computations when the scaled hardware becomes 10 Optical Transformers available. Furthermore, any improvements to the energy efficiency of electronic memories directly benefits both digital processors and optical processors, so future development of digital proces- sors may only shrink the optics–electronics efficiency gap through improved MAC-computation efficiency, which has proceeded pre- dictably for the past two decades based on transistor scaling (Datta et al., 2022). We believe our findings about the potential energy-efficiency of op- tical accelerator hardware strongly motivate pursuing the develop- ment of optical processors for large-scale deep learning with Trans- formers or other models that heavily rely on weight-stationary matrix-vector multiplication. 7. Acknowledgements The authors wish to thank NTT Research for their financial and technical support. Portions of this work were supported by the National Science Foundation (awards CCF-1918549 and CBET- 2123862) and a David and Lucile Packard Foundation Fellowship. We acknowledge helpful discussions with and feedback from Alen Senanian, Benjamin Malia, Fan Wu, Federico Presutti, Jeremie Laydevant, Sridhar Prabhu, and Vladimir Kremenetski. 8. Author Contributions M.G.A., T.W., L.G.W., and P.L.M. conceived the project. M.G.A., S.M., T.W., L.G.W., and P.L.M. designed the experiments. S.M. performed the dot-product computation experiments on the SLM- based ONN setup. M.G.A. and S.M. analyzed the experimental data. M.G.A. designed and trained the optical Transformer mod- els, and simulated the effects of optical hardware running them. M.G.A. and T.W. created the model of an ONN accelerator for estimating ONN energy consumption for running Transformers. M.G.A., S.M., T.W., L.G.W., and P.L.M. wrote the manuscript. P.L.M. supervised the project. 9. Reproducibility Statement We provide code, data, and instructions to reproduce our results. Our models, configurations, procedures, and assumptions for theo- retical calculations are provided in the appendices. Configurations of optical Transformer models, training hyperparameters, and quantization are available in Appendix A. A description of our experimental procedure including the techniques and components used is in Appendix B. The assumptions we used for our calcula- tion of estimated ONN energy costs are detailed in Appendix D. The assumptions about ONNs, electronic hardware, and model precision for future systems are in Appendix F. We make our code and data available so that all of our analysis can be reproduced. We provide data collected from our experiments, code to estimate energy consumption of ONNs running Transform- ers, and the source code for our training/evaluation/simulations of optical Transformer models. Finally, the release contains code to analyze all of the data and results. Instructions for how to per- form each of these tasks is provided in the README file. All of these materials are available at: https://doi.org/10.5281/ zenodo.7574198. 11 Optical Transformers References Ahmed, M. N., Chong, J., and Ha, D. S. A 100 Gb/s tran- simpedance amplifier in 65 nm CMOS technology for opti- cal communications. In 2014 IEEE International Symposium on Circuits and Systems (ISCAS), pp. 1885–1888, 2014. doi: 10.1109/ISCAS.2014.6865527. Andersch, M., Palmer, G., Krashinsky, R., Stam, N., Mehta, V., Brito, G., and Ramaswamy, S. NVIDIA Technical report, March Hopper architecture in-depth. 2022. URL https://developer.nvidia.com/blog/ nvidia-hopper-architecture-in-depth/. Andregg, W., Andregg, M., Weverka, R. T., and Clermont, L. Wavelength multiplexed matrix-matrix multiplier, April 19 2019. URL https://patents.google.com/patent/ US10274989B2/en. (U.S. Patent No. 10,274,989). U.S. Patent and Trademark Office. Ba, J. L., Kiros, J. R., and Hinton, G. E. Layer normalization, 2016. URL https://arxiv.org/abs/1607.06450. Bandyopadhyay, S., Sludds, A., Krastanov, S., Hamerly, R., Harris, N., Bunandar, D., Streshinsky, M., Hochberg, M., and Englund, D. Single chip photonic deep neural network with accelerated training. arXiv preprint arXiv:2208.01623, 2022. URL https: //doi.org/10.48550/arXiv.2208.01623. Bogaerts, W., Pérez, D., Capmany, J., Miller, D. A. B., Poon, J., Englund, D., Morichetti, F., and Melloni, A. Programmable photonic circuits. Nature, 586(7828):207–216, 2020. URL https://doi.org/10.1038/s41586-020-2764-0. Bondarenko, Y., Nagel, M., and Blankevoort, T. Understand- ing and overcoming the challenges of efficient Transformer quantization. In Proceedings of the 2021 Conference on Em- pirical Methods in Natural Language Processing, pp. 7947– 7969, Online and Punta Cana, Dominican Republic, November 2021. Association for Computational Linguistics. URL https: //aclanthology.org/2021.emnlp-main.627. Brown, T. B., Mann, B., Ryder, N., Subbiah, M., Kaplan, J., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., Agarwal, S., Herbert-Voss, A., Krueger, G., Henighan, T., Child, R., Ramesh, A., Ziegler, D. M., Wu, J., Winter, C., Hesse, C., Chen, M., Sigler, E., Litwin, M., Gray, S., Chess, B., Clark, J., Berner, C., McCandlish, S., Radford, A., Sutskever, I., and Amodei, D. Language models are few-shot learners, 2020. URL https://arxiv.org/abs/2005.14165. Caragiulo, P., Daigle, C., and Murmann, B. DAC performance survey 1996-2020. URL https://github.com/pietro- caragiulo/survey-DAC. Caulfield, H. J. and Dolev, S. Why future supercomputing requires optics. Nature Photonics, 4(5):261–263, 2010. URL https: //doi.org/10.1038/nphoton.2010.94. Cerebras Systems. systems: through a Cerebras dustry best AI performance proach. //8968533.fs1.hubspotusercontent-na1.net/ hubfs/8968533/Whitepapers/Cerebras-CS-2- Whitepaper.pdf. Achieving in- ap- URL https: Technical report, Apr 2021. systems Chowdhery, A., Narang, S., Devlin, J., Bosma, M., Mishra, G., Roberts, A., Barham, P., Chung, H. W., Sutton, C., Gehrmann, S., Schuh, P., Shi, K., Tsvyashchenko, S., Maynez, J., Rao, A., Barnes, P., Tay, Y., Shazeer, N., Prabhakaran, V., Reif, E., Du, N., Hutchinson, B., Pope, R., Bradbury, J., Austin, J., Isard, M., Gur-Ari, G., Yin, P., Duke, T., Levskaya, A., Ghemawat, S., Dev, S., Michalewski, H., Garcia, X., Misra, V., Robinson, K., Fedus, L., Zhou, D., Ippolito, D., Luan, D., Lim, H., Zoph, B., Spiridonov, A., Sepassi, R., Dohan, D., Agrawal, S., Omernick, M., Dai, A. M., Pillai, T. S., Pellat, M., Lewkowycz, A., Moreira, E., Child, R., Polozov, O., Lee, K., Zhou, Z., Wang, X., Saeta, B., Diaz, M., Firat, O., Catasta, M., Wei, J., Meier-Hellstern, K., Eck, D., Dean, J., Petrov, S., and Fiedel, N. PaLM: Scaling language modeling with Pathways, 2022. URL https://arxiv.org/abs/2204.02311. Clark, A., De Las Casas, D., Guy, A., Mensch, A., Paganini, M., Hoffmann, J., Damoc, B., Hechtman, B., Cai, T., Borgeaud, S., Van Den Driessche, G. B., Rutherford, E., Hennigan, T., John- son, M. J., Cassirer, A., Jones, C., Buchatskaya, E., Budden, D., Sifre, L., Osindero, S., Vinyals, O., Ranzato, M., Rae, J., Elsen, E., Kavukcuoglu, K., and Simonyan, K. Unified scaling laws for routed language models. In Chaudhuri, K., Jegelka, S., Song, L., Szepesvari, C., Niu, G., and Sabato, S. (eds.), Proceedings of the 39th International Conference on Machine Learning, volume 162 of Proceedings of Machine Learning Re- search, pp. 4057–4086. PMLR, 17–23 Jul 2022. URL https: //proceedings.mlr.press/v162/clark22a.html. Datta, S., Chakraborty, W., and Radosavljevic, M. Toward attojoule switching energy in logic transistors. Science, 378 (6621):733–740, 2022. doi: 10.1126/science.ade7656. URL https://www.science.org/doi/abs/10.1126/ science.ade7656. Denkinger, B. W., Ponzina, F., Basu, S. S., Bonetti, A., Balási, S., Ruggiero, M., Peón-Quirós, M., Rossi, D., Burg, A., and Atienza, D. Impact of memory voltage scaling on accuracy and resilience of deep learning based edge devices. IEEE Design & Test, 37(2):84–92, 2020. doi: 10.1109/MDAT.2019.2947282. Dettmers, T., Lewis, M., Belkada, Y., and Zettlemoyer, L. LLM.int8(): 8-bit matrix multiplication for Transform- ers at scale, 2022. URL https://arxiv.org/abs/ 2208.07339. Devlin, J., Chang, M.-W., Lee, K., and Toutanova, K. BERT: Pre-training of deep bidirectional transformers for language In Proceedings of the 2019 Conference of understanding. 12 Optical Transformers the North American Chapter of the Association for Com- putational Linguistics: Human Language Technologies, Vol- ume 1 (Long and Short Papers), pp. 4171–4186, Minneapo- lis, Minnesota, June 2019. Association for Computational doi: 10.18653/v1/N19-1423. URL https: Linguistics. //aclanthology.org/N19-1423. Dosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., Dehghani, M., Minderer, M., Heigold, G., Gelly, S., Uszkoreit, J., and Houlsby, N. An image is worth 16x16 words: Transformers for image recognition at scale. ICLR, 2021. Fedus, W., Zoph, B., and Shazeer, N. Switch Transformers: Scaling to trillion parameter models with simple and efficient sparsity. Journal of Machine Learning Research, 23(120): 1–39, 2022. URL http://jmlr.org/papers/v23/21- 0998.html. Feldmann, J., Youngblood, N., Karpov, M., Gehring, H., Li, X., Stappers, M., Le Gallo, M., Fu, X., Lukashchuk, A., Raja, A. S., et al. Parallel convolutional processing using an integrated photonic tensor core. Nature, 589(7840):52–58, 2021. Fu, Y., Bolotin, E., Chatterjee, N., Nellans, D., and Keck- ler, S. W. GPU domain specialization via composable on- package architecture. ACM Trans. Archit. Code Optim., 19 (1), dec 2021. ISSN 1544-3566. doi: 10.1145/3484505. URL https://doi.org/10.1145/3484505. Glorot, X. and Bengio, Y. Understanding the difficulty of train- ing deep feedforward neural networks. In Teh, Y. W. and Titterington, M. (eds.), Proceedings of the Thirteenth Inter- national Conference on Artificial Intelligence and Statistics, volume 9 of Proceedings of Machine Learning Research, pp. 249–256, Chia Laguna Resort, Sardinia, Italy, 13–15 May 2010. PMLR. URL https://proceedings.mlr.press/v9/ glorot10a.html. Graphcore. The data center architecture core computing. https://www.graphcore.ai/hubfs/Graphcore- Mk2-IPU-System-Architecture-GC.pdf. Technical report, Apr 2021. for graph- URL Habana Labs. HABANA® GAUDI®2 white report, pa- URL https: June 2022. Technical per. //habana.ai/wp-content/uploads/pdf/2022/ gaudi2-whitepaper.pdf. Hamerly, R., Bernstein, L., Sludds, A., Soljaˇci ́c, M., and Englund, D. Large-scale optical neural networks based on photoelectric multiplication. Physical Review X, 9(2):021032, 2019. URL https://doi.org/10.1103/PhysRevX.9.021032. Hayasaki, Y., Tohyama, I., Yatagai, T., Mori, M., and Ishihara, S. Optical learning neural network using Selfoc microlens array. Japanese Journal of Applied Physics, 31(5S):1689, 1992. URL https://doi.org/10.1143/JJAP.31.1689. He, K., Zhang, X., Ren, S., and Sun, J. Deep residual learning for image recognition. In 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR). IEEE, June 2016. doi: 10.1109/cvpr.2016.90. URL https://doi.org/10.1109/ cvpr.2016.90. Hendrycks, D. and Gimpel, K. linear units (GELUs), 2016. URL https://arxiv.org/abs/ 1606.08415. Gaussian error Hoffmann, J., Borgeaud, S., Mensch, A., Buchatskaya, E., Cai, T., Rutherford, E., Casas, D. d. L., Hendricks, L. A., Welbl, J., Clark, A., Hennigan, T., Noland, E., Millican, K., Driessche, G. v. d., Damoc, B., Guy, A., Osindero, S., Simonyan, K., Elsen, E., Rae, J. W., Vinyals, O., and Sifre, L. Training compute-optimal large language models, 2022. URL https://arxiv.org/ abs/2203.15556. Howard, A. G., Zhu, M., Chen, B., Kalenichenko, D., Wang, W., Weyand, T., Andreetto, M., and Adam, H. MobileNets: Efficient convolutional neural networks for mobile vision applications. ArXiv, abs/1704.04861, 2017. Huang, C., Sorger, V. J., Miscuglio, M., Al-Qadasi, M., Mukher- jee, A., Lampe, L., Nichols, M., Tait, A. N., de Lima, T. F., Marquez, B. A., Wang, J., Chrostowski, L., Fok, M. P., Brunner, D., Fan, S., Shekhar, S., Prucnal, P. R., and Shastri, B. J. Prospects and applications of photonic neural networks. Advances in Physics: X, 7(1), October 2021. doi: 10.1080/23746149.2021.1981155. URL https: //doi.org/10.1080/23746149.2021.1981155. Jacob, B., Kligys, S., Chen, B., Zhu, M., Tang, M., Howard, A., Adam, H., and Kalenichenko, D. Quantization and training of neural networks for efficient integer-arithmetic-only inference. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2704–2713, 2018. URL https: //doi.org/10.1109/CVPR.2018.00286. Jaegle, A., Borgeaud, S., Alayrac, J.-B., Doersch, C., Ionescu, C., Ding, D., Koppula, S., Zoran, D., Brock, A., Shelhamer, E., Hénaff, O., Botvinick, M. M., Zisserman, A., Vinyals, O., and Carreira, J. Perceiver IO: A general architecture for structured inputs & outputs, 2021a. URL https://arxiv.org/abs/ 2107.14795. Jaegle, A., Gimeno, F., Brock, A., Vinyals, O., Zisserman, A., and Carreira, J. Perceiver: General perception with iterative In Meila, M. and Zhang, T. (eds.), Proceedings attention. of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pp. 4651–4664. PMLR, 18–24 Jul 2021b. URL https:// proceedings.mlr.press/v139/jaegle21a.html. Jouppi, N. P., Hyun Yoon, D., Ashcraft, M., Gottscho, M., Jablin, T. B., Kurian, G., Laudon, J., Li, S., Ma, P., Ma, X., Norrie, T., Patil, N., Prasad, S., Young, C., Zhou, Z., and Patterson, D. Ten 13 Optical Transformers lessons from three generations shaped Google's TPUv4i : In- dustrial product. In 2021 ACM/IEEE 48th Annual International Symposium on Computer Architecture (ISCA), pp. 1–14, 2021. doi: 10.1109/ISCA52012.2021.00010. Liu, Z., Lin, Y., Cao, Y., Hu, H., Wei, Y., Zhang, Z., Lin, S., and Guo, B. Swin transformer: Hierarchical vision transformer using shifted windows. In Proceedings of the IEEE/CVF Inter- national Conference on Computer Vision (ICCV), 2021b. Kaplan, J., McCandlish, S., Henighan, T., Brown, T. B., Chess, B., Child, R., Gray, S., Radford, A., Wu, J., and Amodei, D. Scaling laws for neural language models, 2020. URL https: //arxiv.org/abs/2001.08361. Kim, H., Park, J., Lee, C., and Kim, J.-J. Improving accuracy of binary neural networks using unbalanced activation distribution. In 2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 7858–7867, 2021. doi: 10.1109/ CVPR46437.2021.00777. Kim, J., Nguyen, T. D., Min, S., Cho, S., Lee, M., Lee, H., and Hong, S. Pure Transformers are powerful graph learners. arXiv, abs/2207.02505, 2022. URL https://arxiv.org/abs/ 2207.02505. Krizhevsky, A. Convolutional deep belief networks on cifar- 10. 2010. URL https://www.cs.toronto.edu/~kriz/ conv-cifar10-aug2010.pdf. Krizhevsky, A., Sutskever, I., and Hinton, G. E. Imagenet classification with deep convolutional neural networks. In Pereira, F., Burges, C., Bottou, L., and Weinberger, K. (eds.), Advances in Neural Information Processing Sys- tems, volume 25. Curran Associates, Inc., 2012. URL https://proceedings.neurips.cc/paper/2012/ file/c399862d3b9d6b76c8436e924a68c45b- Paper.pdf. Lewkowycz, A., Andreassen, A., Dohan, D., Dyer, E., Michalewski, H., Ramasesh, V., Slone, A., Anil, C., Schlag, I., Gutman-Solo, T., Wu, Y., Neyshabur, B., Gur-Ari, G., and Misra, V. Solving quantitative reasoning problems with language mod- els, 2022. URL https://arxiv.org/abs/2206.14858. Li, Z., Wallace, E., Shen, S., Lin, K., Keutzer, K., Klein, D., and Gonzalez, J. E. Train large, then compress: Rethinking model size for efficient training and inference of transformers. In Proceedings of the 37th International Conference on Machine Learning, ICML'20. JMLR.org, 2020. Liu, H., Dai, Z., So, D. R., and Le, Q. V. Pay attention to mlps, 2021a. URL https://arxiv.org/abs/2105.08050. Liu, J., Hassanpourghadi, M., and Chen, M. S.-W. A 10GS/s 8b 25fJ/c-s 2850um2 two-step time-domain ADC using delay- tracking pipelined-SAR TDC with 500fs time step in 14nm In 2022 IEEE International Solid- CMOS technology. State Circuits Conference (ISSCC). IEEE, February 2022. doi: 10.1109/isscc42614.2022.9731625. URL https:// doi.org/10.1109/isscc42614.2022.9731625. Liu, Z., Wang, Y., Han, K., Ma, S., and Gao, W. Post-training quantization for vision transformer, 2021c. URL https:// arxiv.org/abs/2106.14156. Loshchilov, I. and Hutter, F. Decoupled weight decay reg- 2019. URL https://openreview.net/ ularization. forum?id=Bkg6RiCqY7. Lu, K., Grover, A., Abbeel, P., and Mordatch, I. Pretrained transformers as universal computation engines. arXiv preprint arXiv:2103.05247, 2021. Merity, S., Xiong, C., Bradbury, J., and Socher, R. Pointer In International Conference on sentinel mixture models. Learning Representations (ICLR), 2017. URL https:// openreview.net/forum?id=Byj72udxe. Mesaritakis, C., Papataxiarhis, V., and Syvridis, D. Micro ring resonators as building blocks for an all-optical high-speed reservoir-computing bit-pattern-recognition system. J. Opt. Soc. Am. B, 30(11):3048–3055, Nov 2013. doi: 10.1364/ JOSAB.30.003048. URL https://opg.optica.org/ josab/abstract.cfm?URI=josab-30-11-3048. Miscuglio, M., Hu, Z., Li, S., George, J. K., Capanna, R., Dalir, H., Bardet, P. M., Gupta, P., and Sorger, V. J. Massively parallel amplitude-only fourier neural network. Optica, 7 (12):1812–1819, 2020. URL https://doi.org/10.1364/ OPTICA.408659. Murmann, B. ADC performance survey 1997-2020. http: //web.stanford.edu/~murmann/adcsurvey.html, 2020. Online Accessed: 2021-02-18. Nahmias, M. A., De Lima, T. F., Tait, A. N., Peng, H.-T., Shas- tri, B. J., and Prucnal, P. R. Photonic multiply-accumulate operations for neural networks. IEEE Journal of Selected Top- ics in Quantum Electronics, 26:1–18, 2020. URL https: //doi.org/10.1109/JSTQE.2019.2941485. Ponzina, F., Peon-Quiros, M., Burg, A., and Atienza, D. E2CNNs: Ensembles of convolutional neural networks to improve robust- ness against memory errors in edge-computing devices. IEEE Transactions on Computers, 70(8):1199–1212, August 2021. doi: 10.1109/tc.2021.3061086. URL https://doi.org/ 10.1109/tc.2021.3061086. Radford, A. and Narasimhan, K. Improving language under- standing by generative pre-training. 2018. URL https: //openai.com/blog/language-unsupervised/. 14 Optical Transformers Radford, A., Wu, J., Child, R., Luan, D., Amodei, D., and Sutskever, I. Language models are unsupervised multitask learn- ers. 2019. URL https://openai.com/blog/better- language-models/. Radford, A., Kim, J. W., Hallacy, C., Ramesh, A., Goh, G., Agarwal, S., Sastry, G., Askell, A., Mishkin, P., Clark, J., Krueger, G., and Sutskever, I. Learning transferable visual models from natural language supervision. In Meila, M. and Zhang, T. (eds.), Proceedings of the 38th International Con- ference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pp. 8748–8763. PMLR, 18–24 Jul 2021. URL https://proceedings.mlr.press/v139/ radford21a.html. Ramesh, A., Pavlov, M., Goh, G., Gray, S., Voss, C., Rad- ford, A., Chen, M., and Sutskever, I. Zero-shot text-to-image generation. In Meila, M. and Zhang, T. (eds.), Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pp. 8821–8831. PMLR, 18–24 Jul 2021. URL https:// proceedings.mlr.press/v139/ramesh21a.html. Reed, S., Zolna, K., Parisotto, E., Colmenarejo, S. G., Novikov, A., Barth-maron, G., Giménez, M., Sulsky, Y., Kay, J., Sprin- genberg, J. T., Eccles, T., Bruce, J., Razavi, A., Edwards, A., Heess, N., Chen, Y., Hadsell, R., Vinyals, O., Bordbar, M., and de Freitas, N. A generalist agent. Transactions on Machine Learning Research, 2022. ISSN 2835-8856. URL https:// openreview.net/forum?id=1ikK0kHjvj. Featured Certification. Reuther, A., Michaleas, P., Jones, M., Gadepally, V., Samsi, S., and Kepner, J. Survey of machine learning accelerators. arXiv:2009.00993, 2020. URL https://arxiv.org/abs/ 2009.00993. Rosset, C. Turing-NLG: A 17-billion-parameter URL language model by Microsoft, https://www.microsoft.com/en-us/research/ blog/turing-nlg-a-17-billion-parameter- language-model-by-microsoft/. Feb 2020. Sanh, V., Debut, L., Chaumond, J., and Wolf, T. DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter. ArXiv, abs/1910.01108, 2019. Sebastian, A., Gallo, M. L., Khaddam-Aljameh, R., and Eleft- heriou, E. Memory devices and applications for in-memory computing. Nature Nanotechnology, 15(7):529–544, March 2020. doi: 10.1038/s41565-020-0655-z. URL https:// doi.org/10.1038/s41565-020-0655-z. Sevilla, J., Heim, L., Ho, A., Besiroglu, T., Hobbhahn, M., and Villalobos, P. Compute trends across three eras of ma- In 2022 International Joint Conference on chine learning. Neural Networks (IJCNN), pp. 1–8, 2022. doi: 10.1109/ IJCNN55064.2022.9891914. Shankar, S. and Reuther, A. Trends in energy estimates for com- puting in AI/machine learning accelerators, supercomputers, and compute-intensive applications. In 2022 IEEE High Per- formance Extreme Computing Conference (HPEC). IEEE, sep 2022. doi: 10.1109/hpec55821.2022.9926296. URL https: //doi.org/10.1109%2Fhpec55821.2022.9926296. Shastri, B. J., Tait, A. N., de Lima, T. F., Pernice, W. H., Bhaskaran, H., Wright, C. D., and Prucnal, P. R. Photonics for artificial intelligence and neuromorphic computing. Nature Photonics, 15(2):102–114, 2021. URL https://doi.org/10.1038/ s41566-020-00754-y. Shen, Y., Harris, N. C., Skirlo, S., Prabhu, M., Baehr-Jones, T., Hochberg, M., Sun, X., Zhao, S., Larochelle, H., Englund, D., and Soljaˇci ́c, M. Deep learning with coherent nanophotonic circuits. Nature Photonics, 11(7):441, 2017. URL https: //doi.org/10.1038/nphoton.2017.93. Shoeybi, M., Patwary, M., Puri, R., LeGresley, P., Casper, J., and Catanzaro, B. Megatron-LM: Training multi-billion parameter language models using model parallelism, 2019. URL https: //arxiv.org/abs/1909.08053. Sludds, A., Bandyopadhyay, S., Chen, Z., Zhong, Z., Cochrane, J., Bernstein, L., Bunandar, D., Dixon, P. B., Hamil- ton, S. A., Streshinsky, M., Novack, A., Baehr-Jones, T., Hochberg, M., Ghobadi, M., Hamerly, R., and Englund, D. Delocalized photonic deep learning on the internet's edge. Science, 378(6617):270–276, 2022. doi: 10.1126/ URL https://www.science.org/ science.abq8271. doi/abs/10.1126/science.abq8271. Smith, S., Patwary, M., Norick, B., LeGresley, P., Rajbhandari, S., Casper, J., Liu, Z., Prabhumoye, S., Zerveas, G., Korthikanti, V., Zhang, E., Child, R., Aminabadi, R. Y., Bernauer, J., Song, X., Shoeybi, M., He, Y., Houston, M., Tiwary, S., and Catanzaro, B. Using DeepSpeed and Megatron to train Megatron-Turing NLG 530B, a large-scale generative language model, 2022. URL https://arxiv.org/abs/2201.11990. Sony Corporation. - Sony Corporation. https://pdf1.alldatasheet.com/datasheet- pdf/view/47550/SONY/LCX027AKB.html. LCX027AKB Datasheet Sony Corporation. (PDF) URL Spall, J., Guo, X., Barrett, T. D., and Lvovsky, A. Fully recon- figurable coherent optical vector–matrix multiplication. Optics Letters, 45(20):5752–5755, 2020. URL https://doi.org/ 10.1364/OL.401675. Stark, P., Horst, F., Dangel, R., Weiss, J., and Offrein, B. J. Op- portunities for integrated photonic neural networks. Nanopho- tonics, 9(13):4221–4232, 2020. URL https://doi.org/ 10.1515/nanoph-2020-0297. 15 Optical Transformers Sze, V., Chen, Y.-H., Yang, T.-J., and Emer, J. S. Efficient processing of deep neural networks: A tutorial and survey. Proceedings of the IEEE, 105(12):2295–2329, 2017. URL https://doi.org/10.1109/JPROC.2017.2761740. Wu, C., Yu, H., Lee, S., Peng, R., Takeuchi, I., and Li, M. Pro- grammable phase-change metasurfaces on waveguides for mul- timode photonic convolutional neural network. arXiv preprint arXiv:2004.10651, 2020. Wuttig, M., Bhaskaran, H., and Taubner, T. Phase-change mate- rials for non-volatile photonic applications. Nature photonics, 11(8):465–476, 2017. URL https://doi.org/10.1038/ nphoton.2017.126. Xu, M., Zhu, Y., Pittalà, F., Tang, J., He, M., Ng, W. C., Wang, J., Ruan, Z., Tang, X., Kuschnerov, M., et al. Dual-polarization thin-film lithium niobate in-phase quadrature modulators for terabit-per-second transmission. Optica, 9(1):61–62, 2022. Xu, X., Tan, M., Corcoran, B., Wu, J., Boes, A., Nguyen, T. G., Chu, S. T., Little, B. E., Hicks, D. G., Morandotti, R., Mitchell, A., and Moss, D. J. 11 TOPS photonic convolutional accel- erator for optical neural networks. Nature, 589(7840):44–51, 2021. URL https://doi.org/10.1038/s41586-020- 03063-0. Yu, J., Wang, Z., Vasudevan, V., Yeung, L., Seyedhosseini, M., and Wu, Y. CoCa: Contrastive captioners are image-text foun- dation models. Transactions on Machine Learning Research, 2022. ISSN 2835-8856. URL https://openreview.net/ forum?id=Ee277P3AYC. Zafrir, O., Boudoukh, G., Izsak, P., and Wasserblat, M. Q8BERT: Quantized 8bit BERT. 2019 Fifth Workshop on Energy Efficient Machine Learning and Cognitive Computing - NeurIPS Edition (EMC2-NIPS), pp. 36–39, 2019. Zhai, X., Kolesnikov, A., Houlsby, N., and Beyer, L. Scaling vision Transformers. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 12104– 12113, June 2022. Zoph, B., Bello, I., Kumar, S., Du, N., Huang, Y., Dean, J., Shazeer, N., and Fedus, W. ST-MoE: Designing stable and transferable sparse expert models, 2022. URL https://arxiv.org/ abs/2202.08906. Tait, A. N., Chang, J., Shastri, B. J., Nahmias, M. A., Demonstration of WDM weighted and Prucnal, P. R. Opt. Ex- addition for principal component analysis. press, 23(10):12758–12765, May 2015. doi: 10.1364/ OE.23.012758. URL https://opg.optica.org/oe/ abstract.cfm?URI=oe-23-10-12758. Tan, M. and Le, Q. EfficientNet: Rethinking model scaling for convolutional neural networks. In Chaudhuri, K. and Salakhut- dinov, R. (eds.), Proceedings of the 36th International Con- ference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pp. 6105–6114. PMLR, 09–15 Jun 2019. URL https://proceedings.mlr.press/v97/ tan19a.html. Tieleman, T., Hinton, G., et al. Lecture 6.5-rmsprop: Divide the gradient by a running average of its recent magnitude. COURS- ERA: Neural networks for machine learning, 4(2):26–31, 2012. Tolstikhin, I., Houlsby, N., Kolesnikov, A., Beyer, L., Zhai, X., Unterthiner, T., Yung, J., Steiner, A., Keysers, D., Uszkoreit, J., Lucic, M., and Dosovitskiy, A. MLP-Mixer: An all-MLP architecture for vision. arXiv preprint arXiv:2105.01601, 2021. Treviso, M., Ji, T., Lee, J.-U., van Aken, B., Cao, Q., Ciosici, M. R., Hassid, M., Heafield, K., Hooker, S., Martins, P. H., Martins, A. F. T., Milder, P., Raffel, C., Simpson, E., Slonim, N., Balasubramanian, N., Derczynski, L., and Schwartz, R. Efficient methods for natural language processing: A survey, 2022. URL https://arxiv.org/abs/2209.00099. Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L. u., and Polosukhin, I. Attention is all you need. In Advances in Neural Information Processing Systems, pp. 5998–6008. Curran Associates, Inc., 2017. URL https://proceedings.neurips.cc/paper/2017/ file/3f5ee243547dee91fbd053c1c4a845aa- Paper.pdf. Wang, T., Ma, S.-Y., Wright, L. G., Onodera, T., Richard, B. C., and McMahon, P. L. An optical neural network using less than 1 photon per multiplication. Nature Communications, 13 (1), January 2022. doi: 10.1038/s41467-021-27774-8. URL https://doi.org/10.1038/s41467-021-27774-8. Wetzstein, G., Ozcan, A., Gigan, S., Fan, S., Englund, D., Soljaˇci ́c, M., Denz, C., Miller, D. A. B., and Psaltis, D. Inference in artificial intelligence with deep optics and photonics. Nature, 588(7836):39–47, Dec 2020. ISSN 1476-4687. doi: 10.1038/ s41586-020-2973-6. URL https://doi.org/10.1038/ s41586-020-2973-6. 16 Optical Transformers Table 1. Model configurations for optical Transformers. M = 106. Non-emb. Params h Model L d n Tiny Small Base Large 1024 1024 1024 1024 192 384 768 1536 12 12 12 12 12 12 12 12 15M 40.6M 123.7M 416.3M Appendices A. Optical Transformer Training Hyperparameters The optical Transformer models were pretrained on the Wikitext- 103 (Merity et al., 2017) dataset and used the same tokenizer as GPT2 (Radford et al., 2019). All models used Xavier uniform initialization (Glorot & Bengio, 2010). The architectures are in Table 1. Embedding layers were initialized with a normal distribution with σ = 0.02. We used the AdamW (Loshchilov & Hutter, 2019) optimizer, with weight decay applied to parameters which were not embedding, gains, or biases. Dropout was applied after every linear layer (including those in attention), as well as on the attention matrix and after the softmax( QKT )V product in the dh attention calculation. The values of the parameters used for the training scheme are in Table 2. √ After pretraining the models were quantized via our 8-bit QAT scheme. For QAT we used the RMSProp optimizer (Tieleman et al., 2012). The parameters we used for the training are in Table 3. To clamp weights and activations we employ two different approaches: first, we kept running statistics of minimum and maximum values with an exponential moving average (EMA, with parameter α) for every layer and use those to clamp. Second, we recorded the minimum/maximum statistic throughout the network for a forward pass to apply a clipping scheme. Specifically, we clamped weights and activations to percentiles of the maximum values collected for each layer. The outputs were either rounded to the nearest integer during QAT, or stochastically rounded to nearby values. Finally, for the Base-sized model we used to run the experiments, we directly used the lookup tables (LUT) instead of "simulating" the quantization of inputs and weights (though outputs are still quantized). Table 4 details our use of these various techniques in the models. For evaluation we used the perplexity (PPL) metric to measure the language modelling performance on Wikitext-103. We evaluated the perplexity over the entire validation set, and ran the model with context length 1024 (the same as in training) and a 1024-token stride length. B. ONN Experimental Procedure B.1. Experimental Setup Our setup is a SLM-based matrix-vector/vector-vector multiplier. The setup is shown in Figure 7 with a simplified illustration in Figure 8, and works as follows: Vectors corresponding to the inputs and weights are rearranged into squares of pixels and loaded onto the display and SLM respectively. They are aligned such that the light from display pixels will reach the corresponding pixels on the SLM. First, light from the display enters into the polarizing beam splitter (PBS), and reaches the SLM through a half-wave plate (HWP) which rotates its polarization. The phase is then modified by the SLM and reflected back through the half-wave plate, rotating the polarization again based on the phase difference. Then, the PBS only admits light of a certain polarization along one of its arms, aimed at a camera for detection. Summation of the output pixels is performed digitally. This SLM–HWP–PBS arrangement effectively creates an amplitude modulating SLM, where the output at each pixel is the element-wise product of the input pixel and corresponding weight pixel. The OLED display has multiple color channels and a broad spec- trum. For easier modulation by the SLM, we used a band-pass filter and only green light. The components we used are: • Organic light-emitting diode (OLED) display (Google Pixel 2016) • Reflective liquid-crystal modulator (1920-500-1100-HDMI, Meadowlark Optics) • Half-wave plate (PH10ME-532, Thorlabs) • Polarizing beam splitter (CCM1-PBS251, Thorlabs) • Zoom lens for imaging onto SLM (Resolv4K, Navitar) • Zoom lens and objective lens for imaging onto detector (1- 81102, Navita and XLFLUOR4x/340, Olympus) • Band-pass filter (FF01-525/15-25, Semroc) • Camera for detection (Prime 95B Scientific CMOS Camera, Teledyne Photometrics) This setup works as a good bench for testing the precision of optical Transformers by performing optical dot products involved in attention and feed-forward layers. Even though the optical dot products were performed one at a time, it is sufficient for showing that Transformer operations can run with the accuracy of ONNs, since matrix-vector and matrix-matrix products are merely collections of many dot products run in parallel. 17 Optical Transformers Table 2. Pretraining hyperparameters for optical Transformer models. All models were trained with the AdamW (Loshchilov & Hutter, 2019) optimizer. Model Steps Batch lr Tiny Small Base Large 90000 90000 90000 90000 32 32 32 32 2e-4 2e-4 2e-4 2e-4 β1 0.9 0.9 0.9 0.9 β2 0.999 0.999 0.999 0.999 (cid:15) Weight decay Dropout Schedule Warmup Stop 1e-8 1e-8 1e-8 1e-8 0.02 0.02 0.02 0.02 0.1 0.1 0.1 0.1 Cosine Cosine Cosine Cosine 2500 2500 2500 2500 - - - 82500 Table 3. Quantization aware training hyperparameters for optical Transformer models. All models were trained with the RMSProp (Tieleman et al., 2012) optimizer. Quantization parameters are in Table. 4. α (cid:15) Weight decay Dropout Schedule Warmup Steps Batch Model Stop lr Tiny Small Base Large 7327 7327 7327 7327 64 64 64 32 1e-5 1e-5 1e-5 1e-5 0.99 0.99 0.99 0.99 1e-8 1e-8 1e-8 1e-8 1e-5 1e-5 1e-5 1e-5 0.1 0.1 0.1 0.1 Cosine Cosine Cosine Cosine 2500 2500 2500 2500 - - 5500 5500 B.2. Calibration and Lookup Tables We used several techniques to reduce errors, map inputs to SLM/display values, and to convert detected outputs back to neural network values. First, we developed a specialized data-pixel encoding scheme to re- duce systematic errors. We noticed that a large source of error was with a limitation of our hardware-in particular the SLM pixels have cross-talk (pixels may affect their neighbors if they have very different values) and misalignment in the experimental setup may lead to corrupted outputs. To help with these issues, we created "macropixels"-each input element (and weight) does not occupy one pixel on the display (SLM) but rather is mapped to a 3x3 grid of pixels, all with the same value. For the attention layers, we used 5x5 macropixels for the results we report, but later discovered that with 3x3 the performance is essentially the same. We also rearranged vectors into square blocks of pixels so that significantly nonzero weights are nearby each other Figure 8. For the vectors to better fit in the center of the field of view (where there is less distortion/misalignment) we computed the dot products using only the 400 largest weight elements (the corresponding input elements are loaded). While this may introduce some inaccuracy in the final results, we found that the benefits of computing the element-wise products more accurately outweigh the drawbacks of pruning the weights; the outputs were still quite accurate to the ground-truth dot-product values (Figure 3). We suspect that this was the case because: • Transformer weights are not entirely dense; some weights were already zero. • Because our setup only supports non-negative data anyway, we use the four-pass approach (Section 3.3). This means that for any given dot product, roughly half the weights and activations will be zero before considering the previously mentioned sparsity. • Meanwhile, a second consequence of this four-pass approach is that roughly half of activations will be zero as well, possibly rendering some of the pruned weights irrelevant. • Transformers still perform well when pruned, and luckily larger models can be pruned more heavily (Li et al., 2020). While our pruning method is quite basic, the number of weights pruned was light (ie. < 75%) compared to what is possible with more advanced methods. This approach was not necessary for attention calculations, since the dot products were sufficiently small to fit them entirely (64 elements). Next, we consider the lookup tables (LUTs) of the display and SLM in the setup. In order to optimize the experimental results, the model used for experiment was trained to be aware of the realistic, discrete mappable values supported by the system. The display has a LUT with 256 unique levels (1000 levels total, but many are the same as others) and the SLM has roughly 128 unique levels (256 total). So they are roughly capable of 7 and 8 bit precision. The SLM also cannot fully extinguish input light-the minimum modulation is 2% of the maximum transmission. Thus, the minimum absolute values of the weights were mapped to 0.02 instead of 0. After applying these approaches, we finally collected the cali- bration curve, which maps the output intensity measurements to neuron values in the neural network and allows us to determine the experimental setup's systematic error. To do this we sampled ran- domly inputs and outputs of the layers we wished to run, computed their dot products both digitally and in experiment, and created a data set of experimental measurements and ground-truth-digital dot-product outputs. We then performed linear regression to find a mapping between experimental output and the correct values, effectively creating another lookup table. Then when future dot products were computed experimentally, the output was passed 18 Optical Transformers Table 4. Hyperparameters for optical Transformer Quantization. We perform QAT with both a percentile-clipping approach and by clamping based on an exponential moving average (EMA) of model statistics with factor γ. For the Base-sized model that is used in our experiments (LUT-Base), we use lookup tables (LUT) for inputs and weights instead of quantization. Model Tiny Small Base Large LUT-Base Tiny Small Base Large Overall Config Precision Rounding 8-bit 8-bit 8-bit 8-bit LUT 8-bit 8-bit 8-bit 8-bit Stochastic Stochastic Stochastic Stochastic Stochastic Deterministic Deterministic Deterministic Deterministic EMA γ - - - - - 0.999 0.999 0.999 0.999 Attention Clipping Input2 Output Input1 Feed-Forward Clipping Input Weights Output 99.99% 99.9% 99.9999% 99.99% 99.9% 99.9999% 99.99% 99.9% 99.9999% 99.99% 99.9% 99.9999% 99.99% 99.9% 99.9999% 99.99% 99.9% 99.9999% 99.99% 99.9% 99.9999% 99.99% 99.9% 99.9999% 99.9999% 99.99% - - - - - - - - 98% - - - - 99% - - - - 99.9999% 99.99% - - - - - - - - to this linear regression model (or it can literally be stored as a lookup table) to get the output. We used many photons and aver- aged outputs across multiple shots for each input, eliminating shot noise-any remaining error in this calibration scheme we defined as the system's systematic error. It is important to note that in general other optical systems might have different causes of error from ours, but the overall accuracy of our system is representative of a typical ONN nowadays. B.3. Model Design Optimization Transformers tend to have large dynamic ranges in their activations and weights (Bondarenko et al., 2021). In particular, we found that systematic error is proportional to some characteristic amplitude of the output. So, because it scales roughly with the sizes of out- puts, having large outlier values can increase the systematic error and worsen the calibration for all other values in the representable range. Furthermore, after quantization in a naive, linear scheme, large outliers mean that huge ranges of outputs which are seldom used are assigned to many of the quantization levels, while the rest of the small, common outputs are squashed into few buckets-so the model precision is poor. This can be an issue when quantiz- ing any deep learning model, but was exacerbated here by those systematic errors and the fact that the lowest levels of the weights are 0.02 and not 0.0. Therefore, we opted for an aggressive clip- ping scheme and the clamped activation ReLU6 when training the model to be run (Appendix A, LUT-base model); they reduce the dynamic range of inputs and weights and we found that they drastically improved the ONN's ability to run Transformer opera- tions with smaller error. Having fewer values in the 0.02 bucket of the SLM LUT also improved QAT training stability significantly. Even though the non-zero light extinction at 0.02 is caused by the specific SLM in our setup, such issues may happen with other optical implementations made of elements with finite extinction or resolution, and here we described a method to mitigate such issues by modifying training methods. B.4. Transformer Dot Product Samples While the speed and parallelism limitation of our setup made it intractable to run an entire Transformer model on it, we attempted to sample dot products to run that were representative of the range of possible activation/weight statistics in the model. That way, our results would be very representative of what running the full model would be like. In particular, we found two ways in which statis- tics throughout the model vary: the statistics change with depth (shallow and deep layers behave differently) and operation type (matrix-matrix multiplication in attention has different statistics from MLP layers). So, given our limited ability to run operations on the setup, we sampled roughly 10000 dot products from the first (QK T ) attention operation and second MLP layer of the first and last encoder layers of the model. The inputs to the whole model were samples from the Wikitext-103 dataset. Our approach captures the range of statistics throughout a model's different com- ponents, over its depth, and when processing a real task's data. The second MLP layer has dot product size 4d, making it the hardest to run experimentally. In sampling the dot products, we tried to sample from both operands equally. For example, one could sample 1000 dot prod- ucts by taking a single input vector and 1000 weight matrix vec- tors, and vice-versa, but choosing random vector pairs captures dot products involving different tokens and weights. This is im- portant because Transformer output sizes, particularly the outlier activation values, are token-dependent (Bondarenko et al., 2021). To maintain this balance, we sample equal rows/columns for both operands. For attention layers we sample 100 from each; For linear layers, we sampled 56 rows from the input data and 200 columns from the weight matrix W T , where the product being computed is xW T . C. Simulated Precision Ablation Study To further study how the optical Transformer can perform infer- ence at lower precisions, we conducted a simple ablation on the 19 Optical Transformers Figure 7. Photo of experimental setup used for running Transformer dot-product operations. Inset: simplified illustration of the experimental system. Spatial light modulator (SLM) + half-wave plate (HWP) + polarizing beam splitter (PBS) arrangement is effectively an amplitude-modulating SLM. The system works as follows: in our experiments, a vector is loaded as pixels on the organic light-emitting diode (OLED) display, and weights on the SLM. The input light enters through the PBS towards the SLM, passing through the HWP twice as the SLM reflects it. The SLM and HWP together rotate the polarization of the light, such that the amount reflected by the PBS towards the detector for each pixel is roughly the product between the pixel value and the corresponding weight on the SLM. The summation of these element-wise products by the detector yields the dot product. The figure is adapted from (Wang et al., 2022) with permission. Table 5. Simulated optical Transformer precision ablation. Input preci- sion is degraded by subsampling from lookup table (LUT), while output is quantized. Input precision is approximate, as LUT has 1000 levels, not 1024. Bold: most compressed model found in our ablation with performance very close to the baseline. Input Precision (LUT) Output Precision Val. Loss ∼ 10 bits ∼ 9 bits ∼ 8 bits ∼ 7 bits ∼ 6 bits ∼ 5 bits ∼ 4 bits ∼ 3 bits ∼ 5 bits ∼ 5 bits ∼ 5 bits ∼ 5 bits 32 bits 32 bits 32 bits 32 bits 32 bits 32 bits 32 bits 32 bits 8 bits 7 bits 6 bits 5 bits 3.0059 3.0057 3.0054 3.0039 3.0034 3.0017 3.0111 3.1223 3.0032 3.0074 3.0335 3.3966 input and output precisions used at inference, on the 8-bit-QAT base-sized model with LUT. We opted to leave the weights at 8-bit precision, since in-place weights are not a significant energy cost, and do not take more space/memory in these analog optical systems. In Table 5 is the performance of the model at lower precisions. With 5-bit input and 7-bit output precision, the model performs as well as the baseline. The reported precision values for the LUT are approximate, since the LUT has 1000 levels instead of 210 = 1024 levels. When using the LUT, it is also not possible to directly change the precision of the input. Instead, we employed a subsampling scheme where the precision is degraded by rounding to every n'th integer level before using the LUT, where n is a power of 2 and represents a reduction in the effective bit precision. The LUT of our display has 1000 levels, some levels have the same value, and we simulate the model without added noise. So we say that the original precision is initially at most 10 bits (210 = 1024). D. ONN Energy Calculation The models we used to estimate the energy use of ONN systems are in Table 6. We used a variety of real models that have been introduced by other works, and then designed our family of hypo- thetical future models FUTURE-* in a similar fashion, keeping a reasonable sequence length, increasing the embedding dimen- sion drastically, and following the trend of recent large models like PaLM (Chowdhery et al., 2022) and MT-NLG (Smith et al., 2022) of increasing the ratio d/h, which results in favorable en- ergy calculations due to the lower fraction of memory operations 20 Optical Transformers Figure 8. Simplified illustration of experimental setup operation. Weights are loaded and rearranged into a block on spatial light modulator (SLM) to prevent crosstalk between pixels of drastically different values. Data is rearranged on display accordingly. Measurements are looked up against calibration curve to obtain the final output value. in attention. The calculation of energy costs for ONNs requires considera- tion of the entire system design and the costs of the surrounding electronics-since the optical computation itself is so cheap the electronics account for nearly all of the energy cost. The way the energy is accounted for is as follows: The energy Eload can be broken down into three components, related to the energy of the cost of reading from memory Eread, digital-to-analog conversion (DAC) EDAC, and modulation to generate the light Emod: Eload = Eread + EDAC + Emod. (5) Detection energy consumption Edet can broken down in a similar fashion, where Edet = Eamp + EADC + Ewrite (6) represent the costs of amplifying the detected signal, performing analog-to-digital conversion, and writing to memory respectively. There is also a cost of maintaining the weights in a weights-in- place system, which we call Emaintain. Because this cost scales per element, it is a per-MAC cost. But based on values from efficient commercial SLM systems, it is sufficiently small (and amortized by a large clock rate) that even the largest models we do estimations for are not bottlenecked. For optical energy, we take 1 eV (single-photon energy at 1240 nm). We started with using our measured 8-bit-performance photon count of 1500/MAC for the smallest model (d = 192) and rescaled the value for larger ones using the constant-per-dot-product trend which we know our simulated models can match or beat. The assumptions we used were that weights would be loaded from off-chip memory like DRAM (in the case of a chunked-weights strategy; for a full weights-in-place, one-shot approach this cost does not exist), and that the system uses large amounts of SRAM for activations (Fu et al., 2021). We assumed that the system only needs 5 bits worth of input precision and 7 bits worth of output precision, per the results of our ablation on the base-sized model. We still assumed 8-bit memory accesses for convenience. The actual costs for the data access and weight maintenance were assumed to be these values: • Eread = 1 pJ/bit for off-chip memory (Sze et al., 2017), and 0.3 pJ/bit for SRAM. The SRAM estimate is based on re- sults for DNN accelerator measurements with 9.55 pJ/32-bit access (Ponzina et al., 2021; Denkinger et al., 2020), and cutting edge/near-future assumptions for data transport from SRAM/cache (Fu et al., 2021). (Jouppi et al., 2021) estimates 14 pJ per 64-bit access, or roughly 0.22 pJ/bit, for a recent TPU architecture. • EDAC = 10 pJ per 5-bit sample @ 10 GHz-this is achievable with 100 mW at 30.1dB SFDR (Caragiulo et al.). • Emod = 1 fJ/bit @ 110 GHz with thin-film lithium-niobate modulators (Xu et al., 2022). • Eamp = 2.4 pJ per access. A transimpedance amplifier can run at 24 mW at 70 GHz (Ahmed et al., 2014). We will just assume 10 GHz. 24mW / 1010 = 2.4 pJ per element. • EADC = 3.17 pJ per 7-bit sample. 10 Ghz, need 7-bits of precision, so 128 conversion steps per sample – Achievable with 24.8 fJ/c-s (Liu et al., 2022) (24.8 fJ × 128 = 3.17 pJ per 7-bit sample). • Ewrite = Eread. Actually, write access was measured to be cheaper than read access in (Denkinger et al., 2020), but we use Ewrite = Eread as a simple, conservative assumption. 21 DisplayAmplitude SLMInput VectorWeightsRearrange to blockElement-wise products summedat detectorOutputCalibration CurveConvert measurement toneuron value Table 6. Designs of models used for energy estimates. Transformers have embedding dimension d, process sequence length n, use h attention heads, and have L layers. M = 106 parameters. Optical Transformers Model n d 1024 GPT2 1024 GPT2 1024 GPT2 1024 GPT2 2048 Megatron 2048 Megatron 2048 Megatron 2048 Megatron 2048 GPT3 2048 GPT3 2048 GPT3 2048 GPT3 2048 GPT3 2048 GPT3 2048 GPT3 GPT3 2048 Turing-NLG 1024 MT-NLG 2048 2048 Chinchilla 2048 Chinchilla 2048 Chinchilla 2048 Chinchilla 2048 Chinchilla 2048 Chinchilla 2048 Chinchilla 2048 PaLM-like 2048 PaLM-like 2048 PaLM-like 768 1024 1280 1600 1536 1920 2304 3072 768 1024 1536 2048 2560 4096 5140 12288 4256 20480 640 1024 1280 1792 2048 3584 8192 4096 8192 18432 FUTURE FUTURE FUTURE FUTURE 2048 2048 2048 2048 40960 81920 163840 655360 h 12 16 20 25 16 20 24 32 12 16 16 24 32 32 40 96 28 128 10 16 10 14 16 28 64 16 32 48 80 128 160 512 L 12 24 36 48 40 54 64 72 32 24 24 24 32 32 40 96 78 105 10 20 24 26 28 40 80 32 64 118 120 200 400 800 Parameters Reference (Radford et al., 2019) (Shoeybi et al., 2019) (Brown et al., 2020) (Rosset, 2020) (Smith et al., 2022) (Hoffmann et al., 2022) (Chowdhery et al., 2022) This work 117M 345M 762M 1.5B 1.2B 2.5B 4.2B 8.3B 125M 350M 760M 1.3B 2.7B 6.7B 13B 175B 17B 530B 73M 305M 552M 1.1B 1.6B 6.8B 70B 8B 62B 540B 2.4T 16T 129T 4q • Emaintain = 0.002 fJ/MAC. Assuming 2W for operation of a 10MP SLM, with inputs shone at 10 GHz (each pixel performs one MAC every cycle). There is not much infor- mation SLM power consumption for maintenance of a fixed pattern on the LCD panel, though more typical LCD displays which update can operate in the ∼1W regime. For example, (Sony Corporation) consumes 30 mW with 180000 pixels, which would scale to 1.67 W with 10MP (at worst, multiple SLMs/LCDs could be used in order to scale up). E. Breakdown-Of-Costs For Estimated ONN Energy Usage In Figure 9 we see that data access costs, that is costs per element loaded/stored in memory, are most expensive. In particular, the cost of ADC and DAC are the leading contributors to the access costs, though since their cost is exponential in the bit precision, one might imagine that a future, optimized Transformer running at lower precision than our 8-bit assumption would have energy costs dominated by the actual SRAM memory costs. Also, for very large models, since the energy from weight maintenance scales with the number of MACs, it eventually will dominate if model sizes scale past that of FUTURE-4q But one might imagine that future hardware would reduce Emaintain through improved electronics or higher clock speeds allowing for lower energy per MAC. Finally, the contribution from optical energy is vanishingly small, a consequence of the efficient photon usage scaling that we found Transformers can leverage. Were it not for this, the cost of actually performing the MACs would be orders of magnitude larger than everything else, resulting in energy usage that scales the same way as digital systems'. 22 Optical Transformers and receiver-less configuration without any amplifier has also been demonstrated (Bandyopadhyay et al., 2022)). Under these assumptions, ONNs become far more efficient, high- lighting that improvements to electronics will impact ONNs, and not just competing digital hardware. The energy scaling (Fig- ure 10) is shifted downward for optics compared to under our previous assumptions, leading to over 1900× and 130, 000× ad- vantages over the current A100 GPU for MT-NLG and FUTURE- 4q models respectively. Of course, by the time this is possible, GPU efficiency will have improved significantly as well, and we are comparing a 4-bit accelerator to the 16-bit performance of the A100. It is difficult to predict the future efficiency of GPUs at lower precision, but it is clear that ONNs can benefit from improvements to electronics and low-precision inference. G. Chunking and Communication Costs in Multi-Processor ONN and GPU Setups Implementation of a real ONN for large models might be diffi- cult because the amount of hardware needed to maintain all the weights is exceedingly large. In Table 7 are the requirements for hardware to run the largest future model. To compute the number of weights/elements, we selected the largest MLP layer in the model, since that requires the most space for weights and activa- tions. While detector and memory requirements are achievable, the number of required cores-each an optical component capable of performing 10M multiplications with weights-is enormous. There are some approaches to remedy this kind of memory issue in both GPUs and ONNs, and we are interested in their hardware- time-energy tradeoffs for ONNs. One solution is to introduce chunking, where only a portion of the weights are loaded at a time, and the inputs are passed through. Then, the amount of time it takes to run is increased by a factor of the number of chunks. This also impacts the optical system's energy advantage over digital ones in two ways. First, the weights must be loaded, but the cost can be amortized via reuse with batched inference. This comes at the expense of latency. This is a new kind of tradeoff, since digital systems cannot reuse weight data for free. Second, for each weight chunk, all inputs must be reloaded; changing the chunk number trades energy efficiency for lower hardware requirements. These energy tradeoffs are illustrated in Figure 11; other factors dominate energy usage until the chunk number is large and chunking becomes the bottleneck. Realizing large models with GPUs will likely also require a multi- GPU strategy, which will incur overhead over the peak perfor- mance of a single GPU. We find that with a simple model of communication costs-modelling the activation reloading in both GPU and ONN systems-that ONNs can retain some of their ad- vantages, dependant on how much system memory (or maximum number of weight elements) is available per-processor. We created a simple model to estimate the cost of this approach in GPU sys- tems. In GPU systems, instead of splitting a model over time, the 23 Figure 9. Breakdown of optical Transformer energy costs by energy type at 8-bit operation. Data access costs are dominant due to the high costs of DAC/ADC, but weight maintenance becomes important for large models. F. Future ONN Energy Consumption As optical accelerators are an emerging technology and as Trans- former models continue to scale over time, it is worth considering how ONNs might improve over the next several years. For exam- ple, an interesting question to ask is how well future ONNs will do by the time it is possible to run a large model like FUTURE-4q. To investigate this, we estimated the energy costs of various Trans- former models running optically again, but with the following changes and assumptions: • Emaintain = 0-Future weights-in-place hardware will need effectively no energy to maintain weight information (for example, one might consider the usage of phase change ma- terials (Wuttig et al., 2017)). • EDAC and EADC are 1/32 the size-we assume that elec- tronics could achieve a 2× improvement in fJ/c-s efficiency, while future advancements in model compression allow for 4- bit Transformer models, which are much cheaper since DAC and ADC costs scale exponentially with the number of bits (Murmann, 2020). • Eread and Estore are 1/5 the size-there is already a growing recognition of the fact that AI accelerators will need high efficiency and large quantities of SRAM and DRAM in the future (Fu et al., 2021; Cerebras Systems, 2021). • Eamp 10× cheaper trans- impedance amplifiers than our conservative estimate here, (there are already cheaper Optical Transformers Figure 10. Energy usage estimates of forward pass for Transformers running on optical hardware, under future electronics energy cost assumptions. The energy advantages over our estimate for the current-day NVIDIA A100 GPU are larger than under our original assumptions (Figure 5). M = 106, G = 109, T = 1012, q = 1015 parameters. model may instead be split over multiple GPUs. This introduces an analogous tradeoff to the activation reloading in ONNs due to communication costs: if each GPU holds some chunk of weights, then after every layer, the outputs of multiplying the inputs with each chunk must be broadcasted to every GPU in an all-to-all fashion. This is in essence an all-reduce operation-after every layer, the outputs from all GPUs must be copied onto all GPUs. In total, this means the total number of activations is loaded k times, where k is the number of GPUs. As a crude but conserva- tive estimate of these costs, we modeled this by taking the cost of running the entire model on one GPU, and then adding the energy cost of loading the activations from DRAM, multiplied by the number of chunks (GPUs). This is likely an underestimate, as broadcasting data across GPUs in a real setup requires sending data electronically over much longer distances than required for DRAM access, which would be expensive. To determine the number of chunks, we tested multiple assump- tions about device memory. We assumed a value for the amount of memory that can be used to store weights and take the total num- ber of weights for each model divided by this memory capacity to determine the number of chunks to be used. With these models, we found that too much chunking is detrimental to ONN performance, but that there is still some energy advantage to be had if it is used sparingly (Figure 11). In Figure 12 (top) are the energy cost estimates assuming a fixed memory of 100M weights (ie. 100MPixel SLM, or RAM with 100MB capcity if each weight is one byte). We assumed that for GPU, the cost of communication is at least that of DRAM-level communication due to the physical distances between GPUs. The curves for GPUs bend upward as the communication costs begin to take over, as do the largest models running optically. The ONNs still maintain an advantage, but the advantage stops growing with model size. Looking at the energy advantage illustrates this idea more clearly: up to a certain model size the advantage is increasing, then as the model size reaches the memory limit it begins to level off, and then the advantage begins to shrink as the cost of chunking takes over. For a small range of model sizes near this peak, the advantage is maintained, suggesting that a small amount of chunking may be useful before it quickly diminishes the energy advantage. The optimal configuration for ONNs, obviously, is to have enough memory (cores which have weights fixed in place) so that chunking is not necessary. When plotting the advantages for larger memories (and therefore fewer chunks), the advantage gets better, and larger models become worthwhile to run. In hindsight this conclusion makes sense: the benefit of ONNs is their ability to copy data ("op- tical fan-out") for free for parallel computation, and so reducing this in favor of repeated memory accesses removes exactly the mechanism that gives optics-based systems their advantages. This also suggests that an "optical memory" from which fixed data can be accessed for free (or significantly less than re-access through 24 Optical Transformers Table 7. Requirements for optical accelerator running feed-forward layer (embedding dimension d, sequence length n) without chunking at 8-bit precision. The requirement of many cores to maintain weights for matrix-vector products (MVM) is high, and we assume the ONN system requires static RAM (SRAM) for saving and loading activations. Input Vector Elements Detectors 2.6 × 106 2.6 × 106 6.55 × 105 6.55 × 105 3.28 × 105 3.28 × 105 1.64 × 105 1.64 × 105 Model FUTURE-4.1q FUTURE-129T FUTURE-16T FUTURE-2.4T PaLM-like-540B 7.37 × 104 8.19 × 104 MT-NLG-530B 4.91 × 104 GPT3-175B General 4d 7.37 × 104 8.19 × 104 4.91 × 104 4d MVM Cores (107 weights each) SRAM (activations) 170,000 11,000 2,700 671 136 168 61 4d2/107 5.37 GB 1.34 GB 671 MB 336 MB 151 MB 168 MB 100 MB 4nd Figure 11. Optical energy advantage vs A100 (FUTURE-4q). When chunking, the cost of loading weights is amortized by increasing batch size, but the overall performance is limited by large numbers of chunks because of input data reloading. electronics) may solve this problem, allowing for more scalable ONN design without huge amounts of hardware for weights. Cur- rently, optics still has an advantage when using multiple cores because in principle the data could be fanned out across cores, while GPUs must pay communication costs in multi-processor se- tups. With a fan-out/fan-in design that can collect/spread a vector across cores, the efficiency of an entirely weights-in-place system is fully that of a single, large core. 25 Single-Pass Optical Transformers Figure 12. Energy estimates assuming a fixed processor memory size and chunking. Top: estimated energy scaling plot for Transformer models running on optical and digital hardware with 100MB of memory. As models get larger, both optical and digital systems have an upward bend in energy consumption trends, driven by communication/input-reloading-from-chunking costs. Bottom: energy advantage scaling for different memory sizes. As the memory increases, there is a maximum energy advantage for optics over NVIDIA A100 and corresponding model size before chunking costs take over. M = 106, G = 109, T = 1012, q = 1015 parameters. 26 100M Weights Memory1G Weights Memory10G Weights Memory100G Weights Memory100M Weights Memory Optical Transformers Figure 13. Behavior of optical Transformer models with varying photon usage with percentile clipping scheme. Left: Wikitext-103 validation set perplexity (PPL) versus embedding dimension d and total photons usage. 8-bit quantized digital model performance levels in dashed lines. Middle: Percent change in perplexity from ideal 10000 photon count performance still exhibits truncated power-law scaling with photons per multiply-accumulate (MAC) operation for all models. Right: Scaling of photon usage for maintaining the 8-bit digital performance versus model size. Dashed lines: constant photons per dot product (optical scaling) and constant photons/MAC analogous to digital scaling. Note that unlike for our results in Figure 4, smaller models beat the constant-dot-product-total scaling, but the largest model exhibits poor efficiency, as the clipping scheme used here was not well suited for it. large model. Of course, this could be improved by designing a better scheme for the largest model such that it requires few photons; these results illustrate how differences in the training and quantization recipe could lead to a variety of outcomes, and efficiency is achievable but not an automatic guarantee for any scheme. H. Effects of Training and Quantization Scheme on Optical Scaling Our results demonstrating favorable scaling of photon usage in Transformers show that they can be optically efficient, but in general the photon usage is affected by the training scheme and other factors like quantization. This is because approaches for optimization quantization, regularization, etc. affect the statistics of weights and activations in the network, which unlike digital systems, are tied to the resource usage. The main example of this is with weights: they are normalized before being loaded onto an ONN accelerator, and so large outliers may lead to many weights being near 0 after normalization-admitting fewer photons through to the detector. This has a direct impact on the output SNR, and so depending on weight statistics more or fewer photons may be needed in order to run at the same precision. To discover how a different scheme might affect photon usage, we analyzed the optical scaling of our quantized optical Transformer models with percentile clipping instead of clamping based on EMA statistics. We applied the same clipping to all models (details in Table 4). These clipped models have familiar trends in their language modelling performance versus photon numbers, but we notice key differences in the photons needed to maintain 8-bit digital performance: first, the absolute number of photons needed for the smaller models (120 and 40 versus 340 and 170 of our unclipped scheme for d = 192, 384) is much lower-this indicates that clipping of large weight values leads to more transmission after normalization. Second, the scaling is inconsistent, with smaller models needing significantly fewer photons than the expected 1/d scaling, but then requiring many photons again for the largest mode. The clipping scheme degraded the performance of the 27 Constant photons/MAC Constant photon totalUnfavorable Clipping
http://arxiv.org/abs/2302.10359v3
2023-10-27T00:14:27
2023-02-20T23:29:43
Replicable Clustering
We design replicable algorithms in the context of statistical clustering under the recently introduced notion of replicability from Impagliazzo et al. [2022]. According to this definition, a clustering algorithm is replicable if, with high probability, its output induces the exact same partition of the sample space after two executions on different inputs drawn from the same distribution, when its internal randomness is shared across the executions. We propose such algorithms for the statistical $k$-medians, statistical $k$-means, and statistical $k$-centers problems by utilizing approximation routines for their combinatorial counterparts in a black-box manner. In particular, we demonstrate a replicable $O(1)$-approximation algorithm for statistical Euclidean $k$-medians ($k$-means) with $\operatorname{poly}(d)$ sample complexity. We also describe an $O(1)$-approximation algorithm with an additional $O(1)$-additive error for statistical Euclidean $k$-centers, albeit with $\exp(d)$ sample complexity. In addition, we provide experiments on synthetic distributions in 2D using the $k$-means++ implementation from sklearn as a black-box that validate our theoretical results.
[ "Hossein Esfandiari", "Amin Karbasi", "Vahab Mirrokni", "Grigoris Velegkas", "Felix Zhou" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10359v3", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10359v3", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.DS" ]
3 2 0 2 t c O 7 2 ] G L . s c [ 3 v 9 5 3 0 1 . 2 0 3 2 : v i X r a Replicable Clustering∗ Hossein Esfandiari Google Research [email protected] Amin Karbasi Yale University, Google Research [email protected] Vahab Mirrokni Google Research [email protected] Grigoris Velegkas Yale University [email protected] Felix Zhou Yale University [email protected] Abstract We design replicable algorithms in the context of statistical clustering under the recently introduced notion of replicability from Impagliazzo et al. [2022]. Accord- ing to this definition, a clustering algorithm is replicable if, with high probability, its output induces the exact same partition of the sample space after two exe- cutions on different inputs drawn from the same distribution, when its internal randomness is shared across the executions. We propose such algorithms for the statistical k-medians, statistical k-means, and statistical k-centers problems by utilizing approximation routines for their combinatorial counterparts in a black-box In particular, we demonstrate a replicable O(1)-approximation algo- manner. rithm for statistical Euclidean k-medians (k-means) with ̃O(poly(k, d)klog log k) sample complexity. We also describe an O(1)-approximation algorithm with an additional O(1)-additive error for statistical Euclidean k-centers, albeit with ̃O(poly(k) exp(d)) sample complexity. In addition, we provide experiments on synthetic distributions in 2D using the k-means++ implementation from sklearn as a black-box that validate our theoretical results2. 1 Introduction The unprecedented increase in the amount of data that is available to researchers across many different scientific areas has led to the study and development of automated data analysis methods. One fundamental category of such methods is unsupervised learning which aims to identify some inherent structure in unlabeled data. Perhaps the most well-studied way to do that is by grouping together data that share similar characteristics. As a result, clustering algorithms have become one of the central objects of study in unsupervised learning. Despite a very long line of work studying such algorithms, e.g. Jain and Dubes [1988], Hart et al. [2000], Anderberg [2014], there is not an agreed-upon definition that quantifies the quality of a clustering solution. Kleinberg [2002] showed that there is an inherent reason why this is the case: it is impossible to design a clustering function that satisfies three natural properties, namely scale-invariance, richness of solutions, and consistency. This means that the algorithm designer needs to balance several conflicting desiderata. As a result, the radically different approaches that scientists use depending on their application domain can be sensitive to several factors such as their random initialization, the measure of similarity of the data, the presence of noise in the measurements, and the existence of outliers in the dataset. All these issues give rise to algorithms whose results are not replicable, i.e., when we execute them on two different samples of the same population, they output solutions that vary significantly. This begs the ∗Authors are listed alphabetically. 2https://anonymous.4open.science/r/replicable_clustering_experiments-E380 37th Conference on Neural Information Processing Systems (NeurIPS 2023). following question. Since the goal of clustering algorithms is to reveal properties of the underlying population, how can we trust and utilize their results when they fail to pass this simple test? Replicability is imperative in making sure that scientific findings are both valid and reliable. Re- searchers have an obligation to provide coherent results and conclusions across multiple repetitions of the same experiment. Shockingly, a 2016 survey that appeared in Nature [Baker, 2016] revealed that 70% of researchers tried, but were unable to, replicate the findings of another researcher and more than 50% of them believe there is a significant crisis in replicability. Unsurprisingly, similar worries have been echoed in the subfields of machine learning and data science [Pineau et al., 2019, 2021]. In this work, we initiate the study of replicability in clustering, which is one of the canonical problems of unsupervised learning. 1.1 Related Works Statistical Clustering. The most relevant previous results for (non-replicable) statistical clustering was established by Ben-David [2007], who designed O(1)-approximation algorithms for statistical k-medians (k-means) with O(k) sample complexity. However, their algorithm picks centers from within the samples and is therefore non-replicable. Combinatorial Clustering. The flavor of clustering most studied in the approximation algorithms literature is the setting where we have a uniform distribution over finite points and the algorithm has explicit access to the entire distribution. Our algorithms rely on having black-box access to a combinatorial clustering oracle. See Byrka et al. [2017], Ahmadian et al. [2019] for the current best polynomial-time approximation algorithms for combinatorial k-medians (k-means) in general metrics with approximation ratio 2.675 (9). Also, see Cohen-Addad et al. [2022] for a 2.406 (5.912) approximation algorithm for the combinatorial Euclidean k-medians (k-means). Clustering Stability. Stability in clustering has been studied both from a practical and a theoretical point of view [Ben-Hur et al., 2001, Lange et al., 2004, Von Luxburg and Ben-David, 2005, Ben-David et al., 2006, Rakhlin and Caponnetto, 2006, Ben-David et al., 2007, Von Luxburg et al., 2010]. In most applications, it is up to the algorithm designer to decide upon the value of k, i.e., the number of different clusters. Thus, it was proposed that a necessary condition it should satisfy is that it leads to solutions that are not very far apart under resampling of the input data [Ben-Hur et al., 2001, Lange et al., 2004]. However, it was shown that this notion of stability for center-based clustering is heavily based on symmetries within the data which may be unrelated to clustering parameters [Ben-David et al., 2006]. Our results differ from this line of work in that we require the output across two separate samples to be exactly the same with high probability, when the randomness is shared. Moreover, our work reaffirms Ben-David et al. [2006] in that their notion of stability can be perfectly attained no matter the choice of k. Other notions of stability related to our work include robust hierarchical clustering [Balcan et al., 2014], robust online clustering [Lattanzi et al., 2021], average sensitivity [Yoshida and Ito, 2022], and differentially private (DP) clustering [Cohen et al., 2021, Ghazi et al., 2020]. The definition of replicability we use is statistical and relies on an underlying data distribution while (DP) provides a worst-case combinatorial guarantee for two runs of the algorithm on neighboring datasets. Bun et al. [2023], Kalavasis et al. [2023] provide connections between DP and replicability for statistical learning problems. However, these transformations are not computationally efficient. It would be interesting to come up with computationally efficient reductions between replicable and DP clustering algorithms. Coresets for Clustering. A long line of work has focused on developing strong coresets for various flavors of centroid-based clustering problems. See Sohler and Woodruff [2018] for an overview of this rich line of work. The most relevant for our results include coresets for dynamic geometric streams through hierarchical grids [Frahling and Sohler, 2005] and sampling based techniques [Ben-David, 2007, Feldman and Langberg, 2011, Bachem et al., 2018]. Dimensionality Reduction. Dimensionality reduction for clustering has been a popular area of study as it reduces both the time and space complexity of existing algorithms. The line of work on data-oblivious dimensionality reduction for k-means clustering was initiated by Boutsidis et al. [2010]. The goal is to approximately preserve the cost of all clustering solutions after passing the data through a dimensionality reduction map. This result was later improved and generalized to (k, p)-clustering [Cohen et al., 2015, Becchetti et al., 2019], culminating in the work of Makarychev 2 et al. [2019], whose bound on the target dimension is sharp up to a factor of log 1/ε. While Charikar and Waingarten [2022] overcome this factor, their result only preserves the cost across the optimal solution. Replicability in ML. Our results extend the recently initiated line of work on designing provably replicable learning algorithms under the definition that was introduced by Impagliazzo et al. [2022]. Later, Esfandiari et al. [2022] considered a natural adaption of this definition to the setting of bandits and designed replicable algorithms that have small regret. A slightly different notion of replicability in optimization was studied in Ahn et al. [2022], where it is required that an optimization algorithm that uses noisy operations during its execution, e.g., noisy gradient evaluations, outputs solutions that are close when executed twice. Subsequently, Bun et al. [2023], Kalavasis et al. [2023] established strong connections between replicability and other notions of algorithmic stability. Recently, Dixon et al. [2023], Chase et al. [2023] proposed a weaker notion of replicability where the algorithm is not required to output the same solution across two executions, but its output needs to fall into a small list of solutions. 2 Setting & Notation Let X ⊆ Rd be the instance space endowed with a metric κ : X × X → R+ and P be a distribution on X which generates the i.i.d. samples that the learner observes. For F ⊆ Rd and x ∈ X , we overload the notation and write F (x) := argminf ∈F κ(x, f ) to be the closest point to x in F as well as κ(x, F ) := κ(x, F (x)) to be the shortest distance from x to a point in F . We assume that X is a subset of Bd, the d-dimensional κ-ball of diameter 1 centered about the origin3. We also assume that κ is induced by some norm ∥*∥ on Rd that is sign-invariant (invariant to changing the sign of a coordinate) and normalized (the canonical basis has unit length). Under these assumptions, the unit ball of κ is a subset of [−1, 1]d. Our setting captures a large family of norms, including the lp-norms, Top-l norms (sum of l largest coordinates in absolute value), and ordered norms (non-negative linear combinations of Top-l norms) [Chakrabarty and Swamy, 2019]. Our results hold for more general classes of norms but for the sake of simplicity, we abide by these assumptions. We define ∆ := sup{κ(x, y) : x, y ∈ [0, 1)d} to be the κ-diameter of the unit hypercube. Note that 1 ≤ ∆ ≤ d by assumption. Moreover, L∆ is the κ-diameter of a hypercube with side length L. For example, if ∥*∥ = ∥*∥2 is the Euclidean norm, then ∆ = √ d. 2.1 Clustering Methods and Generalizations We now introduce the clustering objectives that we study in this work, which all fall in the category of minimizing a cost function cost : F → R+, where F := {F ⊆ Bd : |F | = k}. We write cost(F ) to denote the objective in the statistical setting and (cid:100)cost(F ) for the combinatorial setting in order to distinguish the two. Problem 2.1 (Statistical (k, p)-Clustering). Given i.i.d. samples from a distribution P on X ⊆ Bd, minimize cost(F ) := Ex∼Pκ(x, F )p. In other words, we need to partition the points into k clusters so that the expected distance of a point to the center of its cluster, measured by κ(*, *)p, is minimized. This is closely related to the well-studied combinatorial variant of the (k, p)-clustering problem. Problem 2.2 ((k, p)-Clustering). Given some points x1, . . . , xn ∈ X , minimize (cid:100)cost(F ) := 1 n i=1 κ(xi, F )p. (cid:80)n We note that (statistical) k-medians and (statistical) k-means is a special case of Problem 2.2 (Problem 2.1) with p = 1, 2, respectively. We also consider a slight variant of the combinatorial problem, i.e., Problem 2.2, where we allow different points xi to participate with different weights wi in the objective. We refer to this problem as the weighted (k, p)-clustering problem. 3Our results can be generalized to κ-balls of diameter L with an arbitrary center through translation and scaling. 3 We now shift our attention to the k-centers problem. Problem 2.3 (Statistical k-Centers). Given i.i.d. samples from a distribution P on X ⊆ Bd, minimize cost(F ) := maxx∈X κ(x, F ). Notice that the l∞ norm is the limit of the lp norm as p tends to infinity, hence k-centers is, in some sense, the limit of (k, p)-clustering as p tends to infinity. Also, notice that this problem differs from k-means and k-medians in the sense that it has a min-max flavor, whereas the other two are concerned with minimizing some expected values. Due to this difference, we need to treat k-centers separately from the other two problems, and we need to make some assumptions in order to be able to solve it from samples (cf. Assumption F.1, Assumption F.2). We elaborate more on that later. Let us also recall the combinatorial version of k-centers. Problem 2.4 (k-Centers). Given some points x1, . . . , xn ∈ X , minimize (cid:100)cost(F ) maxi∈[n] κ(xi, F ). := We remark that clustering has mainly been studied from the combinatorial point of view, where the distribution is the uniform distribution over some finite points and we are provided the entire distribution. The statistical clustering setting generalizes to arbitrary distributions with only sample access. We emphasize that although we only have access to samples, our output should be a good solution for the entire distribution and not just the observed data. We write FOPT to denote an optimal solution for the entire distribution and OPT := cost(FOPT). Similarly, we write (cid:98)FOPT to denote an optimal sample solution and (cid:91)OPT := (cid:100)cost( (cid:98)FOPT). Suppose we solve Problem 2.4 given a sample of size n from Problem 2.3. Then (cid:91)OPT ≤ OPT since we are optimizing over a subset of the points. Recall that a β-approximate solution F is one which has cost cost(F ) ≤ β OPT. Note this is with respect to the statistical version of our problems. An algorithm that outputs β-approximate solutions is known as a β-approximation algorithm. We also say that F is a (β, B)-approximate solution if cost(F ) ≤ β OPT +B. 2.1.1 Parameters p and κ Here we clarify the difference between p and κ, which are two separate entities in the cost function Ex [κ(x, F (x))p]. We denote by κ the distance metric used to measure the similarity between points. The most commonly studied and applied option is the Euclidean distance for which our algorithms are the most sample-efficient. On the other hand, p is the exponent to which we raise the distances when computing the cost of a clustering. A smaller choice of p puts less emphasis on points that are far away from centers and p = 1 seeks to control the average distance to the nearest center. A large choice of p puts emphasis on points that are further away from centers and as p tends to infinity, the objective is biased towards solutions minimizing the maximum distance to the nearest center. Thus we can think of k-centers as (k, p)-clustering when p = ∞. As a concrete example, when κ is the Euclidean distance and p = 5, the cost function becomes Ex ∥x − F (x)∥5 2 (cid:105) (cid:104) . 2.2 Replicability Throughout this work, we study replicability4 as an algorithmic property using the definition of Impagliazzo et al. [2022]. Definition 2.5 (Replicable Algorithm; [Impagliazzo et al., 2022]). Let ρ ∈ (0, 1). A randomized algorithm A is ρ-replicable if for two sequences of n i.i.d. samples ̄X, ̄Y generated from some distribution Pn and a random binary string ̄r ∼ R(X ), P ̄X, ̄Y ∼Pn, ̄r∼R(X ){A( ̄X; ̄r) = A( ̄Y ; ̄r)} ≥ 1 − ρ, . In the above definition, we treat A as a randomized mapping to solutions of the clustering problem. Thus, even when ̄X is fixed, A( ̄X) should be thought of as random variable, whereas A( ̄X; ̄r) is the realization of this variable given the (fixed) ̄X, ̄r. We should think of ̄r as the shared randomness 4Originally this definition was called reproducibility [Impagliazzo et al., 2022] but it was later pointed out that the correct term is replicability [Ahn et al., 2022]. 4 between the two executions. In practice, it can be implemented as a shared random seed. We underline that sharing the randomness across executions is crucial for the development of our algorithms. We also note that by doing that we couple the two random variables A( ̄X), A( ̄Y ), whose realization depends on r ∼ R(X ). Thus, if their realizations are equal with high probability under this coupling, it means that the distributions of A( ̄X), A( ̄Y ) are statistically close. This connection is discussed further in Kalavasis et al. [2023]. In the context of a clustering algorithm A, we interpret the output A( ̄X; ̄r) as a clustering function f : X → [k] which partitions the support of P. The definition of ρ-replicability demands that f is the same with probability at least 1 − ρ across two executions. We note that in the case of centroid-based clustering such as k-medians and k-means, the induced partition is a function of the centers and thus it is sufficient to output the exact same centers with probability 1 − ρ across two executions. However, we also allow for algorithms that create partitions implicitly without computing their centers explicitly. Our goal is to develop replicable clustering algorithms for k-medians, k-means, and k-centers, which necessitates that the centers we choose are arbitrary points within Rd and not only points among the samples. We underline that as in the case of differential privacy, it is trivial to design algorithms that satisfy the replicability property, e.g. we can let A be the constant mapping. The catch is that these algorithms do not achieve any utility. In this work, we are interested in designing replicable clustering algorithms whose utility is competitive with their non-replicable counterparts. 3 Main Results In this section, we informally state our results for replicable statistical k-medians ((k, 1)-clustering), k-means ((k, 2)-clustering), and k-centers under general distances. Unfortunately, generality comes at the cost of exponential dependency on the dimension d. We also state our results for replicable statistical k-medians and k-means specifically under the Euclidean distance, which has a polynomial dependency on d. Two key ingredients is the uniform convergence of (k, p)-clustering costs (cf. Theorem C.9) as well as a data-oblivious dimensionality reduction technique for (k, p)-clustering in the distributional setting (cf. Theorem E.10). These results may be of independent interest. We emphasize that the Euclidean k-median and k-means are the most studied and applied flavors of clustering, thus the sample complexity for the general case and the restriction to p = 1, 2 does not diminish the applicability of our approach. The main bottleneck in reducing the sample complexity for general norms is the lack of a data- oblivious dimensionality reduction scheme. This bottleneck is not unique to replicability and such a scheme for general norms would be immediately useful for many distance-based problems including clustering. It may be possible to extend our results to general (k, p)-clustering beyond p = 1, 2. The main challenge is to develop an approximate triangle inequality for p-th powers of norms. Again, this limitation is not due to replicability but rather the technique of hierarchical grids. It is a limitation shared by Frahling and Sohler [2005]. Before stating our results, we reiterate that the support of our domain X is a subset of the unit-diameter κ-ball Bd. In particular, we have that OPT ≤ 1. Theorem 3.1 (Informal). Let ε, ρ ∈ (0, 1). Given black-box access to a β-approximation oracle for weighted k-medians, respectively weighted k-means (cf. Problem 2.2), there is a ρ-replicable algorithm for statistical k-medians, respectively k-means (cf. Problem 2.1), such that with probability at least 0.99, it outputs a (1 + ε)β-approximation. Moreover, the algorithm has sample complexity (cid:32) ̃O poly (cid:18) k ρ OPT (cid:19) (cid:18) 2∆ ε (cid:19)O(d)(cid:33) . When we are working in Euclidean space, we can get improved results for these problems. Theorem 3.2 (Informal). Let ρ ∈ (0, 1). Suppose we are provided with black-box access to a β-approximation oracle for weighted Euclidean k-medians (k-means). Then there is a ρ-replicable algorithm that partitions the input space so with probability at least 0.99, the cost of the partition is 5 at most O(β OPT). Moreover, the algorithm has sample complexity (cid:19)O(log log(k/ρ))(cid:33) (cid:32) ̃O poly (cid:18) d OPT (cid:19) (cid:18) k ρ . We underline that in this setting we compute an implicit solution to Problem 2.1, since we do not output k centers. Instead, we output a function f that takes as input a point x ∈ X and outputs the label of the cluster it belongs to in polynomial time. The replicability guarantee states that, with probability 1 − ρ, the function will be the same across two executions. The combinatorial k-medians (k-means) problem where the centers are restricted to be points of the input is a well-studied problem from the perspective of polynomial-time constant-factor approximation algorithms. See Byrka et al. [2017], Ahmadian et al. [2019] for the current best polynomial-time approximation algorithms for combinatorial k-medians (k-means) in general metrics with approximation ratio 2.675 (9). Also, see Cohen-Addad et al. [2022] for a 2.406 (5.912) approximation algorithm for the combinatorial Euclidean k-medians (k-means). As we alluded to before, in order to solve k-centers from samples, we need to make an additional assumption. Essentially, Assumption F.2 states that there is a (β, B)-approximate solution F , such that, with some constant probability, e.g. 0.99, when we draw n samples from P we will observe at least one sample from each cluster of F . Theorem 3.3 (Informal). Let c ∈ (0, 1). Given black-box access to a ( ˆβ, ˆB)-approximation oracle for k-centers (cf. Problem 2.4) and under Assumption F.2, there is a ρ-replicable algorithm for statistical k-centers (cf. Problem 2.3), that outputs a (O(β + ˆβ), O(B + (cid:98)B + (β + ˆβ + 1)c)∆)-approximate solution with probability at least 0.99. Moreover, it has sample complexity (cid:32) ̃O n2k (1/c)3d ρ2q2 (cid:33) . Recall that there is a simple greedy 2-approximation for the sample k-center problem whose approxi- mation ratio cannot be improved unless P = NP [Hochbaum and Shmoys, 1985]. We defer the discussion around k-centers to Appendix F. In particular, see Theorem F.8 in Appendix F for the formal statement of Theorem 3.3. 4 Overview of (k, p)-Clustering In this section, we present our approach to the (k, p)-clustering problem. First, we replicably approximate the distribution with a finite set of points by extending the approach of Frahling and Sohler [2005] to the distributional setting. Then, we solve the combinatorial (k, p)-clustering problem on this coreset using an approximation oracle in a black-box manner. In the following subsections, we give a more detailed overview for each step of our approach. For the full proofs and technical details, we kindly refer the reader to Appendix D.4 - D.6. In summary: 1) Replicably build a variant of a quad tree [Finkel and Bentley, 1974] (cf. Section 4.2). 2) Replicably produce a weighted coreset using the quad tree (cf. Section 4.1). 3) Apply the optimization oracle for the combinatorial problem on the coreset. For general norms, this approach leads to an exponential dependence on d. However, we are able to handle the case of Euclidean distances by extending existing dimensionality reduction techniques for sample Euclidean (k, p)-clustering [Makarychev et al., 2019] to the distributional case (cf. Section 5). Thus, for the widely used Euclidean norm, our algorithm has poly(d) sample complexity. 4.1 Coresets Definition 4.1 ((Strong) Coresets). For a distribution P with support X ⊆ Bd and ε ∈ (0, 1), a (strong) ε-coreset for X is a distribution P′ on X ′ ⊆ Bd which satisfies (1 − ε) * Ex∼Pκ(x, F )p ≤ Ex′∼P′ [κ(x′, F )p] ≤ (1 + ε) * Ex∼Pκ(x, F )p for every set of centers F ⊆ Bd, |F | = k. 6 Essentially, coresets help us approximate the true cost on the distribution P by considering another distribution P′ whose support X ′ can be arbitrarily smaller than the support of P. Inspired by Frahling and Sohler [2005], the idea is to replicably consolidate our distribution P through some mapping R : X → X whose image has small cardinality |R(X )| << ∞ so that for any set of centers F , (1 − ε)Exκ(x, F )p ≤ Exκ(R(x), F )p ≤ (1 + ε)Exκ(x, F )p , where ε ∈ (0, 1) is some error parameter. In other words, (PR, R(X )) is an ε-coreset. Note that given the function R, we can replicably estimate the probability mass at each point in R(X ) and then apply a weighted (k, p)-clustering algorithm. 4.2 Replicable Quad Tree We now explain how to replicably obtain the mapping R : X → X by building upon the work of Frahling and Sohler [2005]. The pseudocode of the approach is provided in Algorithm 4.1. While Frahling and Sohler [2005] present their algorithm using hierarchical grids, we take an alternative presentation using the quad tree [Finkel and Bentley, 1974], which could be of independent interest. First, we recall the construction of a standard quad tree in dimension d. Suppose we have a set of n points in [−1/2, 1/2]d. The quad tree is a tree whose nodes represent hypercubes containing points and can be built recursively as follows: The root represents the cell [−1/2, 1/2]d and contains all points. If a node contains more than one point, we split the cell it represents into 2d disjoint, equally sized cells. For each non-empty cell, we add it as a child of the current node and recurse into it. The recursion stops when a node contains only 1 point. In the distributional setting, the stopping criterion is either when the diameter of a node is less than some length or when the node contains less than some mass, where both quantities are a function of the depth of the node. See Algorithm 4.1. A quad tree implicitly defines a function R : X → X as follows. Given a point x ∈ X and the root node of our tree, while the current node has a child, go to the child containing x if such a child exists, otherwise, go to any child. At a leaf node, output the center of the cell the leaf represents. Intuitively, the quad tree consolidates regions of the sample space into single points. The construction can be made replicable since the decision to continue the recursion or not is the only statistical operation and is essentially a heavy-hitters operations which can be performed in a replicable fasion. Let Gi denote the union of all 2id possible cells at the i-th level. We write Pi to denote the discretized distribution to Gi. In other words, Pi = P|σ(Gi) is the restriction of P to the smallest σ-algebra containing Gi. Moreover, we write Λ to denote a replicable estimate of OPT with relative error ε, say 1/β(1+ε) OPT ≤ Λ ≤ (1 + ε) OPT for some absolute constant β ≥ 1. We demonstrate how to obtain such a replicable estimate in Appendix D.5. Algorithm 4.1 Replicable Quad Tree 1: rQuadTree(distribution P, accuracy ε, exponent p, replicability ρ, confidence δ): 2: Init the node on the first level Z[0] ← (cid:8)[−1/2, 1/2]d(cid:9). 3: for depth i ← 1; Z[i − 1] ̸= ∅ AND (2−i+1∆)p > εΛ/5; i ← i + 1 do {Pi is the discretized distribution over 2id cells on the i-th layer} 4: {γ is a parameter to be determined later.} 5: {t is an upper bound on the number of layers.} 6: 2−pi , v Compute H = rHeavyHitters for node Z ∈ Z[i − 1] do Pi, v = γ*Λ 2 , ρ t , δ 7: (cid:16) (cid:17) t for heavy hitter cells H ∈ H such that H ⊆ Z do children(Z) ← children(Z) ∪ {H} Z[i] ← Z[i] ∪ {H}. 8: 9: 10: 11: 12: 13: 14: end for 15: Output root node. end for end for Our technique differs from that of Frahling and Sohler [2005] in at least three ways. Firstly, they performed their analysis for finite, uniform distributions with access to the entire distribution, while 7 our results hold assuming only sample access to a general bounded distribution5. Secondly, Frahling and Sohler [2005] bound the number of layers as a function of the cardinality of the support. For us, this necessitates the extra termination condition when the side lengths of our grids fall below a fraction of Λ as our distribution may have infinite support. Finally, Frahling and Sohler [2005] estimate OPT by enumerating powers of 2. This suffices for their setting since their distributions are discrete and bounded. However, we require a more nuanced approach (cf. Appendix D.5) as we do not have a lower bound for OPT. We tackle this by showing uniform convergence of the clustering solution costs, which we establish via metric entropy and Rademacher complexity (cf. Appendix C). 4.3 Putting it Together Once we have produced the function R implicitly through a quad tree, there is still the matter of extracting a replicable solution from a finite distribution. We can accomplish this by replicably estimating the probability mass at each point of R(X ) and solving an instance of the weighted sample k-medians (k-means). This leads to the following results. For details, see Appendix D.4 - D.6. Theorem 4.2 (Theorem 3.1; Formal). Let ε, ρ ∈ (0, 1) and δ ∈ (0, ρ/3). Given black-box access to a β-approximation oracle for weighted k-medians (cf. Problem 2.2), there is a ρ-replicable algorithm for statistical k-medians (cf. Problem 2.1) such that, with probability at least 1 − δ, it outputs a (1 + ε)β-approximation. Moreover, it has sample complexity (cid:18)(cid:18) ̃O k2d2 ε12ρ6 * OPT12 + k3218d∆3d+3 ρ2ε3d+5 * OPT3 (cid:19) log (cid:19) . 1 δ Theorem 4.3 (Theorem 3.1; Formal). Given black-box access to a β-approximation oracle for weighted k-means (cf. Problem 2.2), there is a ρ-replicable algorithm for statistical k-means (cf. Problem 2.1) such that, with probability at least 1 − δ, it replicably outputs a (1 + ε)β-approximation. Moreover, it has sample complexity (cid:18)(cid:18) ̃O k2d2 ε12ρ6 * OPT12 + k3239d∆3d+6 ρ2ε6d+8 * OPT3 (cid:19) log (cid:19) . 1 δ 5 The Euclidean Metric, Dimensionality Reduction, and (k, p)-Clustering In this section, we focus on the Euclidean metric κ(y, z) := ∥y − z∥2 and show how the sample complexity for Euclidean (k, p)-clustering can be made polynomial in the ambient dimension d. Note that results for dimensionality reduction exist for the combinatorial Euclidean (k, p)-clustering problem [Charikar and Waingarten, 2022, Makarychev et al., 2019]. However, these do not extend trivially to the distributional case. We remark that we require our dimensionality reduction maps to be data-oblivious since we are constrained by replicability requirements. The cornerstone result in dimensionality reduction for Euclidean distance is the Johnson-Lindenstrauss lemma (cf. Theorem E.1), which states that there is a distribution over linear maps πd,m from Rd → Rm that approximately preserves the norm of any x ∈ Rd with constant probability for some target dimension m. In Makarychev et al. [2019], the authors prove Theorem E.4, which roughly states that it suffices to take m = ̃O(p4/ε2 log(1/δ)) in order to preserve (k, p)-clustering costs when the domain is finite. Firstly, we extend Theorem E.4 to the distributional setting by implicitly approximating the distribution with a weighted ε-net. Then, we implicitly map the ε-net onto the low-dimensional space and solve the clustering problem there. An important complication we need to overcome is that this mapping preserves the costs that correspond to partitions6 of the data and not arbitrary solutions. Because of that, it is not clear how we can "lift" the solution from the low-dimensional space to the original space. Thus, instead of outputting k points that correspond to the centers of the clusters, our algorithm outputs a clustering function f : X → [k], which takes as input a point x ∈ X and returns the label of the cluster it belongs to. The replicability guarantees of the algorithm state that, with probability 1 − ρ, it will output the same function across two executions. In Appendix E.4, we describe this function. We emphasize that for each x ∈ X , the running time of f is polynomial in k, d, p, 1/ε, log(1/δ). Essentially, this function maps x onto the low-dimensional 5Our results also generalize to unbounded distributions with sufficiently small tails 6Roughly speaking, a solution corresponds to a partition when the center of each cluster is its center of mass. 8 space using the same projection map π as our algorithm and then finds the nearest center of π(x) in the low-dimensional space. For full details, we refer the reader to Appendix E.3. We are now ready to state the result formally. Theorem 5.1 (Theorem 3.2; Formal). Let ε, ρ ∈ (0, 1) and δ ∈ (0, ρ/3). Given a β-approximation oracle for weighted Euclidean k-medians (k-means), there is a ρ-replicable algorithm that outputs a clustering function such that with probability at least 1 − δ, the cost of the partition is at most (1 + ε)β OPT. Moreover, the algorithm has sample complexity (cid:32) ̃O poly (cid:18) kd ρ OPT (cid:1). where m = O (cid:0) 1 ε2 log k δε (cid:19) (cid:18) 2 √ (cid:19)O(m) (cid:33) , 1 δ log m ε 6 Running Time for (k, p)-Clustering All of our algorithms terminate in O(poly(n)) time where n denotes the sample complexity. See Table A.1 for more detailed time complexity of each stage of our approach. Moreover, we make O(log(β/(ε OPT))) calls to the β-approximation oracle for the combinatorial (k, p)-clustering problem within our OPT estimation subroutine and then one more call to the oracle in order to output a solution on the coreset. 7 Replicable k-Centers Due to space limitations, we briefly sketch our approach for the k-centers problem and kindly refer the reader to Appendix F. As explained before, the assumptions we make in this setting state that there exists some "good" solution, so that when we draw n i.i.d. samples from P we observe at least one sample from each cluster, with constant probability. We first take a fixed grid of side c in order to cover the unit-diameter ball. Then, we sample sufficiently many points from P. Subsequently, we "round" all the points of the sample to the centers of the cells of the grid that they fall into and estimate the probability mass of every cell. In order to ensure replicability, we take a random threshold from a predefined interval and discard the points from all the cells whose mass falls below the threshold. Finally, we call the approximation oracle using the points that remain. Unlike the (k, p)-clustering problem (cf. Problem 2.1), to the best of our knowledge, there does not exist any dimensionality reduction techniques that apply to the k-centers problem. The main result is formally stated in Theorem F.8. 8 Experiments We now provide a practical demonstration7 of the replicability of our approach on synthetic data in 2D. In Figure 8.1, we leverage the sklearn [Pedregosa et al., 2011] implementation of the popular k-means++ algorithm for k = 3 and compare the output across two executions on the two moons distribution. In the first experiment, we do not perform any preprocessing and run k-means++ as is, resulting in different centers across two executions. In the second experiment, we compute a replicable coreset for the two moons distribution before running k-means++ on the coreset. This leads to the same centers being outputted across the executions. Note that the computation for the coreset is performed independently for each execution, albeit with a shared random seed for the internal randomness. See also Figure 8.2 for the results of a similar experiment on a mixture of truncated Gaussian distributions. 7https://anonymous.4open.science/r/replicable_clustering_experiments-E380 9 Figure 8.1: The results of running vanilla vs replicable k-Means++ on the two moons distribution for k = 3. Figure 8.2: The results of running vanilla vs replicable k-Means++ on a mixture of truncated Gaussians distributions for k = 3. 9 Conclusion & Future Work In this work, we designed replicable algorithms with strong performance guarantees using black-box access to approximation oracles for their combinatorial counterparts. There are many follow-up research directions that this work can lead to. For instance, our coreset algorithm adapts the coreset algorithm of Frahling and Sohler [2005] by viewing their algorithm as a series of heavy hitter estimations that can be made replicable. it may be possible to interpret more recent approaches for coreset estimation as a series of statistical operations to be made replicable in order to get replicable algorithms in the statistical (k, p)-clustering setting [Hu et al., 2018]. It would also be interesting to examine the sensitivity of (replicable) clustering algorithms to the choice of parameters such as the choice of exponent in the cost function or the measure of similarity of the data. Another relevant direction is to explore sample complexity lower ounds for statistical clustering, where little is known even in the non-replicable setting. Acknowledgments and Disclosure of Funding Amin Karbasi acknowledges funding in direct support of this work from NSF (IIS-1845032), ONR (N00014-19-1-2406), and the AI Institute for Learning-Enabled Optimization at Scale (TILOS). Grigoris Velegkas is supported by TILOS, the Onassis Foundation, and the Bodossaki Foundation. Felix Zhou is supported by TILOS. 10 References Sara Ahmadian, Ashkan Norouzi-Fard, Ola Svensson, and Justin Ward. Better guarantees for k- means and euclidean k-median by primal-dual algorithms. SIAM Journal on Computing, 49(4): FOCS17–97, 2019. Kwangjun Ahn, Prateek Jain, Ziwei Ji, Satyen Kale, Praneeth Netrapalli, and Gil I Shamir. Repro- ducibility in optimization: Theoretical framework and limits. arXiv preprint arXiv:2202.04598, 2022. Michael R Anderberg. Cluster analysis for applications: probability and mathematical statistics: a series of monographs and textbooks, volume 19. Academic press, 2014. Olivier Bachem, Mario Lucic, and Andreas Krause. Scalable k-means clustering via lightweight coresets. In Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 1119–1127, 2018. Monya Baker. 1,500 scientists lift the lid on reproducibility. Nature, 533(7604), 2016. Maria-Florina Balcan, Yingyu Liang, and Pramod Gupta. Robust hierarchical clustering. The Journal of Machine Learning Research, 15(1):3831–3871, 2014. Luca Becchetti, Marc Bury, Vincent Cohen-Addad, Fabrizio Grandoni, and Chris Schwiegelshohn. Oblivious dimension reduction for k-means: beyond subspaces and the johnson-lindenstrauss lemma. In Proceedings of the 51st annual ACM SIGACT symposium on theory of computing, pages 1039–1050, 2019. Shai Ben-David. A framework for statistical clustering with constant time approximation algorithms for k-median and k-means clustering. Machine Learning, 66(2):243–257, 2007. Shai Ben-David, Ulrike Von Luxburg, and D ́avid P ́al. A sober look at clustering stability. International conference on computational learning theory, pages 5–19. Springer, 2006. In Shai Ben-David, D ́avid P ́al, and Hans Ulrich Simon. Stability of k-means clustering. In International conference on computational learning theory, pages 20–34. Springer, 2007. Asa Ben-Hur, Andre Elisseeff, and Isabelle Guyon. A stability based method for discovering structure in clustered data. In Biocomputing 2002, pages 6–17. World Scientific, 2001. Christos Boutsidis, Anastasios Zouzias, and Petros Drineas. Random projections for k-means clustering. Advances in neural information processing systems, 23, 2010. Mark Bun, Marco Gaboardi, Max Hopkins, Russell Impagliazzo, Rex Lei, Toniann Pitassi, Jessica Sorrell, and Satchit Sivakumar. Stability is stable: Connections between replicability, privacy, and adaptive generalization. arXiv preprint arXiv:2303.12921, 2023. Jarosław Byrka, Thomas Pensyl, Bartosz Rybicki, Aravind Srinivasan, and Khoa Trinh. An improved approximation for k-median and positive correlation in budgeted optimization. ACM Transactions on Algorithms (TALG), 13(2):1–31, 2017. Bernd Carl and Irmtraud Stephani. Entropy, compactness and the approximation of operators. Cambridge University Press, 1990. Deeparnab Chakrabarty and Chaitanya Swamy. Approximation algorithms for minimum norm and ordered optimization problems. In Proceedings of the 51st Annual ACM SIGACT Symposium on Theory of Computing, pages 126–137, 2019. Moses Charikar and Erik Waingarten. The johnson-lindenstrauss lemma for clustering and subspace approximation: From coresets to dimension reduction. arXiv preprint arXiv:2205.00371, 2022. Zachary Chase, Shay Moran, and Amir Yehudayoff. Replicability and stability in learning. arXiv preprint arXiv:2304.03757, 2023. Edith Cohen, Haim Kaplan, Yishay Mansour, Uri Stemmer, and Eliad Tsfadia. Differentially-private clustering of easy instances. In International Conference on Machine Learning, pages 2049–2059. PMLR, 2021. 11 Michael B Cohen, Sam Elder, Cameron Musco, Christopher Musco, and Madalina Persu. Dimen- sionality reduction for k-means clustering and low rank approximation. In Proceedings of the forty-seventh annual ACM symposium on Theory of computing, pages 163–172, 2015. Vincent Cohen-Addad, Hossein Esfandiari, Vahab Mirrokni, and Shyam Narayanan. Improved approximations for euclidean k-means and k-median, via nested quasi-independent sets. arXiv preprint arXiv:2204.04828, 2022. Ronald A DeVore and George G Lorentz. Constructive approximation, volume 303. Springer Science & Business Media, 1993. Peter Dixon, A Pavan, Jason Vander Woude, and NV Vinodchandran. List and certificate complexities in replicable learning. arXiv preprint arXiv:2304.02240, 2023. Hossein Esfandiari, Alkis Kalavasis, Amin Karbasi, Andreas Krause, Vahab Mirrokni, and Grigoris Velegkas. Reproducible bandits. arXiv preprint arXiv:2210.01898, 2022. Dan Feldman and Michael Langberg. A unified framework for approximating and clustering data. In Proceedings of the forty-third annual ACM symposium on Theory of computing, pages 569–578, 2011. Raphael A Finkel and Jon Louis Bentley. Quad trees a data structure for retrieval on composite keys. Acta informatica, 4:1–9, 1974. Gereon Frahling and Christian Sohler. Coresets in dynamic geometric data streams. In Proceedings of the thirty-seventh annual ACM symposium on Theory of computing, pages 209–217, 2005. Badih Ghazi, Ravi Kumar, and Pasin Manurangsi. Differentially private clustering: Tight approxima- tion ratios. Advances in Neural Information Processing Systems, 33:4040–4054, 2020. Peter E Hart, David G Stork, and Richard O Duda. Pattern classification. Wiley Hoboken, 2000. Dorit S Hochbaum and David B Shmoys. A best possible heuristic for the k-center problem. Mathematics of operations research, 10(2):180–184, 1985. Wei Hu, Zhao Song, Lin F Yang, and Peilin Zhong. Nearly optimal dynamic k-means clustering for high-dimensional data. arXiv preprint arXiv:1802.00459, 2018. Russell Impagliazzo, Rex Lei, Toniann Pitassi, and Jessica Sorrell. Reproducibility in learning. arXiv preprint arXiv:2201.08430, 2022. Anil K Jain and Richard C Dubes. Algorithms for clustering data. Prentice-Hall, Inc., 1988. Svante Janson. Tail bounds for sums of geometric and exponential variables. Statistics & Probability Letters, 135:1–6, 2018. William B Johnson. Extensions of lipschitz mappings into a hilbert space. Contemp. Math., 26: 189–206, 1984. Alkis Kalavasis, Amin Karbasi, Shay Moran, and Grigoris Velegkas. Statistical indistinguishability of learning algorithms. arXiv preprint arXiv:2305.14311, 2023. Michael Kearns. Efficient noise-tolerant learning from statistical queries. Journal of the ACM (JACM), 45(6):983–1006, 1998. Jon Kleinberg. An impossibility theorem for clustering. Advances in neural information processing systems, 15, 2002. Tilman Lange, Volker Roth, Mikio L Braun, and Joachim M Buhmann. Stability-based validation of clustering solutions. Neural computation, 16(6):1299–1323, 2004. Silvio Lattanzi, Benjamin Moseley, Sergei Vassilvitskii, Yuyan Wang, and Rudy Zhou. Robust online correlation clustering. Advances in Neural Information Processing Systems, 34:4688–4698, 2021. Michel Ledoux and Michel Talagrand. Probability in Banach Spaces: isoperimetry and processes, volume 23. Springer Science & Business Media, 1991. 12 Konstantin Makarychev, Yury Makarychev, and Ilya Razenshteyn. Performance of johnson- lindenstrauss transform for k-means and k-medians clustering. In Proceedings of the 51st Annual ACM SIGACT Symposium on Theory of Computing, pages 1027–1038, 2019. Vitali D Milman and Gideon Schechtman. Asymptotic Theory of Finite Dimensional Normed Spaced, volume 1200. Springer Berlin, 1986. F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Pretten- hofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011. Joelle Pineau, Koustuv Sinha, Genevieve Fried, Rosemary Nan Ke, and Hugo Larochelle. Iclr reproducibility challenge 2019. ReScience C, 5(2):5, 2019. Joelle Pineau, Philippe Vincent-Lamarre, Koustuv Sinha, Vincent Larivi`ere, Alina Beygelzimer, Florence d'Alch ́e Buc, Emily Fox, and Hugo Larochelle. Improving reproducibility in machine learning research: a report from the neurips 2019 reproducibility program. Journal of Machine Learning Research, 22, 2021. Gilles Pisier. The volume of convex bodies and Banach space geometry, volume 94. Cambridge University Press, 1999. Alexander Rakhlin and Andrea Caponnetto. Stability of k-means clustering. Advances in neural information processing systems, 19, 2006. Christian Sohler and David P Woodruff. Strong coresets for k-median and subspace approximation: Goodbye dimension. In 2018 IEEE 59th Annual Symposium on Foundations of Computer Science (FOCS), pages 802–813. IEEE, 2018. AW van der Vaart and Jon A Wellner. Weak convergence and empirical processes with applications to statistics. Journal of the Royal Statistical Society-Series A Statistics in Society, 160(3):596–608, 1997. Ulrike Von Luxburg and Shai Ben-David. Towards a statistical theory of clustering. In Pascal workshop on statistics and optimization of clustering, pages 20–26. London, UK, 2005. Ulrike Von Luxburg et al. Clustering stability: an overview. Foundations and Trends® in Machine Learning, 2(3):235–274, 2010. Martin J Wainwright. High-dimensional statistics: A non-asymptotic viewpoint, volume 48. Cam- bridge University Press, 2019. Yuichi Yoshida and Shinji Ito. Average sensitivity of euclidean k-clustering. In Advances in Neural Information Processing Systems, 2022. 13 A Tables We present the running times required for our sub-routines in order to ensure each stage is ρ-replicable and succeeds with probability at least 0.99. The overall output is a constant ratio approximation for Euclidean k-medians (k-means). Table A.1: Running Time Overview for Euclidean k-Medians (k-Means) ALGORITHM OPT ESTIMATION DIMENSIONALITY REDUCTION CORESET PROBABILITY MASS ESTIMATION RUNNING TIME ̃O(poly(kd/OPT ρ)) ̃O(poly(d/OPT)(k/ρ)O(log log(k/ρ))) ̃O(poly(d/OPT)(k/ρ)O(log log(k/ρ))) ̃O(poly(d/OPT)(k/ρ)O(log log(k/ρ))) B Useful Facts Proposition B.1 (Bretagnolle-Huber-Carol Inequality; [Vaart and Wellner, 1997]). Suppose the random vector (Z (1), . . . , Z (N )) is multinomially distributed with parameters (p(1), . . . , p(N )) and n. Let (cid:98)p(j) := 1 n Z (j). Then   P N (cid:88)  j=1 |(cid:98)p(j) − p(j)| ≥ 2ε    ≤ 2N exp (cid:0)−2ε2n(cid:1) . In particular, for any ε, ρ ∈ (0, 1), sampling n ≥ ln 1 ρ + N ln 2 2ε2 points from a finite distribution implies that (cid:80)N j=1|(cid:98)p(j) − p(j)| < 2ε with probability at least 1 − ρ. Remark B.2 (Weighted k-Means/Medians). We remark that if we have access to a β-approximation oracle for unweighted k-means/medians, we can implement a weighted one by considering multiple copies of the points. In particular, in our applications, we get weights that are polynomials in the parameters of concern so this will not affect the stated runtime guarantees. C Uniform Convergence of (k, p)-Clustering Costs We would like to estimate OPT for statistical k-medians and statistical k-means by solving the combinatorial problem on a sufficiently large sample size. However, while the convergence of cost for a particular set of centers is guaranteed by standard arguments, e.g. Chernoff bounds, we require the stronger statement that convergence holds simultaneously for all possible choices of centers. Similar results can be found [Ben-David, 2007], with the limitation that centers are either chosen from the sample points, or chosen as centers of mass of the clusters they induce. While this suffices to achieve constant ratio approximations, we would like to choose our centers anywhere in Bd. One reason for doing so is for replicability as we have no control over the location of samples from two independent executions so we need to output centers that are not overly reliant on its specific input. Another is for dimensionality reduction, which we will see later. C.1 History of Uniform Laws of Large Numbers Uniform laws of large numbers generalize convergence results for a finite number of random variables to possibly uncountable classes of random variables. The Rademacher complexity and related Gaussian complexity are canonical techniques in developing these laws and also have a lengthy history in the study of Banach spaces using probabilistic methods [Pisier, 1999, Milman and Schechtman, 14 1986, Ledoux and Talagrand, 1991]. Metric entropy, along with related notions of expressivity of various function classes, can be used to control the Rademacher complexity and are also central objects of study in the field of approximation theory [DeVore and Lorentz, 1993, Carl and Stephani, 1990]. C.2 Rademacher Complexity Let F denote a class of functions from Rd → R. For any fixed collection of n points xn (x1, . . . , xn), we write 1 := f (xn F (xn 1 ) := (f (x1), . . . , f (xn)) 1 ) : f ∈ F }, 1 ) := {f (xn i.e, the restriction of F onto the sample. Let s ∈ {−1, 1}n be a Rademacher random vector. That is, si takes on values −1, 1 with equal probability independently of other components. Recall that the Rademacher complexity of F is given by (cid:34) 1 n (cid:35) 1 )⟩ sup f ∈F Theorem C.1 ([Wainwright, 2019]). For any b-uniformly bounded class of functions F , integer n ≥ 1, and error ε ≥ 0, Rn(F ) := EX,s ⟨s, f (X n . (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) 1 n sup f ∈F with probability at least 1 − exp n (cid:88) (cid:12) (cid:12) f (Xi) − E[f (X)] (cid:12) (cid:12) (cid:12) ≤ 2Rn(F ) + ε i=1 (cid:16) − nε2 2b2 (cid:17) . In particular, as long as Rn(F ) = o(1), we have uniform convergence of the sample mean. C.3 Metric Entropy We write B(x, r; μ) to denote the ball of radius r about a point x with respect to a metric μ. Recall that an ε-cover of a set T with respect to a metric μ is a subset θ1, . . . , θN ⊆ T such that (cid:91) T ⊆ B(θi, ε; μ). i∈[N ] The covering number N (ε; T, μ) is the cardinality of the smallest ε-cover. Proposition C.2 ([Wainwright, 2019]). Fix ε ∈ (0, 1). Let B(R; ∥*∥) denote the d-dimensional ball of radius R with respect to ∥*∥. Then N (ε, B(R; ∥*∥), ∥*∥) ≤ 1 + (cid:18) (cid:19)d 2R ε ≤ (cid:18) 3R ε (cid:19)d . We say a collection of zero-mean random variables {Yθ : θ ∈ T } is a sub-Gaussian process with respect to a metric μ on T if E exp [λ(Yθ − Yθ′)] ≤ exp (cid:20) λ2μ2(θ, θ′) 2 (cid:21) for all θ, θ′ ∈ T and λ ∈ R. Proposition C.3. The canonical Rademacher process Yθ := ⟨s, θ⟩ is a zero-mean sub-Gaussian process with respect to the Euclidean norm on T ⊆ Rn. Proof. Recall that a Rademacher variable is sub-Gaussian with parameter 1. Moreover, the sum of sub-Gaussian variables is sub-Gaussian with parameter equal to the Euclidean norm of the parameters. It follows that Yθ − Yθ′ = ⟨s, θ − θ′⟩ is sub-Gaussian with parameter ∥θ − θ′∥2. The result follows. 15 Theorem C.4 (One-Step Discretization; [Wainwright, 2019]). Let Yθ, θ ∈ T be a zero-mean sub- Gaussian process with respect to the metric μ. Fix any ε ∈ [0, D] where D = diam(T ; μ) such that N (ε; T, μ) ≥ 10. Then E (cid:20) Yθ sup θ∈T (cid:21) ≤ E (cid:35) Yθ − Yθ′ (cid:34) sup θ,θ′∈T (cid:34) ≤ 2E sup θ,θ′∈T :μ(θ,θ′)≤ε Yθ − Yθ′ (cid:35) + 4D(cid:112)log N (ε; T, μ). In general, it may be possible to improve the bound in Theorem C.4 using more sophisticated techniques such as Dudley's entropy integral bound [Wainwright, 2019]. However, the simple inequality from Theorem C.4 suffices for our setting. Corollary C.5. Fix any ε ∈ [0, D] where D = diam(T ; μ) such that N (ε; T, μ) ≥ 10. The canonical Rademacher process Yθ = ⟨s, θ⟩ for θ ∈ T ⊆ Rn satisfies E (cid:20) Yθ sup θ (cid:21) √ ≤ 2ε n + 4D (cid:113) log N (ε; T, ∥*∥2). Proof. By Proposition C.3, Yθ is a zero-mean sub-Gaussian process and we can apply Theorem C.4 to conclude that (cid:34) E sup ∥θ−θ′∥2≤ε Yθ − Y ′ θ (cid:35) (cid:34) (cid:35) ⟨v, s⟩ = 2E sup ∥v∥2≤ε ≤ 2E [∥s∥2 * ∥v∥2] n. ≤ 2ε √ Corollary C.5 gives us a way to control the Rademacher complexity of a function class whose co-domain is well-behaved. We make this notion rigorous in the next section. C.4 Uniform Convergence of (k, p)-Clustering Cost For a fixed set of centers F , let κp F : Rd → R be given by κp F (x) := κ(x, F )p. Define F := {F ⊆ Bd : |F | = k}. We take our function class to be Let μ : F × F → R be given by F := {κp F : F ∈ F}. μ(A, B) := max a∈A,b∈B κ(a, b). Proposition C.6. μ is a metric on F. Proof. It is clear that μ is symmetric and positive definite. We need only show that the triangle inequality holds. Fix A, B, C ∈ F and suppose a ∈ A, c ∈ C are such that κ(a, c) = μ(A, C). Then μ(A, C) = κ(a, c) ≤ κ(a, b) + κ(b, c) ≤ μ(A, B) + μ(B, C) ∀b ∈ B as desired. Proposition C.7. F is p-Lipschitz parameterized with respect to the metric μ. 16 √ 1 ) is n (cid:88) Proof. We have |κ1 F (x) − κ1 F ′(x)| = |κ(x, F (x)) − κ(x, F ′(x))| ≤ |κ(x, F ′(x)) + κ(F ′(x), F (x)) − κ(x, F ′(x))| = κ(F ′(x), F (x)) ≤ μ(F, F ′). Now, the function g(x) : [0, 1] → R given by x (cid:55)→ xp is p-Lipschitz by the mean value theorem: |g(x) − g(y)| ≤ sup ξ∈[0,1] g′(ξ)|x − y| ≤ p|x − y|. The result follows by the fact that the composition of Lipschitz functions is Lipschitz with a constant equal to the product of constants from the composed functions. n] such that N (ε; F (xn Theorem C.8. For any ε ∈ [0, D = √ 1 ), ∥*∥2) ≥ 10, (cid:115) Rn(F ) ≤ 2ε √ n + 4 √ np ε kd log 3 n = o(1). Proof. Remark that κp F (xn np-Lipschitz with respect to the metric μ. Indeed, |κp F (xi) − κp F ′(xi)|2 ≤ np2μ(F, F ′)2. Now, D := diam(F (xn 1 ); ∥*∥2) = √ n. We can apply Corollary C.5 with T = F (xn 1 ) to see that i=1 Rn(F ) = ≤ E 1 n 2ε √ n (cid:20) (cid:21) Yθ sup θ (cid:114) + 4 log N (ε; F (xn 1 ), ∥*∥2) n . √ np-Lipschitz, a np -cover for F yields an ε-cover of F (xn ε√ 1 ). Hence N (ε; F (xn 1 ), ∥*∥2) ≤ N (cid:18) ε √ np (cid:19) ; F, μ . Now, since κp F (xn 1 ) is Note that the cross product of k ε-covers of B is an ε-cover of F. Hence N (cid:18) ε √ np (cid:19) ; F, μ ≤ N (cid:18) ε √ (cid:19)k ; Bd, κ np √ (cid:18) 3 np ε ≤ (cid:19)kd . Proposition C.2 Substituting this bound on the covering number of F (xn 1 ) concludes the proof. Note that the Lipschitz property was crucial to ensure that the exponent in the covering number does not contain n. Theorem C.9. Fix ε, δ ∈ (0, 1). Then with O (cid:18) k2d2 ε4 log (cid:19) p δ i.i.d. samples from P, (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) ≤ ε (cid:12)(cid:100)cost(F ) − cost(F ) with probability at least 1 − δ for any set of centers F ⊆ Bd. 17 Proof. Choose ε := 3 ≤ D = √ n. By Theorem C.8, √ np 3 np kd log 3 n √ kd log n Rn(F ) (cid:115) ≤ ≤ ≤ ≤ 2 * 3 √ n + 4 (cid:114) (cid:114) (cid:114) + 4 + 4 + 4 6 √ n 6 √ n 6 √ n kd log p n kd log p n (cid:114) (cid:115) + 4 + 4 kd log n kd √ n . √ n √ a + b ≤ √ √ b a + √ √ n n ≤ log Fix some ε1 ∈ (0, 1). We have Similarly, we have Finally, 6 √ n ≤ ε1 ⇐⇒ n ≥ 36 ε2 1 . (cid:114) 4 kd log p n ≤ ε1 ⇐⇒ n ≥ 16kd log p ε2 1 . (cid:115) 4 kd √ n ≤ ε1 ⇐⇒ n ≥ 256k2d2 ε4 1 . By taking the maximum of the three lower bounds, we conclude that n ≥ 256k2d2 ε4 1 log p =⇒ Rn(F ) ≤ 3ε1. Fix δ ∈ (0, 1). Observe that F is 1-uniformly bounded. Thus by Theorem C.1, we require 256k2d2 ε4 1 256k2d2 ε4 1 (cid:18) 2 ε2 1 samples in order to guarantee that log p max log log p δ 1 δ ≤ (cid:19) , (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) 1 n n (cid:88) i=1 sup κp F ∈F F (Xi) − Eκp κp (cid:12) (cid:12) (cid:12) F (X) (cid:12) (cid:12) ≤ 2Rn(F ) + ε1 ≤ 7ε1 with probability at least 1 − δ. Choosing ε1 = ε 7 concludes the proof. D (k, p)-Clustering In this section, we provide the full proofs for Theorem 4.2 and Theorem 4.3, which state the guarantees for the replicable k-medians and k-means algorithms, respectively. First, we describe a 18 useful subroutine for replicable heavy hitters estimation in Appendix D.2. This subroutine is crucial to the replicable coreset algorithm (cf. Algorithm D.3), which we analyze in Appendix D.3. Once we have a coreset, it remains to solve the statistical (k, p)-clustering problem on a finite distribution. We describe a replicable algorithm for this in Appendix D.4. Our coreset algorithm assumes the knowledge of some constant ratio estimate of OPT. In Appendix D.5, we show how to output such an estimate replicably. Finally, we summarize our findings in Appendix D.6. D.1 Warm-Up: Replicable SQ Oracle and ε-Covers In order to give some intuition to the reader, we first show how we can use a subroutine that was developed in Impagliazzo et al. [2022] in order to derive some results in the setting we are studying. We first need to define the statistical query model that was introduced in Kearns [1998] Definition D.1 (Statistical Query Oracle; [Kearns, 1998]). Let D be a distribution over the domain X and φ : X n → R be a statistical query with true value v⋆ := lim n→∞ φ(X1, . . . , Xn) ∈ R. Here Xi ∼i.i.d. D and the convergence is understood in probability or distribution. Let ε, δ ∈ (0, 1)2. A statistical query (SQ) oracle outputs a value v such that |v − v⋆| ≤ ε with probability at least 1 − δ. The simplest example of a statistical query is the sample mean φ(X1, . . . , Xn) = 1 n n (cid:88) i=1 Xi. The idea is that by using a sufficiently large number of samples, an SQ oracle returns an estimate of the expected value of a statistical query whose range is bounded. Impagliazzo et al. [2022] provide a replicable implementation of an SQ oracle with a mild blow-up in the sample complexity which we state below. Theorem D.2 (Replicable SQ Oracle; [Impagliazzo et al., 2022]). Let ε, ρ ∈ (0, 1) and δ ∈ (0, ρ/3). Suppose φ is a statistical query with co-domain [0, 1]. There is a ρ-replicable SQ oracle to estimate its true value with tolerance ε and failure rate δ. Moreover, the oracle has sample complexity (cid:18) 1 (cid:19) ̃O ε2ρ2 log 1 δ . The interpretation of the previous theorem is that we can replicably estimate statistical queries whose range is bounded. We now explain how we can use this result for the statistical k-means problem under the Euclidean metric, but it is not hard to extend the approach to more general (k, p)-clustering problems. Consider a fixed set of centers F. Then, we can replicably estimate the cost of this solution using Theorem D.2 within an additive accuracy ε and confidence δ using O (cid:0)ε−2ρ−2 log(1/δ)(cid:1) samples. Thus, a natural approach is to consider an ε-cover of the unit-diameter ball and then exhaustively search among solutions whose centers coincide with elements of the ε-cover. This is outlined in Algorithm D.1. We are now ready to state our results. Algorithm D.1 Replicable k-Means with ε-Cover rKMeansCover: distribution P, error ε, replicability ρ, confidence δ G ← ε/3-cover over the d-dimensional unit-diameter ball F ← {F ⊆ G : |F | = k} {We restrict the solutions to the ε-cover.} Output argminF ∈F rSQ-Oracle(cost(F ), ε/3, ρ/|F |, δ/|F |) Lemma D.3. For any ε, δ, ρ ∈ (0, 1), δ < ρ/3, Algorithm D.1 is ρ-replicable and outputs a solution F whose cost is at most OPT +ε with probability 1 − δ. Moreover, it has sample complexity (cid:18) (9/ε)2kd ρ2ε2 log 1 δ ̃O (cid:19) . 19 Proof (Lemma D.3). We first argue about the replicability of Algorithm D.1. Since we make |F| calls to the replicable SQ subroutine with parameter ρ/|F |, the overall replicability of the algorithm follows by taking a union bound. Let us now focus on the correctness of the algorithm. Let F ∗ be the optimal solution. Consider the solution that we get when we move the centers of F ∗ to the closest point of G and let us denote it by ˆF ∗. Notice that the cost of ˆF ∗ is at most OPT +ε/3. Furthermore, by a union bound, all the calls to the SQ oracle will return an estimate that is within an additive ε/3-error of the true cost. This happens with probability at least 1 − δ and we condition on this event for the rest of the proof. Thus the estimated cost of the solution ˆF ∗ will be at most OPT +2ε/3. Let (cid:101)F be the solution that we output. Its estimated cost is at most that of ˆF ∗ and so its true cost will be at most OPT +ε. This concludes the proof of correctness. Lastly, we argue about the sample complexity of the algorithm. By Proposition C.2, By plugging this value into the sample complexity from Theorem D.2, we get |F| ≤ O (cid:0)(9/ε)kd(cid:1) . O (cid:18) (9/ε)2kd ρ2ε2 log (9/ε)kd δ (cid:19) . Although Algorithm D.1 provides some basic guarantees, there are several caveats with this approach. Namely, we can only get additive approximations and the dependence of the sample and time complexity on both k, d is exponential. In the following sections, we will explain how we can overcome these issues. As we alluded to before, our approach combines ideas from coresets estimation through hierarchical grids [Frahling and Sohler, 2005], uniform convergence through metric entropy [Wainwright, 2019], and dimensionality reduction techniques [Makarychev et al., 2019]. D.2 Replicable Heavy-Hitters In this section, we present a replicable heavy hitters algorithm which is inspired by Impagliazzo et al. [2022] and has an improved sample complexity by a factor of O(1/(v−ε)). We believe that this result could be of independent interest since the replicable heavy hitters algorithm has many applications as a subroutine in more complicated algorithms [Impagliazzo et al., 2022]. Intuitively, this algorithm consists of two phases. In the first phase, we estimate all the candidate heavy hitters and reduce the size of the domain. In the second phase, we estimate the mass of these candidates. We present a new analysis of the second phase using Proposition B.1. Algorithm D.2 Replicable Heavy Hitters rHeavyHitters:distribution P, target v, error ε, replicability ρ, confidence δ if |X | < then ln 2 δ(v−ε) v−ε ˆX ← X else ˆX ← (cid:26) ln 2 δ(v−ε) v−ε (cid:27) samples ∼ P end if S ← (cid:26) 648 ln 2/δ+648(| ˆX |+1) ln 2 ρ2ε2 (cid:27) samples ∼ P Choose v′ ∈ [v − 2/3ε, v − 1/3ε] uniformly randomly Output all x ∈ ˆX such that ˆPS(x) ≥ v′ {empirical distribution} Theorem D.4. Fix v, ρ ∈ (0, 1) and ε ∈ (0, v), δ ∈ (0, ρ/3). Then Algorithm D.2 is ρ-replicable and returns a list L of elements x such that with probability at least 1 − δ: (a) If P(x) ≤ v − ε, then x /∈ L. (b) If P(x) ≥ v, then x ∈ L. 20 Moreover, it has sample complexity (cid:18) (cid:18) ̃O min |X |, 1 (v − ε) (cid:19) 1 ρ2ε2 log (cid:19) . 1 δ Proof. First, we wish to capture all v − ε heavy hitters in ˆX . If X is sufficiently small, this is easy. Otherwise, we fail to observe each (v − ε) heavy hitter with probability at most (1 − v + ε)| ˆX |. By a union bound over all (v − ε)−1 possible heavy hitters, we fail to capture all v − ε heavy hitters with probability at most (cid:34) exp −(v − ε) * (cid:35) ln 2 δ(v−ε) v − ε (1 − v + ε)| ˆX | v − ε ≤ ≤ 1 v − ε δ 2 . Moving forward, we condition on this step succeeding. Next, consider ˆp1, ˆp2, the mass estimates over the course of two runs supported on the candidate sets ˆX1, ˆX2. both follow (possibly different) multinomial distributions of dimension at most | ˆX | + 1 with unknown mean parameters p1(x) for x ∈ ˆX1 ∪ {y1}, p2(x) for x ∈ ˆX2 ∪ {y2}, respectively, and |S|. ln 2/δ+(| ˆX |+1) ln 2 Here y1, y2 are dummy elements for observations beyond ˆX1, ˆX2. Suppose we draw 2ε′2 samples over each of two runs to yield estimates ˆp1, ˆp2. By Proposition B.1, (cid:88) |ˆp1(x) − p1(x)| < 2ε′ x∈ ˆX1∪{y1} (cid:88) |ˆp2(x) − p2(x)| < 2ε′ x∈ ˆX2∪{y2} each with probability at least 1 − δ/2. Moving forward, we condition on this step succeeding. Now, consider choosing v′ ∈ [v − 2ε/3, v − ε/3] uniformly at random. Correctness: By choosing 2ε′ < ε/3, any element x with true mass at least v will have empirical mass strictly more than v − ε/3 ≥ v′. Similarly, any element x with true mass at most v − ε will have empirical mass strictly less than v − 2ε/3 ≤ v′. Thus we satisfy the correctness guarantees. Note that we satisfy this guarantee with probability at least 1 − δ. Replicability: v′ lands in between some ˆp1(x), ˆp2(x) for x ∈ ˆX1 ∩ ˆX2 with total probability at most (cid:80) (cid:80) (cid:80) x∈ ˆX1∩ ˆX2 |ˆp1(x) − ˆp2(x)| ε/3 |ˆp1(x) − p1(x)| ε/3 In addition, we wish for v′ to avoid landing "below" any ˆp1(x), ˆp2(x) where x /∈ ˆX1 ∩ ˆX2. This happens with probability at most (cid:80) |ˆp2(x) − p2(x)| ε/3 x∈ ˆX1∩ ˆX2 x∈ ˆX1∩ ˆX2 (cid:80) + ≤ x∈ ˆX1∪{y1}\ ˆX2 |ˆp1(x) − p1(x)| x∈ ˆX2∪{y2}\ ˆX1 |ˆp2(x) − p2(x)| ε/3 + ε/3 . The sum of the two expressions above is at most 4ε′ ε/3 . Thus we set 4ε′ ε/3 ≤ ε′ ≤ ρ 3 ρε 36 . The probability of failing to be replicable is then at most 1 − ρ/3 − 2δ ≥ 1 − ρ. Sample Complexity: Recall that we set ε′ = min (cid:17) (cid:16) ρε 36 , ε 6 = ρε 36 . 21 If |X | is sufficiently small, the sample complexity becomes ln 2 δ + (|X | + 1) ln 2 2ε′2 = 648 ln 2 δ + 648 (|X | + 1) ln 2 ρ2ε2 Otherwise, the sample complexity is ln 2 δ(v−ε) v − ε + 648 ln 2 δ ρ2ε2 + (cid:16) 648 2 ln δ(v−ε) + 1 ρ2ε2(v − ε) (cid:17) ln 2 . D.3 Replicable Coreset We now prove that Algorithm 4.1 replicably yields an ε-coreset. In Appendix D.3.1, we state Algorithm D.3, an equivalent description of Algorithm 4.1. Then, we show that it is indeed replicable in Appendix D.3.2. Following this, we prove that the cost of any set of centers F ⊆ Bd is preserved up to an ε-multiplicative error in Appendix D.3.3. In Appendix D.3.4, we show that the outputted coreset is of modest size. Last but not least, we summarize our findings in Appendix D.3.5. D.3.1 Pseudocode Before presenting the analysis, we state an equivalent algorithm to Algorithm 4.1 which uses precise notation that is more suitable for analysis. Starting with the grid that consists of a single cell [−1/2, 1/2]d at layer 0, we recursively subdivide each cell into 2d smaller cells of length 2−i at layer i. Each subdivided cell is a child of the larger cell, the containing cell is the parent of a child cell, and cells sharing the same parent are siblings. Let Gi denote the union of cells at the i-th level. We write Pi to denote the discretized distribution to Gi. In other words, Pi = P(cid:12) (cid:12)σ(Gi) is the restriction of P to the smallest σ-algebra containing Gi. We say a cell on the i-th level is heavy if the replicable heavy hitters algorithm (cf. Algorithm D.2) returns it with input distribution Pi, heavy hitter threshold v = γ*Λ 2−pi , and error v/2 for some parameter γ to be determined later. A cell that is not heavy is light. The recursion terminates either when there are no more heavy cells on the previous layer, or the current grid length is a sufficiently small fraction of OPT. In the second case, we say the last layer consists of special cells. If no child cell of a heavy parent is heavy, we mark the parent. Otherwise, we recurse on its heavy children so that one of its descendants will eventually be marked. The recursion must stop, either when there are no more heavy children or when the side length is no more than a fraction of Λ. Note that the light cells with heavy parents and special cells partition [−1/2, 1/2]d. Then, we build R in reverse as follows. For a marked heavy cell Z, we set R(x) to be an arbitrary (but replicable) point in Z, e.g. its center, for all x ∈ Z. This covers all light cells with no heavy siblings as well as special cells. Otherwise, a cell Z is light with heavy siblings, and its parent is heavy but unmarked. Thus, the parent has some marked heavy descendent Z ′, and we choose R(x) = R(x′) for all x ∈ Z and x′ ∈ Z ′. D.3.2 Replicability Proposition D.5. Algorithm D.3 terminates after at most layers. t := (cid:24) 1 p log 10β∆p ε * OPT (cid:25) + 1 22 Algorithm D.3 Replicable Coreset; Algorithm 4.1 Equivalent 1: rCoreset(distribution P, accuracy ε, exponent p, replicability ρ, confidence δ): 2: Init H[i] ← ∅ for all i 3: Init L[i] ← ∅ for all i 4: Init S[i] ← ∅ for all i 5: [−1/2, 1/2]d(cid:111) (cid:110) 6: H(0) ← 7: for i ← 1; H[i − 1] ̸= ∅; i ← i + 1 do 8: 9: 10: 11: if (2−i+1∆)p ≤ εΛ/5 then S[i] ← children(H[i − 1]) Pi, v = γ*Λ 2−pi , v/2, ρ/t, δ/t else (cid:16) H[i] ← children(H[i − 1]) ∩ rHeavyHitters bound on the number of layers.} L[i] ← children(H[i − 1]) \ H[i] (cid:17) {t is an upper R′(Z) ← R′(rChoice(children(Z) ∩ H[j + 1])) if children(Z) ∩ H[j + 1] = ∅ then else for Z ∈ H[j] do R′(Z) ← rChoice(Z) 12: end if 13: 14: end for 15: 16: for j ← i − 1; j ≥ 0; j ← j − 1 do 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: end for 31: 32: Output R end if end for for Z ∈ L[j + 1] do end for for Z ∈ S[j + 1] do R(Z) ← R′(parent(Z)) R(Z) ← R′(parent(Z)) end for Proof. We have (2−i+1∆)p ≤ εΛ 5 ⇐⇒ 2p(−i+1) ≤ εΛ 5∆p ⇐⇒ p(−i + 1) ≤ log ⇐⇒ i ≥ 1 p log 5∆p ε * Λ But 1/Λ ≤ β(1+ε)/OPT, concluding the proof. εΛ 5∆p + 1. Corollary D.6. Algorithm D.3 is ρ-replicable and succeeds with probability at least 1 − δ. Moreover, it has sample complexity (cid:18) ̃O t2 ρ2γ3 * OPT3 log 1 δ (cid:19) . Proof. The only non-trivial random components of Algorithm D.3 is the heavy hitter estimation. By Theorem D.4, the heavy hitters subroutine call on the i-th layer is ρ/t-replicable and succeeds with 23 probability at least 1 − δ/t. Also, it has sample complexity Now, ̃O (cid:18) t2 * 23(−pi+1) ρ2γ3 * Λ3 log (cid:19) . 1 δ t (cid:88) i=0 2−3pi ≤ ∞ (cid:88) 2−3pi i=0 = O(1). Thus all in all, Algorithm D.3 is ρ-replicable and succeeds with probability at least 1 − δ. It also has sample complexity (cid:18) ̃O t2 ρ2γ3 * Λ3 log 1 δ (cid:19) . Since 1/Λ ≤ β(1+ε)/OPT, we conclude the proof. D.3.3 Expected Shift Proposition D.7. For any x ∈ Z ∈ L[i] ∪ S[i] outputted by Algorithm D.3, κ(x, R(x)) ≤ (2−i+1∆). Proof. x is represented by some point within its parent. Proposition D.8. The output S[t] of Algorithm D.3 satisfies (cid:90) S[t] κ(x, R(x))pdP(x) ≤ εΛ 5 . Proof. By computation, (cid:90) S[t] κ(x, R(x))pdP(x) ≤ (cid:90) S[t] (2−i+1∆)pdP(x) Proposition D.7 dP(x) definition of t ≤ ≤ = εΛ 5 εΛ 5 (cid:90) S[t] (cid:90) X εΛ 5 . dP(x) Let F be an arbitrary set of k centers. Partition L[i] into Lnear[i] := (cid:26) (cid:26) Z ∈ L[i] : min x∈Z κ(x, F )p ≤ Lfar[i] := Z ∈ L[i] : min x∈Z κ(x, F )p > (2−i+1∆)p (2−i+1∆)p (cid:27) (cid:27) . 5 ε 5 ε Proposition D.9. The output Lfar of Algorithm D.3 satisfies t (cid:88) (cid:90) i=0 Lfar[i] κ(x, R(x))pdP(x) ≤ ε 5 cost(F ). 24 Proof. Any x ∈ Z ∈ Lfar[i] contributes a cost of at least 5 ε (2−i+1∆)p. Hence t (cid:88) (cid:90) i=0 Lfar[i] κ(x, R(x))pdP(x) ≤ t (cid:88) (cid:90) (2−i+1∆)pdP(x) i=0 Lfar[i] t (cid:88) (cid:90) i=0 t (cid:88) i=0 Lfar[i] (cid:90) Lfar[i] cost(F ). = ≤ ≤ ε 5 ε 5 ε 5 5 ε (2−i+1∆)pdP(x) κ(x, F )pdP(x) Proposition D.10. The output Lnear of Algorithm D.3 satisfies |Lnear[i]| ≤ kM where M := (cid:21)d ∆ (cid:20) 25 ε Proof. The furthest point x in a cell in Lnear[i] can have a distance of at most (cid:114) 5 ε (2−i+1∆) ≤ 2−i∆ + p (2−i∆) 10 ε 1 + (cid:19) (cid:18) to the nearest center. Thus the points belonging to a particular center live in an l∞ ball of that radius. Not including the cell containing the center, we can walk past at most (cid:18) (cid:19) (cid:19) (cid:18) 1 2−i * 1 + 10 ε (2−i∆) = 1 + ∆ 10 ε cells if we walk in the directions of the canonical basis of Rd. It follows that there can be at most (cid:19) (cid:21)d (cid:21)d (cid:18) (cid:20) 1 + 2 1 + ∆ ≤ 10 ε (cid:20) 32 ε ∆ cells in Lnear[i] close to each center of F , and thus there are at most kM cells in total. Proposition D.11. By choosing γ := ε 5tkM (2∆)p , The output Lnear of Algorithm D.3 satisfies t (cid:88) (cid:90) i=0 Lnear[i] κ(x, R(x))p ≤ εΛ 5 . Proof. Each light cell has measure at most γ*Λ 2−pi . By computation, t (cid:88) (cid:90) κ(x, R(x))pdP(x) ≤ (2−i+1∆)pdP(x) t (cid:88) (cid:90) i=0 Lnear[i] Corollary D.12. Set i=1 t (cid:88) i=1 ≤ Lnear[i] kM * γ * Λ 2−pi 2−pi(2∆)p = t * kM * γ * Λ * (2∆)p ≤ εΛ 5 . γ := ε 5tkM (2∆)p . Then for any set F of k-centers, the output R of Algorithm D.3 satisfies (cid:90) X κ(x, R(x))pdP(x) ≤ ε cost(F ). 25 Proof. X is contained in the union of all L[i]'s and S[t]. Hence (cid:90) X κ(x, R(x))pdP(x) ≤ ≤ ≤ cost(F ) + 2εΛ 5 ε 5 2ε(1 + ε) OPT 5 + ε 5 cost(F ) 4ε 5 OPT + ε 5 cost(F ) D.3.4 Coreset Size ≤ ε cost(F ). To determine the size of our coreset, we bound the number of marked heavy cells, as all our representative points are in marked heavy cells. Fix FOPT to be a set of optimal centers for the (k, p)-clustering problem. Write M[i] to denote the set of marked heavy cells on the i-th layer and partition M[i] as Mclose[i] := (cid:26) (cid:26) Z ∈ M[i] : min x∈Z κ(x, F ) ≤ 2−pi+1 Mdist[i] := Z ∈ M[i] : min x∈Z κ(x, F ) > 2−pi+1 (cid:27) (cid:27) . Proposition D.13. The marked heavy cells Mdist outputted by Algorithm D.3 satisfy (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:91) 0≤i≤t Mdist[i] (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) ≤ 2β γ . Proof. Each cell in Mdist[i] has mass at least least 2−pi+1 to its closest center. Thus each cell contributes at least γ*Λ 2−pi+1 and each x ∈ Z ∈ Mdist[i] is of distance at to the objective. If follows that there are at most γ * Λ 2−pi+1 * 2−pi+1 = γ * Λ OPT γΛ ≤ 1 γ β (1 + ε) ≤ 2β γ . such cells. Proposition D.14. The marked heavy cells Mclose outputted by Algorithm D.3 satisfy |Mclose[i]| ≤ k(7∆)d. Proof. The furthest point x in a cell Mclose[i] to its nearest center is 2−pi+1 + 2−i∆. In other words, not including the cell containing the center, we can walk past at most cells by walking along the direction of the canonical basis of Rd. Thus there are at most 2i(1−p)+1 + ∆ ≤ 2 + ∆ k [1 + 2 (2 + ∆)]d ≤ k [7∆]d such cells on the i-th layer. Proposition D.15. The image of the map R outputted by Algorithm D.3 satisfies N := |R(X )| ≤ 2β γ + tk(7∆)d. 26 In particular, for we have γ := ε 5tkM (2∆)p , N := |R(X )| ≤ 3β γ = 3β * 5tkM (2∆)p ε . Proof. The image is contained in the marked heavy cells. D.3.5 k-Medians & k-Means We now derive results for the case of p = 1. Theorem D.16. Algorithm D.3 is ρ-replicable and outputs an ε-coreset of size O (cid:18) k25d∆d+1 εd+1 log ∆ ε * OPT (cid:19) for statistical k-medians with probability at least 1 − δ. Moreover, it has sample complexity (cid:18) k3215d∆3d+3 ρ2ε3d+3 * OPT3 log 1 δ ̃O (cid:19) . Proof (Theorem D.16). By Corollary D.12, Algorithm D.3 outputs an ε-coreset. By Corollary D.6, Algorithm D.3 is ρ-replicable with sample complexity (cid:18) ̃O t2 ρ2γ3 * OPT3 log 1 δ (cid:19) . We have 3β γ = O (cid:32) k (cid:2)25∆/ε(cid:3)d ε (2∆) * log ∆ ε * OPT (cid:33) = O (cid:18) k25d∆d+1 εd+1 log ∆ ε * OPT (cid:19) By Proposition D.15, the coreset has size at most this value. Substituting the value of γ above and remarking that t is a polylogarithmic factor of the other terms, we thus conclude that the final sample complexity is (cid:18) k3215d∆3d+3 ε3d+3 (cid:18) k3215d∆3d+3 ρ2ε3d+3 * OPT3 1 ρ2 * OPT3 log = ̃O 1 δ 1 δ ̃O (cid:19) (cid:19) * . Now consider the case of p = 2. We can perform our analysis with the help of a standard inequality. Proposition D.17. For any set of centers F , Exκ(R(x), F )2 ≤ Exκ(x, F )2 + 2(cid:112)Ex [κ(x, F )2] * Ex [κ(x, R(x))2] + Exκ(x, R(x))2 Exκ(x, F )2 ≤ Exκ(R(x), F )2 + 2(cid:112)Ex [κ(R(x), F )2] * Ex [κ(x, R(x))2] + Exκ(x, R(x))2. Thus if Exκ(x, R(x))2 ≤ ε2 Exκ(R(x), F )2 ≤ Exκ(x, F )2 + 2 * (cid:16) (cid:17) ≤ 1 + ε 4 26 Exκ(x, F )2, 1 23 εEx Exκ(x, F )2 (cid:114) (cid:2)κ(x, F )2(cid:3) + 1 26 ε2Ex (cid:2)κ(x, F )2(cid:3) Exκ(x, F )2 ≤ Exκ(R(x), F )2 + 2 (1 + ε) Ex [κ(x, F )2] * 1 26 ε2Ex [κ(x, F )2] + 1 26 ε2Exκ(x, F )2 ≤ Exκ(R(x), F )2 + εEx (cid:2)κ(x, F )2(cid:3) + 1 2 1 26 ε2Exκ(x, F )2 ≤ Exκ(R(x), F )2 + εExκ(x, F )2. 27 Proof. By H ̈older's inequality, Exκ(R(x), F )2 ≤ Ex [κ(x, F ) + κ(x, R(x))]2 = Exκ(x, F )2 + 2Ex[κ(x, F )κ(x, R(x))] + Exκ(x, R(x))2 ≤ Exκ(x, F )2 + 2(cid:112)Ex [κ(x, F )2] Ex [κ(x, R(x))2] + Exκ(x, R(x))2. The other case is identical. Theorem D.18. Algorithm D.3 is ρ-replicable and outputs an ε-coreset for statistical k-means of size O (cid:18) k211d∆d+2 ε2d+2 log (cid:19) ∆2 ε OPT with probability at least 1 − δ. Moreover, it has sample complexity ̃O (cid:18) k3233d∆3d+6 ρ2ε6d+6 * OPT3 log 1 δ (cid:19) . Proof (Theorem D.18). Similar to k-medians, Algorithm D.3 outputs an ε-coreset with probability at least 1 − δ, is ρ-replicable, and has sample complexity (cid:18) ̃O t2 ρ2γ3 * OPT3 log 1 δ (cid:19) . However, we need to take ε′ := ε2/26. We have 3 γ = O (cid:32) tk (cid:2)25+6∆/ε2(cid:3)d (2∆)2 (cid:33) ε2 = O (cid:18) k211d∆d+2 ε2d+2 log ∆2 ε OPT (cid:19) . By Proposition D.15, the coreset has size at most this value. t is a polylogarithmic factor of the rest of the parameters, thus we thus conclude that the final sample complexity is ̃O (cid:18) k3233d∆3d+6 ε6d+6 * 1 ρ2 * OPT3 (cid:19) = ̃O (cid:18) k3233d∆3d+6 ρ2ε6d+6 * OPT3 log 1 δ (cid:19) . It is not clear how to compare our guarantees with that of Frahling and Sohler [2005] as we attempt to minimize the number of samples required from a distribution assuming only sample access. On the other hand, Frahling and Sohler [2005] attempted to minimize the running time of their algorithm assuming access to the entire distribution. D.4 Replicable Multinomial Parameter Estimation Now that we have reduced the problem to a finite distribution (coreset), we can think of it as a weighted instance of (k, p)-clustering where the weights are unknown but can be estimated using data. Proposition D.19. Enumerate the coreset R(X ) = r(1), . . . , r(N ) and let w(i) be the probability mass at r(i). If we have estimates ˆw(i) satisfying | ˆw(i) − w(i)| < ε N , then for all centers F . (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) N (cid:88) i=1 w(i)κ(r(i), F )p − ˆw(i)κ(r(i), F )p (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) ≤ ε. N (cid:88) i=1 28 Proof. Indeed, (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) N (cid:88) i=1 w(i)κ(r(i), F )p − N (cid:88) i=1 ˆw(i)κ(r(i), F )p |w(i) − ˆw(i)|κ(r(i), F )p |w(i) − ˆw(i)| * 1 (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) ≤ ≤ N (cid:88) i=1 N (cid:88) i=1 ≤ ε. Let us formulate this as a replicable multinomial parameter estimation problem. Consider a multino- mial distribution Z = (Z (1), . . . , Z (N )) of dimension N with parameters p(1), . . . , p(N ) and n. Note that this can be cast as a more general statistical query problem which we illustrate below. We allow simultaneous estimation of more general statistical queries g1, . . . , gN : (X n, P) → R compared to Impagliazzo et al. [2022], assuming they can be estimated with high accuracy and confidence from data, say each query gj(x1, . . . , xn) concentrates about its true value Gj ∈ R with high probability. Algorithm D.4 Replicable Rounding 1: rRounding(statistical queries g1, . . . gN , distribution P, number of samples n, error ε, replicabil- ity ρ, confidence δ): 2: Sample x1, . . . , xn ∼ P 3: α ← 2ε ρ+1−2δ 4: for j ← 1, . . . , N : do 5: 6: 7: 8: end for α(j) ← uniform random sample [0, α] Split R into intervals I (j) = {[α(j) + zα, α(j) + (z + 1)α) : z ∈ Z} Output the midpoint ˆGj of the interval within I (i) that gj(x1, . . . , xn) falls into Theorem D.20 (Replicable Rounding). Suppose we have a finite class of statistical queries g1, . . . , gN and sampling n independent points from P ensures that N (cid:88) j=1 |gj(x1, . . . , xn) − Gj| ≤ ε′ := ε(ρ − 2δ) ρ + 1 − 2δ with probability at least 1 − δ. Then Algorithm D.4 is ρ-replicable and outputs estimates ˆGj such that | ˆGj − Gj| ≤ ε with probability at least 1 − δ for every j ∈ [N ]. Moreover, it requires at most n samples. Proof. Outputting the midpoint of the interval can offset each gj(x1, . . . , xn) by at most α ε(ρ − 2δ) ρ + 1 − 2δ ε ρ + 1 − 2δ | ˆGj − Gj| ≤ = ε. + 2 . Hence Consider two executions of our algorithm yielding estimates ˆG(1), ˆG(2). The probability that any of the estimates fail to satisfy l1-tolerance ε′ is at most 2δ. The two executions output different estimates only if some random offset "splits" some ˆG(1) . Conditioning on the success to satisfy l1-tolerance, this occurs with probability at most N (cid:88) j − Gj| + | ˆG(2) j − Gj| , ˆG(2) j | ˆG(1) | ˆG(1) N (cid:88) | j j − ˆG(2) α j ≤ j=1 α ≤ j=1 2ε′ α ≤ ρ − 2δ. Accounting for the probability of failure to satisfy the l1-tolerance of 2δ, our algorithm is ρ-replicable. 29 We note that Theorem D.20 can be thought of as a generalization of the SQ oracle (cf. Theorem D.2) from Impagliazzo et al. [2022]. Indeed, simply using Theorem D.2 yields an extra factor of N in the sample complexity as we must take a union bound. Corollary D.21. Let ε, ρ ∈ (0, 1) and δ ∈ (0, ρ/3). There is a ρ-replicable algorithm that outputs parameter estimates ̄p for a multinomial distribution of dimension N such that (a) | ̄p(i) − p(i)| ≤ ε for every i ∈ [N ] with probability at least 1 − δ. (b) ̄p(i) ≥ 0 for all i ∈ [N ]. (c) (cid:80) i ̄p(i) = 1. Moreover, the algorithm has sample complexity O (cid:18) ln 1/δ + N ε2(ρ − δ)2 (cid:19) = ̃O (cid:18) N ε2ρ2 log (cid:19) . 1 δ Proof. Define By Proposition B.1, sampling ε′ := ε(ρ − 2δ) ρ + 1 − 2δ . n = ≤ 2 ln 1/δ + 2N ln 2 ε′2 8 ln 1/δ + 8N ln 2 ε2(ρ − 2δ)2 . points implies that (cid:80)N Thus running Algorithm D.4 with functions i=1|(cid:98)p(i) − p(i)| < ε′ with probability at least 1 − δ. gj(x1, . . . , xN ) := 1 N N (cid:88) i=1 1{xi = j} yields ̄p(i)'s such that | ̄p(i) − p(i)| ≤ ε for each i ∈ [N ]. If there are any negative ̄p(i)'s, we can only improve the approximation by setting them to 0. If the sum of estimates is not equal to 1, we can normalize by taking ̄p(i) ← ̄p(i) − 1 N (cid:35) ̄p(i) − 1 . (cid:34) (cid:88) i This introduces an additional error of ε/N for each ˆp(i) and a maximum error of 2ε. Choosing ε1 := ε/2 concludes the proof. D.5 Replicable OPT Estimation for (k, p)-Clustering Our coreset algorithm assumes the knowledge of a constant ratio estimation of OPT. If this is not provided to us, we show in this section that it is possible to replicably compute such an estimate using a two-step approach. First, we are able to produce replicable estimates with additive error ε simply by approximately solving the sample (k, p)-clustering problem on a sufficiently large sample thanks to uniform convergence (cf. Theorem C.9). Then, we repeat this process with ε ← ε/2 until ε is but a small fraction of the outputted estimate. Theorem D.22 (OPT Estimation with Additive Error). Let β ≥ 1 be an absolute constant and ε, ρ ∈ (0, 1), δ ∈ (0, ρ/3). Suppose we are provided with an algorithm A that, given an instance of sample (k, p)-clustering, outputs an estimate Ξ of the value (cid:91)OPT such that Ξ ∈ (cid:20) 1 β (cid:21) (cid:91)OPT, (cid:91)OPT . 30 Then there is a ρ-replicable algorithm which produces an estimate Λ of OPT such that (cid:20) OPT β − ε, OPT +ε Λ ∈ (cid:21) with probability at least 1 − δ. Moreover, the algorithm has sample complexity ̃O (cid:18) k2d2 ε6ρ6 log (cid:19) . p δ We note that the algorithm A can be taken to be any β-approximation algorithm with some postpro- cessing, where we divide the value of the cost by β. Alternatively, we can take A to be some convex relaxation of our problem with constant integral gap. Proof. Let X1, . . . , XN ∼ P be i.i.d. random variables. The output Ξ = A(X1, . . . , XN ) ∈ [0, 1] is thus a bounded random variable. Suppose we repeat this experiment n times to produce estimates Ξ1, . . . , Ξn. By an Hoeffding bound, (cid:40) P 1 n n (cid:88) i=1 (cid:41) (Ξi − E[Ξ]) > ε ≤ 2 exp (cid:0)−2nε2(cid:1) . Thus with trials, the average estimate ̄Ξ := 1 n Now, by Theorem C.9, choosing 1 n ≥ 2ε2 ln i=1 Ξi satisfies (cid:12) 2 δ (cid:12) ̄Ξ − E[Ξ](cid:12) (cid:80)n (cid:12) < ε with probability at least 1 − δ. i.i.d. samples from P ensures that Thus conditioning on success, we have (cid:19) N = O (cid:18) k2d2 ε4 (cid:12) (cid:91)OPT − OPT (cid:12) (cid:12) ≤ ε for all n trial with probability at least 1 − δ. np δ log (cid:12) (cid:12) (cid:12) Ξi ∈ (cid:20) OPT β (cid:21) − ε, OPT +ε for every trial i ∈ [n]. But then the average ̄Ξ also falls into this interval as well. We have shown that there is an algorithm that outputs an estimate ̄Ξ ∈ [E[Ξ] − ε, E[Ξ] + ε] ∩ (cid:20) OPT β (cid:21) − ε, OPT +ε with probability at least 1 − δ. Moreover, it has sample complexity nN = O = O (cid:18) 1 ε2 log (cid:18) k2d2 ε6 * k2d2 1 ε4 δ (cid:19) log2 p εδ log (cid:18) p ε2δ log 1 δ (cid:19)(cid:19) We can now apply the replicable rounding algorithm (cf. Algorithm D.4) to achieve the desired outcome. Indeed, by Theorem D.20, the output Λ after the rounding procedure is ρ-reproducible and offsets the average ̄Ξ by at most ε. Hence we have Λ ∈ (cid:20) OPT β − 2ε, OPT +2ε. (cid:21) with probability at least 1 − δ. Finally, the algorithm has sample complexity O (cid:18) k2d2 ε6ρ6 log2 p ερδ (cid:19) Choosing ε′ = ε/2 completes the proof. 31 Theorem D.23 (OPT Estimation with Relative Error). Fix ε, ρ ∈ (0, 1) and δ ∈ (0, ρ/3). There is a ρ-replicable algorithm such that with probability at least 1 − δ, it outputs an estimate Λ of OPT where Λ ∈ (cid:20) 1 β(1 + ε) OPT, (1 + ε) OPT . (cid:21) Moreover, it has sample complexity ̃O (cid:18) k2d2β12 ε12ρ6 * OPT12 log p δ (cid:19) . Proof. We run the estimation algorithm with additive error with εi := 2−i ρi := 2−iρ δi := 2−iδ for i = 1, 2, 3, . . . until we obtain an estimate Λi such that εi ≤ εΛi/2. Remark that 2−i ≤ 1 2 εΛi ⇐= 2−i ≤ (cid:18) ⇐⇒ 2−i ⇐= −i ≤ log (cid:19) − 2−i ε OPT 2β 1 2 ε (cid:18) OPT β (cid:19) 1 + ≤ ε 1 2 ε OPT 4β β ε OPT + 2. Thus the algorithm certainly terminates. ⇐⇒ i = log Upon termination, we output some Λ such that Λ ∈ [OPT/β − εΛ/2, OPT +εΛ/2]. It follows that Λ ≤ OPT + 1 2 εΛ Λ ≤ OPT (cid:18) 1 − (cid:19) ε 1 2 Λ ≤ OPT 1 1 − ε 2 ≤ (1 + ε) OPT and Λ ≥ OPT β − 1 2 εΛ (cid:18) β 1 + 1 2 (cid:19) ε Λ ≥ OPT Λ ≥ 1 β(1 + ε) OPT . The probability of not being replicable in each iteration is 2−iρ. Hence the total probability is at most and similarly for δ. ∞ (cid:88) i=1 2−iρ = ρ 32 (cid:16) (cid:17) Finally, there are O above by the sample complexity of the final iteration where (cid:19) log β ε OPT 2−i = Ω (cid:18) ε OPT β . iterations and the sample complexity of each iteration is bounded Hence the total sample complexity is  ̃O  log β ε OPT * k2d2 (cid:17)6 (cid:16) ε OPT β (cid:16) ε OPT β (cid:17)6 log * ρ   = ̃O  p δ (cid:18) k2d2β12 ε12ρ6 * OPT12 log p δ (cid:19) . D.6 Putting it Together We are now ready to prove the results on statistical k-medians and statistical k-means, which we restate below for convenience. Recall that β is an absolute constant and hence disappears under the big-O notation. Theorem 4.2 (Theorem 3.1; Formal). Let ε, ρ ∈ (0, 1) and δ ∈ (0, ρ/3). Given black-box access to a β-approximation oracle for weighted k-medians (cf. Problem 2.2), there is a ρ-replicable algorithm for statistical k-medians (cf. Problem 2.1) such that, with probability at least 1 − δ, it outputs a (1 + ε)β-approximation. Moreover, it has sample complexity (cid:18)(cid:18) ̃O k2d2 ε12ρ6 * OPT12 + k3218d∆3d+3 ρ2ε3d+5 * OPT3 (cid:19) log (cid:19) . 1 δ Proof (Theorem 4.2). First, we compute Λ, an estimate of OPT with relative error ε, confidence δ/3, and replicability parameter ρ/3. Then, we produce an ε/2-coreset for k-medians of cardinality N with confidence and replicability parameters δ/3, ρ/3. Finally, we estimate the mass at each point of the coreset with confidence and replicability parameters δ/3, ρ/3 to an accuracy of By Proposition D.19, running the approximation oracle on the coreset with the estimated weights yields a β(1 + ε)-approximation. εΛ 4N ≤ ε OPT 2N . By Theorem D.23, computing Λ requires (cid:18) ̃O k2d2 ε12ρ6 * OPT12 log (cid:19) 1 δ samples. By Theorem D.16, the coreset construction yields a coreset of cardinality N = O (cid:18) k25d∆d+1 εd+1 log ∆ ε * OPT (cid:19) * 2d = O (cid:18) k26d∆d+1 εd+1 log ∆ ε * OPT (cid:19) and incurs a sample cost of ̃O (cid:18) k3215d∆3d+3 ρ2ε3d+3 * OPT3 * 23d 1 δ (cid:19) = ̃O (cid:18) k3218d∆3d+3 ρ2ε3d+3 * OPT3 1 δ (cid:19) . Finally, Corollary D.21 states that the probability mass estimation incurs a sample cost of (cid:18) (cid:19) (cid:19) ̃O (cid:18) N 3 ε2ρ2 * Λ2 log 1 δ = ̃O = ̃O = ̃O 1 δ N 3 ε2ρ2 * OPT2 log (cid:18) k3218d∆3d+3 ε3d+3 (cid:18) k3218d∆3d+3 ρ2ε3d+5 * OPT2 log * 1 ε2ρ2 * OPT2 log (cid:19) (cid:19) 1 δ 1 δ . 33 Theorem 4.3 (Theorem 3.1; Formal). Given black-box access to a β-approximation oracle for weighted k-means (cf. Problem 2.2), there is a ρ-replicable algorithm for statistical k-means (cf. Problem 2.1) such that, with probability at least 1 − δ, it replicably outputs a (1 + ε)β-approximation. Moreover, it has sample complexity (cid:18)(cid:18) ̃O k2d2 ε12ρ6 * OPT12 + k3239d∆3d+6 ρ2ε6d+8 * OPT3 (cid:19) log (cid:19) . 1 δ Proof (Theorem 4.3). Similar to k-median, we first compute Λ, an estimate of OPT with relative error ε, confidence δ/3, and replicability parameter ρ/3. Then, we produce an ε/2-coreset for k-medians of cardinality N with confidence and replicability parameters δ/3, ρ/3. Finally, we estimate the mass at each point of the coreset with confidence and replicability parameters δ/3, ρ/3 to an accuracy of By Proposition D.19, running the approximation oracle on the coreset with the estimated weights yields a β(1 + ε)-approximation. εΛ 4N ≤ ε OPT 2N . By Theorem D.23, computing Λ requires (cid:18) ̃O k2d2 ε12ρ6 * OPT12 log (cid:19) 1 δ samples. By Theorem D.18, the coreset construction yields a coreset of cardinality (cid:18) k213d∆d+2 ε2d+2 (cid:18) k211d∆d+2 ε2d+2 ∆ ε OPT N = O * 22d = O log (cid:19) log (cid:19) . ∆ ε OPT and incurs a sample cost of ̃O (cid:18) k3233d∆3d+6 ρ2ε6d+6 * OPT3 * 26d (cid:19) = ̃O (cid:18) k3239d∆3d+6 ρ2ε6d+6 * OPT3 1 δ (cid:19) . Finally, Corollary D.21 states that the probability mass estimation incurs a sample cost of (cid:18) (cid:19) (cid:19) (cid:18) N 3 ̃O ε2ρ2 * Λ2 1 δ = ̃O = ̃O = ̃O 1 δ N 3 ε2ρ2 * OPT2 (cid:18) k3239d∆3d+6 ε6d+6 (cid:18) k3239d∆3d+6 ρ2ε6d+8 * OPT2 * (cid:19) 1 δ 1 ε2ρ2 * OPT2 1 δ (cid:19) . E The Euclidean Metric, Dimensionality Reduction, and (k, p)-Clustering We now build towards a proof for Theorem 5.1, which states the formal guarantees of the replicable k-medians and k-means algorithms under the Euclidean distance. Let us begin by recalling the Johnson-Lindenstrauss lemma. Theorem E.1 ([Johnson, 1984]). There exists a family of random linear maps πd,m from Rd → Rm such that the following hold. (i) For every d ≥ 1, ε, δ ∈ (0, 1/2), x ∈ Rd, and m = O (1/ε2 log 1/δ), 1 1 + ε with probability at least 1 − δ. ∥πx∥2 ≤ ∥x∥2 ≤ (1 + ε)∥πx∥2 (ii) πd,m is sub-Gaussian-tailed, thus for every unit vector x ∈ Rd and ε > 0, with probability at most exp(cid:0)−Ω(ε2m)(cid:1). ∥πx∥2 ≥ 1 + ε 34 Furthermore, we can take πd,m to be the set of random orthogonal projections Rd → Rm scaled by a factor of (cid:112)d/m. We say that π ∈ πd,m is a standard random dimension-reduction map and write Pπ to denote the projected distribution on Rm, i.e., Pπ(*) = P(π−1(*)). As mentioned in Section 5, it is not entirely clear how to translate between sets of centers for high- dimensional data and solutions sets for the compressed data. For this reason, our goal is to produce a clustering function f : X → [k] which computes the label for any given point in polynomial time. This also requires us to consider another notion of cost which is translated more easily. Definition E.2 (Partition Cost). Define the cost of a k-partition C = (C (1), . . . , C (k)) of X as cost(C) := min u(j)∈Rd:j∈[k] Ex   k (cid:88) 1{x ∈ C (j)} * κ(x, u(j))p   . j=1 i.e., we consider the expected cost of picking the optimal centers w.r.t. the underlying data-generating distribution. Similarly, we define the following sample partition cost. Definition E.3 (Sample Partition Cost). We define the sample cost of a k-partition C of x1, . . . , xn as (cid:100)cost(C, w) = min u(j)∈Rd:j∈[k] n (cid:88) wi k (cid:88) i=1 j=1 1{xi ∈ C (j)}κ(xi, u(j))p where w ≥ 0, (cid:80) on the samples. We write (cid:100)cost(C) to denote the cost with the uniform distribution on the samples. i wi = 1. i.e., we consider the cost that is induced by the distribution specified by w Remark that if C is induced by F , then OPT ≤ cost(C) ≤ cost(F ) and similarly for the sample partition cost as well. Theorem E.4 ([Makarychev et al., 2019]). Let x1, . . . , xn ∈ Rd be an instance of the Euclidean (k, p)-clustering problem. Fix ε ∈ (0, 1/4), δ ∈ (0, 1) and suppose π : Rd → Rm is a standard random dimension-reduction map with m = O (cid:18) p4 ε2 log (cid:19) . k εδ Then with probability at least 1 − δ, 1 1 + ε (cid:100)cost(C) ≤ (cid:100)cost(π(C)) ≤ (1 + ε)(cid:100)cost(C) for every k-partition C of x1, . . . , xn. In essence, this theorem tells us that if we let the centers of the clusters be the centers of the partition, then the (sample) cost is preserved in the lower dimensional space. To the best of our knowledge, this is the strongest result for dimensionality reduction in (sample) (k, p)-clustering which preserves more than just the costs of optimal centers. The rest of Appendix E serves to generalize Theorem E.4 for preserving partition costs in the distributional setting. First, Appendix E.1 addresses the issue that a random orthogonal projection can increase the diameter of our data in the worst case by scaling the original data by an appropriate factor. Next, Appendix E.2 slightly generalizes Theorem E.4 to the weighted sample clustering setting. Finally, Appendix E.3 extends Theorem E.4 to the distributional setting, culminating with Theorem E.10, which may be of independent interest beyond replicability. Recall that Pπ is the push-forward measure on π(X ) induced by π. We write OPTπ to denote the cost of an optimal solution to the statistical (k, p)-clustering problem on (π(X ), Pπ) and (cid:91)OPTπ for the (k, p)-clustering problem on π(x1), . . . , π(xn). 35 E.1 Scaling We may assume that a standard dimension-reduction map π satisfies π = (cid:112)d/mP for some orthogonal √ projection P . Hence π has operator norm at most √ π(X ) ⊆ d and dBm. √ In order to apply our existing analysis, we first scale down the samples in the input space by a d so that the projected space still lives in a κ-ball of diameter 1. This does not affect factor of our approximation guarantees as they are all multiplicative and hence scale-invariant. However, the analysis we perform is on the scaled distribution with optimal cost OPT′ = d−p/2 OPT. This extra term must be accounted for. We proceed assuming now that X ⊆ 1√ d Bd and π(X ) ⊆ Bm. E.2 Preserving Partition Costs Let (cid:100)cost(C, w), (cid:100)cost(π(C), w) be the weighted cost of the partition and projected partition, respec- tively. Recall this means that the points participate with weights w in the objective. Essentially, the next result shows that since the projection guarantees do not depend on the number of points we are projecting, we can simulate the weights by considering multiple copies of the points. Proposition E.5. Let x1, . . . , xn ∈ Rd be an instance of the Euclidean (k, p)-clustering problem and w1, . . . , wn ∈ R+ be weights which sum to 1. Fix ε ∈ (0, 1/4), δ ∈ (0, 1), and suppose π : Rd → Rm is a standard random dimension-reduction map with m = O (cid:18) p4 ε2 log (cid:19) . k εδ Then with probability at least 1 − δ, 1 1 + ε (cid:100)cost(C, w) ≤ (cid:100)cost(π(C), w) ≤ (1 + ε)(cid:100)cost(C, w), for every k-partition C of x1, . . . , xn. Proof (Proposition E.5). First suppose that wi = ai/bi for ai, bi ∈ Z+ and consider w′ i := lcm(b1, . . . , bn)wi ∈ Z+ obtained from wi by multiplying by the least common multiple of the denominators. Let y1, . . . , yn′ be the multiset obtained from x1, . . . , xn by taking w′ i multiples of xi. The cost of any partition of x1, . . . , xn with weights q1, . . . , qn is equal to the cost of the induced partition of y1, . . . , yn′ with uniform weights. Thus we can apply Theorem E.4 on y1, . . . , yn′ to conclude the proof. Now, for general wi ∈ R+, we remark by the density of the rationals in R that there are some q1, . . . , qn ∈ Q+ which sum to 1 and satisfy |qi − wi| < ε min((cid:91)OPT, (cid:91)OPTπ) 2 . n (cid:88) i=1 Then for any k-partition C and u(1), . . . , u(k) ∈ Bd, (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) n (cid:88) qi k (cid:88) i=1 j=1 1{xi ∈ C (j)}κ(xi, u(j))p − n (cid:88) wi k (cid:88) i=1 j=1 1{xi ∈ C (j)}κ(xi, u(j))p (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) 1{xi ∈ C (j)}κ(xi, u(j))p ≤ ≤ ≤ n (cid:88) i=1 n (cid:88) |qi − wi| k (cid:88) j=1 |qi − wi| i=1 ε 2 (cid:91)OPT. 36 In particular 1 1 + ε cost(C, w) ≤ cost(C, q) ≤ (1 + ε) cost(C, w). Similarly, for any v(1), . . . , v(k) ∈ Bm, k (cid:88) j=1 1{xi ∈ C (j)}κ(π(xi), v(j))p − n (cid:88) wi k (cid:88) i=1 j=1 1{xi ∈ C (j)}κ(π(xi), v(j))p (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) qi (cid:12) (cid:12) n (cid:88) (cid:12) (cid:12) (cid:12) (cid:12) i=1 ε 2 ≤ (cid:91)OPTπ, which implies that 1 1 + ε cost(π(C), w) ≤ cost(π(C), q) ≤ (1 + ε) cost(π(C), w). Finally, we conclude that cost(C, w) ≤ (1 + ε) cost(C, q) ≤ (1 + ε)2 cost(π(C), q) ≤ (1 + ε)3 cost(π(C), w) cost(π(C), w) ≤ (1 + ε)3 cost(C, w). Choosing ε′ to be a constant fraction of ε concludes the proof. Corollary E.6. Let x1, . . . , xn ∈ Rd be an instance of the weighted Euclidean (k, p)-clustering problem with non-negative weights w1, . . . , wn ∈ R+ which sum to 1. Fix ε ∈ (0, 1/4), δ ∈ (0, 1) and suppose π : Rd → Rm is a standard random dimension-reduction map with m = O (cid:18) p4 ε2 log (cid:19) . k εδ Then with probability at least 1 − δ, 1 1 + ε (cid:91)OPT ≤ (cid:91)OPTπ ≤ (1 + ε)(cid:91)OPT. Proof (Corollary E.6). The optimal clustering cost coincides with the cost of the partition induced by the optimal centers. E.3 Dimensionality Reduction Let G = {g(1), . . . , g(k)} be a β-approximate solution to the statistical Euclidean (k, p)-clustering problem on (π(X ), Pπ). We would like to argue that the partition of X induced by G is a (1 + ε)β- approximate partition with probability at least 1 − δ. To do so, we first approximate X with a finite set ̃X in a replicable fashion while preserving partition costs. This allows us to apply Proposition E.5. Recall we write Λ to denote a replicable estimate of OPT such that Λ ∈ [OPT/β(1+ε), (1 + ε) OPT] (cf. Theorem D.23). Consider a grid of length εΛ/(4p∆). for a point x ∈ X , we assign it to the center of the cell that it belongs to, say ̃x. Let ̃X := { ̃x : x ∈ X } denote this finite set and ̃P the distribution induced by the discretization. Remark that κ(x, ̃x) ≤ εΛ/(4p) for every x ∈ X . Note that a partition of X induces a partition of ̃X and vice versa. We proceed without making any distinction between the two. Proposition E.7. For any point u ∈ Bd, |κ(x, u)p − κ( ̃x, u)p| ≤ p|κ(x, u) − κ( ̃x, u)|. Proof. By the mean value theorem, the function g : [0, 1] → R given by z (cid:55)→ zp is p-Lipschitz: |g(y) − g(z)| ≤ sup ξ∈[0,1] ≤ p|y − z|. g′(ξ)|y − z| 37 We write (cid:103)cost(C) to denote the cost of the partition C of ̃X . Proposition E.8. For any partition C of X 1 1 + ε cost(C) ≤ (cid:103)cost(C) ≤ (1 + ε) cost(C). 1{x ∈ C (j)} * κ(x, u(j))p   − Ex   k (cid:88) 1{x ∈ C (j)} * κ( ̃x, u(j))p (cid:12)  (cid:12) (cid:12) (cid:12)  (cid:12) (cid:12) j=1  1{x ∈ C (j)} * |κ(x, u(j))p − κ( ̃x, u(j))p|  1{x ∈ C (j)} * p|κ(x, u(j)) − κ( ̃x, u(j))|   Proof. We have  (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) Ex  k (cid:88) j=1  ≤ Ex ≤ Ex k (cid:88)  j=1   k (cid:88) j=1 ≤ p * εΛ 4p ≤ ε 2 OPT . Corollary E.9. Fix ε ∈ (0, 1/4), δ ∈ (0, 1) and suppose π : Rd → Rm is a standard random dimension-reduction map with d = O (cid:18) p4 ε2 log (cid:19) . k εδ We have 1 (1 + ε) OPT ≤ (cid:93)OPTπ ≤ (1 + ε) OPT , with probability at least 1 − δ, where the probability is taken w.r.t. the choice of the random map. Proof. The optimal clustering cost coincides with the cost of the partition induced by the optimal centers. An application of Proposition E.8 yields the desired result. Theorem E.10. Fix ε ∈ (0, 1/4), δ ∈ (0, 1) and suppose π ∈ πd,m is a standard random dimension- reduction map with (cid:18) p4 (cid:19) k εδ m = O ε2 log Let G = {g(1), . . . , g(k)} be a β-approximate solution to the statistical Euclidean (k, p)-clustering problem on (π( ̃X ), ̃Pπ). Then the partition of X induced by G is a (1 + ε)β-approximate partition with probability at least 1 − δ. That is, for C = {C (1), . . . , C (k)} given by . C (j) := x ∈ X : g(j) = argming∈G κ(π( ̃x), g(j))p(cid:111) (cid:110) , cost(C) ≤ (1 + ε)β OPT . we have Proof. We have cost(C) ≤ (1 + ε)(cid:103)cost(C) ≤ (1 + ε)2 (cid:103)cost(π(C)) ≤ (1 + ε)2 (cid:103)cost(G) ≤ (1 + ε)2β (cid:93)OPTπ ≤ (1 + ε)3β OPT . Proposition E.8 Proposition E.5 G induces π(C) G is β-approximate Corollary E.9 Choosing ε′ to be a constant fraction of ε concludes the proof. 38 E.4 Summary of Dimensionality Reduction Before proving Theorem 5.1, let us summarize the stages of our pipeline. √ d. 1) Scale the input data by 1/ 2) Estimate OPT of the scaled data within a multiplicative error. 3) Discretize the scaled data with a fine grid. 4) Project the scaled data with a random map π ∈ πd,m. 5) Compute a coreset on the projected data. 6) Estimate the probability mass at each point of the coreset. 7) Call the β-approximation oracle to produce k centers g(1), . . . , g(k). 8) Output the clustering function induced by the centers. The clustering function proceeds as follows. Given a point x ∈ X , √ d. 1) Scale x by 1/ 2) Discretize the scaled point with the same grid used in the algorithm. 3) Project the discretized point using the same π used in the algorithm. 4) Output the label of the closest center g(j) in the lower dimension for j ∈ [k]. We are now ready to prove Theorem 5.1, which we restate below for convenience. Theorem 5.1 (Theorem 3.2; Formal). Let ε, ρ ∈ (0, 1) and δ ∈ (0, ρ/3). Given a β-approximation oracle for weighted Euclidean k-medians (k-means), there is a ρ-replicable algorithm that outputs a clustering function such that with probability at least 1 − δ, the cost of the partition is at most (1 + ε)β OPT. Moreover, the algorithm has sample complexity (cid:32) ̃O poly (cid:18) kd ρ OPT (cid:1). where m = O (cid:0) 1 ε2 log k δε (cid:19) (cid:18) 2 √ (cid:19)O(m) (cid:33) , 1 δ log m ε Proof (Theorem 5.1). We randomly draw some π ∈ πd,m for d = O ε2 log Then, we discretize a sufficiently large sample after scaling and push it through π. We then run the corresponding algorithm (cf. Theorem 4.2, Theorem 4.3) to produce some centers G for the compressed data. This allows us to partition X according to the closest member of G in the lower dimension. An application of Theorem E.10 yields the performance guarantees of this algorithm. . (cid:18) p4 (cid:19) k εδ The sample complexity guarantee from Theorem 4.2, Theorem 4.3 is for the scaled distribution and the scaled optimal cost satisfies OPT′ π = d−p/2 OPTπ. Hence the sample complexity resolves to (cid:18) kd (cid:19) (cid:18) 2 (cid:19)O(m) √ (cid:33) (cid:32) ̃O poly ρ OPT m ε log 1 δ We conclude the proof by remarking that for the Euclidean metric, ∆ = O(log n)O(log n) = nO(log log n). √ d and that F k-Centers In this section, we will explain our approach to solving the statistical k-centers problem (cf. Prob- lem 2.3). As we explained before, since this problem has a different flavor compared to (k, p)- clustering, we introduce some extra assumptions in order to be able to solve it from samples. To the best of our knowledge, this is the first work that considers a model of statistical flavor for the k-centers problem. 39 F.1 Assumptions First, we describe an assumption that is necessary to obtain good clustering solutions even if we do not insist on using replicable algorithms. Assumption F.1 (Clusterable). For some absolute constants β, B > 0, an i.i.d. sample S = x1, . . . , xn of size n from P has the following property. With probability at least q, there exists some (β, B)-approximate solution F∗ to Problem 2.3 such that, for every f ∈ F∗ there is some xf ∈ S with F∗(xf ) = f . Here q ∈ [0, 1]. Assumption F.1 is necessary to obtain good clustering solutions even in the non-replicable case. Our distribution P must be sufficiently well-behaved so that solving the sample k-centers problem translates to a good solution in the population case. Essentially, this assumption states that with high probability, the sample will contain a point from every single cluster of some (β, B)-approximate solution. In order to design replicable algorithms, we need to make a stronger assumption. Assumption F.2 (Replicable). For some absolute constants β, B, there exists a (β, B)-approximate solution F∗ to Problem 2.3 with the following property. With probability at least q, in an i.i.d. sample S = x1, . . . , xn of size n from P, for every f ∈ F∗, there is some xf ∈ S with F∗(xf ) = f . Here q ∈ [0, 1]. Note that Assumption F.1 guarantees that, with high probability, every sample will help us identify some good solution. However, these good solutions could be vastly different when we observe different samples, thus this assumption is not sufficient to design a replicable algorithm with high utility. Assumption F.2 is necessary to attain replicable solutions. Indeed, this assumption essentially states that there is a fixed solution for which we will observe samples from every cluster with high probability. If this does not hold and we observe points from clusters of solutions that vary signifi- cantly, we cannot hope to replicably recover a fixed approximate solution. Note that Assumption F.2 is stronger than Assumption F.1, since we have flipped the order of the existential quantifiers. One way to satisfy this assumption is to require that there is some (β, B)-approximate solution so that the total mass that is assigned to every cluster of it is at least 1/n for some n ∈ N. Then, by observing (cid:101)O(n) points, we will receive at least one from every cluster with high probability. This is made formal in Proposition F.3. Proposition F.3 ([Janson, 2018]). Let δ ∈ (0, 1). Under Assumption F.2, a sample of O (cid:18) nm q log (cid:19) 1 δ points contains at least m points from each cluster of F∗ with probability at least 1 − δ. Proof (Proposition F.3). Let Yi be a geometric variable with success rate q, which denotes the number of batches of n samples we draw until a point from each cluster of F∗ is observed. Then Y := (cid:80)m As shown in Janson [2018], i=1 Yi upper bounds the number of batches until we obtain m points from each cluster. P{Y ≥ λEY } ≤ exp(1 − λ) EY = m q . The result follows by picking λ = 1 + log(1/δ). F.2 High-Level Overview of the Approach We are now ready to provide a high-level overview of our approach to derive Theorem 3.3. We first take a fixed grid of side c in order to cover the unit ball. Then, we sample sufficiently many points from P. Subsequently, we round all the points of the sample to the centers of the cells of the grid that they fall into. Using these points, we empirically estimate the density of the distribution on every cell of the grid. Next, in order to ensure that our solution is replicable, we take a random threshold from a predefined interval and discard the points from all the cells whose density falls below the threshold. Finally, we call the approximation oracle that we have access to using the points that have survived after the previous step. We remark that unlike the (k, p)-clustering problem (cf. Problem 2.1), to the best of our knowledge, there does not exist any dimensionality reduction techniques that apply to the k-centers problem. In the following subsections we explain our approach in more detail. 40 F.3 Oracle on Sample As we explained before, we require black-box access to an oracle O for the combinatorial k-centers problem on a sample which outputs ( (cid:98)β, (cid:98)B)-approximate solutions (cid:98)F for Problem 2.4. Thus, we need to show that, with high probability, the output of this solution is a good approximation to Problem 2.3. This is shown in Proposition F.4. Proposition F.4. Suppose there is a (β, B)-approximate solution F∗ for Problem 2.3 and that we are provided with a sample of size O(n log(1/δ)/q) containing an observation from each cluster of F∗, with probability at least 1 − δ. Then, the output (cid:98)F of the oracle O on the sample satisfies for all x ∈ X , with probability at least 1 − δ. κ(x, (cid:98)F ) ≤ (2β + (cid:98)β) OPT +2B + (cid:98)B. In the previous result (β, B), ( (cid:98)β, (cid:98)B) are the approximation parameters that we inherit due to the fact that we receive samples from P and that we solve the combinatorial problem approximately using O, respectively. Proof (Proposition F.4). Let F∗ denote the (β, B)-approximate solution from Assumption F.2. We condition on the event that such a solution exists in the sample, which occurs with probability at least 1 − δ. Fix x ∈ X , which is not necessarily observed in the sample. We pay a cost of β OPT +B to travel to the nearest center of F∗. Next, we pay another β OPT +B to travel to the observed sample from this center. Finally, we pay a cost of (cid:100)cost( (cid:98)F ) ≤ (cid:98)β (cid:91)OPT + (cid:98)B ≤ (cid:98)β OPT + (cid:98)B. to arrive at the closest center in (cid:98)F . F.4 Oracle with Grid The issue with using directly the output of O on a given sample is that the result will not be replicable, since we have no control over its behavior. In a similar way as with the (k, p)-clustering problem, the main tool that we have in our disposal to "stabilize" the output of O is to use a grid. Unlike the other problems, we cannot use the hierarchical grid approach in this one. The reason is that, due to the min-max nature of k-centers, we need to cover the whole space and not just the points where the distribution is dense. Recall that so far we have established that the oracle O outputs (2β + (cid:98)β, 2B + 2 (cid:98)B)-approximate solutions F for Problem 2.3, given that Assumption F.2 holds. Algorithm F.1 "discretizes" the points of the sample using a grid with side-length c before applying the oracle. Proposition F.5 shows that by doing that, we have to pay an extra additive term that is of the order O(c∆). Algorithm F.1 Oracle with Grid 1: Oracle with Grid(oracle O, sample x1, . . . , xn, grid length c): 2: for i ← 1, . . . , n do 3: 4: 5: end for 6: Return O( ̃x1, . . . , ̃xn) i for some zi ∈ Zd, x′ Decompose xi = zi * c + x′ ̃xi ← zi * c + (c/2, c/2, . . . , c/2) { ̃xi is the center of the cell that contains xi.} i ∈ [0, c)d Proposition F.5. Suppose there is a (β, B)-approximate solution F∗ for Problem 2.3 and that we are provided with a sample of size n containing an observation from each cluster of F∗. Let ̃G denote the output of Algorithm F.1 using a ( ˆβ, ˆB)−approximation oracle O for Problem 2.4. Then, for any x ∈ X , κ(x, ̃G) ≤ (2β + (cid:98)β) OPT +2B + (cid:98)B + (4β + 2 ˆβ + 1)c∆ . 41 Proof (Proposition F.5). For the sake of analysis, imagine we used the grid to discretize all points of X (cid:55)→ ̃X . Then F∗ is a solution with cost β (cid:93)OPT + B + c∆ and we observe a point from each of its clusters in our discretized sample. Here (cid:93)OPT is the cost of a solution to Problem 2.3 on ̃X . Proposition F.4 shows that the oracle returns a solution (cid:101)G with cost at most (2β + (cid:98)β)(cid:93)OPT + (2B + c∆) + (cid:98)B on the discretized points. Then for any x ∈ X , (cid:93)OPT = κ(x, ̃GOPT) ≤ κ(x, ̃x) + κ( ̃x, ̃GOPT) ≤ κ(x, ̃x) + κ ( ̃x, FOPT) ≤ 2κ(x, ̃x) + κ(x, FOPT) ≤ 2c∆ + OPT . The conclusion follows by combining the two inequalities. F.5 Replicable Active Cells At a first glance, we might be tempted to work towards replicability by arguing that, with high probability, every grid cell is non-empty in one execution of the algorithm if and only if it is non- empty in another execution. However, since we have no control over P, it is not clear how one can prove such a statement. Our approach is to take more samples and ignore cells which do not have a sufficient number of points using some random threshold. The idea is similar to the heavy-hitters algorithm (cf. Algorithm D.2) originally conceived by Impagliazzo et al. [2022] and is presented in Algorithm F.2. Then, we move all the points of active cells to the center of the cell. Notice that in the k-center objective, unlike the (k, p)-clustering objective, we do not care about how much mass is placed in a cell, just whether it is positive or not. We first derive a bound on the number of cells that the distribution puts mass on. It is not hard to see that since we are working in a bounded domain, the grid contains at most (1/c)d cells in total. Thus there are at most M ≤ (1/c)d cells that have non-zero mass. Proposition F.6 shows how we can obtain such a bound in the unbounded domain setting. Proposition F.6. Let F∗ be a (β, B)-approximate solution for Problem 2.3. Let M denote the maximum number of cells which intersect some cluster of F∗ and ̃P the discretized distribution that is supported on centers of the cells of the grid of size c. Then, the support of ̃P is at most kM where M ≤ (cid:18) c + 2c∆ + 2(β OPT +B) c (cid:19)d . Proof (Proposition F.6). Fix a center f and consider the cell Z containing the center. The farthest point in the farthest cell in the cluster of f is of distance at most β OPT +B + c∆ and thus the cells we are concerned with sit in an l∞ ball of that radius. Not including Z, we walk past at most cells along the canonical basis of Rd, hence there are at most β OPT +B + c∆ c (cid:20) 1 + 2c∆ + 2 c (cid:21)d (β OPT +B) such cells. Notice that the previous discussion and Proposition F.5 reveal a natural trade-off in the choice of the parameter c: by reducing c, we decrease the additive error of our approximation algorithm but we increase the number of samples at a rate (1/c)d. Since we have bounded the number of cells from which we can observe a point, the next step is to use a sufficiently large number of samples so that we can estimate replicably whether a cell is active or not. This is demonstrated in Algorithm F.2. 42 Algorithm F.2 Replicable Active Cells 1: rActiveCells(grid length c): 2: m ← ̃O (cid:0)λknM 2/ρ2(cid:1) 3: N ← λnmM 4: Sample x1, . . . , xN ∼ P, 5: Lazy initialize counter Z = 0 for every cell of the grid with length c 6: for i ← 1, . . . , N do 7: Gi ← cell that samples xi falls into Increment Z(Gi) ← Z(Gi) + 1 8: 9: end for 10: Choose v ∈ [0, m/N] uniformly randomly 11: Output all Gi such that Z(Gi)/N ≥ v Proposition F.7. Suppose Assumption F.2 holds and let F∗ be the (β, B)-approximate solution. Let δ, ρ ∈ (0, 1). Then Algorithm F.2 is ρ-replicable and returns cells of the grid such that at least one sample from each cluster of F∗ falls into these cells with probability at least 1 − δ. Moreover, it has sample complexity ̃O (cid:18) n2kM 3 log(1/δ) q2ρ2 (cid:19) . Proof (Proposition F.7). Enumerate the kM cells within the support of P and let the counter Z (j) denote the number of samples at the j-th cell. Then Z = (Z (1), . . . , Z (kM )) follows a multinomial distribution with parameters (p(1), . . . , p(kM )) and N, where p is unknown to us. Nevertheless, by Proposition B.1, for any ε ∈ (0, 1), sampling N ≥ ln 5/δ + kM ln 2 2ε2 points implies that (cid:80)a N , this is equivalent to j=1|(cid:98)p(j) − p(j)| < 2ε with probability at least 1 − δ/5. From the definition of m ≥ ln 5/δ + kM ln 2 nM ε2 . By Proposition F.3, we observe at least mM points from each cluster of F∗ with probability at least 1 − δ. Let (cid:98)p(j) by the triangle inequality, (cid:80)kM 2 be the empirical mean of Z (j) across two different executions of Algorithm F.2. Then 1 , (cid:98)p(j) j=1|(cid:98)p(j) 1 − (cid:98)p(j) 2 | ≤ 4ε. Since we observe at least M m points from each cluster of F∗, there is at least one point from each cluster with at least m observations. Thus outputting the points j such that (cid:98)p(j) ≥ v for some v ∈ [0, m/N] means we always output one point from each cluster. Now, the outputs between two executions are not identical only if the point v "splits" some pair 1 , (cid:98)p(j) (cid:98)p(j) 2 . This occurs with probability at most 4ε/(m/N ) = 4N ε/m, To bound this value by ρ/5, set ε ≤ = ρm 20N ρ 20λnM . Plugging this back yields m ≥ 400λnM ln 5 δ + 400λnkM 2 ln 2 ρ2 . All in all, Algorithm F.2 outputs the desired result with probability at least 1 − δ and is ρ-replicable given samples from P. ̃O (cid:18) n2kM 3 log(1/δ) q2ρ2 (cid:19) 43 F.6 Putting it Together We now have all the ingredients in place to prove Theorem 3.3. The proof follows directly by combining Proposition F.5, and Proposition F.7. Essentially, we replicably estimate the active cells of our grid and then move all the points of each active cell to its center. For completeness, we also state the formal version of Theorem 3.3. Theorem F.8 (Theorem 3.3; Formal). Let δ, ρ ∈ (0, 1). Suppose Assumption F.2 holds and let F∗ be the (β, B)-approximate solution. Then, given black-box access to a ( ˆβ, ˆB)-approximation oracle for Problem 2.4, Algorithm F.2 is ρ-replicable and returns a solution ˆF such that κ(x, ˆF ) ≤ (2β + (cid:98)β) OPT +2B + (cid:98)B + (4β + 2 ˆβ + 1)c∆ with probability at least 1 − δ. Moreover, the algorithm requires at most (cid:32) ̃O n2k (1/c)3d log(1/δ) q2ρ2 (cid:33) samples from P. 44
http://arxiv.org/abs/2302.10351v1
2023-02-20T22:34:43
2023-02-20T22:34:43
Variational Autoencoding Neural Operators
Unsupervised learning with functional data is an emerging paradigm of machine learning research with applications to computer vision, climate modeling and physical systems. A natural way of modeling functional data is by learning operators between infinite dimensional spaces, leading to discretization invariant representations that scale independently of the sample grid resolution. Here we present Variational Autoencoding Neural Operators (VANO), a general strategy for making a large class of operator learning architectures act as variational autoencoders. For this purpose, we provide a novel rigorous mathematical formulation of the variational objective in function spaces for training. VANO first maps an input function to a distribution over a latent space using a parametric encoder and then decodes a sample from the latent distribution to reconstruct the input, as in classic variational autoencoders. We test VANO with different model set-ups and architecture choices for a variety of benchmarks. We start from a simple Gaussian random field where we can analytically track what the model learns and progressively transition to more challenging benchmarks including modeling phase separation in Cahn-Hilliard systems and real world satellite data for measuring Earth surface deformation.
[ "Jacob H. Seidman", "Georgios Kissas", "George J. Pappas", "Paris Perdikaris" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10351v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10351v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "stat.ML" ]
3 2 0 2 b e F 0 2 ] G L . s c [ 1 v 1 5 3 0 1 . 2 0 3 2 : v i X r a VARIATIONAL AUTOENCODING NEURAL OPERATORS A PREPRINT Jacob H. Seidman Electrical and Systems Engineering Mechanical Engineering and Applied Mechanics University of Pennsylvania [email protected] Georgios Kissas Mechanical Engineering and Applied Mechanics University of Pennsylvania [email protected] George J. Pappas Electrical and Systems Engineering University of Pennsylvania [email protected] Paris Perdikaris Mechanical Engineering and Applied Mechanics University of Pennsylvania [email protected] February 22, 2023 ABSTRACT Unsupervised learning with functional data is an emerging paradigm of machine learning research with applications to computer vision, climate modeling and physical systems. A natural way of modeling functional data is by learning operators between infinite dimensional spaces, leading to discretization invariant representations that scale independently of the sample grid resolution. Here we present Variational Autoencoding Neural Operators (VANO), a general strategy for making a large class of operator learning architectures act as variational autoencoders. For this purpose, we provide a novel rigorous mathematical formulation of the variational objective in function spaces for training. VANO first maps an input function to a distribution over a latent space using a parametric encoder and then decodes a sample from the latent distribution to reconstruct the input, as in classic variational autoencoders. We test VANO with different model set-ups and architecture choices for a variety of benchmarks. We start from a simple Gaussian random field where we can analytically track what the model learns and progressively transition to more challenging benchmarks including modeling phase separation in Cahn-Hilliard systems and real world satellite data for measuring Earth surface deformation. 1 Introduction Much of machine learning research focuses on data residing in finite dimensional vector spaces. For example, images are commonly seen as vectors in a space with dimension equal to the number of pixels [1] and words are represented by one-hot encodings in a space representing a dictionary [2]. Architectures that act on such data are built with this structure in mind; they aim to learn maps between finite dimensional spaces of data. Variational Autoencoding Neural Operators A PREPRINT On the other hand, physics often models signals of interest in the natural world in terms of continuous fields, e.g. velocity in fluid dynamics or temperature in heat transfer. These fields are typically functions over a continuous domain, and therefore correspond to vectors in infinite-dimensional vector spaces, also known as functional data. To use machine learning tools for continuous signals in these physical applications, models must be able to act on and return representations of functional data. The most straightforward way to do this is known as the discretize-first approach. Here, functional data is mapped into a finite dimensional vector space via measurements along a predefined collection of locations. At this point, standard machine learning tools for finite dimensional data can be used to generate measurements of a desired output function, also evaluated along a predefined set of locations. The drawback of these methods is their rigidity with respect to the underlying discretization scheme; they will not be able to evaluate the output function at any location outside of the original discretization. As an alternative, operator learning methods aim to design models which give well defined operators between the function spaces themselves instead of their discretizations. These methods often take a discretization agnostic approach and are able to produce outputs that can be queried at arbitrary points in their target domain. The Graph Neural Operator [3] proposed a compositional architecture built from parameterized integral transformations of the input combined with point-wise linear and nonlinear maps. This approach was modified to leverage fast Fourier transforms in computing the integral transform component, leading to the Fourier Neural Operator [4], U-net variants [5], as well as guarantees of universal approximation [6]. Inspired from one of the first operator architectures in [7], the DeepONet [8] uses finite dimensional representations of input functions to derive coefficients along a learned basis of output functions. While this approach has been shown to have universal approximation properties as well [9], the required size of the architecture can scale unfavorably due to the linear nature of the output function representations [9, 10]. Under the assumption that the output functions concentrate along a finite dimensional manifold in the ambient function space, [10] proposed a model which builds nonlinear parameterizations of output functions and circumvents the limitations of purely linear representations. While much recent work has focused on designing methods for functional data in a supervised setting, less has been done for unsupervised learning. Here we focus on two key aspects of unsupervised learning, namely dimensionality reduction and generative modeling. For dimensionality reduction of functional data living in a Hilbert space, the inner product structure allows for generalizations of principal components analysis (PCA) [11], also known as proper orthogonal decomposition [12]. Kernel tricks can also be employed on functional data to obtain nonlinear versions of PCA in feature spaces [13]. A generalization of the manifold learning [14] approach was taken in [15] to learn distance preserving and locally linear embeddings of functional data into finite dimensional spaces. Generative modeling of functional data has been approached by defining stochastic processes with neural networks, dubbed neural processes [16, 17, 18]. Adversarial generative models for continuous images trained on point-wise data have also been proposed in [19] and [20], while a variational autoencoder (VAE) approach with neural radiance fields (NeRFs) was taken in [21]. These methods formulate their training objective in terms of point-wise measurements, resulting in models which learn to maximize the probability of observing a collection of points and not a function itself. This makes the function sampling density play a decisive role in how well the model performs; if high and low resolution data coexist in a data-set, the model will over-fit the high resolution data [22]. Recently, the U-net FNO architecture [5] was used in the Generative Adversarial Neural Operator (GANO) framework [22] to build a generator acting on samples of Gaussian random fields and a functional discriminator in order to overcome the aforementioned drawbacks. In this paper, we provide a novel method of using encoder-decoder operator learning architectures for dimensionality reduction and generative modeling of functional data. Under the manifold hypothesis for functional data [10], if we train these models to learn the identity map then the latent space attempts to learn finite dimensional coordinates for the data manifold. In Figure 1 we give a visual representation of our approach. We will additionally view the data as coming from a generative model on this coordinate space and train the corresponding operator learning architecture via an auto-encoding variational Bayes approach. The decoder component of the architecture then creates functions from samples in the latent coordinate space which can be queried at any point along their domain. To overcome over-fitting pathologies at higher data resolutions we describe the variational objective in a discretization agnostic way by putting forth a well-defined formulation with respect to the functional data space instead of spaces of point-wise evaluations. Our main contributions can be summarized as: • We provide the first rigorous mathematical formulation of a variational objective which is completely dis- cretization agnostic and easily computable. 2 Variational Autoencoding Neural Operators A PREPRINT Figure 1: Schematic representation of the VANO framework: The encoder Eφ maps a point from the input function manifold to a random point sampled from a variational distribution Qφ z|u which is then mapped to a point on the output function manifold using the decoder Dθ. • Using this objective, we give a novel formulation of a variational autoencoder for functional data with operator learning architectures. • We perform zero-shot super-resolution sampling of functions describing complex physical processes and real world satellite data. • We demonstrate state-of-the-art performance in terms of reconstruction error and sample generation quality while taking a fraction of the training time and model size compared to competing approaches. Outline of paper: The remainder of the paper will be structured as follows. First we will describe the class of encoder-decoder operator learning architectures and describe how they perform dimensionality reduction on functional data. Next, we will briefly review the VAE formulation for finite dimensional data before giving a mathematically precise generalization to functional data and describing the components of our model. Section 6 will present several experiments illustrating the effectiveness of this approach. Notation We denote our functional data by u ∈ X , where X is a function space over some domain X ⊂ Rd. Typically we will take X = L2(X) or X = H s(X), where H s(X) is the Sobolev space of index s over X. Probability measures will be denoted by blackboard bold typefaced letters P, Q, and V. 2 Encoder-Decoder Neural Operators A large class of architectures built to learn mappings between spaces of functions X → Y make use of a finite dimensional latent space in the following way. First, an encoding map E : X → Rn is learned from the input functions to a n-dimensional latent space. Then, the latent code corresponding to a functional input, z = E(u) is mapped to a queryable output function via a decoding map D : Rn → Y, f (*) = D(z). For example, in the DeepONet architecture [8], input functions u are mapped via a "branch network" to a hidden vector z ∈ Rn, which is then used as coefficients of a learned basis to reconstruct an output function. These methods can be interpreted as giving a finite dimensional parameterization to the set of output functions, where the parameters for a fixed output function are determined from the corresponding input function. 2.1 Linear versus Nonlinear Decoders It was shown in [10] that when these kinds of architectures build output functions in a linear manner from the latent space, such as in [8, 23, 24], they may miss low dimensional nonlinear structure in the set of output functions that can otherwise be captured by a nonlinear map from the latent space to the output function space. The authors further gave an interpretation of this architecture under the assumption that the distribution of output functions concentrates on a low dimensional manifold in its ambient function space. In this setting, the decoder map ideally would learn a coordinate chart between the finite dimensional latent space and the manifold of output functions. This suggests that successful architectures are implicitly performing dimensionality reduction on the set of output functions. 2.2 Dimensionality Reduction through the Latent Space We will follow this interpretation to create a natural extension of encoder-decoder operator learning architectures for dimensionality reduction and generation of functional data. If the input and output function spaces are the same X = Y 3 Variational Autoencoding Neural Operators A PREPRINT and we learn the identity map on our data factored through a finite dimensional latent space, then the encoding map E : X → Rn gives a lower dimensional representation of our functional data. That is, when trained to approximate the identity map, these architectures become functional autoencoders. If we additionally would like to generate new samples of our functional data with this framework, it would suffice to learn a probability measure over the latent space corresponding to the finite dimensional embedding of our data. Similar to the non-functional data case, this can be modelled through the use of a Variational Auto-Encoder (VAE) [25], which takes a Bayesian approach to determining latent representations of observed data. While this method has been studied extensively on finite dimensional data, its extension to functional data has only been explored specifically for neural radiance fields in [21], where the variational objective is formulated in terms of point-wise measurements. In this paper, we will place operator learning architectures with a finite dimensional latent space, such as DeepONet [8] and NOMAD [10], within the formalism of autoencoding variational Bayesian methods to simultaneously obtain a new method of dimensionality reduction and generative modeling for functional data. To do so, we must be careful to reformulate the VAE objective in function spaces. Variational objectives have been formulated considering latent spaces as function spaces, as in [26, 27], but a variational objective where the likelihood term is described in a functional data space has not yet been addressed. As we will see, while the immediate application of the formulation for finite dimensional data does not apply, there exists an appropriate generalization which is mathematically rigorous and practically well behaved. The benefit of the function space formulation is the lack of reference to a particular choice of discretization of the data, leading to a more flexible objective which remains valid under different measurements of the functional data. 3 VAEs for Finite Dimensional Data Here we review a simple generative model for finite dimensional data and the resulting variational Bayesian approach to inference in the latent space. For this subsection only, we will define our data space as X = Rd. As before, let the latent space be Z = Rn, often with n << d. Assume the following generative model for samples of u from its probability measure Pu on X . Let Pz be a prior probability measure on Z, D : Z → X a function from the latent space to the data space, and η a noise vector sampled from a probability measure V on X such that u = D(z) + η, z ∼ Pz, η ∼ V, (1) is distributed according to Pu. According to this model, there exists a joint probability measure P on Z × X with marginals Pz and Pu as defined above. Assume these three measures have well defined probability density functions, p(z, u), p(z) and p(u), respectively, and conditional densities p(z|u) and p(u|z). Under full knowledge of these densities, we can form a low dimensional representation of a given data point u by sampling from p(z|u). However, in general, the evaluation of the conditional density is intractable. This motivates the variational approach [25], where we instead create a parameterized family of distributions qφ(z|u), and attempt to approximate the true conditional p(z|u) with qφ(z|u). When the KL divergence is used as a quality of approximation from qφ(z|u) to p(z|u), this can be approached with the following optimization problem minimize φ E u∼p(u) (cid:2)KL[qφ(z|u) || p(z|u)](cid:3) . (2) Since we do not have access to p(z|u) and cannot evaluate the KL divergence term above, we optimize instead a quantity known as the Evidence Lower Bound (ELBO), L = − E [log p(u|z)] + KL[qφ(z|u) || p(z)], z∼qφ(z|u) (3) which differs from the objective in (2) by a data-dependent constant, KL[qφ(z|u) || p(z|u)] = −L + log p(x) (4) When the prior p(z) is a Gaussian and the variational distribution qφ(z|u) is also Gaussian with a mean and variance dependent on the input u through a parameterized encoding map Eφ(u) = (μφ(u), σφ(u))), the KL term in (3) has a closed form. Under the assumption that the noise vector in (1) is a centered Gaussian with isotropic covariance, η ∼ N (0, δ2I), the log likelihood term is equal to log p(u | z) = log(2πδ2)−d/2 − 1 2δ2 (cid:107)u − D(z)(cid:107)2 2. (5) 4 Variational Autoencoding Neural Operators A PREPRINT By parameterizing the function D as well, we arrive at an objective function that can be used to train the encoder Eφ and decoder Dθ in an end-to-end fashion. 4 VAEs for Functional Data We begin formulating a VAE in this case analogously to the previous section; we posit the generative model in (1) which induces a joint measure P on Z × X with marginals Pu and Pz. Under mild assumptions on the spaces Z and X (such as being a separable Banach spaces), there exist regular conditional measures Pz|u and Pu|z which are well defined Pu-a.e. and Pz-a.e., respectively. At this point the formulation begins to diverge from the finite dimensional case. In an infinite dimensional function space, such as X , we no longer have a canonical notion of a probability density function to formulate our objective function and ELBO. In particular, the first term of (3) is no longer well defined as written. We will instead reason in terms of the probability measures Pu, Pz, Pz|u, Pu|z, the variational family of measures Qφ z|u, the noise process measure V, and various Radon-Nikodym derivatives between them. Proceeding in this manner we are able to derive the appropriate generalization of (3) for data in the function space X . Theorem 4.1. Let X and Z be Polish spaces. Given the generative model (1), assume that the conditional measure Pu|z is absolutely continuous with respect to the noise measure V. Then the following holds with KL[Qφ z|u || Pz] = −L + log dPu dV . L = − E z∼Qφ z|u (cid:104) log dPu|z dV (u) (cid:105) + KL[Qφ z|u || Pz] (6) (7) Proof. The proof is provided in Appendix 4.1. The benefit of this formulation is that the objective function makes no reference to any particular choice of discretization or available function measurements. In this sense, it is a training objective that is truly defined on a function space; whatever measurements are available will be used to approximate this objective, ensuring a form of consistency over varying discretization schemes. 4.1 Computing the ELBO Objective To compute the likelihood term in (7), first note that under the generative model (1), given z ∈ Z the conditional measure Pu|z corresponds to a shifted version of the noise process centered at D(z). The Radon-Nikodym derivative dPu|z dV then represents the change of measure of V under a shift by D(z). In this work we will assume that V is a Gaussian measure on the space X . Changes of measure for translated Gaussian measures are well understood and are described by the Cameron-Martin formula (see Appendix A); this will be the main tool which allows us to evaluate the first term in (7). In particular, we will take η to be a pure white noise process and V the corresponding white noise measure. Note that this implies that our measured signals must live in the dual Sobolev space X = H −s(X) for any s > d/2 [28]. In this case, the Cameron-Martin formula gives log dPu|z dV (u) = − 1 2 (cid:107)D(z)(cid:107)2 L2 − (cid:104)D(z), u(cid:105)∼, (8) where (cid:104)D(z), u(cid:105)∼ can be thought of as the inner product on L2(X) extended to H −s(X) in the second argument and is well defined a.e. with respect to the noise process V. Given sensor measurements of u, we can approximate this second term as the standard inner product with the corresponding measurements of D(z). For more details on Gaussian measures in Banach spaces, white noise, and the Cameron-Martin formula see Appendix A. Note that the expression in (8) is the same as − 1 2 (cid:107)D(z) − u(cid:107)2 L2 = − 1 2 (cid:107)D(z)(cid:107)2 L2 − (cid:104)D(z), u(cid:105) − 1 2 (cid:107)u(cid:107)2 L2, except for the last term. This is what we would expect to see when our data is not functional and lies in Rd with a Gaussian likelihood, but since u is drawn from a shifted white noise measure it is not in L2. However, we see that the 5 Variational Autoencoding Neural Operators A PREPRINT Figure 2: Representative function samples from the different benchmarks considered in this work. Left: Example functions from the testing data-sets, Right: Super-resolution samples generated by VANO. expression we derived instead for the likelihood is the same as what we would like to use up to the model independent term (cid:107)u(cid:107)2 L2. In this sense, the white noise likelihood formulation of the ELBO is the natural extension of the Gaussian likelihood from the finite dimensional case. 5 Variational Autoencoding Neural Operators Given Theorem 4.1 we can define the full Variational Autoencoding Neural Operator (VANO) after making choices for the encoding and decoding maps. See Figure 1 for a visual illustration of the overall architecture. Encoder: The encoder will map a function u ∈ X to the probability measure Qφ z|u on the latent space Rn. We choose the variational family Qφ z|u to be multivariate Gaussians with diagonal covariance. It then suffices that the encoding map takes as input the function u, and returns a mean μ(u) ∈ Rn and n positive scalars σ1, . . . , σn = σ ∈ Rn to parameterize this Gaussian. Hence, we define the encoder as a map E φ : X → Rn × Rn. In this paper, we will use architectures which pass measurements of the input function u through a neural network of fixed architecture. These measurements can either be point-wise, as we take to be the case in this paper, but could also be projections onto sets of functions such as trigonometric polynomials, wavelets, or other parameterized functions. Decoder: The decoder will take a sample z of a probability measure on the latent space Rn and map it to a function D(z) ∈ X that can be queried at any point. In this paper, we will parameterize decoders by defining a neural network which takes in points in the domain of the functions in X , and condition its forward pass on the latent variable z. Here we will use two main variations of this conditioning process: linear conditioning, and concatenation conditioning (see Appendix C.2 for details). Evaluating ELBO for Training: Given a data-set of N functions {ui}N objective function i=1, we train VANO by optimizing the L(φ, θ) = 1 N N (cid:88) (cid:104) EQφ z|ui (cid:20) 1 2 (cid:107)Dθ(z)(cid:107)2 L2 − (cid:104)Dθ(z),ui(cid:105)∼ (cid:21) + KL[Qφ (cid:105) z|ui || Pz] . (9) z|ui is approximated via Monte-Carlo by sampling S latent variables z ∼ Qφ i=1 The expectation over the posterior Qφ z|ui and computing an empirical expectation. The re-parameterization trick [25] is used when sampling from Qφ z|ui to decouple the randomness from the parameters of the encoder E φ and allow for the computation of gradients with respect to the parameters φ. As D(z) can be evaluated at any point in the domain X, we can approximate the terms inside this expectation with whichever measurements are available for the data ui. For example, with point-wise measurements u(x1), . . . , u(xm) we can use the approximation (cid:104)Dθ(z), ui(cid:105)∼ ≈ m (cid:88) i=1 6 Dθ(xi)u(xi). (10) Variational Autoencoding Neural Operators A PREPRINT To avoid pathologies in the optimization of (9), we train our models with a scalar hyper-parameter β in front of the KL divergence term as in [29] to balance the interplay between the KL and reconstruction losses. 6 Experiments In this section we consider four examples for testing the performance of our model. In the first example, we learn the distribution corresponding to a Gaussian random field (GRF). We show that a model with a linear decoder architecture is able to accurately recover the Karhunen-Loéve decomposition [30], which is known to be an L2 optimal dimension reduced approximation of the true field. Next, we examine the impact of different decoder architectures for learning distributions which do not immediately concentrate on low dimensional linear spaces, using a functional data-set of bivariate Gaussian pdfs. Next, we learn solutions to a Cahn-Hilliard partial differential equation (PDE) system representing patterns from a phase separation processes in binary mixtures. Finally, we employ the real world InSAR interferogram data-set presented in [22] to demonstrate state-of-the-art performance compared to recent operator learning methods for generative modeling. For the first three experiments, we use a MMD metric for functional data [31] between samples from the different models and the ground truth to assess performance. For the last example we compare angular statistics between model generated samples and the ground truth. As an overview, Figure 2 shows some samples generated by our model on three of the data-sets we consider. More details on the metrics, hyper-parameters, architectures and the training set-up can be found in the Appendix in Section D. 6.1 Gaussian Random Field The motivation of this example is to study the quality of the reduced dimension approximation that our model learns. For this purpose, we aim to learn a zero mean Gaussian random field (GRF) on X = [0, 1] with zero boundary conditions and covariance operator Γ = (I − ∆)−α. This operator admits the orthonormal eigendecomposition where λi = ((2πi)2 + τ 2)−α and φi(x) = random functions distributed as √ Γ = ∞ (cid:88) i=1 λiφi ⊗ φi, 2 sin(2πix). From the Karhunen-Loéve theorem [30] we can construct u = ∞ (cid:88) i=1 (cid:112) ξi λiφi, (11) where ξi ∼ N (0, 1) are normally distributed random variables. We use the above sum truncated at 32 eigenpairs to construct a data-set of N functions {ui}N i=1 and use it to train a Variational Autoencoding Neural Operator with a linear decoder. By setting the prior Pz to be a standard Gaussian on Rn, a linear decoder D learns basis functions τi ∈ X which map samples from the prior to functions, D(z)(x) = n (cid:88) i=1 ziτi(x), zi ∼ N (0, 1), i.i.d. The Karhunen Loéve theorem again tells us that the optimal choice of decoder basis functions τi should be exactly the eigenfunctions φi of the covariance operator Γ scaled by λi. To evaluate the model performance we compare the covariance operators between the true Gaussian random field and the learned model (6.1) using a normalized Hilbert-Schmidt norm, (cid:107)Γ − ˆΓ(cid:107)2 √ HS/(cid:107)Γ(cid:107)2 HS. We present the values of the normalized Hilbert-Schmidt norm for different latent dimension sizes and over multiple model initializations in Figure 3. The right side of Figure 3 shows that the learned basis functions align closely with the λiφi. Generated samples from the trained optimal choice from the Karhunen Loéve theorem, scaled eigenfunctions model are depicted in Figure 6 in the Appendix. √ 6.2 The Need for Nonlinear Decoders In this example we examine the effect of using linear versus nonlinear decoders for learning distributions of functional data. We construct a data-set consisting of bivariate Gaussian density functions over the unit square [0, 1]2 where the mean is sampled randomly within the domain and the covariance is a random positive multiple of the identity. Performing PCA on this data-set shows a spectrum of eigenvalues with slow decay, indicating that architectures with linear decoders will not be able to capture these functional data unless their hidden dimension is very large (see 7 Variational Autoencoding Neural Operators A PREPRINT Figure 3: Left: Normalized Hilbert-Schmidt norm error between GRF samples generated from VANO and the ground truth for different sizes of the latent space. Right: Comparison between the optimal basis from the Karhunen Loéve theorem (top) and the learned basis (bottom). Figure 4: Left: Generalized MMD values for VANO with a linear and a nonlinear decoder for different latent dimensions, Right: Generated samples from VANO with a linear (top) and with a nonlinear decoder (bottom). Appendix figure 7). To test this, we train VANO models with a linear and nonlinear decoder, respectively, over a range of hidden dimensions. We measure the distance of the learned distribution of functions to the ground truth via the generalized MMD distance, see Appendix E.2. In the left panel of Figure 4 we present values of the MMD metric over five individual runs and samples generated from VANO with a linear and nonlinear decoder. We observe that the error metric for the linear model takes very high values even at larger latent dimensions. In the right panel we see representative samples generated from linear and nonlinear decoder versions of VANO. The linear decoder is not able to localize the 2D functions as in the data-set, while the nonlinear decoder produces very similar samples. In Figures 8 and 9 of the Appendix we show the reconstruction of randomly chosen cases from the test data-set for the linear and nonlinear decoders, respectively. More samples from the linear and nonlinear decoder versions of VANO are shown in Figures 11 and 10 of the Appendix. 8 Variational Autoencoding Neural Operators A PREPRINT Figure 5: Left: Circular variance of the true data-set, the VANO generated data and the GANO generated data. Right: Circular skewness and generated samples between the true data-set, the VANO generated data and the GANO generated data. Table 1: Generalized MMD distance between ground truth test samples and samples generated by different models. Subscripts indicate the resolution of the data used to train each model. MMD×10−2 VANO64×64 VAE64×64 VAE128×128 VAE256×256 64 × 64 128 × 128 256 × 256 0.71 ± 0.04 0.73 ± 0.02 - - 0.88 ± 0.04 - 0.64 ± 0.03 - 1.34 ± 0.06 - - 1.03± 0.03 6.3 Phase separation patterns in Cahn-Hilliard systems As a more challenging benchmark we consider the Cahn-Hilliard patterns data-set [32] which contains different patterns derived from the solution of the Cahn-Hilliard equation. The Cahn-Hilliard equation is a fourth-order partial differential equation that describes the evolution of the phase separation process in binary material mixtures, see Appendix Section D.3, for details. For this problem we compare the VANO model with a discretize-first convolutional VAE approach over different resolutions. We train the discrete VAE on images of different resolutions namely 64x64, 128x128 and 256x256 and compare against the proposed VANO model which we train only on 64x64 images and generate samples at higher resolutions. We present the results of the generalized MMD metric for each model in Table 1. We observe that the VANO model performs better than the VAE at resolution 64x64, and slightly worse at generating samples at resolutions 128x128 and 256x256. However, even though the VANO model was not trained on these resolutions, it still gives competitive performance to the discretize-first method which did have access to high resolution data during training. Additionally, the size of the discretize-first model increases with the desired resolution while the size of the VANO remains fixed. This highlights the super-resolution capabilities of using models designed to output true functional data. Additionally, we present functions sampled from both models in the Appendix Section D.4, as well as reconstructions from each model at different resolutions. In Figure 13 we see that at higher resolutions the samples generated by the VANO model have smoother boundaries and appear more natural than those created by the discretize-first VAE approach. 6.4 Interferometric Synthetic Aperture Radar data-set As a final example, we consider the data-set proposed by Rahman et. al. [22] consisting of Interferometric Synthetic Aperture Radar (InSAR) data. InSAR is a sensing technology that exploits radar signals from aerial vehicles to measure the deformation of the Earth surface for studying the dilation of volcanoes, earthquakes or underwater reserves. As a comparison, we use the Generative Adversarial Neural Operator (GANO) architecture and training parameters provided in [22]. We train VANO on the entire data-set using the set-up provided in the Appendix Section D.4. We evaluate the performance of our model using two metrics: circular variance and circular skewness. These are moments of angular random variables, see [22], used to evaluate the quality of the generated functions. In Figure 5 we present a comparison 9 Variational Autoencoding Neural Operators A PREPRINT between the circular statistics [22], see Appendix Section E.3 for details on the metrics, for N = 4096 samples from the true data-set, and those created from VANO and GANO. In Section D.4 we present samples generated from both models. We observe that the VANO model achieves superior performance both in terms of circular statistics metrics, as well as in generating realistic samples without spurious artifacts. In Figure 14 we present sample reconstructions of the data from VANO and see that it also acts as a denoiser for the original data. Moreover, we find that VANO is trains 4x faster, with the 1/4 of model size compared to GANO (see Appendix Tables 3 and 4). 7 Discussion In this work, we have shown that a large class of architectures designed for supervised operator learning can be modified to behave as variational auto-encoders for functional data. The performance of this approach was demonstrated through learning generative models for functional data coming from synthetic benchmarks, solutions of PDE systems, and real satellite data. By deriving an appropriate variational objective in an (infinite-dimensional) functional data space, we placed this approach on firm mathematical footing. These models inherit some limitations common to all VAE approaches. In particular, there is a constant tension in the objective function of balancing the reconstruction loss of the data and the distance of the variational posterior distribution to the prior. The additional scalar parameter β multiplying the KL divergence term [29] attempts to provide some control of this balance, but the performance of the model can be sensitive to the setting of this parameter. Some insight can be gained into controlling this phenomenon through rate distortion theory [33], and it is an interesting direction of future work to generalize this to functional data. The choice of prior distribution on the latent space can also have a large impact on model performance. Hierarchical priors could provide additional structure for the generative model, as has been shown in [34]. The approach presented in this paper bears some similarity to generative models built for learning neural fields in computer vision [35, 36]. Our theoretical foundation of a variational lower bound for functional data can be directly applied to these approaches instead of the typical formulation of a likelihood on fixed point-wise measurements. This similarity also points to a larger connection between operator learning methods and conditioned neural fields in vision applications [37]. Both approaches aim to build neural representations of functions which can be queried at arbitrary points of their domains and the techniques developed to do so are likely to be useful across both domains. Finally, adapting the conditional version of the variational objective [38] can be useful for supervised operator learning where there is aleatoric uncertainty in the output functions. For example, this can often be the case in inverse problems where not all functional outputs of a system are available for observation. Applying the variational approach put forth in this paper would give a natural notion of uncertainty quantification, while retaining the approximation capabilities of encoder-decoder operator learning architectures. Acknowledgments We would like to acknowledge support from the US Department of Energy under under the Advanced Scientific Computing Research program (grant DE-SC0019116) and the US Air Force Office of Scientific Research (grant AFOSR FA9550-20-1-0060). We also thank the developers of the software that enabled our research, including JAX [39], Matplotlib [40], Pytorch [41] and NumPy [42]. References [1] Venkataraman Santhanam, Vlad I Morariu, and Larry S Davis. Generalized deep image to image regression. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 5609–5619, 2017. [2] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. arXiv preprint arXiv:1706.03762, 2017. [3] Anima Anandkumar, Kamyar Azizzadenesheli, Kaushik Bhattacharya, Nikola Kovachki, Zongyi Li, Burigede Liu, and Andrew Stuart. Neural operator: Graph kernel network for partial differential equations. In ICLR 2020 Workshop on Integration of Deep Neural Models and Differential Equations, 2020. [4] Zongyi Li, Nikola Kovachki, Kamyar Azizzadenesheli, Burigede Liu, Kaushik Bhattacharya, Andrew Stuart, and Anima Anandkumar. Fourier neural operator for parametric partial differential equations. arXiv preprint arXiv:2010.08895, 2020. 10 Variational Autoencoding Neural Operators A PREPRINT [5] Gege Wen, Zongyi Li, Kamyar Azizzadenesheli, Anima Anandkumar, and Sally M Benson. U-fno-an enhanced Fourier neural operator-based deep-learning model for multiphase flow. Advances in Water Resources, 163:104180, 2022. [6] Nikola Kovachki, Samuel Lanthaler, and Siddhartha Mishra. On universal approximation and error bounds for fourier neural operators. Journal of Machine Learning Research, 22:Art–No, 2021. [7] Tianping Chen and Hong Chen. Universal approximation to nonlinear operators by neural networks with arbitrary activation functions and its application to dynamical systems. IEEE Transactions on Neural Networks, 6(4):911–917, 1995. [8] Lu Lu, Pengzhan Jin, Guofei Pang, Zhongqiang Zhang, and George Em Karniadakis. Learning nonlinear operators via DeepONet based on the universal approximation theorem of operators. Nature Machine Intelligence, 3(3):218–229, 2021. [9] Samuel Lanthaler, Siddhartha Mishra, and George E Karniadakis. Error estimates for DeepOnets: A deep learning framework in infinite dimensions. Transactions of Mathematics and Its Applications, 6(1):tnac001, 2022. [10] Jacob H Seidman, Georgios Kissas, Paris Perdikaris, and George J. Pappas. NOMAD: Nonlinear manifold decoders for operator learning. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho, editors, Advances in Neural Information Processing Systems, 2022. [11] Jane-Ling Wang, Jeng-Min Chiou, and Hans-Georg Müller. Functional data analysis. Annual Review of Statistics and Its Application, 3:257–295, 2016. [12] Anindya Chatterjee. An introduction to the proper orthogonal decomposition. Current Science, pages 808–817, 2000. [13] Jun Song and Bing Li. Nonlinear and additive principal component analysis for functional data. Journal of Multivariate Analysis, 181:104675, 2021. [14] Boaz Nadler, Stéphane Lafon, Ronald R Coifman, and Ioannis G Kevrekidis. Diffusion maps, spectral clustering and reaction coordinates of dynamical systems. Applied and Computational Harmonic Analysis, 21(1):113–127, 2006. [15] Yilun Du, Katie Collins, Josh Tenenbaum, and Vincent Sitzmann. Learning signal-agnostic manifolds of neural fields. Advances in Neural Information Processing Systems, 34:8320–8331, 2021. [16] Marta Garnelo, Jonathan Schwarz, Dan Rosenbaum, Fabio Viola, Danilo J Rezende, SM Eslami, and Yee Whye Teh. Neural processes. arXiv preprint arXiv:1807.01622, 2018. [17] Marta Garnelo, Dan Rosenbaum, Christopher Maddison, Tiago Ramalho, David Saxton, Murray Shanahan, Yee Whye Teh, Danilo Rezende, and SM Ali Eslami. Conditional neural processes. In International Conference on Machine Learning, pages 1704–1713. PMLR, 2018. [18] Hyunjik Kim, Andriy Mnih, Jonathan Schwarz, Marta Garnelo, Ali Eslami, Dan Rosenbaum, Oriol Vinyals, and Yee Whye Teh. Attentive neural processes. In International Conference on Learning Representations, 2018. [19] Ivan Skorokhodov, Savva Ignatyev, and Mohamed Elhoseiny. Adversarial generation of continuous images. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10753–10764, 2021. [20] Emilien Dupont, Yee Whye Teh, and Arnaud Doucet. Generative models as distributions of functions. arXiv preprint arXiv:2102.04776, 2021. [21] Adam R Kosiorek, Heiko Strathmann, Daniel Zoran, Pol Moreno, Rosalia Schneider, Sona Mokrá, and Danilo Jimenez Rezende. Nerf-vae: A geometry aware 3d scene generative model. In International Conference on Machine Learning, pages 5742–5752. PMLR, 2021. [22] Md Ashiqur Rahman, Manuel A Florez, Anima Anandkumar, Zachary E Ross, and Kamyar Azizzadenesheli. Generative adversarial neural operators. Transactions on Machine Learning Research, 2022. [23] Georgios Kissas, Jacob H Seidman, Leonardo Ferreira Guilhoto, Victor M Preciado, George J Pappas, and Paris Perdikaris. Learning operators with coupled attention. Journal of Machine Learning Research, 23(215):1–63, 2022. [24] Kaushik Bhattacharya, Bamdad Hosseini, Nikola B Kovachki, and Andrew M Stuart. Model reduction and neural networks for parametric PDEs. The SMAI journal of computational mathematics, 7:121–157, 2021. [25] Diederik P. Kingma and Max Welling. Auto-Encoding Variational Bayes. In 2nd International Conference on Learning Representations, ICLR 2014, Banff, AB, Canada, April 14-16, 2014, Conference Track Proceedings, 2014. 11 Variational Autoencoding Neural Operators A PREPRINT [26] Veit Wild and George Wynne. Variational gaussian processes: A functional analysis view. arXiv preprint arXiv:2110.12798, 2021. [27] Veit David Wild, Robert Hu, and Dino Sejdinovic. Generalized variational inference in function spaces: Gaussian measures meet bayesian deep learning. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho, editors, Advances in Neural Information Processing Systems, 2022. [28] Sari Lasanen, Lassi Roininen, and Janne MJ Huttunen. Elliptic boundary value problems with Gaussian white noise loads. Stochastic Processes and their Applications, 128(11):3607–3627, 2018. [29] Irina Higgins, Loic Matthey, Arka Pal, Christopher Burgess, Xavier Glorot, Matthew Botvinick, Shakir Mohamed, and Alexander Lerchner. beta-VAE: Learning basic visual concepts with a constrained variational framework. In International Conference on Learning Representations, 2017. [30] Robert J Adler. An introduction to continuity, extrema, and related topics for general Gaussian processes. Lecture Notes-Monograph Series, 12:i–155, 1990. [31] George Wynne and Andrew B Duncan. A kernel two-sample test for functional data. Journal of Machine Learning Research, 23(73):1–51, 2022. [32] Hiba Kobeissi and Emma Lejeune. Mechanical mnist-cahn-hilliard. 2022. [33] Christopher P. Burgess, Irina Higgins, Arka Pal, Loïc Matthey, Nick Watters, Guillaume Desjardins, and Alexander Lerchner. Understanding disentangling in β-VAE. CoRR, abs/1804.03599, 2018. [34] Arash Vahdat and Jan Kautz. Nvae: A deep hierarchical variational autoencoder. Advances in Neural Information Processing Systems, 33:19667–19679, 2020. [35] Zhiqin Chen and Hao Zhang. Learning implicit fields for generative shape modeling. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 5939–5948, 2019. [36] Ivan Anokhin, Kirill Demochkin, Taras Khakhulin, Gleb Sterkin, Victor Lempitsky, and Denis Korzhenkov. Image generators with conditionally-independent pixel synthesis. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 14278–14287, 2021. [37] Yiheng Xie, Towaki Takikawa, Shunsuke Saito, Or Litany, Shiqin Yan, Numair Khan, Federico Tombari, James Tompkin, Vincent Sitzmann, and Srinath Sridhar. Neural fields in visual computing and beyond. In Computer Graphics Forum, volume 41, pages 641–676. Wiley Online Library, 2022. [38] Kihyuk Sohn, Honglak Lee, and Xinchen Yan. Learning structured output representation using deep conditional generative models. Advances in neural information processing systems, 28, 2015. [39] James Bradbury, Roy Frostig, Peter Hawkins, Matthew James Johnson, Chris Leary, Dougal Maclaurin, George Necula, Adam Paszke, Jake VanderPlas, Skye Wanderman-Milne, and Qiao Zhang. JAX: composable transforma- tions of Python+NumPy programs, 2018. [40] John D Hunter. Matplotlib: A 2D graphics environment. IEEE Annals of the History of Computing, 9(03):90–95, 2007. [41] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. Advances in neural information processing systems, 32:8026–8037, 2019. [42] Charles R Harris, K Jarrod Millman, Stéfan J van der Walt, Ralf Gommers, Pauli Virtanen, David Cournapeau, Eric Wieser, Julian Taylor, Sebastian Berg, Nathaniel J Smith, et al. Array programming with numpy. Nature, 585(7825):357–362, 2020. [43] Hui-Hsiung Kuo. Gaussian measures in banach spaces. In Gaussian Measures in Banach Spaces, pages 1–109. Springer, 1975. [44] Vladimir I Bogachev. Gaussian Measures, volume 62. American Mathematical Soc., 2015. [45] Daniel W Stroock. Probability theory: an analytic view. Cambridge university press, 2010. [46] Subhashis Ghosal and Aad Van der Vaart. Fundamentals of nonparametric Bayesian inference, volume 44. Cambridge University Press, 2017. [47] Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014. [48] Daniel Rebain, Mark J Matthews, Kwang Moo Yi, Gopal Sharma, Dmitry Lagun, and Andrea Tagliasacchi. Attention beats concatenation for conditioning neural fields. arXiv preprint arXiv:2209.10684, 2022. 12 Variational Autoencoding Neural Operators A PREPRINT [49] Ben Mildenhall, Pratul P Srinivasan, Matthew Tancik, Jonathan T Barron, Ravi Ramamoorthi, and Ren Ng. Nerf: Representing scenes as neural radiance fields for view synthesis. Communications of the ACM, 65(1):99–106, 2021. [50] Matthew Tancik, Pratul Srinivasan, Ben Mildenhall, Sara Fridovich-Keil, Nithin Raghavan, Utkarsh Singhal, Ravi Ramamoorthi, Jonathan Barron, and Ren Ng. Fourier features let networks learn high frequency functions in low dimensional domains. Advances in Neural Information Processing Systems, 33:7537–7547, 2020. [51] Thomas Müller, Alex Evans, Christoph Schied, and Alexander Keller. Instant neural graphics primitives with a multiresolution hash encoding. arXiv preprint arXiv:2201.05989, 2022. [52] Dan Hendrycks and Kevin Gimpel. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415, 2016. [53] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. [54] Sifan Wang, Hanwen Wang, Jacob H Seidman, and Paris Perdikaris. Random weight factorization improves the training of continuous neural representations. arXiv preprint arXiv:2210.01274, 2022. [55] Patricio Clark Di Leoni, Lu Lu, Charles Meneveau, George Em Karniadakis, and Tamer A Zaki. Neural operator prediction of linear instability waves in high-speed boundary layers. Journal of Computational Physics, 474:111793, 2023. [56] Sifan Wang, Hanwen Wang, and Paris Perdikaris. Improved architectures and training algorithms for deep operator networks. Journal of Scientific Computing, 92(2):35, 2022. [57] Paul A Rosen, Eric Gurrola, Gian Franco Sacco, and Howard Zebker. The InSAR scientific computing environment. In EUSAR 2012; 9th European conference on synthetic aperture radar, pages 730–733. VDE, 2012. [58] Bharath K Sriperumbudur, Kenji Fukumizu, and Gert RG Lanckriet. Universality, characteristic kernels and RKHS embedding of measures. Journal of Machine Learning Research, 12(7), 2011. [59] Krikamol Muandet, Kenji Fukumizu, Bharath Sriperumbudur, Bernhard Schölkopf, et al. Kernel mean embedding of distributions: A review and beyond. Foundations and Trends® in Machine Learning, 10(1-2):1–141, 2017. [60] Kenji Fukumizu, Arthur Gretton, Gert Lanckriet, Bernhard Schölkopf, and Bharath K Sriperumbudur. Kernel choice and classifiability for RKHS embeddings of probability distributions. Advances in neural information processing systems, 22, 2009. 13 Variational Autoencoding Neural Operators A PREPRINT A Review of Gaussian Measures Here we review some basic facts on Gaussian Measures defined Banach spaces. Our presentation follows the discussion in [43, 44] and Chapter 8 of [45]. We call a probability measure P on the Borel σ-algebra B(X ) a Gaussian measure if for every f ∈ X ∗, the pushforward measure P ◦ f −1 is Gaussian on R. For such a measure there exists two objects that completely characterize it. The mean is an element m ∈ X such that for all f ∈ X ∗, (f, m) = (cid:90) X (f, x) dP(x), and the covariance operator C : X ∗ → X is defined by Cf (g) = (cid:90) X (f (x) − (f, m))(g(x) − (g, m)) dP(x). We see from the definition that the covariance operator can also be thought of as a bi-linear form on X ∗. The definition of a Gaussian measure given above allows us to view each f ∈ X ∗ as an element of L2(P) := (cid:26) f : X → R (cid:12) (cid:12) (cid:90) X f (x)2 dP(x) < ∞ (cid:27) . (12) (13) Thus, we have an embedding of X ∗ → L2(P). Forming the completion of the image of this embedding with respect to the L2(P) norm forms the Cameron Martin space of the measure P, denoted HP. Note that by construction, X ∗ can be identified with a dense subspace of HP and we have the inclusion map I : HP → L2(P). The map I is sometimes known as the Paley-Wiener map (for example, when P is the Wiener measure I(h)(x) is the Ito integral (cid:82) ̇h dx(t)). Note that this implies for any h ∈ HP, the quantity (cid:104)h, x(cid:105)∼ := I(h)(x) is well defined for P-almost-every x. It can additionally be shown that there exists a dense injection HP (cid:44)→ X. The Cameron Martin space has a number of equivalent definitions and determines many of the relevant properties of the measure P. We will make repeated use of the Cameron Martin Theorem, which determines when the translation of a Gaussian measure P by h ∈ X gives an equivalent measure. This will allow us to give an expression for the log likelihood as well as the KL divergence term in the ELBO objective. For a proof see [44], [43] or [45]. Theorem A.1 (Cameron-Martin). Given a Gaussian measure P on X with Cameron Martin space HP, the translated measure Ph(A) := P(A − h) is absolutely continuous with respect to P if and only if h ∈ HP, with log dPh dP (x) = − 1 2 (cid:107)h(cid:107)2 HP + (cid:104)h, x(cid:105)∼. (14) When the Gaussian measure P is supported on a Hilbert space H, the previous definitions simplify due to the Riesz representation theorem which allows us to use the isomorphism H∗ (cid:39) H. In particular, for this case the covariance operator is a trace-class, self-adjoint operator C : H → H. Further, in this case the Cameron Martin space can be identified with im(C1/2) and has an inner product given by (cid:104)x, y(cid:105)HP = (cid:104)C−1/2x, C−1/2y(cid:105)H. A.1 Abstract Wiener Space There is an alternate characterization of Gaussian measures which instead begins with a separable infinite dimensional Hilbert space H. If we attempt to sample from the "standard Gaussian" on H by taking an orthonormal basis {ei}∞ i=1 and try to form the sum ∞ (cid:88) x = ξiei, ξi ∼ N (0, 1), i.i.d., (15) we see that E[(cid:107)x(cid:107)2 H] = ∞ and thus x /∈ H almost surely. i=1 The way around this is to consider the convergence of the sum (15) with respect to a norm other than that from H. After picking such a "measurable norm" [43] we may complete the space H with respect to this norm to obtain a new Banach space X, on which the measure we have tried to construct is supported. This completion gives us a dense inclusion 14 Variational Autoencoding Neural Operators A PREPRINT i : H (cid:44)→ X. The triple (i, H, X) is called an Abstract Wiener Space (AWS). The induced Gaussian measure P on X has H as its Cameron Martin space. Thus, the AWS construction gives us a way to construct a Gaussian measure starting from its Cameron Martin space. An example of this construction that will be particularly useful is that which starts from L2(X; R) with X ⊂ Rd compact as the desired Cameron Martin space. If we consider the dense inclusion L2(X; R) (cid:44)→ H−s(X; R), with s > d/2, then (i, L2(X; R), H−s(X; R)) is an AWS and the associated measure is called the white noise measure. B Proof of Theorem 4.1 To prove the generalization of the ELBO, we will need to use a modified measure-theoretic formulation of Bayes theorem phrased in terms of Radon-Nikodym derivatives. We begin from that presented in [46], dPz|u dPz = 1 c(u) dPu|z dPu , (16) where dPu|z dPu We claim that c(u) = 1, Pu-a.e. Since the Radon-Nikodym derivative is non-negative, we have that c(u) ≥ 0. Next, we show that c(u) ≤ 1. Assume this is not true. Then by the disintegration property of the regular conditional measures we may write for any measurable f (u), (u) dPz. c(u) = (17) Z (cid:90) (cid:90) X (cid:90) (cid:90) f (u) dPu = f (x) dPu|z dPz Z (cid:90) X (cid:90) X = > X f (u) (cid:18)(cid:90) Z f (u) dPu, dPu|z dPu (cid:19) dPz dPu which is a contradiction. Hence, c(u) ≤ 1. This allows us to write (cid:90) X |1 − c(x)| dPu = = (cid:90) Z (cid:90) X 1 − c(x) dPu (cid:90) 1 − Z (cid:90) (cid:90) Z (cid:90) X (cid:90) Z X dPu|z dPu dPu|z dPu (u) dPz dPu (u) dPu dPz dPu dPx = 1 − = 1 − = 0, and we have shown that c(x) = 1 Pu-a.e and thus from (16) dPz|u dPz = dPu|z dPu . We are now able to prove the generalize ELBO stated in Theorem 4.1. By the definition of the KL divergence, KL[Qφ z|u||Pz|u] = (cid:90) Z log (cid:32) dQφ z|u dPz|u (cid:33) (z) dQφ z|u. From the chain rule for Radon-Nikodym derivatives we may write dQφ z|u dPz|u = dQφ z|u dPz dPz dPz|u . 15 (18) (19) (20) Variational Autoencoding Neural Operators A PREPRINT Using (18), we then have dQφ z|u dPz|u = = = dQφ z|u dPz dQφ z|u dPz dQφ z|u dPz dPu dPu|z dPu dV dPu dV dV dPu|z (cid:18) dPu|z dV (cid:19)−1 , (21) where the last equality holds under the assumption of mutual absolute continuity between all written measures. Placing this relation in (19) shows that KL[Qφ z|u||Pz|u] = = (cid:90) Z (cid:90) Z (cid:32) dQφ z|u dPz (cid:32) dQφ z|u dPz log log (cid:19)−1(cid:33) dPu dV (cid:18) dPu|z dV dQφ z|u (cid:33) dQφ z|u + (cid:90) Z log (cid:19) (cid:18) dPu dV dQφ z|u − (cid:90) Z log (cid:19) (cid:18) dPu|z dV dQφ z|u. (22) z|u||Pz]. The integrand of the second term is a function of u only and z|u is a probability measure, thus the second term is equal to the log likelihood of the data x. The third term is the We identify the first term on the right as KL[Qφ Qφ expectation of the conditional likelihood of x given z. We have thus proved the equality KL[Qφ z|u||Pz|u] = KL[Qφ z|u||Pz] + log (cid:18) dPu (cid:19) dV (x) − E z∼Qφ z|u (cid:20) log dPu|z dV(x) (cid:21) . (23) C Architectures Here we present different architecture choices we have considered in the different experiments presented in this manuscript. Specifically here we outline our specific choices in terms of encoder and decoder architectures, as well as different types of positional encodings. C.1 Encoders We consider two types of encoders in our benchmarks. In the Gaussian Random Field we consider a Multi-layer Perceptron (MLP) network encoder. In all other benchmarks we build encoders using a simple VGG-style deep convolutional network [47], where in each layer the input feature maps are down-sampled by a factor of 2 using strided convolutions, while the number of channels are doubled. C.2 Decoders First, we consider possible decoder choices. The decoders can be categorized broadly as linear and nonlinear. Linear Decoder: Linear decoders take the form D(z)(x) = n (cid:88) i=1 ziτi(γ(x)), zi ∼ N (0, 1), i.i.d., where τ is a vector-valued function parameterized by a Multi-layer Perceptron Network (MLP), and γ(x) is a positional encoding of the query locations (see next section for more details). Nonlinear Decoders: Generalized nonlinear decoders can be constructed as D(z)(x) = fθ(zi, γ(x)), zi ∼ N (0, 1), i.i.d., where f is a function parameterized by an MLP network, and γ(x) is a positional encoding of the query locations (see next section for more details). Following the work of Rebain et. al. [48] we consider two types of conditioning f on the latent vector z. The first approach concatenates the latent vector z with the query location γ(x) before pushing them through the decoder, as in [10]. An alternative approach is to split the latent vector into chunks and concatenate each chunk to each hidden layer of the decoder, see Rebain et. al. for more details. 16 Variational Autoencoding Neural Operators A PREPRINT C.3 Positional Encodings Positional encodings have been shown to help coordinate-MLPs to capture higher frequency components of signals thereby mitigating spectral bias [49, 50, 50]. Here we employ different types of positional encodings depending on the nature of the benchmark we are considering. Fourier Features: First we consider a periodic encoding of the form γ(x) = [1, cos(ωx), sin(ωx), . . . , cos(kωx), sin(kωx)], with ω = 2π L , and some non-negative integer k. Here L denotes the length of the domain. This encoding was employed in the GRF benchmark to ensure that the generated functions satisfy a zero Dirichlet boundary condition at the domain boundaries. Random Fourier Features: The Random Fourier Feature encoding can be written as: γ(x) = [cos(2πBx), sin(2πBx)], where B ∈ Rq×d is sampled from the Gaussian distribution N (0, σ2) using a user-specified variance parameter σ. Here q denotes the number of Fourier features used and d is the dimension of the query point x. In our experiments we set q = n/2, where n is the latent space dimension of the model. We empirically found that this positional encoding gives good performance for the Cahn-Hilliard data-set. Multi-resolution Hash Encoding: For cases where we expect the function to contain multiscale characteristics, such as in the InSAR data-set, we considered the Multi-resolution Hash Encoding proposed in [51]. We found that this type of encoding gives the best performance for the InSar data-set. C.4 Hyper-parameter Sweeps In order to quantify the sensitivity of our results on the choice of different hyper-parameters, as well as to identify hyper-parameter settings that lead to good performance, we have performed a series of hyper-parameter sweeps for each benchmark considered in the main manuscript. Here we present the sweep settings and the best configuration identified for each benchmark. Gaussian Random Field: We perform a parametric sweep by considering different latent dimension sizes and different model initialization seeds, as shown in Table 2. Our goal is to find the model out of these set-ups that minimizes the normalized Hilbert-Schmidt norm between samples drawn from the ground truth data distribution and the VANO models. The lowest Hilbert-Schmidt norm value is achieved for n = 64. 2D Gaussian Densities: We perform a parametric sweep by considering different latent dimension sizes and different model initialization seeds, as shown in Table 2. Our goal is to find the model out of these set-ups that minimizes the generalized MMD metric between samples drawn from the ground truth data distribution and the VANO models. The lowest generalized MMD value is achieved for n = 32. Cahn-Hilliard: We perform a parametric sweep by considering different latent dimension sizes, KL loss weights β and decoder types, as shown in Table 2. Our goal is to find the model out of these set-ups that minimize the generalized MMD metric between samples drawn from the ground truth data distribution and the VANO models. The lowest generalized MMD value is achieved for n = 64, β = 10−4 and a concatenation decoder. InSAR Interferograms: We perform a parametric sweep by considering different latent dimension sizes, KL loss weight β and decoder layer width, as shown in Table 2. Our goal is to find the model out of these set-ups that minimize the generalized MMD metric between samples drawn from the ground truth data distribution and the VANO models. The lowest generalized MMD value is achieved for n = 256, β = 10−4 and a decoder layer width of 512. D Experimental Details In this section we present details about each experimental set-up and the generation of the training and testing data-sets. 17 Variational Autoencoding Neural Operators A PREPRINT Table 2: Hyper-parameter sweep settings for different examples (C and SC indicate a concatenation and a split concatenation decoder, respectively, see Section C.2). BENCHMARK GRF RANDOM SEED n [0, . . . , 10] [2,4,8,16,32,64] 2D GAUSSIAN DENSITIES [0, . . . , 4] [4, 32, 64, 128, 256] β - - DECODER LAYER WIDTH - - - - CAHN-HILLIARD INSAR INTERFEROGRAMS - - [32, 64, 128] [10−5, 10−4, 10−3] [C,SC] [64, 128, 256] [128, 256, 512] [10−5, 10−4, 10−3] - [256, 512] D.1 Gaussian Random Field Data Generation: From the Karhunen-Loéve theorem [30] we can construct random functions distributed according to a mean zero Gaussian measure with covariance Γ u = ∞ (cid:88) i=1 (cid:112) λiφi, ξi (24) where ξi ∼ N (0, 1) are i.i.d. normally distributed random variables, and λi and φi are the eigenvalues and eigenvectors of the covariance operator. We define λi = ((2πi)2 + τ 2)−α and φi(x) = 2 sin(2πix). These setup corresponds to the eigenvalues and eigenfunctions of the operator (I + ∆)−α on X = [0, 1] with zero boundary conditions. To generate these functions, we take samples of the sum in (11) truncated at the first 32 eigenfunctions and eigenvalues to construct Ntrain = 2048 functions evaluated at m = 128 points which we use to train our model. We independently sample an additional Ntest = 2048 functions for testing. √ Encoder: We parameterize the encoder using an MLP network with 3 hidden layers, width of 128 neurons and Gelu [52] activation functions. Decoder: We consider a linear decoder parameterized by a 3-layer deep MLP network, with a width of 128 neurons width, periodic positional encoding and Gelu activation functions. Training Details: We consider a latent space dimension of n = 64, S = 16 Monte Carlo samples for evaluating the expectation in the reconstruction loss, and a KL loss weighting factor β = 5 10−6. We train the model using the Adam optimizer [53] with random weight factorization [54] for 40, 000 training iterations with a batch size of 32 and a starting learning rate of 10−3 with exponential decay of 0.9 every 1,000 steps. Additionally, it has been observed in the operator learning literature [55, 56] that when a functional data-set has examples of varying magnitudes the training can overfit those with larger magnitude, as they are more heavily weighted in the loss function. To correct for this, we use a data dependent scaling factor in the likelihood terms. We find this modification is only necessary for the first two experiments, as the other scenarios do not have this magnitude variability in their data. Evaluation: To test the performance of the linear decoder VANO model, we train it on a range of dimensions for its latent space, n ∈ {2, 4, 8, 16, 32, 64}. We then generate data by sampling latent vectors from the prior z ∼ Pz = N (0, I) and map them through the decoder to create functions as in (6.1). Since this distribution is a mean zero Gaussian, like the ground truth Gaussian random field, it suffices to compare the resulting covariance operators to measure how close the two distributions are. The covariance associated with the distribution described in (6.1) is given by ˆΓ = n (cid:88) i=1 τi ⊗ τi. (25) We use the ground truth covariance eigenfunctions and the approximated eigenfunctions to compute the true and approximated covariance operators, and compare them using the Hilber-Schmidt norm. We observe in Figure 3 that qualitatively the two sets of look similar indicating the model is recovering the optimal choice of decoder. 18 Variational Autoencoding Neural Operators A PREPRINT Figure 6: GRF benchmark: Left: Functions sampled from the ground truth datset, Right: Functions sampled from the VANO model. D.2 2D Gaussian Densities Data Generation: For this example we construct a functional data-set consisting of two-dimensional Gaussian pdf functions in the unit square X = [0, 1]2 U (x, y) = (2π)−1/2 det(Σ)−1/2 exp (cid:16) − 1 2 (x − μ)(cid:62)Σ−1(x − μ) (cid:17) , (26) where μ ∼ (μx, μy) and Σ = σI. We consider μx, μy ∼ U (0, 1) and σ ∼ U (0, 0.1) + 0.01 and generate Ntrain = 2, 048 training and Ntest = 2048 testing samples of m = 2, 304 measurement points on a 48 × 48 equi-spaced grid. Encoder: We parameterize the encoder using a 4-layer deep VGG-style convolutional network using a 2 × 2 convolution kernel, a stride of size two, (8, 16, 32, 64) channels at each layer, and Gelu activation functions. Decoder: We consider two types of decoders, a linear and a nonlinear. The linear decoder is parameterized using a 3-layer deep MLP network with 128 neurons per layer and Gelu activation functions. For the nonlinear decoder case we consider a 3-layer deep MLP network with 128 neurons per layers, Gelu activation functions and concatenation conditioning. In both cases we also apply a softplus activation on the decoder output to ensure positivity in the predicted function values. Training Details: We consider a latent space dimension of n = 32, S = 4 Monte Carlo samples for evaluating the expectation of the reconstruction part of the loss and a KL loss weighting factor β = 10−5. We train the model using the Adam optimizer [53] with random weight factorization [54] for 20, 000 training iterations with a batch size of 32 and a starting learning rate of 10−3 with exponential decay of 0.9 every 1,000 steps. For this case, we also re-scale the likelihood terms by the empirical norm of the input function to ensure the terms with larger magnitude do not dominate the optimization procedure, as in [55, 56]. Evaluation: In figure 7 we present the decay of the PCA eigenvalues computed across function samples. The eigenvalue decay is slow which is the reason that makes the VANO with a linear decoder fail in reconstructing and generating function samples as shown in Figures 9 and 10, respectively. We perform a comparison between samples from the true data-set and samples generated by VANO using the generalized MMD metric computed using 512 function samples. D.3 Phase separation patterns in Cahn-Hilliard systems Data Generation: The Cahn-Hilliard equation is a fourth order partial differential equation that describes the evolution of the phase separation process in an anisotropic binary alloys [32]. The Cahn-Hilliard equation is written as: ∂c ∂t − ∇ * (M ∇(μc − λ∇2c)) = 0 inΩ, (27) where 0 < c < 1 denotes the concentration of one of the components of the binary mixture, M is a mobility parameter, μc is the chemical potential of the uniform solution, and λ a positive scalar that describes the thickness of the interfaces 19 Variational Autoencoding Neural Operators A PREPRINT Figure 7: 2D Gaussian densities benchmark: PCA eigenvalue decay of the training data-set. of the two mixtures. We consider boundary conditions on Γg, c = g M λ∇c * n = 0 in ∂Ω, on Γr, M ∇(μc − λ∇2c) * n = s on Γs, M λ∇c = r (28) where Ω is two dimensional domain, ∂Ω the domain boundary, n the unit outward normal, and Γg see [32]. The initial conditions are given by (cid:83) Γs = Γq (cid:83) Γr, For the above set-up the chemical potential μc is chosen as a symmetric double well potential where the wells correspond to the two different material phases, namely f = bc2(1 − c2). For more information on the set-up we refer the interested reader to [32]. c(x, 0) = c0(x) in Ω. (29) Encoder: We employ a VGG-style convolutional encoder with 5 layers using 2 × 2 convolution kernels, stride of size two, (8, 16, 32, 64, 128) channels per layer, and Gelu activation functions. Decoder: We employ a nonlinear decoder parameterized by a 4-layer deep MLP network with 256 neurons per layer, random Fourier Features positional encoding [50] with σ2 = 10, Gelu activation functions and concatenation conditioning. We also apply a sigmoid activation on the decoder outputs to ensure that the predicted function values are in [0,1]. Training Details: We consider a latent space dimension of n = 64, S = 4 Monte Carlo samples for evaluating the expectation of the reconstruction part of the loss and a KL loss weighting factor β = 10−4. We train the model using the Adam optimizer [53] with random weight factorization [54] for 20, 000 training iterations with a batch size of 16 and a starting learning rate of 10−3 with exponential decay of 0.9 every 1,000 steps. Discretize-first VAE training set-up: For the discretize-first VAE simulations we consider an identical encoder as in the VANO case, and a convolutional decoder that exactly mirrors the encoder structure, albeit using transposed convolutions. Evaluation: We perform a comparison between the ground truth test data-set and samples generated by VANO and the discretize-first VAE models using the generalized MMD metric computed using 256 function samples. We present reconstructed function samples chosen randomly from the test data-set for the VANO model trained on a 64x64 resolution and use to make predictions on higher resolutions, namely 128x128 and 256x256. Separate discretize-first VAE models are trained on data with resolutions 64x64, 128x128 and 256x256. Representative test reconstructions from all models are presented in Figure 12. In Figure 13 we show generated function samples at different resolutions. For the VANO model we train the model on 64x64 resolution images and generate samples in super-resolution mode, while for the discretize-VAE models we present samples of the same resolution as the images on which each model was trained on. The resolution of the images used for training each model are indicated by subscripts. 20 Variational Autoencoding Neural Operators A PREPRINT Figure 8: 2D Gaussian densities benchmark: Left: Ground truth functions samples from the test data-set, Middle: Linear VANO reconstruction, Right: Absolute error. 21 Variational Autoencoding Neural Operators A PREPRINT Figure 9: 2D Gaussian densities benchmark: Left: Ground truth functions samples from the test data-set, Middle: Nonlinear VANO reconstruction, Right: Absolute point-wise error. 22 Variational Autoencoding Neural Operators A PREPRINT Figure 10: 2D Gaussian densities benchmark: Gaussian density function samples generated from the VANO model with a nonlinear decoder in super-resolution mode (training resolution: 48 × 48, sample resolution 256 × 256). 23 Variational Autoencoding Neural Operators A PREPRINT Figure 11: 2D Gaussian densities benchmark: 2D Gaussian density function samples generated from the VANO model using a linear decoder in super-resolution mode (training resolution: 48 × 48, sample resolution 256 × 256). 24 Variational Autoencoding Neural Operators A PREPRINT Figure 12: Cahn-Hilliard benchmark: Ground truth data-set samples, VANO reconstructions, and discretize first VAE reconstructions of Cahn-Hilliard functions in different resolutions. For the VANO model, we train on 64x64 resolution and then perform super-resolution for 128x128 and 256x256, while for the discrete-first VAE models we must train a separate model at each target resolution. D.4 Interferometric Synthetic Aperture Radar data-set Data Generation: InSAR is a sensing technology that exploits radar signals from aerial vehicles in order to record changes in echoes over time to measure the deformation of a point on the Earth between each pass of the aerial vehicle over the specified point. This technology is employed in measuring deformation on the Earth's surface caused by earthquakes, volcanic eruptions, etc. The data returned by InSAR mostly consists of interferograms. An interferogram is an angular-valued spatial field u ∈ X and u(x) ∈ [−π, π] where x ∈ X the domain of u which in this case corresponds to the Earth surface. Interferograms contain different types of noise and are affected by local weather, Earth topography, and different passes of the aerial vehicles which makes them complex to approximate [22]. The InSAR data-set we use consists of N = 4, 096 examples extracted from raw interferograms, each of 128 × 128 resolution coming from the Sentinel-1 satellites, as described in [22]. The satellite image covers a 250 by 160 km area around the Long Valley Caldera, an active volcano in Mammoth Lakes, California, from November 2014 to March 2022, using the InSAR Scientific Computing Environment [57]. The data is pre-processed as described in [22] to produce the training data-set. We train VANO on the entire data, as in [22]. Encoder: We employ a simple VGG-style convolutional encoder with 6 layers using 2 × 2 convolution kernels, stride of size two, (8, 16, 32, 64, 128, 256) channels per layer, and Gelu activation functions. Decoder: We employ a nonlinear decoder parameterized by an 8-layer deep MLP network with 512 neurons per layer and split concatenation conditioning. We also employ the Multi-resolution Hash Encoding put forth by [51] in order to capture the multi-resolution structure in the target functional signals (see [51] for the default hyper-parameter settings). Training Details: We consider a latent space dimension of n = 256, S = 4 Monte Carlo samples for evaluating the expectation of the reconstruction part of the loss and a KL loss weighting factor β = 10−4. We train the model using the Adam optimizer [53] with random weight factorization [54] for 20, 000 training iterations with a batch size of 16 and a starting learning rate of 10−3 with exponential decay of 0.9 every 1,000 steps. 25 Variational Autoencoding Neural Operators A PREPRINT Figure 13: Cahn-Hilliard benchmark: On the far left column we provide 256x256 image samples from the VANO model trained on 64x64 resolution. On the other columns, we provide discretize-first VAE samples where the training resolution is indicated by their subscript, i.e. VAE64×64 indicates a samples coming from a VAE model trained on 64x64 resolution. GANO training setup: We use the implementation from the official repository of the GANO paper 1 to train the model with the recommended hyper-parameter settings. Evaluation: We evaluate the performance of our model using two metrics: the circular variance and the circular skewness, as explained in the Appendix Section E.3. Generated function samples are presented in Figure 16. We present reconstructions from the data-set in Figure 14 and new generated function samples in Figure 15. E Comparison Metrics In this section we provide a description of different metrics used for evaluating the quality of our results. E.1 Hilbert-Schmidt norm The Hilbert-Schmidt norm of an operator T : H → H on a Hilbert space H with orthonormal basis ei is given by (cid:107)T (cid:107)2 HS = (cid:104)T ei, ei(cid:105). (cid:88) i (30) 1https://github.com/kazizzad/GANO 26 Variational Autoencoding Neural Operators A PREPRINT Figure 14: InSar benchmark: Left: Ground truth functions samples from the data-set, Middle: Linear VANO reconstruction, Right: Absolute error. 27 Variational Autoencoding Neural Operators A PREPRINT Figure 15: InSar benchmark: VANO generated function samples for InSAR Interferograms. 28 Variational Autoencoding Neural Operators A PREPRINT Figure 16: InSar benchmark: GANO [22] generated function samples for InSAR Interferograms. 29 Variational Autoencoding Neural Operators A PREPRINT If the operator T is self-adjoint with eigenvalues λi, this can also be written as (cid:107)T (cid:107)2 HS = (cid:88) λ2 i . i (31) Note that when H is a finite dimensional Hilbert space, this is equivalent to the standard 2 (Frobenius) norm for operators (matrices). Since covariance operators for Gaussian measures always have finite Hilbert-Schmidt norm, we measure the distance of the two mean-zero Gaussian measures in the Gaussian random field example via the Hilbert-Schmidt norm of their difference. We approximate this via the approximations of the covariance operators in the discretization space R128×128, C = neig (cid:88) i=1 λi ̃φi ̃φ(cid:62) i , ˆC = n (cid:88) i=1 ̃τi ̃τ (cid:62) i , (32) where ̃φi, ̃τi ∈ R128 are the evaluations of the functions φi and τi along the measurement points used in the experiment. The normalized Hilbert-Schmidt norm of the difference of the true covariance operators is then approximated as the Frobenius norm of the difference of their approximations divided by the Frobeinus norm of the true covariance C. E.2 Generalized Maximum Mean Discrepancy For measuring the distance between ground truth and learned distributions, we choose to use a version of the Maximum Mean Discrepancy (MMD) distance. Given a probability distribution on a set X and a characteristic kernel k : X ×X → R [58], the kernel mean embedding [59] is a map from probability measures μ on X into the Reproducing Kernel Hilbert Space (RKHS) associated with k, Hk given by (cid:90) ˆμk := k(*, x) dμ(x). (33) Note that if μ is an empirical distribution, that is, a sum of delta measures X then the kernel mean embedding is given by μ = 1 N N (cid:88) i=1 δxi, ˆμk = 1 N N (cid:88) i=1 k(*, xi). (34) Given two probability measures, μ and ν on a set X , we can define the MMD distance between them as the distance between their kernel mean embeddings in the RKHS Hk, MMDk(μ, ν) = (cid:107)ˆμk − ˆνk(cid:107)2 Hk . (35) When both μ and ν are empirical distributions on points {xi}N as i=1 and {yj}M j=1, respectively, the MMD can be evaluated (cid:107)ˆμk − ˆνk(cid:107)2 Hk = 1 N 2 N (cid:88) i,k=1 k(xi, xk) + 1 M 2 M (cid:88) j,(cid:96)=1 k(yj, y(cid:96)) − 2 N M N (cid:88) M (cid:88) i=1 j=1 k(xi, yj). (36) While this is convenient for giving a notion of distance between empirical distributions corresponding to samples from a data-set and a generative model, it can be sensitive to the form of the kernel. For example, if a norm on X is used in a Gaussian kernel with a length-scale σ, kσ(x, y) = exp (cid:18) 1 2σ2 (cid:107)x − y(cid:107)2 X (cid:19) , (37) for large enough σ the kernel will see all data points as being roughly the same and the MMD for any two fixed empirical distributions will become arbitrarily small. To mitigate this problem, the generalized MMD distance was proposed [60], which instead of using a single kernel uses a family of kernels F and defines a (pseudo-)metric between probability measures as GMMDF (μ, ν) := sup k∈F MMDk(μ, ν). (38) 30 Variational Autoencoding Neural Operators A PREPRINT Figure 17: An example of MMDs computed over a range of lengthscales σ between the ground truth 2D Gaussian density data-set and the data-set generated by VANO. Table 3: Computational cost for training all the models considered in this manuscript: We present the wall clock time in seconds that is needed to train each model on a single NVIDIA RTX A6000 GPU. BENCHMARK GRF 2D GAUSSIAN DENSITIES CAHN-HILLIARD (64 × 64) CAHN-HILLIARD (128 × 128) - - 43 55 CAHN-HILLIARD (256 × 256) 166 INSAR INTERFEROGRAM - VAE VANO (LINEAR) VANO (NONLINEAR) GANO 53 67 - - - - - 198 1,020 - - - - - - - 11,820 42,060 As long as one of the kernels in F is characteristic, this defines a valid distance [60]. In our experiments, we use the GMMD as a measure of distance of distributions with the family of kernels (cid:26) F = kσ | kσ(x, y) = exp (cid:18) 1 2σ2 (cid:107)x − y(cid:107)2 X (cid:19) , σ− ≤ σ ≤ σ+ . (cid:27) (39) Empirically, we find that the σ giving the largest M M D lies within the interval σ− = .1 and σ+ = 20 for all experiments, and therefore use a mesh of σ in this interval to approximate this GM M D. In Figure 17 we plot an example of the MMD for varying σ between 512 function samples from the 2D Gaussian densities data-set and those generated from the VANO model. E.3 Circular variance and Skewness √ The circular variance and skewness are moments of circular random variables, see [22], used to evaluate the quality i eipθj with of generated angular valued functions. For N random variables given by angles, {θj}N i = −1. Define φp = arg(zp) where arg is the complex argument function (returns the angle of a complex number to the real axis) and let Rp = |zp|/N . The circular variance is then defined by σ = 1 − R1 and the skewness by s = R2 sin(φ2−2φ1) j=1, let zp = (cid:80)N . (1−R1)3/2 F Trainable Parameters and Computational Cost We present the training time in seconds for each experiment and model in the manuscript in Table 3 as well as the total number of trainable parameters in Table 4. 31 Variational Autoencoding Neural Operators A PREPRINT Table 4: Total number of trainable parameters for all the models considered in this manuscript. BENCHMARK GRF 2D GAUSSIAN DENSITIES - - 107,712 85,368 VAE VANO (LINEAR) VANO (NONLINEAR) GANO - 89,305 341,000 - - - - - - - 11,130,420 48,827,763 CAHN-HILLIARD (64 × 64) 187,000 CAHN-HILLIARD (128 × 128) 485,000 CAHN-HILLIARD (256 × 256) 1,667,000 INSAR INTERFEROGRAM - - - - - 32
http://arxiv.org/abs/2302.10348v1
2023-02-20T22:30:35
2023-02-20T22:30:35
Binding-and-folding recognition of an intrinsically disordered protein using online learning molecular dynamics
Intrinsically disordered proteins participate in many biological processes by folding upon binding with other proteins. However, coupled folding and binding processes are not well understood from an atomistic point of view. One of the main questions is whether folding occurs prior to or after binding. Here we use a novel unbiased high-throughput adaptive sampling approach to reconstruct the binding and folding between the disordered transactivation domain of \mbox{c-Myb} and the KIX domain of the CREB-binding protein. The reconstructed long-term dynamical process highlights the binding of a short stretch of amino acids on \mbox{c-Myb} as a folded $\alpha$-helix. Leucine residues, specially Leu298 to Leu302, establish initial native contacts that prime the binding and folding of the rest of the peptide, with a mixture of conformational selection on the N-terminal region with an induced fit of the C-terminal.
[ "Pablo Herrera-Nieto", "Adrià Pérez", "Gianni De Fabritiis" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10348v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10348v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "q-bio.BM", "@scheme": "http://arxiv.org/schemas/atom" }
[ "q-bio.BM", "cs.LG", "physics.comp-ph" ]
3 2 0 2 b e F 0 2 ] . M B o i b - q [ 1 v 8 4 3 0 1 . 2 0 3 2 : v i X r a Binding-and-folding recognition of an intrinsically disordered protein using online learning molecular dynamics , Pablo Herrera-Nieto,† k Adrià Pérez ,† , , , k and Gianni De Fabritiis∗ , ¶ , § † ‡ † Computational Science Laboratory, Universitat Pompeu Fabra, Barcelona Biomedical Research Park (PRBB), C Dr. Aiguader 88, 08003, Barcelona, Spain Acellera Labs, C Dr Trueta 183, 08005, Barcelona, Spain Acellera Ltd, Devonshire House 582, HA7 1JS, United Kingdom Institució Catalana de Recerca i Estudis Avançats (ICREA), Passeig Lluis Companys 23, 08010 Barcelona, Spain These authors contributed equally to this work k ¶ ‡ § E-mail: [email protected] Abstract Intrinsically disordered proteins participate in many biological processes by folding upon bind- ing with other proteins. However, coupled fold- ing and binding processes are not well under- stood from an atomistic point of view. One of the main questions is whether folding occurs prior to or after binding. Here we use a novel unbiased high-throughput adaptive sampling approach to reconstruct the binding and folding between the disordered transactivation domain of c-Myb and the KIX domain of the CREB- binding protein. The reconstructed long-term dynamical process highlights the binding of a short stretch of amino acids on c-Myb as a folded α-helix. Leucine residues, specially Leu298 to Leu302, establish initial native con- tacts that prime the binding and folding of the rest of the peptide, with a mixture of conforma- tional selection on the N-terminal region with an induced fit of the C-terminal. Introduction Intrinsically disordered proteins (IDPs) partic- ipate in many biological functions despite lack- ing a stable tertiary structure. 1 Initial clues for the function of IDPs were revealed by structural studies, 2,3 showing that proteins that were dis- ordered in isolation became folded upon inter- acting with their partners, opening to question how folding couples with binding. Recently, molecular dynamics (MD) simula- tions have been successfully applied to recon- struct biological dynamic events in problems such as protein-ligand 4 and protein-protein 5,6 binding, as well as protein folding. 7,8 MD has also been applied in the field of IDPs. 9–12 In par- ticular, the Mdm2 protein and the disordered 12-residue N-terminal region of p53 were stud- ied using implicit solvent simulations, 9 paral- lel full-atom simulations totaling, 11 biased free- energy-based sampling, 10 and biased/unbiased simulations to estimate kinetics on the second timescale. 12 For another system, KIX-pKID, a single event of binding 13 has been sampled at all-atom resolution. The KIX-c-Myb binding-and-folding mech- anism has been extensively studied experimen- tally as an exemplar case of protein-IDP in- teraction. 14–20 The KIX domain of the CREB- binding protein is a short 87-aa region com- posed of three α-helices (designated as α-1, 1 α-2 and α-3, from N-terminal to C-terminal) forming a compact bundle. 3 KIX represents it binds a paradigm of binding promiscuity: to many IDPs, including the proto-oncogene c-Myb 3 (Figure 1.a), with multiple binding con- formations. 14 However, the system composed by KIX-c-Myb remained outside of the scope of all-atom molecular simulations due to the size of the IDP (it doubles the length of p53) and the existence of multiple binding modes between them. 14 In particular, it is unclear whether the interaction takes place by con- formational selection, i.e. c-Myb needs to be folded before binding to its partner, or by induced-fit, where binding not only happens in- dependently of c-Myb's secondary structure but also triggers its folding, as shown for other IDPs (KIX-pKID). 13,21 Understanding these aspects has implications for the druggability of disor- dered proteins. Another important factor is c-Myb's high helicity in isolation and the con- sequences it might exert on the final complex structure, which features an extended α-helical c-Myb bound to KIX. Some reports support the induced-fit approach based on kinetics and mu- tagenesis studies, 15,16,20 while others advocate for a mixed mechanism 14; yet not a detailed model for the binding process is available. In this paper, we take advantage of a novel algorithm that frames the MD sampling prob- lem from a reinforcement learning perspective (see 22 and Methods) to reconstruct multiple binding modes between c-Myb and KIX. This sampling algorithm was key for us to recon- struct the binding process, as previous attempts over the years using other state-of-the-art adap- tive sampling methods 23,24 were not successful, always failing to recover the NMR bound struc- ture. Results provide insights into the bind- ing mechanism between these two proteins, sup- porting a mixed model that combines both con- formational selection and induced fit. Results & Discussion Adaptive sampling the KIX-c- Myb binding-and-folding process Simulations to reconstruct the KIX-c-Myb binding mode were performed following an adaptive sampling strategy. In adaptive sam- pling, successive rounds of simulations are performed in an iterative step-wise manner, where an acquisition function over the cur- rently sampled conformations is defined. We compare two of the acquisition functions used for KIX-c-Myb simulations: a count-based one and another one inspired by reinforce- ment learning, part of the novel AdaptiveBan- dit method. 22 The new AdaptiveBandit method is framed into a simplified reinforcement learning prob- lem, the multi-armed bandit problem (see Methods). We use the upper confidence bound (UCB) algorithm 25 to optimize an action- picking policy in order to maximize future re- wards, optimally balancing the exploration of new higher rewarding actions with the exploita- tion of the most known rewarding ones. The re- ward function, which associates the action with the reward given by the system, defines what we want to optimize. In this work, we choose the reward to be minus the free energy of each con- figuration visited in the trajectory spawn from a given action (see Eq.2 in Methods), where the free energy of a conformation is given by the corresponding Markov state model (MSM) mi- crostate computed with the data available at the current sampling epoch. Standard low counts adaptive sampling 23 (hereby named Counts Adaptive) can be shown to be optimal in pure exploration conditions. 24 Counts are computed over clusters of conforma- tions; this method is, however, noisy as clus- in ters can be poorly populated. Therefore, the implementation available in, 24 counts are computed over a smaller subset by grouping clusters (microstates) into macrostates, con- structing a Markov State Model (MSM) 26 with the available data at each round. The ac- quisition function is given by proportionally choosing macrostates as 1/c, where c represents 2 Figure 1: Exploration performance. a) KIX-cMyb NMR structure. KIX domain is shown as a white surface and ribbon and c-Myb bound to KIX as a red helix (PDB code 1SB0 ). Exploration 450 μs) is shown performance by b) Counts Adaptive ( by plotting the mean RMSD (on the x-axis) and standard deviation (on the y-axis) for each of the MSM's microstates, color-mapped accordingly to their macrostate assignment. The dashed square indicates the bound zone, placed in the region corresponding to low mean RMSD and standard deviation. 480 μs) , and AdaptiveBandit ( ∼ ∼ macrostate counts, and by randomly selecting conformations within them. ∼ A comparison between Counts Adaptive and AdaptiveBandit is provided in Figure 1.b. The batch based on Counts Adaptive (48 epochs) failed to connect microstates similar to the 480 μs, reaching at NMR structure in over best an RMSD around 7 Å. For us, it was im- possible to build an MSM with the bound state with previous methods, and novel approaches were needed to reconstruct the binding-and- folding process between KIX and c-Myb suc- cessfully. AdaptiveBandit provides converged estimates of kinetics and thermodynamics after just 150 μs of sampling (Supplementary Figure 5). Identification of the bound state ∼ The full data set of the AdaptiveBandit run accounted for a total simulation time of 450 μs, split across 40 epochs, and was the one used to study the molecular features of KIX- c-Myb binding-and-folding. For the analysis, a slightly different MSM was built based on all- pair Cα+Cβ distances between KIX and c-Myb, self distances between Cα of c-Myb, secondary structure of c-Myb and RMSD to the NMR bound conformation (PDB ID: 1SB0 ). The MSM defines three kinetically similar sets of conformations, referred as macrostates (Figure 2.a and Supplementary Figure 1.b): a highly populated state with an heterogeneous mix- ture of conformations (unbound ), a well defined c-Myb bound state (bound ) and, finally, a sec- ondary bound state (secondary). Representa- tive structures of all states can be found in Fig- ure 2.b. The bound macrostate contains struc- tures with a minimum RMSD of approximately 3 Å with respect to the NMR structure. Com- plete binding and folding trajectory videos can be found in Supplementary Table 1, with recon- structed trajectories from different epochs con- taining unique paths to the bound state (with RMSD < 4 Å with respect to the bound NMR structure) The bound state identifies the primary cMyb bound pose in the hydrophobic groove between α-1 and α-3) of KIX. On average, it shares 36% of the fraction of native inter-molecular contacts (Qint) with the original NMR struc- ture, as shown in Figure 2.c. These contacts mainly involve the interaction of c-Myb residues Leu298 and Leu302 with residues across the primary binding interface: Leu302 contacts 3 a b KIX c-Myb Figure 2: KIX & c-Myb binding model. a) States distribution across the TICA space: microstates are represented as dots and are colored following their macrostate assignment. b) Representative structures: PDB structure 1SB0 is depicted with KIX as a gray surface, c-Myb bound to the primary interface as a yellow ribbon, and c-Myb bound to the secondary interface as a blue ribbon. c-Myb backbones for 30 representatives MD structures of bound and secondary states are displayed with blurry yellow and blue clouds, respectively. c) Macrostate contact fingerprint: profile of contacts established between c-Myb and KIX in each macrostate in at least 50% of the structures. Blue color represents contacts present in the state but not in the original NMR structure; green indicates original NMR contacts not found in the MSM state; and yellow squares represent contact matches, found in both NMR and MD structures. d) Macrostate cMyb helicity: helicity fraction per residue of c-Myb in each macrostate. Helicity for the cMyb peptide alone is depicted in grey in each plot for comparison. Leu603, Leu653, and specially Leu607 of KIX, which is buried down in the pocket, whereas Leu298 establishes additional native contacts with Ala610, Ile657, and Tyr658. Qint reaches up to 80% in those microstates exhibiting the tightest bound conformations, and, in addition to the leucine binding, they feature most of the contacts between the C-terminal half of c-Myb and KIX, which are not that prevalent across the bound macrostate (Supplementary Figure 2). The main contacts missing account for the electrostatic interactions established between Arg294 and the region on α-3. There are some conformations where these interactions occur, but their prevalence in those microstates is less than 50%. The secondary structure profile for MD- derived states matches the experimental de- scription of c-Myb, 14,19 as shown in Supplemen- tary Figure 3: the 25 residues are separated in two halves by residues Met303 and Ser304. The N-terminal half shows a high helical ten- dency, around 20-30% for residues in positions 297 to 302 with c-Myb in isolation, being max- imal in bound states. Experimentally, this N- terminal half in isolation reaches even higher helicity levels ( 70%) when using an extended construct of c-Myb. 14 On the other hand, the C- terminal section exhibits low helical propensity when in isolation, and increases when bound to KIX. The full helix conformation only appears in those microstates with the tightest bound conformations. ∼ Secondary binding mode The existence of alternative binding poses be- tween c-Myb and KIX has also been reported. 14 The MSM shows the presence of a secondary binding mode (referred to as secondary), occu- 4 c d a b Figure 3: Complete c-Myb binding process to KIX domain. Main pathways leading from Bulk (macrostate 14) to the Bound state (macrostate 12). Fluxes are shown as percentages near the arrows. Only those fluxes higher than 5% are shown. The arrow thickness is proportional to the flux percentage. Straight arrows indicate the maximum flux path, while dashed arrows show other fluxes. Each macrostate structure shows KIX as the white surface and ribbons and c-Myb as the orange ribbon and tubes. For each macrostate, 25 conformations are shown as thin tubes with one structure highlighted as a ribbon structure that includes the side chain of Leu302, colored by atom element. Additionally, for macrostates 7 and 12, the reference NMR c-Myb structure is shown as a transparent red ribbon for comparison. pying a novel interface, located between α-1 and α-2 (Figure 1.b and Supplementary Figure 9). The interaction of the secondary state resem- bles the bound binding mode: the N-terminal half is folded in the typical α-helix, while the C- terminal section remains mostly unstructured. The presence of a native contact in this sec- ondary binding mode is due to the penetration of Leu302, located close to Leu603's backbone in KIX, rather than by side-chain proximity. Leu298 and Leu302 of c-Myb are deeply buried in a hydrophobic pocket composed of residues Val604, Val608, Leu620 (found in the G2 he- lix, which connects α-1 and α-2) and Val629. Kinetically, there is a 10-fold difference in the mean first passage time for binding between 103 ns for bind- both sites - (9.96 3.57) 105 ns for ing to bound site and (1.05 0.46) the secondary site - that may account for the preferential binding of c-Myb to the primary interface. * ± ± * Model validation To validate the model, we compared the ki- netic parameters derived from it with avail- able information. 17 Experimental values from Shammas et al. were calculated at tempera- tures ranging from 278 to 298 K, while simu- lations were executed at physiological tempera- ture (310 K). kon values display a temperature independent tendency, whereas for temperature dependent variables kof f and kd values had to be extrapolated to 310K (Supplementary Fig- ure 4). Hence, reference values for kof f and free energy (obtained from kd) resulted in 866 s− 1 and -6.81 kcal mol− Due to the size of the peptide compared to the solvation box, it is hard for the MSM to automatically define the correct bulk state. We, therefore, manually defined a bulk state that contains conformations where the distance between KIX and cMyb is maximized. The bulk state was defined by taking those mi- crostates where the minimum distance between 1 respectively. 5 Macrostate 10 Macrostate 11 7% 85% 61% Bulk 38% 54% 70% 7% 14% 7% Macrostate 12 Bound Macrostate 13 Macrostate 7 KIX and cMyb is higher than a threshold. Con- sequently, some kinetic and thermodynamic es- timates have a dependency on such distance threshold (Supplementary Figure 6a) as this af- fects the definition of the bulk state. However, the computed kof f and free energy estimates are practically stable after a minimum separa- tion distance of just 4 Å. 1, * * * * 107M − 107M − 1 and (3.65) 107M − 103 s− The obtained MSM estimations of kon go be- 1s− 1s− tween (2.72) in agreement with the experimental value 1. 17 kof f estimates range 1s− (2.2 0.2) ± 1, overes- 103 s− 1 to 21.70 from 3.50 timating the extrapolated experimental value by an order of magnitude. Free energy esti- 1 and 7.35 kcal mol− mates range between 1 depending on the choices of − the analysis parameters, with the extrapolated experimental value inside this interval. 6.27 kcal mol− − * We further verified the reproducibility of ki- netic and thermodynamic measurements to en- sure model convergence by building multiple MSMs using incrementally more trajectories. Convergence is reached at 150 μs on all the previous estimates (Supplementary Figure 5). The discrepancy between the experimental ref- erence and computed kof f values translates into a faster dissociation in our model. We also verified if this was due to normal discretiza- tion errors in the MSM projection or to the fact that our simulations did not obtain a com- plete bound conformation between KIX and In order to test this hypothesis, ad- cMyb. long trajectories (8 replicas of 2 μs ditional each) were run starting from bound NMR and MD-derived conformations. We constructed an MSM using both simulation datasets. However, the free energy estimations are only marginally improved (Supplementary Figure 6b). Thus, we concluded that the additional bound simula- tions do not add additional information and we restrict the analysis to just the AdaptiveBan- dit set of simulations as this is the most general case where no NMR information is available. 6 Binding follows both induced-fit and conformational selection In order to gain additional structural insight of the binding process, we constructed an MSM with a higher number of macrostates, using the same lag time. We used transition path theory 27,28 to calculate fluxes leading from the purely bulk state to the bound conformations. Out of the 15 macrostates of the new MSM, only a reduced set of 6 is sufficient to explain binding to the primary interface. The other macrostates describe either the secondary bind- ing mode or other unstable interactions between KIX and cMyb. The network generated by the flux interchanges between macrostates (Figure 3) separates the binding and folding process into three events: the establishment of the ini- tial contacts, binding and folding of the N-term section of cMyb and finally, binding and folding of the C-term section of cMyb. The first step of the binding process features the first native contacts found across the KIX-c-Myb bind- ing pathway, which involves residues Leu302 of c-Myb. The role of Leu302 as the main driv- ing force for the interaction has already been described 3 and is due in part to the kink in the helix created by neighbors residues Met303 and Ser304, which exposes Leu302 allowing for a deep penetration inside the binding pocket. Besides, of the KIX residues contacted at this stage is Leu603, which is one of the most ex- posed residues in the hydrophobic pocket later occupied by Leu302. To determine if cMyb folding precedes or fol- lows binding at this step, we looked at the flux passing through different cMyb conformations in macrostate 13 (Supplementary Figure 8). We see that almost half of the flux goes through N- term helical conformations, suggesting that the presence of helix in residues 297 to 302 facili- tates these first binding step, following a con- formational selection mechanism. There is also a considerable flux going through unfolded con- formations, meaning Leu302 also binds through induced fit. The second step of the binding process goes from macrostate 13 to macrostate 11, where several contacts are formed across the N-term of cMyb. The last step, which goes from macrostate 11 to 12 (the bound state), involves forming the last contacts on the C-term and completely folding cMyb. Here, we also looked at the flux passing through macrostate 11 (Sup- plementary Figure 8c) to discern between con- formational selection and induced fit on the C- term folding and binding mechanism. Here, all the flux goes through conformations where the C-term is unfolded, meaning that only when the C-term native contacts start to happen we see a complete cMyb folding to an alpha helix, following a clear induced-fit mechanism. The overall mechanism works as an induced- fit binding and folding, but we can see a mixed mechanism during the first binding steps, where both conformational selection and induced-fit seem to take a part in facilitating the first con- tacts through cMyb's Leu302. In summary, ini- tial steps can be greatly benefited from pre- folded helical structures of c-Myb (Figure 3), although binding before folding is also observed. The binding of helical conformations dominates the initial steps of the interaction, but for the interaction of the C-terminal tail, folding fol- lows binding. No limiting steps in the binding process are observed; hence no possible transi- tion states can be defined, as pointed out by experimental reports. 17 Conclusions The analysis presented here provides a detailed molecular description of binding of c-Myb to the primary interface of KIX, summarized as a two-step process, where initially the N-terminal region of c-Myb binds with a preferred heli- cal conformation, allowing the formation of na- tive contacts and, in the last step, folding and binding of the C-terminal. Study of the fluxes derived from the MSM shows the relevance of residue Leu302, not only in the final bound structure but also as the responsible for estab- lishing the first contacts and serving as an an- choring point between c-Myb and KIX. The model describes an overall induced-fit binding mechanism, as the complete folding of cMyb is only observed when native contacts 7 have been formed. Conformational selection would only affect the first binding stage on residues 298 to 302 and not the whole length of the peptide, whereas the latter stages of binding follow an induced-fit mechanism. Overall, our results provide a detailed mech- anistic model for the binding of c-Myb to the primary interface of KIX, as well as showing the interaction with a secondary binding site, by using unbiased full-atom MD simulations and MSM analysis. The novel MD sampling approach used in this work, AdaptiveBandit, had a crucial role in resolving this type of fold- ing and binding process. The method is im- plemented and available in the HTMD python package. 24 However, more algorithms can be de- rived within the same bandit framework. While here we choose the reward to be minus the free energy, other choices could optimize different costs, for example, improving the precision of the off-rate or optimizing sampling in the con- text of structure prediction. Methods Molecular dynamics simulations In order to generate initial conformations for c-Myb (residues 291 to 315), we ran multiple parallel simulations. The peptide was solvated in a cubic water box of 64 Å side with a NaCl concentration of 0.05 M . First, the peptide was simulated at 500 K for 120 ns to unfold the ini- tial structure. Then, 200 systems were built by placing one random unstructured c-Myb con- formation in conjunction with KIX in opposite corners of a 64 Å side cubic water box with a NaCl concentration of 0.05 M , resulting in a final protein concentration of 3.2 mM. All systems were built using HTMD 24 and simulated with ACEMD, 29 CHARMM22* force field 30 and TIP3P water model. 31 A Langevin integrator was used with a damping constant of 0.1 ps-1. The integration time step was set to 4 fs, with heavy hydrogen atoms (scaled up to four times the hydrogen mass) and holo- nomic constraints on all hydrogen-heavy atom bond terms. Electrostatics were computed us- ∼ ing PME with a cutoff distance of 9 Å and grid spacing of 1 Å. After energy minimization, equi- libration for all systems was done in an NPT ensemble at 303 K, 1 atm, with heavy atoms 1 Å2. Energy mini- constrained at 1 kcal mol− mization was run for 500 steps and equilibrated for 2 ns. Production runs of 250 ns were performed at 310 K using the distributed computing project GPUGrid, 32 following an adaptive sampling strategy. The final data set included 1,809 tra- jectories of 250 ns, resulting in an aggregated 450 μs. Additionally, a set simulation time of of long MD runs were performed starting from bound structures. Four models of the NMR- determined structure and four random bound conformations were selected and equilibrated as previously described. A total of 8 long trajec- 2 μs each were generated. tories of ∼ ∼ Markov state model analysis The projected space used for building the MSM included four different featurizations: all pair Cα + Cβ atoms distances between KIX and c-Myb to account for the interaction between the two proteins, self-distances between every Cα of c-Myb and its secondary structure, to monitor its conformation, and finally, RMSD to the bound structure. TICA was used at a lag time τ = 20 ns (implied timescales are shown in Supplementary Figure 1.a) for both the dis- tance features and the secondary structure fea- tures, taking the 4 most relevant components from the distance features (both inter-distances and cMyb self-distances) and the 3 most rele- vant components from the secondary structure features. The 8-dimensional projected data was dis- cretized into 2,000 clusters using the mini-batch k-means algorithm. 33 The microstates defined in the MSM were coarse-grained into larger meta-stable macrostates by using PCCA++. 34 For the estimation of kinetic values, the original MSM was modified by creating an additional macrostate, considered as the bulk state for all subsequent calculations to obtain the kinetics of binding. The bulk state was created by tak- ing those microstates where the minimum dis- tance between KIX and cMyb was higher than a threshold. Error in kinetic measures was esti- mated by creating 50 independent MSMs using a random set containing 80% of the simulation data. To obtain the kinetic pathway of binding and folding, we increased the number of macrostates in the MSM using PCCA++ again. Fluxes between macros were estimated using transi- tion path theory. 27,28 For the intra-macrostate flux analysis, we computed the mean helicity of cMyb for each microstate in it and clustered them into 4 main states which describe the pep- tide's grade of helix formation. All analysis were performed with HTMD. 24 AdaptiveBandit sampling R , γ and The multi-armed bandit problem is defined by a , where an action at ∈ A , R i hA is a (stochastic) reward function. We choose γ = 0 for totally discounted rewards. The P[a] selects actions at in optimal policy πa ∼ order to maximize the cumulative future re- wards. The construction of an optimal selec- tion strategy requires handling the exploration- exploitation problem. AdaptiveBandit relies on the UCB1 algorithm, 25 defining an upper con- fidence bound for each action-value estimate based on the number of times an action has been picked and the total amount of actions taken at = argmax ∈A " a Qt(a) + c ln t Nt(a)# , s (1) where t denotes the total number of actions a] is the action-value es- taken, Qt(a) = Eπ[r | timation, Nt(a) is the number of times action a has been selected (prior to time t) and c is a constant controlling the degree of exploration. As for the reward definition, there are different choices depending on the objective, e.g. here, the interest is sampling the bound metastable state, hence, we rewarded actions based on the stability of conformations using MSM estima- tions of the free energy for each state Ra =< kBT log(μ(x)) >(a,x1,...,xτ ), (2) 8 where μ(x) is the equilibrium distribution esti- mated by the MSM with the currently avail- able data and the average is performed over the frames in the trajectory starting from a. AdaptiveBandit uses the MSM discretized con- formational space to define the action set and at each round acquires a random conformation from the selected states to respawn new simu- lations. A more formal description of the ban- dit framework and AdaptiveBandit in the con- text of adaptive sampling as well as analysis in simpler, analytical potentials are available at. 22 The AdaptiveBandit sampling algorithm is made available in the HTMD 24 Python pack- age. Adaptive Sampling parameters For both the AdaptiveBandit and the count Adaptive runs, the construction of MSMs at each epoch was done using the residue-residue contacts between KIX and c-Myb measured as the minimum contacts between residues at a threshold of 5 Å, and the backbone dihedral angles of c-Myb. Time independent component analysis (TICA) 35 was used for dimensionality reduction using a lag time of τ = 20 frames and keeping the 3 first dimensions, which were later clustered with a k-centers algorithm. Adaptive- Bandit was performed during 40 epochs with a c value of 0.01. authors Acknowledgement The thank Kresten Lindorff-Larsen and Frank Noé for their critical reading of the manuscript. The authors also thank volunteers at GPUGRID.net for contributing computational resources and Acellera for funding. G.D.F. acknowledges support from MINECO (Unidad de Excelen- cia María de Maeztu CEX2018-000782-M and BIO2017-82628-P) and FEDER. This project received funding from the European Union's Horizon 2020 Research and Innovation Pro- gramme under Grant Agreement No. 823712 (CompBioMed2 Project). Author Contributions P.H.N. and A.P. generated and analyzed the data; P.H.N., A.P. and G.D.F. wrote the pa- per; G.D.F. designed research. Supporting Information Avail- able Supporting information is available free of charge. • Supporting information: Contains all supporting figures as well as the sup- porting table containing trajectory videos capturing the folding and binding of c-Myb with KIX domain. References (1) Dyson, H. J.; Wright, P. E. Intrinsi- cally unstructured proteins and their func- tions. Nature reviews Molecular cell biol- ogy 2005, 6, 197. (2) Kussie, P. H.; Gorina, S.; Marechal, V.; Elenbaas, B.; Moreau, J.; Levine, A. J.; Pavletich, N. P. Structure of the MDM2 oncoprotein bound to the p53 tumor sup- pressor transactivation domain. Science 1996, 274, 948–953. (3) Zor, T.; De Guzman, R. N.; Dyson, H. J.; Wright, P. E. Solution structure of the KIX domain of CBP bound to the trans- activation domain of c-Myb. Journal of molecular biology 2004, 337, 521–534. (4) Buch, I.; Giorgino, T.; De Fabritiis, G. Complete reconstruction of an enzyme- inhibitor binding process by molecular dy- namics simulations. Proceedings of the Na- tional Academy of Sciences 2011, 108, 10184–10189. (5) Plattner, N.; Doerr, S.; De Fabritiis, G.; Noé, F. Complete protein–protein as- sociation kinetics in atomic detail re- vealed by molecular dynamics simulations 9 and Markov modelling. Nature chemistry 2017, 9, 1005. (6) Borgia, A.; Borgia, M. B.; Bugge, K.; Kissling, V. M.; Heidarsson, P. O.; Fer- nandes, C. B.; Sottini, A.; Soranno, A.; Buholzer, K. J.; Nettels, D., et al. Ex- treme disorder in an ultrahigh-affinity pro- tein complex. Nature 2018, 555, 61. (7) Lindorff-Larsen, S.; K.; Dror, R. O.; Shaw, D. E. How fast- folding proteins fold. Science 2011, 334, 517–520. Piana, (8) Piana, S.; Lindorff-Larsen, K.; Shaw, D. E. Atomistic description of the folding of a dimeric protein. The Journal of Physical Chemistry B 2013, 117, 12935–12942. (9) Zwier, M. C.; Pratt, A. J.; Adel- man, J. L.; Kaus, J. W.; Zucker- man, D. M.; Chong, L. T. Efficient atom- istic simulation of pathways and calcu- lation of rate constants for a protein– peptide binding process: application to the MDM2 protein and an intrinsically disordered p53 peptide. The journal of physical chemistry letters 2016, 7, 3440– 3445. (10) Morrone, J. A.; Perez, A.; MacCallum, J.; Dill, K. A. Computed binding of peptides to proteins with MELD-accelerated molec- ular dynamics. Journal of chemical theory and computation 2017, 13, 870–876. (11) Zhou, G.; Pantelopulos, G. A.; Mukher- jee, S.; Voelz, V. A. Bridging micro- scopic and macroscopic mechanisms of p53-MDM2 binding with kinetic network models. Biophysical journal 2017, 113, 785–793. (12) Paul, F.; Wehmeyer, C.; Abualrous, E. T.; Wu, H.; Crabtree, M. D.; Schöneberg, J.; Clarke, J.; Freund, C.; Weikl, T. R.; Noé, F. Protein-peptide association ki- netics beyond the seconds timescale from atomistic simulations. Nature communica- tions 2017, 8, 1095. 10 (13) Chong, S.-H.; Im, H.; Ham, S. Explicit Characterization of the Free Energy Land- scape of pKID–KIX Coupled Folding and Binding. ACS Central Science 2019, 5, 1342–1351. (14) Arai, M.; Sugase, K.; Dyson, H. J.; Wright, P. E. Conformational propensities of intrinsically disordered proteins influ- ence the mechanism of binding and fold- ing. Proceedings of the National Academy of Sciences 2015, 112, 9614–9619. (15) Giri, R.; Morrone, A.; Toto, A.; Brunori, M.; Gianni, S. Structure of the transition state for the binding of c-Myb and KIX highlights an unexpected order for a disordered system. Proceedings of the National Academy of Sciences 2013, 110, 14942–14947. (16) Gianni, S.; Morrone, A.; Giri, R.; Brunori, M. A folding-after-binding mech- anism describes the recognition between the transactivation domain of c-Myb and the KIX domain of the CREB-binding protein. Biochemical and biophysical re- search communications 2012, 428, 205– 209. (17) Shammas, S. L.; Travis, A. J.; Clarke, J. Remarkably fast coupled folding and bind- ing of the intrinsically disordered trans- activation domain of cMyb to CBP KIX. The journal of physical chemistry B 2013, 117, 13346–13356. (18) Toto, A.; Camilloni, C.; Giri, R.; Brunori, M.; Vendruscolo, M.; Gianni, S. Molecular recognition by templated fold- ing of an intrinsically disordered protein. Scientific reports 2016, 6, 21994. (19) Poosapati, A.; Gregory, E.; Borcherds, W. M.; Chemes, L. B.; Daughdrill, G. W. Uncoupling the folding and binding of an intrinsically disordered protein. Journal of molecular biology 2018, 430, 2389–2402. (20) Shammas, S. L.; Travis, A. J.; Clarke, J. Allostery within a transcription coacti- vator is predominantly mediated through dissociation rate constants. Proceedings of the National Academy of Sciences 2014, 111, 12055–12060. (21) Sugase, K.; Dyson, H. J.; Wright, P. E. Mechanism of coupled folding and bind- ing of an intrinsically disordered protein. Nature 2007, 447, 1021. (22) Pérez, A.; Herrera-Nieto, P.; Doerr, S.; De Fabritiis, G. AdaptiveBandit: a multi- armed bandit framework for adaptive sampling in molecular simulations. Jour- nal of Chemical Theory and Computation 2020, 16, 4685–4693. (23) Doerr, S.; De Fabritiis, G. On-the-fly learning and sampling of ligand bind- ing by high-throughput molecular simula- tions. Journal of chemical theory and com- putation 2014, 10, 2064–2069. (24) Doerr, S.; Harvey, M.; Noé, F.; De Fab- ritiis, G. HTMD: high-throughput molec- ular dynamics for molecular discovery. Journal of chemical theory and computa- tion 2016, 12, 1845–1852. (25) Auer, P. Using confidence bounds for exploitation-exploration trade-offs. Jour- nal of Machine Learning Research 2002, 3, 397–422. (26) Prinz, J.-H.; Wu, H.; Sarich, M.; Keller, B.; Senne, M.; Held, M.; Chodera, J. D.; Schütte, C.; Noé, F. Markov models of molecular kinetics: Generation and validation. The Journal of chemical physics 2011, 134, 174105. (27) Weinan, E.; Vanden-Eijnden, E. Towards a theory of transition paths. Journal of statistical physics 2006, 123, 503. (28) Noé, F.; Schütte, C.; Vanden-Eijnden, E.; Reich, L.; Weikl, T. R. Constructing the equilibrium ensemble of folding pathways from short off-equilibrium simulations. 11 Proceedings of the National Academy of Sciences 2009, 106, 19011–19016. (29) Harvey, M. J.; Giupponi, G.; Fab- ritiis, G. D. ACEMD: accelerating biomolecular dynamics in the microsec- ond time scale. Journal of chemical theory and computation 2009, 5, 1632–1639. (30) Piana, S.; Lindorff-Larsen, K.; Shaw, D. E. How robust are protein folding simulations with respect to force field parameterization? Biophysical journal 2011, 100, L47–L49. (31) Jorgensen, W. L.; Chandrasekhar, J.; Madura, J. D.; Impey, R. W.; Klein, M. L. Comparison of simple potential functions for simulating liquid water. The Journal of chemical physics 1983, 79, 926–935. (32) Buch, I.; Harvey, M. J.; Giorgino, T.; Anderson, D. P.; De Fabritiis, G. High- throughput all-atom molecular dynamics simulations using distributed computing. Journal of chemical information and mod- eling 2010, 50, 397–403. (33) Pedregosa, F.; Varoquaux, G.; Gram- fort, A.; Michel, V.; Thirion, B.; Grisel, O.; Blondel, M.; Prettenhofer, P.; Weiss, R.; Dubourg, V., et al. Scikit- learn: Machine learning in Python. Jour- nal of machine learning research 2011, 12, 2825–2830. (34) Röblitz, S.; Weber, M. Fuzzy spectral clus- tering by PCCA+: application to Markov state models and data classification. Ad- vances in Data Analysis and Classification 2013, 7, 147–179. (35) Pérez-Hernández, G.; Paul, F.; Giorgino, T.; De Fabritiis, G.; Noé, F. Identification of slow molecular order pa- rameters for Markov model construction. The Journal of chemical physics 2013, 139, 07B604_1. Supporting Information: Binding-and-folding recognition of an intrinsically disordered protein using online learning molecular dynamics Pablo Herrera-Nieto,† , k Adri`a P ́erez ,† , ‡ , k and Gianni De Fabritiis∗ , † , , ¶ § Computational Science Laboratory, Universitat Pompeu Fabra, Barcelona Biomedical † Research Park (PRBB), C Dr. Aiguader 88, 08003, Barcelona, Spain Acellera Labs, C Dr Trueta 183, 08005, Barcelona, Spain ‡ Acellera Ltd, Devonshire House 582, HA7 1JS, United Kingdom ¶ Instituci ́o Catalana de Recerca i Estudis Avan ̧cats (ICREA), Passeig Lluis Companys 23, § 08010 Barcelona, Spain These authors contributed equally to this work k E-mail: [email protected] 3 2 0 2 b e F 0 2 ] . M B o i b - q [ 1 v 8 4 3 0 1 . 2 0 3 2 : v i X r a S-1 Table S1: Visualizations of representative trajectories showing the binding and folding of cMyb with the KIX domain. The selected trajectories were reconstructed from different trajectory fragments spawned across different epochs in the adaptive sam- pling scheme. The seven trajectories listed represent the seven unique paths that sample conformations with RMSD lower than 4 ̊A to the bound pose. Trajectory Trajectory 1 Trajectory 2 Trajectory 3 Trajectory 4 Trajectory 5 Trajectory 6 Trajectory 7 Min RMSD ( ̊A) Trajectory length [ns] Video URL 3.0 3.1 3.3 3.5 3.7 3.8 4.0 https://youtu.be/XNCe88Yzxro https://youtu.be/fZZji2cdaKI https://youtu.be/6qYiyhsqtig https://youtu.be/d8nvW8i_vHk https://youtu.be/eAOnZcW3D5Y https://youtu.be/vltn2zURsfY https://youtu.be/Mn_wjOxmcvU 323.1 631.7 323.1 706.5 521.7 445.1 323.1 S-2 Figure S1: Markov state model summary a) Implied time scales of the MD data. b) Microstate distribution across the first two TICA dimensions. Each microstate is colored by its corresponding macrostate. The legend shows the population of each macrostate. c) AdaptiveBandit exploration of the TICA space. Each colored point indicates a starting point selected by AdaptiveBandit to respawn a new trajectory. The color indicates the epoch number. In grey, the area covered by the projected simulation data without clustering, both in b) and c). d) Flux pathway from bulk to bound. Nodes are placed according to the committor probability. The y axis is manually set for better visualization of the graph. Node size is proportional to the equilibrium distribution. Node color corresponds to macrostate assignment as in b). The flux percentage is shown near each arrow. The main pathway is indicated with black, thicker arrows. S-3 a b c d Figure S2: Maximum Qint microstates contact fingerprint. Profile of contacts es- tablished between c-Myb and KIX in microstates with maximum fraction of native binding contacts Qint. Blue color represents contacts present in the state but not in the original NMR conformation, green indicates native contacts not found in the MSM state and yellow squares represent a match on that contact, found in both the NMR model and MD mi- crostate. A contact is considered present in a microstate when it appears in at least 50% of the conformations in that state. S-4 i % 2 . 9 8 t n Q 5 3 3 - K291 E292 K293 R294 I295 K296 E297 L298 E299 L300 L301 L302 M303 S304 e T305 t E306 a N307 t s E308 o L309 r K310 c G311 i Q312M i % 5 . 6 8 t n Q 5 7 - K291 E292 K293 R294 I295 K296 E297 L298 E299 L300 L301 L302 M303 e S304 t T305 a E306 t N307 s E308 o L309 r c K310 i G311 Q312M i % 5 . 6 8 t n Q 0 3 1 - K291 E292 K293 R294 I295 K296 E297 L298 E299 L300 L301 L302 M303 S304 e T305 t E306 a N307 t s E308 o L309 r K310 c G311 i Q312M i % 5 . 6 8 t n Q 0 2 2 - K291 E292 K293 R294 I295 K296 E297 L298 E299 L300 L301 L302 M303 S304 e T305 t E306 a N307 t s E308 o L309 r K310 c G311 i Q312M 6 9 5 T 7 9 5 Q 8 9 5 D 9 9 5 L 0 0 6 R 1 0 6 S 2 0 6 H 3 0 6 L 4 0 6 V 5 0 6 H 6 0 6 K 7 0 6 L 8 0 6 V 9 0 6 Q 0 1 6 A 1 1 6 I 2 1 6 F 3 1 6 P 4 1 6 T 5 1 6 P 6 1 6 D 7 1 6 P 8 1 6 A 9 1 6 A 0 2 6 L 1 2 6 K 2 2 6 D 3 2 6 R 4 2 6 R 5 2 6 M 6 2 6 E 7 2 6 N 8 2 6 L 9 2 6 V 0 3 6 A 1 3 6 Y 2 3 6 A 3 3 6 K 4 3 6 K 5 3 6 V 6 3 6 E 7 3 6 G 8 3 6 D 9 3 6 M 0 4 6 Y 1 4 6 E 2 4 6 S 3 4 6 A 4 4 6 N 5 4 6 S 6 4 6 R 7 4 6 D 8 4 6 E 9 4 6 Y 0 5 6 Y 1 5 6 H 2 5 6 L 3 5 6 L 4 5 6 A 5 5 6 E 6 5 6 K 7 5 6 I 8 5 6 Y 9 5 6 K 0 6 6 I 1 6 6 Q 2 6 6 K 3 6 6 E 4 6 6 L 5 6 6 E 6 6 6 E 7 6 6 K 8 6 6 R 9 6 6 R 0 7 6 S 1 7 6 R 2 7 6 L 6 9 5 T 7 9 5 Q 8 9 5 D 9 9 5 L 0 0 6 R 1 0 6 S 2 0 6 H 3 0 6 L 4 0 6 V 5 0 6 H 6 0 6 K 7 0 6 L 8 0 6 V 9 0 6 Q 0 1 6 A 1 1 6 I 2 1 6 F 3 1 6 P 4 1 6 T 5 1 6 P 6 1 6 D 7 1 6 P 8 1 6 A 9 1 6 A 0 2 6 L 1 2 6 K 2 2 6 D 3 2 6 R 4 2 6 R 5 2 6 M 6 2 6 E 7 2 6 N 8 2 6 L 9 2 6 V 0 3 6 A 1 3 6 Y 2 3 6 A 3 3 6 K 4 3 6 K 5 3 6 V 6 3 6 E 7 3 6 G 8 3 6 D 9 3 6 M 0 4 6 Y 1 4 6 E 2 4 6 S 3 4 6 A 4 4 6 N 5 4 6 S 6 4 6 R 7 4 6 D 8 4 6 E 9 4 6 Y 0 5 6 Y 1 5 6 H 2 5 6 L 3 5 6 L 4 5 6 A 5 5 6 E 6 5 6 K 7 5 6 I 8 5 6 Y 9 5 6 K 0 6 6 I 1 6 6 Q 2 6 6 K 3 6 6 E 4 6 6 L 5 6 6 E 6 6 6 E 7 6 6 K 8 6 6 R 9 6 6 R 0 7 6 S 1 7 6 R 2 7 6 L 6 9 5 T 7 9 5 Q 8 9 5 D 9 9 5 L 0 0 6 R 1 0 6 S 2 0 6 H 3 0 6 L 4 0 6 V 5 0 6 H 6 0 6 K 7 0 6 L 8 0 6 V 9 0 6 Q 0 1 6 A 1 1 6 I 2 1 6 F 3 1 6 P 4 1 6 T 5 1 6 P 6 1 6 D 7 1 6 P 8 1 6 A 9 1 6 A 0 2 6 L 1 2 6 K 2 2 6 D 3 2 6 R 4 2 6 R 5 2 6 M 6 2 6 E 7 2 6 N 8 2 6 L 9 2 6 V 0 3 6 A 1 3 6 Y 2 3 6 A 3 3 6 K 4 3 6 K 5 3 6 V 6 3 6 E 7 3 6 G 8 3 6 D 9 3 6 M 0 4 6 Y 1 4 6 E 2 4 6 S 3 4 6 A 4 4 6 N 5 4 6 S 6 4 6 R 7 4 6 D 8 4 6 E 9 4 6 Y 0 5 6 Y 1 5 6 H 2 5 6 L 3 5 6 L 4 5 6 A 5 5 6 E 6 5 6 K 7 5 6 I 8 5 6 Y 9 5 6 K 0 6 6 I 1 6 6 Q 2 6 6 K 3 6 6 E 4 6 6 L 5 6 6 E 6 6 6 E 7 6 6 K 8 6 6 R 9 6 6 R 0 7 6 S 1 7 6 R 2 7 6 L 6 9 5 T 7 9 5 Q 8 9 5 D 9 9 5 L 0 0 6 R 1 0 6 S 2 0 6 H 3 0 6 L 4 0 6 V 5 0 6 H 6 0 6 K 7 0 6 L 8 0 6 V 9 0 6 Q 0 1 6 A 1 1 6 I 2 1 6 F 3 1 6 P 4 1 6 T 5 1 6 P 6 1 6 D 7 1 6 P 8 1 6 A 9 1 6 A 0 2 6 L 1 2 6 K 2 2 6 D 3 2 6 R 4 2 6 R 5 2 6 M 6 2 6 E 7 2 6 N 8 2 6 L 9 2 6 V 0 3 6 A 1 3 6 Y 2 3 6 A 3 3 6 K 4 3 6 K 5 3 6 V 6 3 6 E 7 3 6 G 8 3 6 D 9 3 6 M 0 4 6 Y 1 4 6 E 2 4 6 S 3 4 6 A 4 4 6 N 5 4 6 S 6 4 6 R 7 4 6 D 8 4 6 E 9 4 6 Y 0 5 6 Y 1 5 6 H 2 5 6 L 3 5 6 L 4 5 6 A 5 5 6 E 6 5 6 K 7 5 6 I 8 5 6 Y 9 5 6 K 0 6 6 I 1 6 6 Q 2 6 6 K 3 6 6 E 4 6 6 L 5 6 6 E 6 6 6 E 7 6 6 K 8 6 6 R 9 6 6 R 0 7 6 S 1 7 6 R 2 7 6 L KIX residues NMR - MD+ NMR+ MD - NMR+ MD+ Figure S3: c-Myb helicity. Comparison of the by-residue helicity fraction of c-Myb between the four microstates with maximum Qint. The helicity profile for the peptide in isolation is depicted in grey. S-5 1.2 1.0 ) Microstate 335 cMyb alone % ( 0.8 y t i c i l 0.6 e H 0.4 0.2 0.0 1.2 1.0 ) 1 9 2 K 2 9 2 E 3 9 2 K 4 9 2 R 5 9 2 I 6 9 2 K 7 9 2 E 8 9 2 L 9 9 2 E 0 0 3 L 1 0 3 L 2 0 3 L 3 0 3 M 4 0 3 S 5 0 3 T 6 0 3 E 7 0 3 N 8 0 3 E 9 0 3 L 0 1 3 K 1 1 3 G 2 1 3 Q 3 1 3 Q 4 1 3 A 5 1 3 L Microstate 75 cMyb alone % ( 0.8 y t i c i l 0.6 e H 0.4 0.2 0.0 1.2 1.0 ) 1 9 2 K 2 9 2 E 3 9 2 K 4 9 2 R 5 9 2 I 6 9 2 K 7 9 2 E 8 9 2 L 9 9 2 E 0 0 3 L 1 0 3 L 2 0 3 L 3 0 3 M 4 0 3 S 5 0 3 T 6 0 3 E 7 0 3 N 8 0 3 E 9 0 3 L 0 1 3 K 1 1 3 G 2 1 3 Q 3 1 3 Q 4 1 3 A 5 1 3 L Microstate 130 cMyb alone % ( 0.8 y t i c i l 0.6 e H 0.4 0.2 0.0 1.2 1.0 1 9 2 K 2 9 2 E 3 9 2 K 4 9 2 R 5 9 2 I 6 9 2 K 7 9 2 E 8 9 2 L 9 9 2 E 0 0 3 L 1 0 3 L 2 0 3 L 3 0 3 M 4 0 3 S 5 0 3 T 6 0 3 E 7 0 3 N 8 0 3 E 9 0 3 L 0 1 3 K 1 1 3 G 2 1 3 Q 3 1 3 Q 4 1 3 A 5 1 3 L Microstate 220 cMyb alone ) % ( 0.8 y t i c i l 0.6 e H 0.4 0.2 0.0 1 9 2 K 2 9 2 E 3 9 2 K 4 9 2 R 5 9 2 I 6 9 2 K 7 9 2 E 8 9 2 L 9 9 2 E 0 0 3 L 1 0 3 L 2 0 3 L 3 0 3 M 4 0 3 S 5 0 3 T 6 0 3 E 7 0 3 N 8 0 3 E 9 0 3 L 0 1 3 K 1 1 3 G 2 1 3 Q 3 1 3 Q 4 1 3 A 5 1 3 L Figure S4: Extrapolations of a) kd and b) kof f values from experimental data. S-6 kd Fit Experimental values Extrapolation ) M ( d k 18 16 14 12 10 8 6 4 ) T / f f o k ( n l 1.0 0.5 0.0 0.5 1.0 1.5 2.0 2.5 koff Fit Experimental values Extrapolation 285 290 295 300 Temperature (K) 305 310 315 0.0032 0.0033 0.0034 1/T (K 1) 0.0035 0.0036 Figure S5: Statistics convergence across the MD run of a) kon, b) koff, c) free energy and d) microstate minimum RMSD, e) bound state maximum Qint and f ) bound state population, computed by the MSM. Each data point was calculated by building 10 different MSMs, bootstrapping 80% of the trajectories each time. S-7 9 8 7 6 5 6 7 8 9 a ) n o K ( 0 1 g o l c ) 1 l o m l a c k ( G e 0.8 0.6 i t n Q m u m x a M i - e t a t s d n u o B 0.4 0.2 0.0 b 4.0 3.5 3.0 2.5 ) f f o K ( 0 1 g o l Experimental value Experimental value 3 0 6 0 9 0 1 2 0 1 5 0 1 8 0 2 1 0 2 4 0 2 7 0 3 0 0 3 3 0 3 0 6 0 9 0 1 2 0 1 5 0 1 8 0 2 1 0 2 4 0 2 7 0 3 0 0 3 3 0 d Experimental value ) Å ( D S M R m u n n M i i - e t a t s d n u o B 3 0 6 0 9 0 1 2 0 1 5 0 1 8 0 2 1 0 2 4 0 2 7 0 3 0 0 3 3 0 Simulation time ( s) 6 4 2 0 3 0 6 0 9 0 1 2 0 1 5 0 1 8 0 2 1 0 2 4 0 2 7 0 3 0 0 3 3 0 Simulation time ( s) f 100 80 60 40 20 0 ) % ( n o i t a u p o p l e t a t s d n u o B 3 0 6 0 9 0 1 2 0 1 5 0 1 8 0 2 1 0 2 4 0 2 7 0 3 0 0 3 3 0 3 0 6 0 9 0 1 2 0 1 5 0 1 8 0 2 1 0 2 4 0 2 7 0 3 0 0 3 3 0 Simulation time ( s) Figure S6: a) Bulk state variability of kon, koff, free energy and metastability term, depending on the maximum distance threshold between KIX and cMyb used. The metastability term is defined as the bulk state self-transition probability (named for plot simplicity). The blue line shows the variable estimate, the red line shows the reference experimental value and the yellow line shows the defined threshold for deciding whether the bulk state is stable enough or not. b) Free energy estimates at different MSM lag times for the AdaptiveBandit simulations alone and together with the long trajectories starting from the NMR structures. The models were performed without defining a bulk state. S-8 a b Figure S7: Complete binding process of c-Myb to KIX. Structural analysis of the states involved in the main binding flux pathway on the 15 macrostate MSM. a) Mean helicity per residue and b) mean contacts profile is shown for the macrostates present in the binding process. c) Main pathways leading from Macrostate 14 (Bulk ) to Macrostate 12 (Bound ). Nodes are placed according to the fraction of native contacts Qint with respect to the NMR model on the x axis, and mean helicity on the y axis. Arrows represent the connection between macrostates, and their color, thickness and trace the percentage of the total flux traversing them. S-9 a c b Figure S8: Detailed intra-macrostate flux analysis. a) Cluster centers corresponding to the four main cMyb folded states: Full helix, Unfolded, N-terminal helix, C-terminal helix. These centers were computed using the mean helicity of all microstates. The centers are displayed with bar plots showing the helicity per residue. b,c) Flux pathways across clus- tered macrostates 13 (b) and 11 (c). The selected macrostates were clustered using the four centers defined in a), and the flux was recomputed using these newly defined clusters. Node colours and names indicate which cluster center from a) they correspond. Node position- ing was manually set for visualization purposes. Arrows represent the connection between macrostates/clusters. Their color, thickness, and trace represent the percentage of the total flux traversing them. S-10 a b c Figure S9: Secondary binding path of KIX and c-Myb. Study of the states involved in the secondary binding pathway, using the 15 macrostate MSM. For selected macrostates the a) mean helicity and b) KIX-c-Myb contacts profile is shown. Contact and helicity data for macrostates 10 and 13 are shown in FigS7. c) Main pathways leading from Macrostate 14 (Bulk ) to Macrostate 6 (Secondary). Nodes are placed according to the maximum distance between KIX and cMyb of each state on the x axis. The y axis is manually set for better visualization of the graph. Arrows represent the connection between macrostates, and their color, thickness, and trace the percentage of the total flux traversing them. S-11 b a c
http://arxiv.org/abs/2302.10347v1
2023-02-20T22:25:47
2023-02-20T22:25:47
Online Evolutionary Neural Architecture Search for Multivariate Non-Stationary Time Series Forecasting
Time series forecasting (TSF) is one of the most important tasks in data science given the fact that accurate time series (TS) predictive models play a major role across a wide variety of domains including finance, transportation, health care, and power systems. Real-world utilization of machine learning (ML) typically involves (pre-)training models on collected, historical data and then applying them to unseen data points. However, in real-world applications, time series data streams are usually non-stationary and trained ML models usually, over time, face the problem of data or concept drift. To address this issue, models must be periodically retrained or redesigned, which takes significant human and computational resources. Additionally, historical data may not even exist to re-train or re-design model with. As a result, it is highly desirable that models are designed and trained in an online fashion. This work presents the Online NeuroEvolution-based Neural Architecture Search (ONE-NAS) algorithm, which is a novel neural architecture search method capable of automatically designing and dynamically training recurrent neural networks (RNNs) for online forecasting tasks. Without any pre-training, ONE-NAS utilizes populations of RNNs that are continuously updated with new network structures and weights in response to new multivariate input data. ONE-NAS is tested on real-world, large-scale multivariate wind turbine data as well as the univariate Dow Jones Industrial Average (DJIA) dataset. Results demonstrate that ONE-NAS outperforms traditional statistical time series forecasting methods, including online linear regression, fixed long short-term memory (LSTM) and gated recurrent unit (GRU) models trained online, as well as state-of-the-art, online ARIMA strategies.
[ "Zimeng Lyu", "Alexander Ororbia", "Travis Desell" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10347v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10347v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.NE" ]
3 2 0 2 b e F 0 2 ] G L . s c [ 1 v 7 4 3 0 1 . 2 0 3 2 : v i X r a Online Evolutionary Neural Architecture Search for Multivariate Non-Stationary Time Series Forecasting Zimeng Lyu∗, Alexander Ororbia, Travis Desell Rochester Institute of Technology, Rochester, NY, USA Abstract Time series forecasting (TSF) is one of the most important tasks in data science given the fact that accurate time series (TS) predictive models play a major role across a wide variety of domains including finance, transportation, health care, and power systems. Real-world utilization of machine learning (ML) typically involves (pre-)training models on collected, historical data and then applying them to unseen data points. However, in real-world ap- plications, time series data streams are usually non-stationary and trained ML models usually, over time, face the problem of data or concept drift. To address this issue, models must be periodically retrained or redesigned, which takes significant human and computational resources. Additionally, historical data may not even exist to re-train or re-design model with. As a (cid:63)This material is based upon work supported by the U.S. Department of Energy, Office of Science, Office of Advanced Combustion Systems under Award Number #FE00031750 and #FE0031547. It is also supported by the Federal Aviation Administration and MITRE Corporation under the National General Aviation Flight Information Database (NGAFID) award. This work has been partially supported by the National Science Foundation under Grant Number 2225354. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the National Science Foundation. ∗Corresponding author Preprint submitted to Elsevier February 22, 2023 result, it is highly desirable that models are designed and trained in an online fashion. This work presents the Online NeuroEvolution-based Neural Archi- tecture Search (ONE-NAS) algorithm, which is a novel neural architecture search method capable of automatically designing and dynamically train- ing recurrent neural networks (RNNs) for online forecasting tasks. Without any pre-training, ONE-NAS utilizes populations of RNNs that are continu- ously updated with new network structures and weights in response to new multivariate input data. ONE-NAS is tested on real-world, large-scale mul- tivariate wind turbine data as well as the univariate Dow Jones Industrial Average (DJIA) dataset. Results demonstrate that ONE-NAS outperforms traditional statistical time series forecasting methods, including online lin- ear regression, fixed long short-term memory (LSTM) and gated recurrent unit (GRU) models trained online, as well as state-of-the-art, online ARIMA strategies. Keywords: Time Series Forecasting, Online Learning, Neural Architecture Search, Recurrent Neural Networks, Neuroevolution 1. Introduction Time series forecasting (TSF) is commonly used in many domains, such as health care [1], transportation [2], finance [3], and power systems [4]. TSF models are usually designed and trained offline with historical time series data. However, offline model building and training for TSF applications is based on the assumption that the target time series is stationary and that the models are to be trained with stationary data. When these pre-trained models are later applied to unseen temporal data, if the underlying data dis- 2 tribution of the data points change over time, these predictive systems begin to break down [5] [6]. In real world TSF applications, time series data is usually non-stationary and suffers from data drift. Some applications rely on auxiliary methods to transform the data's non-stationary distribution to a stationary one by training the models in a batch manner (by periodically updating the model with new data) to maintain expected prediction accu- racy. Unfortunately, this in turn can make models susceptible to catastrophic forgetting [7, 8] if the wrong historical data is removed in future training runs. The increase in computational ability of personal computers and the ac- cessibility of cloud computing makes it possible to do online TSF for various domains, such as the internet of things [9], climate modeling [10], financial decision making [11], and power and energy systems [12]. While traditional batch training methods can struggle to keep up with the large scale of modern streaming data, online TSF methods offer the potential of real-time model updates. Additionally, it may not be computationally feasible to examine model architecture changes when doing batch updates as it is not typically possible to do transfer learning between different model architectures. However, online TSF faces a lot of challenges. The first problem is catas- trophic forgetting – when there is data drift in online TSF data, models tends to forget historical information [13, 14]. Even though rehearsal techniques can help to avoid catastrophic forgetting [8], they can increase model com- plexity and reduce prediction efficiency. To ensure online methods can handle real time data, tradeoffs need to be made between model complexity, learning capability, and efficiency. Additionally, real-world time series data tends to be multivariate, which adds more complexity due to a higher dimensionality, 3 as well as non-seasonal. This makes it challenging to effectively use classical statistical methods such as the autoregressive moving average (ARMA) [15] and autoregressive integrated moving average (ARIMA) [16] for online mul- tivariate time series forecasting. Lastly, real-world, large-scale online data is usually noisy, and sometimes has incomplete data (e.g., when sensors may not be available), and TSF models need to be robust enough to deal with incomplete data streams. Models in this domain should also be able to adapt to multiple applications [13]. A major limitation for traditional and current online TSF models is that they assume a single model or neural network architecture which remains fixed, even as it is retrained on new batches of data or incoming online data. Due to this, a model for online TSF will either need to be large enough to be able to capture all possible aspects of concept drift, which is computation- ally inefficient/intractable, or suffer from catastrophic forgetting when it is trained on new data, limiting its ability to predict data similar to historical observations. In order to overcome these limitations, based on our previous work with time series forecasting on real-world TSF data with neuroevolution (NE) [17, 18, 4], we have developed the Online NeuroEvolution-based Neu- ral Architecture Search (ONE-NAS) algorithm. ONE-NAS, to the authors' knowledge, is the first algorithm capable of training and evolving recurrent neural networks (RNNs) architectures in an online manner for TSF. Models architectures evolved through ONE-NAS can be quickly trained in response to incoming data streams, which stands in contrast to alternative methods that require significant offline training time using previously gathered sets of training data. Furthermore, ONE-NAS dynamically adapts architectures to 4 keep computational costs minimal while being more robust to catastrophic forgetting. The novel contributions of our proposed ONE-NAS framework include: • it is the first online NE neural architecture search (NAS) algorithm for TSF with RNNs, • it utilizes distributed islands that allow evolution in small niches, • it utilizes island repopulation to improve performance over traditional methods, • it generates genomes (RNN architectures and weights) using a Lamar- ckian weight initialization strategy that allows information retention (significantly speeding up training), • it trains genomes on randomly selected historical data, such that im- portant historical data is naturally preserved in the training process, • it performs well on univariate as well as multivariate datasets, • it is distributed and scalable, and, • it is robust to real-world, large scale, and noisy data. Preliminary work [12] only offered a minimal presentation/sketch of the ONE-NAS algorithm, and this work extends this by providing full treat- ment of the algorithm, including detailed pseudocode. Preliminary, earlier work further only compared the performance between ONE-NAS and classi- cal naive, moving average, and exponential smoothing methods, focusing on the performance between ONE-NAS and ONE-NAS utilizing a repopulation method. This paper presents additional experiments comparing ONE-NAS with a traditional statistical TSF methods for online linear regression, online trained fixed architecture LSTM and GRU RNNs, as well as modern online 5 Figure 1: Depicted is one generation of the ONE-NAS online neuroevolutionary process. The global best genome performs predictions concurrently with distributed genome gen- eration and evaluation. 6 ARMIA based methods – crucially highlighting its feasibility as an algorithm that can both design and train RNNs for TSF in online scenarios. Results were gathered using noisy, real-world multivariate time series data extracted from wind turbine sensors as well as the univariate Dow Jones In- dustrial Average (DJIA) dataset. Our empirical results demonstrate signif- icant improvements in accuracy when using ONE-NAS over these methods. Furthermore, ONE-NAS utilizes a distributed, scalable computational pro- cessing scheme and is shown to operate efficiently, in real-time, over short time scales. Furthermore, we show that, within ONE-NAS, utilizing multiple islands that are periodically repopulated to prevent stagnation significantly improves the performance of the underlying optimization process. 2. Related Work Classical time series forecasting methods include na ̈ıve prediction, mov- ing average (MA) prediction [15], autoregression (AR) [19], and exponential smoothing [20] (also called simple exponential smoothing), offering powerful tools for time series forecasting; and traditional statistical methods such as autoregressive moving average (ARMA) [15], autoregressive integrated mov- ing average (ARIMA) models [15], triple exponential smoothing [21] (also known as Holt Winter's Exponential Smoothing) still play an important role in time series forecasting and have been used in a variety of different datasets [22] [23] [24]. Recent research has led to the development of online variants of classical models allowing model parameters to adapt to incoming streams of data. The online autoregressive integrated moving average (online ARIMA) has 7 been proposed for online time series forecasting [16], anomaly detection [25], and unsupervised anomaly detection [26] [26]. The autoregressive moving average (ARMA) [27] and the seasonal autoregressive integrated moving av- erage (SARIMA) [28] have also been proposed as powerful models for time series, with Anava et al.further proposing an AR model for TSF that can handle missing data values [29]. With respect to the artificial neural network (ANN) based approaches for online TSF, Guo et al. proposed an adaptive gradient learning method for training recurrent neural networks (RNNs) capable of time series forecasting notably in the presence of anomalies and change points [5]. Yang et al. use RoAdam (Robust Adam) to train long short-term memory (LSTM) RNNs for online time series prediction in the presence of outliers [30]. Wang et al. design an online sequential extreme learning machine utilizing a kernel (OS-ELMK) for non-stationary time series forecasting [31]. Other than clas- sical or NN-based online algorithms, online neural architecture search (NAS) and AutoML algorithms could also solve the drift problem. Some AutoML frameworks are designed to automatically adapt to data drift problem for online time series classification problems [32] [33] [34]. Yan et al. proposed a privacy-preserving online AutoML for face detection that extracts the meta- features of the input data with the goal of continuously improving the core algorithm's performance [35]. Neuroevolution (NE) itself has been widely used for time series prediction and neural architecture search in offline scenarios [36] [18] [17]. However, on- line neuroevolution has only been rarely investigated, with a few algorithms designed for games or simulators that involve real-time interactions, such as 8 an online car racing simulator [37], online video games [38] [39], and robotic controllers [40]. Crucially, these online NE NAS algorithms are based on the venerable NeuroEvolution of Augmenting Topologies (NEAT) algorithm [41] and start with minimal networks and evolve topologies and weights through a simulated evolutionary process. Cardamone et al. developed an online car racing simulator based on NEAT [41] and rtNEAT [39], combined with four evaluation strategies ((cid:15)-greedy [42], (cid:15)-greedy-improved, softmax, and interval-based). This algorithm evolves car drivers from scratch and can outperform offline models. To our knowledge, none of the above online neu- roevolution algorithms are capable of evolving recurrent networks nor have any been developed to specifically conduct online time series forecasting, notably making ONE-NAS the first of its kind. 3. Methodology This work leverages components from the Evolutionary Exploration of Augmenting Memory Models (EXAMM) algorithm [43] at its core. In partic- ular, our algorithm leverage's EXAMM's mutation, crossover, and training operations while maintaining the population in distinct islands. However, the process by which it evolves artificial neural networks (ANNs) and the operations it provides for utilizing them in online scenarios are novel. This section first describes EXAMM and its leveraged components in detail be- fore describing how they are incorporated into and extended/generalized in ONE-NAS. 9 Figure 2: EXAMM flowchart 3.1. EXAMM Figure 2 provides a high-level flowchart for the EXAMM algorithm. EX- AMM is an offline, distributed asynchronous neuro-evolutionary (NE) algo- rithm that evolves progressively larger RNNs for large-scale, multivariate, real-world TSF [44, 45]. EXAMM has n islands and each island has a ca- pacity of m. Each island starts with a minimum seed genome that only has input-to-output connections. One genome is generated for each island in a round-robin fashion until the entire population reaches the total number of the generated genomes. On each island, the new genome could be generated 10 by mutation, intra-island crossover, or inter-island crossover, in which islands could exchange genes. The generated genome is sent to the next available worker process for training. After training is completed, the trained genome is sent back to the island where it was generated, potentially replacing the worst genome if its fitness is higher than the (current) worst fitness value. EXAMM evolves RNN architectures consisting of varying degrees of re- current connections and memory cells through a series of mutation and crossover (reproduction) operations. Memory cells are selected from a neural library including ∆-RNN units [46], gated recurrent units (GRUs) [47], long short-term memory cells (LSTMs) [48], minimal gated units (MGUs) [49], and update-gate RNN cells (UGRNNs) [50]. ONE-NAS utilizes a similar parallel asynchronous strategy which naturally loads balances itself and al- lows for the decoupling of population size from the number of workers during each generation [43]. Generated offspring inherit their weights from their par- ents, which can significantly reduce the time needed for their training and evaluation [17]. It has been shown that EXAMM can swiftly adapt RNNs in transfer learning scenarios, even when the input and output data streams are changed [44] [45]. This serves as a preliminary motivation and justification for being able to adapt and evolve RNNs for online TSF. EXAMM has also evolved RNNs for time series prediction for different real-world applications [4, 45] and performance improvements through the use of extinction and repopulation events/mechanisms, in real-world evolu- tion [18], have been investigated. 11 3.2. The ONE-NAS Algorithm Algorithms 1, and 2 present pseudo-code for the full ONE-NAS procedure and Figure 1 presents a high-level overview of the asynchronous, distributed, and online ONE-NAS process. ONE-NAS concurrently evolves and trains new RNN candidate models while performing online time series data predic- tion. Note that ONE-NAS is fully online and does not require pre-training on any historical data before the online NE process begins. Figure 3 presents an example of ONE-NAS online prediction performance on multivariate wind turbine dataset. The plotted value is the expected and predicted output parameter average active power with values normalized between [0, 1]. We can see that the output values are non-seasonal. 12 Algorithm 1 ONE-NAS 1: function ONE-NAS MAIN 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: for t in generations do (cid:46) Perform predictions concurrently in a new thread, (cid:46) which returns the next time subsequence when complete Bnext = globalBestGenome.onlinePredict() if islandRepopulation then if t % extinctFreq == 0 then worstIsland = rankIslands().last() repopulate(worstIsland, globalBestGenome) (cid:46) Generate genomes in main process Ot = MPIMain.generateGenomes(Et) (cid:46) Process genomes asynchronously in parallel on worker processes Bvalidation = getValidationData(t, numV alidationSets) for genome g in Ot do (cid:46) Each worker randomly selects different training data Btrain = getTrainingData(t, numT rainingSets) MPIWorker.trainGenomes(g, Bvalidation, Btrain) MPI-Barrier() (cid:46) Evaluate genomes for next generation Et+1 = selectElite(Et, Ot, Bvalidation) globalBestGenome = getGlobalBestGenome() wait(Bnext) (cid:46) Get the latest subsequence of data and add it to the historical data timeSeriesSets.append(Bnext) Similarities between EXAMM and ONENAS:. ONE-NAS is also a NE NAS algorithm, so the online learning process typically starts with a minimal seed genome (a minimal seed genomes only has input to output connections 13 Algorithm 2 Data Selection Methods 1: function GetTrainingData(t) 2: 3: timeSeriesSets[0 : t − numV alidationSets].shuffle() Btrain = timeSeriesSets[0 : numT rainSets] 4: function GetValidationData(t, numV alidationSets) 5: Bvalidation = timeSeriesSets[t − numV alidationSets : t] 6: function GetOnlineTestData(t, numV alidationSets) 7: Bnext = timeSeriesSets[t + 1] and contains no hidden layers). It is also possible to start with a previously trained model or generated architecture as the seed genome to bootstrap this process. Genomes are evolved with the same mutation and crossover meth- ods in EXAMM. The population is maintained by distributed islands, which allows islands to evolve in their own niche, with islands exchanging informa- tion only by periodic inter-island crossover. Islands in both methods use a repopulation strategy to periodically erase and repopulate the islands that become stuck in local optima [18], and this work shows that this repopulation is critical for achieving viable online performance in ONE-NAS. Differences between EXAMM and ONE-NAS:. EXAMM is an offline algo- rithm, where the evolutionary process happens offline with each generated genome adapted to the entire offline dataset. In contrast, ONE-NAS collects the online streaming data for online training and evaluation, selecting sub- sets of historical data to be used for training and validation. In this work, crucially, ONE-NAS operates entirely online without any pretraining1. 1ONE-NAS can be seeded with a prior model or topology - however all results in this work start with an untrained, minimal seed genome 14 At the end of the neuro-evolutionary process, EXAMM selects the global best genome as the optimal solution. However, in ONE-NAS, the genome generation, training, evaluation, and online prediction processes are all per- formed online and concurrently. ONE-NAS uses the selected best genome from its previously trained population to make online predictions at each time t while a new population of genomes is dynamically trained. During the online evolutionary process, genomes are generated randomly by crossover and mutation, and inevitably, new generations contain genomes that perform worse than the average population. In the online setting, any algorithm needs to produce on-the-fly predictions with an expected accuracy at real-time, so it cannot afford to have too many poorly performing genomes in the population pool, allowing them to be parents to future offspring. ONE- NAS instead selects an elite population from the generated trained genomes and uses the elite population as online predictor candidates and parents for the next generation. ONE-NAS's online NE process starts with a minimal seed genome, which serves as an initial genome. In ONE-NAS each island has two sub-populations, generated and elite2. At time t, ONE-NAS evolves genomes according to the following steps: • Use the elite population Et−1 to generate a set of m genomes through mutation and crossover, defined as the generated population Ot. • Train the generated genomes Ot using MPI3 workers for a specified 2EXAMM, on the other hand, operates in a steady-state manner so it does not have explicit populations or elite populations. 3The Message Passing Interface [51], the most popular high performance computing 15 number of iterations/epochs with randomly selected historical data, Btrain. • Evaluate all of the current generation's genomes, Et−1 and Ot, using recent validation data, Bvalidation, to calculate their fitness values. • Select the next elite population, Et, from Et−1 and Ot. • Selecting the global best genome from the elite populations, Et, from all islands for online prediction. • Retain the members of the elite population Et for the next generation. Each generation lasts for a specified period p, measured in a number of dis- crete time steps (in this work, p = 25), which allows for the processing of a subsequence of the target time series. The best genome from the previous generation performs online predictions of the new subsequence (Bnext) as it arrives while, concurrently, the new generation of genomes is generated and trained. At the end of a generation, this new subsequence of data is added to ONE-NAS's historical training data (memory). During a generation, the generated genomes Ot are trained on a randomly selected set of Btrain sub- sequences of historical data, after which the entire population (including the elite Et) will be validated on the most recent Bvalidation subsequences. Each genome's fitness, calculated as the mean squared error loss over Bvalidation, is then used to select the next elite population Et+1. The best genome in Et+1 is used for online prediction in the next generation. Note that, while the genomes Ot are trained using backpropagation on batches sampled from the historical data, the RNNs in Et do not continue message passing library. 16 to be trained. Since not all RNNs in Et will perform better than those in Ot, "obsolete" RNNs will naturally die off over time while RNNs with strong performance will remain/persist. Also note that one of EXAMM's mutation operations, crucially utilized by ONE-NAS, is a clone operation which allows for a duplicate of an elite parent to be retained and trained in the next generation (further re-using its parent's weights due to EXAMM's Lamarckian weight inheritance strategy). 3.3. Learning Important Information Online learning models generally suffer from catastrophic forgetting [13] – this poses a significant problem since preserving important historical tem- poral information is crucial for TSF problems. One way to counter forgetting and data drift would be to train all of the offspring/genomes on every single historical data point seen so far jointly with any new incoming data. How- ever, this would quickly become inefficient, preventing an adaptive system from operating in a fast and online fashion. In ONE-NAS, offspring are in- stead trained with new incoming data and only on randomly selected sub-sets of historical data. Historical information is preserved in the population by retaining elite individuals as well as children inheriting weights from those parents [17] in tandem with efficient training using only small amounts of randomly selected/stored historical data. The fitness of the trained offspring is evaluated via validation mean squared error (MSE) using the most recent data. This process results in genomes that contain less important temporal information that naturally die off across generations of evolution. 17 Figure 3: The average active power parameter from the wind dataset used in this work, as well as an example of ONE-NAS's predictions on this dataset. As the time series is very long (over 59, 000 datapoints), for visibility, this figure depicts a selection of 7, 000 data points from February to April 2017. 4. Experimental Design 4.1. Datasets This work utilized two real-world datasets for predicting time series data with RNNs. The first was wind turbine engine data collected and made avail- able by ENGIE's La Haute Borne open data windfarm4, which was gathered from 2017 to January 2018. This wind dataset is very long, multivariate (con- taining 22 parameters/dimensions), non-seasonal, and the parameter record- ings are not independent. The wind turbine data consists of readings every 10 minutes from 2017 to January 2018. Average Active Power was selected as the output parameter to forecast for the wind turbine dataset. Figure 3 pro- vides an example of the noisiness and complexity of the output parameter as well as an example of the accuracy of ONE-NAS's predictions. This entire time series has around 59, 000 data points, with the above example showing 7000 data points from February to April 2017 as an example. Note that ONE-NAS is trained online (with no pre-training) so this plot depicts on- 4https://opendata-renewables.engie.com 18 line predictive performance as our system learns from scratch. The second dataset is the daily index of the Dow Jones Industrial Average (DJIA) from the years 1885-1962, which is univariate and contains 35, 701 samples. Both of the datasets that we investigate contain raw and abnormal data points that have not been cleaned – spikes and outliers have not been removed or smoothed from either dataset. 4.2. Processing and Setup Research has shown that using shorter subsequences of time series data during training can improve an RNN's convergence rate as well as its overall performance [4]. For these experiments, the original datasets were divided into subsequences of 25 timesteps each. During each simulated ONE-NAS generation, each newly generated genome was trained on 600 randomly se- lected subsequences from the historical data pool and then validated using the most recent 100 subsequences of data. Each genome utilizes a different random selection of 600 subsequences. There is no overlap between training and validation data (the most recent 100 subsequences are added into the historical pool after being used for validation). All the experiments for the wind dataset were run for 2000 generations, which represents one singular pass over the full wind data time series. In the ONE-NAS simulations5, during each generation, 50 elite genomes from the previous generation were retained and the elite genomes were used to generate 100 new genomes using a mutation rate of 0.4 and crossover probability of 0.6. Each of the 100 non-elite genomes in the new generation 5https://github.com/travisdesell/exact 19 were trained in a worker process for 10 epochs of backprop (a local search), with the first 5 epochs involving training on the original subsequence data. Then, in each of the last 5 epochs, 10% Gaussian noise was added (using the mean and standard deviation of the sliced data) as an augmentation technique to prevent overfitting [52] [53]. ONE-NAS with island repopulation utilized 10, 20, 30, or 40 islands, each having its own elite population of 5 genomes which generated an additional 10 genomes per generation. New genomes were generated with a mutation rate of 0.3, inter-island crossover rate of 0.4, and intra-island crossover rate of 0.3. 4.3. Results Each experiment was repeated 10 times using Rochester Institute of Tech- nology's research computing systems. This system consists of 2304 Intel® Xeon® Gold 6150 CPU 2.70GHz cores and 24 TB RAM, with compute nodes running the RedHat Enterprise Linux 7 system. Each experiment utilized 16 cores. 4.3.1. Comparison with Classical TSF Methods To test the performance of ONE-NAS, we first compared it to classical TSF methods: naive prediction, moving average prediction, and simple ex- ponential smoothing. While these are very simple univariate methods, they do perform well in many real-world application scenarios, due to the fact that the TSF data is very noisy and using previous observations to estimate the expected value at next time step usually gives a reasonable prediction. No- tably, these methods are capable of outperforming complex and sophisticated methods across a wide variety of datasets [54]. 20 Na ̈ve prediction (Naive) simply uses the data's/parameter's previous value, xt−1 as the predicted value, ˆyt, for the next time step: ˆyt = xt−1. The mov- ing average [15] predictor (MA) uses the average of the last n time steps as the prediction of the next time step, where n is the moving average data smoothing window (a hyperparameter): ˆyt = 1/n ∗ (cid:80)n 1 xt−n. The simple ex- ponential smoothing (Holt linear) [20] predictor (EXP) computes a running average of the previously seen parameters, where α is the smoothing factor, and 0 < α < 1: ˆyt = α ∗ xt−1 + (1 − α) ∗ ˆyt−1. We are aware that the choice of window size and α significantly affect the prediction performance of the moving average and exponential smoothing methods. Figure 4 shows the MA and EXP prediction mean squared error (MSE) with different window sizes (n) and α values on the wind dataset. The plot shows that the wind dataset is highly complex, where na ̈ve almost en- tirely predicts better than MA or EXP (apart from a negligible improvement with EXP for alpha values of 0.8 and 0.9). Figure 5 shows a plot for the online prediction MSE of ONE-NAS. The horizontal lines show each of the three classical time series forecasting meth- ods. Note that these methods are not stochastic, so their performance is always the same. Moving average (MA) predicts with a window size n = 3 and exponential smoothing uses a α = 0.2. The difference between "One- Nas" and "OneNas Repopulation" on the plots is that "OneNas" does not use any islands, where the entire population is one island, and the "OneNas Repopulation" uses multiple islands and the island repopulation strategies. The ONE-NAS repopulation strategy shown in this plot used 20 islands (each with 5 elite genomes and 10 other genomes per generation), with an extinc- 21 tion and repopulation frequency of 200 generations. While the ONE-NAS online prediction without repopulation performs worse compared to all three classical methods, the ONE-NAS method with repopulation not only signif- icantly outperforms the baselines but exhibits better predictive performance than the classical methods across all repeats except for one outlier. We further investigated using linear regression for online learning. At time t, the linear regression model is built using the last n observations and is then used to make predictions for time t + 1. Figure 6 shows the average linear regression online prediction mean squared error (MSE) using different observation window sizes n on the wind dataset. The plot shows that, for this dataset, the linear regressor makes better predictions when the observation window n is smaller. The best results come from the window size of 1, which is simply the na ̈ve prediction from before. The inability of these methods to outperform na ̈ve prediction highlights the complexity of this dataset – simpler prediction methodologies cannot capture the complexity of forecasting this data. Due to this, we focus on using na ̈ve prediction MSE to represent classical, baseline prediction performance in the following sections/experiments. 4.3.2. Preserving Population Variety with Islands As shown in Figure 5, using islands to maintain the population can sig- nificantly improve/boost the online forecasting performance, allowing ONE- NAS to outperform the classical methods. It is crucial to preserve variety in an online setting, because: 1) ONE-NAS generates more genomes than EX- AMM (for the same dataset and experimental set up, only 8k genomes were generated using EXAMM, but 200k generated in total using ONE-NAS), 2) 22 Figure 4: Classical TSF methods with varying window sizes and alpha values. genomes generated online are trained and evaluated with significantly less data (only a subset of the historical data), and, 3) the elite population is evaluated using the most recent data, so there is some data drift present in each generation, meaning that preserving variety can preserve important historical information while preventing overfitting. Given the above result that it is possible to effectively evolve and train RNNs in an online setting, we found that two hyperparameters significantly affect online prediction performance in ONE-NAS: the island size and the extinction and repopulation frequency. Figure 7 shows a box plot of the online prediction MSE using island sizes of 20, 30, and 40 in 10 repeated experiments/trials with varying repopulation frequencies. As the number of islands increases, the prediction performance improves. This could be due to the fact that more islands allow for more speciation and a greater ability to 23 Figure 5: Online prediction MSE of ONE-NAS and three classical TSF methods. escape local optima. Additional species also provide more robustness to noise and overfitting of the data. Given the same number of islands, more frequent extinction and repopulation events yield better performance on average. This is most likely due to the fact that these events prevent islands from stagnating with poor(er) species. 4.3.3. Online Predictions over Time The previous plots show the overall performance of ONE-NAS against classical methods for the entire wind time series, which gives an advantage to classical methods since they do not require any training and thus have a significant advantage for earlier time steps when ONE-NAS has not had much opportunity to train/evolve RNNs. In order to investigate how much the RNNs evolved by ONE-NAS were improving as they processed more data in an online fashion, we measured how many time steps (for each gen- 24 Figure 6: Linear regression window size vs. MSE. eration) exhibited a better predictive performance between the na ̈ve method and ONE-NAS. Figure 8 shows the percentage of predictions of each method that were accurate as the simulation progressed, with the red line represent- ing 50%. This plot shows that, while ONE-NAS does not outperform the na ̈ve strategy within the first 500 generations, the performance of ONE-NAS continues to increase as the evolution continues, which means that ONE- NAS does not only train and predict values online, it also gets progressively better throughout the evolutionary process, which is what we would expect from an online algorithm. Also note that it would be beneficial to combine a classical method with ONE-NAS – it could prove fruitful to use a na ̈ıve predictor until ONE-NAS has had enough evolution time to produce more accurate predictions. 25 Figure 7: ONE-NAS MSE with varying island sizes and extinction rates. 4.3.4. Online Prediction Time Efficiency Another key concern for the evaluation of online algorithms, apart from predictive accuracy, is time efficiency. If an online algorithm cannot provide predictions at a rate less than the arrival rate of new data to be predicted, then it is not usable/viable. ONE-NAS resolves this issue by utilizing the previous best genome to provide predictions while concurrently training the next generation. Note that for this study, each generation was generated and trained over a single subsequence of 25 time steps. For the wind dataset, each time step was gathered at a 10 minute interval, so this provides a significant buffer. However, for many time series datasets, time step frequency can be 26 Figure 8: ONE-NAS percentage of better prediction generations versus classical methods. per minute, per second, or even faster - making time efficiency a serious concern. Table 1 presents the average and longest time required to evolve and train one generation of the ONE-NAS Repopulation experiments for the varying numbers of islands. Note that population size was tied to island size, with 5 elite genomes and 10 other genomes per island, which is why the 40 island genomes took approximately twice the time. In the worst case, for 40 islands, the longest time per generation was a bit above 3 minutes, which is far below the 250 minute generation time for the wind data. It should also be noted that the workers training the genomes for each generation were distributed across 16 processors and that performance will scale linearly upwards until the number of available processors is equal to the population size (i.e., all generated genomes can be independently trained in parallel without reduction in performance apart from a fixed communication 27 Num Avg Longest Islands Time (s) Time (s) 20 30 40 35.67 41.72 69.96 109.20 127.44 189.72 Table 1: The average and longest measured times, in seconds (s), needed to evolve each generation for the wind dataset. and genome generation overhead cost). This particular scalability of ONE- NAS makes it well-suited to online learning. For example, if we scaled up to 200 processors over the 16 used for the 20 island experiments, we can estimate approximately 2.85 seconds per generation (i.e., training the 200 non-elite genomes at once, instead of 16 at a time), plus some additional communi- cation and generation overhead. With a generation time of 25 time steps, this would allow for incoming data to be processed at almost 10 readings per second. Given some flexibility in determining subsequence/generation time, ONE-NAS demonstrates the potential to operate for very high frequency time series given enough computing power. 4.3.5. ONE-NAS vs LSTM & GRU RNNs LSTM and GRU RNNs have been widely used in TSF problems [55] [56]. Fixed one-layer and two-layer LSTM and GRU networks were trained online to compare with ONE-NAS, where one-layer indicates that an LSTM/GRU only contained one fixed hidden layer or neurons while two-layer indicates that the RNN contained two fixed hidden layers. The size of each hidden layer was set to be equal to the size of the input layer and each node/unit 28 Figure 9: ONE-NAS versus one and two layer online LSTM RNNs. in the hidden layer was set to be an LSTM or GRU cell (whereas the input and output layer nodes consisted of simple neurons). Note that each layer is fully connected to the next. The LSTM and GRU networks were initial- ized with uniform random U(−0.5, 0.5) weights and weight updates/gradients were applied using Nesterov's accelerated gradient with a momentum value of μ = 0.9. The LSTM and GRU networks were trained on the wind data with a fixed moving window size. The gradients for the fixed-layer RNNS were all computed online using truncated backpropagation through time [57] [58] (where the networks were unrolled over the length of the window in order to compute the full gradients). Figure 9 and 10 show online testing RMSE using the best-found window size and best-found learning rate over 10 runs. A window size of 30 and a learning rate of 1e−3 was used for both one- 29 Figure 10: ONE-NAS versus one and two layer online GRU RNNs. layer LSTM and GRU networks, a window size of 20 and learning rate of 1e−3 was used for for the two-layer LSTM network, and a window size of 20 and learning rate of 2e−3 was used for the two-layer GRU network. These configurations were selected from experiments with different fixed window size of n = 10, 20, 30, 40, 50, and a variety of potential learning rates ranging from 5e−3 to 1e−4. The results show that ONE-NAS significantly outperforms tuned, fixed one-layer and two-layer LSTM and GRU networks. 4.3.6. ONE-NAS vs Online ARIMA While there is a significant lack of methods for online multivariate TSF, recent work by Liu et al. [16] has led to the development of an online ARIMA method for univariate TSF. To compare ONE-NAS with a state-of-the-art method as opposed to only the classical methods investigated earlier, we 30 Figure 11: Online ARIMA versus ONE-NAS predictions on the wind dataset. investigate ONE-NAS performance alongside this powerful, online ARIMA model. To reproduce the results from Liu et al., we first performed experi- ments using the Dow Jones Industrial Dataset (DJIA), which was used for evaluation in their work. Figure 12 presents results for their ARIMA-ONS (Arima Online Newton Step) and ARIMA-OGD (ARIMA Online Gradient descent) variants, which were the best performing variants examined in the original study. These were compared to the ONE-NAS Repopulation method with 10 islands and extinction frequency of 200, and over a similar genera- tion and subsequence length of 25. For both ONE-NAS and online ARIMA, the plots show that the online root mean squared error (RMSE) over time, averaged over 10 repeated experiments. The online RMSE over time is calcu- lated as the average RSME of all previous predictions. For this DJIA data, we show that, although the online ARIMA predictor mirrors/reproduces the 31 Figure 12: Online ARIMA versus ONE-NAS predictions on the DIJA dataset. results from the original study, ONE-NAS clearly outperforms this method by multiple orders of magnitude. We finally compared ONE-NAS with online ARIMA on the wind datasets, the results of which are presented in Figure 11. Similarly, the results de- pict the average performance over 10 repeated experiments. For online ARIMA, we performed a hyper-parameter sweep using a grid search for the online ARIMA methods on its learning rates and (cid:15) and report the best found hyper-parameters. For ARIMA-ONS, the learning rate was set to e−3 and (cid:15) = 3.16e−6. For ARIMA-OGD, learning rate was set to e3, and (cid:15) = e−5.5. ONE-NAS used the best hyper-parameters from our earlier pre- vious results/experiments in this study (40 islands and extinction frequency of 100). Similarly, we find that ONE-NAS also significantly outperforms the online ARIMA methods on the wind dataset. 32 4.4. ONE-NAS Evolved RNNs Figure 13 presents an example RNN evolved by ONE-NAS. In compari- son to commonly used layer-based (hierarchical) neural networks, networks evolved by ONE-NAS are "unlayered" but exhibit highly complex connec- tivity structures. Nodes in the network show their selected memory cell type (or simple, if a basic neuron was chosen), and edges with positive weights are shown in blue, and edges with negative weights are shown in red. Feed forward connections are in solid lines, and recurrent connections are shown in dotted lines. While this network may seem complex, in comparison to a standard layer based GRU or LSTM network (which ONE-NAS was shown to outperform in Section 4.3.5), the evolved network only has 21 neurons (of varying types). Whereas the GRU and LSTM networks have hidden layers of size 22 (the same size as the input layer). Furthermore, the nodes in the evolved network are not fully connected and, as a result, actually contains significantly less synaptic edges. This example shows how ONE-NAS not evolves well per- forming architectures online but also ones that are sparser (with respect to synaptic connectivity) and computationally more efficient. 5. Conclusion This work presents the Online NeuroEvolution-based Neural Architecture Search (ONE-NAS) meta-heuristic optimization algorithm and applies it to the problem of non-stationary time series forecasting (TSF) on challenging real-world tasks. To the author's knowledge, ONE-NAS is the first neu- ral architecture search algorithm capable of designing and training recurrent 33 - . S A N E N O y b e n i l n o d e v l o v e s a w t a h t N N R g n m r o f r e p i t s e b r a l p m a x e n A : 3 1 e r u g i F 34 neural networks (RNNs) in real-time as data arrives in an online fashion. ONE-NAS is a dynamic/online, distributed, scalable, real-time algorithm that works on univariate and multivariate real-world TSF datasets. ONE- NAS starts evolution from a minimal seed genome, which potentially reduces optimal model complexity [41], and then generates, trains, evaluates genomes online/incrementally, while concurrently performing online forecasting with the best previously found model. New streaming data is collected into a historical data pool and new generated genomes are trained on randomly selected sub-sets of the historical data. Generated genomes retain knowledge from parental weights using a Lamarckian inheritance process [17], reducing the amount of training required. By training new genomes with randomly selected historical data and evaluating these on recently collected data, data drift can be managed and catastrophic forgetting can be avoided. Maintain- ing genomes in populations also acts as a method to retain previously gained knowledge on historical data to further safeguard against forgetting. An important feature of the ONE-NAS algorithm is that it utilizes islands to maintain the population diversity and prevent over-fitting during the on- line learning process. Further, periodically repopulating poorly performing islands was shown to be critical in allowing ONE-NAS to outperform other strategies. Our empirical results show that ONE-NAS repopulation out- performs classical TSF methods, linear regression models, LSTM and GRU networks trained online, and a powerful online ARIMA method. Our results also demonstrate that using more islands with more frequent repopulation is strongly correlated with increasing/improved performance. Finally, our sta- tistical results indicate that our algorithm can achieve real-time performance 35 in real-world scenarios. As a result, this study shows that online neuroevolu- tion or neural architecture search is feasible in online scenarios, which holds great promise for addressing important challenges in time series forecasting. References [1] N. Zinouri, K. M. Taaffe, D. M. Neyens, Modelling and forecasting daily surgical case volume using time series analysis, Health Systems 7 (2) (2018) 111–119. [2] T. Wu, K. Xie, D. Xinpin, G. Song, A online boosting approach for traffic flow forecasting under abnormal conditions, in: 2012 9th International Conference on Fuzzy Systems and Knowledge Discovery, IEEE, 2012, pp. 2555–2559. [3] J. Cao, Z. Li, J. Li, Financial time series forecasting model based on ceemdan and lstm, Physica A: Statistical Mechanics and its Applications 519 (2019) 127–139. [4] Z. Lyu, S. Patwardhan, D. Stadem, J. Langfeld, S. Benson, S. Thoelke, T. Desell, Neuroevolution of recurrent neural networks for time series forecasting of coal-fired power plant operating parameters, in: Proceed- ings of the Genetic and Evolutionary Computation Conference Compan- ion, 2021, pp. 1735–1743. [5] T. Guo, Z. Xu, X. Yao, H. Chen, K. Aberer, K. Funaya, Robust on- line time series prediction with recurrent neural networks, in: 2016 IEEE International Conference on Data Science and Advanced Ana- lytics (DSAA), Ieee, 2016, pp. 816–825. 36 [6] T. Fields, G. Hsieh, J. Chenou, Mitigating drift in time series data with noise augmentation, in: 2019 International Conference on Computa- tional Science and Computational Intelligence (CSCI), IEEE, 2019, pp. 227–230. [7] M. McCloskey, N. J. Cohen, Catastrophic interference in connectionist networks: The sequential learning problem, in: Psychology of learning and motivation, Vol. 24, Elsevier, 1989, pp. 109–165. [8] R. M. French, Catastrophic forgetting in connectionist networks, Trends in cognitive sciences 3 (4) (1999) 128–135. [9] M. P. Raju, A. J. Laxmi, Iot based online load forecasting using machine learning algorithms, Procedia Computer Science 171 (2020) 551–560. [10] S. Partee, M. Ellis, A. Rigazzi, A. E. Shao, S. Bachman, G. Marques, B. Robbins, Using machine learning at scale in numerical simulations with smartsim: An application to ocean climate modeling, Journal of Computational Science 62 (2022) 101707. [11] J. A. R. Gonz ́alez, J. F. Sol ́ıs, H. J. F. Huacuja, J. J. G. Barbosa, R. A. P. Rangel, Fuzzy ga-svr for mexican stock exchange's financial time series forecast with online parameter tuning, International Journal of Combinatorial Optimization Problems and Informatics 10 (1) (2019) 40. [12] Z. Lyu, T. Desell, One-nas: An online neuroevolution based neu- ral architecture search for time series forecasting, arXiv preprint arXiv:2202.13471. 37 [13] S. C. Hoi, D. Sahoo, J. Lu, P. Zhao, Online learning: A comprehensive survey, Neurocomputing 459 (2021) 249–289. [14] L. Yu, S. Wang, K. K. Lai, An online learning algorithm with adaptive forgetting factors for feedforward neural networks in financial time series forecasting, Nonlinear dynamics and systems theory 7 (1) (2007) 51–66. [15] J. D. Cryer, Time series analysis, Vol. 286, Springer, 1986. [16] C. Liu, S. C. Hoi, P. Zhao, J. Sun, Online arima algorithms for time series prediction, in: Thirtieth AAAI conference on artificial intelligence, 2016. [17] Z. Lyu, A. ElSaid, J. Karns, M. Mkaouer, T. Desell, An experimental study of weight initialization and lamarckian inheritance on neuroevo- lution, The 24th International Conference on the Applications of Evo- lutionary Computation (EvoStar: EvoApps). [18] Z. Lyu, J. Karnas, A. ElSaid, M. Mkaouer, T. Desell, Improving dis- tributed neuroevolution using island extinction and repopulation, The 24th International Conference on the Applications of Evolutionary Com- putation (EvoStar: EvoApps). [19] R. A. Stine, Estimating properties of autoregressive forecasts, Journal of the American statistical association 82 (400) (1987) 1072–1078. [20] E. S. Gardner Jr, Exponential smoothing: The state of the art, Journal of forecasting 4 (1) (1985) 1–28. [21] J. I. Hansen, Triple exponential smoothing; a tool for common stock price prediction. 38 [22] B. Siregar, I. Butar-Butar, R. Rahmat, U. Andayani, F. Fahmi, Com- parison of exponential smoothing methods in forecasting palm oil real production, in: Journal of Physics: Conference Series, Vol. 801, IOP Publishing, 2017, p. 012004. [23] Z. Chen, Q. Xue, R. Xiao, Y. Liu, J. Shen, State of health estimation for lithium-ion batteries based on fusion of autoregressive moving average model and elman neural network, IEEE access 7 (2019) 102662–102678. [24] D. Benvenuto, M. Giovanetti, L. Vassallo, S. Angeletti, M. Ciccozzi, Application of the arima model on the covid-2019 epidemic dataset, Data in brief 29 (2020) 105340. [25] V. Kozitsin, I. Katser, D. Lakontsev, Online forecasting and anomaly detection based on the arima model, Applied Sciences 11 (7) (2021) 3194. [26] F. Schmidt, F. Suri-Payer, A. Gulenko, M. Wallschl ̈ager, A. Acker, O. Kao, Unsupervised anomaly event detection for cloud monitoring using online arima, in: 2018 IEEE/ACM International Conference on Utility and Cloud Computing Companion (UCC Companion), IEEE, 2018, pp. 71–76. [27] O. Anava, E. Hazan, S. Mannor, O. Shamir, Online learning for time series prediction, in: Conference on learning theory, PMLR, 2013, pp. 172–184. [28] M. Han, S. Zhang, M. Xu, T. Qiu, N. Wang, Multivariate chaotic time 39 series online prediction based on improved kernel recursive least squares algorithm, IEEE transactions on cybernetics 49 (4) (2018) 1160–1172. [29] O. Anava, E. Hazan, A. Zeevi, Online time series prediction with missing data, in: International Conference on Machine Learning, PMLR, 2015, pp. 2191–2199. [30] H. Yang, Z. Pan, Q. Tao, Robust and adaptive online time series pre- diction with long short-term memory, Computational intelligence and neuroscience 2017. [31] X. Wang, M. Han, Online sequential extreme learning machine with kernels for nonstationary time series prediction, Neurocomputing 145 (2014) 90–97. [32] B. Celik, P. Singh, J. Vanschoren, Online automl: An adaptive automl framework for online learning, arXiv preprint arXiv:2201.09750. [33] B. Celik, J. Vanschoren, Adaptation strategies for automated machine learning on evolving data, IEEE Transactions on Pattern Analysis and Machine Intelligence 43 (9) (2021) 3067–3078. [34] J. G. Madrid, H. J. Escalante, E. F. Morales, W.-W. Tu, Y. Yu, L. Sun- Hosoya, I. Guyon, M. Sebag, Towards automl in the presence of drift: first results, arXiv preprint arXiv:1907.10772. [35] C. Yan, Y. Zhang, Q. Zhang, Y. Yang, X. Jiang, Y. Yang, B. Wang, Privacy-preserving online automl for domain-specific face detection, arXiv preprint arXiv:2203.08399. 40 [36] I. Ororbia, G. Alexander, F. Linder, J. Snoke, Using neural generative models to release synthetic twitter corpora with reduced stylometric identifiability of users, arXiv preprint arXiv:1606.01151. [37] L. Cardamone, D. Loiacono, P. L. Lanzi, Learning to drive in the open racing car simulator using online neuroevolution, IEEE Transactions on Computational Intelligence and AI in Games 2 (3) (2010) 176–190. [38] A. Agogino, K. Stanley, R. Miikkulainen, Online interactive neuro- evolution, Neural Processing Letters 11 (1) (2000) 29–38. [39] K. O. Stanley, B. D. Bryant, R. Miikkulainen, Real-time neuroevolution in the nero video game, IEEE transactions on evolutionary computation 9 (6) (2005) 653–668. [40] M. Galassi, N. Capodieci, G. Cabri, L. Leonardi, Evolutionary strate- gies for novelty-based online neuroevolution in swarm robotics, in: 2016 IEEE International Conference on Systems, Man, and Cybernetics (SMC), IEEE, 2016, pp. 002026–002032. [41] K. Stanley, R. Miikkulainen, Evolving neural networks through aug- menting topologies, Evolutionary computation 10 (2) (2002) 99–127. [42] R. S. Sutton, A. G. Barto, Reinforcement learning: An introduction, MIT press, 2018. [43] A. Ororbia, A. ElSaid, T. Desell, Investigating recurrent neural network memory structures using neuro-evolution, in: Proceedings of the Genetic and Evolutionary Computation Conference, GECCO '19, ACM, New 41 York, NY, USA, 2019, pp. 446–455. doi:10.1145/3321707.3321795. URL http://doi.acm.org/10.1145/3321707.3321795 [44] A. ElSaid, J. Karns, Z. Lyu, D. Krutz, A. Ororbia, T. Desell, Improving neuroevolutionary transfer learning of deep recurrent neural networks through network-aware adaptation, in: Proceedings of the 2020 Genetic and Evolutionary Computation Conference, 2020, pp. 315–323. [45] A. ElSaid, J. Karnas, Z. Lyu, D. Krutz, A. G. Ororbia, T. Desell, Neuro- evolutionary transfer learning through structural adaptation, in: Inter- national Conference on the Applications of Evolutionary Computation (Part of EvoStar), Springer, 2020, pp. 610–625. [46] A. G. Ororbia II, T. Mikolov, D. Reitter, Learning simpler language models with the differential state framework, Neural Computation 0 (0) (2017) 1–26, pMID: 28957029. arXiv:https://doi.org/10.1162/ neco\_a\_01017, doi:10.1162/neco\_a\_01017. URL https://doi.org/10.1162/neco_a_01017 [47] J. Chung, C. Gulcehre, K. Cho, Y. Bengio, Empirical evaluation of gated recurrent neural networks on sequence modeling, arXiv preprint arXiv:1412.3555. [48] S. Hochreiter, J. Schmidhuber, Long short-term memory, Neural Com- putation 9 (8) (1997) 1735–1780. [49] G.-B. Zhou, J. Wu, C.-L. Zhang, Z.-H. Zhou, Minimal gated unit for re- current neural networks, International Journal of Automation and Com- puting 13 (3) (2016) 226–234. 42 [50] J. Collins, J. Sohl-Dickstein, D. Sussillo, Capacity and trainability in recurrent neural networks, arXiv preprint arXiv:1611.09913. [51] B. Barker, Message passing interface (mpi), in: Workshop: high perfor- mance computing on stampede, Vol. 262, Cornell University Publisher Houston, TX, USA, 2015. [52] C. M. Bishop, Training with noise is equivalent to tikhonov regulariza- tion, Neural computation 7 (1) (1995) 108–116. [53] C. M. Bishop, et al., Neural networks for pattern recognition, Oxford university press, 1995. [54] S. Makridakis, E. Spiliotis, V. Assimakopoulos, Statistical and machine learning forecasting methods: Concerns and ways forward, PloS one 13 (3) (2018) e0194889. [55] V. K. R. Chimmula, L. Zhang, Time series forecasting of covid-19 trans- mission in canada using lstm networks, Chaos, Solitons & Fractals 135 (2020) 109864. [56] R. Fu, Z. Zhang, L. Li, Using lstm and gru neural network methods for traffic flow prediction, in: 2016 31st Youth Academic Annual Conference of Chinese Association of Automation (YAC), IEEE, 2016, pp. 324–328. [57] O. Marschall, K. Cho, C. Savin, A unified framework of online learning algorithms for training recurrent neural networks, Journal of machine learning research. 43 [58] F. A. Gers, D. Eck, J. Schmidhuber, Applying lstm to time series predictable through time-window approaches, in: Neural Nets WIRN Vietri-01, Springer, 2002, pp. 193–200. 44
http://arxiv.org/abs/2302.10344v1
2023-02-20T22:19:50
2023-02-20T22:19:50
Model-based feature selection for neural networks: A mixed-integer programming approach
In this work, we develop a novel input feature selection framework for ReLU-based deep neural networks (DNNs), which builds upon a mixed-integer optimization approach. While the method is generally applicable to various classification tasks, we focus on finding input features for image classification for clarity of presentation. The idea is to use a trained DNN, or an ensemble of trained DNNs, to identify the salient input features. The input feature selection is formulated as a sequence of mixed-integer linear programming (MILP) problems that find sets of sparse inputs that maximize the classification confidence of each category. These ''inverse'' problems are regularized by the number of inputs selected for each category and by distribution constraints. Numerical results on the well-known MNIST and FashionMNIST datasets show that the proposed input feature selection allows us to drastically reduce the size of the input to $\sim$15\% while maintaining a good classification accuracy. This allows us to design DNNs with significantly fewer connections, reducing computational effort and producing DNNs that are more robust towards adversarial attacks.
[ "Shudian Zhao", "Calvin Tsay", "Jan Kronqvist" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10344v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10344v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "math.OC", "@scheme": "http://arxiv.org/schemas/atom" }
[ "math.OC", "cs.LG" ]
3 2 0 2 b e F 0 2 ] C O . h t a m [ 1 v 4 4 3 0 1 . 2 0 3 2 : v i X r a Model-based feature selection for neural networks: A mixed-integer programming approach∗ Shudian Zhao † Calvin Tsay ‡ Jan Kronqvist †§ February 22, 2023 In this work, we develop a novel input feature selection framework for ReLU- based deep neural networks (DNNs), which builds upon a mixed-integer opti- mization approach. While the method is generally applicable to various clas- sification tasks, we focus on finding input features for image classification for clarity of presentation. The idea is to use a trained DNN, or an ensemble of trained DNNs, to identify the salient input features. The input feature selection is formulated as a sequence of mixed-integer linear programming (MILP) prob- lems that find sets of sparse inputs that maximize the classification confidence of each category. These "inverse" problems are regularized by the number of inputs selected for each category and by distribution constraints. Numerical results on the well-known MNIST and FashionMNIST datasets show that the proposed input feature selection allows us to drastically reduce the size of the input to ∼15% while maintaining a good classification accuracy. This allows us to design DNNs with significantly fewer connections, reducing computational effort and producing DNNs that are more robust towards adversarial attacks. Keywords- Mixed-integer programming, Deep neural networks, Feature selection, Sparse DNNs, Model reduction. 1 Introduction Over the years, there has been an active interest in algorithms for training sparse deep neural networks (DNNs) or sparsifying trained DNNs. By sparsifying a DNN we mean removing some connections (parameters) in the network, which can be done by setting the corresponding weights to zero. Examples of algorithms for sparsifying or training sparse networks include, dropout methods [8, 14, 15, 31], optimal/combinatorial brain surgeon [13, 36], optimal brain damage [19], and regularization based methods [21, 23, 33]. Carefully sparsifying the network, i.e., reducing the number of parameters wisely, has shown to reduce ∗Supported by C3.ai Digital Transformation Institute, and Digital Futures at KTH †Optimization and Systems Theory, Department of Mathematics, KTH Royal Institute of Technology, Stockholm, Sweden, [email protected], [email protected] ‡Department of Computing, Imperial College London, London, UK, [email protected] §Corresponding author 1 over-fitting and improve overall generalizability [14, 18]. This paper focuses on feature selection for DNNs, which can also be interpreted as "sparsifying" the first/input layer, and we show that we can significantly reduce the number of parameters, i.e., non-zero weights, while keeping a good accuracy. Throughout the paper we focus on image classification, but the framework is general. This work focuses on finding the salient input features for classification using a DNN. We hypothesize that the number of inputs to DNNs for classification can often be greatly reduced by a "smart" choice of input features while keeping a good accuracy (i.e., feature selection). We build the hypothesis on the assumption that not all inputs, or pixels, will be equally important. Reducing the number of inputs/parameters has the potential to: i) reduce over-fitting, ii) give more robust DNNs that are less sensitive for adversarial attacks (fewer degrees of freedom for the attacker), and iii) reduce computational complexity both in training and evaluating the resulting classifier (fewer weights to determine and fewer computational operations to evaluate the outputs). The first two are classical focus areas within artificial intelligence (AI), and the third is becoming more important with an increasing interest in so-called green AI [26]. Most strategies for feature selection can be grouped as either filter methods, which examine the data, e.g., for correlation, and wrapper methods, which amount to a guided search over candidate models [4, 20]. Feature selection can also be incorporated directly into model training using embedded methods, e.g., regularization. This paper and the numerical results are intended as a proof of concept to demonstrate mixed-integer linear programming (MILP) as an alternative technology for extracting the importance of input features from DNNs. Input feature selection is an active research area, e.g., see the review papers [9, 37], and a detailed comparison to state-of-the- art methods is not within the scope of this paper. Our proposed method leverages trained models that achieve desirable performance, and attempts to select a feature set that replicates the performance using mixed-integer pro- gramming. We build on the idea that, given a relatively well-trained DNN, we can analyze the DNN in an inverse fashion to derive information about the inputs. Specifically, to determine the most important inputs, or pixels in the case of image classification, for a given label, we solve an optimization problem that maximizes the classification confidence of the label with a cardinality constraint on the number of non-zero inputs to the DNN. We consider this as an "inverse problem," as the goal is to determine the DNN inputs from the output. We additionally propose some input distribution constraints to make the input feature selection less sensitive to errors in the input-output mapping of the DNN. We only consider DNNs with the rectified linear unit (ReLU) activation function, as it enables the input feature selection problem to be formulated as a MILP problem [7, 22]. However, the framework can be easily generalized to CNN architectures and other MIP representable activation functions, e.g., max pooling and leaky ReLU Optimizing over trained ReLU-based DNNs has been an active research topic in recent years, and has a wide variety of applications including verification [2, 22, 28], lossless com- pression [27], and surrogate model optimization [11, 35]. There even exists software, such as OMLT [3], for directly incorporating ReLU DNNs into general optimization models. Op- timizing over a trained ReLU-based DNN through the MILP encoding is not a trivial task, but significant progress has been made in terms of strong formulations [1, 16, 29], solution methods [5, 25], and techniques for deriving strong valid inequalities [1, 2]. In combination with the remarkable performance of state-of-the-art MILP solvers, optimization over DNNs appears computationally tractable (at least for moderate size DNNs). This work builds upon recent optimization advancements, as reliably optimizing over ReLU-based DNNs is 2 a key component in the proposed method. The paper is structured as follows. Section 2 first describes the MILP problem to de- termine which inputs maximize the classification confidence. Some enhancements for the input selection are presented, and the complete input selection algorithm is presented in Section 2.4. Numerical results are presented in Section 3, where we show that we can obtain a good accuracy when downsizing the input to 15% by the proposed algorithm, and that the resulting DNNs are more robust towards adversarial attacks in the (cid:96)∞ sense. Section 4 provides some conclusions. 2 Input feature selection algorithm Our feature selection strategy is based on the idea of determining a small optimal subset of inputs, or pixels for the case of image classification, that are allowed to take non-zero values to maximize the classification confidence for each label using a pre-trained DNN. By combining the optimal subsets for each label, we can determine a set of salient input features. These input features can be considered as the most important for the given DNN, but we note that the DNN might not offer a perfect input-output mapping. To mitigate the impact of model errors, we propose a technique of using input distribution constraints to ensure that the selected input features are to some extent distributed over the input space. This framework could easily be extended to use optimization over an ensemble DNN model [32] for input selection, where the inputs would be selected such that the ensemble classification confidence is maximized. While using DNN ensembles can further mitigate the effect of errors in individual DNNs, our initial tests did not indicate clear advantages of using DNN ensembles for this purpose. Here we focus on fully connected DNNs that classify grayscale images into 10 categories. While this setting is limited, the proposed method is applicable to classification of RGB images, and other classification problems in general. The input features are scaled between 0 and 1, with 255 (white) corresponding to 1 and 0 remaining black. We start by briefly reviewing MILP encoding of DNNs in the next subsection, and continue with more details on the input feature selection in the following subsections. 2.1 Encoding DNNs as MILPs In a fully connected ReLU-based neural network, the l-th layer with input xl and output xl+1 is described as xl+1 = max{0, W lxl + bl}, where W l ∈ Rnl+1×nl is the weight matrix and bl ∈ Rnl+1 is the bias vector. The input-output mapping of the ReLU activation function is given by a piece-wise linear function, and is mixed-integer representable [30]. There are different formulations for encoding the ReLU activation function using MILP, where the big-M formulation [7, 22] was the first presented MILP encoding and remains a common approach. For the i-th ReLU node at a fully connected layer with input xl, the big-M formulation for input-output 3 relation is given by (wl i)(cid:62)xl + bl , (wl i)(cid:62)xl + bl i − (1 − σ)LBl+1 i ≤ xl+1 i i ≥ xl+1 xl+1 i ≤ σU Bl+1 i σ ∈ {0, 1}, xl+1 i ≥ 0, , , i (1) i is the i-th row vector of W l, bl where wl and lower bounds on the pre-activation function over xl+1 U Bl+1 i i is the i-th entry of bl, LBl+1 i i , such that LBl+1 and U Bl+1 i ≤ (wl . i are upper i ≤ i)(cid:62)xl +bl The big-M formulation is elegant in its simplicity, but it is known to have a weak contin- uous relaxation which may require the exploration of a huge number of branch-and-bound nodes in order to solve the problem [1]. Anderson et al. [1] presented a so-called extended convex hull formulation, which gives the strongest valid convex relaxation of each individ- ual node, and a non-extended convex hull formulation. Even though the convex hull is the strongest formulation for each individual node, it does not in general give the convex hull of the full input-output mapping of the DNN. Furthermore, the convex hull formulation results in a large problem formulation that can be computationally difficult to work with. The class of partition-based, or P -split, formulations, was proposed as an alternative for- mulation with a stronger continuous relaxation than big-M and computationally cheaper than the convex hull [16, 29]. Computational results in [17, 29] show that the partition- based formulation often gives significant speed-ups compared to the big-M or convex hull formulations. Here, we do not focus on the computational efficiency of optimizing over ReLU-based DNNs, and, for the sake of clarity, we use the simpler big-M formulation (1). In fact, for the problems considered in this work, the computational time to solve the MILP problems did not represent a limiting factor (big-M tends to actually perform relatively well for simple optimization problems). But, alternative/stronger formulations could directly be used within our framework. 2.2 The optimal sparse input features (OSIF) problem With the MILP encoding of the DNN, we can rigorously analyze the DNN and find extreme points in the input-output mapping. Recently Kronqvist et al. [17] illustrated a similar optimal sparse input features (OSIF) problem. This problem aims to maximize the proba- bility of at most א non-zero input features being classified with a certain label i for a given trained DNN. The problem is formed by encoding the ReLU activation function for each hidden node by MILP. Instead of the softmax function, the objective function is xL i , where xL is the output vector, thus maximizing the classification confidence of label i. 4 Using the big-M formulation, the OSIF problem can be stated as max xL i s.t. W lxl + bl ≤ xl+1, ∀l ∈ [L − 1], W lxl + bl − diag(LBl+1)(1 − σl+1) ≥ xl+1, ∀ l ∈ [L − 1], xl ≤ diag(U Bl)σl, σl ∈ {0, 1}nl, ∀ l ∈ {2, . . . , L}, xL = W L−1xL−1 + bL−1, xL ∈ R10, xl ∈ Rnl y ≥ x1, y ∈ {0, 1}n1, 1(cid:62)y ≤ א0, + , ∀ l ∈ [L − 1], (2a) (2b) (2c) (2d) (2e) (2f) (2g) (2h) where n1 is the size of the input data, xL ∈ R10 is the output, L is the number of layers, LBl and U Bl are the bounds on xl, 1 denotes the all-ones vector, diag(*) denote the matrix with * on the diagonal and 0 on other entries. Eq. (2g) and (2h) describe the cardinality constraint (cid:107)x1(cid:107)0 ≤ א0, which limits the number of selected inputs. Fig 1 shows some example results of solving problem (2) with א ∈ {10, 20} and class i ∈ {0, 1}. Given a larger cardinality number א, the latter is more visually recognizable from the selected pixels. (a) i = 0, א = 10 (b) i = 1, א = 10 (c) i = 0, א = 20 . (d) i = 1, א = 20 Figure 1: The results of OSIF for class 0 and 1 on MNIST (א0 ∈ {10, 20}). Note that the selected pixels are white. 2.3 Input distribution constraints To extract information across the whole input image, we propose to add constraints to force the selected pixels to be distributed evenly across some pre-defined partitioning of the input space. Forcing the selected pixels to be more spread-out may also mitigate the effect of inaccuracy of the DNN used in the OSIF problem, e.g., by preventing a small area to be given overly high priority. There are various ways to partition the input variables. In this 5 paper, we focus on image classification problems with square images as input. Furthermore, we assume that the images are roughly centered. Therefore, we denote each input variable as matrix X ∈ Rn×n and define the partition as k2 submatrices of equal size, i.e., X ij ∈ R n k × n k for i, j ∈ [k]. For instance, given n is even and k = 2, a natural partition of the matrix is X = (cid:18)X 11 X 12 X 21 X 22 (cid:19) . In this way, we denote x1 := vec(X) the input data and n1 := n2 the size of the input data, then Iij is the index set for entries mapped from Xij Iij = {(i1 − 1)n + i2 | i1 ∈ {(i − 1) n k + 1, . . . , i n k − 1}, i2 ∈ {(j − 1) n k + 1, . . . , j n k − 1}}. We denote the collection of index sets for the partition as I := {Ii,j}∀i,j∈[k]. To limit the number of pixels selected from each box for each category we add the following constraints (cid:98) א0 k2 (cid:99) ≤ (cid:88) i∈It yi ≤ (cid:100) א0 k2 (cid:101), ∀It ∈ I, (3) The constraint (3) forces the pixels to spread evenly between all partitions, while allowing some to contain one more selected pixel for each category. To illustrate on the impact on the distribution constraints, Fig. 2 compares the selected pixels for MNIST with k ∈ {1, 2}. Compared to the result without distribution constraints (equivalent to k = 1), pixels selected with k = 2 are more scattered over the whole image and are more likely to identify generalizable distinguishing features of the full input data, assuming the dataset has been pre-processed for unused areas of the images matrices. (a) k = 1 (b) k = 2 Figure 2: Optimal input features for MNIST (א = 50) 2.4 Controlling the number of selected features Repeatedly solving the OSIF problem (2) for each label, i.e., i ∈ {0, . . . , 9}, and taking the union of all selected pixels does not give us full control of the total number of selected pixels. Specifically, some of the pixels can be selected by the OSIF problem for multiple classes, resulting in fewer combined pixels (the union of selected subsets) than an initial target. Therefore, we present an approach to control the number of selected inputs, which we use in the proposed MILP-based feature selection algorithm. The main idea is to allow freedom 6 over features already selected by previous classes in the current OSIF problem and adjust the cardinality constraint (2h) to (cid:88) yi ≤ א0, i∈[n1]\J (4) where J is the index set for input features selected by previous models. Similarly, constraints (3) are adjusted as (cid:98) א0 k2 (cid:99) ≤ (cid:88) i∈It\J yi ≤ (cid:100) א0 k2 (cid:101), ∀It ∈ I. (5) Finally, we formulate the OSIF problem with input distribution and total number control as OSIF (M, i, א0, I, J) = argmax {xL i | (2b)–(2g), (4), (5)}. (6) Based on the described techniques, we introduce the input feature selection algorithm, which is presented as pseudo code in Alg. 1. Algorithm 1: MILP-based feature selection (MILP-based selection) Data: the number of features א, a trained DNN M, a matrix partition set I, class set C; Input: J ← ∅; Output: Index set J; א0 ← א/10; for i ∈ C do x ← OSIF (M, i, א0, I, J) ; J ← J ∪ {s | x1 s = 0, s ∈ [n1]}; end # Eq. (7) 3 Computational results In this paper, we focus on image classification problems for the MNIST [6] and FashionM- NIST [34] datasets. Both datasets consist of a training set of 60,000 examples and a test set of 10,000 examples. Each sample image in both datasets is a 28 × 28 grayscale image associated with labels from 10 classes. MNIST is the dataset of handwritten single digits between 0 and 9. FashionMNIST is a dataset of Zalando's article images with 10 cate- gories of clothing. There is one fundamental difference between the two data sets, besides FashionMNIST being a somewhat more challenging data set for classification. In MNIST there are significantly more pixels that do not change in any of the training images, or only change in a few images, compared to FashionMNIST. The presence of such "dead" pixels is an important consideration for input feature selection. Image preprocessing and training DNNs are implemented in PyTorch [24], and the MILP problems are modeled and solved by Gurobi through the Python API [12]. We trained each DNN with 2 hidden layers of the same size. 7 3.1 Accuracy of DNNs with sparse input features The goal is to illustrate that Alg. 1 can successfully identify low-dimensional salient input features. We chose to focus on small DNNs, as DNN 2 × 20 can already achieve an accuracy of 95.7% (resp. 86.3%) for MNIST (resp. FashionMNIST) and larger DNNs did not give clear improvements for the input selection. For such models, the computational cost of solving the MILPs is low1. Table 1 and Table 2 present the accuracies of DNNs with sparse input features on MNIST and FashionMNIST. It is possible to obtain a much higher accuracy by considering a more moderate input reduction (about 0.5% accuracy drop with 200 –300 inputs), but this defeats the idea of finding low dimensional salient features. For grayscale input image of 28 × 28, we select at most 15% input features and present the results with א ∈ {50, 100}. 3.1.1 MILP-based feature selection Table 1 compares the accuracy of classification models with different architectures, i.e., with 2 × 20 vs. with 2 × 40. We select sparse input features by Alg. 1 with OSIF models 2 × 10 and 2 × 20. Since the distribution constraints are supposed to force at least one pixel selected in each submatrix, we select partition number k ∈ {1, 2} and k ∈ {1, 2, 3} for instances with א = 50 and א = 100 respectively. Table 1: Accuracy of DNNs of different architectures with sparse input features selected by Alg. 1 on MNIST א 50 100 א 50 100 DNNs of 2 × 20 hidden layers OSIF Model 2 × 10 2 × 10 2 × 10 2 × 10 2 × 10 k 1 80.6% 2 85.3% 1 88.8% 2 91.2% 89.3% 3 Acc. OSIF Model 2 × 20 2 × 20 2 × 20 2 × 20 2 × 20 Acc. k 1 80.5% 2 86.6% 1 89.0% 2 90.6% 89.3% 3 DNNs of 2 × 40 hidden layers OSIF Model 2 × 10 2 × 10 2 × 10 2 × 10 2 × 10 k 83.1% 1 2 87.6% 1 91.4% 2 93.4% 92.3% 3 Acc. OSIF Model 2 × 20 2 × 20 2 × 20 2 × 20 2 × 20 Acc. k 82.7% 1 2 89.2% 1 91.4% 2 92.9% 91.8% 3 First, we investigate the effect of the distribution constraints. Table 1 and Table 2 both show that the accuracy increases when adding the distribution constraints (i.e., from k = 1 to k = 2) for א ∈ {50, 100}. However, the distribution constraints become less important as the number of selected features א increases; the best k for MNIST and FashionMNIST varies for א = 100 (noting that the choice of k also affects accuracy less). For MNIST with א = 100, the accuracy of instances drops slightly as the k increases from 2 to 3, while 1On a laptop with a 10-core CPU, Gurobi can solve instances with א = 100 and a DNN of 2 × 20 under 15 seconds. However, previous research [1, 29] has shown that significant speed-ups can be obtained by using a more advanced MILP approach. 8 Table 2: Accuracy of DNNs of different architectures with sparse input features selected by Alg. 1 on FashionMNIST א 50 100 א 50 100 DNNs of 2 × 20 hidden layers OSIF Model 2 × 10 2 × 10 2 × 10 2 × 10 2 × 10 k 1 76.6% 2 77.0% 81.1% 1 2 82.3% 82.2% 3 Acc. OSIF Model 2 × 20 2 × 20 2 × 20 2 × 20 2 × 20 Acc. k 1 77.2% 2 77.9% 81.3% 1 2 81.8% 3 82.1% DNNs of 2 × 40 hidden layers OSIF Model 2 × 10 2 × 10 2 × 10 2 × 10 2 × 10 k 1 78.3% 2 79.4% 82.4% 1 2 83.1% 3 83.7% Acc. OSIF Model 2 × 20 2 × 20 2 × 20 2 × 20 2 × 20 Acc. k 1 78.6% 2 79.6% 82.6% 1 2 83.2% 3 84.0% using input features selected with k = 3 leads to slightly higher accuracy for FashionMNIST with א = 100. One reason behind this difference could be that input pixels of MNIST and FashionMNIST are activated in different patterns. In MNIST, there are more active pixels in the center, and the peripheral pixels stay inactive over the training data. Given the distribution constraints with k = 2 (see Fig. 3b), the selected pixels stay away from the peripheral area. However, when k = 3 (see Fig. 3c), more pixels are forced to be chosen In contrast, the active pixels from the upper right-hand and bottom left-hand corners. are more evenly spread across the full input in FashionMNIST. Hence, as k increases (see Fig. 3e and Fig. 3f), the active pixels remain well-covered by the evenly scattered selected pixels. Next, Table 1 and Table 2 also compare OSIF using different DNN architectures, i.e., 2 × 10 and 2 × 20. The accuracy is 94% (resp. 84%) for the former and 96% (resp. 86%) for the latter for MNIST (resp. FashionMNIST). The results show that even using a simple DNN for feature selection using OSIF can produce feature sets that achieve good accuracy, when appropriately large classification models are trained on the selected features. For MNIST (see Table 1), the former model has accuracy at most 2 points worse than the latter model when א = 50. When א = 100, both models achieve similar levels of performance. As for Fashion, the difference is at most 1 point for א ∈ {50, 100}. Hence, we cannot observe a clear difference between the two OSIF DNN models in terms of feature selection quality. Finally, we would like to make a brief remark on the improvement in accuracy by increas- ing the size of the DNNs for classification, i.e., from 2 × 20 to 2 × 40, for both MNIST and FashionMNIST. Unsurprisingly, using larger DNNs results in overall higher accuracy. More importantly, the performance of the proposed input feature selection seems to be robust toward the final architecture. For both architectures, we observe a similarly slight reduction in classification accuracy related to the reduction in number of input features (pixels). 9 (a) MNIST, k = 1 (b) MNIST, k = 2 (c) MNIST, k = 3 (d) FashionMNIST, k = 1 (e) FashionMNIST, k = 2 (f) FashionMNIST, k = 3 . Figure 3: MNIST and FashionMNIST input features selected by Alg. 1 with א = 100 and k ∈ {1, 2, 3} 3.1.2 Comparisons between feature selection approaches In this section, we compare the performance of the MILP-based features-selection approach (i.e., Alg. 1) to some other simple feature-selection approaches. The other feature selection techniques considered in the comparison are random feature selection, data-based feature selection, and DNN weights-based. In the following paragraphs, we briefly describe the feature selection algorithms that are used as reference points for the comparison. The random feature selection uniformly samples a subset of א input features, and we present the average accuracy with the standard deviation over 5 DNNs trained with input features independently selected by this approach. This approach is included, as it is the simplest approach to down-sample the full input. The data-based feature selection is conducted in the following way: i) we first calculate the mean value of each input feature over the whole train dataset; ii) the features with the largest א mean are selected. The motivation behind this simple heuristic is that it selects the pixels that are most strongly colored over the training data, i.e., the strongest signals. For example, selecting a pixel uncolored in all images of the training data does not make sense as that input does not contain any information for the training data. In the DNN weights-based approach, we use the same DNN models as we use in the MILP-based selection, but the inputs are now selected based on the weights of the inputs. For each input, we sum up the absolute values of all the weights from the input to the nodes in the consecutive layer and select the ones with the largest sum. This can be seen as a form of pruning of inputs, and the motivation is that inputs with small, or almost zero, weights should be less important as these inputs have less impact in the DNN. In Table 3, we compare MILP-based feature selection (i.e., Alg. 1) with random selection, data-based selection, and weights-based selection. The figure for Alg. 1 has the best result from Table 1, where the accuracy of DNNs with sparse input features is only 5 points with א = 100 less than the accuracy with full input features. It can be observed that our method has the best overall performance. For MNIST, the random selection has the worst 10 performance, but the data-based selection and weights-based selection achieve a slightly worse performance than our method. Table 4 compares the performance of features selections on FashionMNIST. The results show a different pattern to MNIST. Our methods still have the best overall performance over different settings by maintaining the accuracy to 84% (resp. 88%) with א = 100 for DNNs 2 × 20 (resp. 2 × 40), while the accuracy of DNNs with full input features are 86% (resp. 88%). While delivering the worst performance on MNIST, random selection has a very close performance to our method on FashionMNIST. The weights-based selection still lies in third overall, while the data-based selection is much worse than the other three methods (e.g., 58% for the DNN 2 × 20 with א = 100 and 62% for the DNN 2 × 40 with א = 100). Table 3: Accuracy of DNNs with sparse input features selected by different methods on MNIST DNN 2 × 20 2 × 40 Feature Selection Approaches א MILP-based 50 100 50 100 86.6% 77.4 ± 2.2% 91.2% 86.0 ± 2.5% 89.2% 76.0 ± 3.9% 93.4% 90.6 ± 1.1% Random Data-based Weights-based 80.7% 81.3% 89.0% 89.2% 83.3% 85.1% 91.2% 92.4% א = 784 95.7% 97.1% Table 4: Accuracy of DNNs with sparse input features selected by different methods on FashionMNIST DNN 2 × 20 2 × 40 Feature Selection Approaches א MILP-based 50 100 50 100 77.9% 77.2 ± 0.8% 82.3% 80.6 ± 1.1% 79.6% 78.8 ± 0.4% 84.0% 82.8 ± 0.4% Random Data-based Weights-based 73.8% 49.6% 80.3% 58.4% 74.6% 51.6% 81.7% 62.3% א = 784 86.3% 87.5% The weights-based selection performs decently on both data sets compared to random and data-based selection. However, based on the results it is clear that MILP-based selection (i.e., Alg. 1) can extract more knowledge from the DNN model regarding the importance of inputs compared to simply analyzing the weights. The overall performance of MILP-based selection is more stable than other feature selection methods on both datasets. 3.2 Robustness to adversarial inputs The robustness of a trained DNN classifier can also be analyzed using MILP, e.g., in veri- fication or finding adversarial input. We use the minimal distorted adversary as a measure of model robustness x under l∞ norm [10]. For a given image ximage, the minimal adversary problem [29] can be formulated as min (cid:15) s.t.(2b)–(2f), xL i ≤ xL j , ||x1 − ximage||∞ ≤ (cid:15), (7) 11 where i is the true label of image ximage and j is an adversarial label. Simply put, problem (7) finds the smallest perturbation, defined by the (cid:96)∞ norm, such that the trained DNN erroneously classifies image ximage as the adversarial label j. We hypothesize that DNNs trained with fewer (well-selected) features are more robust to such attacks, as there are fewer inputs as degrees of freedom. Furthermore, we note that the robustness of smaller DNNs can be analyzed with significantly less computational effort. Table 5: Minimal adversarial distance (cid:15) for trained DNNs. DNN 2 × 20 2 × 40 MNIST א (cid:15) (×10−2) Average ∆ 50 100 784 50 100 784 16.1±7.9 14.0±6.1 10.1±4.7 15.2±7.2 12.4±4.6 10.4±5.1 69.9% 50 33.6% 100 784 - 57.2% 50 42.6% 100 784 - FashionMNIST א (cid:15) (×10−2) Average ∆ 65.4% 44.3% - 89.1% 52.7% - 12.1±7.2 11.7±5.8 8.9±3.7 12.9±7.6 11.5±5.5 8.4±3.4 Table 5 shows the minimal adversarial distance (mean and standard deviation over 100 instances), defined by (7) for DNNs trained on MNIST and FashionMNIST with MILP- based feature selection. The adversaries are generated for the first 100 instances of the respective test datasets, with adversarial labels selected randomly. Furthermore, we report the mean percentage increase, ∆, in minimal adversarial distance over the 100 instances for the reduced input DNNs compared to the full input. In all cases, reducing the the number of inputs א results in a more robust classifier. For the 2 × 40 DNN trained on FashionMNIST, reducing the number of inputs from 784 to 50 increases the mean minimal adversarial distance by almost 90%, with a loss in accuracy of <10%. 4 Conclusion In the paper, we have presented an MILP-based framework using trained DNNs to extract information about salient input features. The proposed algorithm is able to drastically reduce the size of the input by using the input features that are most important for each category according to the DNN, given a regularization on the input size and spread of selected features. The numerical results show that the proposed algorithm is able to effi- ciently select a small set of features for which a good prediction accuracy can be obtained. The results also show that the proposed input feature selection can improve the robustness toward adversarial attacks. References [1] Anderson, R., Huchette, J., Ma, W., Tjandraatmadja, C., Vielma, J.P.: Strong mixed- integer programming formulations for trained neural networks. Math. Program. 183(1), 3–39 (2020) [2] Botoeva, E., Kouvaros, P., Kronqvist, J., Lomuscio, A., Misener, R.: Efficient verifi- cation of relu-based neural networks via dependency analysis. In: Proc. Conf. AAAI Artif. Intel. vol. 34, pp. 3291–3299 (2020) 12 [3] Ceccon, F., Jalving, J., Haddad, J., Thebelt, A., Tsay, C., Laird, C.D., Misener, R.: OMLT: Optimization & Machine Learning Toolkit. J . Mach. Learn. Res. 23(349), 1–8 (2022) [4] Chandrashekar, G., Sahin, F.: A survey on feature selection methods. Comput. Electr. Eng. 40(1), 16–28 (2014) [5] De Palma, A., Behl, H.S., Bunel, R., Torr, P.H., Kumar, M.P.: Scaling the convex barrier with sparse dual algorithms (2021), arXiv preprint [6] Deng, L.: The mnist database of handwritten digit images for machine learning re- search. IEEE Signal Process. Mag. 29(6), 141–142 (2012) [7] Fischetti, M., Jo, J.: Deep neural networks and mixed integer linear optimization. Constraints 23(3), 296–309 (2018) [8] Gal, Y., Ghahramani, Z.: Dropout as a bayesian approximation: Representing model uncertainty in deep learning. In: Proceedings of the 33rd of ICML. pp. 1050–1059. PMLR (2016) [9] Ghojogh, B., Samad, M.N., Mashhadi, S.A., Kapoor, T., Ali, W., Karray, F., Crowley, M.: Feature selection and feature extraction in pattern analysis: A literature review (2019), arXiv preprint [10] Goodfellow, I.J., Shlens, J., Szegedy, C.: Explaining and harnessing adversarial exam- ples (2014), arXiv preprint [11] Grimstad, B., Andersson, H.: Relu networks as surrogate models in mixed-integer linear programs. Comput. Chem. Eng. 131, 106580 (2019) [12] Gurobi Optimization, LLC: Gurobi Optimizer Reference Manual (2022), https:// www.gurobi.com [13] Hassibi, B., Stork, D.: Second order derivatives for network pruning: Optimal brain surgeon. In: Hanson, S., Cowan, J., Giles, C. (eds.) Proceedings of NIPS 1992. vol. 5 (1992) [14] Hinton, G.E., Srivastava, N., Krizhevsky, A., Sutskever, I., Salakhutdinov, R.R.: Im- proving neural networks by preventing co-adaptation of feature detectors (2012), arXiv preprint [15] Kingma, D.P., Salimans, T., Welling, M.: Variational dropout and the local reparam- eterization trick. vol. 28 (2015) [16] Kronqvist, J., Misener, R., Tsay, C.: Between steps: Intermediate relaxations between big-m and convex hull formulations. In: Stuckey, P.J. (ed.) Proceedings of CPAIOR 2021. pp. 299–314. Springer (2021) [17] Kronqvist, J., Misener, R., Tsay, C.: P-split formulations: A class of intermediate formulations between big-M and convex hull for disjunctive constraints (2022), arXiv preprint [18] Labach, A., Salehinejad, H., Valaee, S.: Survey of dropout methods for deep neural networks (2019), arXiv preprint 13 [19] LeCun, Y., Denker, J., Solla, S.: Optimal brain damage. In: Touretzky, D. (ed.) Proceedings of NIPS 1989. vol. 2 (1989) [20] Li, J., Cheng, K., Wang, S., Morstatter, F., Trevino, R.P., Tang, J., Liu, H.: Feature selection: A data perspective. ACM Comput. Surv. 50(6), 1–45 (2017) [21] Liu, B., Wang, M., Foroosh, H., Tappen, M., Pensky, M.: Sparse convolutional neural networks. In: Proc. IEEE Comput. Soc. Conf. Comput. Vis. Pattern Recognit. pp. 806–814 (2015) [22] Lomuscio, A., Maganti, L.: An approach to reachability analysis for feed-forward relu neural networks (2017), arXiv preprint [23] Manng ̊ard, M., Kronqvist, J., B ̈oling, J.M.: Structural learning in artificial neural networks using sparse optimization. Neurocomputing 272, 660–667 (2018) [24] Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., Killeen, T., Lin, Z., Gimelshein, N., Antiga, L., Desmaison, A., Kopf, A., Yang, E., DeVito, Z., Raison, M., Tejani, A., Chilamkurthy, S., Steiner, B., Fang, L., Bai, J., Chintala, S.: Pytorch: An imperative style, high-performance deep learning library. In: Proceedings of NEURIPS 2019, pp. 8024–8035. Curran Associates, Inc. (2019) [25] Perakis, G., Tsiourvas, A.: Optimizing objective functions from trained ReLU neural networks via sampling (2022), arXiv preprint [26] Schwartz, R., Dodge, J., Smith, N.A., Etzioni, O.: Green ai. Communications of the ACM 63(12), 54–63 (2020) [27] Serra, T., Kumar, A., Ramalingam, S.: Lossless compression of deep neural networks. In: Hebrard, E., Musliu, N. (eds.) Proceedings of CPAIOR 2020. pp. 417–430. Springer International Publishing, Cham (2020) [28] Tjeng, V., Xiao, K., Tedrake, R.: Evaluating robustness of neural networks with mixed integer programming (2017), arXiv preprint [29] Tsay, C., Kronqvist, J., Thebelt, A., Misener, R.: Partition-based formulations for mixed-integer optimization of trained ReLU neural networks. In: Ranzato, M., Beygelz- imer, A., Dauphin, Y., Liang, P., Vaughan, J.W. (eds.) Proceedings of NEURIPS 2021. vol. 34, pp. 3068–3080. Curran Associates, Inc. (2021) [30] Vielma, J.P.: Mixed integer linear programming formulation techniques. Siam Review 57(1), 3–57 (2015) [31] Wan, L., Zeiler, M., Zhang, S., Le Cun, Y., Fergus, R.: Regularization of neural networks using DropConnect. In: Proceedings of the 30th ICML. pp. 1058–1066. PMLR (2013) [32] Wang, K., Lozano, L., Cardonha, C., Bergman, D.: Acceleration techniques for opti- mization over trained neural network ensembles (2021), arXiv preprint [33] Wen, W., Wu, C., Wang, Y., Chen, Y., Li, H.: Learning structured sparsity in deep neural networks. In: Lee, D., Sugiyama, M., Luxburg, U., Guyon, I., Garnett, R. (eds.) Proceedings of NEURIPS 2016. vol. 29 (2016) 14 [34] Xiao, H., Rasul, K., Vollgraf, R.: Fashion-mnist: a novel image dataset for benchmark- ing machine learning algorithms (2017), arXiv preprint [35] Yang, D., Balaprakash, P., Leyffer, S.: Modeling design and control problems involving neural network surrogates. Comput. Optim. Appl. pp. 1–42 (2022) [36] Yu, X., Serra, T., Ramalingam, S., Zhe, S.: The combinatorial brain surgeon: Pruning weights that cancel one another in neural networks. In: Chaudhuri, K., Jegelka, S., Song, L., Szepesvari, C., Niu, G., Sabato, S. (eds.) Proceedings of the 39th ICML. vol. 162, pp. 25668–25683. PMLR (2022) [37] Zebari, R., Abdulazeez, A., Zeebaree, D., Zebari, D., Saeed, J.: A comprehensive review of dimensionality reduction techniques for feature selection and feature extraction. J. Appl. Sci. Technol. Trends. 1(2), 56–70 (2020) 15
http://arxiv.org/abs/2302.10341v2
2023-02-24T20:31:06
2023-02-20T22:06:26
Take Me Home: Reversing Distribution Shifts using Reinforcement Learning
Deep neural networks have repeatedly been shown to be non-robust to the uncertainties of the real world. Even subtle adversarial attacks and naturally occurring distribution shifts wreak havoc on systems relying on deep neural networks. In response to this, current state-of-the-art techniques use data-augmentation to enrich the training distribution of the model and consequently improve robustness to natural distribution shifts. We propose an alternative approach that allows the system to recover from distribution shifts online. Specifically, our method applies a sequence of semantic-preserving transformations to bring the shifted data closer in distribution to the training set, as measured by the Wasserstein distance. We formulate the problem of sequence selection as an MDP, which we solve using reinforcement learning. To aid in our estimates of Wasserstein distance, we employ dimensionality reduction through orthonormal projection. We provide both theoretical and empirical evidence that orthonormal projection preserves characteristics of the data at the distributional level. Finally, we apply our distribution shift recovery approach to the ImageNet-C benchmark for distribution shifts, targeting shifts due to additive noise and image histogram modifications. We demonstrate an improvement in average accuracy up to 14.21% across a variety of state-of-the-art ImageNet classifiers.
[ "Vivian Lin", "Kuk Jin Jang", "Souradeep Dutta", "Michele Caprio", "Oleg Sokolsky", "Insup Lee" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10341v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10341v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.CV" ]
Take Me Home: Reversing Distribution Shifts using Reinforcement Learning Vivian Lin Kuk Jin Jang Souradeep Dutta Michele Caprio Oleg Sokolsky Insup Lee PRECISE Center, University of Pennsylvania, Philadelphia, PA 19104, USA 3 2 0 2 b e F 4 2 ] G L . s c [ 2 v 1 4 3 0 1 . 2 0 3 2 : v i X r a Abstract Deep neural networks have repeatedly been shown to be non-robust to the uncertainties of the real world. Even subtle adversarial attacks and naturally occurring distribution shifts wreak havoc on sys- tems relying on deep neural networks. In response to this, current state-of-the-art techniques use data- augmentation to enrich the training distribution of the model and consequently improve robustness to natural distribution shifts. We propose an alter- native approach that allows the system to recover from distribution shifts online. Specifically, our method applies a sequence of semantic-preserving transformations to bring the shifted data closer in distribution to the training set, as measured by the Wasserstein distance. We formulate the problem of sequence selection as an MDP, which we solve us- ing reinforcement learning. To aid in our estimates of Wasserstein distance, we employ dimensionality reduction through orthonormal projection. We pro- vide both theoretical and empirical evidence that orthonormal projection preserves characteristics of the data at the distributional level. Finally, we apply our distribution shift recovery approach to the ImageNet-C benchmark for distribution shifts, targeting shifts due to additive noise and image his- togram modifications. We demonstrate an improve- ment in average accuracy up to 14.21% across a variety of state-of-the-art ImageNet classifiers. 1 INTRODUCTION The brittleness of deep learning models remains a difficult challenge. Even with their successful deployment to many application domains, it has only grown more important to determine and improve the robustness of approaches using deep learning. Some efforts to prevent such failures focus on the adversarial setting for model robustness, studying the worst case accuracy of classifiers. However, these scenarios are unlikely to occur in the real world. A more realistic challenge is when naturally occurring shifts take place. In Hendrycks and Dietterich [2019], a set of commonly occur- ring shifts were proposed as a benchmark dataset. These disturbances are semantic-preserving shifts in the sense that the underlying meaning or label that a model must predict is unchanged, despite the corruption to the input. This paper focuses on robustness to such naturally-occurring shifts. Many state-of-the-art techniques have addressed the is- sue of robustness towards semantic-preserving shifts. The most common approaches use data augmentation tech- niques to generate samples with noise disturbances. AugMix [Hendrycks et al., 2019] applies a set of transformations (e.g., rotation, translation, shear, etc.) to distort the original image. NoisyMix [Erichson et al., 2022] takes this augmen- tation one step further by injecting noises into the augmented examples, expanding the experiences that a model would be exposed to during training. ManifoldMix [Verma et al., 2019] also uses a data augmentation approach, but focuses on generating examples from a lower-dimensional latent manifold. Other notable work in the recent literature in- cludes CutMix [Yun et al., 2019], PuzzleMix [Kim et al., 2020], and DeepAugment [Hendrycks et al., 2020]. In contrast, we propose an online technique that exploits the following observation: when distribution shift arises in the external environment due to natural causes, it persists for a certain duration of time. For instance, when a corruption in image quality occurs due to snow, this corruption does not disappear in the next image frame. This gives the system some time to adapt and recover from this shift by computing some semantic preserving transformations to the data. We propose a technique, Supervisory system for Shift Adaptation and Recovery (SuperStAR), that learns to ap- ply a set of semantic-preserving transforms, correcting the input to align with the original training set of the classifier. This allows the system to recover from distribution shifts online. Moreover, this approach can be used in conjunction with other DNN directed techniques like data-augmentation schemes to improve their performance. belongs to S. This includes transforms like addition of Gaus- sian noise, speckle noise and alike. The error of a classifier C under the distribution D, is defined as Additionally, our approach uses a lower-dimensional approx- imation of the Wasserstein distance to navigate the process of shift correction. As with image classification, models of- ten operate on high-dimensional input spaces. This presents a challenge when employing statistical distance measures, such as the Wasserstein distance, to measure the distance between the training set of images and the set of images a model encounters during deployment. Recently, results by Cai and Lim [2022] have shown a method for measur- ing distances between distributions of different dimension, inspiring our dimensionality reduction approach. We summarize our contributions in order to address the problem of robustness to semantic-preserving shifts: 1. We develop an approach for distribution shift correc- tion using reinforcement learning. 2. We develop a method to efficiently compute the de- gree of distribution shift by projecting to a lower di- mensional space. This uses results from Cai and Lim [2022] in conjunction with the Wasserstein distance. 3. We demonstrate an application to Imagenet-C, target- ing shifts due to additive noise and image histogram modifications. Our empirical results show significant accuracy improvements (up to 14.21% averaged across all shift severity levels) on top of standard training and data-augmentation schemes. 2 PRELIMINARIES We begin by assuming that the images are sampled from a measurable space (X , AX ). X is usually decided by the image format, but it is a countable subset of the Euclidean space Rh×w×3, where h, w denote the height and width of the image, respectively, and the third dimension encodes the color information. Let ∆(X , AX ) denote the set of all probability measures on (X , AX ). We pick a distribution D ∈ ∆(X , AX ) from which the current set of images are sampled. Additionally, let us assume that the labels belong to a measurable space (Y, AY ), and a classifier C is an AX \AY measurable map, C : X → Y. An oracle classi- fier C∗ produces the ground truth labels. Next, we define a semantic preserving transform T. Definition 2.1 (Semantic Preserving Transform). A func- tion T : X → X is semantic preserving iff C∗(x) = C∗(T(x)), for all x ∈ X err(D) := Ex∼D [1(C∗(x) (cid:54)= C(x))] , where 1 is the standard indicator function, which evaluates to 1 iff C∗(x) (cid:54)= C(x).1 For a robust classifier we expect err(D) to be minimal, for different choices of the distri- bution D. For instance in the case of common corruptions introduced in Hendrycks and Dietterich [2019], the goal is to optimize the choice of classifier C such that err(D) is mini- mized. This is typically achieved using data-augmentation schemes such as Augmix, NoisyMix, and DeepAugment. 3 PROBLEM STATEMENT AND APPROACH Note that a semantic preserving transform T is generally not invertible. Consider a random variable xc such that xc = T(z), where z ∼ D. Let us denote the distribution of xc by DT. It is hard to undo the corruption, even with full knowledge of the transform, except in the simplest of cases such as when T is a brightness transform. In practice, it might be possible to choose an element T(cid:48) from the set of semantic preserving transforms S such that it is possible to partially recover the accuracy drop due to T. In fact it might be better to expand from a single inverse transform, to a sequence of transforms from S. That is an ordered set T := {Tk, Tk−1, . . . T1} with k ≥ 1, such that S (cid:51) Ik(x) := Tk ◦ Tk−1 ◦ * * * ◦ T1(x).2 Ideally, we wish to find an algorithm which optimizes the following: I ∗ k = argmin Ik R(Ik), (1) R(Ik) = err(DIk◦T) − err(D), where DIk◦T denotes the distribution of Ik ◦ T(z), z ∼ D. The transform Ik is what effectively reverses an image corruption due to T. Approach. We present an overview of our SuperStAR algorithm here. At a high level its functioning is akin to a su- pervisor for the classifier shown in Figure 1. SuperStAR detects distribution shifts, and computes a recovery strat- egy to be applied before sending an image to a classifier. We make the following assumptions. At training time the algorithm has access to a validation set V = {v1, . . . , vn}, where vi is drawn i.i.d from the training distribution D. At inference time it has access to a corrupted set Vc = i is drawn i.i.d from DTc, Tc ∈ S. {vc Using V and Vc, SuperStAR constructs the transform I ∗ k . We propose a two-fold process to achieve this. n}, where vc 2, . . . , vc 1, vc We denote by S the set of all such semantic preserving transforms. In the standard ERM paradigm, we approximate C∗ with some classifier C. When measuring robustness to common corruptions, typically a corrupting transform Tc 1For notational convenience, we hereafter denote both a ran- dom variable and its realization by a lowercase Latin letter. 2The order ≺T on T is given by Ti ≺T Tj ⇐⇒ i < j, i, j ∈ N. In addition, T0 is assumed to be the identity function. 2 Figure 1: Overview of SuperStAR for distribution shift de- tection and recovery. At deployment, assume that a distribution shift causes a drop in accuracy. This is detected through changes in the Wasserstein distance between the validation set V of im- ages and the corrupted set Vc. SuperStAR computes a compo- sition of transforms Ik to adapt to the shift and recover accuracy. SuperStAR composes with a base classifier to detect and adapt to distribution shifts, increasing the robustness of classification. 4 DETECTION AND CORRECTION Deployment. We refer the reader to Figure 1. At deploy- ment, when the system detects a shift in distribution com- pared to a clean validation set, it proposes a composition of transforms Ik. From the vantage point of classifier C, im- ages transformed using Ik appear to be closer to the home distribution D. The effectiveness of this candidate transform is judged using Wasserstein distance from a validation set. We describe this in detail later in the Section. Design Time. At design time, we train a deep neural net- work policy π such that, given a corrupted set Vc of i.i.d observations from corrupted distribution Dc, the policy gen- erates a finite composition Ik of k < ∞ transforms from S that solves the optimization problem in Equation 1. This is described in detail in Section 5. As mentioned, the SuperStAR algorithm has access to a validation set V drawn i.i.d. from D. In the presence of a shift incurred by T, it samples a corrupted set Vc from DT and selects T := {Tk, Tk−1, . . . T1} using a policy π. We fix a maximum horizon k to keep the algorithm tractable at both learning and deployment. The procedure for select- ing sequence T is presented in Algorithm 1. In Line 1, Algorithm 1 first uses the estimator ̃W to estimate the ini- tial Wasserstein distance. Next, it runs policy π for k steps (Lines 4 − 11), where it iteratively applies the transform picked by the policy to update the corrupted set. The algo- rithm uses a lower dimensional state representation of V for evaluating the policy and for the estimator ̃W (discussed in more detail in Section 5). The algorithm collects this set of transforms in T and returns the sequence. The stopping criterion in Line 8 guards against two phenomena. First, it avoids overly transforming images to a point of diminishing returns. Second, a more practical reason, it hedges against the chance that the distribution shift is not semantic preserv- ing, which is always possible in reality. In the worst case, images from a completely unknown class or faulty hardware Algorithm 1 Transformation Selection Input: Validation set V, corrupted set Vc, policy π, horizon k, thresholds α, β ∈ (0, 1] 1: w0 ← ̃W (V, Vc), V0 ← Vc, T ← { } 2: for i = 1, . . . , k do Ti ← π(Vi−1) 3: Vi ← Ti(Vi−1) 4: wi ← ̃W (V, Vi) 5: if wi ≤ α w0 ∨ wi ≥ β wi−1 then 6: 7: 8: 9: 10: end for 11: Return T end if T ← {Ti} ∪ T Return T could destroy semantics. Hence, we pause the policy when the Wasserstein distance decreases within a threshold. 5 TRAINING RECOVERY POLICY USING REINFORCEMENT LEARNING Our task is to compute a composition of transforms Ik to apply to the set Vc, sampled i.i.d from Dc, to realize the optimization cost outlined in Equation 1. To this end, we note the following theorem. Theorem 5.1. R(Ik) ≤ α*dT V (D, DIk◦T), for some finite α ∈ R and semantic preserving transform Ik. Proof: See Section A of Supplementary Material. Thus, for a transform T (possibly a corruption), it is possi- ble for the classifier to recover performance if the apparent distribution under Ik ◦ T is close enough to the original distribution D. We set up the search of Ik as a reinforce- ment learning problem. The agent attempts to maximize its rewards, measured as the inverse of distance from D. To achieve this it uses actions, which are semantic preserving transforms designed to correct the effects of a corruption. 5.1 MDP FORMULATION Definition 5.2 (MDP). A Markov Decision Process (MDP) is a 6-tuple E = (S, A, P, R, γ, I0), where S ⊆ Rn is the set of states, A ⊆ Rm is the set of actions, P(s(cid:48)|s, a) specifies the probability of transitioning from state s to s(cid:48) on action a, R(s, a) is the reward returned when taking action a from state s, γ ∈ [0, 1) is the discount factor, and I0 is the initial state distribution. In the following, we formulate the task of computing Ik as obtaining a reactive policy for an MDP. We first walk through the realizations of the different components. 3 Figure 2: Example of transformations applied to a corrupted image of constrast shift level 5. CLAHE(x,y) denotes histogram equalization with strength determined by x and y (further description can be found in Section 8). The policy learns to apply a non-trivial composition of transformations that would be difficult to find through manual manipulation. The policy chooses few redundant actions and improves the accuracy of an AugMix-trained ResNet-50 on a random batch of 1000 images. brightness, standard deviation, and entropy of an image x, respectively. Actions. The set of actions A ⊆ S is a set of semantic preserving transforms from which the learner chooses to maximize some reward. Hence, capturing Equation 1 as a reward leads the agent to pick actions that mitigate the current corruption to some extent. Transitions. The idea of transitions in this case is to model the effect of applying a transform from S to a possibly corrupted set Vc. With slight abuse of notation, we use T(V) to denote set {v(cid:48) : v(cid:48) = T(v), v ∈ V}. Computing Reward. As shown in Figure 3, computing the reward for a set of images Vc corresponds to measuring the distance from a clean validation set V. Ideally, the distance between the distributions from which Vc and V are drawn would be measured, but this is difficult without knowledge of the source distributions. Instead, we use an empirical estimate of Wasserstein distance [Bonneel et al., 2011] to compute the distributional distance between sets Vc and V. In practice the policy might not be able to reduce the W e p to a level such that the classifier completely recovers the loss in accuracy. One reason for this is the possible non-existence of the inverse of the corruption transform in S. Another is that, while a transformation may reduce W e p , it may also overly alter the image content such that the classifier performs poorly. Ideally, we can combat against this by ensuring that actions make incremental changes to the image. However, this is hard to control. We therefore add a regularizer to the above Wasserstein distance that penalizes excessive changes to the image. We use a measure of image similarity known as ssim [Wang et al., 2004] which computes the visual similarity between pairs of images. Given λ > 0 and 0 ≤ ω < 1, the reward function is given by R(st, at) = −W e p (V, F−1 R (st)) R (s0), F−1 + λLS(F−1 R (st+1)), (3) where (cid:40) log(1 − ssim(X, Y)), 0 ssim(X, Y) < ω otherwise. (4) Initial State. At test time, the initial state of the MDP is Figure 3: Operation of SuperStAR . Starting from Vc, the algorithm selects a sequence of transforms T which move Vc closer to the original distribution V. During the sequence, the orthonormal projections φ(V) and φ(Vc) are used to compute the Wasserstein distance Wp(φ(Vc), φ(V)). See Sec. 6 for details. State Representation. The environment has access to a set V ⊂ X , which is a set of possibly corrupted images. A state of the MDP is a compressed representation of the above set V encapsulating the type of corruptions subjected to an image. Let us assume that this projection is captured by some function FR : AX → R, where R is the space of representations for a set of images. For a representation r = FR(V), we want it to be rich enough that a policy can decipher the appropriate choice of action in A, but also compact enough that it is possible to learn a policy within a few episodes. Typically, a smaller state space size leads to faster convergence for reinforcement learning algorithms. In this paper, for a set of images V, we select a 3- dimensional state representation that measures the average brightness, standard deviation, and entropy of the images in V. First, we preprocess the images into its grayscale values. Next, for each image we obtain the discrete wavelet trans- form and compute its average brightness, standard deviation and entropy. The state representation is finally an average of all these values across the images, FR(V) = 1 |V| (cid:88) x∈V (cid:2)AvgBrix, StDevx, Entrx (cid:3)(cid:62) , LS(X, Y) = (2) where, AvgBrix, StDevx, Entrx ∈ R are the average 4 produced by a random environment corruption from the set S that the system is subjected to. In reality the designer does not have access to any of these corrupting transforms. Hence, at training time we train a policy network to reverse a set of surrogate corruptions from S, with the hope that some of these transfer at inference time to an unseen set of corruptions. We explain the details of the surrogate cor- ruptions in Section 8. We pick uniformly randomly from a finite set of Sc ⊂ S of these surrogate corruptions to sample the initial state I0. 5.2 LEARNING ALGORITHM A policy π : S → A for the MDP E is a strategy to recover the distribution shift. The value of a state for policy π is the expected return Rπ(s0), starting from state s0, while executing the policy π at every step, at = π(st). The op- timal policy π∗ maximizes the reward starting from the initial state distribution – i.e., π∗ = arg max V I0 (π), where V I0 (π) = Es0∈I0 [Rπ(s0)]. of m × n matrices with orthonormal rows. O(m, n) := {V ∈ Rm×n : V V (cid:62) = Id}. For any V ∈ O(m, n) and b ∈ Rm, let φV,b : Rn → Rm, x (cid:55)→ φV,b(x) := V x + b, and for any μ ∈ M (Rn), let φV,b(μ) := μ ◦ φ−1 V,b be the pushforward measure. This can be seen as a projection of μ onto the smaller dimensional space Rm, and we call it a Cai-Lim projection; it is not unique: it depends on the choice of V and b. Recall then the definition of the p-Wasserstein distance between μ, ν ∈ M p(Rn): (cid:20) Wp(μ, ν) := inf γ∈Γ(μ,ν) (cid:90) R2n (cid:107)x − y(cid:107)p 2 dγ(x, y) (cid:21) 1 p , where (cid:107) * (cid:107)2 denotes the Euclidean norm and Γ(μ, ν) := {γ ∈ M (R2n) : πn 1 (γ) = ν, πn 2 (γ) = μ} is the set of couplings between μ and ν, where πn jection onto the first n coordinates and πn onto the last n coordinates. 1 is the pro- 2 is the projection 6 ORTHONORMAL PROJECTIONS FOR Denote by DIMENSIONALITY REDUCTION In this section, we discuss the practical constraints of esti- mating the Wasserstein distance in high dimensions. Fur- ther, to mitigate these concerns, we examine dimensionality reduction through orthonormal projection as a means of improving the sample efficiency of this estimate. The empirical estimate of the Wasserstein distance con- verges in sample size to the true Wasserstein distance slowly in large dimensions [Ramdas et al., 2017]. This suggests that, ideally, by reducing the dimensionality of the sample data, fewer samples are needed to achieve an accurate esti- mate of the Wasserstein distance. Naturally, the efficacy of such a technique is contingent on minimal loss of informa- tion incurred by the dimensionality reduction. We posit that orthonormal projection is a reduction technique that pre- serves characteristics of the sample data at a distributional level. An intuitive motivation for this arises from a metric we refer to as the Cai-Lim distance [Cai and Lim, 2022]. Let m, n ∈ N and p ∈ [1, ∞]. Call M (Rn) and M (Rm) the spaces of probability measures on Rn and Rm, respectively. Denote then by M p(Rn) and M p(Rm) the spaces of proba- bility measures having finite p-th moment on Rn and Rm, respectively (here p = ∞ is interpreted in the limiting sense of essential supremum). For convenience, we consider only probability measures with densities, so that we do not have to keep track of which measure is absolutely continuous to which other measure [Cai and Lim, 2022, Section III]. Φ−(μ, d) := {β ∈ M (Rm) : φV,b(μ) = β, for some V ∈ O(d, n), b ∈ Rm}. the set of Cai-Lim projections of μ onto Rm. We call Cai- Lim distance between μ ∈ M p(Rn) and ν ∈ M p(Rm), m ≤ n, the smallest p-Wasserstein distance between ν and a Cai-Lim projection of μ onto Rm, for some p ∈ [1, ∞]. That is, W CL p (μ, ν) := inf β∈Φ−(μ,d) Wp (β, ν) . (5) We note that Cai-Lim distance is closely related to Monge and Kantorovich's formulations of the optimal transport problem (see Section B of Supplementary Material). A gen- eralization of the Wasserstein distance, the Cai-Lim distance allows for measurements of distance between distributions of different dimensions. It follows directly from (5) that when an orthonormal projection is applied, ν = φV,0(μ), the Cai-Lim distance is trivially zero, W CL (μ, ν) = 0. This suggests that the orthonormal projection preserves informa- tion about the distance between two distributions. p We now present more rigorous theoretical justification of this claim. The following is an important result. ([Cai and Lim, 2022, Lemma II.1]) Let Lemma 6.1. m, n ∈ N and p ∈ [1, ∞], and assume m ≤ n. For any μ, ν ∈ M p(Rn), any V ∈ O(m, n), and any b ∈ Rm, we have that Suppose now m ≤ n and consider the Stiefel manifold on Wp (φV,b(μ), φV,b(ν)) ≤ Wp (μ, ν) . 5 7 RELATED WORK SuperStAR combines various techniques across different fields and integrates them into a unique process for increas- ing the robustness to semantic-preserving transforms. Data augmentation for classification robustness. A com- mon technique for increasing the robustnesss of classifiers is data augmentation through the generation of corrupted examples with semantic-preserving shifts [Hendrycks et al., 2019, Erichson et al., 2022, Verma et al., 2019, Yun et al., 2019, Kim et al., 2020, Hendrycks et al., 2020]. Our ap- proach complements such approaches and improves robust- ness through transformation of corrupted samples to the original data distribution. Distribution shift detection. Out-of-distribution shift de- tection has gained significant interest as more machine learn- ing models are deployed into safety critical systems [Kaur et al., 2022, Hendrycks and Gimpel, 2018, Lee et al., 2018]. In [Rabanser et al., 2019], various approaches to dimension- ality reduction are explored and empirical results demon- strating the benefit to distribution shift detection are pre- sented. Our work expands on these observations and utilizes a theoretically sound approach of using orthogonal projec- tions for dimensionality reduction. Deep learning for image restoration. Deep learning ap- proaches for image restoration and recovery from corrup- tion is well studied in the literature and exhaustive review is beyond the scope of this paper. Most of these approaches fo- cus on a specific corruption type or a set of corruptions. For example, Zhang et al. [2017] approaches Gaussian denois- ing by constructing denoising convolutional feed-forward networks. For a recent survey of deep blurring approaches and comprehensive approaches targeting multiple sets of noises we refer to Zhang et al. [2022], Ledig et al. [2017], Zamir et al. [2021, 2020, 2022]. Such approaches utilize a generative model to restore information lost due to a low resolution. These methods are limited in recovery and can result in image artifacts which degrade classification per- formance. Here, we attempt to alleviate such limitations by utilizing a composition of transformations which are se- lected automatically depending on the context. Additionally, the performance can be enhanced with additional image transformations in the action library (see Sec. 8.1). 8 APPLICATION: IMAGENET-C Figure 4: Empirical Wasserstein distance between MNIST and MNIST with varied levels of additive Gaussian noise, over a range of sample sizes. Curves are over 5 trials. MNIST samples are downsampled to 24×24, flattened, and projected to 50 dimensions. This can be interpreted as "losing some information" when performing a Cai-Lim projection: in smaller dimensional spaces, distributions μ and ν seem to be closer than they ac- tually are. This is an inevitable byproduct of any projection operation. Lemma 6.1 implies the following corollary. Corollary 6.2. Let m, n ∈ N and p ∈ [1, ∞], and assume m ≤ n. Consider μ, ν, ρ, ζ ∈ M p(Rn), and pick any V ∈ O(m, n) and any b ∈ Rm. Suppose Wp(μ, ν) ≥ Wp(ρ, ζ). Then, there exists ε > 0 such that if Wp (μ, ν) − Wp (φV,b(μ), φV,b(ν)) ≤ ε, then Wp (φV,b(μ), φV,b(ν)) ≥ Wp (φV,b(ρ), φV,b(ζ)) . Proof. Set ε = Wp (ρ, ζ) − Wp (φV,b(ρ), φV,b(ζ)). The result then follows immediately by Lemma 6.1. Corollary 6.2 states the following. If we "do not lose too much information" when performing a Cai-Lim projection of the two farthest apart distributions (captured by the as- sumption that Wp (μ, ν) − Wp (φV,b(μ), φV,b(ν)) ≤ ε), then the inequality Wp(μ, ν) ≥ Wp(ρ, ζ) between the orig- inal distribution is preserved between their projections. Figure 4 compares the empirical Wasserstein distance us- ing orthonomal projection compared to Gaussian random projection and sparse random projection when MNIST is perturbed with additive Gaussian noise. Further results can be found in Section C of Supplementary Material. We find that orthonormal projection better preserves distributional information than Gaussian and sparse random projections. We now describe the application of our SuperStAR al- gorithm to the ImageNet-C benchmark for distribution shifts [Hendrycks and Dietterich, 2019]. The ImageNet- C dataset is constructed from ImageNet samples corrupted by 19 semantic-preserving transformations. Of these, we target the subset of shifts for which there exists strong prior literature on manual correction. This allows us to construct 6 an action library with effective individual corrective trans- formations, a foundation on which we implement our tool for automated online correction. Namely, we target distribu- tion shifts arising due to additive noise (i.e., gaussian, shot, impulse, and speckle noise shift) and modifications to the im- age histogram (i.e., brightness, contrast, and saturate shift), which we refer to as noise-type and histogram-type shifts, respectively. We evaluate our algorithm on ImageNet classi- fiers trained with and without various state-of-the-art data augmentation techniques, and we report each classifier's accuracy on ImageNet-C data with and without correction by SuperStAR . 8.1 SURROGATE CORRUPTIONS AND ACTIONS As discussed in Section 5, in practice the corrupting trans- formations present at test time are unknown to the designer. Hence, surrogate corruptions are necessary at training time. To maximize generalization, we therefore select two surro- gate corruptions which subject the images to a broad set of transformations. Below, we describe in greater detail the selection criterion for each class of shift we target. Additive Noise. We use additive uniform noise, U nif orm(−c, c), as a representative of noise-type shifts. We select the severity of this corruption based on the average entropy of the corrupted and uncorrupted data measured by FR. Modifications to Image Histogram. We adjust the γ value of the images to create a representative of histogram-type shifts. For this surrogate corruption, we select the sever- ity based on the average brightness of the corrupted and uncorrupted data measured by FR. Formally, given a random sample Vc of the surrogate cor- rupted data and a random sample V of ImageNet data, for both surrogates we select the parameter c such that trast Limited Adaptive Histogram Equalization (CLAHE) to correct for histogram modifications. (window size, contrast change limit) of (2,1), (2,2), and (6,1). For each transformations, we select weak parameters to guard against single actions with irreversibly destructive effect. Simultaneously, this allows SuperStAR to adapt accordingly to the noise severity. Finally, we include in A an action that does not enact any transformation, allowing for inaction in the presence of benign corruptions. 8.2 EXPERIMENTAL SETUP We train a deep neural network policy π with actions A and surrogate corruptions defined above. Sequences are limited to five actions, but a shorter sequence may occur based on the stopping criteria in Algorithm 1. We choose our stopping condition threshold to be α = 0.9 and β = 0.995. In constructing our training set of surrogate corruptions, we choose c = 0.9 and γ = 3.0. The neural network policy π is trained using the advantage actor critic algorithm. The details of the network architecture and hyperparameters can be found in Section E of Supplementary Material. Addition- ally, the reinforcement learning training curves can be found in Section F of Supplementary Material. For the estimation of Wasserstein distances, we convert images to grayscale and project them to 5000 dimensions using a randomly gen- erated orthonormal matrix. Finally, we select the reward hyperparameters λ = 20 and ω = 0.994. We deploy the learned policy π in SuperStAR to correct noise-type and histogram-type ImageNet-C corruptions, and we evaluate the accuracies of Resnet-50 classifiers with and without correction. We evaluate a baseline classifier trained without data augmentation, as well as classifiers trained with data augmentation through AugMix, NoisyMix, DeepAug- ment, DeepAugment with Augmix, and Puzzlemix.3 FR(Vc)i − FR(V)i FR(V)i ≈ 0.60, (6) 8.3 RESULTS AND DISCUSSION where FR(X)i denotes the ith index of FR(X). For our noise-type and histogram-type shift surrogates, we use i = 2 and i = 0, respectively. Section D of Supplementary Material shows a sample image subjected to these surrogate corruptions. We manually select an action library A of eight correcting transformations. We describe the actions by category below. Smoothing Transformations. We include a denoising con- volutional neural network from the MATLAB Deep Learn- ing Toolbox, a bilateral filter with filter size 2, wavelet denoising with BayesShrink thesholding [Chang et al., 2000], and wavelet denoising with VisuShrink threshold- ing [Donoho and Johnstone, 1994]. Histogram Equalization Transformations. We use Con- 7 Table 1 summarizes the classifier accuracy improvements from applying SuperStAR to noise- and histogram-type shifts from ImageNet-C. Corrections via our SuperStAR algorithm leads to accuracy improvements in nearly all cases of shift, with maximum improvement of 14.21% (averaged across all five severity levels) for the baseline classifier evaluated on shot noise data. Further, when combined with data augmentation, SuperStAR leads to higher accuracies than SuperStAR or data augmentation alone. Additionally note that when no distribution shift is present, SuperStAR refrains from taking any action and does not harm performance. Similarly, on the classes of ImageNet- 3Our code https://github.com/vwlin/SuperStAR. can be found at Table 1: Average accuracies (%) on noise- and histogram-type ImageNet-C shifts with and without SuperStAR for ResNet-50 classifiers. Accuracy improvement is denoted by ∆ = recovered − shifted. Values are taken over 5 severity levels with 3 trials each. SuperStAR improves accuracy in almost all cases, with a maximum increase of 14.21% . Baseline (No Data Aug.) shifted recovered ∆ shift 74.52 74.52 none 31.11 43.44 gauss. noise shot noise 28.61 42.81 impulse noise 26.57 39.36 speckle noise 36.09 49.26 65.17 65.72 brightness 35.56 37.70 contrast 59.00 59.17 saturate 0.00 12.33 14.21 12.79 13.18 0.55 2.14 0.17 AugMix NoisyMix DeepAugment DeepAug+AugMix PuzzleMix shifted recovered ∆ shifted recovered ∆ shifted recovered ∆ shifted recovered ∆ shifted recovered ∆ 75.94 75.94 41.90 50.87 41.78 50.93 38.78 47.49 50.61 56.94 67.35 68.46 48.96 49.85 61.42 61.89 0.00 75.63 75.63 6.05 41.48 46.94 6.61 37.39 45.56 5.50 35.28 42.82 4.74 42.24 51.92 0.76 69.59 69.67 1.39 50.56 52.87 0.33 65.96 65.60 0.00 76.22 76.22 8.98 52.71 55.51 9.15 51.81 55.38 8.71 50.73 53.37 6.33 57.67 60.88 1.11 68.82 69.87 0.89 50.37 52.74 0.47 63.48 64.00 0.00 75.86 75.86 2.80 59.07 59.48 3.57 58.21 58.46 2.64 58.61 58.38 3.22 62.21 63.81 1.05 69.04 69.73 2.37 44.89 48.23 0.52 64.59 64.81 0.00 75.26 75.26 0.41 55.39 61.43 1.24 55.76 62.37 -0.23 55.16 60.67 1.59 60.93 65.66 0.69 69.42 70.18 3.33 56.01 57.40 0.22 65.79 66.12 0.00 5.46 7.77 7.54 9.68 0.08 2.30 -0.37 Figure 5: Accuracy improvements for increasing severity eval- uated on classifiers trained with (left) no data augmentation and (right) AugMix. In general, performance improvements are more pronounced for greater severities of corruption. C shifts that we do not target (e.g., blur, weather, etc.), SuperStAR primarily avoids taking action, at worst incur- ring a 1.80% drop in average accuracy (see Section G of Supplementary Material). For most of these shifts, inaction occurs because there is nothing in the action library that miti- gates the shift's effects (in future iterations of SuperStAR, additional actions, such as a superresolution network, can easily be added to the library to handle other classes of shift). However, fog shift is an interesting case where an appropriate action exists (e.g., CLAHE), but it is not taken because our stopping conditions in Algorithm 1 prematurely terminate SuperStAR's procedure. Further discussion can be found in Section H of Supplementary Material. In Figure 5, we show the accuracy improvements for the baseline and AugMix classifiers at each severity level. In general, accuracy improvements are greater for higher sever- ities, with a maximum improvement of over 20% on shot noise severity level 3 for the baseline classifier. The re- maining classifiers exhibit similar trends, as can be seen in Section I of Supplementary Material. Interestingly, for the hyperparameter selection β = 1.10 (i.e., allow some increase in Wasserstein distance at each step), we find that SuperStAR selects a non-trivial 5- action sequence of transformations for contrast shift severity level 5, which incrementally increases the accuracy of the AugMix classifier. Figure 2 shows a sample image with the applied transformations and resulting accuracies. The transformations incur a noticeable change in the image. Overall, our SuperStAR algorithm shows significant im- provement in classification accuracy on ImageNet-C for a Figure 6: K-means clustering of sampled state representations for noise- and histogram-type shifts from ImageNet-C and our surrogates (projected onto two dimensions). The surrogate shifts are clustered with the appropriate ImageNet-C shifts. variety of corruptions. In some cases, SuperStAR identi- fies complex sequences of corrective transformations. We attribute this strong performance largely to our selection of surrogate shifts. Figure 6 shows the projected state repre- sentations for 100 samples of each noise- and histogram- type ImageNet-C shift and each surrogate shift, sorted into K = 2 clusters by K-means clustering. The value of K was selected from the range [1, 9] via the elbow method. We see that samples from ImageNet-C noise-type shifts are in the same cluster as those from our uniform noise shift. Likewise, histogram-type shifted samples are clustered with our γ adjustment shift. Thus, SuperStAR generalizes well from the surrogates to these ImageNet-C shifts. 9 CONCLUSION In this work we presented SuperStAR , an algorithm for distribution shift detection and recovery. The algorithm uses the Wasserstein distance (with a theoretically-sound approach for dimensionality reduction using orthonormal projections) to detect distribution shifts and select recovery actions from a library of image correction techniques. The policy for computing actions is trained using reinforcement learning. We applied our approach to various classifiers on noise- and histogram-type shifts from the ImageNet-C dataset, and we obtained significant accuracy improvements (up to an average 14.21% across all shift severities) when compared the classifiers alone. Expansion of the action li- brary and additional tuning can lead to further improvements on the benchmark. 8 References Nicolas Bonneel, Michiel Van De Panne, Sylvain Paris, and Wolfgang Heidrich. Displacement interpolation using lagrangian mass transport. In Proceedings of the 2011 SIGGRAPH Asia conference, pages 1–12, 2011. Yuhang Cai and Lek-Heng Lim. Distances between proba- bility distributions of different dimensions. IEEE Trans- actions on Information Theory, 68(6):4020–4031, 2022. S Grace Chang, Bin Yu, and Martin Vetterli. Adaptive wavelet thresholding for image denoising and compres- sion. IEEE transactions on image processing, 9(9):1532– 1546, 2000. David L Donoho and Jain M Johnstone. Ideal spatial adap- tation by wavelet shrinkage. biometrika, 81(3):425–455, 1994. N. Benjamin Erichson, Soon Hoe Lim, Francisco Utr- era, Winnie Xu, Ziang Cao, and Michael W. Mahoney. Noisymix: Boosting robustness by combining data aug- mentations, stability training, and noise injections. CoRR, abs/2202.01263, 2022. URL https://arxiv.org/ abs/2202.01263. Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. arXiv preprint arXiv:1903.12261, 2019. Dan Hendrycks and Kevin Gimpel. A Baseline for Detect- ing Misclassified and Out-of-Distribution Examples in Neural Networks, October 2018. URL http://arxiv. org/abs/1610.02136. arXiv:1610.02136 [cs]. Dan Hendrycks, Norman Mu, Ekin D Cubuk, Barret Zoph, Justin Gilmer, and Balaji Lakshminarayanan. Augmix: A simple data processing method to improve robustness and uncertainty. arXiv preprint arXiv:1912.02781, 2019. Dan Hendrycks, Steven Basart, Norman Mu, Saurav Ka- davath, Frank Wang, Evan Dorundo, Rahul Desai, Tyler Zhu, Samyak Parajuli, Mike Guo, Dawn Song, Jacob Steinhardt, and Justin Gilmer. The many faces of robust- ness: A critical analysis of out-of-distribution general- ization. CoRR, abs/2006.16241, 2020. URL https: //arxiv.org/abs/2006.16241. Leonid Vital'eviˇc Kantoroviˇc. On a problem of Monge. Zap. Nauchn. Sem. S.-Peterburg. Otdel. Mat. Inst. Steklov. (POMI), 312(11):15–16, 2004. Ramneet Kaur, Kaustubh Sridhar, Sangdon Park, Susmit Jha, Anirban Roy, Oleg Sokolsky, and Insup Lee. CODiT: Conformal Out-of-Distribution Detection in Time-Series Data, July 2022. URL http://arxiv.org/abs/ 2207.11769. arXiv:2207.11769 [cs]. Jang-Hyun Kim, Wonho Choo, and Hyun Oh Song. Puzzle mix: Exploiting saliency and local statistics for optimal mixup. CoRR, abs/2009.06962, 2020. URL https: //arxiv.org/abs/2009.06962. Christian Ledig, Lucas Theis, Ferenc Huszar, Jose Ca- ballero, Andrew Cunningham, Alejandro Acosta, Andrew Aitken, Alykhan Tejani, Johannes Totz, Zehan Wang, and Wenzhe Shi. Photo-Realistic Single Image Super- Resolution Using a Generative Adversarial Network, May 2017. URL http://arxiv.org/abs/1609. 04802. arXiv:1609.04802 [cs, stat] version: 5. Kimin Lee, Honglak Lee, Kibok Lee, and Jinwoo Training Confidence-calibrated Classifiers Shin. for Detecting Out-of-Distribution Samples, Febru- ary 2018. URL http://arxiv.org/abs/1711. 09325. arXiv:1711.09325 [cs, stat]. Stephan Rabanser, Stephan Günnemann, and Zachary C. Lipton. Failing Loudly: An Empirical Study of Methods for Detecting Dataset Shift, October URL http://arxiv.org/abs/1810. 2019. 11953. arXiv:1810.11953 [cs, stat]. Aaditya Ramdas, Nicolás García Trillos, and Marco Cuturi. On wasserstein two-sample testing and related families of nonparametric tests. Entropy, 19(2):47, 2017. Vikas Verma, Alex Lamb, Christopher Beckham, Amir Na- jafi, Ioannis Mitliagkas, David Lopez-Paz, and Yoshua Bengio. Manifold mixup: Better representations by inter- polating hidden states. In ICML, 2019. Cedric Villani. Optimal Transport: Old and New. Springer Berlin, Heidelberg, 2009. Z. Wang, A. C. Bovik, H. R. Sheikh, and E. P. Simon- Image Quality Assessment: From Error Visi- IEEE Transactions on doi: celli. bility to Structural Similarity. Image Processing, 13(4):600–612, April 2004. 10.1109/TIP.2003.819861. Sangdoo Yun, Dongyoon Han, Seong Joon Oh, Sanghyuk Chun, Junsuk Choe, and Youngjoon Yoo. Cutmix: Reg- ularization strategy to train strong classifiers with local- izable features. CoRR, abs/1905.04899, 2019. URL http://arxiv.org/abs/1905.04899. Syed Waqas Zamir, Aditya Arora, Salman Khan, Mu- nawar Hayat, Fahad Shahbaz Khan, Ming-Hsuan Yang, and Ling Shao. Learning Enriched Features for Real Image Restoration and Enhancement. In Andrea Vedaldi, Horst Bischof, Thomas Brox, and Jan-Michael Frahm, editors, Computer Vision – ECCV 2020, vol- ume 12370, pages 492–511. Springer International Pub- lishing, Cham, 2020. ISBN 978-3-030-58594-5 978- 3-030-58595-2. doi: 10.1007/978-3-030-58595-2_30. URL https://link.springer.com/10.1007/ 9 978-3-030-58595-2_30. Notes in Computer Science. Series Title: Lecture Syed Waqas Zamir, Aditya Arora, Salman Khan, Munawar Hayat, Fahad Shahbaz Khan, Ming-Hsuan Yang, and Ling Shao. Multi-Stage Progressive Image Restora- tion, March 2021. URL http://arxiv.org/abs/ 2102.02808. arXiv:2102.02808 [cs]. Syed Waqas Zamir, Aditya Arora, Salman Khan, Munawar Hayat, Fahad Shahbaz Khan, Ming-Hsuan Yang, and Ling Shao. Learning Enriched Features for Fast Image Restora- tion and Enhancement, April 2022. URL http:// arxiv.org/abs/2205.01649. arXiv:2205.01649 [cs, eess]. Kai Zhang, Wangmeng Zuo, Yunjin Chen, Deyu Meng, and Lei Zhang. Beyond a Gaussian Denoiser: Residual Learn- ing of Deep CNN for Image Denoising. IEEE Transac- tions on Image Processing, 26(7):3142–3155, July 2017. ISSN 1941-0042. doi: 10.1109/TIP.2017.2662206. Con- ference Name: IEEE Transactions on Image Processing. Kaihao Zhang, Wenqi Ren, Wenhan Luo, Wei-Sheng Lai, Bjorn Stenger, Ming-Hsuan Yang, and Hong- dong Li. Deep Image Deblurring: A Survey, May 2022. URL http://arxiv.org/abs/2201. 10700. arXiv:2201.10700 [cs]. 10 A PROOF OF THEOREM 5.1 Let us denote by d the pdf of DIk◦T and by d(cid:48) the pdf of D . We begin by expanding the definition of R(Ik). R(Ik) = err(DIk◦T) − err(D) = Ex1∼DIk ◦T,x2∼D [1(C∗(x1) (cid:54)= C(x1)) − 1(C∗(x2) (cid:54)= C(x2))] X (cid:90) (cid:18) X (cid:18) sup x∈X = ≤ ≤ = ≤ ≤ (cid:90) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) 1(C∗(x) (cid:54)= C(x))[d(x) − d(cid:48)(x)]dx X (cid:90) 1(C∗(x) (cid:54)= C(x))[d(x) − d(cid:48)(x)]dx (cid:12) (cid:12) (cid:12) (cid:12) 1(C∗(x) (cid:54)= C(x)) sup x∈X (cid:19) 1(C∗(x) (cid:54)= C(x)) (cid:19) (cid:90) [d(x) − d(cid:48)(x)]dx [d(x) − d(cid:48)(x)]dx X (cid:12) (cid:12) (cid:12) (cid:12) * (cid:90) X 1(C∗(x) (cid:54)= C(x)) 1(C∗(x) (cid:54)= C(x)) sup x∈X sup x∈X (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) [d(x) − d(cid:48)(x)]dx (cid:12) (cid:12) (cid:12) (cid:12) (cid:90) A [d(x) − d(cid:48)(x)]dx (cid:12) (cid:12) (cid:12) (cid:12) * sup A∈AX (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) = α * dT V (D, DIk◦T), where α = |supx∈X the definition of computing expectation in terms of the classifier error. 1(C∗(x) (cid:54)= C(x))|. The first step assumes that X is a continuous space. The rest follows from expressing 11 B CAI-LIM DISTANCE AND OPTIMAL TRANSPORT Monge's formulation of the optimal transport problem can be formulated as follows. Let X , Y be two separable metric Radon spaces. Let c : X × Y → [0, ∞] be a Borel-measurable function. Given probability measures μ on X and ν on Y, Monge's formulation of the optimal transportation problem is to find a transport map T : X → Y that realizes the infimum inf T(cid:63)(μ)=ν (cid:90) X c(x, T (x)) dμ(x), (7) where T(cid:63)(μ) ≡ μ ◦ T −1 is the pushforward of μ by T . Monge's formulation of the optimal transportation problem can be ill-posed, because sometimes there is no T satisfying T(cid:63)(μ) = ν. Equation (7) can be improved by adopting Kantorovich's formulation of the optimal transportation problem, which is to find a probability measure γ ∈ Γ(μ, ν) that attains the infimum inf γ∈Γ(μ,ν) (cid:90) X ×Y c(x, y) dγ(x, y), (8) where Γ(μ, ν) is the set of joint probability measures on X × Y whose marginals are μ on X and ν on Y. A minimizer for this problem always exists when the cost function c is lower semi-continuous and Γ(μ, ν) is a tight collection of measures. Our Cai-Lim distance formulation – equation (5) in the main portion of the paper – can be written as (cid:34)(cid:18) inf β∈Φ−(μ,d) inf γ∈Γ(β,ν) (cid:90) R2d (cid:107)x − y(cid:107)p 2 dγ(x, y) (cid:19)1/p(cid:35) . (9) Therefore, (9) is a combination of (7) and (8). To see this, notice that X = Y = Rd, and (x, y) (cid:55)→ c(x, y) = (cid:107)x − y(cid:107)p 2, for some p ∈ [1, ∞]. Hence, the inner part of (9) corresponds to Kantorovich's formulation of the optimal transportation problem. The outer inf, instead, has a Mongenian flavor to it. With this, we mean that the probability measure β must be the one minimizing the p-Wasserstein distance between ν and all the elements in the set Φ−(μ, d) of Cai-Lim projections of μ onto Rd, d ≤ n. Because Φ−(μ, d) := {β ∈ M (Rm) : φV,b(μ) = β, for some V ∈ O(d, n), b ∈ Rm}, and φV,b(μ) ≡ φ−1 V,b(cid:63) The fact that (9) has a solution is guaranteed by Cai and Lim [2022, Section II]. V,b is the pushforward of μ by φ−1 (μ) := μ ◦ φ−1 V,b, this reminds us (heuristically) of Monge's formulation. Some further references can be found at Kantoroviˇc [2004], Villani [2009]. 12 C EMPIRICAL EVALUATION OF ORTHONORMAL PROJECTION Figure 7: Empirical Wasserstein distance between MNIST and MNIST with varied levels of additive impulse noise, measured over a range of sample sizes. Curves are taken over 5 trials. MNIST samples are downsampled to 24×24, flattened, and projected to 50 dimensions. Orthonormal projection better preserves distributional information than Gaussian random projection and sparse random projection. 13 Figure 8: Empirical Wasserstein distance between MNIST and MNIST with varied levels of Gaussian blur, measured over a range of sample sizes. Curves are taken over 5 trials. MNIST samples are downsampled to 24×24, flattened, and projected to 50 dimensions. Orthonormal projection better preserves distributional information than Gaussian random projection and sparse random projection. D EXAMPLES OF SURROGATE TRANSFORMATIONS Figure 9: Sample images from ImageNet, ImageNet-C, and clean images subjected to surrogate corruptions. 14 E REINFORCEMENT LEARNING DETAILS AND HYPERPARAMETERS For both the actor and critic network, we employ a linear ReLU network with two hidden layers of 128 and 256 units. We train the actor and critic networks until convergence (about 1600 episodes) with learning rate 10−4, learning frequency 1, discount factor 0.9, and exploration rate decaying exponentially from 0.9 to 0.1 according the rule 0.90.07∗(episode+1). F TRAINING CURVES FOR REINFORCEMENT LEARNING Figure 10: Reinforcement learning training curves, averaged with a moving window of 200 episodes. Values shown are the reward at episode termination. G SUPERSTAR PERFORMANCE ON ALL IMAGENET-C SHIFTS Table 2: Average accuracies (%) on each ImageNet-C shift with and without SuperStAR for ResNet-50 classifiers. Accuracy improvement is denoted by ∆ = recovered − shifted. Values are taken over 5 severity levels with 3 trials each. On the classes of ImageNet-C shifts that we do not target, SuperStAR primarily avoids taking action. Baseline (No Data Aug.) shifted recovered ∆ shift 74.52 74.52 none 31.11 43.44 gauss. noise shot noise 28.61 42.81 impulse noise 26.57 39.36 35.21 35.21 defocus blur 25.56 25.56 glass blur 36.25 36.25 motion blur 36.27 36.27 zoom blur 30.51 29.28 snow 35.16 35.07 frost 42.79 42.79 fog 65.17 65.72 brightness 35.56 37.70 contrast 43.24 43.24 elastic 45.51 45.51 pixelate jpeg 52.47 52.47 speckle noise 36.09 49.26 38.08 38.08 gauss. blur 46.65 46.45 spatter 59.00 59.17 saturate 0.00 12.33 14.21 12.79 0.00 0.00 0.00 0.00 -1.13 -0.09 0.00 0.55 2.14 0.00 0.00 0.00 13.18 0.00 -0.19 0.17 AugMix NoisyMix DeepAugment DeepAug+AugMix PuzzleMix shifted recovered ∆ shifted recovered ∆ shifted recovered ∆ shifted recovered ∆ shifted recovered ∆ 75.94 75.94 41.90 50.87 41.78 50.93 38.78 47.49 44.48 44.48 32.97 32.97 49.63 49.63 47.45 47.45 37.89 36.85 41.39 41.24 44.97 44.97 67.35 68.46 48.96 49.85 50.18 50.18 57.25 57.25 58.49 58.49 50.61 56.94 47.17 47.17 53.25 52.97 61.42 61.89 0.00 75.63 75.63 6.05 41.48 46.94 6.61 37.39 45.56 5.50 35.28 42.82 0.00 38.02 38.02 0.00 25.71 25.71 0.00 39.29 39.29 0.00 39.85 39.85 -1.32 39.48 37.74 -0.95 46.96 45.75 0.00 55.62 55.62 0.76 69.59 69.67 1.39 50.56 52.87 0.00 43.31 43.31 0.00 49.03 49.03 0.00 56.83 56.83 4.74 42.24 51.92 0.00 41.07 41.07 -0.11 53.27 52.90 0.33 65.96 65.60 0.00 76.22 76.22 8.98 52.71 55.51 9.15 51.81 55.38 8.71 50.73 53.37 0.00 44.72 44.72 0.00 35.71 35.71 0.00 49.53 49.53 0.00 47.16 47.16 -1.04 43.20 41.52 -0.15 50.05 49.46 0.00 51.34 51.34 1.11 68.82 69.87 0.89 50.37 52.74 0.00 51.02 51.02 0.00 54.23 54.23 0.00 61.85 61.85 6.33 57.67 60.88 0.00 47.30 47.30 -0.28 57.63 57.35 0.47 63.48 64.00 0.00 75.26 75.26 0.41 55.39 61.43 1.24 55.76 62.37 -0.23 55.16 60.67 0.00 55.52 55.52 0.00 44.45 44.45 0.00 57.56 57.56 0.00 50.54 50.54 -1.80 47.68 46.36 -0.78 51.21 50.26 0.00 54.46 54.46 0.69 69.42 70.18 3.33 56.01 57.40 0.00 53.26 53.26 0.00 67.31 67.31 0.00 61.31 61.31 1.59 60.93 65.66 0.00 57.53 57.53 -0.19 57.75 57.64 0.22 65.79 66.12 0.00 75.86 75.86 2.80 59.07 59.48 3.57 58.21 58.46 2.64 58.61 58.38 0.00 48.10 48.10 0.00 38.39 38.39 0.00 45.46 45.46 0.00 39.84 39.84 -1.68 41.71 39.91 -0.59 46.87 46.08 0.00 49.88 49.88 1.05 69.04 69.73 2.37 44.89 48.23 0.00 50.35 50.35 0.00 64.31 64.31 0.00 56.99 56.99 3.22 62.21 63.81 0.00 51.93 51.93 -0.29 53.74 53.55 0.52 64.59 64.81 0.00 5.46 7.77 7.54 0.00 0.00 0.00 0.00 -1.75 -1.21 0.00 0.08 2.30 0.00 0.00 0.00 9.68 0.00 -0.36 -0.37 15 H INACTION ON FOG SHIFT As discussed in the main paper, fog shift (a weather-type shift) is a special case of the ImageNet-C shifts classes that we do not target. Although SuperStAR chooses to take no action in the presence of fog shift, this is not because there is no appropriate action for this shift. In fact, Contrast Limited Adaptive Histogram Equalization (CLAHE) can achieve a 4.15% accuracy improvement, averaged across all five severity levels, on the AugMix classifier. Further, if allowed to take the full 5-step sequence of actions, SuperStAR would initially select a CLAHE action to correct for fog shift. This is supported by Figure 11, which shows that samples from fog shift have a state representation similar to those from our surrogate γ adjustment shift and ImageNet-C histogram-type shifts (i.e., brightness, contrast, and saturate), leading SuperStAR to select a similar action for fog shift as for these histogram-type shifts. However, SuperStAR uses a stopping condition that can prematurely terminate its procedure. The nature of fog corruption is such that, after taking the first action, SuperStAR decides to terminate the process. We speculate that this can be improved by using larger batch sizes for the validation set, which would allow for a more accurate estimate of the Wasserstein distance. Simultaneously, this would come at a higher computational cost for training the RL policy. Figure 11: K-means clustering of sampled state representations for noise- and histogram-type shifts from ImageNet-C, fog shift from ImageNet-C, and our surrogates. 100 samples were taken from each shift. K = 2 clusters were chosen by selecting K from the range [1, 10] via the elbow method. The projection onto the entropy and average brightness dimensions of the state representation is shown. Samples from fog shift are clustered with γ change shift and the ImageNet-C histogram-type shifts. 16 I PERFORMANCE ACROSS SEVERITY LEVELS FOR ALL CLASSIFIERS Figure 12: Accuracy improvements for increasing severity evaluated on classifiers trained with a) no data augmentation, b) AugMix, c) NoisyMix, d) DeepAugment, e) DeepAugment and AugMix, and f) PuzzleMix. In general, performance improvements are more pronounced for greater severities of corruption. 17
http://arxiv.org/abs/2302.10331v3
2023-08-07T22:07:04
2023-02-20T21:54:25
Causal Razors
When performing causal discovery, assumptions have to be made on how the true causal mechanism corresponds to the underlying joint probability distribution. These assumptions are labeled as causal razors in this work. We review numerous causal razors that appeared in the literature, and offer a comprehensive logical comparison of them. In particular, we scrutinize an unpopular causal razor, namely parameter minimality, in multinomial causal models and its logical relations with other well-studied causal razors. Our logical result poses a dilemma in selecting a reasonable scoring criterion for score-based casual search algorithms.
[ "Wai-yin Lam" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10331v3", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10331v3", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.LO", "stat.ML" ]
3 2 0 2 g u A 7 ] G L . s c [ 3 v 1 3 3 0 1 . 2 0 3 2 : v i X r a Causal Razors Wayne Lam Q Causal Razors: A Comparative Study of Simplicity Assumptions in Causal Discovery* Wai-yin (Wayne) Lam Department of Philosophy Carnegie Mellon University Pittsburgh, Pennsylvania, USA Abstract When performing causal discovery, assumptions have to be made on how the true causal mechanism cor- responds to the underlying joint probability distribution. These assumptions are labeled as causal razors in this work. We review numerous causal razors appeared in the literature, and offer a comprehensive logical comparison over them. In particular, we scrutinize an unpopular causal razor, namely parameter minimality, in multinomial causal models and its logical relations with other well-studied causal razors. Our logical result poses a dilemma in selecting a reasonable scoring criterion for score-based casual search algorithms. 1 Introduction A fundamental goal of scientific inference is to discover causal structures. How to attain this goal based on non-experimental data is a striking question, especially in the era of abundant data. In recent decades, the research of causal discovery has been flourishing, particularly due to the explosion of data and the rise of many machine learning techniques that ease computational complexity. While traditional statistical tools are designed to recover non-causal associations, causal discovery aims at the process of inferring causal relationships between variables in a given system from observational data. Causal discovery procedures, also known as causal search algorithms, generally connect statistical in- formation from the observational data with a graphical representation that depicts causal relations. One popularly used graphical device is causal directed acyclic graphs (DAGs) where each directed edge depicts the direct causal influence flowing from one variable to another. By postulating that the true causal mecha- nism can be represented by a causal DAG, causal search algorithms primarily purport to recover the causal information from the observational data generated by the ground truth. Given an observational dataset over a set of measured variables V with a joint probability distribution P, each DAG G over V is a hypothesis with an objective to explain P in terms of its graphical features, particularly through d-separations which was famously introduced by Pearl [1988]. The explanation of P is predominately referring to the set of conditional independencies (CIs) entailed by P, which is a focal point for researchers to mine possible causal information. Accordingly, one intuitive task in causal discovery is to shrink the space of hypotheses to an extent that substantial causal information of the true causal mechanism can be retrieved. Nonetheless, the size of the hypothesis space grows exponentially with the size of V. So, a crucial research question concerns how poorer hypotheses can be eliminated from consideration. Structure discovery can hardly be feasible without making any assumptions. Causal discovery makes no exception. The elimination of poorer hypotheses can be performed only by assuming that the true *This paper is part of the author's dissertation titled Causal Razors and Causal Search Algorithms [Lam, 2023]. 1 causal mechanism, denoted as G∗, satisfies certain desired features such that DAGs without these features are deemed inferior. As inspired by the principle of common cause from Reichenbach [1956], one well- known assumption is the Causal Markov Condition (CMC) which requires that the CIs entailed through d-separations by G∗ is a subset of the CIs held in the joint probability distribution P. Along these lines, DAGs violating CMC (i.e., non-Markovian DAGs) are impermissible hypotheses and should be rejected. Despite its broad acceptance, CMC alone still leaves us with an ample amount of hypotheses to consider. For instance, every complete DAG (i.e., all vertices are pairwise connected by a directed edge) trivially satisfies CMC in that it entails no CI by d-separation. Stronger assumptions, thus, are required to retrieve more substantial information about G∗. One widely discussed candidate in the literature is the Causal Faithfulness Condition (CFC), or faithfulness for short. By adopting the converse of CMC, faithfulness assumes that the set of CIs held in P is a subset of those entailed graphically by G∗. Albeit its strong logical strength which enables a considerable cut-down of the hypothesis space, G∗ might not be identifiable even if CFC is satisfied. DAGs different in orientations can graphically entail the same set of CIs. In standard notations, these DAGs are in the same Markov equivalence class (MEC). One notable theoretical result is that the MEC of the G∗ (i.e., the true MEC) is identifiable when the true causal model (G∗, P) meets CFC. On a positive note, the violation of CFC, as shown by Spirtes et al. [2000], has a Lebesgue measure of zero at the level of population for a wide range of probability distributions that are commonly studied. Nevertheless, unfaithfulness does not vanish in small probability in practice. Sometimes scientific models have paramter values evolved through a long-term dynamic equilibrium and tended to elicit unfaithfulness In the case of finite samples, violation of CFC can be almost (in contrast to exact) [Andersen, 2013]. in the sense that dependencies are mistakenly judged as independencies (i.e., almost independencies) by statistical tests [Zhang and Spirtes, 2008]. To avoid, so, one might be tempted to adopt the strong causal faithfulness condition which assumes that no CI not entailed by CMC almost holds in the joint distribution [Kalisch and B ̈uhlmann, 2007]. However, [Uhler et al., 2013] convincingly show that almost unfaithfulness occurs frequently. This observation prompts researchers to reflect on the legitimacy of assuming CFC at the sample level despite its nice mathematical property possessed at the population level. Below is an example illustrating this phenomenon. Suppose we want to analyze the causal relations over the following five variables: taking contraception pills (C), diabetes (D), smoking (K), pregnancy (P), and stroke (T ). Say G∗ in Figure 1 depicts the true data-generating causal mechanism where we collect finite samples from. We observe that T is directly caused by each of the other four variables. For example, there is a positive causal influence from C to T due to a slight increase in probability of having stroke after taking contraceptive pills. On the other hand, there is also an indirect but negative causal influence from C to T mediated by P. This can be interpreted as how the probability of pregnancy is lowered by taking contraceptive pills while pregnancy raises the probability of stroke. Suppose that the direct (and positive) and indirect (and negative) causal influences from C to T are relatively close to even out, that is, C makes a negligible change to the probability of T though they are probabilistically dependent. Due to sampling error, our finite sample informed us the marginal independence between C and T mistakenly. The almost independence between C and T is not graphically represented by G∗ (due to the adjacency between them). Thus, G∗ is not faithful to the sampling distribution and it exhibits an almost violation of CFC. C T D G∗ P K Figure 1: A DAG hypothesis explaining the causal relations over taking contraception pills (C), diabetes (D), smoking (K), pregnancy (P), and stroke (T ). 2 Historically, the PC algorithm [Spirtes and Glymour, 1991]) and the GES algorithm [Chickering, 2002] have been proven to identify the true MEC under CFC. But they can fail this task under unfaithfulness. For instance, the PC algorithm will mistakenly judge C and T as non-adjacent due to their almost indepen- dence. Thus, the problem of almost unfaithfulness motivates the research direction of studying assumptions strictly weaker than CFC while the true MEC is still identifiable. These include the restricted form of faith- fulness by Ramsey et al. [2006], also the Sparsest Markov Representation (SMR) assuption introduced by Raskutti and Uhler [2018]. Numerous theoretical assumptions of a similar sort have been scrutinized in the literature. For instance, Zhang [2013] discussed two minimality conditions, namely Pearl-minimality and SGS-minimality, that the true causal model is expected to satisfy. With CFC included, he referred to these three conditions as Occam's razors for Markovian causal models. Obviously, this notation dates back to William of Occam's law of parsimony which gives precedence to simplicity: of the competing hypotheses, the simpler one is to be preferred. Given the many simplicity assumptions pertinent to causal discovery have been surveyed in recent decades, we borrow a similar terminology to subsume all of these assumptions under the generic term causal razors. More than a dozen causal razors have been proposed But a comprehensive logical comparison of them is still found wanting. One possible exception is [Forster et al., 2020] which compares a handful of causal razors with frugality: a weaker variant of SMR that requires that Markovian DAGs which are not the sparsest should be rejected. For example, consider the DAG hypothesis G′ in Figure 2 which is supposedly also Markovian like G∗ in Figure 1. Following frugality, G′ should be rejected because G∗ contains strictly fewer edges than G′. C T D G′ P K Figure 2: An alternative DAG hypothesis which satisfies CMC. Ostensibly, frugality has an intuitive appeal in terms of simplicity. Analogous to counting edges in DAGs, experimental research in psychology (e.g., Bonawitz and Lombrozo [2011]) find positive evidence that people identify simplicity among causal hypotheses as the number of causes invoked in a causal expla- nation. Also, certain causal search algorithms (e.g., Raskutti and Uhler [2018], Solus et al. [2021]) purport to identify the true MEC by favoring sparser Markovian DAGs. A theoretical motivation for embracing causal razors defined by graphical sparsity is due to the com- monly studied linear Gaussian causal models. They license an elegant bijection between directed edges in a DAG and linear coefficients that are parameters used to define a causal model. Thus, the intuitive appeal of frugality is arguably grounded by a more fundamental concept: number of parameters in a causal model. Counting parameters is a ubiquitous practice in both statistics and computer science. It helps to measure the statistical complexity of a statistical/learning model, and hypotheses with fewer parameters are less prone to the problem of overfitting in general [MacKay, 1992]. However, no serious attempt has been devoted to the analysis of parameter minimality in the causal discovery literature, not to mention its relation to other causal razors such as frugality. The points made above incentivize a more encyclopedic analysis of causal razors. By laying out a spectrum of causal razors defined inclusively by CMC and CFC, they will be scrutinized in terms of their logical strength. On the other hand, we demonstrate that a comprehensive logical analysis of causal razors, though can easily be glossed over, yields salient implications to complement the increasingly influential development of causal search algorithms. One instance is the recent result of [Lam et al., 2022] which 3 shows that CFC is logically equivalent to a specific form of Pearl-minimality. This logical discovery can be utilized to show the limitation of a causal search algorithm that was not aware of by its developers. For instance, Solus et al. [2021] thought that their GSP algorithm can be correct under unfaithfulness. Yet, when CFC fails, the logical equivalence demonstrates how their algorithm can be trapped by a Pearl-minimal DAG which is deemed as sub-optimal in their framework. This is an instance verifying the practical significance of a careful comparative study of causal razors. On the other hand, we focus on the comparison between frugality and parameter minimality in multi- nomial causal models. An example will be showcased to prove the logical independence between the two causal razors, that is, a sparser DAG (e.g., G∗ in Figure 1) can have more parameters than a denser one (e.g., G′ in Figure 2). Though G′ appears to be implausible when we have background knowledge over the variables, it is not evident whether G∗ or G′ is a more preferable hypothesis when no background or contextual information is given. This logical independence, furthermore, is closely intertwined with actual implementations of causal search algorithms, particularly the scored-based species such as GES and GSP. In the face of almost unfaithfulness, should one adopt edge count as a scoring criterion that prefers sparser Markovian DAGs, or a metric (e.g., Bayesian scoring criterion by Schwarz [1978]) that favors those with fewer parameters? This dilemma evokes algorithm users to reflect on which causal razor they have implicitly committed to when performing robust causal discovery. Additional remarks about causal razors should be made explicit before delving into further details. First, though the term 'razor' encodes the spirit of Occam's razor, not every causal razor to be studied conveys a clear bearing of simplicity. For instance, orientation faithfulness [Ramsey et al., 2006] requires that triplets of vertices in a DAG are not associated with a particular kind of CIs. It is not obvious how this assumption can be affiliated with a sense of theoretical parsimony. Thus, causal razors in this work primarily refer to the behavior of shrinking the hypothesis space. Second, the shrinking behavior should be understood functionally. Following the functional account of causation espoused by Woodward [2021], causal reasoning focuses on what agents want to do with the causal notions with certain goals and purposes. So the shrinking behavior of causal razors needs to be studied with a well-defined desideratum that informs us how much shrinking is necessary and sufficient. Following the common practice, this work will concentrate on the identification of the true MEC. That being said, different formal desiderata prevail in the literature. The LiNGAM algorithm [Shimizu et al., 2006] does not seek to identify the true MEC, and the conservative PC algorithm [Ramsey et al., 2006] aims to identify a broader class of DAGs than the true MEC. Following the learning-theoretic approach as in [Lin and Zhang, 2020], one should inquire what the highest achievable desideratum is when assuming a particular causal razor. The study of desiderata can be interpreted in a practical sense as well. An algorithm assuming a strong causal razor can run much faster than its competitor which assumes weaker. When there is a lack of computational resources, researchers may justifiably choose to sacrifice accuracy for efficiency by embracing the latter as a desideratum. Instead of insisting on an objective study of desiderata, this work leans to open up a menu of possibilities that researchers are free to choose from. Lastly, parametric assumptions can also be used to shrink the space of possible hypotheses, and should be qualified as causal razors accordingly. Nevertheless, parametric assumptions are generally disconnected from structural causal razors such as CFC and frugality that are defined non-parametrically. Still, param- eter minimality is a notable exception which demands a parametric assumption to effectively enumerate parameters. In this work, the discussion of parametric assumptions will only be studied in association with parameter minimality. But interested readers are suggested to explore the interplay between parametric assumptions and structural causal razors. This paper is organized as follows. Section 2 begins with some basic terminologies. In Section 3, we review a list of eleven structural causal razors studied in the literature, followed by a comprehensive logical analysis of them in Section 4. Section 5 discusses parameter minimality and its stronger variant, also their logical relations to the structural causal razors in the multinomial context. Section 6 initiates an algorithmic 4 dilemma resulted from our logical analysis. Concluding remarks will be given in Section 7. Proofs and construction details of examples will be left in the Appendix. 2 Basic Terminologies We use italicized letters for variables (e.g., X1, Y) and boldfaced letters for sets of variables (e.g., X) through- out this paper. In the following, we review some standard notations and definitions related to directed acyclic graphs and joint probability distributions. A directed graph G over a set of measured variables V = {X1, ..., Xm} consists of m vertices v = {1, ..., m} where each vertex i ∈ v associates to the variable Xi ∈ V, and each edge in G is directed with the form j → k. We focus on simple graphs where no vertex has an edge to itself, and there is at most one edge for every pair of vertices. For any vertices j, k ∈ v, we say that j and k are adjacent in G if there exists a directed edge between j and k (i.e., j → k or k → j) in G. Let E(G) be the set of edges in G. Given a directed graph G, a path p is a sequence of vertices hp1, ..., pki for some k ≥ 2 where pi and pi+1 are adjacent in G for each 1 ≤ i < k. Such a path p is said to be a directed path (from p1 to pk) in G if (pi → pi+1) ∈ E(G) holds for each 1 ≤ i < k. A directed acyclic graph (DAG) is a directed graph where no vertex has a directed path to itself. Given a set of variables V, denote DAG(v) as the set of all possible DAGs defined over V. Below are some standard graphical notations. Given a DAG G ∈ DAG(v) and a vertex i ∈ v: • pa(i, G) := { j ∈ v : ( j → i) ∈ E(G)} : the set of parents of i in G; • ch(i, G) := { j ∈ v : (i → j) ∈ E(G)} : the set of children of i in G; • ne(i, G) := pa(i, G) ∪ ch(i, G) : the set of neighbors of i in G; • an(i, G) := transitive closure of pa(i, G) union with {i}: the set of ancestors of i in G; • de(i, G) := transitive closure of ch(i, G) union with {i} : the set of descendants of i in G; • nd(i, G) := v \ de(i, G) : the set of non-descendants of i in G. The skeleton of G, denoted as sk(G), is the set of (unordered pairs of) adjacencies in G. Pictorially, when G is a DAG, sk(G) represents the undirected graph of G obtained by removing all the arrowheads in G. For any triple of pairwise distinct vertices i, j, k ∈ v, we say that (i, j, k) is unshielded if (i, j), ( j, k) ∈ sk(G) but (i, k) < sk(G), and (i, j, k) is shielded (or a triangle) if they are pairwise adjacent in G. Given a path p = hp1, ..., pki in a DAG G, pi (for any 1 < i < k) is a collider on p if (pi−1 → pi), (pi+1 → pi) ∈ E(G), and a non-collider otherwise. For any i, j ∈ v and any k ⊆ v \ {i, j}, i and j are d-connected given k in G if there exists a path p between i and j in G such that no non-collider on p is in k, and each collider l on p or a descendant of l is in k. i and j are d-separated given k in G if i and j are not d-connected given k. For any disjoint subsets of vertices i, j, k ⊆ v, i and j are d-separated given k in G, written as i ⊥G j | k, if i and j are d-separated by k in G for every i ∈ i and every j ∈ j. On the other hand, consider a joint probability distribution P over V. For any subsets X, Y ⊆ V, the conditional probability distribution of X given Y is denoted by P(X | Y). For any pairwise disjoint subsets of variables X, Y, Z ⊆ V, X and Y are said to be conditionally independent given Z if P(X | Y, Z) = P(X | Z), and we write X ⊥⊥P Y | Z to denote the conditional independence (CI) between X and Y given Z in P. When X = {X} and Y = {Y} are singleton sets, we write X ⊥⊥P Y | Z (instead of {X} ⊥⊥P {Y} | Z). When Z = ∅, we write X ⊥⊥P Y (instead of X ⊥⊥P Y | Z).1 1X ⊥⊥P Y is generally referred to as a marginal independence in the literature. But, for the sake of convenience, all marginal independencies are labeled as CIs. 5 Following [Studen ́y, 2005], we use independence models as machinery to juxtapose the CI relations that hold in a joint distribution with those that entailed by a DAG through d-separation. First, we define the set of all possible CIs as: I(V) := {hX, Y | Zi : X, Y, Z are pairwise disjoint subsets of V}. The independence model of a joint distribution P (over V) is I(P) = {hX, Y | Zi ∈ I(V) : X ⊥⊥P Y | Z} and the independence model of a DAG G (over V) is I(G) = {hXj, Xk | Xli ∈ I(V) : j ⊥G k | l} where Xi = {X j} j ∈ i for every i ⊆ v. Similar to the shorthands introduced above, we write hX, Y | Zi when X and Y are singleton sets {X} and {Y}, and write hX, Yi when Z = ∅. Two DAGs G1 and G2 are Markov equivalent if I(G1) = I(G2). The Markov equivalent class of a DAG G, denoted MEC(G), is defined by the set of DAGs that are Markov equivalent to G. Two DAGs can be different but Markov equivalent. One simple case is the 2-vertex case where E(G1) = {1 → 2} and E(G2) = {2 → 1} while I(G1) = I(G2) = ∅. As proven by Verma and Pearl [1988], two DAGs are Markov equivalent if and only if they share the same set of adjacencies and unshielded colliders. Each MEC can be graphically represented by a unique completed partially directed acyclic graph (CPDAG) which is a mixed graph composed of directed and undirected edges. [Meek, 1995] showed that a set of orientation rules is complete to obtain a unique CPDAG from the skeleton and the unshielded colliders of a DAG. A causal model is a pair (G, P) where G is a DAG and P is a joint probability distribution over the same set of variables V. We denote G∗ as the true data-generating DAG and so (G∗, P) is the true causal model assumed to always exist. Next, we use param(G, P) to define the set of parameters of a causal model (G, P). A parametric assumption on P has to be made in order to identify the set of parameters of a causal model. So, for a non- parametric model where we do not assume that the joint distribution P belongs to any particular parametric family of distributions, param(G, P) becomes an undefined notion. In the following, we write param(G) for short when the underlying joint distribution P is clear from context. We will focus on two kinds of causal models in this work: structural equation models (SEMs) and multinomial causal models. A structural equation model (G, ǫ, F ) over V = {X1, ..., Xm} where ǫ = {ǫ1, ..., ǫm} is a set of noise terms, F = { f1, ..., fm} is a set of structural equations where the following is satisfied for each 1 ≤ i ≤ m. Xi = fi(pa(i, G), ǫi) (1) Let Pǫ be the joint probability distribution over the noise terms. Given the structural equations in F , a joint distribution P over V is induced provided that Xi's can be uniquely solved in terms of ǫi's. One commonly studied species of SEMs in the literature is the linear Gaussian causal model where ǫ follows a multivariate Gaussian distribution, and each fi ∈ F is a linear equation. To be precise, each variable Xi ∈ V is governed by the following equation: Xi = XX j ∈ Xpa(i,G) θ ji X j + ǫi ! (2) where 0 , θ ji ∈ θG only if j ∈ pa(i, G), and each ǫi ∈ ǫ follows a Gaussian distribution. One widely made assumption is that noise terms in ǫ are assumed to jointly independent.2 Under this assumption, we say that 2By requiring joint independence of ǫ, the mean and variance of each ǫi ∈ ǫ can be estimated by the conditional mean and partial variance of Xi given its parents Xpa(i,G). 6 param(G) = θG (without involving ǫ). Given the bijection between θG and E(G), we have a nice equality |param(G)| = |E(G)| for every linear causal Gaussian model (G, P). On the other hand, in a multinomial causal model (G, P), P is a joint multinomial distribution where each Xi ∈ V is a discrete k-valued variable with its range of values specified by range(Xi) = {0, 1, ..., k − 1} where k ≥ 2. Let r(i) be the cardinality of Xi's range of values (i.e., r(i) := |range(Xi)|). So, we say that V is ranged from hr(1), r(2), ..., r(|v)|i. We further define range(Xi) for any subset of variables Xi ⊆ V as the Cartesian product of {range(X j)} j∈i. Similarly, we extend r(*) to any subset of variables Xi ⊆ V as follows: i∈i r(i) if i , ∅ otherwise. r(i) :=  Q 1   For each i ∈ v, let θi,G be the set of parameters of i in G needed to compute P(Xi | Xpa(i,G)). Each parameter in θi,G corresponds to the probability of Xi taking a particular value given a specific value configuration s ∈ j∈range(Xi) P(Xi = j | Xpa(i,G) = s) = 1 for each s ∈ range(Xpa(i,G)), the degree range(Xpa(i,G)). Given that of freedom (i.e., the maximum number of logically independent values) of computing P(Xi | Xpa(i,G) = s) is r(i) − 1.3 Accordingly, we have P |θi,G| := (r(i) − 1) × r(pa(i, G)). (3) Consequently, the set of parameters of a multinomial causal model (G, P) is param(G) = ∪i∈v θi,G = θG such that |param(G)| = |θi,G| = (r(i) − 1) × r(pa(i, G)). (4) Xi∈v Xi∈v Consider the G∗ and G′ in Figure 1 and 2 again. By supposing that all variables are binary, readers can verify that |param(G∗)| = 21 and |param(G′)| = 23. Unlike the linear Gaussian case, |param(G)| > |E(G)| holds for every multinomial causal model (G, P). So much for the basic notations. In the next section, we will utilize them to articulate the crux of this work, namely, causal razors. 3 Structural Causal Razors The general goal of causal discovery, as outlined in Section 1, is the retrieval of causal information of the true DAG G∗ from the joint probability distribution P. This can be rephrased as the behavior of shrinking the hypothesis space DAG(v) to the extent that only a desired class of DAGs remains. This shrinking behavior inevitably requires assumptions to be made of the true causal model (G∗, P) such that DAGs failing the assumptions will be removed from consideration. These assumptions are generically labeled as causal razors in this work. Roughly speaking, causal razors can be classified into three different groups, though they can possi- bly overlap. First, a parametric assumption can be imposed on the joint probability distribution P of the true causal model such that certain DAGs incompatible with P should be eliminated from the hypothesis space. For example, by assuming that (G∗, P) is a linear Gaussian causal model, CIs held in P can only be explained by the d-separation relations in G∗ or the coincidental cancellation of linear coefficients induced by path-cancellation in G∗.4 For instance, by representing the example in Figure 1 as a linear Gaussian model, the unfaithful independence between taking contraception pills (C) and stroke (T ) is resulted from 3Since j∈range(X j) P(Xi = j | Xpa(i,G) = s) = 1, P(Xi = k | Xpa(i,G) = s) is determined when P(Xi = j | Xpa(i,G) = s) for every j ∈ range(Xi) \ {k} is known. P 4See [Weinberger, 2017] for a in-depth theoretical discussion of path-cancellation. 7 the cancellation effect between two directed paths from C to T . Another sort of causal razors are algorithmic in nature. The set of DAGs prescribed by the causal razor is determined by the output of a specific causal search algorithm. For example, the assumption of Edge Sparsest Permutation (ESP) in [Solus et al., 2021] and GRaSP-razors in [Lam et al., 2022] are of this sort. Nonetheless, the kind of causal razors that draws more attention in the literature is of a different category. Generally speaking, their definitions are expressed without appealing to a specific parametric or algorithmic feature. Their focus is more on a well-defined graphical feature (e.g., edges), or a feature that entailed by a graphical feature (e.g., CIs entailed by d-separation). We label these causal razors as structural causal razors. Admittedly, this heuristic categorization is imprecise. But this deliberate vagueness can simplify the exposition in our upcoming comparative analysis. We first review a list of structural causal razors studied in the literature. Each definition will be unpacked into three parts: [class] specifies the class of DAGs satisfying the intended condition, [property] describes each DAG in [class], and [razor] states the causal razor supposed to be satisfied by the true causal model (G∗, P). When we speak of a causal razor, we generally refer to the [razor] part.5 Definitions of causal razors are stated within a surrounding box for a more glossarial view for readers. The first candidate is the causal Markov condition (CMC) which serves as the most fundamental pillar of causal discovery. Definition 3.1. (Markov) For any joint probability distribution P over V, • [class] CMC(P) := {G ∈ DAG(v) : I(G) ⊆ I(P)}; • [property] a DAG G is Markovian (to P) if G ∈ CMC(P); • [razor] (G∗, P) satisfies the causal Markov condition if G∗ ∈ CMC(P). CMC requires that the CIs entailed by the true DAG (through d-separation) is a subset of those held in the joint distribution. The definition of CMC is obtained from the global Markov condition (i.e., I(G) ⊆ I(P)) which is equivalent to each of the following two conditions.6 First, G satisfies the local Markov assumption relative to P if Xi ⊥⊥P Xnd(i,G) \ Xpa(i,G) | Xpa(i,G) for every Xi ∈ V. (5) In words, every variable is independent of its non-descendants by conditioning on all of its parents. This condition helps rewriting the joint probability distribution P by the famous Markov factorization: P(V) = P(Xi | Xpa(i,G)). Yi∈v (6) Notice that CMC alone cannot attain the desideratum of identifying the true Markov equivalence class (ex- cept the trivial case where I(P) = ∅). This is because if G is Markovian, every supergraph G′ of G (i.e., E(G′) ⊆ E(G)) is also Markovian. Also, every complete DAG is Markovian trivially since it entails no CI by d-separation. Thus, CMC(P) still leaves us with a huge hypothesis space to perform causal search. To 5Following the terminologies in [Zhang, 2013], [property] and [razor] of a causal razor can be interpreted as a methodological assumption and an ontological assumption respectively. To be more precise, thaking the causal razor (e.g., Markov) as a method- ological assumption (or principle) means that DAGs not satifying [property] (e.g., non-Markovian) are hypotheses that should be rejected according to the assumption. On the other hand, taking the causal razor as an ontological assumption means that the true causal model is assumed to satisfy the [property] in question (e.g., causal Markov condition). 6The proof to the equivalence of the three Markov conditions can be found in [Lauritzen, 2019]. 8 further contract the search space, a widely discussed causal razor is the causal faithfulness condition (CFC) from [Spirtes et al., 2000]. Definition 3.2. (Faithfulness) For any joint probability distribution P, • [class] CFC(P) := {G ∈ CMC(P) : I(P) ⊆ I(G)}; • [property] a DAG G is faithful (to P) if G ∈ CFC(P); • [razor] (G∗, P) satisfies the causal faithfulness condition if G∗ ∈ CFC(P). By assuming the converse of CMC, CFC further requires that I(G∗) = I(P).7 In other words, all CIs held in P can be perfectly explained by G∗ through d-separation. Denote ΨG,P = I(P) \ I(G) as the set of unfaithful CIs in G ∈ CMC(P). Sometimes we write I(P) = I(G) *∪ ΨG,P to highlight the disjoint union between I(G) and ΨG,P. Methodologically speaking, when G ∈ CFC(P) while G′ has a non-empty ΨG′,P, then G is strictly preferred to G′ in terms of explanatory power, and thus G′ should be rejected. When CFC is satisfied, the identification of the true MEC is an attainable desideratum because MEC(G∗) = CFC(P) holds. On a positive note, the violation of CFC has a Lebesgue measure of zero in the large sample limit.8 Nevertheless, as argued by Andersen [2013], unfaithfulness does not vanish in small probability because certain parameter values of a scientific model can be obtained through a long-term dynamic equi- librium which can give rise to a violation of CFC. Moreover, as shown by Uhler et al. [2013], learning CIs from observational data by hypothesis testing is error-prone, and so almost violations of faithfulness are fre- quent in finite samples. Back to the example in Figure 1, G∗ < CFC(P) because of the almost independence between C and T which is not entailed by G∗ though d-separation. By upholding the same desideratum while admitting the frequent almost violations of CFC, researchers are motivated to resort to causal razors strictly weaker than CFC. One earliest approach is the assumption of restricted faithfulness offered by Ramsey et al. [2006], which can be decomposed into adjacency faith- fulness and orientation faithfulness.9 Definition 3.3. (Adjacency faithfulness) For any joint probability distribution P over V, • [property] a DAG G is adjacency-faithful (to P) if hXi, X j | Xsi < I(P) for every (i, j) ∈ sk(G) and every s ⊆ v \ {i, j}; • [class] AdjF(P) := {G ∈ CMC(P) : G is adjacency-faithful to P}; • [razor] (G∗, P) satisfies the causal adj-faithfulness assumption if G∗ ∈ AdjF(P). 7Instead of following the common practice in defining CFC as the converse of CMC (or CFC(P) := {G ∈ DAG(v) : I(P) ⊆ I(G)}), defining CFC as the conjunction of CMC and its converse (or CFC(P) := {G ∈ CMC(v) : I(P) ⊆ I(G)} as in Definition 3.2) helps simplifying the exposition in the sense that a faithful but non-Markovian DAG does not exist. The same convention will be used for the [class] of each causal razor defined below. 8See Spirtes et al. [2000, pp.41-2]. 9Following the definitions of CMC and CFC, we label each [razor] starting with the term causal to indicate that it is the true causal model that satisfies the associated [property]. But this naming custom will often be neglected henceforth for brevity. 9 Definition 3.4. (Orientation faithfulness) For any joint probability distribution P over V, • [property] a DAG G is orientation-faithful (to P) if for every unshielded triple (i, j, k) in G, (a) if i → j ← k holds in G, then hXi, Xk | Xsi < I(P) for every s ⊆ v \ {i, k} where j ∈ s; (b) otherwise, hXi, Xk | Xsi < I(P) for every s ⊆ v \ {i, k} where j < s; • [class] OriF(P) := {G ∈ CMC(P) : G is orientation-faithful to P}; • [razor] (G∗, P) satisfies the causal ori-faithfulness assumption if G∗ ∈ OriF(P). Definition 3.5. (Restricted faithfulness) For any joint probability distribution P, • [class] ResF(P) := AdjF(P) ∩ OriF(P); • [property] a DAG G is restricted-faithful (to P) if G ∈ ResF(P); • [razor] (G∗, P) satisfies the causal res-faithfulness assumption if G∗ ∈ ResF(P). According to the classic result by Verma and Pearl [1990], MEC(G) for any given DAG G can be uniquely identified by its skeleton sk(G) and the set of unshielded colliders in G. Note that res-faithfulness assumption ensures that both adjacencies and unshielded colliders in G∗ are correctly identified by I(P) (through adj-faithfulness and ori-faithfulness respectively). Hence, MEC(G∗) is identifiable under res- faithfulness. As proven by Ramsey et al. [2006], the famous PC algorithm (originated by Spirtes and Glymour [1991]) can correctly identify MEC(G∗) when res-faithfulness holds. For our earlier 5-node example in Fig- ure 1, G∗ is not adjacency-faithful since the adjacency between C and T is associated with an (almost) unfaithful independence. Thus, G∗ is not restricted-faithful either. A different route to identify MEC(G∗) is the sparsest Markov representation (SMR) assumption proposed by Raskutti and Uhler [2018]. This assumption is defined in terms of the sparsity of G∗, or equivalently, fru- gality in [Forster et al., 2020]. Definition 3.6. (Frugality) For any joint probability distribution P, • [class] Fr(P) := {G ∈ CMC(P) : ¬∃G′ ∈ CMC(P) s.t. |E(G′)| < |E(G)|}; • [property] a DAG G is frugal (to P) if G ∈ Fr(P); • [razor] (G∗, P) satisfies the causal frugality assumption if G∗ ∈ Fr(P). 10 Definition 3.7. (Unique frugality / SMR) For any joint probability distribution P, • [class] uFr(P) := if all DAGs in Fr(P) belong to the same MEC, otherwise; • [property] a DAG G is u-frugal (to P) if G ∈ uFr(P); Fr(P)  ∅   • [razor] (G∗, P) satisfies the causal u-frugality assumption if G∗ ∈ uFr(P). From an ontological point of view, frugality hypothesizes that G∗ is one of the sparsest Markovian DAGs. Methodologically, it states that only the sparsest Markovian DAGs are acceptable hypotheses. Back to the two DAGs in Figure 1 and 2, G∗ is a frugal DAG while G′ is not.10 On the other hand, u-frugality requires not only frugality but also the uniqueness of MEC (i.e., all frugal DAGs are Markov equivalent). Thus, u-frugality is stronger than its non-unique variant by definition. Accordingly, u-frugality imposes an equiv- alence between MEC(G∗) and Fr(P) and hence the identification of MEC(G∗) is straightforward when u- frugality is correctly assumed. In practice, the Sparsest Permutation (SP) algorithm in [Raskutti and Uhler, 2018] returns Fr(P) by enumerating all possible permutations and locating the sparsest induced DAGs. The correctness of SP, hence, is evident when u-frugality is satisfied.11 Now we turn to some other causal razors studied in the literature. One candidate is the minimality con- dition sometimes referred to as the minimal I-map (e.g., Verma and Pearl [1988]). We follow Zhang [2013] and label this causal razor as SGS-minimality as in [Spirtes et al., 2000]. Definition 3.8. (SGS-minimality) For any joint probability distribution P, • [class] SGSM(P) := {G ∈ CMC(P) : ¬∃G′ ∈ CMC(P) s.t. E(G′) ⊂ E(G)}; • [property] a DAG G is SGS-minimal (to P) if G ∈ SGSM(P); • [razor] (G∗, P) satisfies the causal SGS-minimality assumption if G∗ ∈ SGSM(P). In plain words, SGS-minimality requires that no subgraph is Markovian. Similar to frugality, SGS- minimality is an edge-minimality condition but is defined in terms of set containment instead of cardinality. This causal razor plays a crucial role in permutation-based causal search algorithms (e.g., SP). As proven by Verma and Pearl [1988], a DAG constructed from a topological ordering of v and a semigraphoid (e.g., a joint probability distribution) must be SGS-minimal.12 In addition, as argued by Zhang and Spirtes [2011], SGS-minimality is a fairly safe assumption to be made, particularly under an interventionist interpretation of causality.13 Another causal razor that has drawn wide attention is the minimality principle studied in Pearl [2009]. Following the naming convention in [Zhang, 2013], we denote this causal razor as Pearl-minimality, or P- minimality for short. 10See Example 4.4 for the details of I(P) to verify that no Markovian DAG is sparser than G∗. 11To be precise, by supposing that P is a graphoid (see Appendix A), SP enumerates all permutations over v where each permutation induces a SGS-minimal DAG. 12See Appendix A for the definition of a semigraphoid. 13Readers might suspect why the unique variant of SGS-minimality is not introduced above. See footnote 23 on why it is an uninteresting causal razor. 11 Definition 3.9. (P-minimality) For any joint probability distribution P, • [class] PM(P) := {G ∈ CMC(P) : ¬∃G′ ∈ CMC(P) s.t. I(G) ⊂ I(G′)}; • [property] a DAG G is P-minimal (to P) if G ∈ PM(P); • [razor] (G∗, P) satisfies the causal P-minimality assumption if G∗ ∈ PM(P). Given that a Markovian DAG is a hypothesis that purports to explain the CIs in I(P), P-minimality re- quires the set of CIs unexplained by G (i.e., ΨG,P) to be minimal in a set-theoretical sense. Methodologically speaking, if a Markovian DAG G can explain a superset of CIs compared to another Markovian DAG G′ (i.e., I(G′) ⊂ I(G) ⊆ I(P)), the latter should be rejected. Zhang [2013] offered several arguments in support of P-minimal as an ontological assumption, particularly when G∗ is relatively sparse with few triangles. Also, by pursuing a learning-theoretic approach, Lin and Zhang [2020] show that certain important convergence properties must be sacrificed when P-minimality is violated. Next, analogous to the relation between frugality and u-frugality, we introduce the strengthened form of P-minimality with a uniqueness condition. Definition 3.10. (Unique P-minimality) For any joint probability distribution P, • [class] uPM(P) := if all DAGs in PM(P) belong to the same MEC, otherwise; • [property] a DAG G is u-P-minimal (to P) if G ∈ uPM(P); PM(P)  ∅   • [razor] (G∗, P) satisfies the causal u-P-minimality assumption if G∗ ∈ uPM(P). Unlike the other discussed causal razors, u-P-minimality does not attract much attention except by Lin and Zhang [2020] and Lam et al. [2022]. Despite its unpopularity, the latter authors prove that u-P-minimality and CFC are logically equivalent. We will recast their simple proof in Appendix B, and discuss an algorithmic im- plication of this logical equivalence in Section 6. We now turn to a causal razor that has been extensively studied in [Spirtes and Zhang, 2015], [Zhang and Spirtes, 2008], and [Zhang, 2013], namely, the assumption of triangle faithfulness. Definition 3.11. (Triangle faithfulness) Given a joint probability distribution P over V, • [property] a DAG G is triangle-faithful (to P) if for every shielded triple (i, j, k) in G, (a) if i → j ← k holds in G, then hXi, Xk | Xsi < I(P) for any s ⊆ v \ {i, k} where j ∈ s; (b) otherwise, hXi, Xk | Xsi < I(P) for any s ⊆ v \ {i, k} where j < s; • [class] TriF(P) := {G ∈ CMC(P) : G is triangle-faithful to P}; • [razor] (G∗, P) satisfies the causal tri-faithfulness assumption if G∗ ∈ TriF(P). 12 Readers might find tri-faithfulness highly similar to ori-faithfulness where the former is defined over triangles and the latter over unshielded triples. Nevertheless, tri-faithfulness is a logical consequence of adj-faithfulness (but not of ori-faithfulness). There are two noteworthy remarks concerning tri-faithfulness. The first First, it relates to the detectability of unfaithfulness. To be precise, the violation of any [razor] can be binarized as detectable and undetectable; detectable if its associated [class] is empty, and undetectable if [class] is non-empty but not containing G∗. As proven by Zhang and Spirtes [2008], any undetectable violation of CFC must be a consequence of the violation of tri-faithfulness. On the other hand, as shown in [Zhang, 2013], the conjunction of SGS-minimality and tri-faithfulness entails P-minimality. This buttresses his claim that P-minimality is relatively safe to be assumed when G∗ is relatively sparse with a small number of triangles. The eleven causal razors defined in this section do not exhaust all that have been introduced in the liter- ature. For example, NOI-minimality in [Zhalama et al., 2019] requires that the true DAG entails the greatest number of CIs over all Markovian DAGs. Single shielded/unshielded-collider-faithfulness in [Ng et al., 2021] weakens the tri-/ori-faithfulness assumptions. Readers are recommended to relate other candidates in the literature to those defined above for a more thorough logical exposition. Our selective focus on the eleven causal razors above is primarily due to their tight logical hierarchies that we are going to explore in the coming section. 4 Logical Hierarchy of Structural Causal Razors In this section, the eleven causal razors defined above will be compared in terms of their logical strength. This can be achieved by comparing their [class]'s in terms of possible pairwise subset relations. Most cases where two [class]'s stand in a subset relation involve simple proofs (if not true by definition). We are not going to recast the specifics except for the relatively new result that CFC and u-P-minimality are logically equivalent in the Appendix B. Contrarily, a counterexample will be covered for each case where the subset relation fails. Theorem 4.1. For any joint probability distribution P, the following statements are true: (a) CFC(P) ⊆ ResF(P) = AdjF(P) ∩ OriF(P) ⊆ uFr(P) ⊆ Fr(P) ⊆ PM(P) ⊆ SGSM(P) ⊆ CMC(P); (b) AdjF(P) ⊆ TriF(P); (c) AdjF(P) ⊆ Fr(P). Proof. For (a), Definition 3.5, 3.7, 3.8 give us ResF(P) = AdjF(P) ∩ OriF(P), uFr(P) ⊆ Fr(P) and SGSM(P) ⊆ CMC(P) respectively. CFC(P) ⊆ ResF(P) is proven in [Ramsey et al., 2006], ResF(P) ⊆ uFr(P) in [Raskutti and Uhler, 2018], Fr(P) ⊆ PM(P) in [Forster et al., 2020], and PM(P) ⊆ SGSM(P) in [Zhang, 2013]. (b) is true by Definition 3.11. For (c), by reductio, suppose G ∈ DAG(v) where G ∈ AdjF(P) \ Fr(P). So, there exists G′ ∈ CMC(P) where |E(G)| > |E(G′)|. There must exist (i, j) ∈ sk(G) such that (i, j) < sk(G′). Given that (i, j) < sk(G′), | Xsi ∈ I(G′) ⊆ I(P) for some s ⊆ v \ {i, j}. However, since (i, j) ∈ sk(G), it contradicts that hXi, X j (cid:3) G ∈ AdjF(P). Theorem 4.2. Lam et al. [2022] For any joint probability distribution P, CFC(P) = uPM(P). Proof. See Appendix B. (cid:3) 13 Next, we turn to the counterexamples where the subset relations fail. To simplify our exposition, only CIs held between two singleton sets in an independence model will be listed (e.g., hX, Y | Zi). Meticulous readers can verify that the independence model I(P) of each example below induces a (compositional) graphoid (see Appendix A). Example 4.3. There exists a joint probability distribution P such that ResF(P) \ CFC(P) , ∅. Consider the DAG G∗ in Figure 3. Let P be the joint probability distribution where I(P) = I(G∗) *∪{hX1, X6i}. Obviously, G∗ < CFC(P). But X1 ⊥⊥P X6 is not associated with any adjacency or unshielded triple in G∗. (cid:3) Hence, G∗ ∈ ResF(P).14 1 2 4 3 5 6 G∗ Figure 3: G∗ ∈ ResF(P) \ CFC(P) due to ΨG∗,P = {hX1, X6i} Example 4.4. There exists a joint probability distribution P such that uFr(P) \ TriF(P) , ∅. This example is from [Lam et al., 2022, supplementary materials].15 Consider the DAG G∗ in Figure 4. Let P be the joint probability distribution with I(P) = I(G∗) *∪ ΨG∗,P where ψ1 : hX1, X5i, ψ3 : hX1, X3 | {X5}i, ψ5 : hX1, X5 | {X3}i, ψ2 : hX1, X2 | {X5}i, ψ4 : hX1, X5 | {X2}i, ψ6 : hX1, X2 | {X3, X5}i, ψ7 : hX1, X3 | {X2, X5}i, ψ8 : hX1, X5 | {X2, X3}i .    ΨG∗,P =    Readers can verify that every Markovian DAG is either Markov equivalent to G∗ or denser than G∗.16 Hence, G∗ ∈ uFr(P). Next, G∗ < TriF(P) because of the triangle (1, 4, 5) and ψ1. Indeed, one can also show that (cid:3) TriF(P) = ∅.17 Example 4.5. There exists a joint probability distribution P such that (a) Fr(P) \ uFr(P) , ∅; (b) TriF(P) \ uFr(P) , ∅; 14This example can be easily constructed as a linear Gaussian causal model using path-cancellation. Given that θG∗ = {θ12, θ14, θ23, θ36, θ45, θ56}, we set θ12θ23θ36 = −(θ14θ45θ56). Accordingly, the two directed paths 1 → 2 → 3 → 6 and 1 → 4 → 5 → 6 in G∗ cancel out and induce hX1, X6i ∈ ΨG∗,P. 15To construct the example as a linear Gaussian causal model (G∗, P), set −θ15 = θ14θ45 such that the two directed paths 1 → 5 and 1 → 4 → 5 cancel out and induce the unfaithful X1 ⊥⊥P X5. The other unfaithful CIs (i.e., {ψ2, ..., ψ8}) are entailed by I(G∗) *∪ {hX1, X5i} using graphoid axioms (including intersection and composition). 16To verify so, one simple way is to induce a DAG Gπ from each permutation π over the set of vertices v by the DAG-inducing method discussed in [Verma and Pearl, 1990] or [Raskutti and Uhler, 2018]. 17By enumerating all SGS-minimal DAGs (using the method discussed in footnote 16), one can verify that none of them is tri- faithful. Next, observe that if G < TriF(P), then G′ < TriF(P) for any G′ ∈ DAG(v) where E(G) ⊆ E(G′). Since each Markovian DAG is a supergraph of some SGS-minimal DAG, no Markovian DAG is tri-faithful. Hence, TriF(P) = ∅. 14 1 5 2 4 3 G∗ Figure 4: G∗ ∈ uFr(P) \ TriF(P) due to hX1, X5i ∈ ΨG∗,P. (c) OriF(P) \ uFr(P) , ∅; (d) TriF(P) \ AdjF(P) , ∅; (e) OriF(P) \ TriF(P) , ∅. This example is from Forster et al. [2020].18 Consider G∗ and G′ in Figure 5. Let P be the joint probability distribution where I(P) = I(G∗) *∪ {hX1, X4i}. Readers can easily verify that G∗, G′ ∈ Fr(P).19 However, uFr(P) = ∅ because G′ < MEC(G∗). So, (a) is proven. Also, we have G∗ ∈ OriF(P) ∩ TriF(P) because the only unfaithful CI of G∗ is X1 ⊥⊥P X4 which is not associated with any unshielded triple or triangle in G∗. However, G∗ < AdjF(P) due to (1, 4) ∈ sk(G∗) and the unfaithful CI. Thus, (b)-(d) are proven as well. Lastly, the only unfaithful CI X1 ⊥⊥P X3 | {X2} of G′ is not associated with any unshielded triple, but it (cid:3) instantiates a violation of tri-faithfulness at the triangle (1, 3, 2). Hence, (e) follows immediately. 1 4 2 3 G∗ 1 4 2 3 G′ Figure 5: G∗, G′ ∈ Fr(P) but uFr(P) = ∅. Example 4.6. There exists a joint probability distribution P such that (a) uFr(P) \ OriF(P) , ∅; (b) AdjF(P) \ OriF(P) , ∅; (c) PM(P) \ Fr(P) , ∅. Consider G∗ in Figure 6. Let P be the joint probability distribution where I(P) = I(G∗) *∪ {hX1, X4i}.20 We leave the readers to verify that G∗ ∈ uFr(P).21 Next, notice that the only unfaithful CI X1 ⊥⊥P X4 of G∗ is not associated with any adjacency in G∗. Thus, we have G∗ ∈ AdjF(P) as in (a). However, it elicits a violation of ori-faithfulness which requires that X1 and X4 are conditionally dependent on X2 and/or X3. So, G∗ < OriF(P) as in (b). Contrarily, consider G′ in Figure 6 where I(G′) = {hX1, X4i} ⊂ I(P). Obviously, G′ < Fr(P) because |E(G∗)| < |E(G′)|. Also, there is no way to extend I(G′) to obtain a Markovian DAG. (cid:3) Hence, G′ ∈ PM(P) \ Fr(P) as in (c). 18To construct the example as a linear Gaussian model, set −θ14 = θ12θ23θ34 such that 1 → 2 → 3 → 4 and 1 → 4 cancel out and induce the unfaithful X1 ⊥⊥P X4. 19Fr(P) can be obtained by the SP algorithm which enumerates all permutation-inducing DAGs as mentioned in footnote 16. 20Like above, by setting θ12θ24 = −(θ13θ34) in the linear Gaussian model (G∗, P), the two paths 1 → 2 → 4 and 1 → 3 → 4 cancel out and induce the unfaithful X1 ⊥⊥P X4. 21Similar to footnote 19, we obtain Fr(P) by the SP algorithm and verify that all DAGs in Fr(P) belong to MEC(G∗). 15 1 3 2 4 G∗ 1 3 2 4 G′ Figure 6: ΨG∗,P = {hX1, X4i} whereas G′ ∈ PM(P) \ Fr(P). Example 4.7. There exists a joint probability distribution P such that AdjF(P) \ uFr(P) , ∅. Let P be the joint probability distribution where I(P) = {hX1, X3i, hX1, X3 | {X2}i}.22 Consider the two Markovian DAGs G0, G1 in Figure 7. We have G0, G1 ∈ AdjF(P) since each of their unfaithful CI is not associated with an adjacency. However, they are frugal DAGs that do not belong to the same MEC. Hence, (cid:3) uFr(P) = ∅. 2 G0 2 G1 1 3 1 3 Figure 7: Even though both G0, G1 ∈ AdjF(P), they do not belong to the same MEC and thus uFr(P) = ∅. Example 4.8. There exists a joint probability distribution P such that (a) CMC(P) \ SGSM(P) , ∅; (b) SGSM(P) \ PM(P) , ∅. Consider the three DAGs in Figure 8. Let P be the joint probability distribution where I(P) = {hX1, X3i}. Thus, G∗ ∈ CFC(P). Note that G′ ∈ CMC(P) is a supergraph of G∗. It entails that G′ < SGSM(P). On the other hand, G′′ ∈ SGSM(P) because no subgraph of G′′ is Markovian. However, G′′ < PM(P) because (cid:3) ∅ = I(G′′) ⊂ I(G∗) = I(P).23 Example 4.9. There exists a joint probability distribution P such that (a) OriF(P) \ SGSM(P) , ∅; (b) TriF(P) \ SGSM(P) , ∅. 22See Appendix E.1 for the construction of the multinomial causal model (G0, P). 23The faithful (G∗, P) can be easily constructed as a linear Gaussian or a multinomial causal model. On the other hand, this example tells us that G∗ and G′′ are both SGS-minimal to P where they do not belong to the same MEC. This implies that the unique variant of SGS-minimality fails even if CFC is satisfied. This renders unique-SGS-minimality an overly strong and uninteresting causal razor. Further, notice that G′ < SGSM(P) but G′′ ∈ SGSM(P). This indicates that SGS-minimality is not MEC-preserving. To be more accurate, a causal razor is MEC-preserving if every DAG in the same MEC is contained in the [class] specified by the causal razor, or none belongs to the [class]. Similarly, this example shows that tri-faithfulness is not MEC-preserving either: G′ ∈ TriF(P) while G′′ < TriF(P). Readers can verify that all causal razors covered in this work, except SGS-minimality and tri-faithfulness, are MEC-preserving. 16 2 G∗ 2 G′ 2 G′′ 1 3 1 3 1 3 Figure 8: G∗ is the unique DAG faithful to P where I(P) = {hX1, X3i}. Also, G′, G′′ ∈ CMC(P) \ PM(P). Let P be the joint probability distribution over V = {X1, X2}. Consider G∗, G′ ∈ DAG(v) where G∗ is an empty DAG and G′ is a single-edge DAG. Given that I(P) = {hX1, X2i}, we have G′ ∈ OriF(P) ∩ TriF(P) (cid:3) vacuously. But G′ < SGSM(P) because G′ is a supergraph of G∗ ∈ CFC(P). We summarize all the pairwise possible subset relations among the [class]'s of the eleven structural causal razors in Table 1 with the applications of a simple set-theoretic fact below. Fact 4.10. Consider any two sets A and B, and also any A+ ⊇ A and B− ⊆ B. If A\B , ∅, then A+\B− , ∅. Now we introduce a new concept to binarize the eleven causal razors. Recall that the violation of a causal razor is detectable if its associated [class] is empty. Observe that certain causal razors can never be detectably violated. For example, Fr(P) is necessarily non-empty for any joint probability distribution P since there always exists a sparsest Markovian DAG. We say that a causal razor is always realizable if its associated [class] is never empty. Consequently, a causal razor is not always realizable if there exists a joint probability distribution that renders the associated [class] as empty. In other words, if a causal razor is not always realizable, it rules out certain joint probability distributions a priori as no DAG hypothesis satisfies the [property] relative to the distribution. Now we can demarcate the eleven causal razors regarding this property. Theorem 4.11. The following statements are true: (a) CMC, ori-faithfulness, SGS-minimality, P-minimality, and frugality are always realizable. (b) CFC, u-P-minimality, res-faithfulness, adj-faithfulness, tri-faithfulness, and u-frugality are not always realizable. Proof. For (a), OriF(P) is necessarily non-empty for any joint probability distribution P because a com- plete DAG contains no unshielded triple. The always-realizability of other causal razors in (a) is obvious. For (b), Example 4.4 is the case where TriF(P) = ∅. Example 4.5 shows the case where uFr(P) = ∅. The (cid:3) non-always-realizability of other causal razors in (b) follows from Theorem 4.1. We now generalize the results from [class]'s to [razor]'s in Table 1. Consider any pair of causal razors. Let r1(*) and r2(*) be their respective [class], and razor1 and razor2 be their respective [razor]. Logical strength of [razor]'s can then be formulated as follows: • razor1 is logically equivalent to razor2 if r1(P) = r2(P) for any joint probability distribution P. • razor1 is strictly stronger than razor2 if r1(P) ⊆ r2(P) holds for any joint probability distribution P, but r2(P′) \ r1(P′) , ∅ for some joint probability distribution P′. • razor1 is logically independent with razor2 if there exist two joint probability distribution P and P′ such that r2(P) \ r1(P) , ∅ and r1(P′) \ r2(P′) , ∅. 17 We visualize the logical hierarchy over the eleven structural causal razors in Figure 9. To simplify terms, we label each [razor] without the word "causal", "condition", or "assumption". Logically equivalent [razor]'s are collapsed into a single node. Each arrow indicates that the [razor] at the tail-node is strictly stronger than the [razor] at the head-node. Any two nodes not connected by a unidirectional path of arrows are logically independent. We end this section by noting the possibility of extending this comparative analysis. First, as mentioned earlier, we can incorporate the recently proposed causal razors to extend the list. Second, pairwise com- parisons are not limited to the study of subset relations. Zhalama et al. [2019] introduced the relation of conservative weakening to study how a weaker causal razor can be reasonably assumed when the stronger causal razor is satisfied.24 Thirdly, causal razors can be studied triple-wise. One instance is the result in [Zhang, 2013] that the conjunction of SGS-minimality and tri-faithfulness entails P-minimality. Hence, in- terested readers can elongate our comparative analysis above to an even fuller extent. In the next section, we stretch our current picture by introducing a causal razor of a different kind: parameter minimality. 5 Parameter Minimality This section particularly concerns a pair of causal razors defined in terms of the number of parameters of a causal model. Readers can quickly realize that the task of defining them is misaligned with the vague classification of causal razors in Section 3. First, they are not purely parametric since we need to make use of the graphical features of a given DAG G to compute |param(G)|. On the other hand, they are not purely structural in that one needs to specify the parametric assumption of the joint probability distribution to obtain param(G). This semi-structural property might plausibly explain why parameter minimality has not received much attention in the literature. Nevertheless, the number of parameters is a major metric in measuring statistical complexity of a model in most, if not all, modeling methods in statistics and computer science. Furthermore, this concept is tightly connected to causal search algorithms. For example, a consistent scoring criterion, as in [Haughton, 1988] and will be further discussed in the next section, is popularly utilized by researchers to evaluate how a DAG hypothesis fits a given observational dataset. In short, a consistent scoring criterion (e.g., Bayesian informa- tion criterion in [Schwarz, 1978]) demands that Markovian DAGs with fewer parameters should receive a higher score. So, it is not hard to see that causal razors defined by the number of parameters do have some reasonable ground. Without further ado, below are the formal definitions of parameter minimality and its unique variant. Definition 5.1. (Parameter minimality) For any joint probability distribution P, • [class] ParamM(P) := {G ∈ CMC(P) : ¬∃G′ ∈ CMC(P) s.t. |param(G′)| < |param(G)|}; • [property] a DAG G is param-minimal (to P) if G ∈ ParamM(P); • [razor] (G∗, P) satisfies the causal param-minimality assumption if G∗ ∈ ParamM(P). 24Using our language, if razor1 is strictly stronger than razor2, and r1(P) = r2(P) for any joint probability distribution P that razor1 is satisfied, then razor2 is a conservative weakening of razor1. For instance, frugality is a conservative weakening of u-frugality. 18 CFC/uPM ResF AdjF OriF uFr Fr PM SGSM TriF CMC CFC/uPM 4.3 4.6(b)† 4.5(e)† 4.4(a)† 4.5(a)† 4.5(a)† 4.5(a)† 4.5(b)† 4.5(a)† ResF 4.1 4.6(b)† 4.5(e)† 4.4(a)† 4.5(a)† 4.5(a)† 4.5(a)† 4.5(b)† 4.5(a)† AdjF 4.1 4.1 4.5(e)† 4.4(a)† 4.4(a)† 4.4(a)† 4.4(a)† 4.5(d) 4.4(a)† OriF 4.1 4.1 4.6(b) 4.6(a) 4.6(a)† 4.6(a)† 4.6(a)† 4.6(b)† 4.6(a)† uFr 4.1 4.1 4.7 4.5(c) 4.5(a) 4.5(a)† 4.5(a)† 4.5(b) 4.5(a)† Fr 4.1 4.1 4.1 4.9(a)† 3.7 4.6(c) 4.6(c)† 4.9(b)† 4.6(c)† PM 4.1 4.1 4.1 4.9(a)† 4.1 4.1 4.8(b) 4.9(b)† 4.6(a)† SGSM 4.1 4.1 4.1 4.9(a) 4.1 4.1 4.1 4.9(b) 4.8(a) TriF 4.1 4.1 4.1 4.5(e) 4.4(a) 4.4(a)† 4.4(a)† 4.4(a)† 4.4(a)† CMC 3.2 3.5 3.3 3.4 3.7 3.6 3.9 3.8 3.11 Table 1: Pairwise comparisons of [class]'s from eleven structural causal razors. Each cell concerns whether the [class] in the row is a subset of the [class] in the column. Cells on the diagonal are filled with black to indicate their trivial truth. Cells filled with cyan indicate that the subset relation is true either by Theorem 4.1 or by definition. Cells filled with magenta refer to the counterexample of the subset relation in Example 4.3 - 4.9. The superscript † indicates an application of Fact 4.10 with Theorem 4.1. faithfulness u-P-minimality res-faithfulness • • adj-faithfulness tri-faithfulness • • not always realizable always realizable • ori-faithfulness • u-frugality • frugality • P-minimality • SGS-minimality Markov • Figure 9: Logical hierarchy of the eleven structural causal razors 19 Definition 5.2. (Unique parameter minimality) For any joint probability distribution P, • [class] uParamM(P) := if all DAGs in ParamM(P) belong to the same MEC otherwise; • [property] a DAG G is u-param-minimal (to P) if G ∈ uParamM(P); ParamM(P)  ∅   • [razor] (G∗, P) satisfies the causal u-param-minimality assumption if G∗ ∈ uParamM(P). With a closer look, readers can easily observe the affinity of these two causal razors with frugality and u-frugality defined in Section 3. They are similar in every aspect except that the pair above is defined in terms of number of parameters instead of number of edges. For linear Gaussian causal models, the difference between the two notions dissipates due to the equality |param(G)| = |E(G)| for any DAG G . But the equality fails in the context of multinomial causal models. By focusing only on multinomial causal models, how do param-minimality and its unique variant relate to the other causal razors discussed in Section 3? We first show some positive claims regarding the subset relations of their [class]'s. In particular, we are going to utilize the famous result in [Chickering, 1995] and [Chickering, 2002] related to covered edge reversals to show that ParamM(P) ⊆ PM(P) for any joint multinomial distribution P. Theorem 5.3. For any joint multinomial distribution P, ParamM(P) ⊆ PM(P) holds. Proof. See Appendix C. (cid:3) By CFC(P) = uPM(P) in Theorem 4.2, one can easily derive that CFC(P) ⊆ uParamM(P). Nonethe- less, a more interesting question is whether the stronger claim ResF(P) ⊆ uParamM(P) holds. We prove the truth of this claim by utilizing the concept parameterizing sets from [Hemmecke et al., 2012]. In short, we show that a restricted-faithful DAG must have a minimal set of parameterizing sets, and it necessitates that the number of parameters for that DAG is the smallest over all Markovian DAGs. Theorem 5.4. For any joint multinomial distribution P, ResF(P) ⊆ uParamM(P) holds. Proof. See Appendix D. (cid:3) Corollary 5.5. For any joint multinomial distribution P, the following statement is true: CFC(P) ⊆ ResF(P) = AdjF(P) ∩ OriF(P) ⊆ uParamM(P) ⊆ ParamM(P) ⊆ PM(P) ⊆ SGSM(P) ⊆ CMC(P). So much for the positive results. We now turn to some counterexamples of each subset relation r1(*) ⊆ r2(*) where one of r1 and r2 is the [class] of (u-)param-minimality. Each counterexample is from the last section where no parametric assumption was involved. Due to the current context, we need to specify how the underlying multinomial distribution can be constructed parametrically. To simplify our exposition, we leave all construction details in Appendix E. Example 5.6. There exists a joint multinomial distribution P such that AdjF(P) \ ParamM(P) , ∅. 20 [Same as Example 4.7 with Figure 7. See Appendix E.1 for details.] First, G1 ∈ AdjF(P) clearly holds. Given that V is ranged from h2, 3, 2i, we have |param(G0)| = 8 > 10 = (cid:3) |param(G1)| such that G1 < ParamM(P). Example 5.7. There exists a joint multinomial distribution P such that (a) ParamM(P) \ uParamM(P) , ∅; (b) TriF(P) \ uParamM(P) , ∅; (c) OriF(P) \ uParamM(P) , ∅. [Same as Example 4.5 with Figure 5. See Appendix E.2 for details.] As specified in the construction, V is ranged from h2, 2, 2, 3i. We have |param(G∗)| = |param(G′)| = 13. Readers can verify that G∗, G′ ∈ ParamM(P). Thus, uParamM(P) = ∅. As explained in Example 4.5, we (cid:3) also have G∗ ∈ OriF(P) ∩ TriF(P). Corollary 5.8. u-param-minimality is not always realizable. Example 5.9. There exists a joint multinomial distribution P such that (a) uParamM(P) \ OriF(P) , ∅; (b) PM(P) \ ParamM(P) , ∅. [Same as Example 4.6 with Figure 6. See Appendix E.3 for details.] Consider the case that every variable in V is binary. Readers can verify that G∗ ∈ uParamM(P) (where |param(G∗)| = 9) and G′ < ParamM(P) (where |param(G′)| = 13). See Example 4.6 for an explanation of (cid:3) G∗ < OriF(P) and G′ ∈ PM(P). Example 5.10. There exists a joint multinomial distribution P such that (a) uParamM(P) \ TriF(P) , ∅; (b) uFr(P) \ ParamM(P) , ∅; (c) uParamM(P) \ Fr(P) , ∅. [Similar to Example 4.4. See Appendix E.4 for details.] Consider G0 and G1 in Figure 10 that are both Markovian to P. As specified by the construction,V is ranged from h2, 2, 2, 2, 3i. As explained in Example 4.4, we know that G0 ∈ uFr(P). However, we have |param(G0)| = 37 < 35 = |param(G1)|. Indeed, readers can verify that uParamM(P) = {G1}. Hence, G0 ∈ uFr(P) \ ParamM(P) whereas G1 ∈ uParamM(P) \ Fr(P). Lastly, G1 < TriF(P) because of the (cid:3) triangle (3, 5, 4) in G′ and hX3, X4i ∈ ΨG1,P. Table 2 and 11 extend the results in Section 4 by incorporating param-minimality and u-param-minimality in the multinomial context. Particularly, the disagreement between (u-)frugality and (u-)param-minimality uncovers a quandary in causal search algorithms: should one count edges or parameters to score a DAG? This methodological problem will be studied in the next section. 21 1 5 2 G0 4 3 1 5 2 G1 4 3 Figure 10: G0 is u-frugal but not param-minimal, whereas G1 is u-param-minimal but not frugal. 6 Algorithmic Implications The comparative analysis presented in the last section demonstrated how the logical strength of numerous causal razors can be systematically arranged into a logical hierarchy. Certain readers, nevertheless, may dismiss this logical project as purely abstract which yields no substantial implication to developers or users of causal search algorithms. This section demonstrates how this viewpoint can be repudiated. First, recall Theorem 4.2 proven by Lam et al. [2022] that CFC and u-P-minimality are logically equiv- alent. This logical discovery entails that certain causal search algorithms inevitably face a problem of P- minimal local optimum. More specifically, when there is a detectable violation of CFC (i.e., CFC(P) = ∅), there must be at least two P-minimal DAGs that are not Markov equivalent. Suppose that G0 is a P-minimal DAG that is particularly favorable by a pre-selected criterion (e.g., frugality). In that case, if a causal search algorithm merely aims at a certain P-minimal DAG (or the MEC of a P-minimal DAG), it may return a P-minimal DAG G1 (or MEC(G1)) which is sub-optimal according to the pre-selected criterion (e.g., G1 is denser than G0). In this case, the algorithm is said to be trapped by a P-minimal local optimum. One instance of such algorithm is the TSP algorithm recently proposed by Solus et al. [2021]. In short, TSP performs a greedy search (using the Chickering algorithm in [Chickering, 2002]) from a DAG induced by an arbitrarily chosen initial permutation of the vertices. They argued that TSP can correctly identify the sparsest DAG even without CFC. Unfortunately, their claim is false because the initial permutation chosen can induce a sub-optimal P-minimal DAG (i.e., not the sparsest). In other words, CFC is necessary for the correctness of TSP.25 This verifies that a careful comparative analysis of causal razors can assist developers of causal search algorithms to identify the limitation of their work. In addition, the equivalence between CFC and u-P-minimality implicates a knotty question for re- searchers in causal discovery. Suppose that P-minimality, as suggested by Zhang [2013], is a reasonably safe assumption to be made about the true causal mechanism. Again, when CFC fails detectably, we are left with at least two P-minimal DAGs that are not Markov equivalent. So, is there any principled reason that renders a (set of) P-minimal DAG(s) preferred to the rest? One natural approach to tackling this problem is to appeal to a causal razor stronger than P-minimality and potentially shrink the hypothesis space. This approach can be pictorially understood as ascending the hierarchy in Figure 11. The figure indicates two candidates that are immediately stronger than P-minimality: frugality and param-minimality. As proven in the last section, though the two principles always resort to the same set of DAGs for linear Gaussian models, they can diverge for multinomial models. Recall Example 5.10 (with Figure 10) where both G0 and G1 are P-minimal. Frugality prefers G0 for its sparsity, whereas param-minimality prefers G1 for its fewest parameters. The logical independence between the two causal razors unveils a dilemma when implementing causal search algorithms, particular the score-based species which aim to identify the best-scoring DAG. Given an observational dataset D, a score-based causal search algorithm with a pre-selected scoring criterion aims to return a DAG, or a class of DAGs, that has the highest score with respect to D. As readers can expect, a scoring criterion respecting frugality (i.e., by preferring sparser Markovian models) can make a different 25See [Lam et al., 2022] for a more detailed analysis of how faithfulness is necessary and sufficient for the correctness of TSP. 22 CFC/uPM ResF AdjF OriF uFr Fr uParamM ParamM PM SGSM TriF CMC CFC/uPM 4.3 4.6(b)† 4.5(e)† 4.4(a)† 4.5(a)† 5.10(a)† 5.10(a)† 4.5(a)† 4.5(a)† 4.5(b)† 4.5(a)† ResF 4.1 4.6(b)† 4.5(e)† 4.4(a)† 4.5(a)† 5.10(a)† 5.10(a)† 4.5(a)† 4.5(a)† 4.5(b)† 4.5(a)† AdjF 4.1 4.1 4.5(e)† 4.4(a)† 4.4(a)† 5.10(a)† 5.10(a)† 4.4(a)† 4.4(a)† 4.5(d) 4.4(a)† OriF 4.1 4.1 4.6(b) 4.6(a) 4.6(a)† 5.9(a) 5.9(a) 4.6(a)† 4.6(a)† 4.6(b)† 4.6(a)† uFr 4.1 4.1 4.7 4.5(c) 4.5(a) 5.10(c)† 5.10(c)† 4.5(a)† 4.5(a)† 4.5(b) 4.5(a)† Fr 4.1 4.1 4.1 4.9(a)† 3.7 5.10(c) 5.10(c)† 4.6(c) 4.6(c)† 4.9(b)† 4.6(c)† uParamM ParamM 5.5 5.5 5.6(a)† 4.9(a)† 5.10(b)† 5.10(b)† 5.7(a) 5.9(b)† 5.9(b)† 5.7(b) 5.9(b)† 5.5 5.5 5.6(a) 4.9(a)† 5.10(b) 5.10(b)† 5.2 5.9(b) 5.9(b)† 4.9(b)† 5.9(b)† PM 4.1 4.1 4.1 4.9(a)† 4.1 4.1 5.5 5.5 4.8(b) 4.9(b)† 4.6(a)† SGSM 4.1 4.1 4.1 4.9(a) 4.1 4.1 5.5 5.5 4.1 4.9(b) 4.8(a) TriF 4.1 4.1 4.1 4.5(e) 4.4(a) 4.4(a)† 5.10(a) 5.10(a)† 4.4† 4.4(a)† 4.4(a)† CMC 3.2 3.5 3.3 3.4 3.7 3.6 5.2 5.1 3.9 3.8 3.11 Table 2: Pairwise comparisons of [class]'s from thirteen causal razors. ParamM and uParamM are defined for multinomial causal models. See the caption of Table 1 for the coloring convention. The superscript † indicates an application of Fact 4.10 with Corollary 5.5 or Theorem 4.1. faithfulness u-P-minimality res-faithfulness • • adj-faithfulness • tri-faithfulness • • u-frugality • u-param-minimality • frugality • param-minimality not always realizable always realizable • ori-faithfulness • P-minimality • SGS-minimality Markov • Figure 11: Logical hierarchy of causal razors with (u-)param-minimality defined for multinomial causal models. 23 judgment compared to one that respects param-minimality (i.e., by preferring Markovian models with fewer parameters). Thus, the theoretical choice between the two causal razors is now reduced to an algorithmic decision. This further verifies that the logical analysis of causal razors is not purely abstract but also gives rise to a practical dilemma. Let us delve deeper into the discussion of scoring criteria. First, we assume that every concerned ob- servational dataset D henceforth consists of n independent and identically distributed (i.i.d.) samples over a set of variables V following a joint probability distribution P. We sometimes write DP to signify that D is sampled from P. Given that this section is primarily studied in the context of large sample theory, we assume that n approaches infinity for the time being. One scoring criterion that aligns with the essence of frugality is the negative edge count that is used to establish the different varieties of the SP algorithm in Raskutti and Uhler [2018] and Solus et al. [2021]. Formally speaking, given an observational dataset DP over V, the negative edge count of a DAG G ∈ DAG(v) is:26 NEC(G, DP) := −|E(G)| −∞ if G ∈ CMC(P) otherwise.    Evidently, NEC is in line with frugality where the sparsest DAGs must have the highest score. On the other hand, one of the most popular scoring criteria in the literature is the Bayesian information criterion (BIC), originated by Schwarz [1978], which aims to approximate the marginal log-likelihood of a DAG. Definition 6.1. (BIC score) Given an observational dataset D with n i.i.d. observations from a joint proba- bility distribution P over V that belongs to a curved exponential family27, for X ∈ V and S ⊆ V \ {X}, BIC(X, S, DP) = 2 l(ˆθX | S ; DP) − c |ˆθX | S| log(n) (7) where l is the log-likelihood function, ˆθX | S is the maximum likelihood estimator (MLE) of X conditioning on S, and c > 0 is the multiplier for the parameter penalty (which is set to be 1 unless specified otherwise). Also, BIC is a decomposable scoring function such that the score of G ∈ DAG(v), denoted BIC(G, DP), satisfies the following: BIC(G, DP) = BIC(Xi, Xpa(i,G), DP) = Xi∈v Xi∈v 2 l(ˆθXi | Xpa(i,G); DP) − c |ˆθXi | Xpa(i,G)| log(n) = 2 l(ˆθG; DP) − c |ˆθG| log(n) (8) where ˆθG is the set of estimated independent parameters of G and l(ˆθG; DP) is the maximum log-likelihood estimator (MLLE) of G. By this formulation, when considering BIC(Xi, Xpa(i,G), DP) for any vertex i ∈ v and any G ∈ DAG(v), the MLE ˆθXi | Xpa(i,G) is the estimation of θi,G, that is, the set of parameters needed to compute P(Xi | Xpa(i,G)). Accordingly, ˆθG is the estimation of θG by assuming that the parameters in the latter are independent of one another. As proven by Haughton [1988], a nice feature that BIC possesses is that it is consistent for distributions belonging to the curved exponential families, including linear Gaussian and multinomial distributions.28 26The original definition of negative edge count in Solus et al. [2021] concerns an independence model I(P) instead of a dataset with the distribution P. However, this difference in formulation draws no loss of generality due to our assumption that DP follows the distribution P asymptotically. 27See [Kass and Vos, 2011] for an in-depth analysis of curved exponential families. 28See Kass and Vos [2011] for a more detailed investigation of curved exponential family of statistical models. 24 Definition 6.2. (Consistent scoring criterion) Given an observational dataset D with n i.i.d. observations from a joint probability distribution P over V, a scoring criterion score is consistent if the following two properties hold for any G, H ∈ DAG(v) in the large sample limit of n: (a) if G ∈ CMC(P) and H < CMC(P), then score(G, D) > score(H, D); (b) if G, H ∈ CMC(P), and |param(G)| < |param(H)|, then score(G, D) > score(H, D). Theorem 6.3. [Haughton, 1988; Chickering, 2002] BIC is a consistent scoring criterion for joint probabil- ity distributions belonging to the curved exponential families. The second condition in Definition 6.2 aligns well with the concept of param-minimality. When a DAG G is param-minimal, all consistent scoring criteria, including BIC, will unanimously judge that G has the highest score over all DAGs. The prominent Greedy Equivalence Search (GES) algorithm from Chickering [2002] is a classical score-based algorithm that utilizes BIC. One can easily verify that NEC satisfies only the first condition of Definition 6.2 but not the second. Consider Example 5.10 again. We have NEC(G0, DP) = −5 > −6 = NEC(G1, DP) while |param(G0)| = 37 > 35 = |param(G1)| (where P is a multinomial distribution as constructed in Appendix E.4. This demonstrates that negative edge count is not a consistent scoring criterion (for multinomial distributions). Now imagine that you are going to deploy a score-based algorithm on an observational dataset DP where ParamM(P) , Fr(P) like that in Example 5.10. Should you select NEC or BIC as your scoring criterion used by the algorithm? Your answer to this question reflects your preference for a specific methodological causal razor. For instance, due to the wide usage of BIC, it is unsurprising to see statisticians and computer scientists inclined to adopt param-minimality. Generally speaking, a param-minimal hypothesis can avoid the problem of overfitting in finite samples better than the non-param-minimal ones.29 Following this line of thought, a consistent scoring criterion is preferred to its inconsistent alternatives. Also, perhaps edge count can be interpreted as a shorthand for counting parameters in some special cases like linear Gaussian models. But this shorthand is not generally applicable, like for multinomial models. Still, the argument above merely suggests that a consistent scoring criterion should be preferred when the desideratum is to solve a specific problem (e.g., overfitting). It does not imply that NEC is methodologically inferior to a consistent scoring criterion in nature. Indeed, it is not hard to propose a different desideratum that favors NEC over BIC. For example, counting edges is clearly much more computationally efficient than computing BIC. When the computational resource is lacking, researchers can justifiably embrace frugality as a methodological principle and use NEC. In addition, how about the non-parametric cases where the underlying joint distribution of the data cannot be represented parametrically? In those cases, the distribution may not belong to the exponential curved family and we have no consistency result like Theorem 6.3. Still, one can employ non-parametric CI tests (e.g., KCIT from [Strobl et al., 2019]) to construct a DAG, and then use NEC to score DAGs. So NEC can be viewed as a more general scoring criterion that does not commit to any parametric assumption. Incidentally, one may suggest looking at the dilemma from a descriptive perspective by inquiring how the simplicity of causal hypotheses is perceived by human beings psychologically. This may hopefully shed some light on which principle comes with a greater naturalistic flavor. Multiple experimental research in psychology, including [Bonawitz and Lombrozo, 2011] and [Lombrozo, 2012], find positive evidence that people identify simplicity as the number of causes invoked in a causal explanation.30 When expressed more formally, counting causes can be reduced to counting edges in DAGs. On the contrary, Blanchard et al. 29As argued by MacKay [1992], a complex hypothesis (i.e., with more parameters) tends to have a lower marginal likelihood and thus is easier to overfit the training data compared to a simpler hypothesis. 30In addition, Pacer and Lombrozo [2017] compare the node simplicity (i.e., the number of causes involved in an explanation) with root simplicity (i.e., the number of causes left unexplained in an explanation), and observe that explanatory preferences track the latter. 25 [2018] provided evidence that people's judgments of simplicity in causal explanations are consistent with the behavior of penalizing free parameters in a hypothesis. Apparently, we have limited descriptive results to solve the methodological dilemma. Lastly, from an epistemic point of view, one can question whether frugality or param-minimality is more likely to converge to the truth. Forster et al. [2020] provides an argument for frugality by arguing that frugal DAGs entail the greatest number of basic CIs.31 However, their argument implicitly assumes an equal weighting of all basic CIs. This assumption is questionable in the multinomial context because each CI can be decomposed into probabilistic equalities, and different CIs can be associated with a different number of probabilistic equalities.32 Lam [2023] showed that a param-minimal DAG must be associated with the greatest number of basic probabilistic equalities (i.e., probabilistic equalities of the basic CIs). On the other hand, the author also provided a Bayesian justification for the principle of param-minimality. Instead of targeting an absolute judgment, this work embraces a rather flexible methodological attitude on the preference of scoring criteria. The interest and desideratum at stake can vastly influence the choice of an appropriate scoring criterion on a case-by-case basis. But, most importantly, algorithm developers and users should be aware of the fact that their choices are subtly tied to a methodological preference of causal razors. A more philosophical comparison between frugality and param-minimality will be explored in a future work. 7 Discussions Causal discovery cannot be done without making assumptions on how the true causal mechanism relates to the underlying joint probability distribution. We studied these assumptions under the generic term causal razors in this work. Many causal razors discussed in the literature are structural in the sense that they are de- fined independent of any algorithmic or parametric assumption, including the causal faithfulness condition and the causal frugality assumption. We initiate a different kind of causal razors that are not purely struc- tural, namely causal parameter minimality condition. We provided a comprehensive logical comparisons of thirteen causal razors in the context of multinomial causal models, and observed that frugality and parame- ter minimality are logically independent despite their similarity. This raises algorithmic concerns on which causal razor should be assumed, methodologically or ontologically, when performing causal discovery. Below we briefly lay out a number of directions to stretch the study of causal razors. First, we can extend the list of structural causal razors. Recent works like [Ng et al., 2021] and [Zhalama et al., 2019] have proposed some new candidates. Also, in light of the use of parameterizing sets in Appendix D, one can define a structural causal razor restricted to the set-theoretic minimal class of parameterizing sets. Stimulated by the proof in Lemma D.5, we conjecture that this new causal razor logically lies between restricted faithfulness and parameter minimality for multinomial causal models. Second, we did not discuss any algorithmic causal razor in this work. The ESP assumption and GRaSP- razors in Solus et al. [2021] and Lam et al. [2022] respectively discuss how these algorithmic causal razors are strictly weaker than faithfulness. It will be interesting to see how they relate to the ones surveyed in this work. Also, we have only inspected parameter minimality (and its unique variant) in the context of linear Gaussian and multinomial causal models. It is unclear how parameter-minimality and frugality are related under other parametric assumptions (e.g., conditional Gaussian distributions). 31The set of basic CIs entailed by a DAG can be easily obtained by the ordered Markov condition. In short, given a topological order π of G, the set of basic CIs of G is {hXi, X j | Xpa(i,G)i : i ∈ v and j precedes i in π and j < pa(i, G)}. See [Lauritzen, 2019] for a more formal definition of the condition. 32For instance, suppose that X1, X2, and X3 are all binary. Then hX1, X2 | {X3}i ∈ I(P) can be further decomposed into two probabilistic equalities: P(X1 = 0 | X2 = 0, X3 = 0) = P(X1 = 0 | X2 = 1, X3 = 0) and P(X1 = 0 | X2 = 0, X3 = 1) = P(X1 = 0 | X2 = 1, X3 = 1). On the contrary, there is only one probabilistic equality associated with the marginal independence hX1, X2i ∈ I(P): P(X1 = 0 | X2 = 0) = P(X1 = 0 | X1 = 1). 26 Third, the choice of causal razors to be assumed can be assessed with computational concerns in practice. Even though it is always safer to assume weaker, weakening faithfulness is accompanied by an algorithmic trade-off. Consider GES which assumes faithfulness. Despite the frequent violations of faithfulness, GES is favored by researchers for its computational efficiency and scalability. As experimented in Ramsey et al. [2017], some version of GES can even scale up to a million variables. By assuming u-frugality, contrar- ily, the SP algorithm from Raskutti and Uhler [2018] can hardly handle cases with more than 10 variables. Greedy versions of SP have been pursued by Lam et al. [2022] and Solus et al. [2021], but their scalability is nowhere close to that of GES. This demonstrates how practical concerns can outweigh theoretical cor- rectness when researchers decide which causal razor to be assumed. To abridge the gap between these two factors, a fast and scalable weaker-than-faithfulness algorithm is highly desirable. Fourth, the comparative analysis of causal razors in this work can be studied in terms of simulations. For example, how often do we observe almost violations of, say, frugality and parameter minimality (and their unique variants)? If parameter minimality and frugality rarely disagree at the sample level, the choice of which causal razor to be assumed, and the choice between negative edge count and a consistent scoring criterion, will be unsubstantial when implementing causal search algorithms on finite samples. To answer this question, a comprehensive simulation study is required to verify how frequent a causal razor can be almost violated. Lastly, all causal razors discussed in this work are defined over DAGs such that the analysis is subsumed under the framework of causal sufficiency, that is, no latent variables in the true causal model. However, by replacing the d-separations with m-separations in [Richardson and Spirtes, 2002], all of our discussed structural causal razors can be defined in terms of maximal ancestral graphs (MAGs) that handle latent variables. By adopting the technique of parameterizing acyclic directed mixed graphs (ADMGs), one can also effectively enumerate the number of parameters in a MAG (in the multinomial context). Accordingly, it is reasonable to expect that all of our logical results can be extended to the causally insufficient framework. References Andersen, H. (2013). When to expect violations of causal faithfulness and why it matters. Philosophy of Science, 80(5):672–683. Andrews, B., Cooper, G. F., Richardson, T. S., and Spirtes, P. (2022). The m-connecting imset and factor- ization for admg models. Blanchard, T., Lombrozo, T., and Nichols, S. (2018). Bayesian occam's razor is a razor of the people. Cognitive Science, 42(4):1345–1359. Bonawitz, E. and Lombrozo, T. (2011). Occam's rattle: Children's use of simplicity and probability to constrain inference. Developmental psychology, 48:1156–64. Chickering, D. M. (1995). A transformational characterization of equivalent Bayesian network structures. In Proceedings of the Conference on Uncertainty in Artificial Intelligence, page 87–98, San Francisco, CA, USA. Morgan Kaufmann Publishers Inc. Chickering, D. M. (2002). Optimal structure identification with greedy search. Journal of machine learning research, 3:507–554. Evans, R. J. and Richardson, T. S. (2014). Markovian acyclic directed mixed graphs for discrete data. The Annals of Statistics, 42(4):1452–1482. 27 Forster, M., Raskutti, G., Stern, R., and Weinberger, N. (2020). The frugal inference of causal relations. The British Journal for the Philosophy of Science. Haughton, D. M. (1988). On the choice of a model to fit data from an exponential family. The annals of statistics, pages 342–355. Hemmecke, R., Lindner, S., and Studen ́y, M. (2012). Characteristic imsets for learning bayesian network structure. International Journal of Approximate Reasoning, 53(9):1336–1349. Fifth European Workshop on Probabilistic Graphical Models (PGM-2010). Kalisch, M. and B ̈uhlmann, P. (2007). Estimating high-dimensional directed acyclic graphs with the pc- algorithm. Journal of Machine Learning Research, 8(22):613–636. Kass, R. E. and Vos, P. W. (2011). Geometrical Foundations of Asymptotic Inference. John Wiley & Sons, Hoboken, NJ. Lam, W.-Y. (2023). Causal Razors and Causal Search Algorithms. PhD thesis, Carnegie Mellon University. Lam, W.-Y., Andrews, B., and Ramsey, J. (2022). Greedy relaxations of the sparsest permutation algorithm. In Cussens, J. and Zhang, K., editors, Proceedings of the Thirty-Eighth Conference on Uncertainty in Artificial Intelligence, volume 180 of Proceedings of Machine Learning Research, pages 1052–1062. PMLR. Lauritzen, S. L. (2019). Lectures on graphical models. Lin, H. and Zhang, J. (2020). On learning causal structures from non-experimental data without any faith- In Kontorovich, A. and Neu, G., editors, Proceedings of the 31st International fulness assumption. Conference on Algorithmic Learning Theory, volume 117 of Proceedings of Machine Learning Research, pages 554–582. PMLR. Lombrozo, T. (2012). Explanation and abductive inference. Oxford Handbook of Thinking and Reasoning, pages 260–276. MacKay, D. J. C. (1992). Bayesian interpolation. Neural Computation, 4(3):415–447. Meek, C. (1995). Causal inference and causal explanation with background knowledge. In UAI. Ng, I., Zheng, Y., Zhang, J., and Zhang, K. (2021). Reliable causal discovery with improved exact search and weaker assumptions. In Ranzato, M., Beygelzimer, A., Dauphin, Y., Liang, P., and Vaughan, J. W., editors, Advances in Neural Information Processing Systems, volume 34, pages 20308–20320. Curran Associates, Inc. Pacer, M. and Lombrozo, T. (2017). Ockham's razor cuts to the root: Simplicity in causal explanation. Journal of Experimental Psychology: General, 146(12):1761. Pearl, J. (1988). Probabilistic Reasoning in Intelligent Systems: Networks of Plausible Inference. Morgan Kaufmann Publishers Inc. Pearl, J. (2009). Causality: Models, Reasoning and Inference. Cambridge University Press, USA, 2nd edition. Ramsey, J., Zhang, J., and Spirtes, P. (2006). Adjacency-faithfulness and conservative causal inference. In Proceedings of the conference on Uncertainty in artificial intelligence, pages 401–408. 28 Ramsey, J. D., Glymour, M., Sanchez-Romero, R., and Glymour, C. (2017). A million variables and more: the fast greedy equivalence search algorithm for learning high-dimensional graphical causal models, with an application to functional magnetic resonance images. Int. J. Data Sci. Anal., 3(2):121–129. Raskutti, G. and Uhler, C. (2018). Learning directed acyclic graph models based on sparsest permutations. Stat, 7. Reichenbach, H. (1956). The Direction of Time. Mineola, N.Y.: Dover Publications. Richardson, T. and Spirtes, P. (2002). Ancestral graph markov models. The Annals of Statistics, 30(4):962– 1030. Schwarz, G. (1978). Estimating the dimension of a model. The annals of statistics, pages 461–464. Shimizu, S., Hoyer, P. O., Hyv ̈arinen, A., Kerminen, A., and Jordan, M. (2006). A linear non-gaussian acyclic model for causal discovery. Journal of Machine Learning Research, 7(10). Solus, L., Wang, Y., and Uhler, C. (2021). Consistency guarantees for greedy permutation-based causal inference algorithms. Biometrika, 108:795–814. Spirtes, P. and Glymour, C. (1991). An algorithm for fast recovery of sparse causal graphs. Social science computer review, 9(1):62–72. Spirtes, P., Glymour, C., and Scheines, R. (2000). Causation, Prediction, and Search. MIT press. Spirtes, P. and Zhang, J. (2015). A uniformly consistent estimator of causal effects under the k-triangle- faithfulness assumption. Statistical Science, 29. Strobl, E. V., Zhang, K., and Visweswaran, S. (2019). Approximate kernel-based conditional independence tests for fast non-parametric causal discovery. Journal of Causal Inference, 7(1):20180017. Studen ́y, M. (2005). Probabilistic Conditional Independence Structures. Information Science and Statistics. Springer. Uhler, C., Raskutti, G., B ̈uhlmann, P., and Yu, B. (2013). Geometry of the faithfulness assumption in causal inference. The Annals of Statistics, pages 436–463. Verma, T. and Pearl, J. (1988). Causal networks: semantics and expressiveness. In Proceedings of the Conference on Uncertainty in Artificial Intelligence, pages 69–78. Verma, T. and Pearl, J. (1990). Equivalence and synthesis of causal models. Probabilistic and Causal Inference. Weinberger, N. (2017). Faithfulness, coordination, and causal coincidences. Erkenntnis. Woodward, J. (2021). Causation with a Human Face: Normative Theory and Descriptive Psychology. Oxford University Press. Zhalama, Zhang, J., Eberhardt, F., Mayer, W., and Li, M. J. (2019). Asp-based discovery of semi-markovian causal models under weaker assumptions. Zhang, J. (2013). A comparison of three Occam's razors for Markovian causal models. The British journal for the philosophy of science, 64:423–448. 29 Zhang, J. and Spirtes, P. (2008). Detection of unfaithfulness and robust causal inference. Minds and Ma- chines, 18(2):239–271. Zhang, J. and Spirtes, P. (2011). Intervention, determinism, and the causal minimality condition. Synthese, 182:335–347. 30 A Graphoid Axioms Consider any pairwise disjoint sets of variables W, X, Y, and Z. X ⊥⊥ Y | Z ⇒ Y ⊥⊥ X | Z X ⊥⊥ Y ∪ W | Z ⇒ X ⊥⊥ Y | Z X ⊥⊥ Y ∪ W | Z ⇒ X ⊥⊥ Y | Z ∪ W (X ⊥⊥ Y | Z) ∧ (X ⊥⊥ W | Z ∪ Y) ⇒ X ⊥⊥ Y ∪ W | Z (X ⊥⊥ Y | Z ∪ W) ∧ (X ⊥⊥ W | Z ∪ Y) ⇒ X ⊥⊥ Y ∪ W | Z (X ⊥⊥ Y | Z) ∧ (X ⊥⊥ W | Z) ⇒ X ⊥⊥ Y ∪ W | Z (symmetry) (decomposition) (weak union) (contraction) (intersection) (composition) A distribution P is a semigraphoid if I(P) is closed under symmetry, decomposition, weak union, and con- traction. A semigraphoid P is a graphoid if I(P) is closed under intersection. A graphoid P is compositional if I(P) is closed under composition. Every joint probability distribution P is a semigraphoid. Every strictly positive distribution is a graphoid, and every linear Gaussian distribution is a compositional graphoid. See [Studen ́y, 2005, Chapter 2] for a more comprehensive study of graphoid axioms. In addition, applications of symmetry in our upcoming proofs will be performed implicitly. 31 B Proof of Theorem 4.2 Lemma B.1. Lam et al. [2022] Given a joint probability distribution P over V, for any hXi, X j | Xsi ∈ I(P), there exists G ∈ DAG(v) s.t. I(G) = {hXi, X j | Xsi}. Proof. Suppose that V consists of m variables such that v = {1, ..., m} where m ≥ 2. When m = 2, an empty DAG will suffice to prove the lemma. Now consider the case where m ≥ 3. Suppose that hXi, X j | Xsi ∈ I(P) for some distinct i, j ∈ v and s ⊆ v \ {i, j}. Without loss of generality, we relabel the indices such that i = 1, j = k + 2 and s = h2, ..., k + 1i where v \ s = hk + 3, ..., mi. Now consider the following algorithm which aims to construct the desired G ∈ DAG(v). 1 G ← a complete undirected graph over v 2 remove the adjacency (1, k + 2) ∈ sk(G) 3 foreach ( j, k) ∈ sk(G) do 4 if j < k then 5 orient j → k in G 6 return G Line 3 to 5 guarantee that G is a DAG. This is because all edges are directed and pointing from lower in- dices to higher indices such that no directed cycle can be induced. Finally, 1 ⊥G k + 2 | s holds since all directed paths from 1 to k + 2 either contain a non-collider i ∈ s or contain a collider i < s. Therefore, (cid:3) I(G) = {hX1, Xk+2 | Xs)} because no other d-separation relations hold in G. Theorem 4.2. Lam et al. [2022] For any joint probability distribution P, CFC(P) = uPM(P). Proof. [⊆] Suppose that G ∈ CFC(P). It follows from Theorem 4.1(a) that G ∈ PM(P). For any G′ ∈ CMC(P), if I(G′) ⊂ I(G), then G′ < PM(P). Hence, if G′ ∈ PM(P), then I(G′) = I(G). Hence, G ∈ uPM(P). [⊇] Suppose that G < CFC(P). Given that uPM(P) ⊆ PM(P) by Definition 3.9, we have G < uPM(P) immediately if G < PM(P). Consider the case where G ∈ PM(P). It follows from G < CFC(P) that ΨG,P , ∅. Consider any unfaithful CI ψ ∈ ΨG,P. By Lemma B.1, we can construct a DAG G′ such that I(G′) = {ψ}. Consequently, there exists G′′ ∈ PM(P) such that I(G′) ⊆ I(G′′) ⊆ I(P). From ψ ∈ I(G′′) but (cid:3) ψ < I(G), it follows that G′′ < MEC(G). Therefore, we have G < uPM(P) from G, G′′ ∈ PM(P). 32 C Proof of Theorem 5.3 We are going to make use of the famous results in [Chickering, 1995] and [Chickering, 2002] related to covered edge reversals to show that ParamM(P) ⊆ PM(P) for any joint multinomial distribution P. To be precise, for any DAG G, a directed edge j → k ∈ E(G) is a covered edge if pa( j, G) = pa(k, G) \ { j}. Theorem C.1. Chickering [1995] Given a set of variables V, consider any pair of DAGs G, H ∈ DAG(v) where H ∈ MEC(G), and for which there are k edges in G that have opposite orientation in H. Then there exists a sequence of k distinct covered edge reversals in G s.t. G becomes H after all reversals. Theorem C.2. Chickering [2002] Given a set of variables V, for every pair of DAGs G, H ∈ DAG(v), if I(H) ⊆ I(G), there exists a sequence of DAGs, call it a Chickering sequence hH = G1, G2, ..., Gk = Gi (from H to G) s.t. I(Gi) ⊆ I(Gi+1) and Gi+1 is obtained from Gi by either reversing a covered edge or deleting a directed edge for each 1 ≤ i < k. Lemma C.3. Given a joint multinomial distribution P over V, consider any pair of DAGs G, G′ ∈ DAG(v) where G′ ∈ MEC(G). Then param(G) = param(G′). Proof. Due to Theorem C.1, it suffices to show that the number of parameters remains unchanged after the reversal of a covered edge. Suppose that G and G′ in DAG(v) differ by reversing exactly one covered edge such that E(G′) = (E(G) \ {i → j}) ∪ { j → i} for some i, j ∈ v. Further denote r(i), r( j), and r(pa(i, G)) as a, b, and c respectively. Thus, we have |θi,G| = (a − 1)c, |θ j,G| = (b − 1)ac, |θi,G′| = (a − 1)bc, |θ j,G′| = (b − 1)c. Notice that |θl,G| = |θl,G′| for each l ∈ v \ {i, j}. By (4), we have: |param(G)| − |param(G′)| = (|θi,G| + |θ j,G|) − (|θi,G′| + |θ j,G′|) = (cid:16) = c − (a − 1)c + (b − 1)ac (cid:17) (a − 1) + (b − 1)a − (a − 1)b − (b − 1) (cid:17) (a − 1)bc + (b − 1)c (cid:17) (cid:16) (cid:16) = c (cid:16) = 0. (a − 1)(1 − b) + (b − 1)(a − 1) (cid:17) Theorem 5.3. For any joint multinomial distribution P, ParamM(P) ⊆ PM(P) holds. Proof. By reductio, suppose that G ∈ ParamM(P) but G < PM(P). So there exists G′ ∈ PM(P) such that I(G) ⊂ I(G′) ⊆ I(P). By Theorem C.2, there exists a Chickering sequence to obtain G′ from G. By Lemma C.3, covered edge reversals preserve the number of parameters. On the other hand, edge deletion is obviously an operation that decreases the number of parameters. Given that G′ and G do not belong to the same MEC, there must be at least one operation of edge deletion to obtain G′ from G. In other words, we (cid:3) have |param(G′)| < |param(G)|. Contradiction arises with G ∈ ParamM(P). (cid:3) 33 D Proof of Theorem 5.10 First, we introduce some concepts facilitating the proof of ResF(P) ⊆ uParamM(P) for every joint multi- nomial distribution P. In particular, we borrow the concept parameterizing sets that has been used to pa- rameterize acyclic directed mixed graphs (ADMGs) in Evans and Richardson [2014]. Given that DAGs are a special class of ADMGs, the concept borrowed can easily be applied to our subject matter.33 Definition D.1. Studen ́y [2005] Consider any DAG G ∈ DAG(v). The characteristic imset cG : P(v) \ {∅} → {0, 1} is defined as follows34: cG(s) := for any s ∈ P(v) where s , ∅. 1 0    if {hXi, X j | Xki ∈ I(G) : s \ k = {i, j}i} = ∅ otherwise Denote the class of parameterizing sets of G as S(G) = {s ∈ P(v) \ {∅} : cG(s) = 1}. In other words, s is a parameterizing set if and only if the characteristic imset evaluated at s is 1. Below is a nice graphical feature of parameterizing sets. Lemma D.2. Hemmecke et al. [2012]; Andrews et al. [2022] Consider any DAG G ∈ DAG(v) and any s ∈ P(v). Then cG(s) = 1 if and only if there exists i ∈ s s.t. s \ {i} ⊆ pa(i, G). Observe that the existence in the last lemma is necessarily unique. That is, each s ∈ S(G) contains a unique vertex i such that s \ {i} ⊆ pa(i, G) holds.35 Hence, we can partition S(G) by vertices. Define S(i, G) as the class of parameterizing sets of vertex i ∈ v in G ∈ DAG(v) such that S(i, G) := {s ∈ S(G) : i ∈ s and s \ {i} ⊆ pa(i, G)}. (9) As a consequence, we have S(G) = i∈v S(i, G), and S(i, G) ∩ S( j, G) = ∅ for any distinct i, j ∈ v. Below is a crucial result on how the number of parameters of a DAG in a multinomial causal model, as S expressed in (4), can be characterized in an alternative manner. Lemma D.3. Consider any DAG G ∈ DAG(v) of a multinomial causal model and any i ∈ v. Then (r( j) − 1) = (r(i) − 1) × r(pa(i, G)). (10) Xs∈S(i,G) Yj∈s Proof. Consider the simplest case where pa(G, i) = ∅. Then S(i, G) = {{i}} and hence the LHS of (10) is r(i) − 1 which is equivalent to the RHS (since r(∅) = 1). In the following, without loss of generality, we write i as 0. Let |pa(0, G)| = k ≤ |v| − 1 such that pa(0, G) = {1, ..., k}. To obtain S(0, G), notice the bijection between S(0, G) and P(pa(0, G)) such that each s ∈ S(0, G) can be uniquely identified by s′ ∪ {0} for some s′ ∈ P(pa(0, G)). 33I owe a huge debt of gratitude to Bryan Andrews for pointing out this approach and also the relevant literature including Hemmecke et al. [2012] and Andrews et al. [2022]. The main proof of the mentioned claim was also sketched by him. 34P(X) is the powerset of X for any set X. 35By reductio, suppose that i, j ∈ s s.t. s \ {i} ⊆ pa(i, G) and s \ { j} ⊆ pa( j, G). Then j ∈ pa(i, G) and i ∈ pa( j, G). Contradiction. 34 Now, we want to show (10) by an induction on k. To begin with, consider the base case where k = 1 such that pa(0, G) = {1} and S(0, G) = {{0}, {0, 1}}. The LHS of (10) becomes (r( j) − 1) = (r(0) − 1) + (r(0) − 1)(r(1) − 1) = (r(0) − 1) r(1) Xs∈S(0,G) Yj∈s where r(1) = r({1}) = r(pa(0, G)). Thus, the base case is proven. Consider the inductive hypothesis that (10) holds for some arbitrary k − 1 ≤ |v| − 2 for DAG G such that pa(0, G) = {1, ..., k − 1}. Then we construct G′ by adding the directed edge k → 0 to G such that pa(0, G′) = {1, ..., k − 1, k}. We want to show that (10) holds for G′ and the vertex 0. Observe that S(0, G) ⊂ S(0, G′) where the former has a size of 2k−1 and the latter of 2k. Also, there is a bijection between S(0, G′) \ S(0, G) and S(0, G) such that each s′ ∈ S(0, G′) \ S(0, G) can be uniquely identified by s ∪ {k} for some s ∈ S(0, G). This observation yields the following. (r( j) − 1) = (r( j) − 1) + (r( j) − 1) (11) Xs∈S(0,G′) Yj∈s Xs∈S(0,G) Yj∈s Xs∈S(0,G′)\S(0,G) Yj∈s Consider the second term on the RHS of (11) in particular. Xs∈S(0,G′)\S(0,G) Yj∈s Xs∈S(0,G′)\S(0,G) Yj∈s\{k} (r( j) − 1) = (r( j) − 1)(r(k) − 1) = (r(k) − 1) × (r( j) − 1) Xs∈S(0,G′)\S(0,G) Yj∈s\{k} = (r(k) − 1) × (r( j) − 1) Xs∈S(0,G) Yj∈s = (r(k) − 1) × (r(0) − 1) × r(pa(0, G)) where the last equality is obtained by the inductive hypothesis. Finally, by plugging the above into (11): (r( j) − 1) = (r( j) − 1) + (r( j) − 1) Xs∈S(0,G′) Yj∈s Xs∈S(0,G) Yj∈s Xs∈S(0,G′)\S(0,G) Yj∈s (r(k) − 1) × (r(0) − 1) × r(pa(0, G)) (cid:19) + = (r(0) − 1) × r(pa(0, G)) (cid:19) (cid:18) = (r(0) − 1) × r(pa(0, G)) × = (r(0) − 1) × r({1, ..., k − 1}) × r(k) = (r(0) − 1) × r({1, ..., k − 1, k}) = (r(0) − 1) × r(pa(0, G′)). (cid:18) 1 + (r(k) − 1) (cid:1) (cid:0) (cid:3) Corollary D.4. Consider any DAG G ∈ DAG(v) of a multinomial causal model. Then |param(G)| = (r( j) − 1) = (r( j) − 1). (12) Xi∈v Xs∈S(i,,G) Yj∈s Xs∈S(G) Yj∈s Now we show a crucial lemma stating that the class of parameterizing sets in a restricted-faithful DAG is necessarily a subset of that in any Markovian DAG. As a consequence, this claim entails our desired result that ResF(P) ⊆ uParamM(P) for any joint multinomial distribution P. 35 Lemma D.5. For any joint multinomial distribution P, if G ∈ ResF(P), then S(G) ⊆ S(G′) for any G′ ∈ CMC(P). Proof. First, following from G ∈ AdjF(P), we have sk(G) ⊆ sk(G′) for any G′ ∈ CMC(P). Now we prove the lemma by considering the cardinality of each s ∈ S(G) (where |s| ≥ 1 as required by Definition D.1). When |s| = 1, we have s ∈ S(G′) trivially. Consider |s| = 2 where s = {i, j} for some distinct i, j ∈ v. Notice that s corresponds to the adjacency between i and j in G. Since sk(G) ⊆ sk(G′), i and j must also be adjacent in G′ and thus {i, j} = s ∈ S(G′). Consider |s| = 3 where s = {i, j, k}. Given that s ∈ S(G), it follows from Lemma D.2 that {i, j, k} forms either an unshielded collider or a triangle in G (because a triangle must be a shielded collider to avoid any cycle in a DAG). From G ∈ ResF(P), {i, j, k} must also form either an unshielded collider or a triangle in G′. Hence, {i, j, k} = s ∈ S(G′) by Lemma D.2. Lastly, consider |s| > 3. By Lemma D.2, there must exist i ∈ s such that s \ {i} ⊆ pa(i, G). Accordingly, for every pair of distinct j, k ∈ s \ {i}, we have {i, j}, {i, k}, {i, j, k} ∈ S(G). Following the above, we have {i, j}, {i, k}, {i, j, k} ∈ S(G′) as well. It entails that hXi, X j | Xl ∪ {Xk}i, hXi, Xk | Xl ∪ {X j}i, hX j, Xk | Xl ∪ {Xi}i < I(G′) for every l ⊆ v where s \ l = {i, j, k}. By Definition D.1, it follows that cG′(s) = 1 and therefore (cid:3) s ∈ S(G′). Theorem 5.4. For any joint multinomial distribution P, ResF(P) ⊆ uParamM(P) holds. Proof. Consider G ∈ ResF(P) = AdjF(P) ∩ OriF(P). From G ∈ AdjF(P), if a DAG G′ ∈ DAG(v) misses any of G's adjacencies, G′ is not Markovian (to P). This observation implies three results. First, no DAG sparser than G can be Markovian. Second, for any Markovian G′ which is strictly denser to G, the set of adjacencies in G′ must be a proper superset of that in G (i.e., sk(G) ⊂ sk(G′)). Lastly, those Markovian DAGs that are equally sparse as G must have the same skeleton as G. The last point, together with G ∈ OriF(P), entails that all those equally sparse DAGs are in the same MEC as G, and thus having the same number of parameters according to Lemma C.3. In other words, to prove that G ∈ uParamM(P), it suffices to prove that |param(G)| < |param(G′)| for any G′ ∈ CMC(P) satisfying sk(G) ⊂ sk(G′). Now consider any of such G′. By Lemma D.5, we have S(G) ⊆ S(G′). However, notice that there must exist i, j ∈ v such that (i, j) ∈ sk(G′) \ sk(G). It follows that {i, j} ∈ S(G′) but {i, j} < S(G). Consequently, (cid:3) we have S(G) ⊂ S(G′). Therefore, by (12) in Corollary D.4, |param(G)| < |param(G′)|. 36 E Constructing the Examples This section discusses how the examples in Section 5 can be simulated constructively. Recall that the claim in each of these examples is the existence of a joint multinomial distribution ̊P (where the overhead ◦ signifies that it is the joint probability distribution we aim to prove its existence) satisfying certain conditions (e.g., AdjF( ̊P) \ ParamM( ̊P) , ∅). Also observe that each of them concerns a particular DAG G ∈ CMC( ̊P) such that I( ̊P) \ I(G) = ΨG, ̊P , ∅ (i.e., G is not faithful to ̊P). To show the existence of such ̊P, we construct a joint multinomial distribution P such that I(P) satisfies the conditions in question. The construction can be divided into two steps. First, we obtain I(G) by d-separation, and introduce the set of CIs in ΨG, ̊P by a specific assignment of probabilities such that I(G) *∪ ΨG, ̊P ⊆ I(P). The second step is to ensure that the mentioned assignment does not introduce any extra CI in I(P). Once both steps are done, we obtain I(P) = I(G) ∪ ΨG, ̊P = I( ̊P) as desired. Since the second step involves tedious but straightforward arithmetic derivations, we will not go through the details except in Example 5.6 for an illustration. Now we introduce some necessary notations for our constructions. Consider any joint multinomial distribution P over V. Next, given that the DAG G in question is Markov to P, we can represent the joint multinomial distribution P by the Markov factorization: P(V) = P(Xi | Xpa(i,G)). Yi∈v (6) Note that each P(Xi | Xpa(i,G)) is determined by the set of parameters θi,G. We express each θi,G in a tabular form (e.g., the three tables in Example 5.6) and call them θ-tables. The table for θi,G has the dimension of r(pa(i, G)) × r(i) where each row corresponds to the value assignment of Xpa(i,G), and each column to the value of Xi. Each cell is the probability of Xi taking the value specified by the column conditioned on the value assignment of Xpa(i,G) specified by the row. Given that each row must sum to 1, cells in the last column are determined by the rest of the cells in the same row. For this reason, the cells in the last column are not parameters needed to compute P(Xi | Xpa(i,G)) and thus are marked as gray. E.1 Example 5.6 2 G0 1 3 Figure 12: G0 from Figure 7 Given that V = {X1, X2, X3}, consider r(1) = r(3) = 2 and r(2) = 3. We want to construct a multinomial distribution P such that I(P) = {hX1, X3 | {X2}i, hX1, X3i} = I( ̊P). First, we start with G0 in Figure 12 where I(G0) = {hX1, X3 | {X2}i}. Below are the θ-tables for the three variables. θ1,G0 i P(X1 = i) 0 a = 0.5 1 0.5 i P(X2 = i | X1 = 0) P(X2 = i | X1 = 1) θ2,G0 0 b0 = 0.2 b1 = 0.3 1 c0 = 0.2 c1 = 0.3 2 0.6 0.4 37 θ3,G0 i P(X3 = i | X2 = 0) P(X3 = i | X2 = 1) P(X3 = i | X2 = 2) 0 d0 = 0.2 d1 = 0.4 d2 = 0.3 1 0.8 0.6 0.7 To verify that hX1, X3i ∈ I(P), it suffices to show that P(X3 = 0 | X1 = 0) = P(X3 = 0 | X1 = 1). Consider any i ∈ {0, 1}. P(X3 = 0 | X1 = i) = P(X3 = 0, X2 = j | X1 = i) = 2 2 Xj=0 P(X1 = i, X2 = j, X3 = 0) P(X1 = i) Xj=0 2 Xj=0 2 Xj=0 = = P(X1 = i) P(X2 = j | X1 = i) P(X3 = 0 | X2 = j) P(X1 = i) P(X3 = 0 | X2 = j) P(X2 = j | X1 = i) = d0bi + d1ci + d2(1 − bi − ci) P(X3 = 0 | X1 = 0) =(0.2 × 0.2) + (0.4 × 0.2) + (0.3 × 0.6) = 0.3 P(X3 = 0 | X1 = 1) =(0.2 × 0.3) + (0.4 × 0.3) + (0.3 × 0.4) = 0.3 and hence hX1, X3i ∈ I(P). On the other hand, we show arithmetically that there exists no CI in I(P) except hX1, X3i and hX1, X3 | {X2}i. By ignoring symmetric pairs, there are a total of 6 possible CIs in I(V). hX1, X3i, hX1, X3 | {X2}i ∈ I(P) have been shown above. For hX1, X2i, hX2, X3i ∈ I(V), readers can verify that they are not in I(P) simply by reading off the tables for θ2,G0 and θ3,G0 respectively. For hX1, X2 | {X3}i ∈ I(V), it suffices to show that P(X1 = 0 | X2 = 0, X3 = 0) , P(X1 = 0 | X2 = 1, X3 = 0). For any j ∈ {0, 1, 2}, P(X1 = 0 | X2 = j, X3 = 0) = P(X1 = 0, X2 = j, X3 = 0) P(X2 = j, X3 = 0) = = = = P(X1 = 0) P(X2 = j | X1 = 0) P(X3 = 0 | X2 = j) P(X2 = j) P(X3 = 0 | X2 = j) P(X1 = 0) P(X2 = j | X1 = 0) P(X2 = j) P(X1 = 0) P(X2 = j | X1 = 0) P(X1 = 0, X2 = j) + P(X1 = 1, X2 = j) P(X1 = 0) P(X2 = j | X1 = 0) P(X1 = 0) P(X2 = j | X1 = 0) + P(X1 = 1) P(X2 = j | X1 = 1) P(X1 = 0 | X2 = 0, X3 = 0) = P(X1 = 0 | X2 = 2, X3 = 0) = 0.5 × 0.2 0.5 × 0.2 + 0.5 × 0.3 0.5 × 0.6 0.5 × 0.6 + 0.5 × 0.4 = 0.4 = 0.6 and thus hX1, X2 | {X3}i < I(P). Lastly, for hX2, X3 | {X1}i, consider any k ∈ {0, 1}. By making use of P(X3 = 0 | X1 = 0) obtained above, we have 38 P(X2 = 0 | X1 = 0, X3 = k) = P(X1 = 0, X2 = 0, X3 = k) P(X1 = 0, X3 = k) = = P(X1 = 0) P(X2 = 0 | X1 = 0) P(X3 = k | X2 = 0) P(X1 = 0) P(X3 = k | X1 = 0) P(X2 = 0 | X1 = 0) P(X3 = k | X2 = 0) P(X3 = k | X1 = 0) P(X2 = 0 | X1 = 0, X3 = 0) = P(X2 = 0 | X1 = 0, X3 = 1) = 0.2 × 0.2 0.3 0.2 × 0.8 (1 − 0.3) = 0.133 = 0.229 and hence hX2, X3 | {X1}i < I(P). (cid:3) E.2 Example 5.7 1 4 2 3 G∗ Figure 13: G∗ from Figure 5 Given that V = {X1, X2, X3, X4}, consider r(1) = r(2) = r(3) = 2, and r(4) = 3. We want to construct a multinomial distribution P such that I(P) = {hX1, X3, | {X2}i, hX2, X4 | {X1, X3}i, hX1, X4i}. First, we start with G∗ from Figure 13 where I(G∗) = {hX1, X3, | {X2}i, hX2, X4 | {X1, X3}i}. Below are the θ-tables. θ1,G∗ i P(X1 = i) 0 a = 0.5 1 0.5 θ2,G∗ i P(X2 = i | X1 = 0) P(X2 = i | X1 = 1) 0 b0 = 0.6 b1 = 0.1 θ3,G∗ i P(X3 = i | X2 = 0) P(X3 = i | X2 = 1) 0 c0 = 0.7 c1 = 0.2 1 0.4 0.9 1 0.3 0.8 i P(X4 = i | X1 = 0, X3 = 0) P(X4 = i | X1 = 0, X3 = 1) P(X4 = i | X1 = 1, X3 = 0) P(X4 = i | X1 = 1, X3 = 1) θ4,G∗ 0 d00 = 0.1 d01 = 0.05 d10 = 0.1125 d11 = 0.0625 1 e00 = 0.1 e01 = 0.05 e10 = 0.1125 e11 = 0.0625 2 0.8 0.9 0.775 0.875 To verify that hX1, X4i ∈ I(P), it suffices to show that P(X4 = l | X1 = 0) = P(X4 = l | X1 = 1) for each l ∈ {0, 1}. Consider each i ∈ {0, 1}. 39 Xk∈{0,1} Xk∈{0,1} Xk∈{0,1} = = = = P(X4 = 0 | X1 = i) = P(X3 = k, X4 = 0 | X1 = i) = P(X1 = i, X3 = k, X4 = 0) P(X1 = i) Xk∈{0,1} P(X4 = 0 | X1 = i, X3 = k) P(X1 = i, X3 = k) P(X1 = i) P(X4 = 0 | X1 = i, X3 = k) j∈{0,1} P(X1 = i, X2 = j, X3 = k) P(X1 = i) P P(X4 = 0 | X1 = i, X3 = k) P(X1 = i) Xk∈{0,1} (cid:18) P(X1 = i) P(X2 = j | X1 = i) P(X3 = k | X2 = j) (cid:19) Xj∈{0,1} P(X4 = 0 | X1 = i, X3 = k) Xk∈{0,1} (cid:18) P(X2 = j | X1 = i) P(X3 = k | X2 = j) (cid:19) Xj∈{0,1} = di0(bic0 + (1 − bi)c1) + di1(bi(1 − c0) + (1 − bi)(1 − c1)) P(X4 = 0 | X1 = 0) = P(X4 = 0 | X1 = 1) = 0.05 × (0.6 × 0.3 + 0.4 × 0.8) 0.1 × (0.6 × 0.7 + 0.4 × 0.2) (cid:18) (cid:19) (cid:18) (cid:19) 0.1125 × (0.1 × 0.7 + 0.9 × 0.2) (cid:19) (cid:18) The case for P(X4 = 1 | X1 = 0) = P(X4 = 1 | X1 = 1) is exactly the same due to the two identical columns (cid:3) in the table for θ4,G∗. Hence, hX1, X4i ∈ I(P). We leave the step of checking no extra CI to readers. 0.0625 × (0.1 × 0.3 + 0.9 × 0.8) (cid:19) = 0.075 = 0.075 + + (cid:18) E.3 Example 5.9 1 3 2 4 G∗ Figure 14: G∗ from Figure 6 Consider V = {X1, X2, X3, X4} where all variables are binary. We want to construct a multinomial distri- bution P such that I(P) = {hX1, X4 | {X2, X3}i, hX2, X3 | {X1}i, hX1, X4i}. First, we start with G∗ in Figure 14 where I(G∗) = {hX1, X4 | {X2, X3}i, hX2, X3 | {X1}i}. Below are the four θ-tables. θ1,G∗ i P(X1 = i) 0 a = 0.5 1 0.5 θ3,G∗ i P(X3 = i | X1 = 0) P(X3 = i | X1 = 1) 0 c0 = 0.4 c1 = 0.3 1 0.6 0.7 θ2,G∗ i P(X2 = i | X1 = 0) P(X2 = i | X1 = 1) 1 0.7 0.6 0 b0 = 0.3 b1 = 0.4 θ4,G∗ i P(X4 = i | X2 = 0, X3 = 0) P(X4 = i | X2 = 0, X3 = 1) P(X4 = i | X2 = 1, X3 = 0) P(X4 = i | X2 = 1, X3 = 1) 0 d00 = 0.1 d01 = 0.7 d10 = 0.7 d11 = 0.8 1 0.9 0.3 0.3 0.2 40 To verify that hX1, X4i ∈ I(P), it suffices to show that P(X4 = 0 | X1 = 0) = P(X4 = 0 | X1 = 1). Consider any i ∈ {0, 1}. P(X4 = 0 | X1 = i) = P(X2 = j, X4 = 0 | X1 = i) Xj∈{0,1} Xj∈{0,1} Xk∈{0,1} Xj∈{0,1} Xk∈{0,1} Xj∈{0,1} Xk∈{0,1} P(X2 = j, X3 = k, X4 = 0 | X1 = i) P(X1 = i, X2 = j, X3 = k, X4 = 0) P(X1 = i) P(X1 = i) P(X2 = j | X1 = i) P(X3 = k | X1 = i) P(X4 = 0 | X2 = j, X3 = k) P(X1 = i) P(X2 = j | X1 = i) P(X3 = k | X1 = i) P(X4 = 0 | X2 = j, X3 = k) = = = = Xj∈{0,1} Xk∈{0,1} = bi(cid00 + (1 − ci)d01) + (1 − bi)(cid10 + (1 − ci)d11) = bi(ci(d00 − d01) + d01) + (1 − bi)(ci(d10 − d11) + d11) P(X4 = 0 | X1 = 0) = 0.3 × (0.4 × (0.1 − 0.7) + 0.7) + (1 − 0.3) × (0.4 × (0.7 − 0.8) + 0.8) = 0.67 P(X4 = 0 | X1 = 1) = 0.4 × (0.3 × (0.1 − 0.7) + 0.7) + (1 − 0.4) × (0.3 × (0.7 − 0.8) + 0.8) = 0.67 and hence hX1, X4i ∈ I(P). We leave the step of checking no extra CI to readers. (cid:3) E.4 Example 5.10 1 5 2 G0 4 3 Figure 15: G0 from Figure 4 Consider that V = {X1, X2, X3, X4, X5} where the first four variables are binary and the last is ternary. From G0 in Figure 15, below shows all the 20 CIs in I(G0). I(G0) = hX1, X2i, hX2, X4i, hX1, X2 | {X4}i, hX1, X3 | {X4}i, hX2, X4 | {X3}i, hX1, X2 | {X3, X4}i, hX2, X4 | {X1, X3}i,    hX1, X3i, hX3, X4i, hX1, X3 | {X2}i, hX2, X3 | {X4}i, hX3, X4 | {X1}i, hX1, X3 | {X2, X4}i, hX3, X4 | {X1, X2}i hX2, X3i, hX1, X2 | {X3}i, hX2, X3 | {X1}i, hX2, X4 | {X1}i, hX3, X4 | {X2}i, hX2, X3 | {X1, X4}i,    Below is the set of unfaithful CIs. ψ1 : hX1, X5i, ψ3 : hX1, X3 | {X5}i, ψ5 : hX1, X5 | {X3}i, ψ2 : hX1, X2 | {X5}i, ψ4 : hX1, X5 | {X2}i, ψ6 : hX1, X2 | {X3, X5}i, ψ7 : hX1, X3 | {X2, X5}i, ψ8 : hX1, X5 | {X2, X3}i ΨG0, ̊P =    .    41 Unlike the previous examples where we only need to induce one CI parametrically, we need to ensure that the eight CIs in ΨG0, ̊P are satisfied. Here are the five θ-tables. θ2,G0 θ1,G0 i P(X1 = i) 0 a = 0.5 1 0.5 θ3,G0 i P(X3 = i) 0 c = 0.5 1 0.5 i P(X2 = i) 0 b = 0.5 1 0.5 θ4,G0 i P(X4 = i | X1 = 0) P(X4 = i | X1 = 1) 0 d0 = 0.4 d1 = 0.8 1 0.6 0.2 θ5,G0 i P(X5 = i | X1 = 0, X2 = 0, X3 = 0, X4 = 0) P(X5 = i | X1 = 0, X2 = 0, X3 = 0, X4 = 1) P(X5 = i | X1 = 0, X2 = 0, X3 = 1, X4 = 0) P(X5 = i | X1 = 0, X2 = 0, X3 = 1, X4 = 1) P(X5 = i | X1 = 0, X2 = 1, X3 = 0, X4 = 0) P(X5 = i | X1 = 0, X2 = 1, X3 = 0, X4 = 1) P(X5 = i | X1 = 0, X2 = 1, X3 = 1, X4 = 0) P(X5 = i | X1 = 0, X2 = 1, X3 = 1, X4 = 1) P(X5 = i | X1 = 1, X2 = 0, X3 = 0, X4 = 0) P(X5 = i | X1 = 1, X2 = 0, X3 = 0, X4 = 1) P(X5 = i | X1 = 1, X2 = 0, X3 = 1, X4 = 0) P(X5 = i | X1 = 1, X2 = 0, X3 = 1, X4 = 1) P(X5 = i | X1 = 1, X2 = 1, X3 = 0, X4 = 0) P(X5 = i | X1 = 1, X2 = 1, X3 = 0, X4 = 1) P(X5 = i | X1 = 1, X2 = 1, X3 = 1, X4 = 0) P(X5 = i | X1 = 1, X2 = 1, X3 = 1, X4 = 1) 0 e0000 = 0.4 e0001 = 0.15 e0010 = 0.2 e0011 = 0.2 e0100 = 0.3 e0101 = 0.08 e0110 = 0.1 e0111 = 0.3 e1000 = 0.2 e1001 = 0.45 e1010 = 0.15 e1011 = 0.4 e1100 = 0.15 e1101 = 0.24 e1110 = 0.225 e1111 = 0.2 1 f0000 = 0.4 f0001 = 0.15 f0010 = 0.2 f0011 = 0.2 f0100 = 0.3 f0101 = 0.08 f0110 = 0.1 f0111 = 0.3 f1000 = 0.2 f1001 = 0.45 f1010 = 0.15 f1011 = 0.4 f1100 = 0.15 f1101 = 0.24 f1110 = 0.225 f1111 = 0.2 2 0.2 0.7 0.6 0.6 0.4 0.84 0.8 0.4 0.6 0.1 0.7 0.2 0.7 0.52 0.55 0.6 Consider ψ8 = hX1, X5 | {X2, X3}i in particular. We first want to show that, if ψ8 ∈ I(P), then all other seven unfaithful CIs in ΨG0, ̊P are also in I(P). To do so, observe that P is a strictly positive multinomial distribution as every cell in the five θ-tables is positive. Thus, P is a graphoid. Now we show that each of ψ1, ..., ψ7 can be derived from I(G0) ∪ {ψ8} using the graphoid axioms discussed in Appendix A includ- ing intersection. In particular, denote φ1 = hX1, X2i, φ2 = hX1, X2 | {X3}i, and φ3 = hX1, X3 | {X2}i where φ1, φ2, φ3 ∈ I(G0) ⊂ I(P). 42 (X1 ⊥⊥P X2 | {X3}) φ2 | {z } (X1 ⊥⊥P X2 | {X3}) φ2 {z } | ∧ (X1 ⊥⊥P X5 | {X2, X3}) ψ8 {z } ∧ (X1 ⊥⊥P X5 | {X2, X3}) ψ8 {z | } | (X1 ⊥⊥P X3 | {X2}) φ3 {z } | ∧ (X1 ⊥⊥P X5 | {X2, X3}) ψ8 {z } | X1 ⊥⊥P X2 | {X3, X5} ψ6 {z } | ∧ X1 ⊥⊥P X3 | {X2, X5} ψ7 {z } | ⇒ X1 ⊥⊥P {X2, X5} | {X3} contraction (13) } ⇒ X1 ⊥⊥P {X2, X5} | {X3} | (i) {z contraction (14) | ⇒ X1 ⊥⊥P X2 | {X3, X5} (i) {z } (i), weak union (15) ⇒ X1 ⊥⊥P X5 | {X3} | ψ6 {z } (i), decomposition (16) ψ5 {z ⇒ X1 ⊥⊥P {X3, X5} | {X2} | } contraction (17) | ⇒ X1 ⊥⊥P X3 | {X2, X5} (ii) {z } (ii), weak union (18) ⇒ X1 ⊥⊥P X5 | {X2} | ψ7 {z } (ii), decomposition (19) ψ4 {z ⇒ X1 ⊥⊥P {X2, X3} | {X5} | } intersection (20) | ⇒ X1 ⊥⊥P X2 | {X5} (iii) {z ψ2 {z } ⇒ X1 ⊥⊥P X3 | {X5} | ψ3 {z } ⇒ X1 ⊥⊥P {X2, X5} | (iv) {z ⇒ X1 ⊥⊥P X5 | } ∧ (X1, X5 | {X2}) ψ4 {z } | (X1 ⊥⊥P X2) φ1 {z | } } (iii), decomposition (21) (iii), decomposition (22) contraction (23) (iv), decomposition (24) ψ1 {z Thus, it suffices to prove that ψ8 ∈ I(P), that is, P(X5 = 0 | X1 = 0, X2 = j, X3 = k) = P(X5 = 0 | X1 = } | 1, X2 = j, X3 = k) for every j, k ∈ {0, 1}. Consider any i, j, k ∈ {0, 1}. P(X5 = 0 | X1 = i, X2 = j, X3 = k) P(X4 = l, X5 = 0 | X1 = i, X2 = j, X3 = k) P(X1 = i) P(X2 = j) P(X3 = k) P(X4 = l | X1 = i) P(X5 = 0 | X1 = i, X2 = j, X3 = k, X4 = l) P(X1 = i) P(X2 = j) P(X3 = k) P(X4 = l | X1 = i) P(X5 = 0 | X1 = i, X2 = j, X3 = k, X4 = l) = = = Xl∈{0,1} Xl∈{0,1} Xl∈{0,1} = diei jk0 + (1 − di)ei jk1 Thus, we have: P(X5 = 0 | X1 = 0, X2 = j, X3 = k) = 0.4e0 jk0 + 0.6e0 jk1 P(X5 = 0 | X1 = 1, X2 = j, X3 = k) = 0.8e1 jk0 + 0.2e1 jk1 43 P(X5 = 0 | X1 = 0, X2 = 0, X3 = 0) = 0.4 × 0.4 + 0.6 × 0.15 = 0.25 P(X5 = 0 | X1 = 1, X2 = 0, X3 = 0) = 0.8 × 0.2 + 0.2 × 0.45 = 0.25 P(X5 = 0 | X1 = 0, X2 = 0, X3 = 1) = 0.4 × 0.2 + 0.6 × 0.2 = 0.2 P(X5 = 0 | X1 = 1, X2 = 0, X3 = 1) = 0.8 × 0.15 + 0.2 × 0.4 = 0.2 P(X5 = 0 | X1 = 0, X2 = 1, X3 = 0) = 0.4 × 0.3 + 0.6 × 0.08 = 0.168 P(X5 = 0 | X1 = 1, X2 = 1, X3 = 0) = 0.8 × 0.15 + 0.2 × 0.24 = 0.168 P(X5 = 0 | X1 = 0, X2 = 1, X3 = 1) = 0.4 × 0.1 + 0.6 × 0.3 = 0.22 P(X5 = 0 | X1 = 1, X2 = 1, X3 = 1) = 0.8 × 0.225 + 0.2 × 0.2 = 0.22 The case for P(X5 = 1 | X1 = 0, X2 = j, X3 = k) = P(X5 = 1 | X1 = 1, X2 = j, X3 = k) for every j, k ∈ {0, 1} is exactly the same due to the two identical columns in the table of θ5,G0. Hence, we have ψ8 = hX1, X5 | {X2, X3}i ∈ I(P). 44
http://arxiv.org/abs/2302.10326v2
2023-08-16T20:46:43
2023-02-20T21:34:59
Unsupervised Out-of-Distribution Detection with Diffusion Inpainting
Unsupervised out-of-distribution detection (OOD) seeks to identify out-of-domain data by learning only from unlabeled in-domain data. We present a novel approach for this task - Lift, Map, Detect (LMD) - that leverages recent advancement in diffusion models. Diffusion models are one type of generative models. At their core, they learn an iterative denoising process that gradually maps a noisy image closer to their training manifolds. LMD leverages this intuition for OOD detection. Specifically, LMD lifts an image off its original manifold by corrupting it, and maps it towards the in-domain manifold with a diffusion model. For an out-of-domain image, the mapped image would have a large distance away from its original manifold, and LMD would identify it as OOD accordingly. We show through extensive experiments that LMD achieves competitive performance across a broad variety of datasets. Code can be found at https://github.com/zhenzhel/lift_map_detect.
[ "Zhenzhen Liu", "Jin Peng Zhou", "Yufan Wang", "Kilian Q. Weinberger" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10326v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10326v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.CV", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.CV", "cs.LG" ]
3 2 0 2 g u A 6 1 ] V C . s c [ 2 v 6 2 3 0 1 . 2 0 3 2 : v i X r a Unsupervised Out-of-Distribution Detection with Diffusion Inpainting Zhenzhen Liu * 1 Jin Peng Zhou * 1 Yufan Wang 1 Kilian Q. Weinberger 1 Abstract Unsupervised out-of-distribution detection (OOD) seeks to identify out-of-domain data by learning only from unlabeled in-domain data. We present a novel approach for this task – Lift, Map, De- tect (LMD) – that leverages recent advancement in diffusion models. Diffusion models are one type of generative models. At their core, they learn an iterative denoising process that gradu- ally maps a noisy image closer to their training manifolds. LMD leverages this intuition for OOD detection. Specifically, LMD lifts an image off its original manifold by corrupting it, and maps it towards the in-domain manifold with a diffusion model. For an out-of-domain image, the mapped image would have a large distance away from its original manifold, and LMD would identify it as OOD accordingly. We show through exten- sive experiments that LMD achieves competitive performance across a broad variety of datasets. Code can be found at https://github. com/zhenzhel/lift_map_detect. Figure 1. The pictorial intuition behind LMD for OOD detection. A diffusion model learns a mapping to the in-domain manifold. LMD lifts an image off its manifold by masking, and uses the diffusion model to move it towards the in-domain manifold. An in-domain image would have a much smaller distance between the original and mapped locations than its out-of-domain counterparts. 1. Introduction Out-of-distribution (OOD) detection seeks to classify whether a data point belongs to a particular domain. It is especially important, because machine learning models typi- cally assume that test-time samples are drawn from the same distribution as the training data. If the test data do not fol- low the training distribution, they can inadvertently produce non-sensical results. The increased use of machine learn- ing models in high-stake areas, such as medicine (Hamet & Tremblay, 2017) and criminal justice (Rigano, 2019), am- plifies the importance of OOD detection. For example, if a doctor mistakenly inputs a chest X-ray into a brain tumor detector, the model would likely still return a prediction – *Equal contribution 1Department of Computer Science, Cornell University, Ithaca, New York, USA. Correspondence to: Zhenzhen Liu <[email protected]>, Jin Peng Zhou <[email protected]>. Proceedings of the 40 th International Conference on Machine Learning, Honolulu, Hawaii, USA. PMLR 202, 2023. Copyright 2023 by the author(s). which would be meaningless and possibly misleading. Previous researches have studied OOD detection under dif- ferent settings: supervised and unsupervised. Within the supervised setup, the supervision can originate from dif- ferent sources. In the most informed setting, one assumes access to representative out-of-domain samples. These al- low one to train an OOD detector as a classifier distinguish- ing in-domain from out-of-domain data, and achieve high performance (Hendrycks et al., 2018; Ruff et al., 2019) – as long as the out-of-domain data do not deviate from the assumed out-of-domain distribution. In many practical ap- plications, however, such knowledge is unattainable. In fact, out-of-domain data can be highly diverse and unpredictable. A significantly more relaxed assumption is to only require access to an in-domain classifier or class labels. Under this setting, methods such as Hendrycks & Gimpel (2016); Liang et al. (2017); Lee et al. (2018); Huang et al. (2021); Wang et al. (2022) have achieved competitive performance. Although less informed, this setting relies on two implicit assumptions: the in-domain data have well-defined classes, 1 Manifold of Faces (In-domain)Manifold of Fire Hydrants (Out-of-domain)The diffusion model learns the in-domain manifold.Lift from ManifoldLift from ManifoldMapMapLarge DistanceDMSmall DistanceDMDM Unsupervised Out-of-Distribution Detection with Diffusion Inpainting and there are sufficiently plenty data with class annotations. In practice, these assumptions often cannot be met. Unla- beled data do not require the expensive human annotation, and thus are often readily available in large quantity. Ideally, one would like to build an OOD detector that only requires unlabeled in-domain data during training. Recently, a class of generative models – the diffusion mod- els (DM) (Ho et al., 2020; Song et al., 2020) – have gained increasing popularity. DMs formulate two processes: The forward process converts an image to a sample drawn from a noise distribution by iteratively adding noise to its pixels; the backward process maps a noise image towards a specific image manifold by iteratively removing noise from the im- age. A dedicated neural network is trained to perform the denoising steps in the backward process. In this paper, we argue that we can leverage the property that the diffusion model learns a mapping to a manifold, and turn it into a strong unsupervised OOD detector. Intuitively, if we lift an image from its manifold, then the lifted image can be mapped back to its original vicinity with a diffusion model trained over the same manifold. If instead the diffusion model is trained over a different manifold, it would attempt to map the lifted image towards its own training manifold, causing a large distance between the original and mapped images. Thus, we can detect out-of-domain images based on such distance. To this end, we propose a novel unsupervised OOD detec- tion approach called Lift, Map, Detect (LMD) that captures the above intuition. We can lift an image from its origi- nal manifold by corrupting it. For example, a face image masked in the center clearly does not belong to the face man- ifold anymore. As shown by Song et al. (2020); Lugmayr et al. (2022), the diffusion model can impute the missing regions of an image with visually plausible content, a pro- cess commonly referred as inpainting, without retraining. Thus, we can map the lifted image by inpainting with a dif- fusion model trained over the in-domain data. We can then use a standard image similarity metric to measure the dis- tance between the original and mapped images, and detect an out-of-domain image when we observe a large distance. Figure 1 illustrates an example: A diffusion model trained on face images maps a lifted in-domain face image closer to the original image than an out-of-domain fire hydrant counterpart. To summarize our contributions: 1. We propose a novel approach LMD for unsupervised OOD detection, which directly leverages the diffusion model's manifold mapping ability without retraining. We introduce design choices that improve the separa- bility between in-domain and out-of-domain data. 2. We show that LMD is versatile through experiments on datasets with different coloring, variability and res- olution. 3. We provide qualitative visualization and quantitative ablation results that verify the basis of our approach and our design choices. 2. Background Unsupervised OOD Detection. We formalize the unsu- pervised OOD detection task as follows: Given a distribu- tion of interest D, one would like to build a detector that decides whether a data point x is drawn from D. The de- tector is only built upon unlabeled in-distribution samples x1, * * * , xn ∼ D. Given a test data point x, the detector outputs an OOD score s(x), where a higher s(x) signifies that x is more likely not to be sampled from D. Existing works can be roughly divided into three categories: likelihood-based, reconstruction-based, and feature-based. Likelihood-based approaches date back to Bishop (1994). At a high level, one fits the in-domain distribution with a model, and evaluates the likelihood of the test data under the model. Recent approaches often employ a deep gener- ative model that supports likelihood computation, such as PixelCNN++ (Salimans et al., 2017) or Glow (Kingma & Dhariwal, 2018). However, several works (Choi et al., 2018; Nalisnick et al., 2018; Kirichenko et al., 2020) have found that generative models sometimes assign higher likelihood to out-of-domain data. This issue can be alleviated in various ways. One line of work adopts a likelihood ratio approach: Ren et al. (2019) trains a semantic model and a background model, and takes the ratio of the likelihoods from the two models. Serr`a et al. (2019) observes a negative correlation between an image's complexity and its likelihood, and adjusts the likeli- hood by the compression size. Xiao et al. (2020) optimizes the model configuration to maximize a test image's likeli- hood, and measures the amount of likelihood improvement. Another line of work adopts a typicality test approach (Nal- isnick et al., 2019; Morningstar et al., 2021; Bergamin et al., 2022). They examine the distribution of in-domain likeli- hood or other model statistics, and evaluate the typicality of the test data model statistics through hypothesis testing or density estimation. Lastly, several works (Maaløe et al., 2019; Kirichenko et al., 2020) seek to improve the design choices of generative models. Reconstruction-based approaches evaluate how well a data point can be reconstructed by a model learned over the in- domain data. Our approach LMD falls into this category. Within this line of work, Sakurada & Yairi (2014); Xia et al. (2015); Zhou & Paffenroth (2017); Zong et al. (2018) encode and decode data with autoencoders. Schlegl et al. (2017); Li et al. (2018) perform GAN (Goodfellow et al., 2 Unsupervised Out-of-Distribution Detection with Diffusion Inpainting 2014) inversion for a data point, and evaluate its reconstruc- tion error and discriminator confidence under the inverted latent variable. Additionally, concurrent to our work, Gra- ham et al. (2022) leverages diffusion models to reconstruct images at varied diffusion steps, while we mask and inpaint an image repeatedly with fixed steps. The two approaches are complementary to each other. Feature-based approaches featurize data in an unsupervised manner, and fit a simple OOD detector like a Gaussian Mixture Model over the in-domain features. Denouden et al. (2018) leverages the latent variables of an autoencoder, and evaluates the Mahalanobis distance in the latent space along with the data reconstruction error. Ahmadian & Lind- sten (2021) extracts low-level features from the encoder of an invertible generative model. Hendrycks et al. (2019); Bergman & Hoshen (2020); Tack et al. (2020); Sehwag et al. (2021) learn a representation over the in-domain data through self-supervised training; Xiao et al. (2021) further shows that one can instead use a strong pretrained feature extractor while maintaining comparable performance. Diffusion Models. In this section, we provide a brief overview of the diffusion models (DM). It is a type of gen- erative model that learns the distribution of its training data. DM formulates a forward process of corrupting data by adding noise to them, commonly referred as diffusion. It learns the reverse process of gradually producing a less noisy sample, commonly referred as denoising. One classic formulation of DM is called Denoising Diffusion Proba- bilistic Models (DDPMs) (Sohl-Dickstein et al., 2015; Ho et al., 2020). Specifically, starting from a data sample x0, each step t = 1, 2, * * * , T of the diffusion process injects Gaussian noise given by q(xt|xt−1) = N (xt; (cid:112)1 − βtxt, βtI) (1) where βt follows a fixed variance schedule. The DDPM with a prior distribution xT ∼ N (0, 1) learns the denoising process given by pθ(xt−1|xt) = N (xt−1; μθ(xt, t), Σθ(xt, t)) (2) where both μθ(xt, t) and Σθ(xt, t) are learned by a neural network parametrized by θ. Note that other formulations of DMs, such as score-based generative models (Song & Ermon, 2019) and stochastic differential equations (Song et al., 2020), also support diffusion and denoising processes. Since LMD is agnostic to different formulations of DMs, we refer the reader to Yang et al. (2022) for a more detailed mathematical description of the other formulations. 3. Lift, Map, Detect diffusion model learned over the in-domain data, which pro- vides a mapping towards the underlying in-domain image manifold. To test whether an image is in-domain or out-of- domain, we lift the image off its original manifold through corruption, and map the lifted image to the in-domain mani- fold with the trained DM. If the original image is in-domain, it is mapped back to its manifold, near its original location. If it is out-of-domain, the image is mapped to a different manifold, likely leaving a large distance between the orig- inal image and the mapped image. Figure 2 shows the high-level workflow of LMD. Algorithm 2 summarizes the key steps of LMD in pseudocode. Lifting Images. To lift an image off its manifold, we need to corrupt the image so that it no longer appears to be from its original manifold. Concretely, we apply a mask to the image so that part of it is completely removed. Since various mask patterns and sizes can be used, masking provides a direct and flexible way to lift the image from the manifold. For example, it is intuitive to see that the larger the mask is, the further away the image is lifted from the manifold. Mapping the Lifted Images. Since diffusion models (DM) can perform inpainting without retraining (Song et al., 2020; Lugmayr et al., 2022) (see Algorithm 1), we naturally em- ploy a DM and use inpainting to map the lifted images. Specifically, we employ a DM parametrized by θin that is trained on the in-domain data. This DM can model the in- domain distribution well enough to map a lifted in-domain image back to its original vicinity. Meanwhile, the DM should have almost no knowledge about the out-of-domain manifold. Thus, it naturally maps a lifted out-of-domain image towards the DM's training manifold, which is the in-domain manifold. This phenomenon leads to a larger distance between the original and mapped images for out- of-domain images than the in-domain ones. For ease of ref- erence, we also refer these mapped images as reconstructed images or simply reconstructions. Algorithm 1 Inpaint Input: original image xorig, binary mask M where 0 indicates region to be inpainted, diffusion model θ Output: inpainted image xinp for t = T to 1 do if t == T then xinp ← sample from noise distribution end if x′ orig ← diffuse(xorig; θ) to step t − 1 xinp ← denoise(xinp; θ) to step t − 1 xinp ← x′ orig * M + xinp * (1 − M ) end for return xinp The intuition behind our algorithm, Lift, Map, Detect (LMD), is illustrated in Figure 1. In a nutshell, we employ a Reconstruction Distance Metric. We adopt the Learned Perceptual Image Patch Similarity (LPIPS) (Zhang et al., 3 Unsupervised Out-of-Distribution Detection with Diffusion Inpainting Figure 2. High-level workflow of LMD. LMD employs a diffusion model learned over the in-domain manifold. It first repeatedly lifts an image from its manifold by masking it, and maps it towards the diffusion model's training manifold by inpainting. Then, it inspects the median distance between the original image and each mapped image to detect out-of-domain images. As out-of-domain images cannot be mapped back to their own manifolds, they have larger distances. 2018) metric, a standard and strong metric that captures the perceptual difference between images. Since LPIPS assigns higher values to more dissimilar images, we compute the LPIPS between original and reconstructed images, and use it directly as the OOD score. We perform detailed ablation on different reconstruction distance metrics in Section 4.4. It is worth noting that mapping lifted images is the most cru- cial component. The hypothesis – in-domain reconstructions are closer to their original images than the out-of-domain ones – ensures the effectiveness of LMD. With this in mind, we now discuss two simple and yet effective ways that can further improve detection performance consistently: multi- ple reconstructions and novel masking strategy. Multiple Reconstructions. The DM inpainting process inherently involves multiple sampling steps. Occasionally, due to randomness, DM could provide dissimilar recon- structions for in-domain data, or similar reconstructions for out-of-domain data. This could make the reconstruction distance of the in-domain and out-of-domain images less separable, and hence lead to suboptimal OOD detection per- formance. To reduce the randomness, we perform multiple lifting and mapping attempts for each image. We calculate the OOD score from each attempt, and take the median1 OOD score as the final OOD score for an image. As shown in Section 4.3, the simple median aggregation already pro- vides strong performance. For further improvement, one may use a parameterized model to learn the distribution of the reconstruction distance across multiple attempts. We 1In our preliminary experiments, we find that median works better than other simple aggregation methods such as mean. leave this to future work. Algorithm 2 Lift, Map, Detect (LMD) Input: test image x, in-domain diffusion model θin Output: OOD score of test image x for i = 1 to r do Mi ← Get Mask(i) x′ i ← Inpaint(x, Mi, θin) di ← Distance(x, x′ i) end for return Aggregate(d1, . . . , dr) Novel Masking Strategy. The extent to which we mask an image is crucial to the detection performance. If the size of the mask is too large (or too small), the reconstruction dis- tance for both in-domain and out-of-domain images would be very large (or very small). Indeed, if the mask covers the entire image, the reconstruction will be independent of the original image. In this case, if the in-domain manifold contains diverse images, an in-domain reconstruction can be far from its original image despite still being on the same manifold. Therefore, a suitable masking strategy should leave enough context to allow in-domain reconstructions to be similar to the original ones. To this end, we propose to use a checkerboard mask pattern. It divides an image into an N × N grid of image patches independent of the image size, and masks out half of the patches similar to a checkerboard. When multiple reconstruction attempts are performed, we also invert the masked and unmasked regions at each attempt. We call this masking strategy al- ternating checkerboard N × N (see Figure 3). Alternating 4 d( , ) = 0.149 d( , ) = 0.146 d( , ) = 0.033 Lift from ManifoldIn-domain ImageInpainted 1Inpainted rMap to Manifold...Masked 1Masked rMeasure DistanceLift from ManifoldOut-of-domain ImageInpainted 1Inpainted r...Masked 1Masked rMap to Manifold......Median Distance = 0.042√Median Distance = 0.148×DMDMd( , ) = 0.050 Measure Distance...... Unsupervised Out-of-Distribution Detection with Diffusion Inpainting checkerboard ensures all regions of the image to be masked with just two attempts. This avoids situations in which the distinguishing features of an out-of-domain image is never masked. LMD by default sets N = 8; ablation study on different mask choices can be found in Table 2. Figure 3. The alternating checkerboard mask pattern. We invert regions that are masked and unmasked at each reconstruction attempt. The example in the figure is 8 × 8. 4. Experiments 4.1. Experiment Settings Evaluation Metric. LMD outputs an OOD score for each input, so in practice we need to apply a threshold to binarize the decision. In the experiments, we follow Hendrycks & Gimpel (2016); Ren et al. (2019); Xiao et al. (2021), and use the area under Receiver Operating Characteristic curve (ROC-AUC) as our quantitative evaluation metric. Baselines. We compare our methods with seven existing baselines: Likelihood (Likelihood) (Bishop, 1994), Input Complexity (IC) (Serr`a et al., 2019), Likelihood Regret (LR) (Xiao et al., 2020), Pretrained Feature Extractor + Mahalanobis Distance (Pretrained) (Xiao et al., 2021), Re- construction with Autoencoder and Mean Squared Error loss (AE-MSE), AutoMahalanobis (AE-MH) (Denouden et al., 2018) and AnoGAN (AnoGAN) (Schlegl et al., 2017). Likelihood is obtained from the DM using the implementa- tion from Song et al. (2020)2. For both Input Complexity and Likelihood Regret, we adapt the official GitHub repos- itory of Likelihood Regret3. Specifically, to compute the Input Complexity, we use the likelihood calculated from the DM for a fair comparison, and convert the compression size to bits per dimension; we use the PNG compressor, because it yields the best performance among all available compres- sors in the GitHub repository. Pretrained Feature Extractor + Mahalanobis Distance is implemented by ourselves, as there is no existing publicly available implementation to our best knowledge. Datasets. We perform OOD detection pairwise among CI- FAR10 (Krizhevsky, 2009), CIFAR100 (Krizhevsky, 2009) and SVHN (Netzer et al., 2011), and pairwise among MNIST (LeCun et al., 2010), KMNIST (Clanuwat et al., 2018) and FashionMNIST (Xiao et al., 2017). For LMD and 2https://github.com/yang-song/score sde pytorch 3https://github.com/XavierXiao/Likelihood-Regret 5 all the baselines, we use the training set of the in-domain dataset to train the model if needed, and evaluate the perfor- mance on the full test set of in-domain and out-of-domain datasets. Additionally, to demonstrate our performance on higher resolution images, we show qualitative results on CelebA-HQ (Karras et al., 2017) as in-domain and Ima- geNet (Russakovsky et al., 2015) as out-of-domain. 4.2. Implementation Details of LMD We adapt the diffusion model implementation from Song et al. (2020). For experiments in Table 1, we use Song et al. (2020)'s pretrained checkpoint for CIFAR10, and we train DMs on the training set of the in-domain dataset for all the other datasets. We evaluate the OOD scores of the full in-domain and out-of-domain test sets. The inpainting recon- struction is repeated 10 times with alternating checkerboard 8 × 8 masks (Figure 3). For CelebA-HQ vs. ImageNet, we observe that CelebA-HQ does not have a train/test set split, and its pretrained checkpoint is trained over the full dataset. Thus, to avoid potential memorization issues, we use the pretrained FFHQ (Karras et al., 2019) checkpoint instead. We randomly sample a subset of size 100 from each dataset, and standardize all images to 256 × 256. We explore three mask choices: checkerboard 4 × 4, checkerboard 8 × 8, and a square-centered mask. We reconstruct each image only once. We use LPIPS as the reconstruction distance metric to calculate the OOD score for all the experiments. 4.3. Experimental Results Table 1 shows the performance of LMD and the baselines on various pairs of datasets. LMD achieves the highest perfor- mance on five pairs, with a maximum improvement of 10% (CIFAR100 vs. SVHN). LMD also achieves competitive performance on several other pairs, and attains the highest average ROC-AUC. This shows that LMD is consistent and versatile. We observe that the performance of the baselines are competitive on some pairs but limited on the others. Figure 5 shows examples of the original, masked and in- painted images for three pairs. We show four reconstruction examples for each image, two with checkerboard mask and two with inverted checkerboard mask. The diffusion mod- els reconstruct the in-domain images relatively accurately, while introducing a lot of artifacts in the out-of-domain in- paintings. For example, when SVHN is out-of-domain, the noise almost overwhelms the signals in the inpaintings. Figure 6 shows the qualitative results and the ROC-AUC for CelebA-HQ vs. ImageNet. Checkerboard 8 × 8 performs competitively, achieving an ROC-AUC of 0.991 without any repeated reconstructions. Visually, the in-domain inpaint- ings look almost identical to the original images, while the out-of-domain inpaintings are locally incoherent. In this specific setting, checkerboard 4 × 4 and center masks yield ⋯Attempt 1CheckerboardAttempt 2Inverted CheckerboardOriginal ImageAttempt 4Inverted CheckerboardAttempt 3Checkerboard Unsupervised Out-of-Distribution Detection with Diffusion Inpainting Table 1. ROC-AUC performance of LMD against various baselines on 12 pairs of datasets. Higher is better. We use the same configuration for LMD across all datasets: Alternating checkerboard mask 8 × 8, distance metric LPIPS, and 10 reconstructions per image. LMD consistently demonstrates strong performance and attains the highest average ROC-AUC. ID CIFAR10 CIFAR100 SVHN MNIST KMNIST FASHIONMNIST AVERAGE OOD LIKELIHOOD IC LR PRETRAINED AE-MSE AE-MH ANOGAN LMD CIFAR100 SVHN CIFAR10 SVHN CIFAR10 CIFAR100 KMNIST FASHIONMNIST MNIST FASHIONMNIST MNIST KMNIST 0.520 0.180 0.495 0.193 0.974 0.970 0.948 0.997 0.152 0.833 0.172 0.542 0.581 0.568 0.870 0.468 0.792 0.973 0.976 0.903 1.000 0.951 0.999 0.912 0.584 0.546 0.904 0.484 0.896 0.805 0.821 0.999 0.999 0.431 0.557 0.971 0.994 0.833 0.783 0.806 0.888 0.543 0.776 0.999 0.999 0.887 0.999 0.582 0.993 0.647 0.730 0.821 0.510 0.025 0.509 0.027 0.981 0.980 0.999 1.000 0.102 0.896 0.804 0.976 0.651 0.488 0.073 0.486 0.122 0.966 0.966 1.000 1.000 0.217 0.868 0.969 0.996 0.679 0.518 0.120 0.510 0.131 0.967 0.962 0.933 0.992 0.317 0.701 0.835 0.912 0.658 0.607 0.992 0.568 0.985 0.914 0.876 0.984 0.999 0.978 0.993 0.992 0.990 0.907 slightly better performance. This is probably because faces are highly structured and provide a strong inductive bias. Thus, with larger contiguous masked regions, the DM can still produce reasonably authentic reconstructions for the in-domain images, while being able to introduce more obvi- ous artifacts for the out-of-domain images. Consequently, the reconstruction qualities of the two domains are more distinguishable. More discussion on mask choices can be found in Section 4.4. Figure 4. Visualization of the masks used in the mask ablation. For the random patch mask, this figure only shows one example; we sample a different pattern at each reconstruction attempt. 4.4. Ablation Effects of Mask Choices. Table 2 shows ablation results on different types of mask patterns (see Figure 4). Specifically, we examine the following patterns: alternating checkerboard 4×4 and 16×16, a fixed non-alternating 8×8 checkerboard, a square centered mask covering one-fourth of an image (center), and a random patch mask covering 50% of an 8 × 8 patch grid (random patch) introduced in Xie et al. (2022)4. Alternating checkerboard 8 × 8 performs consistently across the three datasets, while other patterns have fluctuation in their performance. Not surprisingly, the center mask ex- hibits very poor performance (0.444) on MNIST vs. KM- 4https://github.com/microsoft/SimMIM 6 NIST, as it removes too much information from the im- ages. Alternating checkerboard 4 × 4 also underperforms on MNIST vs. KMNIST. This suggests that if the masked patches are too large, both in-domain and out-of-domain reconstructions may be dissimilar from the original images. Fixed checkerboard 8 × 8 performs only slightly worse than its alternating counterpart, usually with a performance drop of less than 0.01. This may be because for these datasets, the distinguishing features of the in-domain and out-of-domain images exist in many patches. Thus, they can already be captured well enough by the fixed 8 × 8 mask. Neverthe- less, the alternating checkerboard pattern should still be preferred, since it can mask the entire image across multiple reconstruction attempts. Effects of Reconstruction Distance Metrics. LMD needs to assess the reconstruction distance of the DM's inpaintings, so we explore three off-the-shelf reconstruction distance metrics: Mean Squared Error (MSE), Structural Similarity Index Measure (SSIM) (Wang et al., 2003), and Learned Perceptual Image Patch Similarity (LPIPS) (Zhang et al., 2018). Additionally, Xiao et al. (2021) demonstrates strong performance using SimCLRv2 (Chen et al., 2020) represen- tations, so we experiment with a SimCLRv2-based error metric too. Specifically, we calculate the cosine distance between the SimCLRv2 representations of the original and reconstructed images, which we simply refer to as Sim- CLRv2. These four reconstruction distance metrics range from shallow reference based to deep feature based metrics. We summarize the results of three dataset pairs in Table 3. LPIPS is competitive on all three dataset pairs, while MSE, SSIM, and SimCLRv2 fluctuate in their performance. In- terestingly, on CIFAR10 vs. CIFAR100, SimCLRv2 out- performs other metrics significantly, with an improvement of 0.09. In Table 1, Xiao et al. (2021) also outperforms OriginalImageCheckerboard4x4Checkerboard8x8Checkerboard16x16CenterRandomPatch Unsupervised Out-of-Distribution Detection with Diffusion Inpainting Figure 5. Reconstruction examples from three dataset pairs. "Orig." stands for the original image; "Inp." stands for the inpainted image. In general, the in-domain reconstructions are close to their original images, while the out-of-domain reconstructions are noisy and different from the original ones. Table 2. ROC-AUC performance on three dataset pairs with different mask types. Alternating checkerboard 8 × 8 shows strong and consistent performance. MASK TYPE CIFAR10 VS. CIFAR100 CIFAR10 VS. SVHN MNIST VS. KMNIST ALTERNATING CHECKERBOARD 4 × 4 ALTERNATING CHECKERBOARD 8 × 8 ALTERNATING CHECKERBOARD 16 × 16 FIXED CHECKERBOARD 8 × 8 CENTER RANDOM PATCH 0.594 0.607 0.597 0.601 0.570 0.591 0.987 0.992 0.981 0.990 0.978 0.990 0.923 0.984 0.997 0.974 0.479 0.912 Table 3. ROC-AUC performance on three dataset pairs with differ- ent reconstruction distance metrics. LPIPS attains consistent and strong performance, while other metrics have fluctuation in their performance. RECON. METRIC CIFAR10 VS. CIFAR100 CIFAR10 KMNIST VS. SVHN VS. MNIST MSE SSIM LPIPS SIMCLRV2 0.548 0.624 0.607 0.713 0.155 0.329 0.992 0.970 0.835 0.922 0.978 0.920 all other methods on CIFAR10 vs. CIFAR100 using Sim- CLRv2 representations. This suggests that other metrics may be suitable for specific domains, and LPIPS serves as an effective default choice for the distance metric. the performance. Figure 7 shows the ROC-AUC from one attempt to ten attempts per image for two pairs of datasets. In both dataset pairs, increasing the number of attempts almost always improves the ROC-AUC. The improvement is especially significant initially, and saturates at around ten attempts. The improvement is consistent across all four distance metrics, further supporting the effectiveness of LMD's multiple reconstructions approach. Table 4. ROC-AUC performance of our OOD detection framework with an alternative lifting and mapping instantiation – diffusion and denoising. It shows strong performance, although it is slightly outperformed by our default choice of masking and inpainting. MAPPING METHOD CIFAR10 VS. CIFAR100 CIFAR10 VS. SVHN FASHIONMNIST VS. MNIST Number of Reconstruction Attempts per Image. We also study the effect of the number of reconstruction attempts on DENOISING INPAINTING 0.600 0.607 0.976 0.992 0.941 0.992 7 In-domain ExamplesOut-of-domain ExamplesOrig.MaskedInp.MaskedInp.MaskedInp.MaskedInp.Orig.MaskedInp.MaskedInp.MaskedInp.MaskedInp.In-domain vs. Out-of-domainCIFAR10 vs. SVHNKMNIST vs. FashionMNISTFashionMNIST vs. KMNIST Unsupervised Out-of-Distribution Detection with Diffusion Inpainting Figure 6. Reconstruction examples from CelebA-HQ (in-domain) and ImageNet (out-of-domain) using different masks. For out-of-domain inpaintings, the checkerboard masks introduce locally incoherent artifacts, while the center mask introduces face-like artifacts. This makes the out-of-domain images highly distinguishable. promising alternative instantiations. 5. Discussion and Conclusion One limitation of the vanilla diffusion model is that the denoising process involves many iterations and is thus slow. Consequently, like many DM-based algorithms in other applications (Meng et al., 2021; Lugmayr et al., 2022), LMD is hard to be applied to real-time OOD detection at the current stage. Recently, there has been a popular line of work on speeding up diffusion models without retraining. For example, Nichol & Dhariwal (2021) re-scales the noise schedule to skip sampling steps, Liu et al. (2022) proposes pseudo numerical methods for diffusion models, and Watson et al. (2022) optimizes fast samplers that enable sampling with only 10-20 steps. This opens up a promising direction for future work to integrate these methods into LMD. In conclusion, we leverage the diffusion model's manifold mapping ability, and propose a method – Lift, Map, Detect (LMD) – for unsupervised OOD detection. We show that it is competitive and versatile through our experiments. (a) MNIST vs. KMNIST (b) KMNIST vs. MNIST Figure 7. ROC-AUC against number of reconstruction attempts on two pairs of datasets. As the number of reconstruction attempts increases, the OOD detection performance improves regardless of the choice of the reconstruction distance metric. Alternative Way of Lifting and Mapping. Alternatively, we can lift an image by diffusion, and map it by denoising. Table 4 shows the performance of our OOD detection frame- work under this instantiation on three dataset pairs. In our experiments, we add noise to step t = 500 in each attempt (where T = 1000), as it generally yields good results. Sim- ilar to our inpainting setting, we perform 10 attempts per image, and use the median reconstruction error under LPIPS as the OOD score. We observe that diffusion/denoising is also competitive, although it is slightly outperformed by masking/inpainting. This indicates that our framework is generally applicable in OOD detection, and supports various 8 In-domain ExamplesOut-of-domain ExamplesOriginalMaskedInpaintedOriginalMaskedInpaintedCheckerboard8x8Checkerboard4x4Center0.9910.9941.000Mask TypeROC-AUC246810# Reconstruction Attempts0.900.920.940.960.981.00ROC-AUCSimCLRSSIMMSELPIPS246810# Reconstruction Attempts0.750.800.850.900.95ROC-AUCSimCLRSSIMMSELPIPS Unsupervised Out-of-Distribution Detection with Diffusion Inpainting 6. Acknowledgement This research is supported by grants from DARPA AIE pro- gram, Geometries of Learning (HR00112290078), the Natu- ral Sciences and Engineering Research Council of Canada (NSERC) (567916), the National Science Foundation NSF (IIS-2107161, III1526012, IIS-1149882, and IIS-1724282), and the Cornell Center for Materials Research with funding from the NSF MRSEC program (DMR-1719875). References Ahmadian, A. and Lindsten, F. Likelihood-free out-of- distribution detection with invertible generative models. In IJCAI, pp. 2119–2125, 2021. Bergamin, F., Mattei, P.-A., Havtorn, J. D., Senetaire, H., Schmutz, H., Maaløe, L., Hauberg, S., and Frellsen, J. Model-agnostic out-of-distribution detection using com- bined statistical tests. In International Conference on Artificial Intelligence and Statistics, pp. 10753–10776. PMLR, 2022. Bergman, L. and Hoshen, Y. anomaly detection for general data. arXiv:2005.02359, 2020. Classification-based arXiv preprint Bishop, C. M. Novelty detection and neural network valida- tion. IEE Proceedings-Vision, Image and Signal process- ing, 141(4):217–222, 1994. Chen, T., Kornblith, S., Swersky, K., Norouzi, M., and Hinton, G. E. Big self-supervised models are strong semi-supervised learners. Advances in neural information processing systems, 33:22243–22255, 2020. Choi, H., Jang, E., and Alemi, A. A. Waic, but why? gen- erative ensembles for robust anomaly detection. arXiv preprint arXiv:1810.01392, 2018. Clanuwat, T., Bober-Irizar, M., Kitamoto, A., Lamb, A., Yamamoto, K., and Ha, D. Deep learning for classical japanese literature. 2018. Denouden, T., Salay, R., Czarnecki, K., Abdelzad, V., Phan, B., and Vernekar, S. Improving reconstruction autoen- coder out-of-distribution detection with mahalanobis dis- tance. arXiv preprint arXiv:1812.02765, 2018. Goodfellow, I. J., Pouget-Abadie, J., Mirza, M., Xu, B., Warde-Farley, D., Ozair, S., Courville, A., and Bengio, Y. Generative adversarial networks, 2014. URL https: //arxiv.org/abs/1406.2661. Graham, M. S., Pinaya, W. H., Tudosiu, P.-D., Nachev, P., Ourselin, S., and Cardoso, M. J. Denoising diffusion models for out-of-distribution detection. arXiv preprint arXiv:2211.07740, 2022. 9 Hamet, P. and Tremblay, J. Artificial intelligence in medicine. Metabolism, 69:S36–S40, 2017. Hendrycks, D. and Gimpel, K. A baseline for detecting misclassified and out-of-distribution examples in neural networks. arXiv preprint arXiv:1610.02136, 2016. Hendrycks, D., Mazeika, M., and Dietterich, T. Deep anomaly detection with outlier exposure. arXiv preprint arXiv:1812.04606, 2018. Hendrycks, D., Mazeika, M., Kadavath, S., and Song, D. Using self-supervised learning can improve model robust- ness and uncertainty. Advances in neural information processing systems, 32, 2019. Ho, J., Jain, A., and Abbeel, P. Denoising diffusion proba- bilistic models. Advances in Neural Information Process- ing Systems, 33:6840–6851, 2020. Huang, R., Geng, A., and Li, Y. On the importance of gradients for detecting distributional shifts in the wild. Advances in Neural Information Processing Systems, 34: 677–689, 2021. Karras, T., Aila, T., Laine, S., and Lehtinen, J. Pro- gressive growing of gans for improved quality, stabil- ity, and variation. CoRR, abs/1710.10196, 2017. URL http://arxiv.org/abs/1710.10196. Karras, T., Laine, S., and Aila, T. A style-based generator architecture for generative adversarial networks. In Pro- ceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 4401–4410, 2019. Kingma, D. P. and Dhariwal, P. Glow: Generative flow with invertible 1x1 convolutions. Advances in neural information processing systems, 31, 2018. Kirichenko, P., Izmailov, P., and Wilson, A. G. Why normal- izing flows fail to detect out-of-distribution data. Ad- vances in neural information processing systems, 33: 20578–20589, 2020. Krizhevsky, A. Learning multiple layers of features from tiny images. Technical report, 2009. LeCun, Y., Cortes, C., and Burges, C. Mnist hand- written digit database. ATT Labs [Online]. Available: http://yann.lecun.com/exdb/mnist, 2, 2010. Lee, K., Lee, K., Lee, H., and Shin, J. A simple unified framework for detecting out-of-distribution samples and adversarial attacks. Advances in neural information pro- cessing systems, 31, 2018. Li, D., Chen, D., Goh, J., and Ng, S.-k. Anomaly detection with generative adversarial networks for multivariate time series. arXiv preprint arXiv:1809.04758, 2018. Unsupervised Out-of-Distribution Detection with Diffusion Inpainting Liang, S., Li, Y., and Srikant, R. Enhancing the reliability of out-of-distribution image detection in neural networks. arXiv preprint arXiv:1706.02690, 2017. Liu, L., Ren, Y., Lin, Z., and Zhao, Z. Pseudo numeri- cal methods for diffusion models on manifolds. arXiv preprint arXiv:2202.09778, 2022. Lugmayr, A., Danelljan, M., Romero, A., Yu, F., Timofte, R., and Van Gool, L. Repaint: Inpainting using denoising In Proceedings of the diffusion probabilistic models. IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11461–11471, 2022. Maaløe, L., Fraccaro, M., Li ́evin, V., and Winther, O. Biva: A very deep hierarchy of latent variables for generative modeling. Advances in neural information processing systems, 32, 2019. Meng, C., He, Y., Song, Y., Song, J., Wu, J., Zhu, J.-Y., and Ermon, S. Sdedit: Guided image synthesis and editing with stochastic differential equations. In International Conference on Learning Representations, 2021. Morningstar, W., Ham, C., Gallagher, A., Lakshmi- narayanan, B., Alemi, A., and Dillon, J. Density of states estimation for out of distribution detection. In Interna- tional Conference on Artificial Intelligence and Statistics, pp. 3232–3240. PMLR, 2021. Nalisnick, E., Matsukawa, A., Teh, Y. W., Gorur, D., and Lakshminarayanan, B. Do deep generative models know what they don't know? arXiv preprint arXiv:1810.09136, 2018. Nalisnick, E. T., Matsukawa, A., Teh, Y. W., and Laksh- minarayanan, B. Detecting out-of-distribution inputs to deep generative models using a test for typicality. 2019. Netzer, Y., Wang, T., Coates, A., Bissacco, A., Wu, B., and Ng, A. Y. Reading digits in natural images with unsupervised feature learning. 2011. Nichol, A. Q. and Dhariwal, P. Improved denoising diffusion In International Conference on probabilistic models. Machine Learning, pp. 8162–8171. PMLR, 2021. Ren, J., Liu, P. J., Fertig, E., Snoek, J., Poplin, R., Depristo, M., Dillon, J., and Lakshminarayanan, B. Likelihood ra- tios for out-of-distribution detection. Advances in neural information processing systems, 32, 2019. Rigano, C. Using artificial intelligence to address criminal justice needs. National Institute of Justice Journal, 280: 1–10, 2019. Ruff, L., Vandermeulen, R. A., G ̈ornitz, N., Binder, A., M ̈uller, E., M ̈uller, K.-R., and Kloft, M. Deep semi-supervised anomaly detection. arXiv:1906.02694, 2019. arXiv preprint Russakovsky, O., Deng, J., Su, H., Krause, J., Satheesh, S., Ma, S., Huang, Z., Karpathy, A., Khosla, A., Bernstein, M., Berg, A. C., and Fei-Fei, L. ImageNet Large Scale Visual Recognition Challenge. International Journal of Computer Vision (IJCV), 115(3):211–252, 2015. doi: 10.1007/s11263-015-0816-y. Sakurada, M. and Yairi, T. Anomaly detection using au- toencoders with nonlinear dimensionality reduction. In Proceedings of the MLSDA 2014 2nd workshop on ma- chine learning for sensory data analysis, pp. 4–11, 2014. Salimans, T., Karpathy, A., Chen, X., and Kingma, D. P. Pixelcnn++: Improving the pixelcnn with discretized lo- gistic mixture likelihood and other modifications. arXiv preprint arXiv:1701.05517, 2017. Schlegl, T., Seeb ̈ock, P., Waldstein, S. M., Schmidt-Erfurth, U., and Langs, G. Unsupervised anomaly detection with generative adversarial networks to guide marker discov- ery. In International conference on information process- ing in medical imaging, pp. 146–157. Springer, 2017. Sehwag, V., Chiang, M., and Mittal, P. Ssd: A unified framework for self-supervised outlier detection. arXiv preprint arXiv:2103.12051, 2021. Serr`a, J., ́Alvarez, D., G ́omez, V., Slizovskaia, O., N ́u ̃nez, J. F., and Luque, J. Input complexity and out-of- distribution detection with likelihood-based generative models. arXiv preprint arXiv:1909.11480, 2019. Sohl-Dickstein, J., Weiss, E., Maheswaranathan, N., and Ganguli, S. Deep unsupervised learning using nonequi- librium thermodynamics. In International Conference on Machine Learning, pp. 2256–2265. PMLR, 2015. Song, Y. and Ermon, S. Generative modeling by estimating gradients of the data distribution. Advances in neural information processing systems, 32, 2019. Song, Y., Sohl-Dickstein, J., Kingma, D. P., Kumar, A., Er- mon, S., and Poole, B. Score-based generative modeling through stochastic differential equations. arXiv preprint arXiv:2011.13456, 2020. Tack, J., Mo, S., Jeong, J., and Shin, J. Csi: Novelty de- tection via contrastive learning on distributionally shifted instances. Advances in neural information processing systems, 33:11839–11852, 2020. Wang, H., Li, Z., Feng, L., and Zhang, W. Vim: Out-of- distribution with virtual-logit matching. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 4921–4930, 2022. 10 Unsupervised Out-of-Distribution Detection with Diffusion Inpainting Wang, Z., Simoncelli, E. P., and Bovik, A. C. Multiscale In structural similarity for image quality assessment. The Thrity-Seventh Asilomar Conference on Signals, Sys- tems & Computers, 2003, volume 2, pp. 1398–1402. Ieee, 2003. Watson, D., Chan, W., Ho, J., and Norouzi, M. Learning fast samplers for diffusion models by differentiating through sample quality. In International Conference on Learning Representations, 2022. Xia, Y., Cao, X., Wen, F., Hua, G., and Sun, J. Learning discriminative reconstructions for unsupervised outlier removal. In Proceedings of the IEEE International Con- ference on Computer Vision, pp. 1511–1519, 2015. Xiao, H., Rasul, K., and Vollgraf, R. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms. CoRR, abs/1708.07747, 2017. URL http: //arxiv.org/abs/1708.07747. Xiao, Z., Yan, Q., and Amit, Y. Likelihood regret: An out-of- distribution detection score for variational auto-encoder. Advances in neural information processing systems, 33: 20685–20696, 2020. Xiao, Z., Yan, Q., and Amit, Y. Do we really need to learn representations from in-domain data for outlier detection? arXiv preprint arXiv:2105.09270, 2021. Xie, Z., Zhang, Z., Cao, Y., Lin, Y., Bao, J., Yao, Z., Dai, Q., and Hu, H. Simmim: A simple framework for masked image modeling. In Proceedings of the IEEE/CVF Con- ference on Computer Vision and Pattern Recognition, pp. 9653–9663, 2022. Yang, L., Zhang, Z., Song, Y., Hong, S., Xu, R., Zhao, Y., Shao, Y., Zhang, W., Cui, B., and Yang, M.-H. Diffu- sion models: A comprehensive survey of methods and applications. arXiv preprint arXiv:2209.00796, 2022. Zhang, R., Isola, P., Efros, A. A., Shechtman, E., and Wang, O. The unreasonable effectiveness of deep features as a perceptual metric. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 586–595, 2018. Zhou, C. and Paffenroth, R. C. Anomaly detection with robust deep autoencoders. In Proceedings of the 23rd ACM SIGKDD international conference on knowledge discovery and data mining, pp. 665–674, 2017. Zong, B., Song, Q., Min, M. R., Cheng, W., Lumezanu, C., Cho, D., and Chen, H. Deep autoencoding gaus- sian mixture model for unsupervised anomaly detection. In International conference on learning representations, 2018. 11
http://arxiv.org/abs/2302.10325v2
2023-07-07T18:25:00
2023-02-20T21:34:36
Adaptive Sparse Gaussian Process
Adaptive learning is necessary for non-stationary environments where the learning machine needs to forget past data distribution. Efficient algorithms require a compact model update to not grow in computational burden with the incoming data and with the lowest possible computational cost for online parameter updating. Existing solutions only partially cover these needs. Here, we propose the first adaptive sparse Gaussian Process (GP) able to address all these issues. We first reformulate a variational sparse GP algorithm to make it adaptive through a forgetting factor. Next, to make the model inference as simple as possible, we propose updating a single inducing point of the sparse GP model together with the remaining model parameters every time a new sample arrives. As a result, the algorithm presents a fast convergence of the inference process, which allows an efficient model update (with a single inference iteration) even in highly non-stationary environments. Experimental results demonstrate the capabilities of the proposed algorithm and its good performance in modeling the predictive posterior in mean and confidence interval estimation compared to state-of-the-art approaches.
[ "Vanessa Gómez-Verdejo", "Emilio Parrado-Hernández", "Manel Martínez-Ramón" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10325v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10325v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "stat.ML" ]
Adaptive Sparse Gaussian Process Vanessa Gómez-Verdejo∗, Emilio Parrado-Hernández∗, Manel Martínez-Ramón†, Senior Member, IEEE. ∗Signal Processing and Communications Department, University Carlos III de Madrid, Leganés, 28911, Madrid, Spain. †Electrical and Computer Engineering Department, The University of New Mexico, Albuquerque, 87106, NM, USA. 1 3 2 0 2 l u J 7 ] G L . s c [ 2 v 5 2 3 0 1 . 2 0 3 2 : v i X r a Abstract-Adaptive learning is necessary for non-stationary environments where the learning machine needs to forget past data distribution. Efficient algorithms require a compact model update to not grow in computational burden with the incoming data and with the lowest possible computational cost for online parameter updating. Existing solutions only partially cover these needs. Here, we propose the first adaptive sparse Gaussian Process (GP) able to address all these issues. We first reformulate a variational sparse GP algorithm to make it adaptive through a forgetting factor. Next, to make the model inference as simple as possible, we propose updating a single inducing point of the sparse GP model together with the remaining model parameters every time a new sample arrives. As a result, the algorithm presents a fast convergence of the inference process, which allows an efficient model update (with a single inference iteration) even in highly non- stationary environments. Experimental results demonstrate the capabilities of the proposed algorithm and its good performance in modeling the predictive posterior in mean and confidence interval estimation compared to state-of-the-art approaches. Index Terms-Sparse Gaussian Process, Variational learning, Online learning, Adaptive learning I. INTRODUCTION Signal processing applications [1] usually require online learning methods, i.e., algorithms capable of self-updating as new data arrive in the system. Moreover, in applications such as spectral estimation, signal modeling, adaptive filtering, or array processing, the signals to be processed are nonstationary (their distributions change over time), so we need algorithms capable of adapting to the new data distributions and forgetting the past. This is known as adaptive learning [2, 3]. In this sense, Bayesian models [4] and in particular Gaussian Processes (GP) [5] seem to be an ideal solution since each time a new sample arrives the predictive posterior can be updated using the previous posterior as new prior of the model and multiplying it by the likelihood of the new data. This idea can be further extended to models which include hidden latent variables and require learning algorithms such as Expectation Maximization, providing what is known in the literature as online Variational Bayes [6]. The main problem of these approaches relies on the fact that the predictive posterior parameters usually depend on all the training data and therefore, as new samples arrive, its complexity tends to grow with Corresponding vanes- author: Vanessa Gómez-Verdejo [email protected]). This work is partially supported by grants PID2020- 115363RB-I00 by MCIN/AEI/10.13039/50110001103, Spain, TED2021-132366B-I00 funded by MCIN/AEI/10.13039/501100011033 and by the "European Union NextGenerationEU/PRTR", EPSCoR OIA-1757207, funded by NSF, USA, and the King Felipe VI Endowed Chair of the UNM. (email: funded O(N 3), N being the number of samples, which makes them intractable if not combined with pruning schemes [7]. A possible solution to this problem is to use low computa- tional cost GP versions [8] or, more specifically, to resort to Sparse GP (SGP) [9]. In these approaches, the model solution only depends on M << N points in the observation space, called inducing points. This avoids the complexity of the model growing as each new sample arrives. However, this strategy complicates the model inference since, in each iteration, the algorithm has to learn and update the kernel and noise parameters and, additionally, the positions of these inducing points and their variational distribution if we resort to variational versions of these models [10]. Despite the number of online applications, there are few proposals for online GP able to provide, on the one hand, a compact solution or, in other words, whose complexity does not grow with the incoming training data, while, on the other hand, keep a low computational cost and capable of efficiently updating the parameters of the model with every new data. For example, [11] proposed a compact Bayesian online algorithm based on an approximation to the real predictive posterior with a computational cost of O(N M 2). The drawback of this approach is that, despite sequentially updating the subset of M relevant data, the remaining model hyperparameters, as the kernel parameters and noise variance, keep fixed. Other approaches directly propose to use SGP models and ex- ploit the structure of the resulting kernel matrices. For example, [12] approximates the kernel matrix using K eigenfunctions to obtain a fast computation of the likelihood derivatives. A more recent work [13] introduces a structured kernel interpolation approach of order K to reduce the computational cost of updating the predictive distribution to O(M K 2). This model has the limitation of having to predefine (and keep fixed) the set of inducing points. Besides, it has the additional drawback of being based on SGPs, so the obtained posterior is an approximation to the exact one, and its performance tends to be worse than the batch approach. To overcome this last limitation, it is preferable to rely on variational SGPs algorithms, where the fact of including a variational distribution over the inducing points avoids the error of approximating the posterior. In this line, we can find the works [14] or [15] where the authors propose an incremental learning algorithm for variational SGPs, although their hyperparameters are fixed during the training procedure. Another interesting approach is the model presented in [16], where the authors propose to update the variational bound with an online variational Bayesian scheme. This way the model is efficiently updated at each iteration with complexity similar to that of a standard SGP, but with the advantage of having a variational bound expression to be optimized with respect to all the model hyperparameters, including the inducing point locations. Within the models based on variational SGP formulations, we can find other methods [17, 16] that use Variational Stochastic Inference (VSI) to obtain online versions, since the VSI strategy allows them to work with mini-batches of data, providing a straightforward scheme to add new data to the minibatch as they arrive. However, these approaches present two problems: first, the stochastic optimization assumes that the data subsampling process is uniformly random, an assumption that does not necessarily hold in online or non-stationary environments; second, this optimization usually requires that each mini-batch is processed in several iterations, which is often not compatible with the computational constraints of an online approach. Finally, the major shortcoming that we have found in all the above-mentioned algorithms for their use in real signal processing applications is that they are designed to work in an online environment, but not in nonstationary scenarios. To our knowledge, there are no adaptive versions of compact or SGP formulations. So, to provide a solution to these needs, in this paper, we propose an adaptive GP that includes: • Adaptive learning, or the ability to forget the information of the remote samples and, thus, the capability to self- adapting to non-stationary environments. • Efficiently predictive distribution update with a cost of O(M 3) each time a new sample arrives. • If it is desired, at each iteration, it can update the set of inducing points and the rest of the hyperparameters of the model with a cost of O(N M 2). • To update the inducing point set at each iteration, only a single inducing point is updated. This significantly reduces the number of parameters to be inferred, and a single inference iteration is usually sufficient to obtain an accurate value of the model parameters. • Finally, unlike reference approaches, the proposed model can recover the solution of the batch variational SGP formulation. That is, if at a given time instant we consider the same model parameters and eliminate the forgetting factor, its predictive distribution converges to that of the original model. As we will see in the experimental section, in practice, this translates into an improvement in the model performance. The rest of the paper is structured as follows. Section 2 reviews GP models, paying special attention to SGPs and the variational version used as starting point of our proposal. Then, Section 3 introduces the proposed algorithm, starting by developing its adaptive formulation and then explaining how to do efficient online learning on this model. Section 4 analyzes the performance of the model showing over a load forecasting application the advantages of having a compact, efficient, and adaptive GP model able to track the signal changes over time. Finally, Section 5 presents the main conclusions of this work. The implementation of all proposed models is available at https://github.com/vgverdejo/AdaptiveSparseGP. 2 II. A REVIEW OF SPARSE GAUSSIAN PROCESSES A. Gaussian Processes Assume a regression problem defined by a training dataset n=1, with xn ∈ RD and yn ∈ R, where each yn is {xn, yn}N generated by a noisy version of a latent function f (xn) = fn, i.e. yn = fn + εn, εn ∼ N (0, σ2). Assume further that function fn can be expressed as fn = ⟨w, φ(xn)⟩ = w⊤φ(xn), (1) (2) where w are the primal parameters, which are modeled as a multivariate Gaussian with zero mean and covariance matrix Σp. Function φ(*) is a nonlinear mapping of the input data xn into a Hilbert space H endowed with a dot product ⟨φ(x), φ(x′)⟩, usually called a Mercer's kernel function, which, by virtue of the Mercer's Theorem [18], is a dot product if and only if such function is positive semidefinite. From expression (1) the covariance between instances of the latent function can be computed as E [fn * fm] =E (cid:2)φ(xn)⊤ww⊤φ(xm)(cid:3) =φ(xn)⊤E (cid:2)ww⊤(cid:3) φ(xm) =φ(xn)⊤Σpφ(xm) p φ(xn), Σ1/2 =⟨Σ1/2 p φ(xm)⟩ = k(xn, xm). (3) Since Σp is positive semidefinite, then function k(xn, xm) is positive semidefinite and hence it is a valid kernel dot product. The GP model for regression [19] considers that the joint process of the latent functions f = [f (x1), . . . , f (xN )] is drawn from a multivariate Gaussian prior p(f ) with with zero mean and covariance Kxx, where this matrix contains all the kernel dot products k(xn, xm) between input data xn and xm for 1 ≤ n, m ≤ N . From this model, we can obtain the predictive posterior for a test sample x∗ as (cid:90) p(f∗|y) = = N p(f∗|f )p(f |y)df = (cid:16) f∗|k⊤ x∗ (cid:0)Kxx + σ2I(cid:1)−1 y, (cid:0)Kxx + σ2I(cid:1)−1 (4) (cid:17) , kx∗ k∗∗ − k⊤ x∗ where kx∗ is a column vector with the kernel products k(xn, x∗), for 1 ≤ n ≤ N , k∗∗ = k(x∗, x∗) is the kernel product of x∗ with itself, and y = [y1, . . . , yN ] ∈ RN is the vector representation of all the training labels. The computation of this posterior requires the inversion of an N × N matrix, which takes a computational burden of O(N 3). B. Sparse Gaussian Processes The motivation of SGPs is to reduce this computational cost by including a set of M inducing variables or inducing points um, 1 ≤ m ≤ M , that approximate the dual space to produce a compact GP model with computational burden O(N M 2). The first versions of the SGP can be unified in a common framework [9] considering that the covariance of the GP prior is modified by an approximate matrix. For example, in [20] Kxx is replaced by a Nyströn approximation KxuK−1 uu Kux, Kxu and Kuu being the kernel matrix of the inducing points with the training data and with themselves, respectively. An evolution of this method, introduced in [21], corrects the approximated matrix with the term diag(Kxx) − diag(KxuK−1 uu Kux) so that the diagonal of Kxx is exact. The main drawback of these approximations is that they do not tend to the exact GP, since they start from an approximation to the real prior, so their posterior will be an approximation to the real one. Moreover, the inducing inputs constitute additional parameters to be inferred, increasing the overfitting risk. C. Variational Sparse Gaussian Processes The Variational Sparse Gaussian Process (VSGP) introduced by Titsias in [10] is intended to overcome the abovementioned limitations by minimizing the divergence between the exact GP posterior and a variational approximation where the inducing points are modeled as variational parameters. This way, by minimizing the divergence with respect to these inducing points, we get the SGP to tend to the original one and, by introducing a variational prior over the inducing variables, we reduce the overfitting risk. To introduce this formulation, let us consider a set of induc- ing inputs U = [u1, . . . , uM ], with their corresponding latent variables fu = [f (u1), . . . , f (uM )]⊤. Then, the predictive posterior of the VSGP is given by (cid:90) (cid:90) p(f∗|y) = p(f∗|fu, f )p(f |fu, y)p(fu|y)df dfu. (5) Assuming that fu is a sufficient statistic for f , p(f∗|fu, f ) can be approximated by p(f∗|fu). Moreover, approximating the posterior distribution p(fu|y) by a variational distribution q(fu), the following approximate posterior can be used (cid:90) (cid:90) q(f∗) = p(f∗|fu)p(f |fu)q(fu)df dfu (cid:90) = p(f∗|fu)q(fu)dfu. (6) Considering that q(fu) is a Gaussian distribution with mean μ and covariance A, the following approximate predictive posterior is obtained q(f∗) = N (f∗|m∗, v∗) m∗ = k⊤ u∗K−1 uu μ v∗ = k∗∗ − k⊤ u∗K−1 uu ku∗ + k⊤ u∗K−1 uu AK−1 uu ku∗, (7) where ku∗ is a column vector with the kernel products between x∗ and U. The main advantage of this approach relies on the fact that once μ, A, and U are obtained, the prediction of a new sample does not depend on training data, but only on these parameters. So the complexity of predicting a new sample is O(M 3) (it does not depend on N ). To complete this model, one needs to find the variational parameters μ, A, and U. For this purpose, [10] introduces the following variational lower bound of the true log marginal likelihood log p(y) ≥ FV (U, q(fu)) = (cid:90) q(fu) log G(fu, y)p(fu) q(fu) dfu (8) where log G(fu, y) = log N (cid:0)y|KxuK−1 1 − 2σ2 tr (cid:8)Kxx − KxuK−1 uu fu, σ2I(cid:1) uu Kux 3 (9) (cid:9) , with tr {*} being the trace operator. To optimize (8) w.r.t the variational parameters, [10] proposes to apply Jensen's inequality to move the logarithm out of the integral and, thus, to cancel distribution q(fu) to obtain a collapsed version of this bound, i.e., (cid:1) uu Kux (cid:9) . FV (U) = log N (cid:0)y|0, σ2I + KxuK−1 (10) 1 − 2σ2 tr (cid:8)Kxx − KxuK−1 and where KxuK−1 uu Kux is the covariance matrix of p(fu). This new bound can be maximized to obtain the optimal values of U, as well as other model hyperparameters, such as the kernel parameters and the noise variance. uu Kux Finally, to obtain the optimal value of q(fu), we can differentiate (8) with respect to q(fu) and set it to zero. This leads to the fact that the optimal distribution is proportional uu fu, σ2I(cid:1) p(fu) and identifying terms, we see to N (cid:0)y|KxuK−1 that the optimal expression for q(fu) is q(fu) = N (fu|μ, A) μ = σ−2KuuBKuxy A = KuuBKuu, (11) (cid:1)−1 where B = (cid:0)Kuu + σ−2KuxKxu . Eq. (11) allows to obtain μ and A to completely define the predictive posterior (7). Note that both the optimization of (10) and the computation of (11) have a computational burden of O(N M 2). This provides fundamental advantages that allow novel and efficient adaptive GP variants, which will become apparent next. III. ADAPTIVE ONLINE VSGPS In this section, we consider that we are working in a time-dependent framework, so in each time instant t a new data pair (xt, yt) arrives. To be able to efficiently deal with this new scenario, we next reformulate the previous VSGP model to make it able to: (1) forget older samples (adaptive capabilities); and, (2) be updated with the information of each new sample reusing the previous time instant model solution (online learning). A. Adaptive VSGP To endow the VSGP formulation with adaptive properties, we can modify the marginal likelihood bound (8) by including a forgetting factor λ (similar to that of the Recursive Least Squares filter [2]) so that older data weigh less in the bound. Then, we can maximize this λ dependent bound to obtain the model hyperparameters, as well as the new parameters of the q(fu) distribution. For this purpose, as the only data-dependent term in FV (U, q(fu)) is log G(fu, y), we include λ into this term and we start considering time instant t, so only data from t′ = 1 to t are available, then, log Gλ(fu, y) = t (cid:88) t′=1 λt−t′ log G(fu, yt′) = − t (cid:88) t′=1 1 2σ2 λt−t′ log N (cid:0)yt′|k⊤ ut′K−1 uu fu, σ2(cid:1) (12) t (cid:88) t′=1 λt−t′ (cid:0)kt′t′ − k⊤ ut′K−1 uu kut′ (cid:1) , where y = [y1, . . . , yt]⊤, kut′ = kuxt′ is a vector constructed with the kernel products between U and sample xt′, and kt′t′ is the kernel of xt′ with itself. After some manipulations (see Appendix A), we can transform (12) into log Gλ(fu, y) ∝ log N (cid:0)y|KxuK−1 1 2 uu fu, σ2Λ−1(cid:1) − 1) log(2πσ2) (λt−t′ t (cid:88) − (13) t′=1 + 1 2σ2 t (cid:88) λt−t′ (cid:0)kt′t′ − k⊤ ut′K−1 uu kut′ (cid:1) , t′=1 where Λ is a t × t diagonal matrix with Λt′t′ = λt−t′ and now Kxu is constructed with the kernel products between samples x1, . . . , xt and the inducing points. The λ dependent FV (U) bound is thus given by: V (U) = log N (cid:0)y|0, σ2Λ−1 + KxuK−1 F λ uu Kux (cid:1) − + 1 2 t (cid:88) (λt−t′ − 1) log(2πσ2) t′=1 1 2σ2 t (cid:88) t′=1 λt−t′ (cid:0)kt′t′ − k⊤ ut′K−1 uu kut′ (14) (cid:1) . The effect of the introduction of parameter λ can be interpreted in Eq. (14) as an enhancement of the noise term that increases when t′ decreases. That is, an increasing uncertainty is attributed to the older training samples. This is a parameter of the cost function, but not a parameter that can be included in the graphic model, and therefore, we do not optimize it maximizing the ELBO function with respect to λ, but it is a hyperparameter that must be selected by the user, as it is done in traditional adaptive algorithms. To complete this model, we obtain the adaptive version of the variational distribution of the inducing points, qλ(fu). For this purpose, its optimum value has to be proportional to N (cid:0)y|KxuK−1 uu fu, σ2Λ−1(cid:1) p(fu) and therefore its mean μλ and covariance Aλ are given by: μλ = σ−2KuuBλKuxΛy Aλ = KuuBλKuu, with Bλ = (cid:0)Kuu + σ−2KuxΛKxu . Finally, by replacing the optimum values of μλ and Aλ into the predictive distri- bution of the VSGP (see (7)), we can obtain the mean and variance of adaptive predictive distribution as (15) (cid:1)−1 mλ,∗ = σ−2k⊤ vλ,∗ = k∗∗ + k⊤ u∗ u∗BλKuxΛy (cid:0)Bλ − K−1 uu (cid:1) ku∗. (16) 4 B. Online update of the Adaptive VSGP With the above model, we can train a GP for non-stationary environments so that the model will learn the distribution of the most recent samples. However, to make this model work efficiently in such scenarios, we need to be able to efficiently update its solution as new samples arrive. To carry out this online learning there are two possible working modes. Firstly, a fast implementation where noise and kernel parameters are considered fixed and, for every new data, we update the predictive distribution and, if needed, the inducing point set. Secondly, a more accurate solution where all model parameters are updated to efficiently track the data distribution changes. Next, these approaches are explained in detail. 1) Model update without inference over the model parame- ters: If we consider that both the noise and kernel parameters are fixed, when a new training sample arrives, (xt+1, yt+1), we only have to update the mean and variance of the adaptive predictive distribution (see Eq. (16)). Considering these values were (mλ,∗)t and (vλ,∗)t, the new values at t + 1 will be given by: (mλ,∗)t+1 = σ−2k⊤ (vλ,∗)t+1 = k∗∗ + k⊤ u∗ u∗ (Bλ)t+1 (KuxΛy)t+1 (cid:0)(Bλ)t+1 − K−1 uu (cid:1) ku∗, (17) where (Bλ)t+1 = (cid:0)Kuu + σ−2 (cid:0)λ (KuxΛKxu)t + ku,t+1k⊤ u,t+1 (cid:1)(cid:1)−1 (KuxΛy)t+1 = λ (KuxΛy)t + ku,t+1yt+1, (18) where ku,t+1 is a column vector constructed with the kernel dot products between U and sample xt+1. Note that as we are working with an adaptive algorithm, the model can forget the past without explicitly removing the old data. Besides, the data-dependent terms, (KuxΛy)t and (KuxΛKxu)t do not increase its size when new data are added, so the predictive distribution complexity does not increase with each new data. However, if we want to limit the memory needed to store past samples (necessary, for example, to recompute Kux when the inducing points are updated), it is advisable to remove old data and keep a window of length T . This can be easily done during the addition of the data using these update rules, which leads to an expression alternative to those in Eq. (18): (Bλ)t+1 = (cid:0)Kuu + σ−2 (cid:0)λ (KuxΛKxu)t + ku,t+1k⊤ u,t+1 (cid:1) − λT ku,t−T k⊤ (cid:1)−1 u,t−T (KuxΛy)t+1 = λ (KuxΛy)t + ku,t+1yt+1 − λku,t−T yt−T . (19) If the values of (KuxΛKxu)t from the previous iteration are saved, the complexity of these operations is O(M 3) and O(M ), respectively. In non-stationary scenarios, it is expected that as new data arrive, their distribution changes and we also need to update the positions of the inducing points to be able to represent the support of the new distribution. To avoid applying a computationally expensive inference process to update the position of all inducing points, when the inducing set is not representative enough, we propose to directly add the new data as a new inducing point. Besides, to limit the length of this set, we can remove the less representative inducing points. To analyze the representativeness of the inducing set, we can use as a criterion the regularization term of the adaptive collapsed marginal likelihood (14), i.e., Rtot = t (cid:88) t′=1 λt−t′ (cid:0)kt′t′ − k⊤ u,t′K−1 uu kut′ (cid:1) . (20) This quantity measures the λ weighed error generated by predicting the training latent values from the inducing points. In fact, the non-adaptive version of this criterion has been already used by [22, 23] for the selection of inducing points from the training data. So, we can analyze this quantity in each iteration, and in the case is larger than a given threshold (Rth,tot), we can decide to include the observation xt+1 as a new inducing point. Besides, according to this criterion, we can consider that the relevance of each inducing point, Rm for m = 1, . . . , M , is given by Rm = t (cid:88) t′=1 λt−t′ mmk2 k−1 mt′, (21) such that Rtot = (cid:80)t m=1 Rm. So, we can now set a relevance threshold (Rth) over Rm to detect the useless inducing points and remove them. kt′t′ − (cid:80)M t′=1 λt−t′ Finally, to complete this algorithm, we need to update the predictive distribution again when the inducing point set is modified. For this purpose, given that there are k elements in the inducing point set, we add a new inducing point uk+1 to this set, so the new predictive mean and variance are: k+1 (Bλ)k+1 (Kux)k+1 Λy (mλ,∗)k+1 =σ−2 (ku,∗)⊤ (vλ,∗)k+1 =k∗∗ + (ku,∗)⊤ (cid:16) k+1 * * (Bλ)k+1 − (cid:0)K−1 uu (22) (cid:17) (cid:1) k+1 (ku∗)k+1 . Updating (ku,∗)k+1 and (Kux)k+1 is straightforward since it only implies adding a new element to this vector and a row to the matrix. The update of (cid:0)K−1 k+1 can be efficiently computed from (cid:0)K−1 k using the properties of the block matrix inversion [24], if we consider that (Kuu)k is an update of (Kuu)k+1 with a new row and column. A similar procedure can be applied to (Bλ)k+1 taking into account that uu uu (cid:1) (cid:1) (Bλ)k+1 = (cid:0)Kuu + σ−2KuxΛKxu (cid:18) (cid:0)B−1 (bλ)k+1 (cid:1) (cid:0)b⊤ (bλ)k+1 = (cid:1) λ λ k k+1 (cid:1)−1 (cid:19)−1 , where (bλ)k+1 = ku,k+1 + σ−2 (Kux)k Λkx,k+1 (bλ)k+1 = kk+1,k+1 + σ−2k⊤ x,k+1Λkx,k+1. (23) (24) This way, the addition of a new inducing point has a computa- tional cost of O(M 2). Note that for the computation of (Kux)k+1, we need to store matrix X with all previous training data, although due 5 Algorithm 1: Fast Adaptive VSGP (fast-AGP) (fast − AGP)t+1 = Update_fast-AGP (cid:0)(fast − AGP)t, (xt+1, yt+1), T, Rth, Rth,tot (cid:1) Inputs: Previous model (fast-AGP)t, new data sample xt+1, yt+1, length of data window (optional) T , and relevance thresholds to update the inducing point set (Rth and Rth,tot). // Update predictive distribution with new data Compute new (mλ,∗)t+1 and (vλ,∗)t+1 with Eq. (17) and (18). If we keep a data window of length T , use Eq. (17) and (19). // Add a new inducing point if it is needed If Rtot > Rth,tot (see Eq. (20)), set uk+1 = xt+1 and update the predictive distribution with Eq. (22) -(24). // Remove useless inducing points For m = 1, . . . , k + 1, compute (21) and remove inducing points with Rm < Rth or those with the lowest Rm so that the set length is no larger than M . Then, if needed, update (Bλ) and K−1 (vλ,∗)k+1. // Return model fast-AGP model at t + 1 Return (fast − AGP)t+1 uu and, later, (mλ,∗)k+1 and to the λ factor, only the most recent data influence over the solution; so, as we have argued before, we can keep a window of T data to reduce the computational requirements without any performance degradation. When we need to remove an irrelevant inducing point for being useless or to keep the inducing point set with M elements, we will have to incur a higher computational burden. This is because the inducing point to be removed occupies an arbitrary position in the matrix; therefore, a rank 1 update is not possible and we have to compute the inversions of (Bλ)k and (Kuu)−1 from scratch with a computational cost of O(M 3) in the worst case that k = M . k A summary of this fast model update, called fast-AGP, is included in Algorithm 1, where the model at the previous instant or a model initialized with some data history is considered as input. 2) Model update with inference over the model parameters: We can improve the performance of the previous algorithm by updating all the model parameters (kernel parameters, noise variance, and the position of the new inducing point) in each iteration. To optimize these parameters, we need to maximize Eq. (14), which leads to a computational burden of O(T M 2), considering that we limit the training data to a window of length T . In this case, since we will have to recalculate the kernel matrices every time we update the kernel parameters, we cannot save computation in the updates with rank one updates, so the predictive distribution will have to be calculated from scratch with a cost of O(T M 2). A summary of this approach is included in Algorithm 2. Note that despite the need to compute the predictive function from scratch, the computational burden of this approach is significantly lower than one of the updates of a standard VSGP starting from the parameters optimized in the last time instant. This is because the number of parameters to update is significantly lower (we only update the position of one inducing point, not the whole set), so the convergence is likely to be achieved in a lower number of inference iterations; even, as we will show in the experimental section, a single iteration per time instant. Moreover, this procedure is subject to further Algorithm 2: Adaptive VSGP (AGP) (AGP)t+1 = Update_AGP (cid:0)(AGP)t, (xt+1, yt+1), T, Rth Inputs: previous model (AGP)t, new data sample xt+1, yt+1, length of data window (optional) T and relevance threshold for inducing points (Rth). // Update the data window Include (xt+1, yt+1) to the model data set and remove (xt−T , yt−T ). (cid:1) // Remove useless inducing points and limit set size to M − 1 For m = 1, . . . , k + 1, compute (21) and remove inducing points with Rm < Rth or those with the lowest Rm so that the set length is no larger than M − 1. // Add a new inducing point Set uk+1 = xt+1 // Update model parameters Compute new values of (σ2)t+1, (uk+1)t+1 and kernel parameters (θ)t+1 by maximizing Eq. (14). // Update predictive distribution with new parameters Compute the predictive distribution at t + 1 with (16). // Return model AGP model at t + 1 Return (AGP)t+1 simplifications. For example, the full parameter update may not be needed every time and, if we need to add a new inducing point, its point position can be set to that of a new data point, i.e., uk+1 = xt+1; this way, no inference is needed in these iterations and the computational cost of the parameter update is lowered further. IV. EXPERIMENTS In this section, we evaluate the performance of the proposed adaptive models against several reference methods. For this purpose, we first consider a synthetic unidimensional problem where we can easily control the non-stationary environment to evaluate the advantages and drawbacks of the different methods. Second, we test these methods on a load forecasting application. A. Experimental setup To analyze the performance of the proposed model, we have considered the two introduced versions: • Adaptive VSGP without inference (fast-AGP) (see Algo- rithm 1), where only the set of inducing points is updated to represent the new data space, but the kernel parameters and the model noise are considered constant. Besides, the inducing point set is updated without any inference, since new data are included as new inducing points, and the useless ones are efficiently removed. • Adaptive VSGP with inference (AGP) (see Algorithm 2), where all model parameters are updated using a single inference iteration every time a new sample arrives. In both cases, for automatic update of the set of inducing points, Rth,tot at time instant t is set as 1 kt′t′ T and Rth = rth maxm(Rm) where rth is a value which has been arbitrarily set to 10−4 in all the experiments below. t′=t−T λt−t′ (cid:80)t To analyze the performance of the proposed methods, we use the following reference approaches: • An adaptive VSGP where we use VSI (Variational Stochastic Inference) (AGP-VSI) to update the model 6 parameters in each iteration (see Appendix B for details of this formulation). For this model, we also consider a window of length T so that only these T samples are used for each data chunk. To make this algorithm converge, at each time instant, we need 50 iterations. • Windowed VSGP (w-VSGP): This is the standard vari- ational SGP of [10] using the implementation of [25], where we use a sliding window of length T to simulate the adaptive scenario. As in the previous model, for each new data, we need to use 50 inference iterations to adjust the model parameters. • Online SGP (OSGP): this is the online approach proposed in [16]. In this case, instead of using the original implemen- tation of the authors1, for comparison purposes, we have preferred to use its PyTorch implementation2. Here, we have used the learning rate parameters recommended by the authors (lr = 0.1 for the noise and kernel parameters and lr = 0.2 for the inducing points) with a Cosine Annealing optimizer. Here, as for the proposed methods, the online inference of the model uses a single iteration. • The Kernel Interpolation for Scalable Online GP (WISKI) approach [13] using the authors implementation3. For this model, since the inducing points are not updated by the model, we have had to predefine a grid over the input space to set them. Besides, as the definition of this grid raises computational problems in high-dimensional spaces when the input dimension is larger than two, we have projected the data into a two-dimensional space with a one- layer neural network (as the authors suggest); the weights of this net are learned with the remaining parameters of the model. The state of the art in online GP includes other methods such as those based on local approximations (see e.g. [26, 27]) and sparse methodologies whose strategy is based on an online reduction of the kernel matrix size through similarity criteria (prominently, the work in [28]). The first methodology is not sparse and its implementation to our applications is not direct, since its computational complexity increases indefinitely with time and, therefore, its application to our experimental setup will involve a pruning procedure to bound such complexity. This is not proposed in the original paper. The second methodology is sparse, but the algorithms do not involve the optimization of a set of inducing points to be statistically significant for the corresponding posterior distribution. Therefore, we do not include these approaches in our comparisons. For all the models and experiments, we used a square exponential kernel with its width and variance as parameters. To initialize the different models, we considered a window of length T and we used the first T samples to train a first model (in batch) during 200 iterations. For the inference of all these models (either during their initialization or, if used, during online learning), except for OSGP which used the optimization proposed by the authors, we applied an Adam algorithm with 1https://github.com/thangbui/streaming_sparse_gp 2https://github.com/wjmaddox/online_gp/blob/main/online_gp/models/streaming_sgpr.py 3Fhttps://github.com/wjmaddox/online_gp a learning rate of 0.05. For adaptive algorithms, the value of the forgetting factor (λ) was set as a function of the window length so that λT = 0.1. Experiments were run on a MacBook M1 with 32GB RAM. B. Toy example As a first adaptive scenario, we generated a synthetic but challenging data set. In particular, we generated a sinusoidal signal: y(t) = Atsin(2πf t) + εt with 500 samples uniformly distributed in the interval from 0 to 5. The first 300 samples (in the interval [0, 3]) use f = 4/2π with an increasing amplitude, At, from 0.5 to 2. The remaining 200 samples consider At = 2 and a frequency of 8/2π. In both cases, these sinusoidal signals were contaminated with a Gaussian noise of zero mean and standard deviation of 0.2. In Figure 1 we include an example of this data set. For all models under study, we used a data window of T = 100 samples, so we have trained a first model with first 100, and we used M = 10 inducing points; for WISKI model as we have to predefine an inducing points grid we set 40 inducing points in the interval from 0 to 5. Finally, for the adaptive models, λ was set to λ = 0.97724, so λ100 ≈ 0.1. To analyze the performance of the different methods, we computed the Mean Square Error (MSE) and the percentage of samples whose prediction error was less than ±2 (cid:0)vλ,∗ + σ2(cid:1) (see Eqs. (17) and (22)), known as 95% confidence interval (95% CI) when the model at the time instant t (i.e, trained with samples from t − T + 1 to t) predicts the output at t + 1. Besides, to obtain representative results, we generated 1000 different runs of the dataset and averaged the results for all the runs. In Table I we include these results for all the methods including their Training Times (TT). Besides, in Figures 2 and 3 we include, respectively, the evolution of the MSE and the predictive distribution during the online learning of the algorithms. Table I clearly shows that the algorithm presenting the best performance is AGP, both in terms of MSE and estimation of the 95% CI followed by OSGP and fast-AGP, the latter being a good choice if the computational burden is critical. Analyzing Figures 2 and 3, we can check as all the models work properly in the first part of the signal (when the frequency is low and only have to follow a change of amplitude), but when the signal frequency changes all the methods under study except AGP fail. For example, the fast-AGP is not able to track the signal because it does not update the kernel and noise parameters, so it is not able to follow the signal variations. w-SVGP and AGP-VSI (mainly the former) fail because they are window based and do not have a forgetting factor, so when the signal changes fast they are only able to learn the average behavior of the signal; if the window length were smaller, the methods fall short of information to properly converge. WISKI tries to track the signal variations, but it struggles to capture the amplitude, and their estimations are delayed (see Fig. 3 bottom right); the OSGP is the only reference algorithm able to track the signal changes, but its confidence interval estimation grows along the time, every time being more pessimistic. 7 To complete this analysis, Figure 4 shows the evolution of the MSE in AGP for different values of λ focusing this analysis on the region around the sinusoidal frequency change (from 2.5 to 4). We set up parameter λ ≤ 1 so the most remote sample of the window has an attenuation λT = 10−v, where v takes the values 0, 0.25, 0.5, 0.75, 1, 2 and 3. As we can see, the introduction of adaptive learning is critical to fast-track the signal transition and to match the high frequency of the new sinusoidal. If λ = 1 (no forgetting is applied), the AGP model has a performance similar to the baselines. Setting λ to any of the other values, the algorithm adapts the model to the new signal frequency. The tracking error decreases as λ is reduced from 1 to 0.933 (see the MSE differences in the interval from t = 3.2 to t = 3.4). Figure 4 shows the evolution of the MSE in AGP for different values of λ, focusing this analysis on the region around the sinusoidal frequency change (from 2.5 to 4). We set up parameter λ ≤ 1 so the most remote sample of the window has an attenuation λT = 10−v, where v takes the values 0, 0.25, 0.5, 0.75, 1, 2, 3, 4, 4.5 and 5. As we can see, the introduction of adaptive learning is critical to fast-track the signal transition and to match the high frequency of the new sinusoidal. If λ = 1 (no forgetting is applied), the AGP model has a performance similar to the baselines. Setting λ to any of the other values, the algorithm adapts the model to the new signal frequency. The tracking error decreases as λ is reduced from 1 to 0.912 (see the MSE differences in the interval from t = 3.2 to t = 3.4). However, if λ is too low (0.9 or lower), the algorithm forgets too fast and does not have enough information to learn the signal evolution. C. Load forecast The dataset used in this article is the archived data ISO-New England4, from 2011 to 2020, including real-time demand of each one of the eight load zones of New England. ISO-New England Inc. is a Regional Transmission Organization (RTO), an Independent System Operator that operates the bulk power electric system and transmission lines serving the territory of the six New England states: Connecticut (CT), Maine (ME), Northeast Massachusetts and Boston (NEMA), New Hampshire (NH), Rhode Island (RI), Southeast Massachusetts (SEMA), Vermont (VT), and Western/Central Massachusetts (WCMA). The input patterns consist of 24 hourly power measures of a single day to predict every hour of the next day, and we have used an observation window of 90 days (T = 90). Assuming that the most remote sample of the window has to be attenuated by a factor of 0.1, this leads to λ = 0.9747. The initial model has also been trained with 90 data, and we have used M = 20 inducing points, but the fast-AGP and AGP algorithms select between 8 and 10 inducing points in all scenarios. As the model is using 24 input variables, the WISKI algorithm cannot work in such a high space, so we include a preprocessing step (as suggested in [13]) to project the data into a two-dimensional space with a one-layer neural network consisting in a set of linear weights, a batch normalization and 4The dataset is publicly available at https://www.iso-ne.com/isoexpress/web/ reports/load-and-demand/-/tree/zone-info. 8 Fig. 1: Example of the synthetic problem. Black points were used for the model initialization and blue samples for online learning. MSE 95% CI Tr. Time w-SVGP 1.0989 93.10 3266.2 OSGP WISKI 0.4507 0.1333 75.28 94.21 120.4 299.5 AGP-VSI 0.5211 93.71 3022.0 fast-AGP 0.1960 71.68 23.1 AGP 0.0630 95.02 108.6 TABLE I: Comparison of the different models under study in the synthetic dataset. Fig. 2: Evolution of the MSE during the online learning in the synthetic dataset. an output hyperbolic tangent to transform the data into the [−1, 1] scale. This way, the inducing point grid is predefined in this dimensional space with 400 points equally lying in the grid [−1, 1] × [−1, 1]. Using less dense grids turns into poor results. best MAPEs correspond to the fast-AGP and AGP algorithms, the WISKI algorithm shows similar performance to the simple persistence, and AGP-VSI and w-SVGP show performances close to AGP and fast-AGP ones. The results for all areas are summarized in Table II. The OSGP reference approach has to be removed from this experiment since it has shown convergence errors in most regions, providing poor performance. These converge problems are due to the expression of its inference bound, which has to invert a matrix defined by the subtraction of two terms of a similar order, causing its Cholesky decomposition, despite being computed with a robust implementation, to fail in many realizations. Figure 5 shows the mean absolute percentage of error (MAPE) of the 24-hour prediction achieved by all methods in the regions of Connecticut (CT) and West/Central Mas- sachusetts. In these results, we also include the performance of the persistence approach, that is, an estimation given by the load consumption on the previous day at the same hour. The Analyzing the detailed results of Table II, we can corroborate that fast-AGP and AGP show the best performance. Although fast-AGP gets the lowest MSE, AGP is the only one able to obtain an accurate 95% CI estimation. This advantage of AGP in terms of the mean estimation can be due to a slight overfitting of fast-AGP. Regarding reference methods, w-SVGP, AGP-VSI and WISKI present an acceptable performance, but if we analyze the MAPE results (see Figure 5), we see that WISKI is quite unstable and in some time hours presents an error higher than the persistence approach. We think this punctual performance degradation is probably because the predefined grid of inducing points is insufficient or is badly placed for some hour estimations. 9 Fig. 3: Predictive distribution for the different methods under study along the online learning in the synthetic dataset. Fig. 4: Evolution of the AGP MSE for different λ values in the synthetic dataset. 10 Fig. 5: MAPE comparison of all algorithms for the power load experiment in the regions of Connecticut and West/Central Massachussets. CT ME NEMA NH RI SEMA VT WCMA Average MSE 95% CI Tr. Time MSE 95% CI Tr. Time MSE 95% CI Tr. Time MSE 95% CI Tr. Time MSE 95% CI Tr. Time MSE 95% CI Tr. Time MSE 95% CI Tr. Time MSE 95% CI Tr. Time MSE 95% CI Tr. Time Persist. 0.1282 – – 0.0092 – – 0.0802 – – 0.0160 – – 0.0088 – – 0.0347 – – 0.0056 – – 0.0360 – – 0.0398 – – w-SVGP WISKI 0.1202 0.0982 90.22 89.91 280.4 5262.4 0.0090 0.0062 91.44 91.96 278.8 5535.3 0.0706 0.0593 89.14 89.74 280.2 5178.2 0.0148 0.0107 90.46 91.50 284.9 5209.2 0.0100 0.0099 89.42 90.75 289.9 5180.2 0.0375 0.0280 91.33 90.19 286.6 5240.5 0.0049 0.0042 92.58 92.58 284.7 5128.1 0.0309 0.0255 92.00 89.84 287.6 5042.0 0.0372 0.0303 90.82 90.81 284.1 5222.0 AGP-VSI 0.0876 89.82 5459.9 0.0112 92.78 5519.2 0.0535 90.01 5162.3 0.0121 91.21 5107.9 0.0134 92.26 5154.2 0.0281 89.65 5105.7 0.0044 93.77 5186.4 0.0240 89.90 5290.0 0.0293 91.17 5248.2 fast-AGP 0.0876 90.70 36.6 0.0058 93.88 60.5 0.0490 89.73 38.7 0.0097 92.38 54.6 0.0061 88.00 65.1 0.0247 89.15 45.6 0.0038 97.14 54.2 0.0237 93.15 37.9 0.0263 91.77 49.2 AGP 0.0933 96.16 196.0 0.0066 96.70 198.5 0.0533 96.20 197.7 0.0107 96.63 196.8 0.0069 96.35 196.3 0.0263 95.84 196.2 0.0040 97.34 196.1 0.0248 96.84 194.4 0.0282 96.51 196.5 TABLE II: Comparison of the different models under study for the different load forecasting regions. However, when we analyze the confidence interval estima- tion, we observe that AGP is the only one that systematically provides an accurate estimate since it is around 96% (perhaps slightly conservative), but the remaining methods are around 90%.. Finally, if we analyze the computational cost, we corroborate that w-SGP and AGP-VSI are not affordable, since their computational burden is 25 times higher than AGP and 100 times higher than fast-AGP. WISKI presents a computational burden similar to the AGP one, but fast-AGP is the fastest with a computation time 5.7 times lower than WISKI. In an environment such as energy load forecast, where kernel and noise parameters do not need to be recalculated quickly, fast-AGP can be a good choice. However, if an accurate confidence interval estimation is needed, the AGP can be a better option. Even for these semi-stationary environments both models can be combined (for instance running AGP every ten days stamps to track the model parameters) and obtain better variance estimation and higher speed. D. Purchase prediction In this subsection, we analyze the performance of the model over two additional datasets related to sales prediction tasks. In particular, we have selected two open datasets: • The Store Sales (SS) from a Kaggle Time Series Fore- casting competition5. In this case, the dataset provides the sale records of a grocery retailer in different categories. We have merged all the categories. The goal of the model is to predict the total amount of sales during the next day using the records of sales during the previous week. • The Online Retail (OR) from the UCI repository6. Here, we aim to predict the revenues generated by total sales 5https://www.kaggle.com/competitions/store-sales-time-series-forecasting 6Avaliable at https://archive.ics.uci.edu/ml/datasets/Online+Retail 05101520246810CTPersistencefast_AGPAGPAGP-VSIw_SVGPWISKI05101520246810WCMA on each day using the incomings generated during the previous week. In both datasets, we have used a similar configuration to the load forecasting problem, that is, we have considered an observation window of 90 days (T = 90), which provides a λ value of 0.9747 and for the fast-AGP and AGP algorithms we have used a maximum of M = 20 inducing points. Again, for the WISKI algorithm, we have included a previous neural network with a hyperbolic tangent output to project the data into a two-dimensional space. The final performance of the different methods is included in Table III. We have included the MSE of each model, their IC at 95%, and the training times of each method. In these datasets, the OSGP algorithm only converged for the OR dataset, so their results are only provided for this case. These results confirm the ones of the previous sections since, again, the proposed models tend to outperform the remaining algorithms providing the best trade-off of error, IC estimation, and reduced training time. Once again, the fast-AGP provides the best MSE with the faster implementation, but the AGP is the one that achieves the best estimation of the IC. In the OR dataset the WISKI approach stands out as the one providing the lowest MSE value, although it fails to achieve an accurate estimation of the IC 95. V. CONCLUSIONS Adaptive algorithms are used in signal processing and in these applications where the environment is non-stationary. We introduced an algorithm that implements an adaptive SGP for regression based on the VSGP introduced in [10], where a variational approach is used to maximize a variational lower bound of the marginal likelihood of the training regressors. To endow the VSGP with adaptive properties, the compo- nents of the log-likelihood are weighted with a factor that exponentially decays with time, so the information included in the log-likelihood is conveniently forgotten in a way similar to what is done in the RLS algorithm. To make this model efficient, the algorithm used for the inference is formulated in two alternative ways that make it adequate for online learning. In one of the approaches, the noise and kernel parameters are frozen after initial training, and only the inducing points are adapted, to obtain the fast-AGP, which combines good performance and low computational burden. The second one, called AGP, updates all parameters in an online way, thus improving its capabilities by increasing the computational burden. In all cases, the computational burden is lower than the state-of-the-art approaches. To limit the number of inducing points, we propose a relevance criterion, based on the change of the marginal likelihood, to automatically add a new sample as an inducing point or remove an existing inducing point. The performance of the algorithm has been tested in two problems. The first one is an artificial problem where a sinusoidal signal has to be tracked (with one-step ahead prediction). This signal shows a sudden frequency change that is properly tracked by the proposed algorithms but not by the state-of-the-art algorithm used in the comparison. The fast-AGP shows the second best performance, while the AGP 11 shows the best performance. A test with different values of the forgetting factor λ shows the importance of the forgetting factor, and it also shows the robustness of the algorithm regarding the parameter choice. A second experiment consists of electric load forecasting with the ISO New England load databases. The results show that both AGP and fast-AGP show the best performance in mean. Besides, the AGP is the only one that achieves an accurate 95% CI, while the rest of the approaches show a 91% of samples inside the estimated 95% CI. This is important in these applications, where it is useful to know what is the confidence interval of the prediction to decide whether to trust the prediction. APPENDIX A DERIVATION OF THE λ-DEPENDENT LOG LIKELIHOOD In this appendix, we derive the different expressions of Section III-A to demonstrate the solution for the adaptive version of the VSGP formulation. Let's start including λ into log G(fu, y) log Gλ(fu, y) = t (cid:88) t′=1 λt−t′ log G(fu, yt′) = t (cid:88) t′=1 λt−t′ log N (cid:0)yt′|k⊤ ut′K−1 uu fu, σ2(cid:1) (25) − t (cid:88) t′=1 λt−t′ 2σ2 (cid:0)kt′t′ − k⊤ ut′K−1 uu kut′ (cid:1) ut′K−1 and, now, focusing on the term of the first sum and defining αt′ = k⊤ λt−t′ uu fu, we can be reformulated this term as: log N (cid:0)yt′|αt′, σ2(cid:1) λt−t′ 2 log (cid:0)2πσ2(cid:1) + (cid:18) (cid:19) = − = − + 1 2 1 2 λt−t′ log log (cid:0)2πσ2(cid:1) − (cid:19) (cid:18) 2πσ2 λt−t′ − 1 2 (cid:19) (cid:18) = log N yt′|αt′, σ2 λt−t′ 1 σ2 (yt′ − αt′)2 λt−t′ 1 σ2 2 (cid:18) 2πσ2 λt−t′ (cid:19) log (yt′ − αt′)2 − 1 2 λt−t′ log (cid:0)2πσ2(cid:1) + 1 2 log (cid:18) 2πσ2 λt−t′ (cid:19) . Now, we including this term into (25), we get that uu fu, σ2Λ−1(cid:1) (cid:17) log Gλ(fu, y) = log N (cid:0)y|KxuK−1 (cid:16) log λt−t′ + (λt−t′ − 1) log(2πσ2) t (cid:88) − 1 2 t′=1 t (cid:88) t′=1 λt−t′ σ2 (cid:0)kt′t′ − k⊤ ut′K−1 uu kut′ (cid:1) . − 1 2 (26) (27) . where Λ is a t × t diagonal matrix with Λt′t′ = λt−t′ Once log Gλ(fu, y) is defined, we can obtain the λ dependent marginal likelihood or variational bound. For this purpose, let's remind that p(fu) is SS OR MSE IC 95 Tr. Time MSE IC 95 Tr. Time Persistance 0.4106 – – 3.9486 – – w-SVGP 0.1744 87.63 1911.6 2.4789 84.39 240.6 OSGP WISKI 0.3877 83.21 226.7 2.0593 89.27 29.3 – – – 2.5190 89.76 30.5 AGP-VSI 0.1966 90.47 1833.5 2.2916 87.32 232.0 Fast-AGP 0.1868 84.28 39.6 2.1920 93.17 3.0 AGP 0.2180 95.45 297.7 2.2394 94.15 20.7 TABLE III: Comparison of the different models under study for the Store Sales (SS) and Online Retail (OR) datasets. 12 p(fu) = N (fu|0, Kuu) (28) and marginalizing log Gλ(fu, y) respect to fu V (U) = log N (cid:0)y|0, σ2Λ−1 + KxuK−1 F λ 1 2 log λt−t′ + (λt−t′ − 1) log(2πσ2) uu Kux (cid:17) t (cid:88) − (cid:16) (cid:1) (29) t′=1 t (cid:88) t′=1 − 1 2 λt−t′ σ2 (cid:0)kt′t′ − k⊤ ut′K−1 uu kut′ (cid:1) An interesting point of expression (33) relies on the fact that the bound over the marginal likelihood is now expressed as a sum over the training data, which facilitates endowing this formulation with adaptive capabilities by weighting each data term with forgetting factor 0 < λ < 1. This way, taking into account that we are in a time-dependent scenario at time t and including λ into (33) new bound becomes F λ SV I (U, q(fu)) = Eq(fu) (cid:34) t (cid:88) log G(fu, yt′)p(fu) − log q(fu) . (cid:35) (34) λt−t′ and simplifying it, by removing the constant terms, we get t′=1 V (U) = log N (cid:0)y|0, σ2Λ−1 + KxuK−1 F λ 1 2 − 1) log(2πσ2) (λt−t′ t (cid:88) − uu Kux (cid:1) (30) t′=1 t (cid:88) t′=1 + 1 2 λt−t′ σ2 (cid:0)kt′t′ − k⊤ ut′K−1 uu kut′ (cid:1) APPENDIX B AN ADAPTIVE SGP WITH STOCHASTIC VARIATIONAL INFERENCE An alternative optimization of (8) can be carried out by means of Stochastic Variational Inference (SVI) [29]. For this purpose, we first rewrite the true marginal bound (8) as an Evidence Lower Bound (ELBO) FV (U, q(fu)) = Eq(fu) [log G(fu, y)p(fu) − log q(fu)] (31) Secondly, we take into account that G(fu, y) factorizes with respect to the data, log G(fu, y) = = N (cid:88) n=1 N (cid:88) n=1 log G(fu, yn) log N (cid:0)yn|knuK−1 uu fu, σ2(cid:1) (32) − N (cid:88) n=1 1 2σ2 (cid:0)knn − k⊤ unK−1 uu kun (cid:1) where knu is a vector with the kernel products of xn with the inducing points and knn is the kernel of xn with itself. Finally, a stochastic expression of the marginal bound can be obtained as FSV I (U, q(fu)) = Eq(fu) (cid:34) N (cid:88) n=1 log G(fu, yn)p(fu) − log q(fu) . (cid:35) By maximizing this lower bound, the inducing points U can be updated at every instant, as well as the variational parameters μ and A, the kernel parameters, and the noise variance. Besides, this can be easily carried out with probabilistic programming packages, such as Pyro [25], which samples from the variational distribution q(fu) to approximate this bound with a computational cost of O(N M 2). If we want to reduce this computational burden or the required memory, we can work with a data window of length T covering training data from instant t − T + 1 to t. Thus, the sum over the data in Eq. (34) can be replaced by a sum from t − T + 1 to t to obtain the values of U μ and A at instant t. During the next instant, t+1, the sliding window advances one position and the parameters are updated in a stochastic fashion using the previous solution as the starting point. This way, the computational burden is O(T M 2). So, this formulation provides an adaptive SGP formulation, as experimental results show (see Section IV). However, the final computational burden of this model is going to be similar to retraining an SGP in each iteration since we are going to need many iterations of the stochastic optimization to make the algorithm converge to an adequate solution. Although this number of iterations can be reduced by using the optimum values of the parameters at instant t − 1 to compute its new value at time t, it is not low enough since the stochastic nature of the model forces us to sample in several iterations over the variational distribution to obtain a workable solution. including the forgetting factor λ, REFERENCES [1] L. Tan and J. Jiang, Digital signal processing: fundamen- tals and applications. Academic Press, 2018. [2] S. Haykin, Adaptive filter theory, 4th ed. Upper Saddle River, NJ: Prentice Hall, 2002. [3] V. Ingle, S. Kogon, and D. Manolakis, Statisical and (33) adaptive signal processing. Artech, 2005. 13 cess regression," in International Workshop on Artificial Intelligence and Statistics. PMLR, 2003, pp. 254–261. [21] E. Snelson and Z. Ghahramani, "Sparse Gaussian pro- cesses using pseudo-inputs," Advances in neural informa- tion processing systems, vol. 18, 2005. [22] A. J. Smola, "Sparse greedy matrix approximation for machine learning," in Proceedings of the 17th interna- tional conference on machine learning, June 29-July 2 2000. Morgan Kaufmann, 2000. [23] N. Lawrence, M. Seeger, and R. Herbrich, "Fast sparse Gaussian process methods: The informative vector ma- chine," Advances in neural information processing sys- tems, vol. 15, 2002. [24] C. D. Meyer, Matrix analysis and applied linear algebra. Siam, 2000, vol. 71. [25] E. Bingham, J. P. Chen, M. Jankowiak, F. Obermeyer, N. Pradhan, T. Karaletsos, R. Singh, P. Szerlip, P. Horsfall, and N. D. Goodman, "Pyro: Deep universal probabilistic programming," The Journal of Machine Learning Re- search, vol. 20, no. 1, pp. 973–978, 2019. [26] D. Nguyen-Tuong, J. Peters, and M. Seeger, "Local Gaussian process regression for real time online model learning," Advances in neural information processing systems, vol. 21, 2008. [27] A. Lederer, A. J. O. Conejo, K. Maier, W. Xiao, J. Umlauft, and S. Hirche, "Real-time regression with dividing local Gaussian processes," arXiv preprint arXiv:2006.09446, 2020. [28] A. Koppel, H. Pradhan, and K. Rajawat, "Consistent online Gaussian process regression without the sample complexity bottleneck," Statistics and Computing, vol. 31, pp. 1–18, 2021. [29] M. D. Hoffman, D. M. Blei, C. Wang, and J. Paisley, "Stochastic variational inference," Journal of Machine Learning Research, 2013. BIOGRAPHY SECTION Vanessa Gómez-Verdejo received the Engineer- ing degree in 2002 from Universidad Politécnica de Madrid. In 2007, she obtained a Ph.D. from Universidad Carlos III de Madrid, where she is currently Associated Professor. Her research inter- ests are focused on machine learning, mainly, on probabilistic machine learning and feature selec- tion methods and their use in health applications http://vanessa.webs.tsc.uc3m.es/. [4] K. P. Murphy, Machine learning: a probabilistic perspec- tive. MIT press, 2012. [5] C. K. Williams and C. E. Rasmussen, Gaussian processes for machine learning. MIT press Cambridge, MA, 2006. [6] Z. Ghahramani and H. Attias, "Online variational bayesian learning," in NIPS Workshop on Online Learning, 2000. [Online]. Available: http://mlg.eng.cam. ac.uk/zoubin/papers/nips00w.pdf [7] S. Van Vaerenbergh, M. Lázaro-Gredilla, and I. Santa- maria, "Kernel recursive least-squares tracker for time- varying regression," Neural Networks and Learning Sys- tems, IEEE Transactions on, vol. 23, pp. 1313–1326, 08 2012. [8] H. Liu, Y.-S. Ong, X. Shen, and J. Cai, "When Gaussian process meets big data: A review of scalable GPs," IEEE Transactions on Neural Networks and Learning Systems, vol. 31, no. 11, pp. 4405–4423, 2020. [9] J. Quinonero-Candela and C. E. Rasmussen, "A unifying view of sparse approximate Gaussian process regression," The Journal of Machine Learning Research, vol. 6, pp. 1939–1959, 2005. [10] M. Titsias, "Variational learning of inducing variables in sparse Gaussian processes," in Artificial intelligence and statistics. PMLR, 2009, pp. 567–574. [11] L. Csató and M. Opper, "Sparse on-line Gaussian pro- cesses," Neural computation, vol. 14, no. 3, pp. 641–668, 2002. [12] T. Evans and P. Nair, "Scalable Gaussian processes with grid-structured eigenfunctions (GP-GRIEF)," in International Conference on Machine Learning. PMLR, 2018, pp. 1417–1426. [13] S. Stanton, W. Maddox, I. Delbridge, and A. G. Wil- son, "Kernel interpolation for scalable online Gaussian processes," in International Conference on Artificial Intelligence and Statistics. PMLR, 2021, pp. 3133–3141. [14] T. N. Hoang, Q. M. Hoang, and B. K. H. Low, "A unifying framework of anytime sparse Gaussian process regression models with stochastic variational inference for big data," in International Conference on Machine Learning. PMLR, 2015, pp. 569–578. [15] C.-A. Cheng and B. Boots, "Incremental variational sparse Gaussian process regression," Advances in Neural Information Processing Systems, vol. 29, 2016. [16] T. D. Bui, C. Nguyen, and R. E. Turner, "Streaming sparse Gaussian process approximations," Advances in Neural Information Processing Systems, vol. 30, 2017. [17] J. Hensman, N. Fusi, and N. D. Lawrence, "Gaussian processes for big data," arXiv preprint arXiv:1309.6835, 2013. [18] M. A. Aizerman, E. M. Braverman, and L. Rozoner, "Theoretical foundations of the potential function method in pattern recognition learning," Automation and remote Control, vol. 25, pp. 821–837, 1964. [19] C. E. Rasmussen, "Gaussian processes in machine learn- ing," in Summer school on machine learning. Springer, 2003, pp. 63–71. [20] M. W. Seeger, C. K. Williams, and N. D. Lawrence, "Fast forward selection to speed up sparse Gaussian pro- 14 Emilio Parrado-Hernández Received an Engineer- ing Degree from Universidad de Valladolid, Spain (1999) and a PhD in Communication Technologies from Universidad Carlos III de Madrid (2003). He currently is an Associate Professor at Universidad Carlos III de Madrid. From 2014 till 2019 Emilio worked as Senior Machine Learning Expert in Ad- vanced Analytics and Algorithmic Trading at BBVA. His research interests include machine learning, mostly kernel methods, and its application in finance and health. Manel Martínez-Ramón Received an Engineering Degree from Universitat Politècntica de Catalunya, Spain (1994) and a PhD in Communication Technolo- gies from Universidad Carlos III de Madrid (1999). He is a professor at the Department of Electrical and Computer Engineering of the University of New Mexico, where he holds the King Felipe VI Endowed Chair in Information Sciences. His research activity is focused on Machine Learning and its applications to communications, smart grids, and complex systems, with emphasis on particle accelerators.
http://arxiv.org/abs/2302.10322v1
2023-02-20T21:26:25
2023-02-20T21:26:25
Deep Transformers without Shortcuts: Modifying Self-attention for Faithful Signal Propagation
Skip connections and normalisation layers form two standard architectural components that are ubiquitous for the training of Deep Neural Networks (DNNs), but whose precise roles are poorly understood. Recent approaches such as Deep Kernel Shaping have made progress towards reducing our reliance on them, using insights from wide NN kernel theory to improve signal propagation in vanilla DNNs (which we define as networks without skips or normalisation). However, these approaches are incompatible with the self-attention layers present in transformers, whose kernels are intrinsically more complicated to analyse and control. And so the question remains: is it possible to train deep vanilla transformers? We answer this question in the affirmative by designing several approaches that use combinations of parameter initialisations, bias matrices and location-dependent rescaling to achieve faithful signal propagation in vanilla transformers. Our methods address various intricacies specific to signal propagation in transformers, including the interaction with positional encoding and causal masking. In experiments on WikiText-103 and C4, our approaches enable deep transformers without normalisation to train at speeds matching their standard counterparts, and deep vanilla transformers to reach the same performance as standard ones after about 5 times more iterations.
[ "Bobby He", "James Martens", "Guodong Zhang", "Aleksandar Botev", "Andrew Brock", "Samuel L Smith", "Yee Whye Teh" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10322v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10322v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI", "cs.CL", "stat.ML" ]
3 2 0 2 b e F 0 2 ] G L . s c [ 1 v 2 2 3 0 1 . 2 0 3 2 : v i X r a Published as a conference paper at ICLR 2023 DEEP TRANSFORMERS WITHOUT SHORTCUTS: MODIFYING SELF-ATTENTION FOR FAITHFUL SIGNAL PROPAGATION Bobby He1 James Martens2 Guodong Zhang2 Aleksandar Botev2 Andrew Brock2 Samuel L. Smith2 Yee Whye Teh1,2 1University of Oxford, 2DeepMind Correspondence to: [email protected],[email protected]. ABSTRACT Skip connections and normalisation layers form two standard architectural com- ponents that are ubiquitous for the training of Deep Neural Networks (DNNs), but whose precise roles are poorly understood. Recent approaches such as Deep Ker- nel Shaping have made progress towards reducing our reliance on them, using in- sights from wide NN kernel theory to improve signal propagation in vanilla DNNs (which we define as networks without skips or normalisation layers). However, these approaches are incompatible with the self-attention layers present in trans- formers, whose kernels are intrinsically more complicated to analyse and control. And so the question remains: is it possible to train deep vanilla transformers? We answer this question in the affirmative by designing several approaches that use combinations of parameter initialisations, bias matrices and location-dependent rescaling to achieve faithful signal propagation in vanilla transformers. Our meth- ods address several intricacies specific to signal propagation in transformers, in- cluding the interaction with positional encoding and causal masking. In experi- ments on WikiText-103 and C4, our approaches enable deep transformers without normalisation to train at speeds matching their standard counterparts, and deep vanilla transformers to reach the same performance as standard ones after about 5 times more iterations. 1 INTRODUCTION Despite numerous impressive successes, the practice of training deep neural networks (DNNs) has progressed to a large extent independently of theoretical justification. Most successful modern DNN architectures rely on particular arrangements of skip connections and normalisation layers, but a general principle for how to use these components in new architectures (assuming they are even applicable) remains unknown, and their roles in existing ones are still not completely understood. The residual architecture, arguably the most popular and successful of these, was first developed in the context of convolutional networks (CNNs) (He et al., 2016), and later in self-attention networks yielding the ubiquitous transformer architecture (Vaswani et al., 2017). One proposed explanation for the success of residual architectures is that they have superior signal propagation compared to vanilla DNNs (e.g. Balduzzi et al., 2017; Xiao et al., 2018; Hayou et al., 2019; De & Smith, 2020; Martens et al., 2021), where signal propagation refers to the transmission of geometric information through the layers of a DNN, as represented by a kernel function (Daniely et al., 2016; Poole et al., 2016; Schoenholz et al., 2017). Recently, using signal propagation principles to train DNNs at high depths, without the skip connec- tions and/or normalisation layers found in residual architectures, has become an area of interest in the community. The reasons are two-fold. First, it would validate the signal propagation hypothesis for the effectiveness of residual architectures, thus clarifying our understanding of DNN trainability. And second, it could lead to general principles and techniques for achieving trainability in DNNs beyond the residual paradigm, with the potential for improved or more efficient architectures. For CNNs, Xiao et al. (2018) showed that improved signal propagation from better initialisation en- ables very deep vanilla networks to be effectively trained, although at significantly reduced speeds 1 Published as a conference paper at ICLR 2023 2 *Σl *diag(Σl)− 1 Figure 1: Normalised kernel matrices diag(Σl)− 1 2 (which are like kernel matrices except with cosine similarities instead of inner-products) at various depths for standard attention-only vanilla transformers and two of our proposed alternatives (Section 3). Standard attention-only vanilla transformers (top) quickly suf- fer from rank collapse where all entries of the normalised kernel converge to 1, whereas our approaches, U-SPA and E-SPA, maintain controlled signal propagation even at large depths. Moreover, our main method E-SPA (bottom) exhibits a recency bias, where cosine similarities corresponding to nearby pairs of locations are larger, akin to positional encoding. Equivalent plots for attention-only transformers with skips and normalisation can be found in Fig. 7. compared to residual networks. Martens et al. (2021) later proposed Deep Kernel Shaping (DKS) which uses activation function transformations to control signal propagation, achieving training speed parity between vanilla and residual networks on ImageNet assuming the use of strong 2nd- order optimizers like K-FAC (Martens & Grosse, 2015). Zhang et al. (2022) extended ideas from DKS to a larger class of activation functions, achieving near parity in terms of generalisation as well. The key quantity that is analysed in signal propagation is the DNN's initialisation-time kernel, or more precisely, the approximate kernel given by the infinite width limit (Neal, 2012; Matthews et al., 2018; Lee et al., 2018; Yang, 2019). For MLPs, and for CNNs that use a Delta-initialisation (Balduzzi et al., 2017; Xiao et al., 2018), this kernel can be written as a simple recursion over layers that involves only 2D functions, facilitating a straightforward analysis. Unfortunately, the evolution of the kernel across layers of a transformer is more complicated, and as a result, existing approaches like DKS are not applicable to transformers (or indeed any architecture that contains self-attention layers). More concretely, if Xl ∈ RT ×d denotes a length-T sequence of l /d ∈ RT ×T for layer l (or activations at layer l of a transformer, then the kernel matrix Σl = XlX(cid:62) more precisely its limit as d → ∞), can be written as a function of the kernel matrix Σl−1 of the previous layer (Hron et al., 2020). In the case of self-attention layers, the relationship of Σl on Σl−1 cannot be simplified or decomposed into lower dimensional functions, leading to a recursion that is intrinsically high dimensional and harder to analyse or control. Analogously to the case of MLPs, where signal propagation is judged by looking at the behavior of the (one-dimensional) kernel, signal propagation in transformers can be judged by looking at the evolution of these (high-dimensional) kernel matrices through the layers of the network. One situation we must avoid is where the diagonal entries rapidly grow or shrink with depth, which corresponds to uncontrolled activation norms and can lead to saturated losses or numerical issues. A more subtle form of signal degradation can occur where Σl converges to a rank-1 matrix, which is known as rank collapse (Dong et al., 2021). Dong et al. (2021) showed that skip connections are essential to avoid the collapsed state: skipless transformers quickly converge to rank collapse at large depths, which we corroborate in Fig. 1 (top). Moreover, Noci et al. (2022) showed that rank collapse may lead to zero gradients for certain parameters in attention layers, hindering the trainablility of deep transformers. Thus, avoiding rank collapse is necessary for deep transformers to be trainable, and the question of whether one can train deep skipless transformers remains open. In the present work we address this question, demonstrating for the first time that it is possible to successfully train deep transformers without skip connections or normalisation layers. To do so, we study the problem of signal propagation and rank collapse in deep skipless transformers, and derive three approaches to prevent it in Section 3. Our methods use combinations of: 1) parameter ini- tialisations, 2) bias matrices, and 3) location-dependent rescaling, and highlight several intricacies 2 020406080Standard vanillaLayer 1Layer 5Layer 10Layer 20Layer 50Layer 100020406080Uniform SPA020406080020406080Exponential SPA0204060800204060800204060800204060800204060800.00.20.40.60.81.0Cosine similarity Published as a conference paper at ICLR 2023 specific to signal propagation in transformers, including the interaction with positional encoding and causal masking. In Section 4, we empirically demonstrate that our approaches result in train- able deep skipless transformers. On WikiText-103 and C4 datasets we show that using our main approach, Exponential Signal Preserving Attention (E-SPA), it is possible to match the training loss of standard transformers with our skipless ones by training for around 5 times longer. Moreover, by combining this approach with skip connections, we show that transformers without normalisation layers are able to match the training speed of standard ones. 2 PROBLEM SETTING Transformer models The input to a transformer consists of a sequence x=(xi)T i=1 over T loca- tions consisting of tokens from a vocabulary V : xi ∈ {1, . . . , |V |}. The model takes this sequence, and using a trainable embedding matrix E ∈ R|V |×d, creates a matrix of vector representations X0 ∈ RT ×d by performing a direct look-up for each location: [X0]i = Exi ∈ Rd. After this, the sequence is successively transformed via a series of L "transformer blocks", with independently initialised parameters. We will denote by Xl ∈ RT ×d the output sequence for block l, and will sometimes refer to the rows of Xl as representation vectors. Each transformer block consists of two component blocks that both employ a standard residual structure (He et al., 2016), computing the sum of a residual branch which performs the main computation, and a shortcut branch (aka a skip connection) which just copies the block's inputs to its output. The attention block, which is the first of these component blocks, applies layer normalisation (LN) (Ba et al., 2016) or RM- SNorm (Zhang & Sennrich, 2019), followed by multi-head attention (MHA), on its residual branch. The MLP block, which comes next, applies LN followed by a standard (typically shallow) MLP on its residual branch. The LN and MLP operations are applied to each sequence element inde- pendently (using shared parameters), so that information is only communicated between sequence elements via the MHA operation (which we will define later). In summary we have Xl = αXl−1 + β MHA(RMSNorm( ˆXl−1)) ˆXl = αXl + β MLP(RMSNorm(Xl)), and (1) where the shortcut and residual weights α, β are typically both 1. In this work we will focus on skipless transformers with α = 0 and β = 1, and on vanilla transformers, which are skipless transformers without normalisation layers. For simplicity we will also devote much of our analysis to attention-only models, which are transformers without MLP blocks (so that ˆXl = Xl). Note that we restrict our analysis to decoder-only transformers in this work, as they have a simpler structure which is easier to analyse, and are widely used in practice. Also note that Eq. (1) corre- sponds to the "Pre-LN" (Baevski & Auli, 2018; Child et al., 2019) rather than the original "Post-LN" transformer (Wang et al., 2019). In Post-LN transformers, the normalisation operation is applied at the output of each MLP and attention block instead of at the beginning of each residual branch. Self-attention Given an input sequence X ∈ RT ×d, the self-attention mechanism computes Attn(X) = A(X)V(X), with A(X) = softmax (cid:18) 1 √ dk Q(X)K(X)(cid:62) (cid:19) , (2) and WV ∈ Rd×dv where the softmax function is applied row-wise. Q(X) = XWQ, K(X) = XWK and V(X) = XWV denote the queries, keys and values respectively, with trainable parameters WQ, WK ∈ Rd×dk . In practice, the attention mechanism, Eq. (2), is applied over h "heads" (with independent parameters), giving rise to so-called multi-head attention: MHA(X) (cid:44) Concat(cid:0)Attn1(X), . . . , Attnh(X)(cid:1)WO, where WO ∈ Rhdv×d are trainable parameters and usually dk = dv = d define WV = Concat(WV h . In this case, we can n denotes the value parameters for head n. We focus our investigation to models that perform next-token prediction: at location i−1 the model outputs a prediction over the identity of the ith target token, but using only information from input tokens 1 through i−1. This corresponds to using a causal masked attention with mask M ∈ RT ×T satisfying Mi,j = 1{i ≥ j}, where the attention matrix A in Eq. (2) is replaced with h )∈Rd×d where WV 1 , . . . , WV (3) A(X) = softmax M ◦ (cid:18) 1 √ dk Q(X)K(X)(cid:62) − Γ(1 − M) (cid:19) , (4) 3 Published as a conference paper at ICLR 2023 where Γ is a large positive constant that zeros the attention coefficients corresponding to future tokens, making A a lower triangular matrix. Signal propagation in transformers As discussed in Section 1, Dong et al. (2021) showed that deep skipless transformers suffer from rank collapse, where the kernel matrix converges in depth to have rank 1, and Noci et al. (2022) showed that rank collapse can prevent trainability. Moreover, Noci et al. (2022) demonstrated that rank collapse in transformers can occur in the ab- sence of normalisation layers even with skip connections, and that downscaling the residual branch by setting β = 1√ can alleviate this issue. This latter observation is in line with previous find- L ings concerning the benefits of downscaling residual weights in ResNets (Hanin & Rolnick, 2018; Zhang et al., 2018; Arpit et al., 2019; Hayou et al., 2021; Bachlechner et al., 2021) and transformers (Zhang et al., 2019; Xu et al., 2020; Huang et al., 2020; Touvron et al., 2021; Wang et al., 2022). Davis et al. (2021) showed that concatenation acts similarly to a downweighted skip as an alter- native way to connect skip and residual branches. De & Smith (2020) noted that the interaction of standard skip connections and normalisations can also effectively downweight the residual branch to give better signal propagation properties, but only if the normalisation layer is placed on the residual branch, like in Pre-LN transformers. Such an effect does not occur for Post-LN transformers, where the normalisation layer is after the residual branch, and we indeed observe in Fig. 7 that Post-LN attention-only transformers also suffer from rank collapse at large depths. This may explain some of the training instabilities of Post-LN transformers that have been observed in practice (Xiong et al., 2020; Liu et al., 2020). 3 CONSTRUCTING TRAINABLE DEEP TRANSFORMERS WITHOUT SHORTCUTS To date, the only strategy for rectifying rank collapse in transformers relies on skip/shortcut connec- tions, which "skip" around the trainability issues intrinsic to self-attention layers. We seek instead to tackle this issue directly. To do so, we first develop a better understanding of signal propagation through attention layers, then derive modifications from our insights to achieve faithful signal prop- agation in deep transformers, allowing them to be trained regardless of the use of skip connections. To start with, we consider the simplified setting of a deep attention-only vanilla transformer, and suppose we are in a single-head setting (h = 1) or a multi-head setting where the attention matrix A does not vary across heads. If block l ≤ L has attention matrix Al at initialisation, then the final block's representation XL takes the following form: l=1 WV XL = [ALAL−1 . . . A1] X0W, (5) l ∈ Rd×d can be made to be orthogonal at initialisation (so that l are orthogonally initialised (assuming dv = d l and WO h ). Going where W = (cid:81)L l WO W(cid:62)W = Id), if each WV forward we will assume such an orthogonal initialisation, providing an ablation study in Fig. 9. 0 ∈RT ×T the input kernel matrix across locations, and In that case, if we denote by Σ0 = X0X(cid:62) Πl = AlAl−1 . . . A1 to be the product of attention matrices up to the lth block, then the location- wise kernel matrix Σl = XlX(cid:62) l ∈ RT ×T at block l simplifies to1 Σl = Πl * Σ0 * Π(cid:62) l . (6) From this simplified formula for kernel matrices in deep attention-only transformers, we identify three requirements on (Al)l: (i) Σl = Πl * Σ0 * Π(cid:62) l must be well-behaved at each block, avoiding degenerate situations such as rank collapse and exploding/vanishing diagonal values. (ii) Al must be elementwise non-negative ∀l (recalling that Al is constructed through the soft- max operation Eq. (4)). (iii) Al should be lower triangular ∀l, for compatibility with causal masked attention.2 In Sections 3.1 and 3.2, we focus on finding attention matrices that satisfy our desiderata above, and demonstrate how to modify softmax attention to achieve these attention matrices in Section 3.3. 1We note that this formula for the kernel matrix is exact even at finite widths, if W is orthogonal at initiali- sation. This is in contrast to the standard kernel correspondence of NNs at initialisation, where the usual kernel equations are only approximations at finite width that become increasingly accurate as width increases (Neal, 2012; Daniely et al., 2016; Yang, 2019; Martens, 2021; Li et al., 2022). 2We describe compatibility of our methods with non-causal attention in Appendix A. 4 Published as a conference paper at ICLR 2023 IDENTITY ATTENTION: ISSUES AND VALUE-SKIPINIT 3.1 An obvious solution to our above requirements on (Al)l is the trivial one: Al = IT ∀l, where each sequence location attends only to itself. In this case, ΣL = Σ0 perfectly preserves the input kernel matrix, and will avoid rank collapse assuming Σ0 is non-degenerate. Unfortunately, identity atten- tion isn't compatible with a viable solution to obtain trainable vanilla transformers. This is because to achieve Al = I we would need to saturate the softmax operation (Eq. (2)) so that gradients do not pass to the query and key parameters, and the attention matrix stays close to identity during training. To provide a partial solution to this that achieves identity attention matrix at initialisation yet is still trainable, we introduce our first approach, Value-SkipInit, based on SkipInit (De & Smith, 2020), and the related ReZero method (Bachlechner et al., 2021). In Value-SkipInit, we modify the attention operation Attn(X) = A(X)V(X), to Attn(X) = (cid:0)αI + βA(X)(cid:1) * V(X) (7) with trainable parameters α and β that are initialised to 1 and 0 respectively. Thus, at initialisa- tion, the attention matrix is the identity. For transformers with MLPs blocks, this yields identical behaviour to a standard MLP acting on each sequence location independently at initialisation, so we can apply the DKS or TAT frameworks (Martens et al., 2021; Zhang et al., 2022) to achieve well-behaved signal propagation in the entire model.3 We note that Value-Skipinit is an approach to remove the standard skip connections in transformer blocks, Eq. (1), but can be construed as adding a skip connection around the value computation, and in that respect isn't strictly "skipless". Moreover, there is useful information contained in the positions of sequence locations that we do not employ when all attention matrices are identity at initialisation. As a result, we treat Value-Skipinit as a baseline for our main two methods, which we describe next. 3.2 SIGNAL PRESERVING ATTENTION METHODS Returning to our requirements on (Al)l in Section 3, we see that controlling their product is key to achieving faithful signal propagation. Given that we are now interested in non-identity (Al)l, this becomes more difficult. To overcome this, we consider Al of the form Al = LlL−1 l−1 (8) such that individual Li's cancel in the product, giving Πl = LlL−1 0 Σ0L−1(cid:62) L−1 0 = IT , we thus have 0 . Then if L0 satisfies Σl = LlL(cid:62) l . (9) Assuming input embeddings are initialised independently, and no repeated tokens in the input se- quence, we have Σ0 = IT in the large width limit,4 and can thus take L0 = IT . In practice, we will apply slight modifications to our methods to account for repeated tokens, as detailed in Appendix B. Now if Ll is lower triangular, then from Eq. (9) we see it is simply a Cholesky factor for the kernel matrix Σl. By the uniqueness of Cholesky factors for PSD matrices up to sign, this means we just need to choose {Σl}L l=0 to be a family of well-behaved kernel matrices that satisfy5 our non- negativity constraint (ii) on Al = LlL−1 l−1. We identify two such families, which give rise to our main method, Signal Preserving Attention (SPA): 1. Uniform (U-SPA): Σl(ρl) = (1 − ρl)IT +ρl11(cid:62). Here, the kernel matrix Σl(ρl) has diagonal entries equal to 1 and off-diagonal entries equal to ρl. The condition ρl ≤ ρl+1 is required for elementwise non-negativity of the A's, as shown in Theorem 1. Setting ρ0 = 0 yields identity input kernel matrix, and as long as ρL < 1, we avoid rank collapse in the skipless attention-only setting. 2. Exponential (E-SPA): (cid:0)Σl(γl)(cid:1) i,j = exp(−γl|i − j|). Here, diagonal entries are again 1, but now off-diagonals decay exponentially for more distant locations, with decay rate γl. Thus, unlike U-SPA, E-SPA captures the notion of positional encoding, as the vector representations for nearby locations have larger inner products (i.e. are more similar to each other). The condition γl ≥ γl+1 is required for elementwise non-negativity of the A's, as established in Theorem 2. Setting γ0 = ∞ yields the identity input kernel matrix, and rank collapse will be prevented as long as γL > 0. 3This is similar in principle to the Delta-initialisation for CNNs (Balduzzi et al., 2017; Xiao et al., 2018), and modifications to GNNs to enable compatibility with TAT (Zaidi et al., 2022). 4Because the embedding matrix E is initialised with variance 1/fan-out we rescale the embeddings it produces by d0 to get a Σ0 with ones on the diagonal. √ 5Constraint (iii) is satisfied as lower triangular matrices are closed under multiplication and inversion. 5 Published as a conference paper at ICLR 2023 l=1 and (γl)L We state and prove Theorems 1 and 2 in Appendix I, and in particular provide a closed-form solution for LlL−1 l−1 in the case of E-SPA in Theorem 3, enabling cheap computation. From these theorems, we see that our proposed SPA approaches are viable as long as the kernel matrix values become pro- gressively larger (in an elementwise fashion) as depth increases, as dictated by (ρl)L l=1. We find ρL = 0.8 and γL = 0.005 to be good default choices for the final block, and describe how to vary ρl and γl across depth in Appendix C. In Alg. 1 in Appendix D, we summarise how to construct a trainable self-attention layer with our main method E-SPA using ideas from Section 3.3, given an input-output decay rate pair γin, γout (in the notation of Alg. 1). Given a decreasing set of decay rates (γl)L In Fig. 1, we verify that our two proposed SPA schemes, U-SPA and E-SPA, successfully avoid rank collapse in attention-only vanilla transformers even at large depths. Moreover, because Σl has diagonals equal to 1 for all l, there is an implicit mechanism in these two schemes to control the representation vector norms across all sequence locations at deep layers. This means that they can be used with or without normalisation layers, as we will verify empirically in Section 4. Moreover, in Fig. 1 we see that E-SPA observes a recency bias as expected, where representation vectors for nearby locations have larger cosine similarity, as seen with positional encoding schemes like ALiBi (Press et al., 2022) (Fig. 7). As a result, even though all three of our approaches successfully avoid rank collapse, we expect E-SPA to outperform both U-SPA and Value-SkipInit. l=0, at block l we set γin = γl−1 and γout = γl. 3.3 REVERSE ENGINEERING SELF-ATTENTION LAYERS AT INITIALISATION In Section 3.2 we identified two families of lower-triangular non-negative attention matrices (Al)l which enable us to obtain well-behaved kernel matrices ΣL at large depth L, and hence faithful signal propagation. It remains to show how we can actually realise these attention matrices via parameter initialisation and minor modifications of the attention mechanism. More precisely, we will show how for any given lower-triangular A ∈ RT ×T with non-negative entries, the masked softmax self-attention layer Eq. (4) can be initialised and augmented such that its output is exactly Attn(X) = AV(X) at initialisation. To do so, we first define matrices D, P ∈ RT ×T such that A = DP, where D is diagonal with positive entries and P is lower triangular with row sums 1. Then if B = log(P) and M is the causal mask Mi,j = 1{i ≥ j}, we set6 Attn(X)=DP(X)V(X), & P(X)=softmax M◦ (cid:18) (cid:20) 1 √ dk (cid:21) Q(X)K(X)(cid:62)+B (cid:19) −Γ(1 − M) (10) dk scaling rather which reduces to Attn(X) = AV(X) (with a data-independent attention matrix) at initialisation if 1√ dk Q(X)K(X)(cid:62) = 0. We note that zero query-key dot products occur if the query-key dot product 1√ one uses a 1 dk in the infinite width limit for independently initialised WQ, WK (Yang, 2019). In practice, to achieve zero initial query-key dot product, we can initialise either: 1) WQ = 0, 2) WK = 0, or 3) both WQ and WK to have small initial scale (which achieves approximately zero dot product). In our experiments we found these three options to all perform similarly, and decided to use option 1): WQ = 0. An empirical evaluation of the sensitivity to the choice of initial scale in option 3) is provided in Fig. 8. In Eq. (10), D acts as a non-trainable location-dependent rescaling, and is needed to realise arbitrary attention matrices since the softmax output P(X) is constrained to have row sums equal to 1.7 Given target kernel matrices with 1's on the diagonal (which we have in SPA) its inclusion is akin to using RMSNorm at initialisation. However, this will gradually stop being true during training, leading to a (slightly) different model class. The additive pre-softmax biases B will also have an effect on the model class, but this will be similar to that of the ALiBi positional encoder (Press et al., 2022), which too involves a non-trainable bias matrix being added to the logits. In our early experiments we tried including a trainable gain parameter on the bias matrix, initialised to 1, in order to better preserve the model class, but found that this didn't have a significant impact on training performance. 6We take log(0) = −∞ or a large negative constant, e.g. −1030, in practice. 7In SPA, D also corrects for the fact that masked softmax attention tends to reduce the norms of represen- tation vectors for locations at the end of the sequence. To see this, if we have kernel matrix Σ = XX(cid:62)/d with Σii = 1, ∀i, and softmax attention matrix A with row i ai, then (AΣA(cid:62))ii = 1 2 = (cid:107)ai(cid:107)2 2. But ai sums to 1 (as a softmax output), so (cid:107)ai(cid:107)2 ≤ 1 with equality if and only if ai has exactly one non-zero entry (equal to 1). This holds for the first token (which can only attend to itself in masked attention) so (AΣA(cid:62))11 = 1, but not in general for later tokens, so (AΣA(cid:62))ii will usually be less than 1, for i > 1. d (cid:107)aiX(cid:107)2 d (cid:107)X(cid:107)2 2(cid:107)ai(cid:107)2 2 ≤ 1 6 Published as a conference paper at ICLR 2023 We also note that this approach to controlling the attention matrix by zeroing the query-key dot product at initialisation is compatible with popular positional encodings like Relative (Shaw et al., 2018; Huang et al., 2019; Dai et al., 2019) and RoPE (Su et al., 2021), as discussed in Appendix E. Unless stated otherwise, we use RoPE in our experiments, and provide an ablation in Fig. 10. 3.4 ADDRESSING MLP BLOCKS AND SKIP CONNECTIONS Up until this point we have restricted our focus to attention-only skipless transformers, for the sake of simplicity. However, MLP blocks are an important part of the transformer architecture that we must also address. And we would like for our approaches to be compatible with skip connections too, both for the sake of generality, and because they might combine profitably. MLP blocks Because MLP blocks operate on the representation vectors independently across locations, their effect on the kernel matrix can be easily computed using the standard limiting kernel formulas for MLPs (Neal, 2012) which are exact in the infinite width limit. In particular, there is a known f that maps the kernel matrix Σl of an MLP block's input sequence to the kernel matrix ˆΣl of its output sequence. In principle, one could modify SPA to account for this change to the kernel l−1, where Ll and ˆLl are the Cholesky factors of Σl and ˆΣl respectively. matrix by taking Al = Ll ˆL−1 Unfortunately, there is no guarantee that the resulting Al would be elementwise non-negative in general. In our experiments we thus elected to ignore the effect on the kernel matrices of the MLP blocks, approximating f as the identity function, which we found to work well enough in practice. As discussed in Martens et al. (2021), this approximation becomes better as the MLP blocks tend to linear functions (for which f is exactly identity), which will happen as we increase the shortcut weight α relative to the residual weight β (see Eq. (1)), or when the MLP's activation functions are close to linear. Notably, the latter condition will tend to be true when using DKS or TAT to transform the activation functions in deep networks. Note, when using DKS, f decreases the size of off-diagonal elements of the kernel matrix, which intuitively will help to combat rank collapse. Skip connections When using skip connections as in Eq. (1), the output kernel matrix of a block is given by Σblock = α2Σshortcut + β2 * Σresidual. One of the main ways that kernel matrices degenerate in DNNs is when their diagonal entries either explode or shrink with depth. As shown by Martens et al. (2021), this can be prevented in fully-connected and convolutional DNN architectures by rescaling the output of the activation functions (which happens automatically as part of DKS or TAT), and by replacing weighted sums with "normalised sums", which yields normalised skip connections defined by the condition α2 + β2 = 1. When using normalised skip connections with U-SPA, both Σshortcut and Σresidual will have the form Σ(ρ) = (1−ρ)IT +ρ11(cid:62) for some ρ, and thus so will Σblock. Moreover, we will have ρblock = α2ρshortcut + β2 * ρresidual, which is less than ρresidual. This means we can easily adjust U-SPA to be compatible with normalised skip connections by replacing Ll in the formula Al = LlL−1 l−1 with the Cholesky factor of Σ((ρl − α2ρl−1)/β2). In the case of E-SPA, we note that Σblock won't be of the form (cid:0)Σ(γ)(cid:1) i,j = exp(−γ|i − j|) for some γ, even when both Σshortcut and Σresidual are. To work around this, we use an approximation described in Appendix F, which seeks to make the combined effect on the kernel matrix of the normalised skip and attention block approximately equal to the effect of a skipless attention block. 4 EXPERIMENTS We now assess the capabilities of our proposed methods in training deep skipless and/or normaliser- free transformers. Our main experiment setting uses a transformer with 36 transformer blocks, which is deep enough that the effects of poor signal propagation and rank collapse render skipless training without modifications impossible. We begin our investigation on WikiText-103 (Merity et al., 2017) focusing primarily on training performance of our various methods, before moving to the larger C4 dataset (Raffel et al., 2019), where overfitting is not an issue. We use Adam optimiser (Kingma & Ba, 2014), as is standard for transformers, and train without dropout (Srivastava et al., 2014). Additional results and experimental details are provided in Appendices G and H respectively. WikiText-103 baselines To start with, we verify that a standard deep transformer without skip connections is untrainable even with normalisation layers (LN) and transformed activations, and that our approaches remedy this. Fig. 2 compares vanilla transformers using our proposed SPA 7 Published as a conference paper at ICLR 2023 Figure 3: Transformers with normalised skip connections, trained for 100K steps. E-SPA (left) without nor- malisation matches the training speed of a standard transformer. Results denote the mean of 2 seeds. methods and Value-Skipinit to standard transformers both with and without skips, on a 36 block transformer. We clearly see that removing skip connections from a standard transformer makes it untrainable, with training loss plateauing around 7.5. This holds true too even when we use DKS to transform the GeLU MLPs, highlighting that the issue lies with the attention layers, which suffer from rank collapse as shown in Fig. 1. On the other hand, all three of our approaches train even for vanilla deep transformers, with our E-SPA method outperforming U-SPA and Value-Skipinit. However, the default transformer with skips and LN still retains a training speed advantage com- pared to our skipless methods, mirroring the situa- tion for CNNs without powerful second-order opti- misers (Martens et al., 2021; Zhang et al., 2022). In Table 1, we assess the effect of different acti- vation functions in the MLP blocks, as well as the use of LN, in skipless transformers using our pro- posed methods. We see that at depth 36 we achieve good training performance for a range of activations: DKS-transformed GeLU, TAT-transformed Leaky ReLU, as well untransformed GeLU (Hendrycks & Gimpel, 2016), but not untransformed Sigmoid. We also see that layer normalisation is relatively unimportant for training speed, and can even be harmful with transformed activations when using SPA, which already has an inbuilt mechanism to control activation norms (as discussed at the end of Section 3.2). Figure 2: Comparison of skipless transformers. Vanilla transformers are not trainable without our modifications. All curves average over 3 seeds. Normalised skip connections In Fig. 3, we see that one way to match the training loss of the default transformer, without more itera- tions, is by using normalised skip connections. While this is perhaps unsurprising, we observe that our E-SPA method (left) matches stan- dard training both with and without normalisa- tion, whereas a standard Transformer with nor- malised skip connections (right) requires nor- malisation in order to match the training speed of the default Pre-LN. Table 1: WT103 train loss of skipless transformers for different activations, with or without LN. Mean and standard deviation are computed across 3 random seeds. Attention Activation LN w/o LN E-SPA U-SPA DKS-GeLU 2.99±.01 TAT-LReLU 3.00±.01 2.86±.04 GeLU 7.42±.01 Sigmoid DKS-GeLU 3.17±.03 TAT-LReLU 3.24±.02 3.10±.01 GeLU V-SkipInit DKS-GeLU 3.20±.02 TAT-LReLU 3.23±.02 3.18±.01 GeLU 2.79±.02 2.89±.02 2.93±.02 7.43±.01 2.99±.01 3.04±.01 3.25±.8 3.26±.02 3.32±.01 3.17±.02 C4 baseline So far, we tested our proposed methods on WikiText-103 (Merity et al., 2017), on which we observed overfitting without the use of extra regularisation. Therefore, we fur- ther compare our methods to standard trans- formers on a larger dataset, C4 (Raffel et al., 2019), where overfitting isn't an issue. Importantly, we see similar trends across validation8 (Fig. 4a), training (Fig. 13) and downstream task (Table 6) performance, and so the benefits of our methods do extend beyond training. Due to the memory 8Argued by Nakkiran et al. (2021), the validation curves measure the "training speed" of the online setting. 8 0.9950.990.980.970.90.70Shortcut weight 1.52.02.53.03.54.04.5WT103 Train lossExponential SPA0.9950.990.980.970.90.70Shortcut weight StandardLN=FalseLN=Truedefault (100k)0K20K40K60K80K100KTraining step234567WT103 Train lossskip+LNe-spau-spavalue skipinitskiplessskipless+LNskipless+LN+DKS Published as a conference paper at ICLR 2023 (a) Validation loss of vanilla transformers. (b) Longer training. Figure 4: Results on C4. (a): E-SPA again outperforms our other approaches. (b): Vanilla E-SPA matches default Pre-LN after 5x more iterations. overhead of longer sequences, we use a 32-block transformer. One can notice that E-SPA performs the best among skipless transformers on all settings: training, validation and downstream tasks. Moreover, in Table 2 we find that E-SPA with nor- malised skips and LN outperforms the default Pre- LN transformer, achieving 24.0 (vs 24.7) validation perplexity on C4 after 50K steps. Even without LN, E-SPA exactly matches the Pre-LN transformer in training speed, and outperforms a range of baselines designed to remove LN, including Stable ResNet (Hayou et al., 2021; Noci et al., 2022) and SkipInit (De & Smith, 2020), both with & without LN. Table 2: Validation perplexity for different skips on C4 with and without LN after 50K iterations. LN w/o LN Attention Skip Default U-SPA E-SPA Pre-LN Normalised Stable (α=1) SkipInit Normalised Normalised 24.7 24.5 24.4 25.9 27.6 24.0 – 25.1 25.3 35.3 28.0 24.7 Longer training matches default transformers In Figs. 2 and 4a, we observed that while our methods are able to train deep skipless transformers (a result which is unprecedented in the litera- ture), there is a significant gap in training speed compared to a standard Pre-LN transformer (with skips). Martens et al. (2021) and Zhang et al. (2022) observed a similar training speed gap for skip- less CNNs, and showed that such a gap can be closed by using more sophisticated second order optimisers like K-FAC (Martens & Grosse, 2015) or Shampoo (Gupta et al., 2018; Anil et al., 2020). As second order optimisers for transformers are not well established, we instead demonstrate that the training loss gap can be closed by simply training for longer in Fig. 4b. We observe that our E-SPA method matches the training loss of a standard pre-LN transformer on C4 if one trains for around 5 times longer with Adam, in line with the findings from the convolutional case (Zhang et al., 2022). An equivalent plot for WikiText-103 is provided in Fig. 14. Depth Scaling Finally, as unmodified networks suffer from worse signal propagation properties at larger depths, it is nat- ural to ask how our modified vanilla transformers perform as depth increases. In Table 3, we compare the training perfor- mance of different depths (36, 72, and 108) at a range of train- ing step budgets on WikiText-103. We find that whilst the shal- lower depth 36 network trains fastest initially over 100K steps, it is matched at 400K steps and then surpassed at 1000K steps by the larger capacity depth 72 network. Moreover, our depth 108 vanilla transformer is able to close the gap in performance to its depth 36 counterpart with longer training, going from 0.3 at 100K steps to just 0.01 at 1000K steps. Table 3: WT-103 training loss across depths. Deeper vanilla E-SPA trans- formers improve with more training. Depth 36 72 108 Training steps 100K 400K 1000K 3.12 3.25 3.42 2.66 2.67 2.78 2.20 2.11 2.21 5 CONCLUSION We have shown for the first time that it is possible to successfully train deep transformers without skip connections or normalisation layers. To do so, we have proposed 3 approaches: E-SPA, U-SPA and Value-Skipinit, each of which control the attention matrices of a transformer to enable faithful signal propagation even at large depths. Our best approach, E-SPA enables deep vanilla transformers to match their standard counterparts with around 5 times more iterations, and also deep transformers without normalisation to match the training speed of standard ones. We hope that our work may potentially pave the way to new and improved architectures, and more research into improving the capabilities of deep learning in practice using insights from theory. 9 0K10K20K30K40K50KTraining step34567C4 Eval lossskip+LNe-spau-spavalue skipinit0K50K100K150K200K250K300K350K400KTraining step3.03.23.43.63.84.04.2C4 Eval loss50k steps100k steps200k steps300k steps400k stepsdefault (50k) Published as a conference paper at ICLR 2023 REPRODUCIBILITY STATEMENT Pseudocode for our main approach, E-SPA, can be found in Alg. 1, using the notation and setup provided in Section 2. All experimental details can be found in Appendix H, including general and experiment-specific implementation details. ACKNOWLEDGEMENTS We thank Christos Kaplanis for helpful discussions during initial stages of this project, as well as the anonymous reviewers for their feedback. BH is supported by the EPSRC and MRC through the OxWaSP CDT programme (EP/L016710/1). REFERENCES Rohan Anil, Vineet Gupta, Tomer Koren, Kevin Regan, and Yoram Singer. Scalable second order optimization for deep learning. arXiv preprint arXiv:2002.09018, 2020. Devansh Arpit, V ́ıctor Campos, and Yoshua Bengio. How to initialize your network? robust initial- ization for weightnorm & resnets. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alch ́e-Buc, E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016. Thomas Bachlechner, Bodhisattwa Prasad Majumder, Henry Mao, Gary Cottrell, and Julian McAuley. Rezero is all you need: Fast convergence at large depth. In Uncertainty in Artificial Intelligence, pp. 1352–1361. PMLR, 2021. Alexei Baevski and Michael Auli. Adaptive input representations for neural language modeling. arXiv preprint arXiv:1809.10853, 2018. David Balduzzi, Marcus Frean, Lennox Leary, JP Lewis, Kurt Wan-Duo Ma, and Brian McWilliams. The shattered gradients problem: If resnets are the answer, then what is the question? In Interna- tional Conference on Machine Learning, pp. 342–350. PMLR, 2017. Yonatan Bisk, Rowan Zellers, Jianfeng Gao, Yejin Choi, et al. Piqa: Reasoning about physical com- monsense in natural language. In Proceedings of the AAAI conference on artificial intelligence, volume 34, pp. 7432–7439, 2020. Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020. Rewon Child, Scott Gray, Alec Radford, and Ilya Sutskever. Generating long sequences with sparse transformers. arXiv preprint arXiv:1904.10509, 2019. Christopher Clark, Kenton Lee, Ming-Wei Chang, Tom Kwiatkowski, Michael Collins, and Kristina Toutanova. Boolq: Exploring the surprising difficulty of natural yes/no questions. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 2924–2936, 2019. Zihang Dai, Zhilin Yang, Yiming Yang, Jaime Carbonell, Quoc V Le, and Ruslan Salakhutdi- nov. Transformer-xl: Attentive language models beyond a fixed-length context. arXiv preprint arXiv:1901.02860, 2019. Amit Daniely, Roy Frostig, and Yoram Singer. Toward deeper understanding of neural networks: The power of initialization and a dual view on expressivity. In D. Lee, M. Sugiyama, U. Luxburg, I. Guyon, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 29. Curran Associates, Inc., 2016. 10 Published as a conference paper at ICLR 2023 Jared Q Davis, Albert Gu, Krzysztof Choromanski, Tri Dao, Christopher Re, Chelsea Finn, and Percy Liang. Catformer: Designing stable transformers via sensitivity analysis. In Marina Meila and Tong Zhang (eds.), Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pp. 2489–2499. PMLR, 18–24 Jul 2021. URL https://proceedings.mlr.press/v139/davis21a.html. Soham De and Sam Smith. Batch normalization biases residual blocks towards the identity function in deep networks. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 19964–19975. Curran As- sociates, Inc., 2020. Yihe Dong, Jean-Baptiste Cordonnier, and Andreas Loukas. Attention is not all you need: Pure attention loses rank doubly exponentially with depth. In International Conference on Machine Learning, pp. 2793–2803. PMLR, 2021. Vineet Gupta, Tomer Koren, and Yoram Singer. Shampoo: Preconditioned stochastic tensor opti- mization. In International Conference on Machine Learning, pp. 1842–1850. PMLR, 2018. Boris Hanin and David Rolnick. How to start training: The effect of initialization and architecture. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, NIPS'18, pp. 569–579, Red Hook, NY, USA, 2018. Curran Associates Inc. Soufiane Hayou, Arnaud Doucet, and Judith Rousseau. On the impact of the activation function on deep neural networks training. In Kamalika Chaudhuri and Ruslan Salakhutdinov (eds.), Pro- ceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pp. 2672–2680. PMLR, 09–15 Jun 2019. Soufiane Hayou, Eugenio Clerico, Bobby He, George Deligiannidis, Arnaud Doucet, and Judith Rousseau. Stable resnet. In International Conference on Artificial Intelligence and Statistics, pp. 1324–1332. PMLR, 2021. Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. In European conference on computer vision, pp. 630–645. Springer, 2016. Dan Hendrycks and Kevin Gimpel. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415, 2016. Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch, Elena Buchatskaya, Trevor Cai, Eliza Rutherford, Diego de Las Casas, Lisa Anne Hendricks, Johannes Welbl, Aidan Clark, et al. Train- ing compute-optimal large language models. arXiv preprint arXiv:2203.15556, 2022. Jiri Hron, Yasaman Bahri, Jascha Sohl-Dickstein, and Roman Novak. Infinite attention: Nngp and ntk for deep attention networks. In International Conference on Machine Learning, pp. 4376– 4386. PMLR, 2020. Cheng-Zhi Anna Huang, Ashish Vaswani, Jakob Uszkoreit, Ian Simon, Curtis Hawthorne, Noam Shazeer, Andrew M. Dai, Matthew D. Hoffman, Monica Dinculescu, and Douglas Eck. Music transformer. In International Conference on Learning Representations, 2019. Xiao Shi Huang, Felipe Perez, Jimmy Ba, and Maksims Volkovs. Improving transformer optimiza- tion through better initialization. In Hal Daum ́e III and Aarti Singh (eds.), Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learn- ing Research, pp. 4475–4483. PMLR, 13–18 Jul 2020. URL https://proceedings.mlr. press/v119/huang20f.html. Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. Taku Kudo and John Richardson. SentencePiece: A simple and language independent sub- In Proceedings of the 2018 Con- word tokenizer and detokenizer for neural text processing. ference on Empirical Methods in Natural Language Processing: System Demonstrations, pp. 66–71, Brussels, Belgium, November 2018. Association for Computational Linguistics. doi: 10.18653/v1/D18-2012. 11 Published as a conference paper at ICLR 2023 Jaehoon Lee, Jascha Sohl-dickstein, Jeffrey Pennington, Roman Novak, Sam Schoenholz, and In International Conference Yasaman Bahri. Deep Neural Networks as Gaussian Processes. on Learning Representations, 2018. Mufan Bill Li, Mihai Nica, and Daniel M Roy. The neural covariance sde: Shaped infinite depth- and-width networks at initialization. arXiv preprint arXiv:2206.02768, 2022. Liyuan Liu, Xiaodong Liu, Jianfeng Gao, Weizhu Chen, and Jiawei Han. Understanding the diffi- culty of training transformers. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 5747–5763, 2020. Ilya Loshchilov and Frank Hutter. Sgdr: Stochastic gradient descent with warm restarts. arXiv preprint arXiv:1608.03983, 2016. James Martens. On the validity of kernel approximations for orthogonally-initialized neural net- works. arXiv preprint arXiv:2104.05878, 2021. James Martens and Roger Grosse. Optimizing neural networks with kronecker-factored approximate curvature. In International conference on machine learning, pp. 2408–2417. PMLR, 2015. James Martens, Andy Ballard, Guillaume Desjardins, Grzegorz Swirszcz, Valentin Dalibard, Jascha Sohl-Dickstein, and Samuel S Schoenholz. Rapid training of deep neural networks without skip connections or normalization layers using deep kernel shaping. arXiv preprint arXiv:2110.01765, 2021. Alexander G de G Matthews, Mark Rowland, Jiri Hron, Richard E Turner, and Zoubin Ghahramani. In International Conference on Gaussian Process Behaviour in Wide Deep Neural Networks. Learning Representations, volume 4, 2018. Elizabeth S. Meckes. The Random Matrix Theory of the Classical Compact Groups. Cambridge Tracts in Mathematics. Cambridge University Press, 2019. doi: 10.1017/9781108303453. Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. In International Conference on Learning Representations, 2017. Preetum Nakkiran, Behnam Neyshabur, and Hanie Sedghi. The deep bootstrap framework: Good online learners are good offline generalizers. In International Conference on Learning Represen- tations, 2021. Radford M Neal. Bayesian learning for neural networks, volume 118. Springer Science & Business Media, 2012. Lorenzo Noci, Sotiris Anagnostidis, Luca Biggio, Antonio Orvieto, Sidak Pal Singh, and Aurelien Lucchi. Signal propagation in transformers: Theoretical perspectives and the role of rank collapse. arXiv preprint arXiv:2206.03126, 2022. Razvan Pascanu, Tomas Mikolov, and Yoshua Bengio. On the difficulty of training recurrent neural networks. In International conference on machine learning, pp. 1310–1318. PMLR, 2013. Ben Poole, Subhaneil Lahiri, Maithra Raghu, Jascha Sohl-Dickstein, and Surya Ganguli. Expo- nential expressivity in deep neural networks through transient chaos. In D. Lee, M. Sugiyama, U. Luxburg, I. Guyon, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 29. Curran Associates, Inc., 2016. Ofir Press, Noah Smith, and Mike Lewis. Train short, test long: Attention with linear biases enables input length extrapolation. In International Conference on Learning Representations, 2022. Jack W Rae, Sebastian Borgeaud, Trevor Cai, Katie Millican, Jordan Hoffmann, Francis Song, John Aslanides, Sarah Henderson, Roman Ring, Susannah Young, et al. Scaling language models: Methods, analysis & insights from training gopher. arXiv preprint arXiv:2112.11446, 2021. Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. arXiv e-prints, 2019. 12 Published as a conference paper at ICLR 2023 Keisuke Sakaguchi, Ronan Le Bras, Chandra Bhagavatula, and Yejin Choi. Winogrande: An adver- sarial winograd schema challenge at scale. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp. 8732–8740, 2020. Maarten Sap, Hannah Rashkin, Derek Chen, Ronan Le Bras, and Yejin Choi. Social iqa: Common- sense reasoning about social interactions. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 4463–4473, 2019. Samuel S Schoenholz, Justin Gilmer, Surya Ganguli, and Jascha Sohl-Dickstein. Deep information propagation. In International Conference on Learning Representations, 2017. Peter Shaw, Jakob Uszkoreit, and Ashish Vaswani. Self-attention with relative position representa- tions. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers), pp. 464–468, 2018. Shaden Smith, Mostofa Patwary, Brandon Norick, Patrick LeGresley, Samyam Rajbhandari, Jared Casper, Zhun Liu, Shrimai Prabhumoye, George Zerveas, Vijay Korthikanti, et al. Using deep- speed and megatron to train megatron-turing nlg 530b, a large-scale generative language model. arXiv preprint arXiv:2201.11990, 2022. Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15(56):1929–1958, 2014. Jianlin Su, Yu Lu, Shengfeng Pan, Bo Wen, and Yunfeng Liu. Roformer: Enhanced transformer with rotary position embedding. arXiv preprint arXiv:2104.09864, 2021. Hugo Touvron, Matthieu Cord, Alexandre Sablayrolles, Gabriel Synnaeve, and Herv ́e J ́egou. Going deeper with image transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 32–42, 2021. Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural informa- tion processing systems, 30, 2017. Hongyu Wang, Shuming Ma, Li Dong, Shaohan Huang, Dongdong Zhang, and Furu Wei. Deepnet: Scaling transformers to 1,000 layers. arXiv preprint arXiv:2203.00555, 2022. Qiang Wang, Bei Li, Tong Xiao, Jingbo Zhu, Changliang Li, Derek F Wong, and Lidia S Chao. Learning deep transformer models for machine translation. arXiv preprint arXiv:1906.01787, 2019. Lechao Xiao, Yasaman Bahri, Jascha Sohl-Dickstein, Samuel Schoenholz, and Jeffrey Pennington. Dynamical isometry and a mean field theory of cnns: How to train 10,000-layer vanilla con- volutional neural networks. In International Conference on Machine Learning, pp. 5393–5402. PMLR, 2018. Ruibin Xiong, Yunchang Yang, Di He, Kai Zheng, Shuxin Zheng, Chen Xing, Huishuai Zhang, Yanyan Lan, Liwei Wang, and Tieyan Liu. On layer normalization in the transformer architecture. In International Conference on Machine Learning, pp. 10524–10533. PMLR, 2020. Hongfei Xu, Qiuhui Liu, Josef van Genabith, Deyi Xiong, and Jingyi Zhang. Lipschitz constrained parameter initialization for deep transformers. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 397–402, 2020. Greg Yang. Wide feedforward or recurrent neural networks of any architecture are gaussian pro- cesses. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alch ́e-Buc, E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. Sheheryar Zaidi, Michael Schaarschmidt, James Martens, Hyunjik Kim, Yee Whye Teh, Alvaro Sanchez-Gonzalez, Peter Battaglia, Razvan Pascanu, and Jonathan Godwin. Pre-training via de- noising for molecular property prediction. arXiv preprint arXiv:2206.00133, 2022. 13 Published as a conference paper at ICLR 2023 Rowan Zellers, Ari Holtzman, Yonatan Bisk, Ali Farhadi, and Yejin Choi. Hellaswag: Can a ma- chine really finish your sentence? In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 4791–4800, 2019. Biao Zhang and Rico Sennrich. Root mean square layer normalization. Advances in Neural Infor- mation Processing Systems, 32, 2019. Biao Zhang, Ivan Titov, and Rico Sennrich. Improving deep transformer with depth-scaled initial- ization and merged attention. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 898–909, 2019. Guodong Zhang, Aleksandar Botev, and James Martens. Deep learning without shortcuts: Shaping the kernel with tailored rectifiers. In International Conference on Learning Representations, 2022. Hongyi Zhang, Yann N Dauphin, and Tengyu Ma. Fixup initialization: Residual learning without normalization. In International Conference on Learning Representations, 2018. 14 Published as a conference paper at ICLR 2023 A COMPATIBILITY WITH NON-CAUSAL ATTENTION In Section 3, we focus on causal masked self-attention for two reasons. First, next-token prediction using causal masked self-attention is arguably the most popular setting for self-attention. And sec- ond, it is a more challenging setting to work with in terms of controlling signal propagation, due to the additional constraint that attention matrices must be lower triangular. In this section we describe how our methods can be made compatible with non-causal masked attention, where the attention matrices are no longer required to be lower triangular. To start with, Value-SkipInit does not modify the softmax-attention computation and hence is al- ready compatible with any form of attention. For our SPA methods, it is straightforward to extend to non-causal attention by changing Ll in Eqs. (8) and (9) from being the Cholesky decomposition of Σl to being the (symmetric) matrix square root of Σl. In this case, for U-SPA it is possible to analytically calculate that Al in Eq. (8) will be element-wise non-negative if ρl ≥ ρl−1 (exactly like the Cholesky case in Theorem 1). This is easy to see because the matrix square-root, inverses and products of uniform kernel matrices are all still uniform of the form Σ(ρ) = (1 − ρ)IT +ρ11(cid:62) (up to positive rescaling), so that Al will be too, and one simply needs to track ρ and verify that it is pos- itive. For E-SPA. we have verified empirically that the resulting Al = LlL−1 l−1 will be non-negative if γl ≤ γl−1, just like the Cholesky case in Theorem 2. B MODIFICATIONS TO SPA METHODS FOR REPEATED TOKENS For simplicity, we assumed that our input sequences had no repeated tokens when presenting SPA in Section 3. This meant that we could take the input kernel matrix Σ0 to be the identity, with zero off-diagonals, which was convenient for our construction of SPA. The effect of repeated tokens, e.g. if the word 'cat' occurs multiple times in the same sentence, is that our input kernel matrices Σ0 will have non-zero off-diagonal entries, corresponding to entries where a token is repeated. This will impact the kernel matrices Σl at deeper layers with SPA, particularly the diagonal values of Σl, which we would like to able to control. In this section we discuss how we can modify our SPA approaches to account for the fact that we will often be working with sequences where a fraction of the tokens are repeated. We stress that the general principle that all our methods (Value-SkipInit and SPA methods) follow is independent of the input kernel matrix (i.e. independent of duplicate input tokens): we seek to prevent the product of attention matrices from deviating away from the identity matrix and degen- erating to a rank-1 matrix. From Eq. (6), we see that if the product of attention-matrices is rank-1 then regardless of the input kernel we will have a rank-1 output kernel i.e. rank collapse (Dong et al., 2021). On the other hand, if we control the deviation of the attention matrix product from the identity then no matter the input kernel, the output kernel will bear some similarity to the input kernel. So as long as the input kernel is non-degenerate and has full rank (regardless of duplicate tokens) so too will be the output kernel. Recall that with attention matrices (Al)l, an input kernel matrix across T locations Σ0 ∈ RT ×T gets mapped, at depth l, to Σl = Πl * Σ0 * Π(cid:62) l (11) where Πl = AlAl−1 . . . A1 is the product of attention matrices. In SPA, we parameterise Al = LlL−1 family of kernel matrices (Σl)l, with either uniform or exponentially decaying off diagonals: l−1 for (Ll)l corresponding to the Cholesky factors of some 1. U-SPA: Σl(ρl)=(1 − ρl)IT +ρl11(cid:62) for 0 ≤ ρ ≤ 1 2. E-SPA: (cid:0)Σl(γl)(cid:1) i,j = exp(−γl|i − j|)) for γ ≥ 0. It is important that Al = LlL−1 l−1 is constructed from two Cholesky matrices belonging to the same family, because Theorems 1 and 2 show in that case we will satisfy our non-negativity constraint on Al (which is computed through a softmax operation), and otherwise there is no prior reason to suppose that non-negativity will be satisfied. Therefore, in an ideal world, Σ0 would be an element of our family of kernel matrices, so that we can set L0 to be the Cholesky factor of Σ0, satisfying 0 Σ0L−1(cid:62) L−1 0 = IT . 15 Published as a conference paper at ICLR 2023 Figure 5: Input token kernel matrices for different proportion of repeated tokens. Figure 6: Diagonal entries of Σl for a single sequence of length T = 100 across blocks for E-SPA in the presence of r = 0.05 shared tokens, with and without modifications. We see that without our modifications and simply assuming Σ0 = I by default (green) the average diagonal diverges at deeper blocks, when γl is smaller and the off-diagonals of Σl are larger. On the other hand, our modifications (purple) keep the average diagonal around 1 with controlled standard deviations. Here, the last kernel matrix (at depth 36) has decay rate γL = 0.02 and the standard deviation is computed over the 100 locations. Typically, Σ0 = XX(cid:62)/d0 for input token embeddings X ∈ RT ×d0 , which are independently initialised for different tokens identites. Thus, in the wide limit d → ∞, (up to rescaling) Σ0 will have diagonals equal to 1, and off-diagonals equal to 1 if there is a repeated token and 0 else. We plot examples of such kernel matrices in Fig. 5 for different fractions of repeated tokens r, under the assumption that repeated tokens occur independently of location. Clearly, when r = 0, we have Σ0 = I is a member of both the uniform and exponential families of kernel matrices, corresponding to uniform off-diagonals of ρ0 = 0 or exponentially decaying off-diagonals with rate γ0 = ∞. In this case we can set L0 = I too. On the other hand, for r > 0, it is in general difficult to say much more about an individual se- quence's Σ0, given that different sequences will have repeated tokens in different locations. More- over, the naive approach of ignoring the repeated tokens and treating Σ0 = I leads to increasing diagonal values of Σl (i.e. activation norms) at large depth without corrections, as shown in Fig. 6.9 This imbalance between blocks could be problematic for training dynamics, and also is incompatible with frameworks like DKS and TAT which suppose that diagonal values of Σl are constant across blocks and locations, usually set to 1. To circumvent this, we will derive our modifications by considering the average input kernel matrix ̄Σ0 (averaged over different sequences), under the assumption that repeated tokens occur indepen- dent of location: ̄Σ0 = (1 − r)IT + r11T (12) 9We find that r ≈ 0.008 for sentencepiece tokenisations like we use in WikiText-103 and C4, but r ≈ 0.05 for character-level prediction like in EnWiki-8. 16 020406080020406080Repeated prob=0.0020406080020406080Repeated prob=0.01020406080020406080Repeated prob=0.05020406080020406080Repeated prob=0.10.00.20.40.60.81.0Cosine similarity05101520253035Layer123456Diagonal entries of lcorrecteduncorrected Published as a conference paper at ICLR 2023 By linearity of Eq. (11) in Σ0 (and because we are controlling Al to be input-independent at initial- isation in Section 3), it also follows that the average depth l kernel matrix ̄Σl satisfies: ̄Σl(X, X) = Πl * ̄Σ0 * Π(cid:62) l (13) so we can modify our SPA approaches to control the average kernel matrix ̄Σl instead. For U-SPA, the situation is more straightforward as ̄Σ0 is a uniform kernel matrix with ρ = r, so it suffices to simply let ρ0 = r instead of ρ0 = 0. For E-SPA, we are unable to view ̄Σ0 as having exponentially decaying off-diagonals, and so we keep γ0 = ∞ which translates to L0 = I and Πl = Ll. Instead, to help us understand the effect of repeated tokens (to motivate our modifications), we first expand on Eq. (13) to simplify a little: l = Ll * ̄Σ0 * L(cid:62) = (1 − r)LlL(cid:62) l + rLl11(cid:62)L(cid:62) l = Σl(γl) + rLl(11(cid:62) − I)L(cid:62) l = Σl(γl) + rLlOT L(cid:62) l Πl * ̄Σ0 * Π(cid:62) (14) l where OT = 11(cid:62) − IT ∈ RT ×T is 0 on the diagonal and 1 off the diagonal. Note that all terms in Eq. (14) are easily computable (given that (cid:0)Σl(γl)(cid:1) i,j = exp(−γl|i − j|)) and Ll has an analytic form provided in Lemma 1). So we can use Eq. (14) to compute the expected diagonal ( ̄Σl)i,i for each location i (where the expectation is taken over different sequences), which we denote by a diagonal matrix ̄Dl: ̄Dl = Diag(Ll * ̄Σ0 * L(cid:62) l ) ∈ RT ×T Thus, we propose to replace Al = LlL−1 This means that our product Πl = (cid:81)l l−1 with Al = ̄D− 1 i=1 Ai = ̄D− 1 2 2 l−1 l Ll, and Eq. (13) is updated to: ̄D− 1 l Ll * ̄Σ0 * L(cid:62) l l 2 2 ̄Σl(X, X) = ̄D− 1 l LlL−1 ̄D l−1, setting ̄D0 = I by default. 1 2 (15) which has diagonals controlled to 1. Though our modifications for repeated tokens only consider averages across different sequences, we find that for individual sequences they still lead to well behaved diagonal values of Σl, as shown in Fig. 6. Moreover, we find that their effect on off-diagonals is still favourable for individual sequences, as shown in Fig. 1. C SETTING (ρl)l AND (γl)l In this section we describe how we set the uniform off-diagonals (ρl)l and the exponential decay rates (γl)l in SPA, at different depths. Recall that Theorems 1 and 2 show that we are free to choose (ρl)L l=0 increase with depth and (γl)L l=0 decrease with depth. Moreover, ρ0 = 0 (or the shared token fraction r, as per Appendix B) and γ0 = ∞ at the input layer, whilst we have found ρL = 0.8 and γL = 0.005 to be good default values for the last block. l=0 such that (ρl)L l=0 and (γl)L For U-SPA, in terms of setting how (ρl)l vary with depth, we tried different polynomial rates of increase with depth from ρ0 to ρL, but did not observe a noticeable difference in performance across different rates so chose to increase from ρ0 to ρL linearly in depth. For E-SPA, we choose (γl)l so that the diagonal elements of the attention matrices Al are constant across blocks, akin to using a constant shortcut weight α over different blocks. From Theorem 3, we have that the diagonal entries of Al satisfy: (Al)i,i = a(γl) a(γl−1) , ∀i > 1 17 Published as a conference paper at ICLR 2023 where a(γ) = (cid:112)1 − exp(−2γ) with inverse γ(a) = − 1 This means that for a set of positive decreasing (γl)l, there exist a corresponding set of decreasing (al)l with values between 0 and 1. 2 log(1 − a2). Because γ0 = ∞, we have a0 = 1, and likewise for a given γL we can compute aL. Thus to have constant diagonal values of Al over different blocks l, we choose to set for l ≤ L, and thus al = al/L L γl = γ(al) = − 1 2 log(1 − a2l/L L ) We found this scheme to work well empirically, and note the similarity to other works which have discussed the choice of how to scale branches in residual architectures (Hayou et al., 2021). We leave further study of choosing how to set (ρl)l and (γl)l to future work. D E-SPA ALGORITHM In Alg. 1 we present pseudocode to construct a trainable E-SPA masked attention layer. Algorithm 1: Modified E-SPA masked attention layer. Input: Input sequence representation X ∈ RT ×d. Output: Updated sequence representation Attn(X) ∈ RT ×d. Hyperparameters: Input γin & output γout exponential decay rates, γin ≥ γout. Number of heads h with head dimension dh = d/h. Causal mask M ∈ RT ×T s.t. Mi,j = 1{i ≥ j}. Large constant Γ, e.g. 1030, to enforce causal mask. Trainable parameters: WQ n , WK n , WV 1 Compute Lin and Lout to be the Cholesky factors of (Σin n ∈ Rd×dh , for 1 ≤ n ≤ h. WO ∈ Rd×d. i )i,j = exp(−γin|i − j|) and (Σout i )i,j = exp(−γout|i − j|) respectively. 2 Set A = LoutL−1 in (using analytic form in Theorem 3) & decompose A = DP where D diagonal & P has row sums 1. Denote B = log(P). 3 for head n ∈ {1, . . . , h} do 4 5 6 7 n , WV n Initialise WK Set Qn(X) = XWQ Compute Pn(X) = softmax Set Attnn(X) = DPn(X) * Vn(X) i.i.d.∼ N (0, 1 n , Kn(X) = XWK (cid:16) M ◦ (cid:0) 1√ dh d ) (alternatively orthogonally). Initialise WQ n = 0. n and Vn(X) = XWV n . (cid:17) Qn(X)Kn(X)(cid:62) + B(cid:1) − Γ(1 − M) 8 Initialise WO i.i.d.∼ N (0, 1 9 return Concat(cid:0)Attn1(X), . . . , Attnh(X)(cid:1)WO d ) (alternatively as an orthogonal matrix) E COMPATIBILITY OF SPA WITH EXISTING POSITIONAL ENCODINGS In Section 3.3, we showed how to control the attention matrix at initialisation, using bias matrices and location-dependent rescaling, as well as making the query-key dot product, dk Q(X)K(X)(cid:62)= 1√ 1√ dk XWQ(XWK)(cid:62), zero at initialisation. This scheme is used in our SPA methods. We detailed several ways to achieve this, and in practice we chose to initialise WQ to zero, and initialise WK as usual (Gaussian fan-in or orthogonal). In this section we show how zero initialising the query-key dot product is also possible when using two standard positional encodings: RoPE (Su et al., 2021) and Relative (Shaw et al., 2018; Huang et al., 2019; Dai et al., 2019). This means that we can use our methods in Section 3.3 in combination with these positional encoders. Let us denote the unscaled query-key dot product as S = XWQ(XWK)(cid:62). 18 Published as a conference paper at ICLR 2023 For RoPE, the (i, j) query-key dot product, Si,j, is modified from (WQXi)(cid:62)(WKXj) to (RiWQXi)(cid:62)(RjWKXj), (16) where Ri,j are some location-dependent rotation matrices defined in Su et al. (2021), and Xi denotes row i of the incoming representation X ∈ RT ×d to the attention block. Clearly, Eq. (16) is 0 for all i, j if WQ is zero. For Relative positional encoding, we take the scheme from (Dai et al., 2019). In that case, the (i, j) query-key dot product, Si,j, is modified from to (WQXi)(cid:62)(WKXj) (WQXi)(cid:62)(WKXj) + (WQXi)(cid:62)(WK,RRi−j) + u(cid:62)(WKXj) + v(cid:62)(WK,RRi−j) (17) where Ri−j ∈ Rd is fixed, and WK,R ∈ Rdk×d, u, v ∈ Rdk are trainable. Thus, we can achieve zero query-key dot products at initialisation if we initialise u, v = 0, in addition to WQ = 0. F USING NORMALISED SKIP CONNECTIONS WITH E-SPA In this section, we describe how to combine our E-SPA method with normalised skip connections in our attention blocks: Z = αX + (cid:112) 1 − α2AXWV (18) where α = 0 is the skipless setting that our methods are originally designed for. The general gist is that we will look at the combined effect, on the kernel matrix after the residual attention block, of the residual branch and the diagonal terms in the attention matrices for preserving signal propagation, and approximate the combination to match the setting where we are without skips, i.e. α = 0. To combine E-SPA with normalised skip connections, we consider how the cosine-similarity be- tween two locations T1, T2 ≤ T is affected through the normalised skip connection. Suppose we have an input kernel matrix: 1 d XX(cid:62) = Σ where (Σ)i,i = 1, ∀i and d is the width. Then after the residual attention block, Eq. (18), we now have: XX(cid:62) + (1 − α2) AXWV WV (cid:62) X(cid:62)A(cid:62) 1 d ZZ(cid:62) =α2 1 d 1 d (cid:2)XWV (cid:62) + α (cid:112) 1 − α2 1 d XT AT + AXWV X(cid:62)(cid:3) (19) (20) Either we have WV to be an orthogonal matrix sampled uniformly at random from the Haar measure, or WV i.i.d.∼ N (0, 1 X(cid:62)A(cid:62) going towards 1 d AXX(cid:62)A(cid:62), and the cross terms Eq. (20) converging to 0 for large d. Thus, we can consider the large d approximation: In both cases we have 1 d AXWV WV (cid:62) d ). 1 d ZZ(cid:62) =α2 1 d XX(cid:62) + (1 − α2) 1 d =α2Σ + (1 − α2)AΣA(cid:62) AXX(cid:62)A(cid:62) (21) (22) 19 Published as a conference paper at ICLR 2023 Then, if we look at the inner product between the T1 and T2 locations for locations T1 (cid:54)= T2 such that T1, T2 > 1, we have: 1 d (ZZ(cid:62))T1,T2 =α2ΣT1,T2 + (1 − α2)(AΣA(cid:62))T1,T2 =α2ΣT1,T2 + (1 − α2) AT1,iΣi,jAT2,j (cid:88) =α2ΣT1,T2 + (1 − α2)AT1,T1ΣT1,T2 AT2,T2 + (1 − α2) i,j (cid:88) i(cid:54)=T1∪j(cid:54)=T2 AT1,iΣi,jAT2,j =(cid:2)α2 + (1 − α2)λ2(cid:3)ΣT1,T2 + (1 − α2) (cid:88) AT1,iΣi,jAT2,j i(cid:54)=T1∪j(cid:54)=T2 =(cid:2)α2 + (1 − α2)λ2(cid:3)ΣT1,T2 + (1 − α2)δ =νΣT1,T2 + (1 − α2)δ (23) where λ = AT1,T1 = AT2,T2 is the constant diagonal of the attention matrices in E-SPA, c.f. Theorem 3, and ν = α2 + (1 − α2)λ2. Moreover, we have defined δ = (cid:80) AT1,iΣi,jAT2,j as it is a term that is not possible to control with only knowledge of ΣT1,T2 and will vary from sequence to sequence, and hence we argue can be discarded from a signal propagation perspective. For example, one could consider a sequence where the kernel matrix Σ has all off-diagonals equal to 0 apart from ΣT1,T2, and T1 could be sufficiently distant from T2 such that there is no i for which AT1,i and AT2,i are large at the same time (which can be seen using the analytic form of A given in Theorem 3). i(cid:54)=T1∪j(cid:54)=T2 Thus, from Eq. (23), we see that after an residual attention block, an input cosine similarity of ΣT1,T2 between locations T1, T2 is diluted by a factor of ν = α2 + (1 − α2)λ2 < 1, with shortcut weight α and attention diagonal probability λ. Our approximation then seeks to pre- serve this factor ν when α > 0 to match the skipless case. Now, in the skipless case α = 0 described in Section 3, at block l we suppose that the incoming kernel matrix Σ has exponentially decaying off-diagonals with rate γl−1, and that we construct the attention matrix A so that the output kernel matrix has exponentially decaying off diagonals with rate γl. From Theorem 3, we see that this gives diagonal entries of A to be: λ0 = a(γl) a(γl−1) where a(γ) = (cid:112)1 − exp(−2γ). Thus, to preserve ν to match the case for α = 0, if we have shortcut weight α > 0 we need the attention matrix diagonal probability λα to satisfy: (cid:115) λ2 0 − α2 1 − α2 . λα = (24) In turn, when we have shortcut weight α, this means that we need to choose our outgoing decay rate at block l, γl,α, such that: Inverting the definition of a(γ), we see we need to set γl,α: a(γl,α) = λαa(γl−1). γl,α = − = − 1 2 1 2 log(1 − (λ2 (cid:18) log 1 − αa(γl−1)2) λ2 0 − α2 1 − α2 (1 − exp(−2γl−1)) (cid:19) (25) (26) 20 Published as a conference paper at ICLR 2023 Table 4: Validation perplexity equivalent of Table 1 Attention Activation With LN Without LN E-SPA U-SPA DKS-GeLU 21.0±.1 TAT-LReLU 21.5±.1 20.4±.2 GeLU DKS-GeLU 24.1±.3 TAT-LReLU 26.0±.5 24.7±.2 GeLU V-SkipInit DKS-GeLU 24.7±.1 TAT-LReLU 25.7±.2 25.5±.3 GeLU 20.0±.3 19.7±.1 23.1±.1 23.2±.3 21.8±.2 29.2±.7 27.5±.1 27.4±.1 26.1±.7 To summarise, if we have a sequence (γl)l of decreasing exponential decay rates, our proposed approximation when using shortcut weights α at block l is, using the notation of Alg. 1, to set γin = γl−1 as normal, and to set γout = γl,α from Eq. (25) in order to preserve the signal propagation from the combined residual attention block Eq. (23). We see that this approximation reduces to the standard skipless setting when α = 0, as a sanity check. G ADDITIONAL RESULTS In this section we present additional results and ablations that were not included in Section 4. Normalised kernel matrix evolution for attention-only transformers with skips and normalisa- tion In Fig. 7 we plot the evolution of normalised kernel matrices for transformers with skips and or RMSNorm normalisation, in addition to those for vanilla transformers in Fig. 1. We see that both skipless with RMSNorm (fourth row) and Post-LN (bottom row) converge to rank collapse at larger depths. The degeneration of skipless with RMSNorm is expected from the results of (Dong et al., 2021), and while the convergence to rank collapse is slower for Post-LN, it is still expected (Hayou et al., 2021; Noci et al., 2022). This is because the residual and shortcut branches are effectively given a constant weighting at all blocks in Post-LN, even as the network's depth increases. On the other hand, Pre-LN observes sensible signal propagation even at depth 100, as the position- ing of the LN in the residual branch effectively downweights the residual branch at later blocks (De & Smith, 2020). Likewise, Pre-LN with skip weight α = 0.98 also observes faithful signal propagation, because each block is effectively downweighted. This effect means that standard Pre- LN's (fifth row) kernel matrix increases elementwise faster with depth than Pre-LN with normalised skips (sixth row), despite both kernel matrices being qualitatively similar at block 100. Note, all methods besides our SPA methods used ALiBi positional encoder (Press et al., 2022) (detailed in Appendix H.2) and we observe both Pre-LN kernel matrices also have a recency bias, like our main method, E-SPA (third row). Validation perplexity across different skipless methods In Table 1 we compared the training speeds for our skipless methods, and found that E-SPA outperforms both U-SPA and Value-Skipinit. In particular, we found E-SPA with a DKS-transformed GeLU activation without LN to perform best. In Table 4, we present the corresponding results but for validation perplexity. Again, we see that E-SPA is the best performing of our attention modifications, but in this case TAT with Leaky ReLU and no LN matches or outperforms DKS with GeLU. Sensitivity to query-key initialisation scale Recall in Section 3.3 that for attention layers using 1√ dk XWQ(XWK)(cid:62), is zero SPA we seek to initialise weights such that the query-key dot product, or small at initialisation. In our main experiments, we achieve this by initialising WQ = 0, and letting WK to be initialised as normal. In Fig. 8, we assess the sensitivity of our E-SPA scheme to the scale of non-zero attention dot product, when WK, WQ are both orthogonally initialised but with scale σ (i.e. at each layer, both WK, WQ are initialised as two independent uniform 21 Published as a conference paper at ICLR 2023 Figure 7: Equivalent of Fig. 1 but with four additional configurations for Transformers: 1) Skipless+LN; 2) 1 − α2; and 4) Post-LN. All rows except our Pre-LN; 3) Pre-LN with normalised skips α = 0.98 and β = SPA methods (i.e all rows except second and third) use pre-softmax bias matrices from the ALiBi (Press et al., 2022) positional encoding to compute attention matrices, assuming zero query-key dot product. √ 22 020406080Standard vanillaLayer 1Layer 5Layer 10Layer 20Layer 50Layer 100020406080Uniform SPA020406080Exponential SPA020406080Skipless+LN020406080Pre-LN020406080Pre-LN with skipweight=0.98020406080020406080Post-LN0204060800204060800204060800204060800204060800.00.20.40.60.81.0Cosine similarity Published as a conference paper at ICLR 2023 orthgonal matrices multiplied by σ). We see that for small initialisation scales, there is little effect of varying initial scale, but that training performance degrades at larger scales, when our attention matrix reverse engineering in Section 3.3 (which expects small or zero query-key dot product at initialisation) is less precise. Figure 8: The sensitivity of training performance to the initialisation scale σ of WQ and WK using vanilla E-SPA. Mean and error bars are over 3 seeds. Ablation over orthogonal initialisation Recall in Section 3 that our kernel matrix evolution for attention-only transformers is exact at finite widths using orthogonally initialised weight matrices, and will be approximate using standard (Gaussian) fan-in initialised In Fig. 9, we ablate over us- ing orthogonally initialised weight matrices, compared to Gaussian fan-in initialisation. Across activations, we see that E-SPA with orthogonal initialisation slightly outperforms Gaussian fan-in initialisation (by around 0.15 train loss). Figure 9: Ablation over using orthogonal parameter initialisations, compared to standard Gaussian fan-in, for our main method E-SPA on vanilla transformers over a range of activation functions. We see that orthogonal intialisation leads to a small improvement in training speed. Curves denote mean over 3 seeds 23 0.00010.0010.010.11Query & Key init scale 2.702.752.802.852.902.953.003.053.10WT103 Train losszero query weight init (100k)0K20K40K60K80K100KTraining step2.83.03.23.43.63.84.04.2WT103 Train lossDKS-GeLU,orth=FalseDKS-GeLU,orth=TrueTAT-LReLU,orth=FalseTAT-LReLU,orth=TrueGeLU,orth=FalseGeLU,orth=True Published as a conference paper at ICLR 2023 Ablation over positional encodings As noted in Appendix E, our methods are compatible with several standard positional encodings, and by default all our experiments use the popular RoPE (Su et al., 2021) positional encoding. In Fig. 10 and Table 5, we assess the effect of removing positional encodings, on training and validation performance respectively, in our skipless methods. We see that all methods are improved when combined with RoPE, however the improvement is most mild in E-SPA, which as discussed has an in-built recency bias akin to a positional encoder. Moreover, E- SPA without additional positional encoding still outperforms all other approaches, including U-SPA (which on its own has no notion of position) with RoPE. Table 5: Validation perplexity equivalent of Fig. 10 Attention PosEnc With LN Without LN E-SPA U-SPA None RoPE None RoPE V-SkipInit None RoPE 22.4±.1 21.0±.1 34.7±1.2 24.1±.3 29.3±.1 24.7±.1 22.1±.2 20.0±.3 28.1±.4 23.2±.3 34.4±.1 27.5±.1 Figure 10: Ablation over positional encoding using a vanilla transformer with E-SPA, averaged over 3 random seeds. Stable residual connection (Hayou et al., 2021; Noci et al., 2022) on WikiText-103 In Fig. 11, we provide an equivalent plot to Fig. 3 using a Stable ResNet (Hayou et al., 2021) rescaling of the shortcut weights (α = 1, β = O( 1√ )). In this case, the shortcut weight is always 1 and the L residual weight β is uniform across blocks and scales as O( 1√ ) in depth L. Hayou et al. (2021) L showed that such a scaling leads to non-degenerate signal propagation in large depth MLPs/CNNs without normalisation, and Noci et al. (2022) showed that the stable scaling prevents rank collapse in transformers without normalisation. We see in Fig. 11 that for large enough β, the stable residual weighting with normalisation matches the training speed of the default transformer (which is unsur- prising given that once β = 1 it is exactly default Pre-LN). However, there is a small but consistent gap without normalisation (with optimal β = 0.1). Here, L = 36, so 1√ 6 ≈ 0.17, or alterna- L tively if we count the 72 nonlinear layers (one self-attention and element-wise nonlinearity for each transformer block), we have ≈ 0.12. = 1 1√ 72 24 0K20K40K60K80K100KTraining step3.03.54.04.55.05.56.0WT103 Train losse-spa,posenc=nonee-spa,posenc=ropeu-spa,posenc=noneu-spa,posenc=ropevalue skipinit,posenc=nonevalue skipinit,posenc=rope Published as a conference paper at ICLR 2023 Figure 11: Performance of a Stable (Hayou et al., 2021; Noci et al., 2022) residual connection weighting on WikiText-103 for different residual weights β. Mean over 2 seeds. Different shortcut weights for MLP and self-attention blocks Recall that in a transformer block Eq. (1), there are two distinct skip connections: one for the self-attention block and one for the MLP block. Moreover, we observed a training speed gap when we remove both skip connections in Fig. 2. This leads us to ask if it is possible that only one of the skips, MLP or attention, is causing this gap in training speed. In Fig. 12, we investigate this by varying the MLP shortcut weight for skipless attention blocks (left) and varying the attention shortcut weight for skipless MLP blocks (right). For all skip connections (for both MLP and self-attention blocks), we use a normalised skip connection 1 − α2). We observe that removing either skip connection results in a comparable loss of (β = training speed (the default Pre-LN on WikiText-103 obtained train loss of 1.76 after 100K steps), although having one is still better than having neither. Moreover, we observe that the attention and MLP blocks prefer slightly different shortcut weights, with dense shortcuts performing better on slightly lower weightings (α = 0.9 or 0.97) compared to attention shortcuts (α = 0.98 or 0.99), whereas our experiments in Figs. 3 and 11 use a joint weighting for both. √ Figure 12: Effect of using different shortcut weights for the attention and MLP blocks, trained on WikiText-103 for 100K steps. Mean and standard deviation over 2 seeds. 25 0.010.020.050.10.20.5Residual weight 1.61.82.02.22.42.62.8WT103 Train lossStable Resnet, =1ln=noneln=rmsnormdefault (100k)0.9950.990.980.970.90.70Dense shortcut weight2.42.52.62.72.82.93.0WT103 Train lossNo attn shortcut0.9950.990.980.970.90.70Attn shortcut weightNo dense shortcut Published as a conference paper at ICLR 2023 Training performance on C4 In Fig. 13 we compare the training performance of our various vanilla transfomers to the default Pre-LN transformer on C4. This is akin to Fig. 4a, which compared validation performance. Figure 13: Training performance on C4, equivalent to Fig. 4a Downstream tasks Typically, transformers are pre-trained on a large corpus of data before evalu- ation on a set of downstream tasks. To assess whether our conclusions about training performance in pre-training transfer over to downstream tasks, we assess models trained on C4 on 5 common sense downstream tasks: BoolQ (Clark et al., 2019), HellaSwag (Zellers et al., 2019), Winogrande (Sakaguchi et al., 2020), PIQA (Bisk et al., 2020), and SIQA (Sap et al., 2019). These datasets are commonly used to evaluate large pre-trained transformers (Brown et al., 2020; Rae et al., 2021; Smith et al., 2022; Hoffmann et al., 2022). In Table 6, we see that the conclusions of pre-training on C4 largely carry over to the downstream tasks: • Among transformers trained for the same number of steps (50k), E-SPA beats U-SPA and Value-SkipInit each on 4 out of 5 downstream tasks. However, the default transformer outperforms skipless transformers on all tasks with the same amount of training. • With around 5 times longer training (200K and 300K steps), E-SPA achieves similar per- formance on downstream tasks to the standard transformer, outperforming on 2 out of 5 tasks (Winogrande and PIQA). Table 6: Downstream evaluation of various models (default Pre-LN and also our skipless models) from Figs. 4a and 4b, (pre-)trained on C4. We evaluate zero-shot on 5 common sense tasks: BoolQ, HellaSwag, Winogrande, PIQA, SIQA. In brackets shows the number of steps each model was trained for. Reported values are percentage accuracies: higher is better. Model BoolQ HellaSwag Winogrande PIQA SIQA Default (50K) V-SkipInit (50K) U-SPA (50K) E-SPA (50K) E-SPA (200K) E-SPA (300K) 60.9 38.7 39.2 59.5 60.2 56.8 29.1 25.8 25.8 26.2 27.7 28.4 52.5 51.6 50.9 51.3 52.8 53.0 62.2 56.0 56.7 59.7 63.1 62.5 41.9 39.0 40.6 39.8 40.9 41.1 Longer training on WikiText-103 In Fig. 14 we see that 4.5x more training allows a vanilla E- SPA transformer to match the validation performance of a standard transformer on WikiText-103. This mirrors our findings on C4 in Fig. 4b. 26 0K10K20K30K40K50KTraining step3.03.54.04.55.05.56.06.57.0C4 Train lossskip+LNe-spau-spavalue skipinit Published as a conference paper at ICLR 2023 Figure 14: Longer training on WikiText-103 with E-SPA on a vanilla transformer. It matches the performance of standard transformer after 4.5x more iterations of training. Kernel matrix evolution during training Fig. 15 shows the evolution of the empirically- computed normalized kernel matrix during training of a (finite width) vanilla E-SPA transformer on WikiText-103. The network has depicted has both attention and MLP blocks, which use DKS- transformer GeLU activations. We note that the untrained network shows good agreement with Fig. 1, despite the fact that Fig. 1 is computed for an attention-only network in the infinite width limit. We also note that while significant changes to the kernel matrix occur during training, it retains the property of being larger close the diagonal. H IMPLEMENTATION DETAILS We first describe all additional general implementation details for our experiments, before going into details relevant for individual results. H.1 GENERAL IMPLEMENTATION DETAILS Datasets We present experiments on WikiText-103 (Merity et al., 2017) and C4 (Raffel et al., 2019). For both datasets, we use the SentencePiece tokeniser (Kudo & Richardson, 2018) with vocabulary size |V | = 32, 000. For WikiText-103 we use sequence length of 512 for both training and validation. For C4, the sequence length is 2048 for both. i.i.d.∼ N (0, 1 d0 ). This means that each embedding entry has scale 1 d0 Embedding By default the embedding layer E ∈ R|V |×d0 is fan-out initialised at initialisation, so that Ei,j at initialisation, whereas our Gram matrices (which are dimension normalised) expect each entry to have scale 1 at initiali- sation. To get by this, in our proposed vanilla methods we rescale the embedding matrix by a fixed d0E which is then treated as a lookup table. At initialisation, this has factor of the same effect using RMSNorm on the embedding layer. In all our experiments, the unembedding layer weights are shared with the embedding weights. We do not use the embedding layer positional encoding introduced by Vaswani et al. (2017). d0, so that E ← √ √ In all our experiments apart from Table 3, the model width d = 1024 across all blocks. We Model use 8 head multi-head attention, so that dk = 128. The MLP block consists of a single hidden layer with width 4d, with input and output dimensions both equal to d. All our experiments use the Pre-LN transformer block Eq. (1), rather than Post-LN. On WikiText-103, we use a 36 block transformer by default for all experiments apart from Table 3. On C4, we use a 32 block transformer due to memory constraints. Any normalisation layer we consider is RMSNorm (Zhang & Sennrich, 2019), which is simpler than Layer Normalisation (Ba et al., 2016) and is commonly used in transformers (Rae 27 0K100K200K300K400K500K600KTraining step1.52.02.53.03.54.0WT103 Train loss100k steps200k steps400k steps600k stepsdefault (100k) Published as a conference paper at ICLR 2023 Figure 15: The normalized kernel matrix for various transformer blocks at three different stages of training of a vanilla E-SPA transformer on WikiText-103. Step 0 corresponds to the untrained network. Note that this is computed with an actual finite-width network with randomly sampled (and then trained) parameters, unlike Fig. 1 which corresponds to the infinite-width limit (at initialisation). et al., 2021). By default, our models use RoPE positional encoder (Su et al., 2021) (apart from the ablation in Fig. 10). Parameter initialisations By default, all weight matrices are fan-in initialised N (0, σ2 fan-in ) with σ = 1. The two exceptions for this are: 1) when using orthogonal intiailisation, we use the scaled- corrected uniform orthogonal initialisation (Martens et al., 2021) with scale σ = 1 (which for square matrices is just an orthogonal matrix sampled from the Haar measure Meckes (2019) multiplied by σ), and 2) for the parameter matrix immediately after the activation we set σ to take input activation norm ("q-values" or diagonals of Gram matrices) of 1 to output activation norm of 1. In the latter 28 020406080Step 0Block 0Block 5Block 10Block 15Block 25Block 35020406080Step 200020406080Step 500020406080Step 1000020406080Step 2000020406080Step 5000020406080020406080Step 500000204060800204060800204060800204060800204060800.00.20.40.60.81.0Cosine similarity Published as a conference paper at ICLR 2023 case, σ = 1 by construction for activations transformed by DKS/TAT Martens et al. (2021); Zhang et al. (2022). All bias parameters are initialised to 0. (Transformed) Activations For DKS (Martens et al., 2021) we set slope parameter ξ = 5, and for TAT (Zhang et al., 2022) with leaky ReLU, we set η = 0.9. Both values were chosen by a small hyperparameter sweep on WikiText-103. The DKS and TAT transformations are chosen without consideration of the attention blocks, where the transformer can be viewed as an MLP (potentially with residual connections). Unless stated otherwise, all skipless transformers used a DKS-transformed GeLU as the nonlinearity in the MLP block by default. Loss We perform next-token prediction, with softmax cross entropy loss. More concretely, if XL ∈ RT ×d denotes our final layer representation and E ∈ R|V |×d denotes our embedding layer, then we obtain logits XLE(cid:62) ∈ RT ×|V | for each location for a |V |-way classification. The loss is softmax cross entropy, obtained by using each location i to predict the identity, in |V |, of the token at location i + 1. In our training loss results, we use an exponential moving average with smoothing factor 0.01, to reduce randomness from mini-batching. Optimiser We use Adam optimiser (Kingma & Ba, 2014) with global gradient clipping of 0.1 by default (Pascanu et al., 2013). We do not use weight decay in our experiments. Training We use mini-batching of 16 sequences for WikiText-103 and 8 for C4, due to memory constraints. Unless stated otherwise, we train for 100K steps on WikiText-103 and 50K steps for C4. Learning rate In all experiments we use a linear learning rate warm-up period of 4000 steps which increases from 0 to a maximum value (which is tunable hyperparameter). In the remaining iterations, we use a "one-cycle" cosine learning rate schedule (Loshchilov & Hutter, 2016) which reaches 0 at the final iteration. The maximum learning rate was tuned in {1, 2, 3, 5} × 10−n over n ∈ Z for all experiments. As the embedding layer does not change across the different depths and skip/normalisation settings we considered, we use a different, fixed maximum learning rate for the embedding layer, which was chosen to match the optimal learning rate for the default transformer (2 × 10−4 for WikiText-103 and 5 × 10−4 for C4) and not tuned further. H.2 ADDITIONAL IMPLEMENTATION DETAILS FOR INDIVIDUAL EXPERIMENTS Attention-only kernel matrix evolution: Figs. 1 and 7 We calculate the kernel matrix Σ evolu- tion directly in T × T kernel matrix-space, where T = 100. Our input kernel matrix Σ is sampled assuming a fraction r = 0.02 of repeated tokens, with value of 1 if the token is repeated, and 0 else. For all configurations of skip/normalisation/attention modifications corresponding to a row of Fig. 7, we use 8 heads. We now detail how each operation in any configuration of Fig. 7 affects the kernel matrix. From this it should be possible to reconstruct the kernel evolution for any row in Fig. 7. The 3 possible operations are: 1) attention, 2) skip connection, or 3) LN/RMSNorm operation. 1. Attention Because our SPA methods (second and third rows) are agnostic to the number of heads at initialisation (all attention matrices in a self-attention block are the same across heads at initialisation), we apply Eq. (6) directly, so that a single attention block amounts to Σ ← AΣA(cid:62) for attention matrix A and incoming kernel matrix Σ. Our E-SPA method uses γL = 0.005 and our U-SPA method uses ρL = 0.8. For all other rows, the self-attention operation uses ALiBi (Press et al., 2022), a popular positional encoder which uses head-dependent pre-softmax bias matrices. More specifi- cally, from the default pre-softmax bias matrices given by ALiBi (for 8 heads), we obtain 8 attention matrices {Ah}8 h=1 using the softmax operation (which is exact assuming zero query-key dot product at initialisation). Because the different heads in transformers are typically concatenated along 8 equal size fractions of the total width d, the kernel evolution of an attention block on kernel matrix Σ with 8-head ALiBi corresponds to (Martens et al., 29 Published as a conference paper at ICLR 2023 Table 7: Shortcut and residual weights for Table 2. Weights are presented as (αattn, βattn)/(αMLP, βMLP), where αattn denotes the shortcut weight for attention block and αMLP denotes the shortcut weight for the MLP block. Residual weights β are defined similarly. * denotes that the initial value of a trainable parameter. Attention Skip LN w/o LN 1 − 0.992)/(0.99, 1 − 0.992) √ (1,1)/(1,1) (0.99, (1,0.2)/(1,0.15) (1,0*)/(1,0*) √ √ √ √ – (0.999, (1,0.05)/(1,0.1) (1,0*)/(1,0*) √ (0.98, (0.9975, 1 − 0.982)/(0.99, √ 1 − 0.992) √ 1 − 0.99752)/(0.995, 1 − 0.9952) (0.995, (0.9975, 1 − 0.9952)/(0.995, √ 1 − 0.99752)/(0.99, √ 1 − 0.9952) √ 1 − 0.992) 1 − 0.9992)/(0.99, √ 1 − 0.992) Default Default Normalised Stable (α=1) SkipInit U-SPA E-SPA Normalised Normalised 2021): Σ ← 1 8 8 (cid:88) h=1 AhΣA(cid:62) h 2. For a skip connection with shortcut weight α and residual weight β, if Σattn(Σ) denotes the output of a kernel matrix Σ after an self-attention operation (i.e. from point 1. above), then an incoming kernel matrix Σ gets mapped to: 3. For a normalisation operation, the incoming kernel matrix Σ gets mapped to: Σ ← α2Σ + β2Σattn(Σ). Σ ← diag(Σ)− 1 2 * Σ * diag(Σ)− 1 2 Hyperparameter tuning of skipless transformers For experiments on WikiText-103 with 100K steps, for our U-SPA transformers we tuned ρL ∈ {0.6, 0.8}, and for our E-SPA transformers we tuned γL ∈ {0.005, 0.2}. For all other settings (longer/deeper training on WikiText-103 or any C4 experiment), we used the default γL = 0.005 and ρL = 0.8. All hyperparameters throughout our work are tuned based on training loss. Hyperparameter tuning of transformers with normalised skips All experiments with skip con- nections (i.e. shortcut weight α (cid:54)= 0 for either the MLP or attention block) use untransformed GeLU activation in the MLP blocks. We combine E-SPA with normalised skips as described in Appendix F. We note that for high shortcut weights α and small final decay rate γL, then the value of attention matrix diagonal λα, Eq. (24), may not be real. This is because the input to the square root in Eq. (24) may be negative. To get by this, we tune γL ∈ {0.005, 0.2, 0.4, 0.6} when using a 36 block transformer on WikiText-103 and γL ∈ {0.005, 0.2, 0.4, 0.7, 1} for Table 2, which used a 32 block transformer on C4. the normalised skip connections had separately tuned attention and MLP For Table 2, for self- shortcut weights, as we observed a difference in the optimal shortcut weight in the attention vs MLP blocks in Fig. 12. We tuned the attention shortcut weight range α ∈ {0.98, 0.99, 0.995, 0.9975, 0.999} and the MLP shortcut weight in the range α ∈ {0.98, 0.99, 0.995}. Likewise, both the stable residual weights were tuned in β ∈ {0.05, 0.1, 0.15, 0.2} separately for self-attention and MLP skips. The selected shortcut/residual weights (using validation performance) are presented in Table 7. Depth scaling Due to memory constraints, for our deeper networks in Table 3 we use width d = 512 rather than 1024, with 8 heads to give dk = 64. All depth scaling runs used a DKS-transformed GeLU with ξ = 5. I THEORETICAL RESULTS In this section we state and prove our theoretical results, including Theorems 1 and 2: 30 Published as a conference paper at ICLR 2023 Theorem 1. (Non-negativity for U-SPA) Let Σ=(1 − ρ)IT +ρ11(cid:62) and Σ(cid:48)=(1 − ρ(cid:48))IT +ρ(cid:48)11(cid:62), with respective (positive) Cholesky factors L and L(cid:48). Then if ρ ≤ ρ(cid:48), we have L(cid:48)L−1 is elementwise non-negative. Theorem 2. (Non-negativity for E-SPA) Let matrices (Σ)i,j = exp(−γ|i − j|)) and (Σ(cid:48))i,j = exp(−γ(cid:48)|i − j|)) with respective (positive) Cholesky factors L and L(cid:48). Then if γ ≥ γ(cid:48), we have L(cid:48)L−1 is elementwise non-negative. We prove Theorem 1 second as it is more involved. I.1 PROOF OF THEOREM 2 We actually prove Theorem 2 as a corollary of Theorem 3, which provides the analytic form for L(cid:48)L−1. Theorem 3. Let matrices (Σ)i,j = exp(−γ|i − j|)) and (Σ(cid:48))i,j = exp(−γ(cid:48)|i − j|)) with respective (positive) Cholesky factors L and L(cid:48). Then if γ ≥ γ(cid:48) > 0, we have A = L(cid:48)L−1 takes the following form: Ai,j =    1, a(γ(cid:48)) a(γ) , (cid:2)exp(−γ(cid:48)) − a(γ(cid:48)) a(γ(cid:48)) a(γ) 0 a(γ) exp(−γ)(cid:3)exp(cid:0) − γ(cid:48)(i − j − 1)(cid:1), (cid:2)exp(−γ(cid:48)) − exp(−γ)(cid:3)exp(cid:0) − γ(cid:48)(i − j − 1)(cid:1), i = j = 1 i = j (cid:54)= 1 j = 1, i > j (27) j (cid:54)= 1, i > j if if if if else where a(γ) = (cid:112)1 − exp(−2γ), and likewise a(γ(cid:48)) = (cid:112)1 − exp(−2γ(cid:48)) Proof of Theorem 2. From Theorem 3, we have the analytic form of A. Clearly a(γ), a(γ(cid:48)) are positive, and moreover if γ(cid:48) ≤ γ, then exp(−γ(cid:48)) − exp(−γ) is non-negative. Finally, because a(γ(cid:48)) a(γ) ≤ 1 when γ(cid:48) ≤ γ, then exp(−γ(cid:48)) − a(γ(cid:48)) a(γ) exp(−γ) is non-negative too. To prove Theorem 3, we first compute what the analytic form of Cholesky factor L for (Σ)i,j = exp(−γ|i − j|)) takes in Lemma 1. Lemma 1. Let (Σ)i,j = exp(−γ|i − j|)) with (positive) Cholesky factors L such that LL(cid:62) = Σ. Then, we have: Li,j =    exp(−γ|j − i|), (cid:112)1 − exp(−2γ)exp(−γ|j − i|), 0 if if else j = 1, i ≥ j j (cid:54)= 1, i ≥ j (28) Proof of Lemma 1. It is clear that Σ is positive semi definite, as it is the covariance matrix of a stationary Ornstein-Uhlenbeck process, hence a Cholesky factor must exist. We now show that it is L, Eq. (28). If we define l = min(m, n), then we have: (LL(cid:62))m,n = Lm,1Ln,1 + l (cid:88) i=2 Lm,iLn,i = exp(−γ(m + n − 2)) + (1 − exp(−2γ)) l (cid:88) i=2 exp(−γ(m + n − 2i)) = exp(−γ(m + n − 2))(cid:2)1 + (cid:0)1 − exp(−2γ)(cid:1) l−1 (cid:88) i=1 exp(2γi)(cid:3) = exp(−γ(m + n − 2))(cid:2)1 + (cid:0)1 − exp(−2γ)(cid:1)exp(2γ) 1 − exp(2γ(l − 1)) 1 − exp(2γ) (cid:3) 31 Published as a conference paper at ICLR 2023 = exp(−γ(m + n − 2))(cid:2)1 − (cid:0)1 − exp(2γ(l − 1))(cid:1)(cid:3) = exp(−γ(m + n − 2l)) = exp(−γ|m − n|) = Σm,n By the uniqueness of (positive) Cholesky factors, the proof is complete. Proof of Theorem 3. We want to show (AL)k,l = (L(cid:48))k,l, ∀k, l. This is clearly true for the top diagonal k = l = 1. We now show this for the rest of the first column, when l = 1, k > 1: (AL)k,1 =Ak,1 + Ak,kLk,1 + k−1 (cid:88) i=2 Ak,iLi,1 =(cid:2)exp(−γ(cid:48)) − a(γ(cid:48)) a(γ) exp(−γ)(cid:3)exp(cid:0) − γ(cid:48)(k − 2)(cid:1) exp(−γ(k − 1)) + + a(γ(cid:48)) a(γ) k−1 (cid:88) i=2 a(γ(cid:48)) a(γ) (cid:2)exp(−γ(cid:48)) − exp(−γ)(cid:3)exp(cid:0) − γ(cid:48)(k − i − 1)(cid:1)exp(−γ(i − 1)) (29) Applying the geometric sum to Eq. (29) yields: (AL)k,1 =(cid:2)exp(−γ(cid:48)) − a(γ(cid:48)) a(γ) exp(−γ)(cid:3)exp(cid:0) − γ(cid:48)(k − 2)(cid:1) + + a(γ(cid:48)) a(γ) a(γ(cid:48)) a(γ) exp(−γ(k − 1)) (cid:20) exp(−γ(cid:48)) − exp(−γ)(cid:3)exp(cid:0) − γ(cid:48)(k − 3) − γ(cid:1) 1 − exp((k − 2)(γ(cid:48) − γ)) 1 − exp(γ(cid:48) − γ) (cid:21) =exp(−γ(cid:48)(k − 1)) + a(γ(cid:48)) a(γ) (cid:2)−exp(cid:0) − γ(cid:48)(k − 2) − γ(cid:1) + exp(−γ(k − 1)) + exp(cid:0) − γ(cid:48)(k − 3) − γ(cid:1)exp(−γ(cid:48))(cid:0)1 − exp(cid:0)(k − 2)(γ(cid:48) − γ)(cid:1)(cid:1)(cid:3) =exp(−γ(cid:48)(k − 1)) + a(γ(cid:48)) a(γ) (cid:2)−exp(cid:0) − γ(cid:48)(k − 2) − γ(cid:1) + exp(−γ(k − 1)) + exp(cid:0) − γ(cid:48)(k − 2) − γ(cid:1)(cid:0)1 − exp(cid:0)(k − 2)(γ(cid:48) − γ)(cid:1)(cid:1)(cid:3) =exp(−γ(cid:48)(k − 1)) + a(γ(cid:48)) a(γ) (cid:2)−exp(cid:0) − γ(cid:48)(k − 2) − γ(cid:1) + exp(cid:0) − γ(cid:48)(k − 2) − γ(cid:1) + exp(−γ(k − 1)) − exp(−γ(k − 1))] =exp(−γ(cid:48)(k − 1)) =L(cid:48) k,1 as desired. Likewise, if l > 1, l ≤ k: (AL)k,l =Ak,kLk,l + k−1 (cid:88) i=l Ak,iLi,l 32 Published as a conference paper at ICLR 2023 (cid:34) =a(γ(cid:48)) exp(−γ(k − l) + k−1 (cid:88) i=l (cid:2)exp(−γ(cid:48)) − exp(−γ)(cid:3)exp(cid:0) − γ(cid:48)(k − i − 1)(cid:1)exp(−γ(i − l)) (cid:35) =a(γ(cid:48)) =a(γ(cid:48)) (cid:20) exp(−γ(k − l) + (cid:2)exp(−γ(cid:48)) − exp(−γ)(cid:3)exp(cid:0) − γ(cid:48)(k − l − 1)(cid:1) 1 − exp((γ(cid:48) − γ)(k − l)) (cid:20) exp(−γ(k − l) + exp(−γ(cid:48))exp(cid:0) − γ(cid:48)(k − l − 1)(cid:1)(cid:0)1 − exp(cid:0)(γ(cid:48) − γ)(k − l)(cid:1)(cid:1) 1 − exp(γ(cid:48) − γ) (cid:21) (cid:21) =a(γ(cid:48)) (cid:20) exp(−γ(k − l) + exp(cid:0) − γ(cid:48)(k − l)(cid:1)(cid:0)1 − exp(cid:0)(γ(cid:48) − γ)(k − l)(cid:1)(cid:1) (cid:21) =a(γ(cid:48)) (cid:20) exp(cid:0) − γ(cid:48)(k − l)(cid:1) + exp(cid:0) − γ(k − l)(cid:1) − exp(cid:0) − γ(k − l)(cid:1) (cid:21) =a(γ(cid:48))exp(cid:0) − γ(cid:48)(k − l)(cid:1) =L(cid:48) k,l 33 Published as a conference paper at ICLR 2023 I.2 PROOF OF THEOREM 1 Theorem 1. (Non-negativity for U-SPA) Let Σ=(1 − ρ)IT +ρ11(cid:62) and Σ(cid:48)=(1 − ρ(cid:48))IT +ρ(cid:48)11(cid:62), with respective (positive) Cholesky factors L and L(cid:48). Then if ρ ≤ ρ(cid:48), we have L(cid:48)L−1 is elementwise non-negative. I.2.1 PRELIMINARIES Before diving into the actual proof of the theorem we will derive several useful properties and notations. First we make a slight notational change from the main text of the theorem by replacing Σ, which depends on ρ, with Cn(x), where n represents the size of the matrix, while x replaces ρ. In addition, since the case of ρ = ρ(cid:48) (or x = y in the rest of the proof) is trivial, since then the resulting matrix is the identity, we will restrict ourselves to dealing with the case where 0 < x < y < 1. In any of the mathematical derivations we will denote with capital English letters (e.g. A, B, C, T ) any temporary expressions, that will be expanded on the following lines. Note that these are never general definitions, so they might be used multiple times for different expressions. We will denote vectors and vector functions in bold and scalars and scalar function in standard font. Let 1n be the n-dimensional vector with only ones: (cid:34) 1 . . . 1 1n = (cid:35) ∈ Rn We will denote with xn the n-dimensional vector with only x's: First, we define the linear map pn(x) as: xn = x1n pn(x) = nx + 1 Proposition 1. The vector 1n is an eigenvector of Cn(x) with an eigenvalue pn−1(x). Proof. Directly calculating the k-th entry of the product Cn(x)1n gives: [Cn(x)1n]k = (cid:80)n which directly implies that: i=1[Cn(x)]k,i = (cid:80)n i )x = 1 + (n − 1)x i + (1 − δk i=1 δk Cn(x)1n = pn−1(x)1n. Corollary 1. The vector 1n is an eigenvector of Cn(x)−1 with an eigenvalue Corollary 2. Cn(x)−1xn = 1 1 pn−1(x) . Corollary 3. xT n Cn(x)−1xn = nx2 pn−1(x) xn. pn−1(x) . Further we define the following useful functions: nx2 1 + (n − 1)x n Cn(x)−1xn = 1 − dn(x) = 1 − xT = 1 + nx − x − nx2 1 + (n − 1)x = (1 − x)(nx + 1) 1 + (n − 1)x = (1 − x) pn(x) pn−1(x) . rn(x) = (cid:112)dn(x)pn−1(x) = (cid:112)(1 − x)pn(x)pn−1(x) = (cid:112)dn(x) ⇒ rn(x) pn−1(x) rn(x) (cid:112)dn(x) ⇒ = pn−1(x) Definition 1. The function vn : I[0, 1] × I[0, 1] → Rn maps the two bounded scalars x and y to the vector: vn(x, y) = Ln(x)−T Ln(y)−1yn − 34 (cid:115) dn(y) dn(x) Cn(x)−1xn. Published as a conference paper at ICLR 2023 I.2.2 LEMMAS Lemma 2. If 0 < x < y < 1 then all entries of the vector vn(x, y) are non-negative - [vn(x, y)]i (cid:62) 0. Lemma 3. If 0 < x < y < 1 then the function gn(x, y) = y(1−y)pn−1(x) non-negative. (cid:113) dn+1(y) dn+1(x) rn(x)rn(y) − x pn(x) is Lemma 4. If 0 < x < y < 1 then the function fn(x, y) = xy(1−y) (cid:113) dn(y) dn(x) pn−1(x) is negative. rn(x)rn(y) + x (cid:113) dn+1(y) dn+1(x) x pn(x) − Definition 2. The partial sum the functions fn(x, y) from k+1 to n−1 will be denote by hn (cid:80)n−1 i=k+1 fi(x, y), which from Lemma 4 follow are always negative. k (x, y) = I.2.3 MAIN PROOF The theorem is proven by induction. First for n = 1 we have that C1(x) = C1(y) = [1], which implies that L1(x) = L1(y) = [1] and the condition is trivially satisfied. Now assuming that the statement is true for all integers up to n, we will prove that it also holds for n + 1: A = xT n Cn(x)−1xn + dn(x) = 1 Cn+1(x) = Ln+1(x) = Ln+1(x)Ln+1(x)T = = (cid:21) (cid:20) (cid:20) Cn(x) xn xT 1 n Ln(x) n Ln(x)−T (cid:112)dn(x) xT Ln(x) n Ln(x)−T (cid:112)dn(x) xT (cid:21) 0n 0n (cid:20) (cid:21) (cid:21) (cid:20) Ln(x)T Ln(x)−1xn (cid:112)dn(x) 0T n (cid:21) (cid:20) Ln(x)Ln(x)T xn xT A n n Ln(x)−T Ln(x)−1xn + dn(x) = xT (cid:34) Ln(x)−1 0n 1√ − 1 rn(x) xT (cid:35) n dn(x) Ln(x) n Ln(x)−T (cid:112)dn(x) xT 0n (cid:21) (cid:34) Ln(x)−1 − 1 rn(x) xT n In xT n Ln(x)−T Ln(x)−1 − In n Cn(x)−1 − 1 xT Ln(y) n Ln(y)−T (cid:112)dn(y) yT pn−1(x) xT 0n 0n 1 (cid:20) In 0T n n √ dn(x) rn(x) xT (cid:21) 0n 1 (cid:21) (cid:34) Ln(x)−1 − 1 rn(x) xT = n n (cid:35) 0n 1√ dn(x) (cid:35) (cid:21) 0n 1 (cid:35) 0n 1√ dn(x) Ln(y)Ln(x)−1 n Ln(y)−T Ln(x)−1 − yT (cid:34) Ln(y)Ln(x)−1 vn(x, y)T 0n (cid:113) dn(y) dn(x) (cid:113) dn(y) dn(x) (cid:35) (cid:35) 0n (cid:113) dn(y) dn(x) 1 pn−1(x) xT n Ln+1(x)−1 = Ln+1(x)Ln+1(x)−1 = = = Ln+1(y)Ln+1(x)−1 = = = (cid:20) (cid:34) (cid:20) (cid:20) (cid:34) Using the fact that Ln(y)Ln(x)−1 is a lower triangular and non-negative matrix by the inductive assumption combined with Lemma 2 and the fact that dn(x) (cid:62) 0 it follows that Ln+1(y)Ln+1(x)−1 is also a lower triangular non-negative matrix. 35 Published as a conference paper at ICLR 2023 I.2.4 PROOF OF LEMMA 2 First we will inspect the evolution of vn(x, y) as we increase n: vn+1(x, y) = Ln+1(x)−T Ln+1(y)−1yn+1 − (cid:115) dn+1(y) dn+1(x) Cn+1(x)−1xn+1 (cid:115) = A − dn+1(y) dn+1(x) 1 pn(x) xn+1 A = Ln+1(x)−T Ln+1(y)−1yn+1 (cid:34) Ln(x)−1 − 1 rn(x) xn 1√ = 0T n dn(x) (cid:34) Ln(x)−1 − 1 rn(x) xn 1√ 0T n dn(x) (cid:35) (cid:34) Ln(y)−1 − 1 rn(y) yT Ln(y)−1yn rn(y) + y√ − ny2 (cid:35) (cid:34) n 0n 1√ dn+1(y) (cid:35) dn(y) (cid:35) yn+1   Ln(x)−1 − √ 0T n 1 dn(x)pn−1(x) 1√ dn(x) xn   (cid:20) Ln(y)−1yn B rn(y) (cid:21) B = ypn−1(y) − ny2 = y((n − 1)y + 1) − ny2 = y − y2 = y(1 − y) (cid:35) (cid:34) (cid:35) A = (cid:34) Ln(x)−1 − 1 rn(x) xn 1√ 0T n Ln(y)−1yn y(1−y) rn(y) dn(x) Ln(x)−1Ln(y)−1yn − y(1−y) rn(x)rn(y) xn   √ y(1−y) dn(x)rn(y) (cid:35) B y(1−y) dn(x)rn(y) √ = =   (cid:34) = = B = Ln(x)−1Ln(y)−1yn − y(1 − y) rn(x)rn(y) xn = vn(x, y) + (cid:115) dn(y) dn(x) Cn(x)−1xn − y(1 − y) rn(x)rn(y) xn = vn(x, y) − y(1 − y) rn(x)rn(y) xn +   A = vn(x, y) − y(1−y) rn(x)rn(y) xn + y(1−y)pn−1(x) rn(x)rn(y) (cid:115) dn(y) dn(x) (cid:113) dn(y) dn(x) 1 pn−1(x) xn 1 pn−1(x) xn   vn+1(x, y) = A −   (cid:113) dn+1(y) dn+1(x) (cid:113) dn+1(y) dn+1(x) 1 pn(x) xn x pn(x) (cid:16) y(1−y)     = vn(x, y) − rn(x)rn(y) + (cid:113) dn+1(y) dn+1(x) y(1−y)pn−1(x) rn(x)rn(y) − 1 pn(x) − (cid:113) dn+1(y) dn+1(x) x pn(x) (cid:113) dn(y) dn(x) 1 pn−1(x) (cid:17) xn   Using the definition of from Lemma 3, Lemma 4 and Definition 2 we have that: v1 = [g0]T v2 = [g0 − f1, g1]T v3 = [g0 − f1 − f2, g1 − f2, g2]T . . . 36 Published as a conference paper at ICLR 2023 (cid:34) vn = g0 − n−1 (cid:88) fi, g1 − n−1 (cid:88) i=2 fi, . . . , gk − (cid:35)T fi, . . . n−1 (cid:88) i=k+1 = [g0 − hn i=1 0 , g1 − hn 1 , . . . , gk − hn k , . . .]T Or in other words we have that: [vn(x, y)]k = gk(x, y) − hn k (x, y) Thus proving the lemma reduces to proving that: gk(x, y) − hn k (x, y) (cid:62) 0 ∀k, n Expanding on the equation that we need to prove is positive: Ln k (x, y) = gk(x, y) − hn+1 k (x, y) = gk(x, y) − n (cid:88) i=k+1 fi(x, y) x pk(x) dk+1(y) dk+1(x) (cid:115) di+1(y) di+1(x) (cid:115) x pi(x) − di(y) di(x) x pi−1(x) (cid:33) xy(1 − y) ri(x)ri(y) (cid:115) di+1(y) di+1(x) − B x pi(x) − (cid:115) n (cid:88) i=k+1 di(y) di(x) x pi−1(x) + n (cid:88) i=k+1 n (cid:88) i=k+1 di+1(y) di+1(x) (cid:115) x pi(x) − n−1 (cid:88) i=k di+1(y) di+1(x) x pi(x) = (cid:115) − y(1 − y)pk−1(x) rk(x)rk(y) (cid:32) n (cid:88) − i=k+1 xy(1 − y) ri(x)ri(y) = y(1 − y)pk−1(x) rk(x)rk(y) − (cid:115) B = x pk(x) + dk+1(y) dk+1(x) (cid:115) n (cid:88) i=k (cid:115) = = dn+1(y) dn+1(x) x pn(x) Ln k (x, y) = y(1 − y)pk−1(x) rk(x)rk(y) − n (cid:88) i=k+1 xy(1 − y) ri(x)ri(y) − (cid:115) dn+1(y) dn+1(x) x pn(x) Now we turn our attention to the sum in the middle: n (cid:88) B = i=k+1 xy(1 − y) ri(x)ri(y) = xy(1 − y) n (cid:88) i=k+1 1 ri(x)ri(y) Using Cacuhy − Schwartz inequality : (cid:33)2 (cid:32) n (cid:88) i=k+1 (cid:112)(1 − x)(1 − y) ri(x)ri(y) = xy (cid:114) 1 − y 1 − x n (cid:88) i=k+1 (cid:112)(1 − x)(1 − y) ri(x)ri(y) (cid:32) n (cid:88) (cid:54) i=k+1 1 − x ri(x)2 (cid:33) (cid:32) n (cid:88) i=k+1 (cid:33) 1 − y ri(y)2 Let's define the partial sum in the brackets as: I n k (x) = n (cid:88) i=k 1 − x ri(x)2 = n (cid:88) i=k 1 − x (1 − x)pi(x)pi−1(x) = n (cid:88) i=k 1 pi(x)pi−1(x) We will prove by induction that: I n k (x) = n − k + 1 pk−1(x)pn(x) 37 Published as a conference paper at ICLR 2023 First for n = k, we have that I n Assuming this is true for n, we will now show it holds for n + 1: n (x) = 1 pn(x)pn−1(x) which clearly satisfies the above equation. I n+1 k (x) = n+1 (cid:88) i=k 1 pn(x)pn−1(x) = I n k (x) + 1 pn(x)pn+1(x) = = = = = + n − k + 1 1 pk−1(x)pn(x) pn(x)pn+1(x) pn+1(x)(n − k + 1) − pk−1(x) pk−1(x)pn(x)pn+1(x) = ((n + 1)x + 1)(n − k + 1) + ((k − 1)x + 1) pk−1(x)pn(x)pn+1(x) x(n2 − nk + n + n − k + 1 + k − 1) + n − k + 1 + 1 pk−1(x)pn(x)pn+1(x) x(n2 − nk + 2n) + n − k + 2 pk−1(x)pn(x)pn+1(x) = xn(n − k + 2) + n − k + 2 pk−1(x)pn(x)pn+1(x) (n − k + 2)(nx + 1) pk−1(x)pn(x)pn+1(x) = n − k + 2 pk−1(x)pn+1(x) Which concludes the proof. This now means that: B (cid:54) xy (cid:113) (cid:113) 1−y 1−x k+1(x)I n I n k+1(y) = xy (cid:115) (cid:114) 1 − y 1 − x (n − k)2 pk(x)pn(x)pk(y)pn(y) Thus we can conclude that k (x, y) (cid:62) y(1 − y)pk−1(x) Ln rk(x)rk(y) − xy (cid:115) (cid:114) 1 − y 1 − x (n − k)2 pk(x)pn(x)pk(y)pn(y) − (cid:115) dn+1(y) dn+1(x) x pn(x) From the fact that hn need to show that for any fixed x and y L∞ k (x, y) (cid:62) 0 it impliest that Ln k (x, y) is positive. k is a decreasing function of n, hence to we only For this, we need to take the limit of the second and third term in the above equation. (cid:115) (cid:115) A = lim n→∞ = lim n→∞ dn+1(y) dn+1(x) x pn(x) = lim n→∞ (cid:118) (cid:117) (cid:117) (cid:116) (1 − y) pn+1(y) pn(y) (1 − x) pn+1(x) pn(x) x pn(x) x2(1 − y)pn+1(y) (1 − x)pn+1(x)pn(x)pn(y) (cid:115) x2(1 − y) (1 − x) (cid:115) lim n→∞ = pn+1(y) pn+1(x)pn(x)pn(y) = 0 where the last line is true since the denominator is of higher degree in n. Taking the limit of the second term corresponds to computing the limit: A = lim n→∞ n − k pn(x) = imn→∞ n − k nx + 1 = 1 x Hence, this means that: k (x, y) (cid:62) y(1 − y)pk−1(x) L∞ rk(x)rk(y) − xy (cid:115) (cid:114) 1 − y 1 − x 1 pk(x)pk(y)xy = = y y(1 − y)pk−1(x) (cid:112)(1 − x)pk(x)pk−1(x)(1 − y)pk(y)pk−1(y) (cid:112)pk−1(x) (cid:114) 1 − y (cid:112)pk(x)pk(y)pk−1(y) 1 − x (cid:114) 1 − y 1 − x xy √ − (cid:115) 1 pk(x)pk(y) √ xy − (cid:115) (cid:114) 1 − y 1 − x 1 pk(x)pk(y) 38 Published as a conference paper at ICLR 2023 (cid:115) √ y (cid:114) 1 − y 1 − x = 1 pk(x)pk(y)pk−1(y) (cid:16)(cid:112)ypk−1(x) − (cid:112)xpk−1(y) (cid:17) A = ypk−1(x) − xpk−1(y) = yx(k − 1) + y − xy(k − 1) − x = y − x (cid:62) 0 ⇒ L∞ k (x, y) (cid:62) 0 Note: All of the limits must be taken for fixed x and y (e.g. we can't have them approach 0 or 1 simul- tanously with n). k (x, y) (cid:62) y(1 − y)pk−1(x) Ln rk(x)rk(y) = A − (B + C) (cid:115) (cid:114) 1 − y 1 − x − xy (n − k)2 pk(x)pn(x)pk(y)pn(y) − (cid:115) dn+1(y) dn+1(x) x pn(x) A = y(1 − y)pk−1(x) rk(x)rk(y) = y(1 − y)pk−1(x) (cid:112)(1 − x)pk(x)pk−1(x)(cid:112)(1 − y)pk(y)pk−1(y) = y (cid:114) 1 − y 1 − x (cid:115) C = dn+1(y) dn+1(x) 1 (cid:112)pk(x)pk(y) (cid:118) (cid:117) (cid:117) (cid:116) x pn(x) = (cid:115) pk−1(x) pk−1(y) (1 − y) pn+1(y) pn(y) (1 − x) pn+1(x) pn(x) x pn(x) (cid:115) = x (1 − y)pn+1(y) (1 − x)pn(y)pn(x)pn+1(x) (cid:115) = x (cid:114) 1 − y 1 − x pn+1(y) pn(y)pn(x)pn+1(x) (cid:115) 1 (cid:112)pk(x)pk(y) (cid:32) y 1 (cid:112)pk(x)pk(y) = x (cid:114) 1 − y 1 − x (cid:114) 1 − y 1 − x (cid:114) 1 − y 1 − x A − B − C = = pk(x)pk(y)pn+1(y) pn(x)pn(y)pn+1(x) (cid:115) (cid:115) pk−1(x) pk−1(y) − xy (n − k)2 pn(x)pn(y) (cid:115) − x pk(x)pk(y)pn+1(y) pn(x)pn(y)pn+1(x) (cid:33) A − B − C (cid:112)pk(x)pk(y)pk−1(y)pn(x)pn(y)pn+1(x) A = y(cid:112)pk−1(x)pn(x)pn+1(x)pn(y) B = xy(n − k)(cid:112)pk−1(x)pn+1(x) = x C = x(cid:112)pk(x)pk(y)pk−1(y)pn+1(y) A2 = y2(kx − x + 1)(nx + 1)(ny + 1)(nx + 1) B2 = x2y2(n − k)(kx − x + 1)(nx + x + 1) C 2 = x2(kx + 1)(ky + 1)(ky − y + 1)(ny + y + 1) A = xy (cid:115) B = (cid:115) (cid:114) 1 − y 1 − x (n − k)2 pk(x)pn(x)pk(y)pn(y) + dn+1(y) dn+1(x) x pn(x) = (cid:118) (cid:117) (cid:117) (cid:116) (1 − y) pn+1(y) pn(y) (1 − x) pn+1(x) pn(x) x pn(x) (cid:115) = x (cid:114) 1 − y 1 − x pn+1(y) pn(y)pn(x)pn+1(x) (cid:115) = x √ C = xy (1 − y)pn+1(y) (1 − x)pn(y)pn(x)pn+1(x) (cid:114) 1 − y 1 − x 1 pk(x)pk(y) (cid:115) 39 Published as a conference paper at ICLR 2023 C − A = (cid:115) √ xy (cid:114) 1 − y 1 − x 1 pk(x)pk(y) (cid:32) 1 − (cid:33) √ xy(n − k) (cid:112)pn(x)pn(y) 1 ± R2 = 1 − xy(n − k)2 pn(x)pn(y) = pn(x)pn(y) ± xy(n − k)2 pn(x)pn(y) = n2xy + nx + ny + 1 ± xy(n − k)2 pn(x)pn(y) = xyk(n2 ± (n − k)2) + 1 pn(x)pn(y) (cid:62) 0 (1 − R)2 = 1 + R2 − 2R (C − A)2 − B2 = xy = x 1 − y 1 − x 1 − y 1 − x 1 − y 1 − x xy 1 pk(x)pk(y) xyk(n2 + (n − k)2) + 1 pk(x)pk(y)pn(x)pn(y) 2R pk(x)pk(y) (1 + R2 − 2R) − x2 1 − y 1 − x pn+1(y) pn(y)pn(x)pn+1(x) − x2 1 − y 1 − x pn+1(y) pn(y)pn(x)pn+1(x) − = x 1 − y 1 − x x pn(x)pn(y)pk(x)pk(y)pn+1(x) K = pn+1(x)(yk(n2 + (n − k)2) + 1) − xpn+1(y)pk(x)pk(y) 1 − y 1 − x K − xy 2R pk(x)pk(y) = (nx + x + 1)y(2n2 − 2nk + k2) − x(ny + 1)(kx + 1)(ky + 1) C − (A + B) = √ xy √ xy = (cid:115) (cid:115) (cid:114) 1 − y 1 − x (cid:114) 1 − y 1 − x (A + B)2 = (cid:32) √ x(n − k) + 1 pk(x)pk(y) 1 pk(x)pk(y) (cid:115) (cid:33)2 pn+1(y)pk(x)pk(y) ypn+1(x) (cid:32) 1 − (cid:18) 1 − √ xy(n − k) (cid:112)pn(x)pn(y) (cid:114) x pn(x)pn(y) (cid:115) − xpn+1(y)pk(x)pk(y) ypn(y)pn(x)pn+1(x) (cid:33) (cid:19) (A + B) = x(n − k)2 + pn+1(y)pk(x)pk(y) ypn+1(x) √ + 2 x(n − k) (cid:115) pn+1(y)pk(x)pk(y) ypn+1(x) = 1 − (A + B)2 = E = xy(n − k)2pn+1(x) + pn+1(y)pk(x)pk(y) ypn+1(x) + √ 2 xy(n − k)(cid:112)pn+1(y)pn+1(x)pk(x)pk(y) ypn+1(x) ypn+1(x) − xy(n − k)2pn+1(x) − pn+1(y)pk(x)pk(y) − 2E ypn+1(x) √ xy(n − k)(cid:112)pn+1(y)pn+1(x)pk(x)pk(y) I.2.5 PROOF OF LEMMA 3 From the definition of gn(x, y) and the fact that pn(x) and rn(x) are non-negative functions we can conclude that: gn(x, y) (cid:62) 0 ⇔ (cid:18) y(1 − y)pn−1(x) rn(x)rn(y) (cid:19)2 − (cid:32)(cid:115) dn+1(y) dn+1(x) x pn(x) (cid:33)2 (cid:62) 0 Denoting with A the left hand side of the second equation we have: A = y2(1 − y)2pn−1(x)2 rn(x)2rn(y)2 − dn+1(y) dn+1(x) x2 pn(x)2 40 Published as a conference paper at ICLR 2023 = = = = y2(1 − y)2pn−1(x)2 (1 − x)pn(x)pn−1(x)(1 − y)pn(y)pn−1(y) − (1 − y) pn+1(y) pn(y) (1 − x) pn+1(x) pn(x) x2 pn(x)2 (1 − y)y2pn−1(x) (1 − x)pn(x)pn(y)pn−1(y) − (1 − y)x2pn+1(y) (1 − x)pn+1(x)pn(x)pn(y) (1 − y) (1 − x)pn(x)pn(y) (cid:18) y2pn−1(x) pn−1(y) − x2pn+1(y) pn+1(x) (cid:19) (1 − y)B (1 − x)pn(x)pn(y)pn−1(y)pn+1(x) B = y2pn−1(x)pn+1(x) − x2pn+1(y)pn−1(y) = y2((nx + 1) − x)((nx + 1) + x) − x2((ny + 1) − y)((ny + 1) + y) = y2(nx + 1)2 − y2x2 − x2(ny + 1)2 + x2y2 = (y(nx + 1) + x(ny + 1))(y(nx + 1) − x(ny + 1)) = (2nxy + x + y)(y − x) A = (y − x) (1 − y)(2nxy + x + y) (1 − x)pn(x)pn(y)pn−1(y)pn+1(x) Hence for x (cid:54) y we have that A (cid:62) 0 ⇔ gn(x, y) (cid:62) 0. I.2.6 PROOF OF LEMMA 4 fn(x, y) = xy(1 − y) rn(x)rn(y) First we will prove that C − B (cid:62) 0 + (cid:115) dn+1(y) dn+1(x) x pn(x) − (cid:115) dn(y) dn(x) x pn−1(x) = A + B − C C 2 − B2 = (1 − y) pn(y) pn−1(y) (1 − x) pn(x) pn−1(x) (cid:18) x2 pn(x)2 (1 − y) pn+1(y) pn(y) (1 − x) pn+1(x) pn(x) x2 pn−1(x)2 − pn(y) pn−1(y)pn(x)pn−1(x) 1 pn(x) pn+1(y) pn(y)pn+1(x)pn(x) pn(y)2pn+1(x) − pn+1(y)pn−1(y)pn−1(x) pn−1(x)pn(y)pn−1(y) − (cid:19) = x2 1 − y 1 − x = x2 1 − y 1 − x A = pn(y)2pn+1(x) − pn+1(y)pn−1(y)pn−1(x) = pn(y)2(pn(x) + x) − (pn(x) − x)(pn(y) + y)(pn(y) − y) = pn(y)2pn(x) + xpn(y)2 − (pn(x) − x)(pn(y)2 − y2) = pn(y)2pn(x) + xpn(y)2 − pn(y)2pn(x) + y2pn(x) − xpn(y)2 + xy2 = y2pn(x) + xy2 (cid:62) 0 ⇒ C (cid:62) B With this we can now conclude that fn(x, y) (cid:62) 0 ⇔ A2 − (C − B)2 (cid:62) 0 L = A2 − C 2 − B2 + 2BC 2L1 = A2 − C 2 − B2 (cid:18) = x2y2(1 − y)2 (1 − x)pn(x)pn−1(x)(1 − y)pn(y)pn−1(y) x2 1 − y 1 − x = x2 1 − y 1 − x = x2 1 − y 1 − x y2 pn−1(x)pn(y)pn−1(y) y2 − pn(y)2 pn−1(x)pn(y)pn−1(y) 1 pn(x) 1 pn(x) 1 pn(x) pn(y) pn−1(y)pn−1(x) − − + (cid:18) (cid:18) − (cid:19) pn+1(y) pn(y)pn+1(x) − pn+1(y) pn(y)pn+1(x) (cid:19) pn(y) pn−1(y)pn−1(x) (cid:19) pn+1(y) pn(y)pn+1(x) 41 Published as a conference paper at ICLR 2023 (cid:18) −pn+1(y)pn−1(y) pn−1(x)pn(y)pn−1(y) (cid:18) pn+1(y) pn−1(x)pn(y) + pn+1(y) pn(y)pn+1(x) (cid:19) − pn+1(y) pn(y)pn+1(x) (cid:19) 1 pn(x) 1 pn(x) = x2 1 − y 1 − x = −x2 1 − y 1 − x = −x2 1 − y 1 − x = −x2 1 − y 1 − x = −2x2 1 − y 1 − x ⇒ L (cid:62) 0 ⇔ B2C 2 − L2 1 pn+1(y) pn(x)pn(y) pn+1(y) pn(x)pn(y) pn+1(y) pn(y)pn−1(x)pn+1(x) (cid:62) 0 (pn+1(x) + pn−1(x)) pn−1(x)pn+1(x) (2nx + 2) pn−1(x)pn+1(x) = −2x2 1 − y 1 − x pn+1(y) pn(x)pn(y) pn(x) pn−1(x)pn+1(x) B2C 2 − L2 1 = = = (cid:18) (cid:18) (cid:18) (cid:18) x2 1 − y 1 − x x2 1 − y 1 − x x2 1 − y 1 − x x2 1 − y 1 − x (cid:19)2 (cid:19)2 1 pn(x)2 pn(y)pn+1(y) pn−1(y)pn−1(x)pn(y)pn+1(x) pn+1(y)2 pn(y)2pn−1(x)2pn+1(x)2 − (cid:19)2 (cid:18) (cid:19)2 pn+1(y) pn−1(y)pn−1(x)pn+1(x)pn(x)2 − pn+1(y)D pn−1(y)pn−1(x)2pn+1(x)2pn(x)2pn(y)2 pn+1(y)2 pn(y)2pn−1(x)2pn+1(x)2 (cid:19) D = pn−1(x)pn+1(x)pn(y)2 − pn+1(y)pn−1(y)pn(x)2 = pn(y)2(pn(x)2 − x2) − (pn(y)2 − y2)pn(x)2 = pn(y)2pn(x)2 − x2pn(y)2 − pn(y)2pn(x)2 + y2pn(x)2 = y2pn(x)2 − x2pn(y)2 = y2(nx + 1)2 − x2(ny + 1)2 = nx2y2 + 2nxy2 + y2 − nx2y2 − 2nx2y − x2 = 2nxy(y − x) + (y − x)(y + x) = (y − x)(2nxy + x + y) (cid:62) 0 Hence with this we can conclude that fn(x, y) (cid:62) 0 ∀n. 42
http://arxiv.org/abs/2302.10320v1
2023-02-20T21:18:02
2023-02-20T21:18:02
Meta-World Conditional Neural Processes
We propose Meta-World Conditional Neural Processes (MW-CNP), a conditional world model generator that leverages sample efficiency and scalability of Conditional Neural Processes to enable an agent to sample from its own "hallucination". We intend to reduce the agent's interaction with the target environment at test time as much as possible. To reduce the number of samples required at test time, we first obtain a latent representation of the transition dynamics from a single rollout from the test environment with hidden parameters. Then, we obtain rollouts for few-shot learning by interacting with the "hallucination" generated by the meta-world model. Using the world model representation from MW-CNP, the meta-RL agent can adapt to an unseen target environment with significantly fewer samples collected from the target environment compared to the baselines. We emphasize that the agent does not have access to the task parameters throughout training and testing, and MW-CNP is trained on offline interaction data logged during meta-training.
[ "Suzan Ece Ada", "Emre Ugur" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10320v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10320v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI", "cs.NE", "cs.RO" ]
3 2 0 2 b e F 0 2 ] G L . s c [ 1 v 0 2 3 0 1 . 2 0 3 2 : v i X r a META-WORLD CONDITIONAL NEURAL PROCESSES Suzan Ece Ada, Emre Ugur Department of Computer Engineering Bogazici University Istanbul, Turkey {ece.ada, emre.ugur}@boun.edu.tr ABSTRACT We propose Meta-World Conditional Neural Processes (MW-CNP), a conditional world model generator that leverages sample efficiency and scalability of Conditional Neural Processes to enable an agent to sample from its own "hallucination". We intend to reduce the agent's interaction with the target environment at test time as much as possible. To reduce the number of samples required at test time, we first obtain a latent representation of the transition dynamics from a single rollout from the test environment with hidden parameters. Then, we obtain rollouts for few-shot learning by interacting with the "hallucination" generated by the meta-world model. Using the world model representation from MW-CNP, the meta-RL agent can adapt to an unseen target environment with significantly fewer samples collected from the target environment compared to the baselines. We emphasize that the agent does not have access to the task parameters throughout training and testing, and MW-CNP is trained on offline interaction data logged during meta-training. Keywords Meta-Learning * Deep Reinforcement Learning * Partially Observable Markov Decision Process 1 Introduction Fast adaptation under uncertainty has various applications in the real-world, including autonomous driving, disassembly with manipulation robots, medical diagnosis, and ventilation robots. Because real-world is non-stationary, an agent should be robust to changing environmental dynamics such as failures in the sensors, and actuators [1]. Robustness in these settings requires a diverse set of skills that can be acquired through incremental learning in environments with emergent complexity. In line with this, world model generation has been an integral part of open-ended learning ([2]). Likewise, meta-reinforcement learning [3] is a promising direction for increasing robustness. However, it is bounded by the number of samples collected from the unknown environment. Increasing sample efficiency is paramount for developing systems that can generate fast responses under uncertainty in the real world. Hence, we propose generating world models from the agent's experience to overcome these problems. Research on lifelong learning focuses on learning incrementally and adapting rapidly to unknown tasks from incoming data streams ([4]). Challenges associated with lifelong learning include catastrophic forgetting, negative transfer, and resource limitations. Furthermore, data to be processed after deployment and optimal model hyperparameters are not available a priori. Meta-reinforcement learning is an enduring area of interest that enables fast adaptation in test tasks. Recent works have integrated meta-learning to offline reinforcement learning ([5]) and lifelong learning ([6, 7, 8]). In open-ended learning, a policy with high representational capacity can be utilized for increasingly challenging environments. In this work, we are interested in few-shot learning in settings where the transition dynamics of the environment change across tasks. More specifically, the agent is trained a the distribution of tasks with varying transition dynamics and expected to adapt to an unseen task with few samples from the target environment. Sampling in the real world is expensive; hence reducing the number of samples used for fast adaptation is an important research direction for sim-to-real RL. In this work, we are interested in meta-reinforcement learning settings where the transition function changes across multiple tasks. In particular, each transition function depends on the environment parameters hidden during training and testing. More concretely, imagine a setting where an agent moves to a goal location in different environments parametrized by different force fields. Different force fields push the agent in different directions. Through trial and error, the agent learns to move robustly in environments with different transition dynamics. The agent is required to adapt quickly to a new target environment with hidden environment parameters and reward signals at test time. We propose Meta-World Conditional Neural Processes(MW-CNP) to generate world models from a few samples collected from the target environment. Our contributions include (1) generating and learning world models with no access to target environment parameters, (2) sample efficient, fast adaptation to the unseen test environment (requires only a single rollout from the unseen target environment at test time compared to 25 rollouts used in No Reward Meta-Learning (NORML) ([9]) for finetuning the meta-policy) and (3) utilizing offline datasets of Markov Decision Process(MDP) tuples for training. 2 Related Work Meta Reinforcement Learning Meta-learning provides a framework for learning new tasks more efficiently from limited experience by using knowledge from previously learned tasks[10]. Meta-learning framework has demonstrated promising results in regression, classification, and reinforcement learning [3, 9]. Our work builds on the meta- reinforcement learning (meta-RL) framework, where tasks share a common structure but differ in transition dynamics. The assumption of a common structure allows few-shot learning in the new task. Context-based meta-RL methods assume each task can be represented by a low-dimensional context variable. Prior work on context-based meta-RL learns the task-specific context variable from a set of experiences collected by a control policy. Recurrent models aim to encode the underlying temporal structure of the collected experiences [11]. Similarly, in [12], memory-augmented models like temporal convolutions and soft attention have been used to learn a contextual representation. In an imitation learning setting, expert demonstrations are encoded into a learned context embedding where policy is conditioned on [13]. In Model-Agnostic Meta-Learning (MAML) [3], a gradient-based meta-learning algorithm is used for the aforemen- tioned problems where training and testing tasks are sampled from the distribution. NORML, proposed by [9], is an extension of MAML-RL framework [3] for settings where the environment dynamics change across tasks instead of the reward function. The goal of NORML is to utilize past experience to quickly adapt to tasks with unknown parameters from a few samples with missing reward signals. While these methods have demonstrated promising results, they fall short in sample efficiency in meta-testing. We instead leverage the generalizable conditional neural processes [14] architecture to reduce the number of experience agent needs for adaptation to the target task. Partially Observable Markov Decision Process In Partially Observable Markov Decision Processes (POMDP) state is augmented by a latent variable z that incorporates unobserved information needed to solve the task. In the Context- based meta-RL setting, solving for the POMDPs become analogous to solving for meta-RL MDPs via task-augmented states [15]. VARIBAD uses a recurrent neural network (RNN) architecture to encode posterior over ordered transitions. The posterior belief is used to augment the state variable where the policy is conditioned on. Unlike FOCAL [15] which assumes a deterministic encoder, PEARL [16], ELUE [17], and VARIBAD [18] uses a stochastic encoder. Latter methods train the inference model by optimizing the evidence lower bound (ELBO)[19] objective. Although FOCAL successfully clusters transitions in the latent space using an inverse power loss distance metric learning objective, it assumes the tasks are deterministic. Furthermore, FOCAL assumes there exists a one-to-one function from the transitions to the T × R where T and R denote the task-specific transition function and reward function respectively. Conditional Neural Processes Conditional Neural Processes [14] predict the parameters of a probability distribution conditioned on a permutation invariant prior data and target input. CNPs attempt to represent a family of functions using Bayesian Inference and the high representational capacity of neural networks. Prior approaches have leveraged the robust latent representations obtained by the CNP model in high-dimensional trajectory generation [20], long-horizon multi-modal trajectory prediction [20, 21] and sketch generation tasks [22]. 3 Preliminaries 3.1 Conditional Neural Processes The architecture of CNPs consists of parameter sharing encoders and a decoder named the query network. In particular, first a random number of input and true output pairs (xf i, ytrue ) are sampled from the function f i ∈ F . Each pair is encoded into a latent representation via the encoder networks. Then, average of these representations is obtained for invariance to permutation and the number of inputs. The resulting representation is concatenated with the target input f i 2 query and fed to the query network. The query network outputs the predicted mean and standard deviation for the queried input (xq f i). 3.2 No-Reward Meta Learning Provided that the change in dynamics can be represented in (st, at, st+1), NORML learns an pseudo-advantage function Aψ (st, at, st+1). It is important to note that the aim of Aψ is to guide the meta-policy adaptation instead of fitting to the advantage function. Aψ is used to compute task specific parameters in the MAML inner loop from a set of state transitions of task i denoted as Dtrain that does not contain reward signal. The learned advantage function is optimized in the MAML outer loop using the reward information present in rollouts (Dtest ) obtained from the updated task-specific policy. i i 4 Proposed Method: Meta-World Conditional Neural Process (MW-CNP) In this section, we present our method, named Meta-World Conditional Neural Processes (MW-CNP), for learning world models using prior experience. We first describe the problem setup and then explain MW-CNP's structure in detail. In few-shot learning, the goal is to quickly adapt to an unseen target task using a few labeled data in the target environment. Meta-World Conditional Neural Processes (MW-CNP) can reduce the number of samples required from the target environment by generating world models from fewer samples from the target environment without accessing the target environment parameter. These models can then be used to obtain inexpensive rollouts for finetuning at test time. Online Meta-Learning We denote the initial state distribution as ρ(s0) : S → R, state transition distribution of taski as ρi(st+1|st, at) : S × A × S → R, and the reward function as rt : S × A × S → R. During meta-training we store transitions for each taski as a set of observations Bi = {(st, at, st+1)}n t=0 ⊂ S × A × S without the task parameter. It is important to note that during both training and testing the parameters of the state transition distribution are hidden. After we obtain the meta-policy and learn the pseudo-advantage function denoted by Aψ (st, at, st+1) using NORML, we train our MW-CNP model using the replay buffer of transitions B = {Bi}n i=1 where n denotes the number of environments. Meta-World Conditional Neural Processes (MW-CNP) MW-CNP is trained in an offline fashion using unlabeled batches of Markov Decision Process (MDP) tuples collected during online meta-learning. Figure 1 illustrates the training procedure for MW-CNP. It is worth noting that the environment parameter is hidden during training and testing. In each training iteration, an unlabeled batch Bi = {(st, at, st+1)}n t=0 is randomly sampled from the offline dataset. Then, a set of task-specific MDP tuples {(sk, ak, sk+1)}k and a single MDP (sq, aq, s(cid:48) q) are randomly sampled from the chosen batch Bi. (sq, aq, s(cid:48) q) is used for target state-action query [sq, aq] and true target next state label [s(cid:48) q]. Each MDP tuple (sk, ak, sk+1) is encoded into a fixed size representation using a parameter sharing encoder network. These representations are then passed through an averaging module A to obtain a latent representation r of the hidden environment transition function used in batch Bi. The resulting latent representation r is concatenated with the [sq, aq] to predict the distribution parameters μq, σq of the next state s(cid:48) q given the latent representation r and the target query [sq, aq]. The loss function of MW-CNP can be expressed as (cid:32) μq, σq = fθD [sq, aq] ⊕ (cid:33) gθE (sk, ak, s(cid:48) k) 1 n n (cid:88) k L(θE, θD) = − log P (cid:16) (cid:48)true s q | μq, softplus(σq) (cid:17) where fθD , gθE are the decoder the encoder networks, [sq, aq] is the target state action query, (sk, ak, s(cid:48) randomly sampled transitions from the set of observations Bi. k) are the Figure 2 illustrates the test procedure of MW-CNP. At test-time, the agent is allowed to collect a few samples from the unseen target environment. These samples are encoded into representations of fixed size by an encoder network with shared weights. A shared representation of the target environment is obtained using an averaging module shown in 3 Figure 1: Structure and the training procedure of the MW-CNP Figure 2: Structure and the test procedure of the MW-CNP 4 ass'.........s'sqaqOffline Dataset ass'.........s'sqaqπ(I)(II) Figure 2(I). Once the latent representation is obtained for the target environment with a hidden task parameter rollouts can be generated inexpensively. This representation is used to predict the parameters of the next-state distribution for the state-action query [sq, aq]. For each MW-CNP generated rollout, same true initial state, sampled from the real target environment, is used. The inital state is fed to the stochastic meta-policy to obtain the action query aq Figure 2(II). Then, the predicted next-state is used to sample the next action query until the episode is terminated. The rollouts "hallucinated" from the MW-CNP are combined with the true rollout sampled from the real target environment. The resulting set of rollouts are fed to the pseudo-advantage network. The learned pseudo-advantage network learned during online meta-learning uses (s, a, s(cid:48)) tuple as input and outputs an advantage estimation value. Hence, once experience from the generated world model is collected, these experiences are fed to the learned advantage function in the form of (s, a, s(cid:48)). Finally, meta policy is finetuned for fast adaptation to the target task using the estimated advantage values and combined set of MW-CNP generated rollouts and a single target environment rollout. 5 Experiments In this section, we analyze the performance of our method and compare it with NORML and the oracle in 2D point agents, cartpole with sensor bias, and locomotion tasks. MW-CNP requires significantly less interaction with the target environment compared to NORML, for fast adaptation to the unseen task. 5.1 2D Point Agent with Unknown Artificial Force Field The goal of the point agent, initialized at [x=0,y=0], is to move to the position [x=1,y=0], where x,y are the positions on the 2D plane. We are interested in a meta-RL setting used in [9] where the reward function is identical across multiple tasks. Different tasks are created by generating different artificial force fields that push the agent in different directions (φ). We use the same reward function, the negative Euclidean distance from the goal position, and hyperparameters used in NORML for comparative analysis. In the Point Agent environment, 5000 tasks are defined over the [−π, π] interval. Figure 3: Post-update loss (y-axis) of finetuning over generated data and ground truth data in target tasks. X-axis represents the target task indices. The agent is initially trained across a distribution of 5000 tasks, i.e. in environments with 5000 different force fields. Then, it is tested in an unseen target task. The rollouts obtained from the target environment will be referred to as actual rollouts, whereas the rollouts generated from the MW-CNP will be named hallucinated rollouts. At the test time, Oracle agent uses 25 actual rollouts from the unseen target environment. 25 rollouts were used in the original NORML experiment; hence we use the same number of rollouts for comparison. The NORML agent and the MW-CNP use only a single rollout for fine-tuning the meta-policy. By limiting the number of actual rollouts that can be used for finetuning we aim to compare sample efficiency of MW-CNP to the baseline NORML. The average return obtained from the target environment after finetuning the meta policy of NORML with 1 rollout are shown in Fig. 3 with green bars. As shown, when MW-CNP and NORML used the same amount of actual rollouts (1 actual rollout) 5 from the target environment, MW-CNP outperformed NORML dramatically. Even though the oracle agent trained with NORML used a significantly higher number of actual rollouts sampled from the target environment than MW-CNP (25 to 1), their performances are similar, as shown in illustrations in Figures 4, 5, 6, and the bar plots in 3. Figure 3 shows the expected post update return obtained in the target environment. We compare results for NORML finetuning over 1 rollout, NORML finetuning over 25 rollouts (Oracle), and finetuning over a combination of 24 hallucinated rollouts from the MW-CNP model and 1 actual rollout from the target environment. At test-time, MW-CNP uses a total of 25 mixed rollouts, similar to the oracle NORML, which uses 25 actual rollouts. For a reliable evaluation, we condition the MW-CNP model on the same rollout used for 1-rollout NORML fine-tuning. The results in Table 1 show that the samples generated from the agent's hallucination created by the MW-CNP can be used for finetuning the meta-policy for fast domain adaptation, thereby significantly increasing the sample efficiency in meta-testing. Table 1: 2D Point Agent Environment Post Update Loss MWCNP(ours) NORML ORACLE mean 1.74 ±0.65 12.23 ±7.81 1.15 ±0.59 median 1.75 12.17 0.84 Figure 4: Illustrations of trajectories for Tasks 0, 500, 1000 and 1500 5.2 Cartpole with Unknown Angle Sensor Bias We evaluate our method on the Cartpole with Angle Sensor Bias environment visualized in Figure 7a [9]. Tasks differ by a hidden position sensor drift in the range [−8◦, 8◦]. In meta-training, tasks are sampled from a uniform distribution where the transition dynamics function is parameterized by the aforementioned hidden variable. The state space consists of the position and velocity of the cart and the pole. We empirically found that the rollout length of 1000, used in prior work [9], is not needed for adaptation in meta-testing. Hence to evaluate adaptation performance where a limited 6 Task 0Task 500Task 1000Task 1500NORMLOracleMW-CNP(ours) Figure 5: Illustrations of trajectories for Tasks 2000, 2500, 3000 and 3500 number of transition tuples are available, we compared the performance of MW-CNP to NORML with roll-out lengths of 5 and 50 shown in Figure 8. Notice that the results are not symmetric across meta-tasks. This can be attributed to gradient bias in meta-training [23]. Subsequently, in Figure 8a we observe that this becomes prominent when evaluated with only 5 meta-test samples. Despite that, the meta-policy can successfully adapt to most test tasks using generated samples from the MW-CNP model. 5.3 Walker-2D Randomized Agent Dynamics Parameters In order to explore the sample efficiency of MW-CNP in higher dimensional continuous control tasks, we evaluate our method in the Walker-2D Randomized Agent Dynamics Parameters environment (Walker-2D-Rand-Params)[24] on MuJoCo[25] visualized in Figure 7b. Different locomotion tasks are created by unknown body mass, body inertia, degrees-of-freedom damping, and friction parameters. More specifically, the uniform distribution range used for sampling the latent scaling parameters is [1.5−3, 1.53] for body mass, body inertia, friction parameters and [1.3−3, 1.33] for body inertia. Table 2: Walker-2D-Params Post Update Reward MWCNP(ours) NORML ORACLE mean 1389.43 ±862.32 1217.93 ±810.48 1268.46 ±878.26 median 1115.65 944.86 956.25 We sample 40 tasks for meta-training from a uniform distribution and use 100 unseen tasks for meta-testing. Figure 9 shows the post-update reward in meta-testing, where NORML and MW-CNP use a single rollout, whereas the ORACLE uses 25 rollouts for adaptation. We empirically demonstrate in Table 2 that sample efficiency and meta-test adaptation performance have increased for a large range of unseen tasks. 7 Task 2000Task 2500Task 3000Task 3500NORMLOracleMW-CNP(ours) Figure 6: Illustrations of trajectories for Tasks 4000 and 4500 (a) Cartpole with Unknown Angle Sensor Bias Environment (b) Walker-2D Randomized Agent Dynamics Parame- ters Environment Figure 7: Visualization of meta-test task performance in (a)cartpole , (b)walker environments 8 Task 4000Task 4500NORMLOracleMW-CNP(ours) (a) MWCNP obtained a significantly higher expected post-update reward of 386.44 ± 159.27 compared to NORML (110.11 ± 138.97) using only 5 MDP tuples from the meta-test tasks. (b) Expected post update reward for MWCNP is 447.67 ± 113.97 using only 50 MDP tuples from the meta-test tasks. In contrast, NORML obtained an expected post-update reward of 302.33 ± 159.27, which is still lower than the expected post-update reward of MWCNP finetuned over 5 samples. Figure 8: Post-update reward (y-axis) of finetuning over generated data using (a) 5, (b) 50 target task MDP tuples and ground truth data in target tasks. X-axis represents the target task parameter. 9 Figure 9: Violin plots of post-update reward from 100 meta-test tasks. The violin plots illustrate the data's vertically aligned kernel density plots with clear markers indicating the minimum, maximum, mean, and median. The mean and median are represented by the blue and green lines, respectively. 6 Conclusion We showed that meaningful hallucinated rollouts can be collected using the MW-CNP framework to guide the meta- policy adaptation. We compared the average meta-test performance obtained from finetuning over generated data with MW-CNP and the real simulated environment. MW-CNP's performance closely matched with the ORACLE and in the more complex locomotion task MW-CNP outperformed the ORACLE. MW-CNP model was able to generate samples from a significantly less number of MDP tuples in all our experiments thereby increasing sample efficiency during meta-testing. All in all, we showed that using generated data for meta-updates, not only significantly increases sample efficiency but can also yield superior performance than using actual data. Furthermore, CNPs were shown to perform well with high dimensional inputs like image data ([20]). Extending our work and applying it to high-dimensional sensorimotor spaces, such as manipulator robots that use RGB-D cameras is an interesting research direction we intend to explore. Declaration of Competing Interest The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper. Acknowledgements This work was supported by the Scientific and Technological Research Council of Turkey (TUBITAK, 118E923) and by the BAGEP Award of the Science Academy. The numerical calculations reported in this work were partially performed at TUBITAK ULAKBIM, High Performance and Grid Computing Center (TRUBA resources). References [1] Rafael Figueiredo Prudencio, Marcos R. O. A. Maximo, and Esther Luna Colombini. A survey on offline reinforcement learning: Taxonomy, review, and open problems, 2022. [2] Rui Wang, Joel Lehman, Jeff Clune, and Kenneth O. Stanley. Paired open-ended trailblazer (POET): endlessly generating increasingly complex and diverse learning environments and their solutions. CoRR, abs/1901.01753, 2019. [3] Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In International Conference on Machine Learning, pages 1126–1135. PMLR, 2017. 10 [4] German I. Parisi, Ronald Kemker, Jose L. Part, Christopher Kanan, and Stefan Wermter. Continual lifelong learning with neural networks: A review. Neural Networks, 113:54–71, 2019. [5] Eric Mitchell, Rafael Rafailov, Xue Bin Peng, Sergey Levine, and Chelsea Finn. Offline meta-reinforcement learning with advantage weighting. CoRR, abs/2008.06043, 2020. [6] Chelsea Finn, Aravind Rajeswaran, Sham Kakade, and Sergey Levine. Online meta-learning. In Kamalika Chaudhuri and Ruslan Salakhutdinov, editors, Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pages 1920–1930. PMLR, 09–15 Jun 2019. [7] Anusha Nagabandi, Chelsea Finn, and Sergey Levine. Deep online learning via meta-learning: Continual adaptation for model-based RL. CoRR, abs/1812.07671, 2018. [8] Glen Berseth, Zhiwei Zhang, Grace Zhang, Chelsea Finn, and Sergey Levine. Comps: Continual meta policy search. CoRR, abs/2112.04467, 2021. [9] Yuxiang Yang, Ken Caluwaerts, Atil Iscen, Jie Tan, and Chelsea Finn. Norml: No-reward meta learning. arXiv preprint arXiv:1903.01063, 2019. [10] J. Schmidhuber. Evolutionary principles in self-referential learning, or on learning how to learn: the meta-meta-... hook. Institut für Informatik, Technische Universität München, 1987. [11] Yan Duan, John Schulman, Xi Chen, Peter L. Bartlett, Ilya Sutskever, and Pieter Abbeel. Rl$ˆ2$: Fast reinforce- ment learning via slow reinforcement learning. CoRR, abs/1611.02779, 2016. [12] Nikhil Mishra, Mostafa Rohaninejad, Xi Chen, and Pieter Abbeel. A simple neural attentive meta-learner. In ICLR (Poster). OpenReview.net, 2018. [13] Yan Duan, Marcin Andrychowicz, Bradly C. Stadie, Jonathan Ho, Jonas Schneider, Ilya Sutskever, Pieter Abbeel, and Wojciech Zaremba. One-shot imitation learning. In Isabelle Guyon, Ulrike von Luxburg, Samy Bengio, Hanna M. Wallach, Rob Fergus, S. V. N. Vishwanathan, and Roman Garnett, editors, NIPS, pages 1087–1098, 2017. [14] Marta Garnelo, Dan Rosenbaum, Chris J. Maddison, Tiago Ramalho, David Saxton, Murray Shanahan, Yee Whye Teh, Danilo J. Rezende, and S. M. Ali Eslami. Conditional neural processes. CoRR, abs/1807.01613, 2018. [15] Lanqing Li, Rui Yang, and Dijun Luo. Focal: Efficient fully-offline meta-reinforcement learning via distance metric learning and behavior regularization. In International Conference on Learning Representations, 2020. [16] Kate Rakelly, Aurick Zhou, Chelsea Finn, Sergey Levine, and Deirdre Quillen. Efficient off-policy meta- reinforcement learning via probabilistic context variables. In International conference on machine learning, pages 5331–5340. PMLR, 2019. [17] Takahisa Imagawa, Takuya Hiraoka, and Yoshimasa Tsuruoka. Off-policy meta-reinforcement learning based on feature embedding spaces. CoRR, abs/2101.01883, 2021. [18] Luisa M. Zintgraf, Kyriacos Shiarlis, Maximilian Igl, Sebastian Schulze, Yarin Gal, Katja Hofmann, and Shimon Whiteson. Varibad: A very good method for bayes-adaptive deep RL via meta-learning. CoRR, abs/1910.08348, 2019. [19] Diederik P Kingma and Max Welling. Auto-encoding variational bayes, 2013. [20] Muhammet Yunus Seker, Mert Imre, Justus H Piater, and Emre Ugur. Conditional neural movement primitives. In Robotics: Science and Systems, 2019. [21] M. Yunus Seker, Alper Ahmetoglu, Yukie Nagai, Minoru Asada, Erhan Oztop, and Emre Ugur. Imitation and mirror systems in robots through deep modality blending networks. Neural Networks, 146:22–35, 2022. [22] S. Ece Ada, M. Yunus Seker, and Pinar Yanardag. GAN-CNMP: an interactive generative drawing tool. CoRR, abs/2111.14934, 2021. [23] Bo Liu, Xidong Feng, Jie Ren, Luo Mai, Rui Zhu, Haifeng Zhang, Jun Wang, and Yaodong Yang. A theoretical understanding of gradient bias in meta-reinforcement learning. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho, editors, Advances in Neural Information Processing Systems, 2022. [24] Ignasi Clavera, Anusha Nagabandi, Ronald S Fearing, Pieter Abbeel, Sergey Levine, and Chelsea Finn. Learning to adapt: Meta-learning for model-based control. arXiv preprint arXiv:1803.11347, 2018. [25] Emanuel Todorov, Tom Erez, and Yuval Tassa. Mujoco: A physics engine for model-based control. In Intelligent Robots and Systems (IROS), 2012 IEEE/RSJ International Conference on, pages 5026–5033. IEEE, 2012. 11
http://arxiv.org/abs/2302.10319v2
2023-05-03T01:12:09
2023-02-20T21:14:27
Differentiable Bootstrap Particle Filters for Regime-Switching Models
Differentiable particle filters are an emerging class of particle filtering methods that use neural networks to construct and learn parametric state-space models. In real-world applications, both the state dynamics and measurements can switch between a set of candidate models. For instance, in target tracking, vehicles can idle, move through traffic, or cruise on motorways, and measurements are collected in different geographical or weather conditions. This paper proposes a new differentiable particle filter for regime-switching state-space models. The method can learn a set of unknown candidate dynamic and measurement models and track the state posteriors. We evaluate the performance of the novel algorithm in relevant models, showing its great performance compared to other competitive algorithms.
[ "Wenhan Li", "Xiongjie Chen", "Wenwu Wang", "Víctor Elvira", "Yunpeng Li" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10319v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10319v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "eess.SP", "@scheme": "http://arxiv.org/schemas/atom" }
[ "eess.SP", "cs.LG" ]
3 2 0 2 y a M 3 ] P S . s s e e [ 2 v 9 1 3 0 1 . 2 0 3 2 : v i X r a Differentiable Bootstrap Particle Filters for Regime-Switching Models Wenhan Li Department of Computer Science University of Surrey Guildford, UK [email protected] Xiongjie Chen Department of Computer Science University of Surrey Guildford, UK [email protected] Wenwu Wang Centre for Vision, Speech and Signal Processing University of Surrey Guildford, UK [email protected] V ́ıctor Elvira School of Mathematics University of Edinburgh Edinburgh, UK [email protected] Yunpeng Li Department of Computer Science University of Surrey Guildford, UK [email protected] Abstract-Differentiable particle filters are an emerging class of particle filtering methods that use neural networks to con- struct and learn parametric state-space models. In real-world applications, both the state dynamics and measurements can switch between a set of candidate models. For instance, in target tracking, vehicles can idle, move through traffic, or cruise on motorways, and measurements are collected in different geo- graphical or weather conditions. This paper proposes a new dif- ferentiable particle filter for regime-switching state-space models. The method can learn a set of unknown candidate dynamic and measurement models and track the state posteriors. We evaluate the performance of the novel algorithm in relevant models, showing its great performance compared to other competitive algorithms. Index Terms-Sequential Monte Carlo, differentiable particle filters, regime switching systems. I. INTRODUCTION Inferring unknown quantities based on sequential observa- tions is an important task in many real-world data analysis problems. One common example is Bayesian filtering, which aims to sequentially estimate posterior distributions of hidden states given observations in a state-space model [1]. Sequential Monte Carlo methods [2], [3], a.k.a. particle filters (PFs), are a class of Monte Carlo algorithms where the posteriors are recursively updated and approximated by a set of particles, i.e. weighted Monte Carlo samples. Since the seminal work on the bootstrap particle filter (BPF) [4], many variants of particle filters have been proposed, such as the auxiliary particle filter (APF) [5]–[8], the Gaussian sum particle filter (GSPF) [9], [10], and the Rao-Blackwellised particle filter (RBPF) [11], [12]. They are designed for non-linear non- Gaussian filtering tasks where the posteriors are analytically intractable and have been widely used in various real-world applications including geoscience [13], robotics [14], control systems [15], and machine learning [16]. Particle filters require the knowledge of state evolution (de- scribed by a dynamic model) and the link between the hidden state and an observation (via a measurement model). It is often non-trivial to specify these models in real-world applications where complex dynamic patterns and high-dimensional obser- vations exist [17]. An added layer of complexity is that both the state dynamics and observations can switch between a set of candidate models [18]–[24]. For example, a manoeuvring vehicle can exhibit a mixture of dynamic patterns ranging from moving through city traffic to cruising on motorways. Camera observations in autonomous vehicles are affected by light and weather conditions. This poses an interesting question on how to construct state-space models and perform particle filtering that account for a mixture of switching sub-models. One class of solutions is to employ a bank of particle filters, one for each candidate model, before fusing the results of each filter [20]–[23]. They can incur high computational complexity when the number of candidate models is high. Another direc- tion is to construct regime-switching particle filters [24] that augment the state space with the regime index while allowing for a flexible regime index proposal distribution1. Both classes of methods commonly assume that candidate models either are pre-defined [20]–[24] or follow specific model structures so that model parameters can be estimated analytically [25], [26]. This restricts their applicability and effectiveness in real- world filtering tasks. Differentiable particle filters (DPFs) are a family of re- cently emerging particle filtering approaches characterised by building and learning components of particle filters with neural networks through automatic differentiation [27]–[32]. Several variants [27], [28] adopt Gaussian dynamic models due to the simplicity of their differentiable implementations via the reparameterisation trick [33]. Normalising flows [34] have been adopted to construct more complicated dynamic models [31]. For measurement models, the conditional like- 1Note that we use the terms "regime", "pattern", "candidate model", and "sub-model" interchangeably throughout the paper. 978-1-6654-5245-8/23/$31.00 ©2023 IEEE lihood of an observation can be obtained as a direct neural network output [27], [28], feature similarity [35], or derived using a conditional normalising flow [36]. To the best of our knowledge, existing differentiable particle filters have not considered dynamic and measurement models with switching regimes. While generative models such as normalising flows are expressive in theory, it is unclear whether they are effective in practice when coupled with differentiable particle filters in filtering tasks with a set of candidate models. In this paper, we propose a new differentiable particle filter algorithm able to learn the models that govern the state dynamics and the observations in regime-switching state- space models. The resulted regime-switching differentiable bootstrap particle filter combines the best of both worlds – it inherits the desired properties of regime-switching particle filters including the flexibility to switch between candidate models without running separate filters, with the added benefit to learn unknown candidate models via the optimisation of neural networks. We demonstrate its effectiveness in non-linear filtering simulations with switching regimes. The rest of the paper is organised as follows. Section II for- mulates the problem. Related work including regime switching particle filters and differentiable particle filters is introduced in Section III. We present the regime-switching differentiable bootstrap particle filters in Section IV. Section V provides simulation results and we conclude the paper in Section VI. II. PROBLEM FORMULATION We consider nonlinear filtering tasks with switching dy- namic and measurement models defined as follows [24]: Fig. 1. Diagram of a regime switching state-space model with a period of T . III. RELATED WORK A. Regime-switching particle filters The regime switching particle filter (RS-PF) was proposed in [24] for general regime switching systems (Equations (1)- (5)). The joint posterior can be factorised as [24]: p(s0:t, m0:t|o1:t) ∝ p(s0:t−1, m0:t−1|o1:t−1)p(ot|st, mt) × p(st|st−1, mt)p(mt|m0:t−1) . (6) The unnormalised importance weight of the i-th particle {s(i) 0:t} is computed as: 0:t, m(i) ̄w(i) t = p(s(i) q(s(i) 0:t, m(i) 0:t, m(i) 0:t|o1:t) 0:t|o1:t) , (7) where the joint proposal distribution is factorised by: q(s0:t, m0:t|o1:t) = q(s0:t−1, m0:t−1|o1:t−1) × q(st|st−1, ot, mt)q(mt|m0:t−1) . (8) m0 ∼ π(m0) , mt ∼ φ(mt|m1:t−1) , s0 ∼ μ(s0) , st ∼ fθmt ot ∼ gθmt (st|st−1) , (ot|st) , (1) (2) (3) (4) (5) where t ∈ N+ represents the time index, θmt ∈ Θ is the parameter set of the mt-th regime of the dynamic system. The regime indices {mt}t≥1 take values from a discrete space M := {1, * * * , Nm}, and are distributed according to a categorical distribution mt ∼ C(p(mt = 1|m1:t−1), * * * , p(mt = Nm|m1:t−1)). In a time-varying latent Markov process {st}t≥1, the ds-dimensional hidden state of interest st is generated by a mixture of Nm or less dynamic patterns. The do-dimensional observation ot is generated by a measurement model defined by gθmt (ot|st). The observations {ot}t≥1 are conditionally independent given the latent process {st}t≥1. We follow the convention that vectors and matrices are denoted using bold fonts while scalars are denoted in normal font letters. The system diagram is shown in Fig. 1. Our goal is to jointly learn the parameter set θ = ∪Nm j=1θj and track the posterior distributions p(s0:t, m0:t|o1:t) of hid- den states s0:t (cid:44) {s0, * * * , st} and model indices m0:t (cid:44) {m0, * * * , mt}, given a collection of observations o1:t (cid:44) {o1, * * * , ot}. If bootstrap particle filters are adopted for each candidate model, i.e., q(st|st−1, mt, ot) = p(st|st−1, mt), the compu- tation of the importance weight is simplified to: |m(i) q(m(i) t 0:t−1)p(ot|s(i) t |m(i) 0:t−1) p(m(i) t , m(i) t ) t ∝ t−1 . w(i) w(i) (9) Three methods were proposed to construct the regime in- dex proposal distribution q(mt|m0:t−1) [24]: (i) a discrete i.e. q(mt = j|m1:t−1) = 1 uniform distribution, for Nm i.e. q(mt = j = {1, * * * , Nm}; (ii) a bootstrap method, j|m0:t−1) = p(mt|m0:t−1) for each j; (iii) a deterministic method that assigns an equal number of particles to each candidate model. B. Differentiable particle filters Differentiable particle filters [27]–[32] apply neural net- works to construct dynamic and measurement models of particle filters in a data-adaptive way, i.e., the dynamic and measurement models are learned from data using machine learning models, e.g. neural networks. The forward propa- gation of a differentiable bootstrap particle filter [28] at a single time step is illustrated in Algorithm 1. Functions kθ(*) and lθ(*), which are the particle proposer and the observation likelihood estimator, respectively, are parameterised by neural networks. The dynamic model constructed with kθ(*) takes an auxiliary noise vector (cid:15)(i) as part of its input for optimisation Algorithm 1: Forward propagation of a differentiable bootstrap particle filter at time step t Input: {s(i) Output: {s(i) t t−1, (cid:15)(i)}Np t }Np t−1, w(i) , ̄w(i) i=1, et, kθ, lθ i=1 Algorithm 2: Regime switching differentiable boot- strap particle filters (RS-DBPFs) framework Input: η, π(m0), μ(s0), Np, T , o1:T , kθ, lθ, ESSthres, L 1 Initialise parameter sets θj ⊆ θ for j = {1, * * * , Nm} and set learning rate η; 1 Sample s(i) t {s(i) according to the dynamic model t−1, (cid:15)(i))}Np i=1; t ∼ fθ(st|s(i) t−1) = kθ(s(i) 2 Compute observation likelihood t )}Np i=1; t ) = lθ(et, s(i) {gθ(et|s(i) 3 Evaluate importance weights { ̄w(i) t = w(i) t−1gθ(et|s(i) t )}Np i=1; with the reparameterisation trick. The observation ot can be encoded by a neural network hθ(*) to generate a feature vector et, i.e., et = hθ(ot). Objective functions L(θ) employed by differentiable particle filters can be classified mainly as supervised losses [27], [28], [31], [36], where the ground truth state information is available for training, and semi-supervised losses to leverage observations with unknown ground truth state information [35]. IV. REGIME-SWITCHING DIFFERENTIABLE BOOTSTRAP PARTICLE FILTERS We now introduce the proposed regime-switching differ- entiable bootstrap particle filter (RS-DBPF). We show in Algorithm 2 how to integrate the regime-switching system into the design of a differentiable bootstrap particle filter. Its key steps are clarified as follows. At the beginning of each time step, the regime index m(i) t of the i-th particle is sampled from the model proposal distribu- tion q(mt|m0:t−1). Three options of q(*) were described in the end of Section III-A. Note that the filter is run with a constant number of particles Np although adaptive mechanisms could be readily used [37], [38]. A forward propagation of the differ- entiable bootstrap particle filter (Algorithm 1) is performed to sample the state component s(i) t with a neural network-based particle proposer kθ denotes the parameter set of the m(i) (s(i) t (*) [27], [28], where θm(i) t -th candidate model: (s(i) s(i) t ∼ fθ t−1, (cid:15)(i)) . t−1) = kθ |s(i) (10) (i) t m t m (i) t m (i) t The auxiliary noise term (cid:15)(i) ∼ N (0ds , Ids) where 0ds denotes a ds-dimensional zero vector and Ids is a ds × ds identity matrix. The likelihood of the i-th particle is computed as [27], [28]: p(ot|s(i) t , m(i) t ) = gθ m (i) t (ot|s(i) t ) = lθ m (i) t (ot, s(i) t ) . (11) Assuming knowledge of the model switching distribution is 1:t−1), the unnormalised importance weight ̄w(i) |m(i) t p(m(i) t updated following Equation (9): |m(i) p(m(i) t ̄w(i) t = w(i) t−1 1:t−1)gθ m (i) t (ot|s(i) t ) q(m(i) t |m(i) 1:t−1) . (12) 3 2 while θ has not converged do Draw regime index {m(i) Draw samples {s(i) Set importance weights {w(i) for t = 1, 2, * * * , T do 0 }Np i=1 ∼ μ(s0); 0 }Np 0 }Np 4 5 6 i=1 ∼ π(m0); i=1 = 1 Np ; Draw regime index from the model proposal distribution {m(i) Sample s(i) t Estimate observation likelihood gθ t ∼ q(mt|m(i) 1:t−1)}Np i=1; as in Eq. (10); (ot|s(i) t ) m (i) t according to Equation (11); Calculate importance weights p(m (i) t |m (i) 1:t−1)gθ (ot|s { ̄w(i) t = w(i) t−1 q(m Normalise weights {w(i) t = (i) t |m (i) m t (i) 1:t−1) (i) ̄w t (cid:80)Np (k) k=1 ̄w t (i) t ) }Np i=1; }Np i=1; 1:t}Np i=1 according Compute the effective sample size ESSt = (cid:80)Np if ESSt < ESSthres then )2 1 (i) i=1(w t ; Resample and update {m(i) to importance weights w(i) Update {w(i) t = 1 Np }Np i=1; t 1:t, s(i) ; end Calculate the estimate ˆst = (cid:80)Np i=1 w(i) t s(i) t ; end Calculate the total loss L(θ); Update parameters by gradient descent θj = θj − η(cid:79)θj L for j = {1, * * * , Nm}; 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 end V. SIMULATIONS AND RESULTS We adopt the synthetic data experiment explored in [24]. It includes a mixture of eight candidate dynamic and mea- surement models with small variances for each candidate model. This leads to multi-modal posterior distributions that are challenging for filtering algorithms to explore all modes2. A. Experiment setting The j-th candidate model (j ∈ {1, * * * , 8}) is as follows: (cid:26) st = ajst−1 + bj + ut (cid:112)|st| + dj + vt ot = cj Mj : . (13) time steps for one trajectory is T = The number of 50. The initial state s0 ∈ R is sampled from a contin- uous uniform distribution U[−0.5, 0.5] whereas the index of the initial sub-model m0 is sampled from a discrete uniform distribution U{1, 8}. Coefficients [a1, * * * , a8] = [−0.1, −0.3, −0.5, −0.9, 0.1, 0.3, 0.5, 0.9], [b1, * * * , b8] = [c1, * * * , c8] = [a1, * * * , a8], and [0, −2, 2, −4, 0, 2, −2, 4], Finally, a resampling step is performed if the effective sample size (ESS) is smaller than a threshold [39]. 2Code to reproduce experiment results is available at https://github.com/ WickhamLi/RS-DBPF [d1, * * * , d8] = [b1, * * * , b8]. The noise terms ut ∼ N (0, 0.1) and vt ∼ N (0, 0.1). The overall dataset includes 2000 trajec- tories (1000 for training, 500 for validation, 500 for testing). The regime switching dynamic follows either a Markovian dynamic or a P ́olya urn dynamic. In the Markovian switching system, p(mt|m0:t−1) = p(mt|mt−1). Following the example in [24], we set the transition probability matrix P as: TABLE I AVERAGE, BEST, AND WORST RMSES WITH A MARKOVIAN DYNAMIC. MM-PF (baseline) DBPF (baseline) RS-DBPF (proposed) RS-PF (oracle) Average 1.9016 1.5176 0.8325 0.4627 Best 0.5601 0.5085 0.3779 0.2570 Worst 9.4422 9.5790 8.6401 2.2972 P =  0.80 0.15 ρ       ρ ... ρ 0.15 0.80 0.15 . . . ρ * * * * * * ρ * * * * * * ρ ρ ... 0.80 0.15 0.80 ρ        , (14) TABLE II AVERAGE, BEST, AND WORST RMSES WITH A P ́OLYA DYNAMIC. MM-PF (baseline) DBPF (baseline) RS-DBPF (proposed) RS-PF (oracle) Average 2.1334 1.6144 0.8394 0.6399 Best 0.6409 0.4754 0.3817 0.3171 Worst 5.3060 5.4350 2.5627 2.0383 where ρ = 1 120 . Pj,k (cid:44) p(mt = k|mt−1 = j). The P ́olya switching model is a more general dynamic process to describe long-term time dependencies between candidate models: p(mt = k|m0:t−1) = 1k,τ + βk (cid:80)t−1 τ =0 j=1((cid:80)t−1 τ =0 (cid:80)Nm 1j,τ + βj) , (15) where k = {1, * * * , Nm} denotes the regime index, 1k,τ = 1(mτ = k) is an indicator function on whether the system is switched to the k-th model at time step τ . βk is set to 1. B. Parameter values for the filtering algorithms We compare the proposed regime-switching differentiable bootstrap particle filter (RS-DBPF) with a multi-model particle filter (MM-PF) [20], a differentiable bootstrap particle filter (DBPF) [28], and a regime-switching particle filter (RS- PF) [24]. 200 particles are employed for training and validation to reduce computational costs. 2000 particles are used to perform filtering with testing trajectories for smooth estimated trajectories. Particles are initialised from a uniform distribution U[−0.5, 0.5]. The RS-DBPF and the RS-PF adopt a uniform distribution for the regime index proposal q(mt|m1:t−1) to evaluate the robustness of the filters when the regime index proposal deviates from the regime switching dynamic. For the DBPF and the RS-DBPF, the particle proposer kθ adopts a 2-layer neural network with 8 neurons in the hidden layer. A Gaussian kernel with a learnable kernel parameter is used to generate conditional likelihoods lθ, by comparing the observation with an embedding generated from the state through a 2-layer neural network with 8 neurons in the hidden layer with a tanh-activation function. A supervised loss based on mean squared errors between the ground truth and predicted states is adopted. Stochastic gradient descent with a momen- tum factor of 0.9 is used as optimiser. We choose learning rates η ∈ {0.01, 0.02, 0.05, 0.1} with a step-wise decay that halves the learning rate every 10 epochs for the DBPF and the RS-DBPF based on best validation performance. The epoch number is set to 60. The mini-batch size is set to 100. C. Tracking performance We compute root mean squared errors (RMSEs) of predicted states for each test trajectory and report error statistics among 500 test trajectories in TABLEs I and II. The proposed RS- DBPF leads to significantly smaller average RMSEs compared with the baselines including the DBPF and the MM-PF. Fig. 2 plots the absolute errors along each time step averaged over all the test trajectories for the P ́olya urn switching model. Note that both the RS-DBPF and the DBPF assume no knowledge of the candidate models, while the MM-PF and the RS-PF have access to the ground truth candidate models. The RS-PF can further utilise the regime switching dynamic so it is served as the oracle model to generate optimal filtering performance as a benchmark. The poor performance of the MM-PF is due to its algorithmic assumption that there is no regime switching. Fig. 2. Mean absolute errors at each time step (P ́olya urn dynamics). VI. CONCLUSION In this paper, we address filtering tasks where a mixture of unknown candidate dynamic and measurement models exist. The proposed RS-DBPF can flexibly switch between candidate models, i.e. regimes, while simultaneously learn the candidate models without prior knowledge of their functional forms. Numerical simulations show that the RS-DBPF outperforms both a vanilla DBPF and a MM-PF in two simulation se- tups with different regime switching dynamics. Future work includes the estimation of the regime-switching dynamic, the incorporation of more expressive neural networks to construct candidate models, and more extensive experimental evaluation with high-dimensional numerical and real-world experiments. [25] P. Fearnhead, "Particle filters for mixture models with an unknown number of components," Stat. Comput., vol. 14, no. 1, pp. 11–21, 2004. [26] F. Caron, M. Davy, A. Doucet, E. Duflos, and P. Vanheeghe, "Bayesian inference for linear dynamic models with dirichlet process mixtures," IEEE Trans. Signal Process., vol. 56, no. 1, pp. 71–84, 2007. [27] P. Karkus, D. Hsu, and W. S. Lee, "Particle filter networks with application to visual localization," in Proc. Conf. Robot Learn. (CoRL), Z ̈urich, Switzerland, Oct. 2018, pp. 169–178. [28] R. Jonschkowski, D. Rastogi, and O. Brock, "Differentiable particle filters: End-to-end learning with algorithmic priors," in Proc. Robot. Sci. Syst., Pittsburgh, USA, Jun. 2018. [29] X. Ma, P. Karkus, D. Hsu, and W. S. Lee, "Particle filter recurrent neural networks," in Proc. AAAI Conf. AI (AAAI), New York, USA, Feb. 2020. [30] A. Kloss, G. Martius, and J. Bohg, "How to train your differentiable filter," Auton. Robots, vol. 45, no. 4, pp. 561–578, 2021. [31] X. Chen, H. Wen, and Y. Li, "Differentiable particle filters through conditional normalizing flow," in Proc. IEEE Int. Conf. Inf. Fusion (FUSION), Sun City, South Africa, Nov. 2021, pp. 1–6. [32] A. Corenflos, J. Thornton, G. Deligiannidis, and A. Doucet, "Differ- entiable particle filtering via entropy-regularized optimal transport," in Proc. Int. Conf. Mach. Learn. (ICML), July 2021. [33] D. P. Kingma and M. Welling, "Auto-encoding variational Bayes," in Proc. Int. Conf. Learn. Represent. (ICLR), Banff, Canada, Apr. 2014. [34] D. Rezende and S. Mohamed, "Variational inference with normalizing flows," in Proc. Int. Conf. Mach. Learn. (ICML), Lille, France, Jul. 2015, pp. 1530–1538. [35] H. Wen, X. Chen, G. Papagiannis, C. Hu, and Y. Li, "End-to-end semi- supervised learning for differentiable particle filters," in Proc. IEEE Int. Conf. Robot. Automat. (ICRA), Xi'an, China, May 2021, pp. 5825–5831. [36] X. Chen and Y. Li, "Conditional measurement density estimation in sequential Monte Carlo via normalizing flow," in Proc. Eur. Signal Process. Conf. (EUSIPCO), Belgrade, Serbia, Aug. 2022, pp. 782–786. [37] V. Elvira, J. M ́ıguez, and P. M. Djuri ́c, "Adapting the number of particles in sequential Monte Carlo methods through an online scheme for convergence assessment," IEEE Trans. Signal Process., vol. 65, no. 7, pp. 1781–1794, 2016. [38] V. Elvira, J. Miguez, and P. M. Djuri ́c, "On the performance of particle filters with adaptive number of particles," Stat. Comput., vol. 31, pp. 1–18, 2021. [39] V. Elvira, L. Martino, and C. P. Robert, "Rethinking the effective sample size," Int. Stat. Rev., vol. 90, no. 3, pp. 525–550, 2022. REFERENCES [1] A. Doucet and A. M. Johansen, "A tutorial on particle filtering and smoothing: Fifteen years later," Handb. of Nonlinear Filtering, vol. 12, no. 656-704, p. 3, 2009. [2] P. M. Djuric, J. H. Kotecha, J. Zhang, Y. Huang, T. Ghirmai, M. F. Bugallo, and J. Miguez, "Particle filtering," IEEE Signal Process. Mag., vol. 20, no. 5, pp. 19–38, 2003. [3] A. Doucet, N. De Freitas, N. J. Gordon et al., Sequential Monte Carlo methods in practice. Springer, 2001, vol. 1, no. 2. [4] N. J. Gordon, D. J. Salmond, and A. F. Smith, "Novel approach to nonlinear/non-Gaussian Bayesian state estimation," in IEE Proc. F (Radar Signal Process.), Apr. 1993, pp. 107–113. [5] M. K. Pitt and N. Shephard, "Filtering via simulation: Auxiliary particle filters," J. Amer. Statist. Assoc., vol. 94, no. 446, pp. 590–599, 1999. [6] V. Elvira, L. Martino, M. F. Bugallo, and P. M. Djuri ́c, "In search for improved auxiliary particle filters," in Proc. Eur. Signal Process. Conf. (EUSIPCO), Rome, Italy, Sep. 2018, pp. 1637–1641. [7] V. Elvira, L. Martino, M. F. Bugallo, and P. M. Djuric, "Elucidating the auxiliary particle filter via multiple importance sampling," IEEE Signal Process. Mag., vol. 36, no. 6, pp. 145–152, 2019. [8] N. Branchini and V. Elvira, "Optimized auxiliary particle filters: adapting mixture proposals via convex optimization," in Proc. Conf. Uncertain. Artif. Intell. (UAI), Jul. 2021, pp. 1289–1299. [9] J. H. Kotecha and P. M. Djuric, "Gaussian sum particle filtering," IEEE Trans. Signal Process., vol. 51, no. 10, pp. 2602–2612, 2003. [10] --, "Gaussian sum particle filtering for dynamic state-space models," in Proc. IEEE Int. Conf. Acoust. Speech Signal Process., Salt Lake City, USA, May 2001. [11] A. Doucet, N. de Freitas, K. Murphy, and S. Russell, "Rao-Blackwellised particle filtering for dynamic Bayesian networks," in Proc. Conf. Un- certain. Artif. Intell. (UAI), Stanford, USA, Jun. 2000, pp. 176–183. [12] N. De Freitas, "Rao-Blackwellised particle filtering for fault diagnosis," in Proc. IEEE Aerosp. Conf., vol. 4, Mar. 2002, pp. 4–4. [13] P. J. Van Leeuwen, H. R. K ̈unsch, L. Nerger, R. Potthast, and S. Reich, "Particle filters for high-dimensional geoscience applications: A review," Quart. Journal of the R. Meteorological Soc., vol. 145, no. 723, pp. 2335–2365, 2019. [14] A. Gunatilake, S. Kodagoda, and K. Thiyagarajan, "A novel UHF-RFID dual antenna signals combined with Gaussian process and particle filter for in-pipe robot localization," IEEE Robot. Autom. Lett., vol. 7, no. 3, pp. 6005–6011, 2022. [15] C. Pozna, R.-E. Precup, E. Horv ́ath, and E. M. Petriu, "Hybrid particle filter–particle swarm optimization algorithm and application to fuzzy controlled servo systems," IEEE Trans. Fuzzy Syst., vol. 30, no. 10, pp. 4286–4297, 2022. [16] M. H. Dupty, Y. Dong, and W. S. Lee, "PF-GNN: Differentiable particle filtering based approximation of universal graph representations," in Proc. Int. Conf. Learn. Represent. (ICLR), May 2021. [17] N. Kantas, A. Doucet, S. S. Singh, J. Maciejowski, and N. Chopin, "On particle methods for parameter estimation in state-space models," Stat. Sci., vol. 30, no. 3, pp. 328–351, 2015. [18] S. McGinnity and G. W. Irwin, "Multiple model bootstrap filter for tracking," IEEE Trans. Aerosp. Electron. Syst., maneuvering target vol. 36, no. 3, pp. 1006–1012, 2000. [19] L.-Q. Li, W.-X. Xie, J.-X. Huang, and J.-J. Huang, "Multiple model rao- blackwellized particle filter for manoeuvring target tracking," Defence Sci. Journal, vol. 59, no. 3, p. 197, 2009. [20] B. Liu, "Instantaneous frequency tracking under model uncertainty via dynamic model averaging and particle filtering," IEEE Trans. Wirel. Commun., vol. 10, no. 6, pp. 1810–1819, 2011. [21] I. Urteaga, M. F. Bugallo, and P. M. Djuri ́c, "Sequential Monte Carlo methods under model uncertainty," in Proc. IEEE Conf. Stat. Signal Process. Workshop (SSP), Palma de Mallorca, Spain, Feb. 2016, pp. 1–5. [22] L. Martino, J. Read, V. Elvira, and F. Louzada, "Cooperative parallel particle filters for online model selection and applications to urban mobility," Digit. Signal Process., vol. 60, pp. 172–185, 2017. [23] H. Wang, X. Zhao, and M. F. Bugallo, "Indoor UAV height estimation with multiple model-detecting particle filters," in Proc. Eur. Signal Process. Conf. (EUSIPCO), Belgrade, Serbia, Aug. 2022, pp. 977–981. [24] Y. El-Laham, L. Yang, P. M. Djuri ́c, and M. F. Bugallo, "Particle filtering under general regime switching," in Proc. Eur. Signal Process. Conf. (EUSIPCO), Online, May 2021, pp. 2378–2382.
http://arxiv.org/abs/2302.10318v1
2023-02-20T21:05:17
2023-02-20T21:05:17
Hadamard Layer to Improve Semantic Segmentation
The Hadamard Layer, a simple and computationally efficient way to improve results in semantic segmentation tasks, is presented. This layer has no free parameters that require to be trained. Therefore it does not increase the number of model parameters, and the extra computational cost is marginal. Experimental results show that the new Hadamard layer substantially improves the performance of the investigated models (variants of the Pix2Pix model). The performance's improvement can be explained by the Hadamard layer forcing the network to produce an internal encoding of the classes so that all bins are active. Therefore, the network computation is more distributed. In a sort that the Hadamard layer requires that to change the predicted class, it is necessary to modify $2^{k-1}$ bins, assuming $k$ bins in the encoding. A specific loss function allows a stable and fast training convergence.
[ "Angello Hoyos", "Mariano Rivera" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10318v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10318v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.CV", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.CV", "cs.LG", "eess.IV", "I.4.6; I.5.1" ]
3 2 0 2 b e F 0 2 ] V C . s c [ 1 v 8 1 3 0 1 . 2 0 3 2 : v i X r a HADAMARD LAYER TO IMPROVE SEMANTIC SEGMENTATION Angello Hoyos, Mariano Rivera Centro de Investigacion en Matematicas, A.C. Guanajuato, Gto., 36023 Mexico {angello.hoyos, mrivera}@cimat.mx ABSTRACT The Hadamard Layer, a simple and computationally effi- cient way to improve results in semantic segmentation tasks, is presented. This layer has no free parameters that require to be trained. Therefore it does not increase the number of model parameters, and the extra computational cost is marginal. Ex- perimental results show that the new Hadamard layer substan- tially improves the performance of the investigated models (variants of the Pix2Pix model). The performance's improve- ment can be explained by the Hadamard layer forcing the net- work to produce an internal encoding of the classes so that all bins are active. Therefore, the network computation is more distributed. In a sort that the Hadamard layer requires that to change the predicted class, it is necessary to modify 2k−1 bins, assuming k bins in the encoding. A specific loss func- tion allows a stable and fast training convergence. Index Terms- Semantic segmentation, Hadamard codi- fication. Conditional generative network. Pix2Pix model. 1. INTRODUCTION Many problems in computer vision can be defined as image- to-image translation with an input image into a corresponding output image. A clear example is semantic image segmenta- tion, where each pixel in an input image is assigned to a class label; in a certain way, we predict an output image that is less complex than the input, even if the input image is a medical image or a street image seen by an autonomous car. Recently, this task has been solved with different strategies using convo- lutional neural networks (CNN), i.e., [1, 2], even though the main trouble of predicting pixels from pixels does not change. An alternative to solved image segmentation using CNN is Conditional Generative Adversarial Networks (cGAN), an image-to-image translation network. Pix2Pix, proposed by Isola et al. [3], was the first demonstration of cGANs successfully generating nearly discrete segmentation labels rather than realistic images. In this work, we present the Hadamard layer. This layer enforces each class label to be encoded to have an equal num- ber of +1s and −1s, unlike the classic one-hot encoding. With that, we increase the Hamming distance between the class la- bels and obtain better segmentation results. We think this hap- pens because to attack one-hot encoding requires changing the response in a bin to flip the assigned class, which explains the susceptibility to adversary attacks by neural networks in classification tasks. On the other hand, using the Hadamard encoding requires modifying half of the bins to change a la- bel. In this way, the network requires a more distributed acti- vation to produce a label. We present experiments on modified cGANs to evaluate the performance of this new layer. In those experiments, we noted a performance increment without sacrificing training time. Fig. 1. Shows a Hadamard Layer embedded in the generator of a Pix2Pix architecture. 2. RELATED WORK 2.1. Semantic Segmentation Several convolutional NN architectures for semantic segmen- tation have been reported in recent years. Among them, pop- ular architectures include UNet [4], which was initially de- veloped for BioMedical Image Segmentation. Since its pub- lication in 2015, variants of the UNet have emerged for such purpose. Among them, Pix2Pix-based models are computa- tionally efficient methods that produce good-quality segmen- tation. Pix2Pix consists of a stable Generative Adversarial Networks (GANs) strategy for training a UNet. The advan- tage of UNet resides in its simplicity: it consists of a single UNet (hourglass stage). We chose the Pix2Pix model to in- troduce our Hadamard Layer in this work. Thus, we evaluate the performance impact of the proposed Hadamard Layer in different implementations, such as the classic UNet, the Re- sUNet, the VGG-UNet, and the UNet3+ variants. We briefly describe such variants below. A UNet comprises two stages: a contraction path (en- coder) and an expansion one (decoder). The encoder captures the image's context using a stack of convolutional and max pooling layers. The decoder transform combines and expands the extracted features to construct the desired output. Re- sUNet [5] takes the performance gain of Residual networks and uses it with the UNet. This architecture was developed by Zhengxin Zhang et al. and initially used for road extrac- tion from high-resolution aerial images in remote sensing image analysis. Later, it was adopted by researchers for mul- tiple other applications, such as brain tumor segmentation, human image segmentation, and many more. Although this is a capable network, it has a slightly large number of pa- rameters. VGG-UNet [6] is another variant of UNet model that combines a pretrained backbone as the encoder. In this proposal, the decoder consists of five up-sampling blocks and uses a symmetric expanding path to enable precise localiza- tion segmentation to detect corrosions from steel bridges and cracks from rubber bearings under limited conditions. More recently, UNet3+ [7] was reported as the best variant for image segmentation: full-scale skip connections incorporate low-level details with high-level semantics from feature maps in different scales and full-scale deep supervision that helps to learn hierarchical representations from the full-scale aggre- gated feature maps. The growing popularity of the UNet3+ is due to its superior performance compared with other reported variants as Attention UNet [8], PSPNet [9], and DeepLab [10], which were considered SOTA. Despite the advances mentioned in this problem, these so- lutions are not yet perfect, which is why in this work, we pro- pose a change that can be applied to any neural network that brings a notable benefit. To understand it better, we will first introduce related theory. 2.2. Linear Error-Correction Codes Information transmission is a well-understood area of math- ematics where the central idea is to increase the Hamming distance between codewords by adding redundancy to a mes- sage to ensure that even if noise flips some random bits, the message is still legible. The solution to this problem is us- ing linear error-correcting codes like Hamming codes [11] or Reed-Solomon codes[12]. In this work, we selected a partic- ular case of Reed-Solomon codes, the Hadamard codes, for our proposal. We recognize that Hadamard codes are suitable to be in- corporated into neural network architectures, given previous works that show the effectiveness of Hadamard codes in the classification of deep features [13] and as a defense strategy against multiple adversary attacks [14]. Nevertheless, this approach has not been explored in semantic segmentation. Hadamard codes are easy to construct; assume we need codes of length 2k, or in other words, there are at most 2k possi- ble classes in our segmentation problem; they can be fewer. The Hadamard codes are the rows of the matrix H2k , defined recursively as with H2k = H2k−1 H2k−1 −H2k−1(cid:21) H2k−1 (cid:20) , H2 = 1 1 1 −1(cid:21) (cid:20) . (1) (2) The above procedure for computing Hadamard matrices is named Silvester's construction and produces symmetric ma- trices [15]. For example, using this construction for eight classes, we have 1 1 1 −1 1 1 −1 −1 1 1 1 1 −1 1 −1 −1 1 −1 −1 −1 −1 1 1 1 −1 −1 1 1 1 1 1 1 1 −1 1 −1 1 −1 1 −1 −1 1 1 −1 −1 1 1 1 −1 −1 1 −1 −1 −1 −1 1 1 −1 1 1 1 −1 1 −1             H8 =             . (3) In the examples above, we can observe that any pair of codes in a Hn Hadamard matrix are at a distance 2k−1; this property allows us to define a more demarcated space between classes, which we consider essential for image segmentation. 3. METHODOLOGY Figure 1 illustrates the use of the proposed Hadamard Layer in the UNet model to achieve a segmentation task. Our Hadamard Layer consists of two operations. First, to multi- ply by H ⊤ the UNet stage output's ˆyc ∈ RH×W ×2k . Second, to apply a sof tmax activation to enforce, even more, the output ˆy to be more informative and closer to the one-hot code: ˆy = H(ˆyc) = softmax(H ⊤ ˆyc). (4) A valuable property of Hadamard matrices H is that they are orthogonal: H H ⊤ = n In; where n is the order, In is the n × n identity matrix and H T is the transpose of H. Since H is orthogonal, y would be closer to a one-hot code if yc is similar to a hadamard code; i.e., yc would have all its entries activated. Fig. 2. Shows some examples of test images from the CelebAMask-HQ dataset: (a) Input image and (b) target segmentation map. The reminder columns depict the results: (c-d) UNet model, (e-f) ResUNet, (g-h) VGG-UNet, and (i-j) UNet3+; where columns (c, e, g, i) correspond to models trained with one-hot codification and columns (d, f, h, j) to models trained with Hadamard layer codification. Now, we introduce another essential ingredient for having successful training: the loss functions for the cGAN. Then, let (x, y) be the input data for our UNet, ˆy is the predicted segmentation, and α the output of the Discriminator (matrix with dimensions h × w) of the full cGAN. Each element αij can be understood as the probability that the support region of the analyzed pair, (x, y) or (x, ˆy), is real. Then, we use the Discriminator loss given by for the differences between ˆy and y. The last loss term pro- motes enforcing the input to the Hadamard Layer be similar to the Hadamard code of the corresponding class. We found that the last two loss terms greatly contribute to the stability and convergence ratio of the entire cGAN. In this way, we train our network to compute a realistic mask image and return the correct classes. LD(ˆy) = S(1|α) + S(0|ˆα) (5) 4. EXPERIMENTS AND RESULTS where α is the discriminator response to the real pair (x, y), and ˆα to the predicted pair (x, ˆy), and S is the cross-entropy loss S(ˆz|z) = − 1 N zk log ˆzk (6) Xk On the other hand, the loss function for the Generator is LG(ˆz) = S(1|ˆα) + Λ1S(ˆy|y) + Λ2M AE(ˆy, y) + Λ3M AE(ˆyc, yc); (7) where the parameters (Λ1, Λ2, Λ3) = (1000, 100, 250) weight the relative contributions of the loss terms, and M AE(ˆz, z) = |ˆzk − zk| (8) Xk is the mean absolute error. Note that the loss (7) includes four terms. The first two terms are the classical one: binary-cross-entropy loss to re- ward that the generator manages to deceive the discrimina- tor, and a multi-class cross-entropy loss to encourage the pre- dicted segmentation probabilistic map ˆy to be similar to the one-hot encoded ground truth y. The third additional loss term reinforces the segmentation by including a L1 penalty We evaluate our proposal in the face segmentation task. For this purpose, we use the CelebAMask-HQ (annotation maps). We separated the images into 25,000 training images and 5,000 test images. We investigated the performance improve- ment when the Hadamard Layers are used in different variants of the Pix2Pix model. Although we have limited our study to Pix2Pix models, it is essential to say that one can intro- duce the Hadamard Layer in other reported architectures for semantic segmentation. However, such a study is outside the scope of this work. Herein, we investigate the Pix2Pix vari- ants using the standard UNet, the ResUNet, the VGG-UNet, and the UNet3+ networks. Each variant follows a training using one-hot and Hadamard coding for class labels under the same number of steps. Figure 2 depicts examples of predicted segmentation for the evaluated models. We compute the segmentation maps M with M (r, c) = argmax ˆyk(r, c) (9) k where Ck ∈ 0, 1, 2, ..., K are class index in the matrix codes, (r, c) are the pixel at coordinates. We can observe the differ- ences in segmentation for each model in Fig. 2. In columns d, f, h, and j, the models that include the Hadamard Layer, we can notice a more detailed segmentation when compared with the respective results in columns c, e, g, and i, the models trained only with one-hot encoding. Table 1 resumes the metrics (Pixel Accuracy and the mean Class IoU) of the predicted segmentation for 5,000 test im- ages. In all cases, using a Hadamard Layer gets better results than one-hot codification in these two metrics. Indeed, the models UNet and ResUNet show a more noticeable improve- ment than VGG-UNet and UNet3+ when using the Hadamard Layer. Layer. Model UNet ResUNet VGG-UNet UNet3+ Pixel Acc. Class IoU One-Hot Hadamard One-Hot Hadamard 0.49 0.53 0.61 0.64 0.69 0.68 0.62 0.67 0.12 0.15 0.16 0.22 0.23 0.28 0.18 0.26 Table 1. Accuracy and mean IoU between one-hot and Hadamard codification: CelebAMask-HQ dataset. Next, Table 2 presents detailed results for two models, UNet and ResUNet. We can observe some consistency in the IoU values for the class background and face. Mean- while, there is a quantitative difference favoring the models that use the proposed Hadamard layer for the classes neck, mouth, lips, brow, and hair. Class Background Face Neck Glasses L-ear R-ear Mouth Nose U-Lip L-Lip R-Brow L-Brow L-Eye R-Eye Clothes Hair Earrings Necklace Hat UNet ResUNet One-Hot Hadamard One-Hot Hadamard 0.76 0.69 0.29 0.03 0.13 0.10 0.08 0.10 0.01 0.02 0.01 0.01 0.01 0.00 0.00 0.03 0.00 0.00 0.00 0.79 0.76 0.47 0.03 0.14 0.11 0.14 0.51 0.21 0.30 0.18 0.13 0.11 0.05 0.07 0.47 0.00 0.00 0.00 0.81 0.79 0.40 0.00 0.22 0.20 0.09 0.15 0.03 0.04 0.02 0.03 0.01 0.00 0.00 0.02 0.00 0.00 0.00 0.79 0.81 0.55 0.01 0.19 0.19 0.18 0.61 0.34 0.41 0.27 0.23 0.13 0.06 0.08 0.41 0.00 0.00 0.00 Table 2. Pixel Accuracy and Class IoU between one-hot and Hadamard class codification for test Images in CelebAMask- HQ dataset. The Discriminator of all the evaluated models is of the PatchGAN type. The Discriminator's output is a matrix where each element evaluates the realness of the support region (re- ceptive field). According to Isola et al., for generating images from semantic segmentations in the CitySky database, the ap- propriate receptive field is 70 × 70 pixels [3]. For our task, we choose the receptive field size as that one produces the best results in the model based on the simple UNet network with one-hot encoding. We conducted this experiment on a subset of just 1000 training images and 100 testing images; instead of the complete data set of 25,000/5000 for training/testing images. The receptive field size turned out to be 30 × 30. In Table 3, we show the results for different receptive field sizes. Note that models with the Hadamard layer perform better for larger receptive fields. However, we use a patch size equal to 30 × 30 for a fair comparison. Patch Sz 15x15 30x30 60x60 120x120 Pixel Acc. Class IoU One-Hot Hadamard One-Hot Hadamard 0.51 0.54 0.51 0.51 0.66 0.64 0.66 0.67 0.12 0.14 0.12 0.13 0.21 0.20 0.19 0.21 Table 3. Pixel Accuracy and Class IoU between one-hot and Hadamard class codification for test Images in CelebAMask- HQ Mini dataset, with different patch sizes in the Discrimi- nator. 5. CONCLUSIONS AND FUTURE WORK We proposed the Hadamard Layer as a simple and computa- tionally efficient way to improve results in semantic segmen- tation tasks. The new layer is constant, so it does not increase the number of model parameters. As test architecture, we use different variants of the Pix2Pix model for the face segmen- tation task using the CelebAMask-HQ database. The results show that the new Hadamard layer substantially improves the performance of the investigated models. The metrics evalu- ated are the simple accuracy (number of pixels correctly clas- sified) and the Intersection Over Union (IOU). The best per- formance of the intervened models can be explained by the Hadamard layer forcing the network to produce an encoding of the classes so that all bins are active. Consequently, the network computation is more distributed. In a sort that the Hadamard layer requires that to change the predicted class, it is necessary to modify 2k−1 bins, assuming k bins in the encoding. On the other hand, changing the predicted class in one-hot encoding is enough to modify a single bin (decrease the response of the most significant bin or increase the re- sponse of any other.). Our future work will extend our evalu- ation to other databases and different architectures and assess the performance of implicit coding against adversary attacks. Acknowledgments. This work was partly supported by the CONACYT (Mexico); Grant CB 2017-2018-A1-S-43858. in Proceedings of the IEEE conference on computer vi- sion and pattern recognition, 2017, pp. 2881–2890. [10] Liang-Chieh Chen, Yukun Zhu, George Papandreou, Florian Schroff, and Hartwig Adam, "Encoder-decoder with atrous separable convolution for semantic image segmentation," in Proceedings of the European confer- ence on computer vision (ECCV), 2018, pp. 801–818. [11] Richard W Hamming, "Error detecting and error cor- recting codes," The Bell system technical journal, vol. 29, no. 2, pp. 147–160, 1950. [12] Irving S Reed and Gustave Solomon, "Polynomial codes over certain finite fields," Journal of the society for industrial and applied mathematics, vol. 8, no. 2, pp. 300–304, 1960. [13] Shuo Yang, Ping Luo, Chen Change Loy, Kenneth W Shum, and Xiaoou Tang, "Deep representation learning with target coding," in Twenty-Ninth AAAI Conference on Artificial Intelligence, 2015. [14] Angello Hoyos, Ubaldo Ruiz, and Edgar Chavez, "Hadamard's defense against adversarial examples," IEEE Access, vol. 9, pp. 118324–118333, 2021. [15] J.J. Sylvester, "Thoughts on inverse orthogonal ma- trices, simultaneous sign successions, and tessellated pavements in two or more colours, with applications to newton's rule, ornamental tile-work, and the theory of numbers," The London, Edinburgh, and Dublin Philo- sophical Magazine and Journal of Science, vol. 34, no. 232, pp. 461–475, 1867. 6. REFERENCES [1] Irem Ulku and Erdem Akag ̈und ̈uz, "A survey on deep learning-based architectures for semantic segmentation on 2d images," Applied Artificial Intelligence, pp. 1–45, 2022. [2] Alan Reyes-Figueroa and Mariano Rivera, "W–net: A convolutional neural network for retinal vessel segmen- tation," in Pattern Recognition: 13th Mexican Confer- ence, MCPR 2021, Mexico City, Mexico, June 23–26, 2021, Proceedings, 2021, pp. 355–368. [3] Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A Efros, "Image-to-image translation with conditional ad- versarial networks," in Proceedings of the IEEE confer- ence on computer vision and pattern recognition, 2017, pp. 1125–1134. [4] Olaf Ronneberger, Philipp Fischer, and Thomas Brox, "U-net: Convolutional networks for biomedical image in International Conference on Med- segmentation," ical image computing and computer-assisted interven- tion. Springer, 2015, pp. 234–241. [5] Foivos I Diakogiannis, Franc ̧ois Waldner, Peter Cac- cetta, and Chen Wu, "Resunet-a: A deep learning frame- work for semantic segmentation of remotely sensed data," ISPRS Journal of Photogrammetry and Remote Sensing, vol. 162, pp. 94–114, 2020. [6] Jiyuan Shi, Ji Dang, Mida Cui, Rongzhi Zuo, Kazuhiro Shimizu, Akira Tsunoda, and Yasuhiro Suzuki, "Im- provement of damage segmentation based on pixel-level data balance using vgg-unet," Applied Sciences, vol. 11, no. 2, pp. 518, 2021. [7] Huimin Huang, Lanfen Lin, Ruofeng Tong, Hongjie Hu, Qiaowei Zhang, Yutaro Iwamoto, Xianhua Han, Yen-Wei Chen, and Jian Wu, "Unet 3+: A full- scale connected unet for medical image segmentation," in ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP). IEEE, 2020, pp. 1055–1059. [8] Ozan Oktay, Jo Schlemper, Loic Le Folgoc, Matthew Lee, Mattias Heinrich, Kazunari Misawa, Kensaku Mori, Steven McDonagh, Nils Y Hammerla, Bernhard Kainz, et al., "Attention u-net: Learning where to look for the pancreas," arXiv preprint arXiv:1804.03999, 2018. [9] Hengshuang Zhao, Jianping Shi, Xiaojuan Qi, Xiaogang Wang, and Jiaya Jia, "Pyramid scene parsing network,"
http://arxiv.org/abs/2302.10311v1
2023-02-20T20:54:11
2023-02-20T20:54:11
Understanding the effect of varying amounts of replay per step
Model-based reinforcement learning uses models to plan, where the predictions and policies of an agent can be improved by using more computation without additional data from the environment, thereby improving sample efficiency. However, learning accurate estimates of the model is hard. Subsequently, the natural question is whether we can get similar benefits as planning with model-free methods. Experience replay is an essential component of many model-free algorithms enabling sample-efficient learning and stability by providing a mechanism to store past experiences for further reuse in the gradient computational process. Prior works have established connections between models and experience replay by planning with the latter. This involves increasing the number of times a mini-batch is sampled and used for updates at each step (amount of replay per step). We attempt to exploit this connection by doing a systematic study on the effect of varying amounts of replay per step in a well-known model-free algorithm: Deep Q-Network (DQN) in the Mountain Car environment. We empirically show that increasing replay improves DQN's sample efficiency, reduces the variation in its performance, and makes it more robust to change in hyperparameters. Altogether, this takes a step toward a better algorithm for deployment.
[ "Animesh Kumar Paul", "Videh Raj Nema" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10311v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10311v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI" ]
Understanding the effect of varying amounts of replay per step Animesh Kumar Paul * 1 Videh Raj Nema * 1 3 2 0 2 b e F 0 2 ] G L . s c [ 1 v 1 1 3 0 1 . 2 0 3 2 : v i X r a Abstract Model-based reinforcement learning uses models to plan, where the predictions and policies of an agent can be improved by using more computa- tion without additional data from the environment, thereby improving sample efficiency. However, learning accurate estimates of the model is hard. Subsequently, the natural question is whether we can get similar benefits as planning with model- free methods. Experience replay is an essential component of many model-free algorithms en- abling sample-efficient learning and stability by providing a mechanism to store past experiences for further reuse in the gradient computational process. Prior works have established connec- tions between models and experience replay by planning with the latter. This involves increasing the number of times a mini-batch is sampled and used for updates at each step (amount of replay per step). We attempt to exploit this connection by doing a systematic study on the effect of varying amounts of replay per step in a well-known model- free algorithm: Deep Q-Network (DQN) in the Mountain Car environment. We empirically show that increasing replay improves DQN's sample ef- ficiency, reduces the variation in its performance, and makes it more robust to change in hyperpa- rameters. Altogether, this takes a step toward a better algorithm for deployment. 1. Introduction Deep Reinforcement Learning (RL) has demonstrated its competence to solve sequential decision-making problems ranging from games (Mnih et al., 2015; Silver et al., 2016), simulated environments (Mnih et al., 2015; Schulman et al., 2015), finance (Rao & Jelvis, 2022), and robotics (Levine et al., 2016). These advancements have been achieved at the *Equal contribution 1Department of Computing Science, University of Alberta, Canada. Correspondence to: Ani- mesh Kumar Paul <[email protected]>, Videh Raj Nema <[email protected]>. cost of huge computational requirements and a large number of interactions with the environment. A promising approach to having sample efficient learning is to reuse valuable past experiences to limit the collection of new experiences from simulation or the real world. This need for sample efficiency can be handled by Experience Replay (Lin, 1992). Experience Replay (ER) has been widely adopted in deep Q-learning due to its data efficiency and the stability it in- duces (Mnih et al., 2015; Schaul et al., 2016; Hessel et al., 2018). ER works by storing the agent's experiences (tran- sitions) in a fixed-size buffer and sampling a mini-batch of them at each step to update the neural network (function approximator), thereby mixing the more and less recent ex- periences for learning. Several modifications of ER have been proposed in terms of non-uniform buffer sampling or experience re-weighting (Schaul et al., 2016; De Bruin et al., 2018; Sinha et al., 2022). There has also been some work on replaying experiences with a goal different from what the agent was trying to achieve to learn even from undesired outcomes (Hindsight ER (Andrychowicz et al., 2017)). The ER mechanism embeds several hyperparameters like the size of the buffer (capacity), the replay mini-batch size, the number of transitions to store before starting updates, and the amount of replay per step. Some noteworthy studies have been conducted to empirically measure the importance of tuning these hyperparameters across a variety of deep RL algorithms. For instance, it has been shown that the perfor- mance of deep RL algorithms degrades due to a large replay capacity (Zhang & Sutton, 2017). Further, it has also been identified that increasing the replay capacity and reducing the effect of the oldest policy in the buffer (transitions col- lect by that policy) improves the performance (Fedus et al., 2020). In this work, we attempt to investigate the variation in algorithm behavior due to a change in one of these hy- perparameters: the amount of replay per step. Typically, a mini-batch of transitions is sampled from the ER buffer only once per training step (Mnih et al., 2015). However, we can put a loop around this by sampling a mini-batch multiple times. This notion is referred to as the amount of replay per step or the replay frequency, where a replay frequency of τ implies sampling a mini-batch and using it to update the network parameters sequentially τ times per training step. The motivation for varying τ comes from the work done Understanding the effect of varying amounts of replay per step by van Hasselt et al. (van Hasselt et al., 2019), where they make connections between parametric models and ER. Model-based algorithms use models to plan, i.e. using more computation to improve the predictions and policies without consuming additional data in the form of new interactions with the environment. They argue that the experience stored in the ER buffer of a model-free algorithm (like DQN) can be similarly used to plan. They provide empirical evidence in Atari where Rainbow DQN (a variant of DQN (Hessel et al., 2018)) with experience planning (i.e. increased τ ) achieves better sample efficiency and faster learning than a model-based algorithm. However, they did not do a sys- tematic study investigating sample efficiency with different values of τ and their effect on the algorithm's sensitivity to other hyperparameters. We do this in our work. Varying τ can have interesting effects on DQN and its other hyperparameters. We investigate this hypothesis empirically in the Mountain Car environment (Moore, 1990). Our objec- tives are to investigate whether (1) increasing τ helps DQN learn faster and achieve better performance, (2) different τ have different effects on sample efficiency, and (3) increas- ing τ makes DQN less sensitive to other hyperparameters, thereby making it easier to choose their best values. 2. Background A Markov Decision Process (MDP) is defined by the tuple (S, A, R, P, γ), where S and A denote the state and action space respectively. R : S × A → R denotes the scalar reward function, P : S × S × A → [0, 1] is the state transition probability, where P (s(cid:48)|s, a) denotes probability of transitioning to state s(cid:48) from state s by taking action a. γ ∈ [0, 1) denotes the discount factor. The goal of the agent is to find a policy π : A × S → [0, 1] (π(a|s) is the probability of taking action a in state s) that maximizes the expected return Qπ(s, a) . = Eπ [r1 + γr2 + . . . |S0 = s, A0 = a] , where rk is the random variable of reward at time step k. Q-learning is an algorithm to achieve this by directly . learning the optimal action-value function Q∗(s, a) = maxπ Qπ(s, a) and deriving the policy from that (Watkins, 1989). The learning rule for Q-learning is given by Qt+1(s, a) = Qt(s, a) + α (cid:16) Z Q t − Qt(s, a) (cid:17) , Z Q t = r + γ max a(cid:48) Qt(s(cid:48), a(cid:48)), (1) where (s, a, r, s(cid:48)) denotes a transition from state s by taking action a to state s(cid:48) with reward r. Z Q t and α above denote the target and scalar learning rate respectively. Intuitively, Q- learning moves the Q-function estimates toward the target. Note that the subscript t above denotes the time step at which an update is made, which can be different from the time step at which the transition is collected. Q-learning is an off-policy algorithm, meaning it learns about the greedy policy but collects data using a different policy. To encourage exploration, one way to collect data is according to an (cid:15)-greedy policy that chooses a random action with probability (cid:15) and the greedy action with 1 − (cid:15). The learning rule in (1) updates the value of each (s, a) pair without affecting the values of other pairs. Hence there is no generalization of value from one pair to another even if the pairs are similar. This makes it unrealistic to directly use (1) for large state-action spaces. To address this issue, we need to turn to function approximation where we learn a parameterized Q-function with a fixed number of parameters and use it for all (s, a) pairs. 2.1. Deep Q-Network Deep Q-Network (DQN) is a deep learning version of Q- learning (Mnih et al., 2015). Here the Q-function is a neural network parameterized by θ, where Q(s, a; θt) is obtained by passing the state s into a network with parameters θt and one output for each action a. The DQN stochastic gradient descent update to θt is given by θt+1 = θt + α (cid:16) − Q(s, a; θt) ∇θQ(s, a; θt), (cid:17) Z DQN t Z DQN t = r + max a(cid:48) Q(s(cid:48), a(cid:48); θ−). (2) One difference from Q-learning here is that the target uses θ−, which are the parameters of the target Q-network. The target Q-network is a lagging copy of the online Q-network, which is refreshed after every C steps, i.e., θ− = θt at time step t, and then kept constant for the next C steps. Using a target network induces stability when learning with neural networks by creating a delay between the time target is computed and the time when parameters are updated. Another important component and difference of DQN from standard Q-learning is experience replay, which we discuss in more detail in the following section. 2.2. Experience Replay Experience Replay (ER) was introduced by (Lin, 1992). It is a constant-size buffer with capacity Ω and comprising the agent's experiences (transition tuples) at interaction time steps, i.e. ek = (sk, ak, rk+1, sk+1) at time step k. Note that a single transition tuple is sufficient to make updates according to (2). However, it is generally more effective to (randomly) sample a mini-batch of transitions (batch size B) from the buffer and use it to update Q-network parameters. Using an ER buffer provides multiple benefits (Mnih et al., 2015). First, it improves sample efficiency by using a par- Understanding the effect of varying amounts of replay per step ticular transition (sample) for multiple updates. Second and more importantly, it makes training more stable by random- izing the samples, thereby breaking correlations between consecutive samples. A typical implementation of the replay buffer involves stor- ing transitions at each time step and making room for new transitions by removing the old ones. This fixes the amount of time each transition spends in the buffer and helps to discard transitions from a very old policy, that might not be relevant to make the current update. The simplest strategy to sample transitions is sampling uniformly, i.e. each tran- sition has an equal probability of being sampled. However, this does not efficiently use transitions that might be the most effective for training. Other sophisticated approaches like Prioritized ER address this issue by sampling important transitions more frequently (Schaul et al., 2016). While prioritization may provide a better performance, in this work we adhere to focusing on uniform random sampling. We do so to observe the sole effect of increasing the replay frequency τ in a simpler setting while keeping other compo- nents of the algorithm intact. 3. Experimental Design In this section, we describe our environment setup, hyperpa- rameter choices, and other experimental details in order to understand and reproduce our results. 3.1. Environment setup We evaluate DQN in the Mountain Car environment (Moore, 1990). Our experiments are based on OpenAI Gym's im- plementation of Mountain Car with slight modifications (Brockman et al., 2016). The environment is formulated as an MDP having a two-dimensional continuous state space: position ∈ [−1.2, 0.6] and velocity ∈ [−0.07, 0.07]. Note that this is the state of the agent and not the environment. The action space consists of three discrete actions: accel- erate left (0), do not accelerate (1), and accelerate right (2). The goal of the agent (car) is to reach the top of the hill as soon as possible. However, it does not have enough power to accelerate up the hill and hence should accelerate backward to generate enough momentum to climb up. A reward of −1 per step is given to encourage the agent to finish the task fast. The default AIGym implementation ter- minates an episode after 200 steps. We modify this to 2000 steps to avoid misleading results due to aggressive episode cutoffs (Patterson et al., 2020). At the same time, we do not set it to infinity to avoid the agent getting stuck. 3.2. Experimental Setup Our objectives are to (1) assess the effect of increasing τ on the performance and sample efficiency of DQN in Mountain Car, and (2) understand the variety of behaviors produced by DQN with different τ values for different hyperparameter settings. For our experiments, we borrow terminology from (Patterson et al., 2020) where an agent refers to "a single entity learning and adapting over time", an algorithm refers to "a process producing a set of agents by specifying initial conditions and learning rules", and hyperparameters refer to "a scalar set of parameters affecting the agents produced by the algorithm". We fix the total number of environment interactions (steps) for each agent instead of episodes. Doing so ensures a fair evaluation as each agent receives the same amount of learning experience. We found N = 250, 000 steps good to evaluate if an agent reaches good performance and stably maintains it for some time. We use a discount factor γ = 0.99 for all our experiments. However, we use the undiscounted return as our perfor- mance metric since discounting is a part of the agent's internal mechanics and not the environment. Using the undiscounted return for Mountain car indicates how quickly the task is solved. Further, we measure online performance, i.e. how the agent performs while it is learning. Note that it needs to balance exploration and exploitation in such evalu- ation (Patterson et al., 2020). To measure performance at a particular step of learning, we use the undiscounted return for the episode containing that step. We do 30 runs for each τ , and each run corresponds to 250, 000 steps but differs in terms of the random seed (Q- network initialization and initial state of the agent). To fairly compare run i of two agents with different τ , we need to ensure that their seeds for run i are the same. We do so in the following way: • For the Q-network initialization, we randomly generate an array of seeds of length equal to the total number of runs and use the same array for each τ . • For the initial state of the agent, the AIGym environ- ment gets reinitialized every time a new episode starts inside a run. Hence we generate a large array of seeds to ensure that the same seed (initial state) is used for episode j inside run i for agents with different τ . Additionally, we use Xavier initialization to initialize the Q-network parameters (Glorot & Bengio, 2010). To achieve our first objective, we follow a simple strategy to set the hyperparameters for our experiments. We borrow most hyperparameter values of DQN in Mountain Car from an existing codebase1 and set the remaining ones using random search. We use these hyperparameters for all values of τ . The resulting setting of hyperparameters might not 1Link to the repository from which we took hyperparameters. Understanding the effect of varying amounts of replay per step be the best but is good enough to ensure a nearly-steady improvement in performance. We argue that doing this is appropriate since we want to assess how much better DQN can be made just by increasing τ for a system that might not be exhaustively tuned for the best hyperparameters. Our main entity of interest is τ and we assess the change in performance upon increasing τ while keeping other hy- perparameters fixed. We evaluate on τ = [1, 2, 4, 8, 16, 32], where τ = 1 corresponds to vanilla DQN. The maximum number of transitions that can be stored in the replay buffer (capacity Ω) is set to 4000 and the number of transitions sampled per update (batch size B) is set to 32. Further, at the beginning of each run, the initial policy collects and stores transitions for the first 1024 steps (replay start size) without making any updates to the Q-network. We set the replay start size to be much bigger than the batch size to ensure better randomization while sampling that breaks cor- relations between samples in early learning. If the replay start size is smaller, there is a higher probability to sample the most correlated recent transitions, which can result in a bad initial start and never recovering thereafter. To represent the Q-network, we use a neural network with two hidden layers of size 32 each and with the ReLU ac- tivation function. We refresh the parameters of the target Q-network every C = 128 steps and use a mean-squared loss to measure the difference between the DQN target and Q value. To optimize this loss function, we use the Adam op- timizer with learning rate α = 0.001, gradient momentum β1 = 0.9, and squared gradient momentum β2 = 0.999. Finally, we use an (cid:15)-greedy behavioral policy for explo- ration with (cid:15)initial = 1 at the start of a run, decayed to (cid:15)f inal = 0.1 with a decay rate (cid:15)decay = 0.999 and fixed thereafter. This roughly corresponds to annealing (cid:15) from 1 to 0.1 over 2300 steps. For our second objective, we do hyperparameter sensitivity analysis. Sensitivity plots help us understand changes in the behavior of algorithms and suggest sensitivity to hy- perparameters that is essential for deployment (Patterson et al., 2020). We pick 4 hyperparameters: learning rate, batch size, replay capacity, and the target network refresh rate. We chose these hyperparameters as we found them to be amongst the most important ones affecting DQN's performance. The range of tested values is specified in the next section. 4. Evaluation and Results As stated before, we care about online performance, which is measured at each step and equals the undiscounted return for the episode containing that step (Patterson et al., 2020). If an episode finishes with an undiscounted return of G, then every step of that episode has the same performance value, G. We refer to this as the performance measure. Figure 1. Performance distribution P(M ) with τ = 32 for 30 runs. To aggregate performance for a single run, we simply sum the performance measures at each step. To get a scalar aggregate performance value over multiple runs for each re- play frequency, we sum the aggregate performance for each run and divide it by the total number of steps times the total number of runs. Additionally, to get the mean performance curve, we average each step's performance measure over all the runs and do this for all steps. Note that we do not apply any kind of smoothing for the mean performance curve. For instance, it is possible to sum the performance measures till a particular step, divide the sum by the step index, and use that for plotting the mean curve (like a running average). In such a case, the curve becomes very smooth. However, we do not do this as it hides potentially important variations. Since individual runs can be different from each other de- pending on the seed initialization, we use the following techniques to measure the variability in performance (Pat- terson et al., 2020) along with the mean performance: • Confidence Interval: We use confidence intervals to measure the uncertainty in our estimated mean online performance. For computing it, we use the Student t-distribution, which requires the assumption of having an approximately Gaussian performance distribution. To validate this assumption in our case, we visualize the distribution over performance. We use a 95% con- fidence interval (α = 0.05) to report our uncertainty in our mean estimate. • Tolerance Interval: We use tolerance intervals to cap- ture the variation in the performance from a limited number of samples. We use a (α = 0.05, β = 0.9) tol- erance interval to examine the performance variability between multiple runs. The (α, β) values suggest that the interval contains at least 0.9 fraction of total runs with the confidence of 95%. Now we provide the empirical results2. First, we visualize 2We provide only the main empirical plots in this draft for 5004504003503002502001500.0000.0020.0040.0060.0080.010For Replay Frequency 32 Understanding the effect of varying amounts of replay per step (a) (d) (g) (b) (e) (h) (c) (f) (i) Figure 2. DQN performance in terms of confidence and tolerance intervals with different replay frequencies τ : (a, b, c) show the confidence intervals with mean performance for 30 runs and τ = (1, 8, 32) respectively. The curves (d, e, f) show the tolerance intervals with the mean performance for 30 runs and τ = (1, 8, 32) respectively. The curves (g, h, i) show the tolerance intervals with the median agent's performance for 29 runs and τ = (1, 8, 32) respectively. The y-axis denotes performance. No smoothing has been applied to the curves. the distribution of performance for DQN. Fig. 1 shows the approximate distribution for 30 runs with replay frequency τ = 32. This distribution is obtained by computing the aggregate performance for each run, dividing it by the total interactions, and plotting the frequency distribution. Hence a sample of this distribution corresponds to a run. Note that the resulting distribution is approximately Gaussian, which allows using the Student-t confidence intervals3. The x-axis contains the distribution between −472.57 and −183.51. This is because the aggregate performance for each run (sample) among the 30 runs was between these two values. We do not show the performance distribution for other τ values because they follow a similar behavior with the dif- ference that the distribution for larger τ values has a greater mean and lower variance estimate than smaller τ values. 4.1. Confidence Intervals The mean performances and confidence intervals for τ = (1, 8, 32) with 30 runs are shown in fig. 2 (a, b, c), respec- tively. The interval for τ = 1 is wider than τ = 8, which brevity. To see all plots, please check this drive link. 3We use t = 2.045 from the Student-t table for 30 runs. is wider than τ = 32 (when we say τ = i, we imply DQN with τ = i). This shows that with a higher replay frequency, we are more certain in our estimate of the mean. The three plots also show that τ = 32 learns faster than τ = 8, which learns faster than τ = 1, i.e. uses fewer samples. Note that agents with all replay frequencies eventually achieve good performance. However, a higher τ results in better sample efficiency. This confirms that using more computation per step with fixed data (from the replay buffer) results in faster learning for DQN in Mountain Car. Lastly, we make a few observations about stability with different τ values. From fig. 2 (a, b, c), we can observe that the mean performance is roughly stable for τ = (8, 32) after about 50, 000 learning steps (the same holds true for τ = (4, 16) but plots are not included for brevity). For τ = (1, 2), the mean starts to stabilize after 200, 000 and 150, 000 steps respectively. This shows that with a higher τ , not only does the agent reach good performance faster but also maintains that on average. The mean curves are still a little noisy because we do not apply any smoothing. 050000100000150000200000250000Learning Steps200017501500125010007505002500For Replay Frequency 1050000100000150000200000250000Learning Steps200017501500125010007505002500For Replay Frequency 8050000100000150000200000250000Learning Steps200017501500125010007505002500For Replay Frequency 32050000100000150000200000250000Learning Steps200017501500125010007505002500For Replay Frequency 1050000100000150000200000250000Learning Steps200017501500125010007505002500For Replay Frequency 8050000100000150000200000250000Learning Steps200017501500125010007505002500For Replay Frequency 32050000100000150000200000250000Learning Steps200017501500125010007505002500For Replay Frequency 1: Median agent(Run 26)050000100000150000200000250000Learning Steps200017501500125010007505002500For Replay Frequency 8: Median agent(Run 22)050000100000150000200000250000Learning Steps200017501500125010007505002500For Replay Frequency 32: Median agent(Run 27) Understanding the effect of varying amounts of replay per step 4.2. Tolerance Intervals Tolerance intervals summarize the range of an algorithm's performance, irrespective of the underlying performance distribution while taking into account the uncertainty due to a limited number of samples. To compute tolerance inter- vals, we use the method described in (Patterson et al., 2020). Fig. 2 (d-i) depict the tolerance intervals around the mean performance and around the median agent's performance. Fig. 2 (d, e, f) show the interval around the mean perfor- mance for τ = (1, 8, 32), respectively. Note that the interval is much wider for τ = 1 than for τ = 8. Further, the interval for τ = 32 is tighter than for τ = 8. This shows that with a higher τ , the variation in algorithm performance is low. The tolerance intervals also show the bottom percentile of runs which indicates that the worst-case performance of a higher τ (τ = 8, 32) is better than a lower τ (τ = 1). Fig. 2 (g, h, i) show the interval around the median agent's performance. The learning curve for the median agent is obtained by arranging the aggregate performances for the first 29 runs4 in increasing order, finding the median, and plotting the curve for the corresponding run index. Note that the learning curve for a higher τ even for an individual run (median here) is not very noisy and the performance increases and stays between −100 and −200 most of the time except for a few occasional drops (verified empirically). 4.3. Replay Frequency Curve To get a bigger picture of DQN performance with increas- ing replay frequency, we plot the aggregate performance against replay frequencies in fig. 3. The y-values denote the aggregate (online) performance across all 30 runs each with 250, 000 steps, which is computed using the method described in the second paragraph of section 4. The error bars are computed using Student-t confidence intervals and depict the uncertainty in the mean estimates. The curve indicates how well DQN with different replay frequencies performs, given a fixed number of interactions with the en- vironment. Hence greater y-values denote better sample efficiency. Note that the curve does not depict the final policy learned after training. The performance of the fi- nal policy is better than the average aggregate performance during training shown in the curve. As shown in fig. 3, vanilla DQN (τ = 1) performs the worst. When the replay frequency is increased to τ = 2 and τ = 4, the increase in mean performance estimate is large and the uncertainty reduces. However, after τ = 4, the change is not 4Having an even number of runs (30) requires averaging the middle two runs after arranging the aggregated runs in increasing order. However, the average is not representative of any single run and can hide the differences between the behavior of the individual runs. Hence we use 29 runs for the median. Figure 3. Comparison of different replay frequencies in terms of aggregate performance measure and error bar (computed using Student t-distribution) over 250, 000 interactions and 30 runs for DQN. The x-axis is on the log scale (base 2). very large. Interestingly, the mean and uncertainty estimates degrade slightly when moving from τ = 8 to τ = 16 but improve from τ = 16 to τ = 32. From τ = 4 onward, the confidence varies but is still more than τ = (1, 2). Even though aggregation hides the internal behavior of indi- vidual runs, fig. 3 helps find the suitable replay frequency for a given scenario. For instance, if we have computational constraints, we would prefer using τ = 4 because it pro- vides a good enough performance without a large increase in computation per step. However, if we care more about performance, we might trade 8 times more computation per step for an improvement in performance. 4.4. Hyperparameter Sensitivity Analysis In this section, we assess the variation in algorithm behavior when interpolating across different hyperparameters. For doing so, we use two-dimensional sensitivity curves where only one hyperparameter value is varied while keeping the others fixed (Patterson et al., 2020). Sensitivity to a hyperpa- rameter is assessed by how much the aggregate performance varies with a change in the hyperparameter value. Fig. 4 shows the curves for four DQN hyperparameters, each for τ = (1, 4). We choose τ = 4 to compare against vanilla DQN (τ = 1). Our choice of τ = 4 is justified by fig. 3. τ = 4 provides a middle ground between good performance and the computation spent per step. Moreover, the uncer- tainty in the mean estimate is the lowest for τ = 4. One objective of the sensitivity experiments is to see if the better sample efficiency of higher τ values is only for the above specific hyperparameter setting or does it apply to a wide range of hyperparameter values. Knowing this is essential, especially for algorithm deployment in scenarios where hyperparameter tuning can be expensive. Another ob- jective is to find the appropriate values of hyperparameters. 12481632Replay Frequency800700600500400300200Aggregate Performance (Averaged over all interactions and runs)Replay Frequency Curve Understanding the effect of varying amounts of replay per step (a) (c) (b) (d) Figure 4. DQN hyperparameter sensitivity curves for τ = (1, 4) with 30 runs: (a), (b), (c), and (d) show the sensitivity curve for learning rate, batch size, replay capacity, and target network refresh rate respectively. The error bars are computed using the Student-t distribution. The x-axis for all plots is on the log scale (base 2). As done for fig 3, we fix the total number of samples for each τ (30 runs each with 250, 000 interactions) and assess the aggregate performance with confidence estimates. 4.4.1. LEARNING RATE Fig. 4 (a) shows the curve for the learning rate α. We experi- ment with four values of α : (0.0001, 0.001, 0.01, 0.1). Our previous experiments used α = 0.001. For α = 0.0001, the learning is slow for both τ values. However, τ = 4 learns much faster than τ = 1. For α = (0.001, 0.01), the mean performance estimate for τ = 4 is higher than τ = 1. More- over, the uncertainty estimates are low with τ = 4 with the lowest for α = 0.001. For α = 0.1, both τ values result in worse performance. This is because a large α takes overly aggressive gradient steps resulting in the agents learning nothing. Finally, if we look at the first three values of α, τ = 4 is less sensitive (around the peak value at α = 0.001) to change in α than τ = 1, thereby making it relatively easier to choose an appropriate value of α for deployment. 4.4.2. BATCH SIZE Fig. 4 (b) shows the curve for batch size B. We experiment with eight values of B : (8, 16, 32, 64, 128, 256, 512, 1024). Our previous experiments used B = 32. Note that 1024 is the maximum value of B that we can get without changing any other hyperparameter. This is because we fixed the replay start size to 1024 and hence choosing B greater than that would require changing the start size. However, we do not increase the replay start size to observe the sole effect of changing B and to remain data efficient (van Hasselt et al., 2019). The curve for τ = 1 increases continuously with the peak mean performance at B = 1024. However, the uncertainty estimates of τ = 1 are very high for all values of B, thereby making it difficult to choose the appropriate value of B. On the other hand, τ = 4 is relatively less sensitive to a change in B and has better mean performance with low uncertainty, which lets us choose B = 32 that has the best mean performance and lowest uncertainty. One can argue that choosing a large value of B with τ = 1 may provide benefits similar to increasing τ . However, this is not true because for a large B, the worst value (lower 0.00010.0010.010.1Learning Rate20001750150012501000750500250Aggregate Performance (Averaged over all interactions and runs)Learning Rate Sensitivity Curve=1=481632641282565121024Batch Size120011001000900800700600500400300Aggregate Performance (Averaged over all interactions and runs)Batch Size Sensitivity Curve=1=40.5141020100200250Replay Capacity (×103)120011001000900800700600500400300Aggregate Performance (Averaged over all interactions and runs)Replay Capacity Sensitivity Curve=1=48321282565121024Target Network Refresh Rate11001000900800700600500400300Aggregate Performance (Averaged over all interactions and runs)Target Network Refresh Rate Sensitivity Curve=1=4 Understanding the effect of varying amounts of replay per step end of the confidence interval) of the mean estimate for τ = 1 is considerably lower than the worst value for τ = 4. Moreover, choosing a large B may not always be feasible due to memory constraints as it requires loading more sam- ples at each step (Stember & Shalu, 2021). Increasing B also requires more computation per step. We argue that it is instead wiser to spend more computation on increasing τ while keeping B small. This is clear from the curve for τ = 4 where B = (32, 64) are the best performing values. Along similar lines, it is interesting to compare τ = 1, B = 32 with τ = 4, B = 8. Both use 32 samples to make param- eter updates with the difference in the way they update. The first one uses all 32 randomly sampled transitions at once, while the second randomly samples 8 transitions and uses them to make an update, doing this sequentially four times at each step. It is clearly visible that the worst mean per- formance for the second is much better than the best mean performance for the first. This traces back to connections of replay with planning where putting a loop around the model-based update results in better performance without consuming additional data (van Hasselt et al., 2019). 4.4.3. REPLAY CAPACITY Fig. 4 (c) shows the curve for the replay capacity Ω. We experiment with eight different values of Ω : (0.5, 1, 4, 10, 20, 100, 200, 250) × 103. Our previous exper- iments used Ω = 4000. When Ω is too small, the life of a transition in the buffer reduces as it gets discarded to make room for new transitions. Hence the replay buffer contains more transitions from a recent policy. This can have a negative effect as there is less chance of breaking correlations between the transitions used for updates. When Ω is too large, the updates can use transitions from an old policy which can be distributed in parts of the state space irrelevant to solving the task. In the extreme case, Ω can be logically equal to the total number of interactions with the environment, in which case it will not forget any experience (250, 000 in our experiments). The curve shows that the performance is worst when Ω is rel- atively small. For τ = 4, Ω = (500, 1000) result in inferior performance with high uncertainty in the mean estimates. However, for Ω = 4000 and greater, the performance is less sensitive to a change in Ω with relatively low uncertainty. τ = 4 with Ω = 10, 000 gives the highest mean perfor- mance with the lowest uncertainty in the estimate. Note that the mean performance and uncertainty estimates of τ = 4 are better than τ = 1 for all Ω values, with the difference clearly visible for Ω less than 20, 000. For τ = 1, the mean performance increases till Ω = 20, 000, after which it degrades slightly. However, high uncertainty in the mean estimates makes it difficult to pick an appropriate value of Ω for τ = 1. It is interesting to note that the nature of the replay capacity sensitivity curve is quite different for τ = 1 and τ = 4. The same holds for the batch size sensitivity curve from the previous subsection. Ω, B, and τ all are hyperparameters of experience replay and they may be interacting with each other in a non-trivial manner. Our two-dimensional sensitiv- ity curves indicate a change in performance with variation in a single hyperparameter but do not capture interactions between multiple hyperparameters. It will be interesting to work on interacting hyperparameters in the future to get a deeper insight into the effects of increasing τ . 4.4.4. TARGET NETWORK REFRESH RATE Fig. 4 (d) shows the curve for the target network re- fresh rate C. We experiment with six values of C : (8, 32, 128, 256, 512, 1024). Our previous experiments used C = 128. The frequency with which the lagging target net- work is refreshed affects the stability and performance of DQN. When C is too small, the delay between the time when the target is computed and the time when parameters are updated decreases, thereby causing oscillations or diver- gence of policy. However, when C is too large, the target is computed using a very old policy that may be very differ- ent from the current policy, which may cause inconsistency in the parameter update. Our results agree with this: both τ = (1, 4) seem sensitive to a change in C with a worse performance when C is too small or too large. It is interesting that a small C has a milder effect on perfor- mance than a large C for τ = 4. On the other hand, both extremes of C result in similar performance drops for τ = 1. This hints that τ = 4 is able to handle non-stationary targets better than τ = 1. This might be because τ = 4 reuses the data more to improve the Q-network's approximation of the value function faster than τ = 1. Subsequently, refreshing the target network more frequently (small C) causes the target to become more accurate faster. When updating the parameters more frequently (τ = 4) with this better target, the drop in performance due to target oscillations is lesser. The highest mean performance occurs at C = 128 for τ = 4 and at C = 256 for τ = 1. However, the best value of C is not clear for τ = 1 because of the high uncertainty in the mean estimate. The uncertainty is high for all values of C for τ = 1 with the highest when C is small. For τ = 4, it is easy to pick the appropriate value of C: 128 is the best-performing value with relatively low uncertainty. 5. Conclusions In this work, we investigated how varying the replay fre- quency affects DQN's performance, sample efficiency, and sensitivity to hyperparameters in the Mountain Car environ- ment. To validate our hypothesis, we experimented with Understanding the effect of varying amounts of replay per step different replay frequencies, measured the variability in per- formance, and tested with different hyperparameter values. The empirical results suggest that (1) increasing τ results in better sample efficiency than vanilla DQN (τ = 1); (2) DQN with higher τ values generally gives better mean per- formance with tighter confidence and tolerance intervals; (c) higher τ makes DQN less sensitive to other hyperparam- eters, thereby easing the task of hyperparameter selection. Software code The https://github.com/animeshkumarpaul/IncreasingReplay. experiments available our of is at Acknowledgements We took the initial codebase from Dongmin repository. Thanks to Andy for sharing the code for tolerance inter- vals. References Andrychowicz, M., Wolski, F., Ray, A., Schneider, J., Fong, R., Welinder, P., McGrew, B., Tobin, J., Abbeel, P., and Zaremba, W. Hindsight experience replay. In Advances in Neural Information Processing Systems, 2017. Brockman, G., Cheung, V., Pettersson, L., Schneider, J., Schulman, J., Tang, J., and Zaremba, W. Openai gym, 2016. URL http://arxiv.org/abs/1606. 01540. cite arxiv:1606.01540. De Bruin, T., Kober, J., Tuyls, K., and Babuˇska, R. Experi- ence selection in deep reinforcement learning for control. Journal of Machine Learning Research, 2018. ISSN 15337928. Fedus, W., Ramachandran, P., Agarwal, R., Bengio, Y., Larochelle, H., Rowland, M., and Dabney, W. Revisiting fundamentals of experience replay. In 37th International Conference on Machine Learning, ICML 2020, 2020. ISBN 9781713821120. Glorot, X. and Bengio, Y. Understanding the difficulty of training deep feedforward neural networks. In Teh, Y. W. and Titterington, D. M. (eds.), AISTATS, vol- ume 9 of JMLR Proceedings, pp. 249–256. JMLR.org, 2010. URL http://dblp.uni-trier.de/db/ journals/jmlr/jmlrp9.html#GlorotB10. Hessel, M., Modayil, J., Van Hasselt, H., Schaul, T., Os- trovski, G., Dabney, W., Horgan, D., Piot, B., Azar, M., and Silver, D. Rainbow: Combining improvements in deep reinforcement learning. In 32nd AAAI Confer- ence on Artificial Intelligence, AAAI 2018, 2018. ISBN 9781577358008. doi: 10.1609/aaai.v32i1.11796. Levine, S., Finn, C., Darrell, T., and Abbeel, P. End-to- end training of deep visuomotor policies, 2016. ISSN 15337928. Lin, L.-J. Self-improving reactive agents based on reinforce- ment learning, planning and teaching. Machine Learning, 1992. ISSN 0885-6125. doi: 10.1007/bf00992699. Mnih, V., Kavukcuoglu, K., Silver, D., Rusu, A. A., Ve- ness, J., Bellemare, M. G., Graves, A., Riedmiller, M., Fidjeland, A. K., Ostrovski, G., Petersen, S., Beattie, C., Sadik, A., Antonoglou, I., King, H., Kumaran, D., Wier- stra, D., Legg, S., and Hassabis, D. Human-level control through deep reinforcement learning. Nature, 2015. ISSN 14764687. doi: 10.1038/nature14236. Moore, A. W. Efficient Memory-based Learning for Robot Control - Dissertation. Learning, 1990. ISSN 1932-7420. Patterson, A., Neumann, S., White, M., and White, A. Draft: Empirical Design in Reinforcement Learning. Journal of Artificial Intelligence Research, 1, 2020. Rao, A. and Jelvis, T. Foundations of Reinforcement Learning with Applications in Finance. Chapman and Hall/CRC, 1st edition, 2022. Schaul, T., Quan, J., Antonoglou, I., and Silver, D. Priori- tized experience replay. In 4th International Conference on Learning Representations, ICLR 2016 - Conference Track Proceedings, 2016. Schulman, J., Levine, S., Moritz, P., Jordan, M., and Abbeel, P. Trust region policy optimization. In 32nd International Conference on Machine Learning, ICML 2015, 2015. ISBN 9781510810587. Silver, D., Huang, A., Maddison, C. J., Guez, A., Sifre, L., Van Den Driessche, G., Schrittwieser, J., Antonoglou, I., Panneershelvam, V., Lanctot, M., Dieleman, S., Grewe, D., Nham, J., Kalchbrenner, N., Sutskever, I., Lillicrap, T., Leach, M., Kavukcuoglu, K., Graepel, T., and Hassabis, D. Mastering the game of Go with deep neural networks and tree search. Nature, 2016. ISSN 14764687. doi: 10.1038/nature16961. Sinha, S., Song, J., Garg, A., Ermon, S., Firoozi, R., Mehr, N., Yel, E., Antonova, R., Bohg, J., Schwa- ger, M., and Kochenderfer, M. Experience Replay with Likelihood-free Importance Weights, may 2022. ISSN 2640-3498. URL https://proceedings. mlr.press/v168/sinha22a.html. Stember, J. N. and Shalu, H. Deep reinforcement learn- ing with automated label extraction from clinical re- ports accurately classifies 3d MRI brain volumes. CoRR, abs/2106.09812, 2021. URL https://arxiv.org/ abs/2106.09812. Understanding the effect of varying amounts of replay per step van Hasselt, H., Hessel, M., and Aslanides, J. When to use parametric models in reinforcement learning? In Ad- vances in Neural Information Processing Systems, 2019. Watkins, C. J. C. H. Learning from Delayed Rewards. PhD thesis, King's College, Oxford, 1989. Zhang, S. and Sutton, R. S. A Deeper Look at Experience Replay. dec 2017. doi: 10.48550/arxiv.1712.01275. URL https://arxiv.org/abs/1712.01275v3.
http://arxiv.org/abs/2302.10298v1
2023-02-20T20:41:31
2023-02-20T20:41:31
Quantum Machine Learning hyperparameter search
This paper presents a quantum-based Fourier-regression approach for machine learning hyperparameter optimization applied to a benchmark of models trained on a dataset related to a forecast problem in the airline industry. Our approach utilizes the Fourier series method to represent the hyperparameter search space, which is then optimized using quantum algorithms to find the optimal set of hyperparameters for a given machine learning model. Our study evaluates the proposed method on a benchmark of models trained to predict a forecast problem in the airline industry using a standard HyperParameter Optimizer (HPO). The results show that our approach outperforms traditional hyperparameter optimization methods in terms of accuracy and convergence speed for the given search space. Our study provides a new direction for future research in quantum-based machine learning hyperparameter optimization.
[ "S. Consul-Pacareu", "R. Montaño", "Kevin Rodriguez-Fernandez", "Àlex Corretgé", "Esteve Vilella-Moreno", "Daniel Casado-Faulí", "Parfait Atchade-Adelomou" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10298v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10298v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "quant-ph" ]
3 2 0 2 b e F 0 2 ] G L . s c [ 1 v 8 9 2 0 1 . 2 0 3 2 : v i X r a Quantum Machine Learning hyperparameter search S. Consul-Pacareu,1 R. Monta ̃no,2 Kevin Rodriguez-Fernandez,2 `Alex Corretg ́e,2 Esteve Vilella-Moreno,1 Daniel Casado-Faul ́ı,1 and Parfait Atchade-Adelomou1, 3, 4 1Lighthouse Disruptive Innovation Group, LLC, 7 Broadway Terrace, Apt 1, Cambridge MA 02139, Middlesex County, Massachusetts (USA) ∗ 2Vueling Airlines S.A. Carrer de Catalunya, 83 Edifici Brasil 08840 Viladecans Spain 3Smart Society Research Group - La Salle - Universitat Ramon Llull, Carrer de Sant Joan de La Salle, 42, 08022 Barcelona (Spain) † 4MIT Media Lab - City Science Group, Cambridge, USA (Dated: Feb 2023) This paper presents a quantum-based Fourier-regression approach for machine learning hyperpa- rameter optimization applied to a benchmark of models trained on a dataset related to a forecast problem in the airline industry. Our approach utilizes the Fourier series method to represent the hyperparameter search space, which is then optimized using quantum algorithms to find the opti- mal set of hyperparameters for a given machine learning model. Our study evaluates the proposed method on a benchmark of models trained to predict a forecast problem in the airline industry us- ing a standard HyperParameter Optimizer (HPO). The results show that our approach outperforms traditional hyperparameter optimization methods in terms of accuracy and convergence speed for the given search space. Our study provides a new direction for future research in quantum-based machine learning hyperparameter optimization. KeyWords: Quantum Computing, Quantum Machine Learning, Fourier Series, QML, Hyperpa- rameters, Interpolation, Regression model, quantum search problem I. INTRODUCTION In recent years, Machine Learning (ML) algorithms have successfully solved various tasks, reaching state-of-the- art in multiple areas [1–7]. This is not only due to the development of new algorithms (more powerful and prominent), but also the selection of good hyperparam- eters contributed to this advance. Performing machine learning on large datasets is a resource-intensive task, but hyperparameter tuning problem [8, 9] increases those resource requirements by orders of magnitude. Despite advances in hyperparameter optimization, the precise se- lection of hyperparameters remains a challenge regarding computational complexity and finding the best approach. Therefore, the scientific community has been working to discover efficient techniques to solve this challenge [9–14]. Due to its stochastic nature and great computational ca- pacity, quantum computing is a great bet and approach to take into account in the efficient search problems of hyperparameters. In this article, we propose a hybrid (quantum + clas- sical) approach algorithm to facilitate this task by fit- ting and executing Fourier-regression models on a large scale on any type of hyperparameters in the most effi- cient way possible. Our proposed quantum algorithm is based on this work [15], which allows us to find the best hyperparameters using a quantum approach, given a good enough representation of the search space (or hy- perparameter space) represented by the model hyperpa- rameters related to a metric. The model was trained ∗ [email protected][email protected] based on the results offered by multiple search methods, such as Grid search, Random Search and Bayes-Based Search for a given training set from a Vueling forecast problem dataset. Three-way cross-validation considers each search algorithm's average scores during the train- ing process. The proposed quantum method provides the best score in time compared to classically, assuming that the hyperparameter/score input search space is highly nonlinear and might not be continuous. The trade-off between speed and precision depends on the number of features to evaluate. We use Pennylane framework and AWS Braket to validate our algorithm. The document is organized as follows. Section (II) presents our primary motivation behind this work. Sec- tion (III) shows previous work on hyperparameters tun- ing. Section (IV) illustrates the quantum machine learn- ing framework and its connection to the hyperparameters tuning problems. In the section (V), we propose the sce- narios and the models we will implement to tackle the hy- perparameters tuning problems. Section (V C) proposes our model, considering our primary reference. Section (VI) delivers the obtained results. Section (VI D) dis- cusses practically relevant results and their implications. Finally, this paper ends with conclusions and future work in Section (VII). II. MOTIVATION AND PROBLEM STATEMENT The aviation industry is highly competitive, and one of the key factors for airlines to remain profitable is to max- imize revenues while minimizing costs. To that effect, many of them are adopting advance analytics solutions to transform the company towards that goal. Solutions range from classical machine learning problems such as a predictive maintenance [16] or dynamic pricing [17], to optimization problems such as network optimization [18, 19]. Nonetheless, optimization problems are compu- tationally expensive and, in most cases, classical comput- ing falls short in yielding a reasonable processing time. This also applies to machine learning hyperparameter op- timization. Vueling has been implementing and using production state-of-the-art hyperparameter tuning algorithms to achieve high-accuracy results. However, the company is aware of the potential advancements in the field of quan- tum computing and wishes to stay ahead of the curve. With this in mind, Vueling is proactively exploring ways to incorporate quantum technology into its technology stack to remain at the forefront of its industry and en- sure long-term success. One of the critical taks in the airline industry is manag- ing passenger no-shows. A no-show occurs when a pas- senger who has purchased a ticket fails to show up for the flight. The data used in this work is a proprietary Vuel- ing no-show dataset, that contains crucial information for understanding and predicting passenger behavior. The dataset contains as target data the number of no- shows per flight and contains 252 183 datapoints with 42 features each, such as flight information (origin, destina- tion, time of flight, etc.), seat reservation status, mean no-shows for different time windows on a given route, number of tickets at different price points as well as other proprietary information. The dataset and the predicting models created allow the company to track performance over time, evaluate the ef- fectiveness of different strategies, and make data-driven decisions that can improve overall performance and prof- itability. The scope of this work is not to solve the specific no- show prediction problem but to use real-life data to im- plement a Quantum Fourier hyperparameter tuning algo- rithm that rivals traditional techniques. In short, show- ing an efficient and useful alternative for such optimiza- tion problems. III. WORK CONTEXT Machine learning is used in various fields and areas, al- lowing computers, among other uses, to identify patterns in large data and make predictions. Such a process in- volves, after all, determining the appropriate algorithm based on a sample space and obtaining an optimal model architecture by adjusting some control variables from its learning process known as Hyperparameters (HP). Thus, these hyperparameters must be tuned to adapt a ma- chine learning model to different problems and datasets. Selecting the best hyperparameters for machine learning models directly impacts model performance. It often re- quires a thorough understanding of machine learning al- 2 gorithms and appropriate hyperparameter optimization techniques. Although there are several automatic opti- mization techniques, they have different advantages and disadvantages. In contrast, parameters are internal to the model. They are learned or estimated solely from the data during training since the algorithm attempts to understand the mapping between input features and target. Model training usually starts with initializing the param- eters to random values. As training/learning progresses, the initial values are updated using an optimization al- gorithm (e.g., gradient descent). The learning algorithm continually updates the parameter values as training con- tinues, but hyperparameter values remain unchanged. At the end of the learning process, the model parameters constitute the model itself. These steps inspired the sci- entific community to develop a research field known as Hyperparameters Optimization (HPO) [12, 14]. The pri- mary aim of this field is to automate the hyperparam- eter tuning process and enable users to apply machine learning models to practical problems (efficiently, reduc- ing computation time and improving performance). In our previous works [20–22], we proposed optimization algorithms that can be used to solve HPO problems with continuous functions, discrete functions, categorical vari- ables, convex or non-convex functions, etc. Next, we re- view some of them to highlight their limitations to find solutions. Grid search (GS) [23–25] is a decision-theoretic approach [26] that exhaustively searches for a fixed domain of hy- perparameter values. GS is one of the most used strate- gies due to its simplicity of implementation. This algo- rithm discretizes the search space to generate a set of possible hyperparameter configurations. Then, it evalu- ates each of these configurations and selects the one with the highest performance. GS's main limitation is that it takes time and is affected by the dimensionality curse [24]. Therefore, it is not suitable for a large number of hyperparameters. Moreover, GS often needs help finding the global optimum of continuous parameters because it requires a predefined and finite set of hyperparameter values. It is also unrealistic for GS to identify continuous integer hyperparameter optima with limited time and re- sources. Therefore, compared to other techniques, GS is only effective for a small number of categorical hyperpa- rameters [24]. Random search (RS) [24, 27, 28] is a variant of Grid Search and attempts to solve the above problem by ran- domly sampling configurations of the search space. As it does not have an implicit end condition, the number of sampled structures to be evaluated will be chosen. RS samples the search space and evaluates sets from speci- fied probability distributions. In short, it is a technique in which the hyperparameters' random combinations are used to find the best solution for the model under con- sideration. RS is more efficient than GS and supports all domains of hyperparameters. In practical applica- tions, using RS to estimate randomly chosen hyperpa- rameter values helps analysts explore an ample search space. However, since RS does not consider the results of previous tests, it may include many unnecessary eval- uations that reduce its performance. Hyperband [29] is considered an improved version of Ran- dom Search [9]. Hyperband balances model performance and resource usage to be more efficient than RS, espe- cially with limited time and resources [30]. However, GS, RS, and Hyperband have a significant limitation: they treat each hyperparameter independently and do not consider hyperparameter correlations [13]. There- fore, they will be inefficient for ML algorithms with con- ditional hyperparameters, such as Support Vector Ma- chine (SVM) [31], Density-Based Spatial Clustering of Applications with Noise (DBSCAN) [32, 33], and logistic regression [34, 35]. Gradient-based algorithms [36, 37] are not a predom- inant choice for hyperparameter optimization because they only support continuous hyperparameters and can only find a local, not global, optimum for non-convex HPO problems. Therefore, gradient-based algorithms can only optimize specific hyperparameters, such as the learning rate in Deep Learning (DL) models [38]. Based on their surrogate models, the Bayesian optimiza- tion (BO) [39] models, BO based on Gaussian Process (GP) [40, 41] and its derivatives, are divided into three different models. BO algorithms determine the next hy- perparameter value based on previously evaluated results to reduce unnecessary evaluations and improve efficiency. BO-GP mainly supports continuous and discrete hyper- parameters but does not support conditional hyperpa- rameters [30]. At the same time, Sequential Model Al- gorithm Configuration (SMAC) [30] and Tree-Structured Parzen Estimator (BO-TPE) [42] can handle categori- cal, discrete, continuous, and dependent hyperparame- ters. SMAC performs best using many categorical and conditional parameters or cross-validation, while BO-GP performs best with only a few continuous parameters. BO-TPE preserves some dependent relationships, so one of its advantages over BO-GP is its native support for some conditional hyperparameters [30]. The Metaheuristic algorithms [43], including Genetic Al- gorithm (GA) [44] and Particle Swarm Algorithm (PSO) [45], are more complex than other HPO algorithms but they often work well for complex optimization problems. They support all hyperparameters and are particularly efficient for large configuration spaces because they can obtain near-optimal solutions in several iterations. How- ever, GA and PSO have their advantages and disadvan- tages in practice. The main advantage of PSO is that it can support large-scale parallelization and is exception- ally suitable for continuous and conditional HPO prob- lems. At the same time, GA runs sequentially, which makes parallelization difficult. Thus, PSO often runs faster than GA, especially for large configuration spaces and data sets. However, good population initialization is essential for PSO; otherwise, it may converge slowly and only identify a local optimum rather than a global 3 one. Regardless, the impact of a good population ini- tialization is less significant for GA than for PSO [45]. Another limitation of GA is that it introduces additional hyperparameters, such as its population size and muta- tion rate [44]. Quantum computing [20, 46, 47] is a field of computa- tion that uses quantum theory principles. A quantum computer is a stochastic machine that uses the laws of quantum mechanics to do computation. Due to the char- acteristics of HPO problems, quantum computing is an excellent ally to seek a paradigm shift and accelerate or find an efficient strategy to apply to them. There are focus on using quantum computing in optimizing hyper- parameters. In [48], the authors employed a quantum genetic algo- rithm to address the hyperparameter optimization prob- lem. The algorithm is based on qudits instead of qubits, allowing more available states. Experiments were per- formed on two MNIST and CIFAR10 datasets, and re- sults were compared against classic genetic algorithms. In [11], the authors presented a quantum-inspired hyperparameter optimization technique and a hybrid quantum-classical machine learning model for supervised learning. They compared their hyperparameter opti- mization method to standard black box objective func- tions. They observed performance improvements in the form of reduced expected execution times and suitabil- ity in response to growth in the search space size. They tested their approaches in a car image classification task and demonstrated a large-scale implementation of the hy- brid quantum neural network model with tensor train hy- perparameter optimization. Their tests showed a qual- itative and quantitative advantage over the correspond- ing standard classical tabular grid search approach used with a ResNet34 deep neural network. The hybrid model achieved a classification accuracy of 0.97 after 18 itera- tions, while the classical model achieved an accuracy of 0.92 after 75 iterations. This last work had an exciting approach that only contemplates discrete hyperparame- ters. We have also found some exciting work dealing with HPO [10, 48–50]. In the latter [50], the authors took the first steps toward Automated Quantum Machine Learn- ing (AutoQML). They proposed a concrete problem de- scription and then developed a classical-quantum hybrid cloud architecture that allows for parallelized hyperpa- rameter exploration and model training. As an applica- tion use-case, they train a quantum Generative Adver- sarial neural Network (qGAN) to generate energy prices that follow a known historic data distribution. Such a QML model can be used for various applications in the energy economics sector. The SWOT of the hyperparameter optimization is sum- marized in Table I. After exploring the state of the art of classical and quantum hyperparameter tuning, we have yet to find a generic model that solves the domain's types of hyperparameters and reduces the search time for said hyperparameters in this quantum era. Table I. The Benchmark of the standard HPO algorithms (n is the number of hyperparameter values and k is the number of hyperparameters) HPO Methods Strengths Limitations Time Complexity 4 GS RS simple Time-consuming Only efficient with categorical More efficient than GS Not consider previous results. Enable paralellization Not efficient with conditional Gradient-based Fast convergence for continuous HPs. BO-GP Fast convergence for continuous HPs. Only support continuous HPs. May only detect local optimums. Poor capacity for parallelization. Not efficient with conditional HPs. O(nk ) O(n) O(nk ) O(n3) Hyperband Enable paralelliization GA PSO Efficient with all types of HPs Not require good initialization Efficient with all types of HPs Enable paralellization Not efficient with conditional HPs. O(nlogn) Require subsets with small budgets Poor capacity for parallelization. O(n2) Require proper initialization. O(nlogn) IV. QUANTUM MACHINE LEARNING Quantum machine learning (QML) [51–53] explores the interplay and takes advantage of quantum computing and machine learning ideas and techniques. Therefore, quantum machine learning is a hybrid system involving both classical and quantum processing, where computationally complex subroutines are given to quan- tum devices. QML tries to take advantage of the clas- sical machine learning does best and what it costs, such as distance calculation (inner product), passing it onto a quantum computer that can compute it natively in the Hilbert vector space. In this era of large classical data and few qubits, the most common use is to design ma- chine learning algorithms for classical data analysis run- ning on a quantum computer, i.e., quantum-enhanced machine learning [53–59]. Quantum circuits are mathematically defined as opera- tions on an initial quantum state. Quantum computing generally makes use of quantum states built from qubits, that is, binary states represented as |ψ(cid:105) = α |0(cid:105) + β |1(cid:105). Their number of qubits n commonly defines the states of a quantum circuit, and, in general, the circuit's initial state |ψ(cid:105)0 is the zero state |0(cid:105). In general, a quantum circuit implements an internal unit operation U to the initial state |ψ(cid:105)0 to transform it into the final output state |ψ(cid:105)f . This gate U is wholly fixed and known for some algorithms or problems. In contrast, others define its internal functioning through a fixed structure, called Ansatz[60] (Parametrized Quantum Circuit (PQC)), and adjustable parameters θ [61]. Parameterized circuits are beneficial and have interesting properties in this quan- tum age since they broadly define the definition of ML and provide flexibility and feasibility of unit operations with arbitrary precision [62–64]. Figure (1) depicts the concept of hybrid computing (quantum + classical), which characterizes the NISQ era. This takes advantage of quantum computing's capacity to solve complex problems and the experience of clas- sical optimization algorithms (COBYLA[65], SPSA[66], BFGS[67], etc.) to train variational circuits. Classical al- gorithms are generally an iterative scheme that searches for better candidates for the parameters θ at each step. The value of the hybrid computing idea in the NISQ era is necessary because it allows the scientific community to exploit both capacities and reaps the benefits of the con- stant acceleration of the oncoming quantum-computer development. Furthermore, learning techniques can be improved by embedding information (data) into the variational circuit through the quantum gate U [53, 68]. The Variational Quantum Circuit (VQC) [69, 70] con- sists of a quantum circuit that defines the base structure similar to neural network architecture (Ansatz), while the variational procedure can optimize the types of gates (one or two-qubit parametric gates) and their free parameters. The usual supervised learning processes within quantum machine learning can be defined as follows: • Quantum Feature Map: It is the data preparation. In the literature, this stage is recognized as State preparation. • The Quantum model : It is the model creation. In the literature, it is recognized as unitary evolution. • The classical error computation : It is the stage of Computing the error where the model best ap- proximates the input set; in machine learning, this stage is known as the prediction. V. IMPLEMENTATION As aforementioned, our proposal is based on HPO. Math- 5 the parameterized variable. From this point and considering equation (1), we will find the minimum of (2). In the next step, according to figure (4), let β and (cid:126)θ be the parameters that define our function f ((cid:126)x) from equa- tion (2). In this stage, we consider these parameters as constant inputs (we do not vary them). Now let V(cid:126)θ,β((cid:126)x) be the new circuit that can be an instantiation of the pre- vious circuit (U ((cid:126)x, β, (cid:126)θ)), and let us execute the gradient of the said quantum circuit (f ((cid:126)x)). The outcome of these operations will yield the optimal value of f ((cid:126)x), and the arguments for this operation will be the best hyperpa- rameters we look for. The variable (cid:126)x will have the same dimension as the best hyperparameters we are finding. From the variational principle [73], the following equa- tion (cid:104)Vβ,(cid:126)θ((cid:126)x)(cid:105)ψ(−→γ ) ≥ λi can be reached. With λi as eigenvector and (cid:104)Vβ,(cid:126)θ((cid:126)x)(cid:105)ψ(−→γ ) as the expected value. In this way, the VQC (Figure (1)) finds (3) such an opti- mal choice of parameters −→γ , that the expected value is minimized and that a lower eigenvalue is located. (cid:104)V(cid:126)θ,β((cid:126)x)(cid:105) = (cid:104)ψ (γ) |V(cid:126)θ,β((cid:126)x)|ψ (γ)(cid:105) (3) Where V(cid:126)θ,β((cid:126)x) ≈ f ((cid:126)x). A. DATASET GENERATION The proposed quantum hyperparameter process is sum- marized in three stages. The first stage is the dataset gen- eration, the second is finding the function that represents quantum-based Fourier regression, and the third is find- ing the minimum of the regression function. This section deals with dataset generation and criteria-the following subsection details all the experiment steps. To imple- ment the proposed algorithm, we generate one dataset per machine learning model regarding the original Vuel- ing dataset considering its hyperparameters evaluating different search methods, as well as Grid search, Ran- dom Search and Bayes-Based Search. We train the N ML models with the Vueling dataset to obtain a new reduced dataset. Three-way cross- validation is used during the training process. Therefore, for each set of hyperparameters, the model is trained three times and keeps the average of the three as the value to be predicted by the quantum system. If more precision is needed, the generated dataset should have more elements. Instead of precision, whether the speed is prioritized at the expense of its precision, the number of features of the dataset should be considerably less than the number of features of the original dataset. The resulting dataset size is reduced so as not to end up doing a quantum Grid Search. The new databases are stored in dataframes using Pandas. Figure 1. Variational Quantum Algorithm (VQC) working principle based on the quantum variational circuit. The quan- tum circuit computes the objective function, and the classical computer computes the circuit parameters. We can use this model to find the minima or the maxima of a given param- eterized function that is our quantum circuit. Our quantum circuit will be separated into two large blocks: the Feature Map and the Variational Quantum Circuit [71]. ematically, we can formulate it as follows: Since a model's performance on a validation set can be modeled as a func- tion f : X → R of its hyperparameters (cid:126)x ∈ X. With X the hyperparameters' space and where f can be any error function, such as the RMSE in a regression prob- lem or the AUC Score for a classification problem. The problem that the HPO must solve is to find (cid:126)x such that (cid:126)x ∈ argmin(cid:126)x∈X f ((cid:126)x). Formally we can define our problem as follows. Let f ((cid:126)x) be our objective function with (cid:126)x as the vector of all the classical input hyperparameters, and we are willing to find the best combination by writing it down as: (cid:126)x∗ ≈ arg min (cid:126)x∈X f ((cid:126)x), (1) In the optimization context, f (x) is the objective func- tion to be minimized, where (cid:126)x∗ is the hyperparameter configuration that produces the optimum value of f ((cid:126)x), and a hyperparameter (cid:126)x can take any value in the search space X. The first step of our algorithm will be to find the func- tion f ((cid:126)x) that generalizes our data. So, let us define our quantum model as follows: f ((cid:126)x) := (cid:104)0| U †((cid:126)x, β, (cid:126)θ)σzU ((cid:126)x, β, (cid:126)θ) |0(cid:105) , (2) Where σz is our observable, U ((cid:126)x, β, (cid:126)θ) the parameterized circuit with the input data (cid:126)x, β our scaling factor and (cid:126)θ, 6 Figure 2. This block diagram presents our approach of a generic hyperparameter tuning with quantum computing-based gradient descent or Adam optimizer [72]. The first block allows us to normalize all inputs to 0 and π. Then for the categorical variables, to save on the number of qubits, we encode the categorical variables in binary and map them over the number of qubits that our model has. The next block allows us to pack all the input variables into a single vector. Each variable is equivalent to a dimension of our vector. If the categorical variable is coded with m dimensions, these m dimensions will be directly mapped to the vector. Having the input vector, we now embed the data in the quantum computer thanks to our Feature Map function. Said function will map our input variable continuously, with the help of our parameterized gates, RX, RY , and RZ. From here, we apply our quantum circuit. After the measurement, we must undo the previous operations in reverse order to recover our input hyperparameters. 6. We train a Quantum-Coding System plus the best U ((cid:126)x, β, (cid:126)θ) found to the predict best hyperparame- ters. 7. We get the best set of hyperparameters by using Quantum Computer. 8. We go back to the classical model and re-train it with the best hyperparameters. Classically there is a process Classical process with its executing time Tc, and from quantum computing, there is a process Quantum process with its executing time Tq(translation) + Tq(solution). We will only get a time advantage if: Tc > [Tq(translation) + Tq(solution)]. Why Tq(translation)? because quantum computers only execute quantum data, so we must translate all the data we got from the classical domain into the quantum one. To test the proper functioning of our algorithm, we design five cases (A, B, C, D, and E), respectively, equivalent to the layer number of the variational algorithm (1, 2, 3, 4, and 5). C. OUR QUANTUM MODEL Based on [15], we propose the hybrid model and strategy from figures (2), (3) and (4) to tackle the generic HPO and reduce the search and analyzing time. VI. RESULTS Figures (5) to (7) show the results of the process we follow to achieve our goal. It can be observed in Figure (6) how the quantum model is molded into the shape of the data, defining a mesh that represents the continuous function, which is used to find the best hyperparameters. We have tested the proposed algorithm and steps with various models and techniques and generated several databases and experiments. The detailed results of each experiment can be seen in the tables (III), (IV), (V), and Figure 3. We use this model based on Fourier series in quantum machine learning [15]. Depending on some scal- ing β parameters and the input data (cid:126)x, the Feature Map will be in charge of coding our data. We rely heavily on the fact that the Feature Map (F ((cid:126)x, β)) must be variational, that the data's loading is repeated in all the layers, and that the variational circuit (V ((cid:126)θ)) searches with the help of the input parameters for the best function within the space of functions that defines the capacity of the variational circuit (U ((cid:126)x, β, (cid:126)θ) = F ((cid:126)x, β)V ( (cid:126)θ)). This configuration will efficiently approximate our given dataset to a continuous function f ((cid:126)x). B. EXPERIMENTS STEPS The scenario is given in Figure (4), and the proposed process to validate our experimentation is summarized as follows: 1. From the database that contains 252, 183 data- points with 42 features each, we generate a set ([n]) of randomly chosen hyperparameters. 2. We train n models with these hyperparameters. Get [n] scores (accuracy, r2, MSE, etc.) and record the dataset. 3. We transform the categorical hyperparameters into linear variables according to figure (2). 4. We transform this dataset into a Quantum Space for the native quantum algorithm. 5. We find the best U ((cid:126)x, β, (cid:126)θ) according to figure (3). Table II. This table represents the space's configuration for the hyperparameters and classical models that were tested in this work. ML Model Hyperparameter Type Search Space 7 Random Forest Classifier n estimators Discrete [5 - 250] max depth Discrete [1 - 50] min samples split Discrete [1 - 10] min samples leaf Discrete [1 - 10] criterion Categorical ['gini', 'entropy', 'ROC'] max features Discrete [1 - 64] SVM Classifier C kernel Continuous [0.1,50] Categorical ['linear', 'poly', 'rbf', 'sigmoid'] KNN Classifier n neighbors Discrete [1,20] Random Forest Regressor SVM Regressor n estimators Discrete [5 - 250] max depth Discrete [1 - 15] min samples split Discrete [1 - 7] min samples leaf Discrete [1 - 8] criterion Categorical ['mse', 'mae' 'absolute error' 'friedman mse' ] max iter Continuous [1000 - 500000] kernel epsilon Categorical ['linear', 'poly', 'rbf', 'sigmoid'] Continuous [0.0001 - 1] max iter Discrete [1 - 1000] HistGradientBoostingRegressor learning rate Discreto [0.01 - 1] max bin Discreto [31 - 255] loss Categorical [ 'squared error' 'absolute error' 'poisson' 'quantile' ] max iter Discrete [1000 - 500000] Ridge solver alpha Categorical ['svd', 'cholesky', 'lsqr', 'sparse cq', 'sag' ] Continuous [0.0001 - 1] Decision Tree Regressor solver Categorical ['mse', 'mae' 'absolute error' 'friedman mse' 'poisson' ] max depth Discrete [1 - 100] ccp alpha Continuous [0.0 - 1] (VI). In addition, we have carried out some comparative studies that can be seen in Figures (8) to (12). A. 2 Hyperparameters From the database that contains 252, 183 datapoints with 42 features each, we generate the database for the His- togram Gradient Boosting Regression. The result of our algorithm by using Histogram Gradient Boosting Regres- sion, precisely a lightGBM implementation and execut- ing the following tests will be shown in three hyperpa- rameters' configurations (2, 3, and 4). In the case of 2 Hyperparameters: max iteration, we obtain the following outcomes: learning rate and • Testing classically with the full database with 240 training samples took 6 minutes 6 seconds, with R2 train = 0.464 and R2 result for the R2 test = 0.388. • Now, executing our quantum algorithm for find- ing the best hyperparameters using the prepared dataset (70 samples) took only 4 minutes and 43 seconds to find the best hyperparameters with R2 score = 0.444. B. 3 Hyperparameters In the case of 3 Hyperparameters: learning rate, max iteration, and loss, we obtain the following out- comes: • Testing classically with the full database with 480 training samples took 11 minutes 36 seconds, with R2 result for the R2 test = 0.388. train = 0.464 and R2 • By creating a subset with only 35 samples, that took 53 seconds to be created and having the R2 = 0.382. • By creating a subset with only 70 samples, that took 1 minute 38 seconds to be created and having the R2 = 0.382. • Now, executing our quantum algorithm for find- ing the best hyperparameters using the prepared dataset (35 samples) took only 1 minute and 56 8 Figure 4. This graph shows the steps followed to achieve our goal. First, we generate a set ([n]) of randomly chosen hyper- parameters and then train n models with these hyperparame- ters. From the latter process, we get [n] scores (accuracy, r2, MSE, etc.) and record the dataset. Next, we transform the categorical hyperparameter into linear variables according to figure (2). From this point, we transform this dataset into a Quantum Space for the native quantum algorithm. Hav- ing the dataset into the quantum domain, we now find the best U ((cid:126)x, β, (cid:126)θ) according to to figure (3). This means hav- ing our generic continuous function given by equation (2). In this stage, we only need to find the minimum, according to equation (1). So, we train a Quantum-Coding System plus the best U ((cid:126)x, β, (cid:126)θ) found to predict the best hyperparame- ters. Now, we get the best set of hyperparameters by using a quantum computer (or a quantum-inspired one); we go back to the classical model and re-train it with the best hyperpa- rameters. Figure 6. We can see the space covered by the new function f ((cid:126)x) resulting from applying the gate U ((cid:126)x, (cid:126)θ, β). In this case, the number of layers is 4. The axes on the graph represent hyperparameters from HistGradBoost model. Here, the score is normalized on π. Please refer to table (II) for more details. seconds to find the best hyperparameters with R2 score = 0.4377. C. 4 Hyperparameters learning rate, In the case of 4 Hyperparameters: max iteration, loss and max bins, we have the following outcomes: • Testing classically with the full database with 1980 training samples took 41 minutes 45 seconds, with Figure 5. We can observe the result of applying a quantum- based Fourier regression approach. We can observe how the model allows interpolating the data from the dataset better. Figure 7. We can observe how our algorithm finds the lo- cal maximum of our multivariate function. In this case, the number of layers is 5. The axes on the graph represent hyper- parameters from HistGradBoost model. Please refer to table (II) for more details. 9 Model Cases HistGradBoost with Random CV A B C D E Classical HistGradBoost performance time (s) 2747.00 2747.00 2747.00 2747.00 2747.00 Total proposed model performance time (s) 146.86 206.09 313.46 374.91 555.11 Time saving (s) Time saving (%) Dev Score Dev Score (%) # HPs # Layers Load Data(ms) VQA (s) 2598.14 2538.91 2431.54 2370.09 2189.89 94.65 92.49 89.59 86.35 79.79 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 3.00 3.00 3.00 3.00 5.00 1.00 2.00 3.00 4.00 5.00 1.30 2.40 4.10 4.81 0.00 84.70 150.05 239.06 282.38 397.03 Finding Quantum best HPs (s) 28.63 44.63 68.01 85.49 140.42 Data mapping from Quantum to Classic Space (μs) 30.35 41.76 51.51 70.66 73.78 Loading Original dataset time (s) 1.44 1.07 1.10 1.07 1.09 Model training (s) 32.08 10.34 5.29 5.97 16.56 Proposed model Test score 0.3879 0.39 0.3879 0.3879 0.3879 Orginal Train score Orginal Test Score 0.4578 0.4598 0.4578 0.4578 0.4598 0.3879 0.3879 0.3879 0.3879 0.3879 Table III. This table shows the experiments for five cases (A, B, C, D, and E) with the input database trained with both the test and train for the HistGradBoost model. The time required to generate said database classically and have the optimal hyperparameters applying Random Search with Cross-Validation is 2747 seconds. The configuration parameters of our hybrid model to obtain the data from the tables are the following: lrVQA = 0.15, maxEpochVQA = 70, lrBH = 0.0005, maxEpochBH = 1500, loadOptBH = F alse and for the different quantum layers (qLayer = 1, 2, 3, 4, and 5). Our algorithm already finds the hyperparameters for the defined target score, considerably reducing the experimentation time using minimum layers. In this case, from 94% for one layer to 79% for five layers. All the tests were done locally on Mac Book Pro with 8-Core Intel [74]. R2 result for the R2 train = 0.464 and R2 test = 0.388. • By creating a subset with only 280 samples, that took 5 minutes 54 seconds to be created and having the R2 = 0.388. • Now, executing our quantum algorithm for find- ing the best hyperparameters using the prepared dataset (280 samples) took only 15 minutes and 2 seconds to find the best hyperparameters with R2 score = 0.415. D. Discussions In this Section, we discuss the obtained results while elab- orating on which cases our proposed model works best. We compared the classical and hybrid proposed models from figure (8). Specifically, we compared the classically trained data model with the HistGradBoost model using Random Search and Cross-Validation with our model. The ratio between the graphs is from saving time, with only a single layer in the quantum circuit. In the case of figure (8), we notice that we saved 56% of total time. The VQA took about 100 seconds, the search algorithm for the optimal hyperparameters took about 33 seconds, and the model retraining took about 50 seconds com- pared to 2747 seconds to get the same hyperparameters. Using Random search, the experiment was done with a 1500-element database over 3 columns. With the hy- perparameters param learning rate [0.01 − 1], param iter [1 − 1000], and param loss as categorical [squared error, absolute error] (for more details (II)). Figure (9) shows the experiment with the same model (HisGradBoost) but this time with Grid Search and Cross-Validation. In this case, the VQA took about 425 seconds, the search algorithm for the optimal hyperpa- rameters took about 36 seconds, and the model retraining took about 8 seconds compared to 2505 seconds to get the same parameters. Although the other times are negligible compared to the magnitudes we are dealing with, we have wanted to plot them on this graph ((9)). The experiment was done with a 1920-element database over 4 columns. With the hyperparameters param learning rate [0.01−1], param iter [1 − 1000], param max bins [31 − 255] and param loss as categorical [squared error, absolute error] (for more details (II)). The results of the experiments with the RandomFor- est model are shown by the figure (10). The experi- ment compares the classically trained data model with the RandomForest model using Cross-Validation. The time saving is 63%. For that, the VQA took about 121 seconds, the search algorithm for the optimal hyperpa- rameters took about 68 seconds, and the model retrain- ing took about 600 seconds compared to 2116 seconds to get the same parameters. The experiment was done 10 Model Cases HistGradBoost with Grid CV A B C D E Classical HistGradBoost performance time (s) 2505.00 2505.00 2505.00 2505.00 2505.00 Total proposed model performance time (s) 368.30 774.53 944.76 1470.23 1757.00 Time saving (s) Time saving (%) Dev Score Dev Score (%) # HPs # Layers Load Data(s) VQA (s) 2136.69 1730.46 1560.24 1034.76 747.9930 85.29 69.08 62.28 41.31 29.86 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 4.00 4.00 4.00 4.00 4.00 1.00 2.00 3.00 4.00 5.00 0.00 0.00 0.00 0.00 0.00 308.31 700.37 855.79 1302.36 1585.81 Finding Quantum best HPs (s) 45.68 65.80 81.75 146.56 160.69 Data mapping from Quantum to Classic Space (s) 0.00 0.00 0.00 0.00 0.00 Loading Original dataset time (s) 1.60 1.11 1.00 1.60 1.23 Model training (s) 12.72 7.25 6.21 19.72 9.27 Proposed model Test score 0.3785 0.3785 0.3785 0.3785 0.3785 Original Train score Original Test Score 0.4583 0.4583 0.4583 0.4583 0.4583 0.3879 0.3879 0.3879 0.3879 0.3879 Table IV. This table shows the experiments for five cases (A, B, C, D, and E) with the input database trained with both the test and train for the HistGradBoost model. The time required to generate said database classically and have the optimal hyperparameters applying Grid Search with Cross-Validation is 2505 seconds. The configuration parameters of our hybrid model lrVQA = 0.15, maxEpochVQA = 70, lrBH = 0.0005, maxEpochBH = to obtain the data from the tables are the following: 1500, loadOptBH = F alse and for the different quantum layers (qLayer = 1, 2, 3, 4, and 5). Our algorithm already finds the hyperparameters for the defined target score, considerably reducing the experimentation time using minimum layers. In this case, from 85% for one layer to 29% for five layers. All the tests were done locally on MacBookPro with 8-Core Intel [74]. with an 88-element database with over 2 columns. With the hyperparameters param n estimators [5 − 250] and param max depth [1 − 15] (for more details (II)). The experimentation with Ridge model is presented in Figure (11), which compares the classically trained data model with the Ridge model using Grid Search The ratio and Cross-Validation with our model. between the graphs represents the savings that we achieve. Here we are saving 73% of the experimen- tation time. In this case, the VQA took about 178 seconds, the search algorithm for the optimal hyper- parameters took about 53 seconds, and the model re- training took about 5 seconds compared to 2075 sec- onds to get the same parameters. The experiment was done with a 560-element database with over 3 columns. With the hyperparameters param alpha [0.0001 − 1], param max iter [1000−500000] and param solver as cate- gorical [svd, cholesky, lsqr, sparse cq, sag ] (for more de- tails (II)). We have realized that for databases classically generated for less than one minute, it is not worth using our algorithm since the setup time in the case of a single hyperparameter is 50 seconds, and for two hyperparame- ters is one minute and 20 seconds. Moreover, to verify the proper functioning of our algorithm and how it shares part of its philosophy with BayesSearch, we wanted to compare it with BayesSearch with cross-validation. As quantum computing is today, the result is quite compa- rable. The comparison has been simulated on a classical Figure 8. This graph compares the classical model and the hybrid proposed model-the classic model on the right of the image and the proposed model on the left. We are compar- ing the classically trained data model with the HistGradBoost model using Random Search with Cross-Validation. The ra- tio between the graphs results from saving time in this case, with only a single layer in the quantum circuit. Table (III) analyzes in detail considering the number of layers. In this case, we save 56% of time compared to the classical coun- terpart. A 1500-element database with 3 columns consid- ering the following the hyperparameters param learning rate [0.01 − 1], param iter [1 − 1000], and param loss as categori- cal [squared error, absolute error] (for more details (II)). computer. That is, as an example, having the limitations of RAM without the ability to take advantage of quan- tum parallelization. Our algorithm has been equated by 89% time to the classicalBayesSearch. Still, we have also experienced cases where BayesSearch has exceeded our algorithm by about 100 seconds as the highest observed 11 Model Cases RandomForest with Grid CV A B C D E Classical Random Forest performance time (s) 2116.00 2116.00 2116.00 2116.00 2116.00 Total proposed model performance time (s) 669.22 1018.24 932.06 955.51 1021.88 Time saving (s) Time saving (%) Dev Score Dev Score (%) # HPs # Layers Load Data(s) VQA (s) 1446.77 1097.76 1183.93 1160.48 1094.12 68.37 51.88 55.95 54.84 51.71 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 2.00 2.00 2.00 2.00 2.00 1.00 2.00 3.00 4.00 5.00 0.00 0.00 0.00 0.00 0.00 80.04 101.80 148.99 218.43 245.46 Finding Quantum best HPs (s) 23.35 37.88 53.02 70.19 76.26 Data mapping from Quantum to Classic Space (s) 0.00 0.00 0.00 0.00 0.00 Loading Original dataset time (s) 1.29 1.49 1.18 1.30 1.02 Model training (s) 564.55 877.07 728.88 665.60 699.14 Proposed model Test score 0.3478 3478 0.3478 0.3478 0.3478 Original Train score Original Test Score 0.6273 0.6273 0.6273 0.6273 0.6273 0.3478 0.3478 0.3478 0.3478 0.3478 Table V. This table shows the experiments for five cases (A, B, C, D, and E) with the input database trained with both the test and train for the RandomForest model. The time required to generate said database classically and have the optimal hyperparameters applying Grid Search with Cross-Validation is 2116 seconds. The configuration parameters of our hybrid model lrVQA = 0.15, maxEpochVQA = 70, lrBH = 0.0005, maxEpochBH = to obtain the data from the tables are the following: 1500, loadOptBH = F alse and for the different quantum layers (qLayer = 1, 2, 3, 4, and 5). Our algorithm already finds the hyperparameters for the defined target score, considerably reducing the experimentation time using minimum layers. In this case, from 68% for one layer to 51% for five layers. All the tests were done locally on MacBookPro with 8-Core Intel [74]. Figure 9. This graph compares the classical model and our hybrid proposal-the classic model on the right of the image and the proposed model on the left. Specifically, we are com- paring the classically trained data model with the HisGrad- Boost model using Grid Search and Cross-Validation with the model. The ratio between the graphs results from saving time in this case, with only a single layer in the quantum circuit. Table (IV) analyzes in detail considering the number of layers. In this case, we save 81% of time compared to the classical counterpart. A 1920-element database over 4 columns con- sidering the following hyperparameters param learning rate [0.01 − 1], param iter [1 − 1000], param max bins [31 − 255] and param loss as categorical [squared error, absolute error] (for more details (II)). Figure 10. This graph compares the classical model and the hybrid proposed model-the classic model on the right of the image and the proposed model on the left. We are compar- ing the classically trained data model with the RandomFor- est model using Grid Search and Cross-Validation with our model. The ratio between the graphs results from saving time in this case, with only a single layer in the quantum circuit. Table (V) analyzes in detail considering the number of layers. In this case, we save 63% of time compared to the classical counterpart. An 88-element database with 2 columns con- sidering the following hyperparameters param n estimators [5 − 250] and param max depth [1 − 15] (for more details (II)). value. In all cases, our algorithm has found the values of the same hyperparameters as BayesSearch. We only compared the algorithm with a single layer. It can be seen in figure (12) the operation at the time and process level of the proposed algorithm. Note how the quantum part goes very fast, and we consume the most time in the retraining of Bayes Search. Since the Bayes Search with Cross-Validation goes back to performing some steps al- ready contemplated in our proposal. 12 Model Cases Ridge with Grid Search CV A B C D E Classical Ridge performance time (s) 2075.00 2075.00 2075.00 2075.00 2075.00 Total proposed model time (s) 163.13 314.93 538.35 632.64 871.59 Time saving (s) Time saving (%) Dev Score Dev Score (%) # HPs # Layers Load Data(s) VQA (s) 1911.87 1760.07 1536.65 1442.36 1203.41 92.13 84.82 74.05 69.51 57.99 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 5.00 5.00 5.00 5.00 5.00 1.00 2.00 3.00 4.00 5.00 0.00 0.00 0.00 0.00 0.00 118.77 243.11 403.12 490.68 678.17 Finding Quantum best HPs (s) 39.87 67.79 130.66 137.81 188.86 Data mapping from Quantum to Classic Space (s) 0.00 0.00 0.00 0.00 0.00 Loading Original dataset time (s) 1.15 0.98 1.10 1.07 1.13 Model training (s) 3.34 3.04 3.46 3.07 3.44 Proposed model Test score 0.3012 0.3012 0.3012 0.3012 0.3012 Original Train score Original Test Score 0.3134 0.3134 0.3134 0.3134 0.3134 0.3012 0.3012 0.3012 0.3012 0.3012 Table VI. This table shows the experiments for five cases (A, B, C, D, and E) with the input database trained with both the test and train for the Ridge model. The time required to generate said database classically and have the optimal hyperpa- rameters applying Grid Search with Cross-Validation is 2116 seconds. The configuration parameters of our hybrid model to obtain the data from the tables are the following: lrVQA = 0.15, maxEpochVQA = 70, lrBH = 0.0005, maxEpochBH = 1500, loadOptBH = F alse and for the different quantum layers (qLayer = 1, 2, 3, 4, and 5). Our algorithm already finds the hyper- parameters for the defined target score, considerably reducing the experimentation time using minimum layers. In this case, from 92% for one layer to 57% for five layers. All the tests were done locally on MacBookPro with 8-Core Intel [74]. Figure 11. This graph compares the classical model and the hybrid proposed model-the classic model on the right of the image and the proposed model on the left. We are comparing the classically trained data model with the Ridge model using Grid Search and Cross-Validation with the model. The ratio between the graphs results from saving time in this case, with only a single layer in the quantum circuit. Table (VI) ana- lyzes in detail considering the number of layers. In this case, we can see that we save 73% of time compared to the classical counterpart. A 560-element database with 3 columns consid- ering the following hyperparameters param alpha [0.0001−1], param max iter [1000−500000] and param solver as categori- cal [svd, cholesky, lsqr, sparse cq, sag ] (for more details (II)). Figure 12. This graph presents the performance of the pro- posed algorithm compared to its classical counterpart using the BayesSearch with Cross-Validation. In this case, the pro- posed algorithm represented 92.5% of the classical model as a reference which means a 7.5% time improvement. A 30- element database with 2 columns were used, considering the following hyperparameters param n estimators [5 − 250] and param max depth [1 − 15]. VII. CONCLUSION Hyperparameter tuning is a research area with great in- terest in this big-data era. In this article, we have studied using classical and quantum hybrid algorithms to offer a generic solution. We have investigated several scenarios and experiments to propose an efficient model for solving the hyperparameter optimization problem. We have de- signed an algorithm that fits the current status of quan- tum computing. Our algorithm and processes can be used in all quantum-inspired machines solving real cases in society, waiting for a quantum computer or a system that allows us to have quality service to run it on a com- mercial quantum computer. Our algorithm has proven robust in all tested scenarios and has given outstanding results. For this reason, we firmly believe that, beyond the hardware limitations and beyond achieving an effi- cient qRAM, if there is a lot of classical data and few functional qubits, algorithms such as the one proposed in this work are the most suitable for the real solutions today. ACKNOWLEDGEMENTS The authors want to thank Guillermo Alonso de Linaje for the discussions and consideration during the experi- 13 ments. Also, the authors wish to thank the Vueling Air- lines SA for allowing the use of their proprietary dataset to perform this work. Compliance with Ethics Guidelines Funding: This research received no external funding. Institutional review: This article does not contain any studies with human or animal subjects. Informed consent: Informed consent was obtained from all individual participants included in the study. Data availability: Data sharing is not applicable. No new data were created or analyzed in this study. Data sharing does not apply to this article. [1] Garry Choy, Omid Khalilzadeh, Mark Michalski, Synho Do, Anthony E Samir, Oleg S Pianykh, J Raymond Geis, Pari V Pandharipande, James A Brink, and Keith J Dreyer, "Current applications and future impact of ma- chine learning in radiology," Radiology 288, 318–328 (2018). [2] Alison Callahan and Nigam H Shah, "Machine learning in healthcare," in Key Advances in Clinical Informatics (Elsevier, 2017) pp. 279–291. [3] David Anderson, Margret V Bjarnadottir, and Zlatana Nenova, "Machine learning in healthcare: Operational and financial impact," Innovative Technology at the In- terface of Finance and Operations: Volume I , 153–174 (2022). [4] Harikumar Pallathadka, Malik Mustafa, Domenic T Sanchez, Guna Sekhar Sajja, Sanjeev Gour, and Mohd Naved, "Impact of machine learning on management, healthcare and agriculture," Materials Today: Proceed- ings (2021). [5] Andrej Miklosik and Nina Evans, "Impact of big data and machine learning on digital transformation in market- ing: A literature review," Ieee Access 8, 101284–101292 (2020). [6] Amir Mosavi, Mohsen Salimi, Sina Faizollahzadeh Ard- abili, Timon Rabczuk, Shahaboddin Shamshirband, and Annamaria R Varkonyi-Koczy, "State of the art of ma- chine learning models in energy systems, a systematic review," Energies 12, 1301 (2019). [7] Parfait Atchade-Adelomou, Guillermo Alonso-Linaje, Jordi Albo-Canals, and Daniel Casado-Fauli, "qrobot: A quantum computing approach in mobile robot order picking and batching problem solver optimization," Al- gorithms 14 (2021), 10.3390/a14070194. [8] R ́emi Bardenet, M ́aty ́as Brendel, Bal ́azs K ́egl, and Michele Sebag, "Collaborative hyperparameter tuning," in International conference on machine learning (PMLR, 2013) pp. 199–207. [9] Li Yang and Abdallah Shami, "On hyperparameter op- timization of machine learning algorithms: Theory and practice," Neurocomputing 415, 295–316 (2020). [10] Yangyang Li, Gao Lu, Linhao Zhou, and Licheng Jiao, "Quantum inspired high dimensional hyperparameter op- timization of machine learning model," in 2017 Interna- tional Smart Cities Conference (ISC2) (2017) pp. 1–6. [11] Asel Sagingalieva, Andrii Kurkin, Artem Melnikov, Daniil Kuhmistrov, Michael Perelshtein, Alexey Mel- nikov, Andrea Skolik, and David Von Dollen, "Hyperpa- rameter optimization of hybrid quantum neural networks for car classification," (2022). [12] Yoshua Bengio, "Gradient-based optimization of hyper- parameters," Neural computation 12, 1889–1900 (2000). [13] Jiazhuo Wang, Jason Xu, and Xuejun Wang, "Combina- tion of hyperband and bayesian optimization for hyper- parameter optimization in deep learning," arXiv preprint arXiv:1801.01596 (2018). [14] Matthias Feurer and Frank Hutter, "Hyperparameter op- timization," in Automated machine learning (Springer, Cham, 2019) pp. 3–33. [15] Parfait Atchade-Adelomou and Kent Larson, "Fourier se- ries weight in quantum machine learning," arXiv Pending (2023). [16] SG Zeldam, Automated failure diagnosis in avia- tion maintenance using explainable artificial intelligence (XAI), Master's thesis, University of Twente (2018). [17] Naman Shukla, Arinbj ̈orn Kolbeinsson, Ken Otwell, La- vanya Marla, and Kartik Yellepeddi, "Dynamic pricing for airline ancillaries with customer context," in Proceed- ings of the 25th ACM SIGKDD International Conference on knowledge discovery & data mining (2019) pp. 2174– 2182. [18] Valentina Cacchiani and Juan-Jos ́e Salazar-Gonz ́alez, "Heuristic approaches for flight retiming in an integrated airline scheduling problem of a regional carrier," Omega 91, 102028 (2020). [19] Axel Parmentier and Fr ́ed ́eric Meunier, "Aircraft rout- ing and crew pairing: Updated algorithms at air france," Omega 93, 102073 (2020). [20] Parfait Atchade-Adelomou, "Quantum algorithms for solving hard constrained optimisation problems," (2022). [21] Saul Gonzalez-Bermejo, Guillermo Alonso-Linaje, and Parfait Atchade-Adelomou, "Gps: A new tsp formulation for its generalizations type qubo," Mathematics 10, 416 (2022). [22] Parfait Atchade-Adelomou, Daniel Casado-Fauli, Elis- and Xavier Vilasis-Cardona, (2021), abet Golobardes-Ribe, "quantum case-based reasoning (qcbr)," arXiv:2104.00409 [cs.AI]. [23] PM Lerman, "Fitting segmented regression models by grid search," Journal of the Royal Statistical Society: Se- ries C (Applied Statistics) 29, 77–84 (1980). [24] Petro Liashchynskyi and Pavlo Liashchynskyi, "Grid search, random search, genetic algorithm: a big compar- ison for nas," arXiv preprint arXiv:1912.06059 (2019). [25] Steven M LaValle, Michael S Branicky, and Stephen R Lindemann, "On the relationship between classical grid search and probabilistic roadmaps," The International Journal of Robotics Research 23, 673–692 (2004). [26] Thomas S Ferguson, Mathematical statistics: A decision theoretic approach, Vol. 1 (Academic press, 2014). [27] Francisco J Solis and Roger J-B Wets, "Minimization by random search techniques," Mathematics of operations research 6, 19–30 (1981). [28] James Bergstra and Yoshua Bengio, "Random search for hyper-parameter optimization." Journal of machine learning research 13 (2012). [29] . [30] Katharina Eggensperger, Matthias Feurer, Frank Hut- ter, James Bergstra, Jasper Snoek, Holger Hoos, Kevin Leyton-Brown, et al., "Towards an empirical foundation for assessing bayesian optimization of hyperparameters," in NIPS workshop on Bayesian Optimization in Theory and Practice, Vol. 10 (2013). [31] Marti A. Hearst, Susan T Dumais, Edgar Osuna, John Platt, and Bernhard Scholkopf, "Support vector ma- chines," IEEE Intelligent Systems and their applications 13, 18–28 (1998). [32] Derya Birant and Alp Kut, "St-dbscan: An algorithm for clustering spatial–temporal data," Data & knowledge engineering 60, 208–221 (2007). [33] Hongfang Zhou, Peng Wang, and Hongyan Li, "Research on adaptive parameters determination in dbscan algo- rithm," Journal of Information & Computational Science 9, 1967–1973 (2012). [34] Raymond E Wright, "Logistic regression." (1995). [35] David G Kleinbaum, K Dietz, M Gail, Mitchel Klein, and Mitchell Klein, Logistic regression (Springer, 2002). [36] Ronald J Williams and Jing Peng, "An efficient gradient- based algorithm for on-line training of recurrent network trajectories," Neural computation 2, 490–501 (1990). [37] Nicolo Cesa-Bianchi, "Analysis of two gradient-based al- gorithms for on-line regression," in Proceedings of the tenth annual conference on Computational learning the- ory (1997) pp. 163–170. [38] Alexios Koutsoukas, Keith J Monaghan, Xiaoli Li, and Jun Huan, "Deep-learning: investigating deep neural net- works hyper-parameters and comparison of performance to shallow methods for modeling bioactivity data," Jour- nal of cheminformatics 9, 1–13 (2017). [39] Bobak Shahriari, Kevin Swersky, Ziyu Wang, Ryan P Adams, and Nando De Freitas, "Taking the human out of the loop: A review of bayesian optimization," Proceed- ings of the IEEE 104, 148–175 (2015). [40] Richard M Dudley, "Sample functions of the gaussian process," in Selected works of RM Dudley (Springer, 2010) pp. 187–224. [41] Eric Schulz, Maarten Speekenbrink, and Andreas Krause, "A tutorial on gaussian process regression: Mod- elling, exploring, and exploiting functions," Journal of Mathematical Psychology 85, 1–16 (2018). [42] Meng Zhao and Jinlong Li, "Tuning the hyper- parameters of cma-es with tree-structured parzen es- timators," in 2018 Tenth International Conference on Advanced Computational Intelligence (ICACI) (IEEE, 2018) pp. 613–618. 14 (Luniver press, 2010). [44] Stefan Lessmann, Robert Stahlbock, and Sven F Crone, "Optimizing hyperparameters of support vector ma- chines by genetic algorithms." in IC-AI, Vol. 74 (2005) p. 82. [45] Pablo Ribalta Lorenzo, Jakub Nalepa, Michal Kawulok, Luciano Sanchez Ramos, and Jos ́e Ranilla Pastor, "Par- ticle swarm optimization for hyper-parameter selection in deep neural networks," in Proceedings of the genetic and evolutionary computation conference (2017) pp. 481–488. [46] Andrew Steane, "Quantum computing," Reports on Progress in Physics 61, 117 (1998). [47] Jozef Gruska et al., Quantum computing, Vol. 2005 (McGraw-Hill London, 1999). [48] Athanasios Lentzas, Christoforos Nalmpantis, and Dim- itris Vrakas, "Hyperparameter tuning using quantum genetic algorithms," in 2019 IEEE 31st International Conference on Tools with Artificial Intelligence (ICTAI) (2019) pp. 1412–1416. [49] Charles Moussa, Jan N. van Rijn, Thomas B ̈ack, and Vedran Dunjko (Springer Nature Switzerland, 2022) pp. 32–46. [50] Ra ́ul Berganza G ́omez, Corey O'Meara, Giorgio Cor- tiana, Christian B Mendl, and Juan Bernab ́e-Moreno, "Towards autoqml: A cloud-based automated circuit ar- chitecture search framework," in 2022 IEEE 19th Inter- national Conference on Software Architecture Compan- ion (ICSA-C) (IEEE, 2022) pp. 129–136. [51] Maria Schuld, Ilya Sinayskiy, and Francesco Petruccione, "An introduction to quantum machine learning," Con- temporary Physics 56, 172–185 (2015). [52] Jacob Biamonte, Peter Wittek, Nicola Pancotti, Patrick Rebentrost, Nathan Wiebe, and Seth Lloyd, "Quantum machine learning," Nature 549, 195–202 (2017). [53] Maria Schuld and Francesco Petruccione, Supervised learning with quantum computers, Vol. 17 (Springer, 2018). [54] Vedran Dunjko, Jacob M Taylor, and Hans J Briegel, "Quantum-enhanced machine learning," Physical review letters 117, 130501 (2016). [55] Parfait Atchade Adelomou, Elisabet Golobardes Rib ́e, and Xavier Vilas ́ıs Cardona, "Using the variational- quantum-eigensolver (vqe) to create an intelligent so- cial workers schedule problem solver," in International Conference on Hybrid Artificial Intelligence Systems (Springer, 2020) pp. 245–260. [56] Parfait Atchade-Adelomou and Guillermo Alonso-Linaje, "Quantum-enhanced filter: Qfilter," Soft Computing , 1– 8 (2022). [57] Parfait Atchade Adelomou, Daniel Casado Fauli, Elis- and Xavier Vilasis-Cardona, abet Golobardes Rib ́e, "Quantum case-based reasoning (qcbr)," Artificial Intel- ligence Review , 1–27 (2022). [58] Atchade Parfait Adelomou, Elisabet Golobardes Ribe, and Xavier Vilasis Cardona, "Using the parameterized quantum circuit combined with variational-quantum- eigensolver (vqe) to create an intelligent social workers' schedule problem solver," (2020). [59] Alonso-Linaje Guillermo, "¿quieres aprender com- putaci ́on cu ́antica ?" (2023). [60] G Arutyunov, S Frolov, and M Staudacher, "Bethe ansatz for quantum strings," Journal of High Energy Physics 2004, 016–016 (2004). [43] Xin-She Yang, Nature-inspired metaheuristic algorithms [61] Sukin Sim, Peter D. Johnson, and Al ́an Aspuru-Guzik, 15 "Expressibility and entangling capability of parameter- ized quantum circuits for hybrid quantum-classical al- gorithms," Advanced Quantum Technologies 2, 1900070 (2019). [62] Jacob Biamonte, Peter Wittek, Nicola Pancotti, Patrick Rebentrost, Nathan Wiebe, and Seth Lloyd, "Quantum machine learning," Nature 549, 195–202 (2017). [63] Adri ́an P ́erez-Salinas, Alba Cervera-Lierta, Elies Gil- Fuster, and Jos ́e I. Latorre, "Data re-uploading for a universal quantum classifier," Quantum 4, 226 (2020). [64] Maria Schuld, Ilya Sinayskiy, and Francesco Petruccione, "An introduction to quantum machine learning," Con- temporary Physics 56, 172–185 (2014). [65] community The SciPy, "Cobyla," (2021). [66] Spall James C., "Spsa community," (2001). [67] Dong C. Liu and Jorge Nocedal, "On the limited memory BFGS method for large scale optimization," Mathemat- ical Programming 45, 503–528 (1989). [68] Adri ́an P ́erez-Salinas, Alba Cervera-Lierta, Elies Gil- and Jos ́e I Latorre, "Data re-uploading for a Fuster, universal quantum classifier," Quantum 4, 226 (2020). [69] Michael A. Nielsen, Isaac Chuang, and Lov K. Grover, "Quantum computation and quantum information," American Journal of Physics 70, 558–559 (2002). [70] Michael W Browne, "Cross-validation methods," Journal of Mathematical Psychology 44, 108–132 (2000). [71] Marco Cerezo, Andrew Arrasmith, Ryan Babbush, Si- mon C Benjamin, Suguru Endo, Keisuke Fujii, Jarrod R McClean, Kosuke Mitarai, Xiao Yuan, Lukasz Cincio, et al., "Variational quantum algorithms," Nature Re- views Physics 3, 625–644 (2021). [72] Diederik P. Kingma and Jimmy Ba, "Adam: A method for stochastic optimization," (2014). [73] Ivar Ekeland, "On the variational principle," Journal of Mathematical Analysis and Applications 47, 324–353 (1974). [74] Apple, "Macbookpro 15,1," https://support.apple. com/kb/SP776?locale=es_ES (2022 (accessed Dec 26, 2022)).
http://arxiv.org/abs/2302.10295v2
2023-02-22T20:17:15
2023-02-20T20:39:07
Active Learning with Positive and Negative Pairwise Feedback
In this paper, we propose a generic framework for active clustering with queries for pairwise similarities between objects. First, the pairwise similarities can be any positive or negative number, yielding full flexibility in the type of feedback that a user/annotator can provide. Second, the process of querying pairwise similarities is separated from the clustering algorithm, leading to more flexibility in how the query strategies can be constructed. Third, the queries are robust to noise by allowing multiple queries for the same pairwise similarity (i.e., a non-persistent noise model is assumed). Finally, the number of clusters is automatically identified based on the currently known pairwise similarities. In addition, we propose and analyze a number of novel query strategies suited to this active clustering framework. We demonstrate the effectiveness of our framework and the proposed query strategies via several experimental studies.
[ "Linus Aronsson", "Morteza Haghir Chehreghani" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10295v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10295v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "stat.ML" ]
ACTIVE LEARNING WITH POSITIVE AND NEGATIVE PAIRWISE FEEDBACK 3 2 0 2 b e F 2 2 ] G L . s c [ 2 v 5 9 2 0 1 . 2 0 3 2 : v i X r a Linus Aronsson Chalmers University of Technology [email protected] Morteza Haghir Chehreghani Chalmers University of Technology [email protected] ABSTRACT In this paper, we propose a generic framework for active clustering with queries for pairwise sim- ilarities between objects. First, the pairwise similarities can be any positive or negative number, yielding full flexibility in the type of feedback that a user/annotator can provide. Second, the process of querying pairwise similarities is separated from the clustering algorithm, leading to more flexibility in how the query strategies can be constructed. Third, the queries are robust to noise by allowing multiple queries for the same pairwise similarity (i.e., a non-persistent noise model is assumed). Finally, the number of clusters is automatically identified based on the currently known pairwise similarities. In addition, we propose and analyze a number of novel query strategies suited to this active clustering framework. We demonstrate the effectiveness of our framework and the proposed query strategies via several experimental studies. 1 Introduction Many machine learning paradigms rely on the availability of labeled data in the form of supervised learning. However, in various real-world applications, such labels might not be available and the procedure of labeling data is often tedious, time-consuming, and expensive. Therefore, it might be unaffordable to label all data. Hence, the goal would be to acquire the most informative/useful data labels given a limited budget. Such a problem is usually studied in the context of active learning. It has been successfully applied to several tasks and applications such as recommender systems [1], sound event detection [2], analysis of driving time series [3], reaction prediction in drug discovery [4] and logged data analysis [5]. Active learning is usually carried out in the context of sequential decision making, where at every step, two actions are taken: i) querying the next object or data to be labeled, and ii) updating the underlying model w.r.t. the newly acquired label(s). Querying is performed using an acquisition function which aims to suggest the most informative data for labeling according to some criterion. Common acquisition functions consider objectives such as variance, margin, uncertainty, entropy and model change [6, 7, 8, 9]. Active learning has also been applied to clustering and is sometimes called supervised clustering [10]. The motivation for supervised clustering is that by including some supervision in the clustering process, one can find clusters that are more relevant to the application and better reflect the expectations of the users. In this setting, the queries are generally performed in one of two ways. First, queries asking if two clusters should merge or if one cluster should be split into multiple clusters [11, 10, 12]. Second, queries for the pairwise relations between objects. Regardless of the query type, the goal is to discover the ground-truth clustering with a minimal number of queries. In previous work, queries for pairwise relations are either in the form of same-cluster queries (SCQ) [13, 14, 15, 16, 17] or queries for the pairwise similarities between objects [18, 19, 20, 21, 22, 23]. For SCQ, one assumes that the true (possibly inconsistent) pairwise similarities between all objects are given and a query indicates whether two objects are in the same cluster or not w.r.t. some optimal clustering. Hence, the goal is to find an optimal clustering w.r.t. known pairwise similarities with a minimal number of SCQ. We note that assuming all the (cid:0)N (cid:1) pairwise similarities between N objects are known in advance is unrealistic in many practical applications. The reason is that acquiring such information can be costly. Given this, previous studies that consider querying pairwise similarities do not assume 2 (cid:1) pairwise similarities are given in advance. Instead, they aim for a trade-off between the number of known that all (cid:0)N pairwise similarities (acquired through active querying) and the quality of the clustering (compared to some ground-truth clustering). In this paper, we consider this setting. 2 Previous works on active learning with pairwise similarities have the following four limitations. First, they assume that the similarities are binary in {+1, -1}. Second, the querying process is integrated into the clustering algorithm itself, thus limiting how the queries can be made. Third, they either assume that the oracle always provides perfect answers (i.e., zero noise) or that it provides noisy answers where the noise is persistent, meaning that multiple queries for the same pairwise similarity always return the same (possibly noisy) answer. Four, in some cases they require that the number of clusters to be extracted is specified in advance. Motivated by these limitations, we develop a generic framework for active learning with pairwise relations that better resembles the traditional active learning framework for supervised learning. First, the pairwise similarities can be any positive or negative number, and might even be inconsistent (i.e., violate transitivity, see Section 3.2). This yields full flexibility in the type of feedback that a user or annotator can provide. Second, the process of querying pairwise similarities is separated from the clustering algorithm. This leads to more flexibility in how the query strategies can be constructed and they can be used in conjunction with any clustering algorithm. Third, the queries are robust w.r.t. a noisy oracle by allowing multiple queries for the same pairwise similarity (i.e., a non-persistent noise model is assumed). Finally, it automatically identifies the number of clusters based on the available pairwise similarities. This framework leads to a natural way of defining clusters: we propose to extract clusters that yield minimal violation of the provided feedbacks. In other words, the clustering is maximally consistent with the set of feedbacks obtained via querying the oracle for active learning. To the best of our knowledge, this framework is the first work that fulfills all the above-mentioned advantages. In addition to the generic active clustering framework, we propose and analyze a number of novel acquisition functions (query strategies) suited for this active clustering paradigm. We demonstrate the effectiveness of our active learning framework and the proposed query strategies via several experimental studies. 2 Active Learning with Pairwise Relations In this section, we introduce our framework for active learning with pairwise relations. We first formulate the problem as a supervised clustering task, then describe the respective active learning procedure, and finally explain the clustering algorithm to be used in our framework. 2.1 Problem formulation 2 (cid:1). We are given a set of N objects (data points) denoted by V = {1, . . . , N }. The set of the pairs of objects in V is denoted by E = {(u, v) | u, v ∈ V and u > v} and will be used to indicate the pairwise relations between objects. Thus, we have |E| = (cid:0)N We are interested in active learning based on pairwise similarities where the pairwise similarities between objects are either a priori unknown or only partially known. Thereby, the pairwise similarities need to be queried from an oracle (or a user) in a cost-efficient way. Unlike existing work on active learning with pairwise similarities, we assume that the feedback (i.e., the pairwise similarities provided by the oracle or user) can be any positive or negative number. Without loss of generality and for ease of explanation, we assume the feedback is a number in [−1, +1]. A positive number indicates that the two respective objects are similar and a negative number indicates a dissimilarity between them. The value of the pairwise similarity (the absolute value in the case of a negative similarity) can, for example, represent the confidence of the user or annotator. A zero pairwise similarity implies neutral feedback, where the oracle cannot decide if the objects are similar or dissimilar 1. We assume there exists a generic similarity function σ∗ : E → [−1, 1] representing the true pairwise similarities between every pair (u, v) ∈ E. However, this similarity function is not known in advance; one can only query the oracle for a noisy instantiation of this function for a desired pair of objects while incurring some cost. We then use σ : E → [−1, 1] to refer to some estimate of the pairwise similarities. If σ(u, v) = σ∗(u, v) for all (u, v) ∈ E we have a perfect estimate of the true pairwise similarities, which is unrealistic in practical cases. Active learning with queries for pairwise relations is also called supervised clustering. The reason is that this setting does not correspond to querying the labels for objects (unlike traditional active learning in supervised learning). Instead, 1Technically, we treat zero pairwise similarities similar to positive pairwise similarities. Thus, for brevity, a positive similarity may also mean a zero similarity. 2 it queries the oracle for pairwise relations and thus no explicit label is assigned to the objects.2 Given σ∗ our problem would become equivalent to standard clustering. However, we might only have partially correct pairwise similarities via a limited number of noisy queries/feedbacks from the oracle. The set V together with a similarity function σ can be viewed as a weighted (undirected) graph Gσ = (V , E) where the weight of edge (u, v) ∈ E is σ(u, v). We denote by e = (u, v) an edge in E. Let Gσ(z) = (z, Ez) denote the subgraph of Gσ induced by z ⊆ V , where Ez = {(u, v) ∈ E | u, v ∈ z and u > v} ⊆ E. A clustering of z ⊆ V is a partition of z into k disjoint sets (clusters). Let Cz be the set of all clusterings of z. Consider a clustering C ∈ Cz with k clusters. We say that an edge (u, v) ∈ Ez violates the clustering C if σ(u, v) ≥ 0 while u and v are in different clusters or if σ(u, v) < 0 while u and v are in the same cluster. Given this, the function of cluster violations given C and σ is denoted by R(z,σ,C) : Ez → [0, 1] and is defined as shown in Eq. 1. R(z,σ,C)(u, v) = (cid:26)|σ(u, v)|, 0, iff (u, v) violates C otherwise We define the cost of a clustering C ∈ Cz given a similarity function σ as ∆(z,σ,C) = (cid:88) (u,v)∈Ez R(z,σ,C)(u, v). (1) (2) We aim for a clustering that is maximally consistent with a set of (provided) feedbacks σ. The optimal clustering of z given σ is C ∗ (z,σ) = arg min C∈Cz ∆(z,σ,C). (3) Thus, given σ∗ the optimal clustering w.r.t. the true pairwise similarities is C ∗ (V ,σ∗). Finally, we let A(z, σ) ∈ Cz be the clustering found by some clustering algorithm A given Gσ(z). 2.2 Active learning procedure To perform active clustering with queries of pairwise similarities, we start with an initial similarity function σ0 which can contain only partial or no information about σ∗. The goal is to recover C ∗ (V ,σ∗) with a minimal number of queries for the weights of edges in E to the oracle O, as each query incurs some cost. In this paper, we consider a noisy oracle where the noise is non-persistent. This means that each query for (u, v) ∈ E returns σ∗(u, v) with probability 1 − γ or a value in the range [−1, 1] uniformly at random with probability γ. Thus, γ will be used to control the level of noise in the experiments. Note that this also implies that multiple queries to the same edge can be beneficial. We employ an iterative procedure where in each iteration i, the goal is to query a batch B ⊆ E of |B| edge weights from the oracle O that aims to maximally improve the clustering when added to the current similarity function σi. Let σB i+1 denote the updated similarity function after querying the oracle for the edge weights of B. Then, the (greedy) optimal batch at iteration i is B∗ = arg max B⊆E I(C ∗ (V ,σ∗), A(V , σB i+1)), (4) where I(*, *) measures the consistency between C ∗ i+1) (according to some index such as rand score). However, maximizing I(*, *) is infeasible since σ∗ is not available. Thus, it is common in active learning to replace (4) with a query strategy (acquisition function) S that is computationally tractable. In Section 3 we introduce a number of query strategies that fit our framework. (V ,σ∗) and the clustering A(V , σB Algorithm 1 outlines the active clustering procedure. It takes as input the set of objects V , an initial similarity function σ0, a clustering algorithm A and a query strategy S. The algorithm begins by initializing a query matrix Qi where Qi uv is a set containing all queries made for edge (u, v) ∈ E until iteration i. Each iteration i of this active learning procedure consists of three steps. First, it runs the clustering algorithm A on objects V given the current similarity function σi. This returns the clustering Ci ∈ CV . Second, the query strategy S selects a batch of edges B ⊆ E. Then, the oracle O is queried for the weights of all the edges (u, v) ∈ B. Algorithm 2 outlines the way the oracle works. 2We note that this setting has a fundamental difference with standard clustering: in standard clustering there is no supervision provided, whereas here the pairwise relations are actively queried from an oracle. 3 Finally, the current similarity function σi is updated based on the queries to the oracle by setting σi+1(u, v) equal to the average of all queries made for the edge (u, v) so far. This leads to robustness against noise since a noisy query of an edge (u, v) will have less impact in the long run. Algorithm 1 Active clustering procedure Input: Data objects V , initial similarity function σ0, clustering algorithm A, query strategy S, noise threshold γ ∈ [0, 1] Output: Clustering C ∈ CV uv ∪ σ0(u, v), ∀(u, v) ∈ E 1: Q0 ← {∅}|V |×|V | uv ← Q0 2: Q0 3: i ← 0 4: while stopping criterion is not met do 5: 6: 7: 8: 9: 10: Q ← ORACLE(u, v, γ) Qi+1 uv ∪ Q σi+1(u, v) ← 1 |Qi+1 uv | Ci ← A(V , σi) B ← S(Ci, Qi, σi) for (u, v) ∈ B do uv ← Qi q∈Qi+1 uv (cid:80) end for i ← i + 1 11: 12: 13: end while 14: Return Ci q Algorithm 2 Oracle procedure Input: Edge (u, v) ∈ E, noise threshold γ ∈ [0, 1] Output: Query Q ∈ [−1, 1] Q ← σ∗(u, v) 1: τ ∼ Uniform(0, 1) 2: if τ > γ then 3: 4: else 5: 6: end if 7: Return Q Q ∼ Uniform(-1, 1) 2.3 Clustering algorithm Given an arbitrary pairwise similarity function σ, a natural clustering would extract clusters that yield minimal violation of the provided feedbacks in σ. In other words, the clustering that is maximally consistent with the pairwise similarities obtained from querying the oracle. This objective fits well with Correlation Clustering [24, 25] and makes it a good choice for this purpose. Finding the optimal solution of Correlation Clustering (and similarly solving the optimization problem in Eq. 3) is NP-hard (and even APX-hard) [24, 25]. Thereby, several approximate algorithms have been proposed for this problem [24, 25, 26, 27, 28, 29] among which the methods based on local search perform significantly better in terms of both the quality of clustering and the computational runtimes [30, 31].3 The local search methods in [34, 31] assume a fixed number of clusters for Correlation Clustering. However, given the pairwise similarities σ, the minimal violation objective should automatically determine the most consistent number of clusters. Assume, for example, the case where all the pairwise similarities are negative. Then, the clustering algorithm should place every object in a separate cluster. On the other hand, when all the pairwise similarities are positive, then only one cluster must be identified from the data. The work in [30] develops a Frank-Wolfe optimization approach to Correlation Clustering, which then leads to a local search method with an optimized choice of the update parameter. To deal with the non-fixed (data-dependent) number of clusters, it sets the initial number of clusters to be equal to the number of objects N , and lets the algorithm try all numbers and thus leave some clusters empty. This method yields some unnecessary extra computation that leads to 3The effectiveness of greedy methods based on local search has been studied extensively in several other clustering settings as well, e.g., [32, 33]. 4 increasing the overall runtime. Thereby, in this paper, we develop a local search method for Correlation Clustering (the objective in Eq. 3) that at each local search step, automatically increases or decreases the number of clusters only if needed. In this method, we begin with a randomly initialized clustering solution and then we iteratively assign each object to the cluster that leads to a maximal reduction in the violations (i.e., the cost function in Eq. 2 is maximally reduced). We allow for the possibility that the object moves to a new (empty) cluster, and in this way we provide a way to expand the number of clusters. On the other hand, when the last object in an existing cluster leaves to move to another cluster, then the cluster disappears. We repeat this local search procedure until no further changes (in the assignments of objects to clusters) happen for an entire round of investigating the objects. In this case, a local optimal solution is achieved and we stop the local search. We may repeat the local search procedure multiple times and choose the solution with a minimal cost. m ), where m indicates the local search step. This convergence rate is significantly faster than the O( 1√ Finally, according to the analysis of the Frank-Wolfe algorithm for Correlation Clustering [30], it provides a convergence rate of O( 1 m ) convergence rate for Frank-Wolfe applied to general non-convex functions [35]. On the other hand, the Frank-Wolfe algorithm in [30] with optimized update parameter is equivalent to the local search algorithm. Thereby, a local search for Correlation Clustering can benefit from a convergence rate of O( 1 m ), significantly improved compared to the general cases with convergence rates of O( 1√ m ). 3 Query Strategies A simple baseline query strategy would be to query the weight of the edge e ∈ E selected uniformly at random. However, this strategy may not lead to querying the most informative edge weights. Instead, one can construct more sophisticated query strategies based on information in one or more of the following three components: the current clustering Ci, the current query matrix Qi and the current similarity function σi. This paper investigates two ways of quantifying the informativeness of edges: inconsistency and uncertainty. Both of these notions are explained in the coming sections. 3.1 Uncertainty and Frequency Uncertainty usually refers to lack of knowledge. Therefore, one way to quantify uncertainty is to consider the edge with the smallest edge weight in absolute value. In other words, we select and query the edge according to ˆe = arg min e∈E |σi(e)|. (5) However, this is not an optimal strategy since a low absolute value of an edge weight does not necessarily imply informativeness. To see this, consider three distinct nodes (u, v, w) ⊆ V with pairwise similarities {σ(u, v), σ(u, w), σ(v, w)} = {1, 1, 0.1}. While σ(v, w) has a small value in absolute value, one can infer that its value must be 1 using the transitive property of pairwise similarities (see Section 3.2). Thus, querying the edge (v, w) is unlikely to impact the resulting clustering. However, the resulting clustering also depends on interactions with all the remaining objects in V . Thus, it is possible to more accurately quantify the informativeness by considering such interactions. An alternative strategy, called frequency, aims to query the edge with the smallest number of queries so far, i.e., ˆe = arg min e∈E |Qi e|. (6) Note that (5) and (6) will behave very similarly if the pairwise similarities in the initial similarity matrix σ0 are small in absolute value, e.g., |σ0(e)| ≤ 0.1 for all e ∈ E. Additionally, with a more noisy oracle, (5) may query the same edge more than once (which could be beneficial), although this is quite unlikely. Finally, a batch of edges B ⊆ E can be selected by selecting the top |B| edges from (5) or (6). 3.2 Inconsistency and the Maxmin Query Strategy By inconsistency we mean that there is no clustering C ∈ Cz of some z ⊆ V such that the clustering cost ∆(z,σ,C) is 0. This occurs when the similarity function σ consists of conflicting information about how a particular edge (u, v) ∈ Ez is to be clustered. In turn, this happens when σ does not satisfy the transitive property of the pairwise similarities. Sets of three objects (u, v, w) ⊆ V , which we call triangles, are the smallest collection of objects for which an inconsistency 5 can occur. The transitive property says that if σ(u, v) ≥ 0 and σ(u, w) ≥ 0 then σ(v, w) ≥ 0 or if σ(u, v) ≥ 0 and σ(u, w) < 0 then σ(v, w) < 0. In fact, the inconsistencies in a set of four or more objects in V comes down to considering each of the triangles that can be constructed from the objects in the set. We discuss this in more detail later, but it highlights the importance of triangles. We denote by T the set of triangles t = (u, v, w) of distinct objects in V , i.e., |T | = (cid:0)|V | (cid:1). Note that Et = {(u, v), (u, w), (v, w)} corresponds to the edges involving the objects in some triangle t ∈ T . 3 In this section, we propose a query strategy that queries the weight of an edge in some triangle t ∈ T with the smallest contribution to the inconsistency of t. Such an edge represents the minimal correction of the edge weights in the triangle t in order to satisfy consistency. Furthermore, since we are in an active learning setting, we want to choose the maximum of such corrections among all the triangles (to gain maximal information). We call this query strategy maxmin. Theorem 1 provides a way to select an edge according to the maxmin query strategy. Theorem 1. Given σ, let Tσ ⊆ T be the set of triangles t = (u, v, w) ∈ T with exactly two positive edge weights and one negative edge weight. Then, the maxmin query strategy corresponds to querying the weight of the edge ˆe selected by (ˆt, ˆe) = arg max t∈Tσ min e∈Et |σ(e)|. (7) Proof. See Appendix A.1. The set Tσ introduced in Theorem 1 will be referred to as the set of bad triangles (given σ). The reason is that for every t ∈ Tσ there is no clustering C ∈ Ct such that ∆(t,σ,C) = 0 (i.e., they induce inconsistency). On the other hand, T \ Tσ will be referred to as the set of good triangles, i.e., those for which there is a clustering C ∈ Ct such that ∆(t,σ,C) = 0. We now provide some further motivation for why we consider triangles (i.e., collections of three objects) instead of collections of four or more objects in V . We say that two triangles t1, t2 ∈ T are correlated if they share an edge. A lower bound of minC∈CV ∆(V ,σ,C) can be obtained by summing the minimal cost minC∈Ct ∆(t,σ,C) of all edge-disjoint (uncorrelated) bad triangles. This is because all uncorrelated bad triangles t must contain at least one unique edge (u, v) ∈ Et that violates the clustering. It is a lower bound since additional mistakes can occur in any triangle t ∈ T (whether it is good or bad) if it is correlated with one or more bad triangles. Thus, a clustering algorithm A must consider such correlations in order to find a clustering that best balances all of the (possibly conflicting) inconsistencies. The inconsistencies that can occur among collections of four or more objects in V boil down to considering the (potentially correlated) triangles that can be constructed from the objects in the collection. Thereby, it is clear that maxmin prefers to select edges in bad triangles. Assuming Tσ∗ = ∅, if Tσi (cid:54)= ∅ in some iteration i (due to a poor initialization of σ0 or a noisy oracle), then all bad triangles t ∈ Tσi are guaranteed to contain at least one edge e ∈ Et with a similarity σi(e) that does not agree with σ∗(e) (i.e., wrong information). Therefore, it would be beneficial to query the edges in bad triangles in order to reveal σ∗ as quickly as possible. We observe that maxmin would prefer a bad triangle with the edge weights {1, 0.7, −0.7} over a bad triangle with the edge weights {1, 1, −0.1}. The intuition behind this is that the first triangle is more confidently inconsistent compared to the second one. Therefore, it makes sense to prioritize querying one of the edges in the first triangle to resolve the inconsistency. Finally, since maxmin ranks all good triangles equally we will follow the random query strategy to select an edge if Tσi = ∅ in some iteration i. Also, a batch of edges B ⊆ E can be selected by selecting the top |B| edges from (7). 3.3 Maxexp Query Strategy Consider a triangle (u, v, w) with edge weights {σ(u, v), σ(u, w), σ(v, w)} and assume σ(u, v) is fixed and that |σ(u, w)| ≥ |σ(u, v)| and |σ(v, w)| ≥ |σ(u, v)|. Then, the maxmin strategy will give equal scores to all such triangles regardless of what σ(u, w) and σ(v, w) are, since |σ(u, v)| is always the smallest edge weight in absolute value. Hence, a triangle t1 with edge weights {1, 1, −0.1} will be ranked equally to a triangle t2 with edge weights {0.1, 0.1, −0.1}. We would like for t1 to be selected over t2 since it is more confidently inconsident. This issue occurs because maxmin discards all edges except for the edge with minimal weight in absolute value. One way to fix this is to replace the smallest absolute edge weight (i.e., the minimal inconsistency) with the expected inconsistency or violation. We call this query strategy maxexp. 6 Given a triangle t ∈ T , maxexp defines the probability of a clustering C ∈ Ct as p(C|t) = (cid:80) exp(−β∆(t,σ,C)) C(cid:48)∈Ct exp(−β∆(t,σ,C(cid:48))) , (8) where β is a hyperparameter to be discussed later. Eq. 8 assigns a higher probability to clusterings with a smaller clustering cost in the triangle t. Then, we can compute the expected cost of a triangle as E[∆t] := EC∼P (Ct)[∆(t,σ,C)] p(C|t)∆(t,σ,C). (cid:88) = (9) C∈Ct Note that while maxmin gives all good triangles a score of 0, maxexp will not do so in general (except if β = ∞, see next section). However, a larger expected cost for a good triangle does not imply that it is more informative like it does for a bad triangle. Therefore, we restrict maxexp to query edge weights from bad triangles, i.e., those that are guaranteed to contribute to an inconsistency: ˆt = arg max t∈Tσ E[∆t]. (10) We can then select the edge from ˆt with the smallest absolute edge weight, i.e., ˆe = mine∈E ˆt |σ(e)|. A batch B ⊆ E is selected as for maxmin. Thus, in summary, maxexp queries edges in bad triangles with the largest expected clustering cost. In the case that Tσi = ∅ in iteration i, we query an edge weight uniformly at random. In Appendix B, we discuss some possible further extensions of maxexp. 3.4 Further Analysis of Maxmin and Maxexp In this section, we analyze the behavior of maxexp compared to maxmin. Further details are provided in Appendix B. Any triangle t = (u, v, w) ∈ T can be clustered in five different ways, i.e., Ct = {C t 5} = {{(u, v, w)}, {(u), (v, w)}, {(v), (u, w)}, {(w), (u, v)}, {(u), (v), (w)}} (order is important here). The pairwise similarities of a triangle t ∈ T are denoted by {s1, s2, s3} := {σ(u, v), σ(u, w), σ(v, w)} (order is important here too). Let pj := p(C t Lemma 1. Given a bad triangle t ∈ Tσ where s1 and s2 are positive and s3 is negative. We have j|t) for j = 1, . . . , 5. Then, Lemma 1 provides an expression for the expected cost E[∆t]. 1, . . . , C t E[∆t] = p1|s3| + p2(|s1| + |s2| + |s3|) + p3|s1| + p4|s2| + p5(|s1| + |s2|). Proof. See Appendix A.2. From Lemma 1 we conclude two insights. First, the larger the pairwise similarities are in absolute value the larger the expected cost (i.e., maxexp prioritizes the bad triangles that are more confidently inconsistent). Second, we note that the two positive edges violate three of the five clusterings while the negative edge only violates two of the clusterings. This implies that there is a bias towards the bad triangles wherein the positive edge weights are larger compared to the negative edge weight in absolute value. See Appendix B for more about this. Furthermore, maxmin can be regarded as a special case of maxexp when β = ∞, as shown in Lemma 2. Lemma 2. Given a bad triangle t ∈ Tσ where s1 and s2 are positive and s3 is negative. The optimization problems in (7) and (10) are equivalent if β = ∞, i.e., Furthermore, if β = 0 we have Proof. See Appendix A.3. lim β→∞ E[∆t] = min e∈Et |σ(e)|, ∀t ∈ Tσ. E[∆t] ∝ |s1| + |s2| + lim β→0 2 3 |s3|. 7 (11) (12) From Lemma 2 we see that β can be used to control the level of confidence we put in each of the clusterings when computing the expected cost. The most optimistic case is when β = ∞ where we put all the confidence in the most likely clustering (i.e., the clustering with the smallest cost). The most pessimistic case is when β = 0 where all clusterings are weighted equally. Intermediate values of β will result in different weightings of the clusterings, leading to different rankings of the triangles. The best value of β depends on the problem, and usually, a wide range of values is acceptable. If we assume Tσ∗ = ∅ and Tσ0 = ∅, then we can interpret maxmin and Exploration with maxmin and maxexp. maxexp as follows. They begin querying edges randomly (since there are no bad triangles initially) and as soon as bad triangles appear due to the new queries, they will begin to actively fix the bad triangles (i.e., turn them into good triangles). When the noise level γ is large, they might waste too many queries on fixing bad triangles, leading to a lack of exploration of other edges, thus degrading the performance in the long run. There are various options to alleviate this issue by improving the exploration. In this paper, we solve this issue in two ways. First, we consider a hard limit on the number of times one can query an edge. This limit is denoted by τ and we have maxe∈E |Qi e| ≤ τ for all i. Second, we consider (cid:15)-greedy selection where one queries edge weights according to maxmin (or maxexp) with probability 1 − (cid:15) or uniformly at random with probability (cid:15). More sophisticated exploration techniques adopted from multi-armed bandits can also be used which will be investigated in future work. 4 Experiments In this section, we present our experimental studies on three different datasets. 4.1 Experiment setup For each experiment, we are given a classification dataset X = {x1, . . . , xN } with the labels Y = {y1, . . . , yN }. We treat the data points in X as the objects V . Note that (cid:15) = 0, τ = 5 and β = 1 for all experiments unless otherwise specified. Pairwise similarity functions. For each (u, v) ∈ E, we set σ∗(u, v) to +1 if yu = yv and −1 otherwise. The initial similarity function σ0 is initialized as follows. We run k-means++ with k clusters on X. This will result in a clustering C ∈ CV . Then, for each (u, v) ∈ E we set σ0(u, v) to +0.1 if u and v are in the same cluster according to C and −0.1 otherwise. This will give an initial similarity function σ0 with partial information about σ∗. Note that we set the similarities to 0.1 in absolute value indicating that we are not fully confident about them. Clustering algorithm. All experiments use the correlation clustering algorithm A introduced in Section 2.3. Query strategies. We consider five different query strategies in the experiments: random, uncertainty (5), fre- quency (6), maxmin (7) and maxexp (10). Performance evaluation. between the current clustering Ci and the ground truth clustering C ∗ In each iteration of an active clustering procedure, we calculate the adjusted rand score (V ,σ∗). We perform the experiments on a synthetic dataset and on samples of CIFAR10 and 20newsgroups datasets, all of which are listed and explained below. Synthetic dataset. The synthetic dataset consists of N = 80 5-dimensional normally distributed data points with five balanced clusters. We set k = 5 when initializing σ0 using k-means++. We set the batch size |B| = 1 for all the experiments with this dataset. CIFAR10. For the CIFAR10 dataset, we randomly select 25 data points from each of the 10 classes resulting in a dataset with N = 250 data points with 10 clusters. We use a resnet18 model [36] trained on the full CIFAR10 dataset in order to embed the 250 data points into a 512-dimensional space. We then perform k-means++ with k = 4 (to make the task more difficult) in the latent space of the final layer of the trained resnet18 model. The resulting clustering is used to initialize σ0. We set the batch size |B| = 5 for all the experiments with this dataset. 20newsgroups. For the 20newsgroups dataset, we randomly select 12 data points from each of the 20 classes resulting in a dataset with N = 240 data points with 20 clusters. We use the distilbert-base-uncased transformer model 8 loaded from the Flair python library [37] in order to embed each of the 240 documents (data points) into a 768- dimensional latent space. We then perform k-means++ in this latent space with k = 20. The resulting clustering is used to initialize σ0. We set the batch size |B| = 10 for all the experiments with this dataset. 4.2 Results and discussion (a) γ = 0 (b) γ = 0 (c) γ = 0.2 (d) γ = 0.2 Figure 1: Results for the synthetic dataset for all query strategies with τ = 5. (a) γ = 0 (b) γ = 0 (c) γ = 0.2 (d) γ = 0.2 Figure 2: Results for CIFAR10 for all query strategies with τ = 5. (a) γ = 0 (b) γ = 0 (c) γ = 0.2 (d) γ = 0.2 Figure 3: Results for 20newsgroups for all query strategies with τ = 5. In this section, we describe the results for each of the datasets. Figure 1 shows the results for the synthetic dataset. Figure 1(a) shows the results for all query strategies with γ = 0 and (cid:15) = 0. Figure 1(b) shows the results for maxmin and maxexp with γ = 0 for different values of (cid:15). Figures 1(c) and 1(d) illustrate a similar investigation but for γ = 0.2. Additionally, Figures 2 and 3 show the same study as in Figure 1, respectively for the CIFAR10 and 20newsgroups datasets. Each active learning procedure is repeated 30 times with different seeds. Thus, each plot shows the average of the repetitions with the variance indicated by a shaded color. We observe that maxexp outperforms all other methods for all datasets except for 20newsgroups where it performs similar to maxmin. Maxmin performs well overall but has more trouble with converging compared to maxexp. As expected, uncertainty and frequency perform very similarly (as discussed in Section 3), while outperforming random in all cases. The results on 20newsgroups are more smooth compared to the other datasets, likely due to larger batch size. The larger batch size could also explain why maxmin and maxexp perform similarly for this dataset. Also, we see that all query strategies manage to find the ground-truth clustering in a noisy setting. This observation confirms that the methods are robust to noise. 9 Furthermore, we see that using (cid:15)-greedy selection improves the performance of both maxmin and maxexp due to the improved exploration. With maxmin we observe significant improvement in performance on the synthetic dataset and in particular on CIFAR10. For CIFAR10, maxmin outperforms maxexp with (cid:15) = 0.2, 0.4. In Appendix C, we report additional results including experiments with different values of τ , β, and γ. 5 Conclusion In this paper, we developed a generic framework for active clustering with queries for pairwise similarities that can be any positive or negative number. It provides maximal flexibility and robustness w.r.t. the type of the feedback given by a user or an annotator. We then proposed a number of novel query strategies suited well to our active learning framework. In particular, the query strategies maxmin and maxexp yield superior results in various experimental studies. Acknowledgements This work was partially supported by the Wallenberg AI, Autonomous Systems and Software Program (WASP) funded by Knut and Alice Wallenberg Foundations References [1] Neil Rubens, Mehdi Elahi, Masashi Sugiyama, and Dain Kaplan. Active Learning in Recommender Systems, pages 809–846. 2015. [2] Zhao Shuyang, Toni Heittola, and Tuomas Virtanen. Active learning for sound event detection. IEEE/ACM Trans. Audio, Speech and Lang. Proc., 28:2895–2905, nov 2020. [3] Sanna Jarl, Linus Aronsson, Sadegh Rahrovani, and Morteza Haghir Chehreghani. Active learning of driving scenario trajectories. Eng. Appl. Artif. Intell., 113:104972, 2022. [4] Simon Viet Johansson, Hampus Gummesson Svensson, Esben Bjerrum, Alexander Schliep, Morteza Haghir Chehreghani, Christian Tyrchan, and Ola Engkvist. Using active learning to develop machine learn- ing models for reaction yield prediction. Molecular Informatics, 41(12):2200043, 2022. [5] Songbai Yan, Kamalika Chaudhuri, and Tara Javidi. Active learning with logged data. In Jennifer G. Dy and Andreas Krause, editors, Proceedings of the 35th International Conference on Machine Learning (ICML), volume 80 of Proceedings of Machine Learning Research, pages 5517–5526. PMLR, 2018. [6] Burr Settles. Active learning literature survey. Computer Sciences Technical Report 1648, University of Wisconsin–Madison, 2009. [7] Ozan Sener and Silvio Savarese. Active learning for convolutional neural networks: A core-set approach. In 6th International Conference on Learning Representations, ICLR, 2018. [8] James T. Wilson, Frank Hutter, and Marc Peter Deisenroth. Maximizing acquisition functions for bayesian optimization. In Advances in Neural Information Processing Systems (NIPS), 2018. [9] S. Tong. Active learning: theory and applications. Stanford University, 2001. [10] Pranjal Awasthi and Reza Bosagh Zadeh. Supervised clustering. In Advances in Neural Information Processing Systems (NIPS), pages 91–99, 2010. [11] Maria-Florina Balcan and Avrim Blum. Clustering with interactive feedback. In Yoav Freund, László Györfi, György Turán, and Thomas Zeugmann, editors, Algorithmic Learning Theory, pages 316–328, Berlin, Heidelberg, 2008. Springer Berlin Heidelberg. [12] Pranjal Awasthi, Maria Florina Balcan, and Konstantin Voevodski. Local algorithms for interactive clustering. Journal of Machine Learning Research, 18(3):1–35, 2017. [13] Hassan Ashtiani, Shrinu Kushagra, and Shai Ben-David. Clustering with same-cluster queries. In D. Lee, M. Sugiyama, U. Luxburg, I. Guyon, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 29. Curran Associates, Inc., 2016. [14] Arya Mazumdar and Barna Saha. Query complexity of clustering with side information. In I. Guyon, U. Von Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017. 10 [15] Arya Mazumdar and Barna Saha. Clustering with noisy queries. In I. Guyon, U. Von Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017. [16] Nir Ailon, Anup Bhattacharya, and Ragesh Jaiswal. Approximate correlation clustering using same-cluster queries. In Michael A. Bender, Martín Farach-Colton, and Miguel A. Mosteiro, editors, LATIN 2018: Theoretical Informatics, pages 14–27, Cham, 2018. Springer International Publishing. [17] Barna Saha and Sanjay Subramanian. Correlation Clustering with Same-Cluster Queries Bounded by Optimal Cost. In Michael A. Bender, Ola Svensson, and Grzegorz Herman, editors, 27th Annual European Symposium on Algorithms (ESA 2019), volume 144 of Leibniz International Proceedings in Informatics (LIPIcs), pages 81:1–81:17, Dagstuhl, Germany, 2019. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik. [18] Brian Eriksson, Gautam Dasarathy, Aarti Singh, and Rob Nowak. Active clustering: Robust and efficient hierarchical clustering using adaptively selected similarities. In Geoffrey Gordon, David Dunson, and Miroslav Dudík, editors, Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics, volume 15 of Proceedings of Machine Learning Research, pages 260–268, Fort Lauderdale, FL, USA, 11–13 Apr 2011. PMLR. [19] Akshay Krishnamurthy, Sivaraman Balakrishnan, Min Xu, and Aarti Singh. Efficient active algorithms for hierarchical clustering. In Proceedings of the 29th International Coference on International Conference on Machine Learning, ICML'12, page 267–274, Madison, WI, USA, 2012. Omnipress. [20] Francesco Bonchi, David García-Soriano, and Konstantin Kutzkov. Local correlation clustering, 2013. [21] Ramya Korlakai Vinayak and Babak Hassibi. Crowdsourced clustering: Querying edges vs triangles. In D. Lee, M. Sugiyama, U. Luxburg, I. Guyon, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 29. Curran Associates, Inc., 2016. [22] Marco Bressan, Nicolò Cesa-Bianchi, Andrea Paudice, and Fabio Vitale. Correlation clustering with adaptive similarity queries. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. [23] David García-Soriano, Konstantin Kutzkov, Francesco Bonchi, and Charalampos Tsourakakis. Query-efficient correlation clustering. In Proceedings of The Web Conference 2020, WWW '20, page 1468–1478, New York, NY, USA, 2020. Association for Computing Machinery. [24] Nikhil Bansal, Avrim Blum, and Shuchi Chawla. Correlation clustering. Machine Learning, 56(1-3):89–113, 2004. [25] Erik D. Demaine, Dotan Emanuel, Amos Fiat, and Nicole Immorlica. Correlation clustering in general weighted graphs. Theor. Comput. Sci., 361(2-3):172–187, 2006. [26] Nir Ailon, Moses Charikar, and Alantha Newman. Aggregating inconsistent information: Ranking and clustering. J. ACM, 55(5):23:1–23:27, 2008. [27] Moses Charikar, Venkatesan Guruswami, and Anthony Wirth. Clustering with qualitative information. J. Comput. Syst. Sci., 71(3):360–383, 2005. [28] Micha Elsner and Warren Schudy. Bounding and comparing methods for correlation clustering beyond ILP. In Proceedings of the Workshop on Integer Linear Programming for Natural Language Processing, pages 19–27, Boulder, Colorado, June 2009. Association for Computational Linguistics. [29] Ioannis Giotis and Venkatesan Guruswami. Correlation clustering with a fixed number of clusters. In Proceedings of the Seventeenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2006, Miami, Florida, USA, January 22-26, 2006, pages 1167–1176. ACM Press, 2006. [30] Erik Thiel, Morteza Haghir Chehreghani, and Devdatt P. Dubhashi. A non-convex optimization approach to correlation clustering. In The Thirty-Third AAAI Conference on Artificial Intelligence, AAAI, pages 5159–5166. AAAI Press, 2019. [31] Morteza Haghir Chehreghani. Shift of pairwise similarities for data clustering. Machine Learning, 2022. [32] Inderjit S. Dhillon, Yuqiang Guan, and Brian Kulis. Kernel k-means: spectral clustering and normalized cuts. In Won Kim, Ron Kohavi, Johannes Gehrke, and William DuMouchel, editors, Proceedings of the Tenth ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pages 551–556. ACM, 2004. [33] Inderjit S. Dhillon, Yuqiang Guan, and Brian Kulis. A unified view of kernel k-means, spectral clustering and graph cuts. Technical Report TR-04-25, 2005. 11 [34] Morteza Haghir Chehreghani. Clustering by shift. In Vijay Raghavan, Srinivas Aluru, George Karypis, Lucio Miele, and Xindong Wu, editors, IEEE International Conference on Data Mining, ICDM, pages 793–798. IEEE Computer Society, 2017. [35] Sashank J. Reddi, Suvrit Sra, Barnabás Póczos, and Alexander J. Smola. Stochastic frank-wolfe methods for nonconvex optimization. In 54th Annual Allerton Conference on Communication, Control, and Computing, Allerton, pages 1244–1251. IEEE, 2016. [36] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. CoRR, abs/1512.03385, 2015. [37] Alan Akbik, Duncan Blythe, and Roland Vollgraf. Contextual string embeddings for sequence labeling. In COLING 2018, 27th International Conference on Computational Linguistics, pages 1638–1649, 2018. A Proofs A.1 Proof of theorem 1 Proof. Consider a triangle t = (u, v, w) ∈ T with pairwise similarities {s1, s2, s3} := {σ(u, v), σ(u, w), σ(v, w)}. The clusterings of a triangle t is Ct = {C1, . . . , C5} = {(u, v, w), {(u), (v, w)}, {(v), (u, w)}, {(w), (u, v)}, {(u), (v), (w)}}. Given this, Table 1 shows the clustering cost for each clustering in Ct for all possible signs of the edge weights {s1, s2, s3}. From this, we see that only the triangles with two positive edge weights and one negative edge weight have no clustering with a clustering cost of 0. Thus, the triangles in Tσ are guaranteed to be inconsistent while the minimal clustering cost of all other triangles t ∈ T \ Tσ is always 0 (i.e., they can yield a consistent clustering). Furthermore, for the triangles t ∈ Tσ we see that the clusterings C1, C3 and C4 corresponds to only one of the edges (i.e., s3, s1 and s2, respectively) violating the clustering. For the clustering C2 all edges violate the clustering and for C5 we have that s1 and s2 violate the clustering. This implies that C1, C3 or C4 will always correspond to the clustering with minimal cost, i.e., minC∈Ct ∆(t,σ,C) = mine∈Et |σ(e)| for all t ∈ Tσ. Thus, for a given triangle t ∈ Tσ, we should pick the edge according to arg mine∈Et |σ(e)|. Finally, among all the triangles t ∈ Tσ, we choose the edge that yields maximal inconsistency, i.e., (ˆt, ˆe) = arg maxt∈Tσ mine∈Et |σ(e)|. It should be noted that if Tσ (cid:54)= ∅, then Eq. 7 corresponds to first selecting the triangle t ∈ T with the maximal minimum clustering cost, i.e., and then selecting an edge from ˆt according to ˆt = arg max t∈T min C∈Ct ∆(t,σ,C), ˆe = arg min |σ(e)|. e∈E ˆt This is true since minC∈Ct ∆(t,σ,C) ≥ 0 for all t ∈ Tσ while minC∈Ct ∆(t,σ,C) = 0 for all t ∈ T \ Tσ. {s1, s2, s3} {+, +, +} {+, +, −} {+, −, −} {−, −, −} ∆(t,σ,C1) 0 |s3| |s2| + |s3| |s1| + |s2| + |s3| ∆(t,σ,C2) |s1| + |s2| |s1| + |s2| + |s3| |s1| + |s3| |s3| ∆(t,σ,C3) |s1| + |s3| |s1| |s1| + |s2| |s2| ∆(t,σ,C4) |s2| + |s3| |s2| 0 |s1| ∆(t,σ,C5) |s1| + |s2| + |s3| |s1| + |s2| |s1| 0 Table 1: Consider a triangle t = (u, v, w) ∈ T with pairwise similarities {s1, s2, s3} := {σ(u, v), σ(u, w), σ(v, w)}. The clusterings of a triangle t is Ct = {C1, . . . , C5} = {(u, v, w), {(u), (v, w)}, {(v), (u, w)}, {(w), (u, v)}, {(u), (v), (w)}}. The first column indicates the sign of the pairwise similarities {s1, s2, s3}. The remaining columns show the clustering cost for each of the clusterings. 12 A.2 Proof of lemma 1 Proof. Given the clusterings Ct it follows directly from the definition of the clustering cost in Eq. 2 in the main text, i.e., 5 (cid:88) i=1 5 (cid:88) E[∆t] = = pi∆(t,σ,Ct i ) (cid:88) pi R(t,σ,Ct i )(u, v) i=1 (u,v)∈Et = p1|s3| + p2(|s1| + |s2| + |s3|) + p3|s1| + p4|s2| + p5(|s1| + |s2|). The last equality can easily be understood from inspecting the row where {s1, s2, s3} = {+, +, −} in Table 1. A.3 Proof of lemma 2 Proof. Based on (8) we see that as β → ∞ all probability mass will be put on the clustering(s) with the smallest clustering cost which yields (11) (from Theorem 1). Furthermore, from (8) we have that limβ→0 pi = 1 5 for all i = 1, . . . , 5 which gives E[∆t] = lim β→0 = 1 5 1 5 5 (cid:88) i=1 ∆Ct i (σi) (3|s1| + 3|s2| + 2|s3|) ∝ |s1| + |s2| + 2 3 |s3|. B More on maxmin and maxexp In this section, we further investigate maxmin and maxexp, and then discuss some extensions to maxexp. B.1 Further analysis of maxmin and maxexp Figure 4 visualizes how maxexp ranks triangles for different values of β. We observe that a higher value of β makes the maxexp cost more concentrated around bad triangles with the edge weights {1, 1, −1}. When β < ∞, maxexp will still give the highest cost to {1, 1, −1} (as desired), but the cost for surrounding triangles is assigned in a smoother and more principled manner. Also, while the ranking of good triangles is not relevant in our case, we can see how different values of β rank them differently. Additionally, Table 2 illustrates some more subtle differences of maxexp with different values of β. The main takeaway is that when β < ∞, the ranking of various triangles follows more accurately the intuition that triangles that are more confidently inconsistent should be ranked higher (i.e., more likely to be selected). σi(u, v) 1 0.8 -0.8 1 -1 1 0.1 σi(u, w) 1 0.5 0.5 1 1 1 0.1 σi(v, w) E[∆t|β = 1] E[∆t|β = ∞] E[∆t|β = 0] -1 -0.5 0.5 -0.1 0.1 1 -0.1 1.18 0.77 0.74 0.71 0.69 0.66 0.15 1 0.5 0.5 0.1 0.1 0 0.1 1.6 0.98 0.92 1.24 1.06 1.8 0.16 Table 2: The expected cost E[∆t] of a triangle t = (u, v, w) for different values of β. 13 (a) β = 0 (b) β = 1 (c) β = 3 (d) β = ∞ (maxmin) Figure 4: The expected loss E[∆t] of a triangle t = (u, v, w) with different values of β. B.2 Further extensions of maxexp One can in principle extend the probabilistic perspective to selecting edges and triangles. We can define the probability of an edge e ∈ Et given a clustering C ∈ Ct as p(e|C) = (cid:80) exp(βR(t,σ,C)(e)) e(cid:48)∈Et exp(βR(t,σ,C)(e(cid:48)) ). (13) Then, after selecting a triangle t using (10), we first sample a clustering from (8) and then given this sampled clustering, we sample an edge from (13). This may result in improved exploration. Alternatively, we can define the expected cost of an edge e given a triangle t as E[∆e|t] := EC∼P (Ct)[R(t,σ,C)(e)|t] = (cid:88) C∈Ct p(C|t)R(t,σ,C)(e) . Then, we define the probability of an edge e given a triangle t as p(e|t) = An edge can either be selected according to exp(βE[∆e|t]) (cid:80) e(cid:48)∈Et exp(βE[∆e(cid:48)|t]) . ˆe = arg max e∈E ˆt E[∆e|t] , 14 (14) (15) (16) or we can sample an edge ˆe from p(e|ˆt). Additionally, we can define the probability of a triangle given an edge according to p(t|e) = (cid:80) exp(βE[∆t]) exp(βE[∆t(cid:48)]) t(cid:48)∈T e . (17) where T e ⊆ T is the set of triangles containing the edge e. Now we can define an informativeness measure of any edge e ∈ E by I(e) := Et,C∼P (T e,Ct)[R(t,σ,C)(e)] = Et∼P (T e)[EC∼P (Ct)[R(t,σ,C)(e)|t]] = Given this, one could select an edge to be queried according to ˆe = arg max I(e). e∈E C Additional experiments (cid:88) p(t|e) (cid:88) t∈T e C∈Ct p(C)R(t,σ,C)(e). (18) (19) In this section, we present several additional experimental results. We use (cid:15) = 0, τ = 5 and β = 1 unless otherwise specified. Figure 5 illustrates the results for the synthetic dataset with the adjusted rand index as the performance metric. Each row shows the results for the noise levels γ = 0, 0.2, 0.4, respectively. The first column shows the results for all query strategies. The second column shows the results for maxmin and maxexp with (cid:15) = 0, 0.2, 0.4. The third column shows the results for maxexp with τ = 1, 2, 3, 5, 20, ∞. The fourth column shows the results for maxexp with β = 0, 0.5, 1, 2, 5, 25, ∞. Figure 6 shows similar results for the synthetic dataset but using the adjusted mutual information (AMI) performance metric. Finally, Figures 7-8 and Figures 9-10 illustrate similar investigations for the CIFAR10 and 20newsgroups datasets, respectively. Each active learning procedure is repeated 30 times with different seeds. Thus, each plot shows the average and the variance indicated by a shaded color. From these figures, we observe similar results about the query strategies to the results outlined in Section 4.2. However, we see that for γ = 0.4 the performance of maxmin and maxexp becomes closer to the baselines. This is expected since for higher noise levels there will be a larger number of bad triangles which exacerbate the exploration issue for maxmin and maxexp, as described at the end of Section 3.4 in the main text. However, the results improve when more exploration is induced either through (cid:15)-greedy selection or by setting τ appropriately. In addition, we observe that for all datasets the performance of maxexp remains the same for various values of τ ≥ 1 when γ = 0 (see, e.g., Figure 5(c)). This makes sense since with zero noise one gains no extra information from querying the same edge more than once, which maxexp (and maxmin) accurately detects. However, for γ = 0.2, we see (in, e.g., Figure 5(g)) that maxexp performs worse when τ < 5. This confirms that maxexp (and maxmin) is benefiting from querying the same edge more than once when the oracle is noisy. Finally, when γ = 0.4, the noise is so high such that maxexp will query the same edges more than what is optimal, leading to exploration issues. This can be observed in, e.g., Figure 5(k) where the performance gets worse when τ = ∞ while the best performance is obtained with τ = 20. Thus, for higher noise levels one can not simply set τ = ∞ and expect an optimal behavior. Finally, from the experiments with different values of β, it is clear that a wide range of values for β are acceptable. However, as β → ∞ the performance seems to degrade for all datasets except 20newsgroups. For 20newsgroups, the batch size |B| is set to 10. Thus, it seems that the larger the batch size is the closer the performance of maxmin and maxexp will be. In the extreme case when |B| = |Tσi| it is clear that they are identical. 15 (a) γ = 0 (b) γ = 0 (c) γ = 0 (d) γ = 0 (e) γ = 0.2 (f) γ = 0.2 (g) γ = 0.2 (h) γ = 0.2 (i) γ = 0.4 (j) γ = 0.4 (k) γ = 0.4 (l) γ = 0.4 Figure 5: Results for the synthetic dataset for all query strategies with adjusted rand score as the performance metric. 16 (a) γ = 0 (b) γ = 0 (c) γ = 0 (d) γ = 0 (e) γ = 0.2 (f) γ = 0.2 (g) γ = 0.2 (h) γ = 0.2 (i) γ = 0.4 (j) γ = 0.4 (k) γ = 0.4 (l) γ = 0.4 Figure 6: Results for the synthetic dataset for all query strategies with adjusted mutual information (AMI) as the performance metric. 17 (a) γ = 0 (b) γ = 0 (c) γ = 0 (d) γ = 0 (e) γ = 0.2 (f) γ = 0.2 (g) γ = 0.2 (h) γ = 0.2 (i) γ = 0.4 (j) γ = 0.4 (k) γ = 0.4 (l) γ = 0.4 Figure 7: Results for CIFAR10 for all query strategies with adjusted rand score as the performance metric. 18 (a) γ = 0 (b) γ = 0 (c) γ = 0 (d) γ = 0 (e) γ = 0.2 (f) γ = 0.2 (g) γ = 0.2 (h) γ = 0.2 (i) γ = 0.4 (j) γ = 0.4 (k) γ = 0.4 (l) γ = 0.4 Figure 8: Results for CIFAR10 for all query strategies with adjusted mutual information (AMI) as the performance metric. 19 (a) γ = 0 (b) γ = 0 (c) γ = 0 (d) γ = 0 (e) γ = 0.2 (f) γ = 0.2 (g) γ = 0.2 (h) γ = 0.2 (i) γ = 0.4 (j) γ = 0.4 (k) γ = 0.4 (l) γ = 0.4 Figure 9: Results for 20newsgroups for all query strategies with adjusted rand score as the performance metric. 20 (a) γ = 0 (b) γ = 0 (c) γ = 0 (d) γ = 0 (e) γ = 0.2 (f) γ = 0.2 (g) γ = 0.2 (h) γ = 0.2 (i) γ = 0.4 (j) γ = 0.4 (k) γ = 0.4 (l) γ = 0.4 Figure 10: Results for 20newsgroups for all query strategies with adjusted mutual information (AMI) as the performance metric. 21
http://arxiv.org/abs/2302.10289v9
2023-07-07T05:50:00
2023-02-20T20:25:41
Tackling Shortcut Learning in Deep Neural Networks: An Iterative Approach with Interpretable Models
We use concept-based interpretable models to mitigate shortcut learning. Existing methods lack interpretability. Beginning with a Blackbox, we iteratively carve out a mixture of interpretable experts (MoIE) and a residual network. Each expert explains a subset of data using First Order Logic (FOL). While explaining a sample, the FOL from biased BB-derived MoIE detects the shortcut effectively. Finetuning the BB with Metadata Normalization (MDN) eliminates the shortcut. The FOLs from the finetuned-BB-derived MoIE verify the elimination of the shortcut. Our experiments show that MoIE does not hurt the accuracy of the original BB and eliminates shortcuts effectively.
[ "Shantanu Ghosh", "Ke Yu", "Forough Arabshahi", "Kayhan Batmanghelich" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10289v9", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10289v9", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.CV" ]
Tackling Shortcut Learning in Deep Neural Networks: An Iterative Approach with Interpretable Models 3 2 0 2 l u J 7 ] G L . s c [ 9 v 9 8 2 0 1 . 2 0 3 2 : v i X r a Shantanu Ghosh 1 Ke Yu 2 Forough Arabshahi 3 Kayhan Batmanghelich 1 Abstract We use concept-based interpretable models to mit- igate shortcut learning. Existing methods lack interpretability. Beginning with a Blackbox, we iteratively carve out a mixture of interpretable experts (MoIE) and a residual network. Each ex- pert explains a subset of data using First Order Logic (FOL). While explaining a sample, the FOL from biased BB-derived MoIE detects the shortcut effectively. Finetuning the BB with Metadata Nor- malization (MDN) eliminates the shortcut. The FOLs from the finetuned-BB-derived MoIE verify the elimination of the shortcut. Our experiments show that MoIE does not hurt the accuracy of the original BB and eliminates shortcuts effectively. 1. Introduction Shortcuts pose a significant challenge to the generalizabil- ity of deep neural networks, denoted as Blackbox (BB), in real-world scenarios (Geirhos et al., 2020; Kaushik et al., 2019). Referred to as spurious correlations, shortcuts indi- cate statistical associations between class labels and coin- cidental features that lack a meaningful causal connection. When trained on a dataset with shortcuts, a BB performs poorly when applied to test data without these shortcuts. This restricted generalization capability engenders a crucial concern, particularly in critical applications e.g., medical diagnosis (Bissoto et al., 2020). Various methods e.g., invariant learning (Arjovsky et al., 2020), correlation alignment (Sun & Saenko, 2016), vari- ance penalty (Krueger et al., 2021), gradient alignment (Shi et al., 2021), instance reweighting (Sagawa et al., 2019; Liu et al., 2021), and data augmentation (Xu et al., 2020; Yao et al., 2022) have been employed to address the issue of 1Department of Electrical and Computer Engineering, Boston University, MA, USA 2Intelligent Systems Program, University of Pittsburgh, PA, USA 3MetaAI, MenloPark, CA, USA. Correspon- dence to: Shantanu Ghosh <[email protected]>. Published at the ICML 2023 Workshop on Spurious Correlations, Invariance, and Stability. Honolulu, Hawaii, USA. Copyright 2023 by the author(s). shortcuts in Empirical Risk Minimization (ERM) models. However, they lack interpretability in 3 pivotal areas: 1) pin- pointing the precise shortcut that the BB is aimed at, 2) clar- ifying the mechanism through which a particular shortcut is eradicated from the BB's representation, and 3) establish- ing a dependable technique to verify the elimination of the shortcut. The application of LIME (Ribeiro et al., 2016) and proxy-based interpretable models (Rosenzweig et al., 2021) have been investigated to detect shortcuts in Explainable AI. However, they function within the pixel space rather than the human interpretable concept space (Kim et al., 2017) and fail to address the issue of shortcut learning. This paper addresses this gap utilizing concept-based models. Concept-based interpretable by design models (Koh et al., 2020; Zarlenga et al., 2022) use 1) a concept classifier to detect the presence/absence of concepts in an image, 2) an interpretable function (e.g., linear regression or rule-based) to map the concepts to the final output. However, these approaches utilize a single interpretable model to explain the whole dataset failing to encompass the diverse instance- specific explanations and exhibiting inferior performance than their BB counterparts. Our contributions. This paper proposes a novel method using the concept-based interpretable model to eliminate the shortcut learning problem. First we carve out a mix- ture of interpretable models and a residual network from a given BB. We hypothesize that a BB encodes multiple interpretable models, each pertinent to a unique data subset. As each interpretable model specializes over a subset of data, we refer to them as expert. Our design routes the sam- ples through the interpretable models to explain them with FOL. The remaining samples are routed through a residual network. On the residual, we repeat the method until all the experts explain the desired proportion of data. Next, we employ MDN (Lu et al., 2021), a batch-level operation, to mitigate the impact of extraneous variables (metadata) on feature distributions. This approach effectively eliminates metadata effects during the training process. Specifically, we deploy a 3-step procedure to mitigate the shortcuts: 1) The FOLs from biased BB detect the presence of the shortcut, 2) Assuming the detected shortcut as metadata, we use MDN layers to eliminate the shortcut by finetuning the Tackling Shortcut Learning in Deep Neural Networks: An Iterative Approach with Interpretable Models Algorithm 1 Applying MoIE to eliminate shortcuts = 1: Input: n j=1; biased BB f 0 = h0(Φ(.)); The total iterations K; Coverages τ1, . . . , τK. Freeze Φ. 2: Using (Yuksekgonul et al., 2022) learn the projection t xj, cj, yj { D } to predict the concept value. Figure 1. Schematic view of our method. Note that f k(.) = hk(Φ(.)). At iteration k, the selector routes each sample ei- ther towards the expert gk with probability πk(.) or the residual rk = f k−1 − gk with probability 1 − πk(.). gk generates FOLs to explain the samples it covers. Note Φ is fixed across iterations. BB, 3) The FOLs from the fine-tuned BB verify the elimina- tion of the shortcut. 2. Method , ◦ Y X , and Notation: Assume f 0 : , with is a BB, on a dataset X → Y being the images, classes, and X × Y × C C concepts, respectively; f 0 = h0 Φ, where Φ and h0 is the feature extractor and the classifier respectively. f 0 predicts . Given a learnable projection (Ghosh from the input Y , our method learns three functions: et al., 2023), t : Φ (1) a set of selectors (π : ) routing samples to 0, 1 } C → { an interpretable model or residual, (2) a set of interpretable models (g : ), and (3) the residuals. The interpretable models are called "experts" since they specialize in a distinct subset of data defined by that iteration's coverage τ as shown in SelectiveNet (Rabanser et al., 2022). Fig. 1 illustrates our method. X → C C → Y 2.1. Distilling BB to the mixture of interpretable models m − The selectors: As the first step of our method, the selector πk routes the jth sample through the interpretable model πk(cj) gk or residual rk with probability πk(cj) and 1 respectively, where k [0, K], with K being the number ∈ of iterations. We define the empirical coverage of the kth iteration as ζ(πk) = 1 j=1 πk(cj), the empirical mean m of the samples selected by the selector for the associated interpretable model gk, with m being the total number of samples in the training set. Thus, the entire selective risk is: xj, cj k(πk, gk) = m k j=1 L (gk,πk) k (gk,πk) ζ(πk) R is the optimization loss used to learn gk and πk together, discussed in the next section. For a given coverage of τ k (0, 1], we solve the following optimization problem: , where (cid:80) (cid:80) 1 m L ∈ (cid:0) (cid:1) 3: Detection step. Learn the experts in MoIE K k=1 and } extract the FOLs. The FOL contains shortcuts. { g 4: Elimination step. Consider the detected shortcut con- cept in the "Detection" step as metadata and finetune BB (f 0) with MDN (Lu et al., 2021) to remove the role of that shortcut. 5: Retrain t with Φ of finetuned BB to get the concepts. 6: Verification step. Learn MoIE K k=1 again from retrained t and recompute the FOLs. The final FOLs do not contain spurious concepts as they have been eliminated in the "Elimination step". g { } sk , θ∗ θ∗ gk = arg min k θsk ,θgk R s.t. ζ (cid:16) πk(.; θsk ) πk(.; θsk ), gk(.; θgk ) (cid:17) τ k, ≥ (1) (cid:0) sk , θ∗ (cid:1) where θ∗ gk are the optimal parameters at iteration k for the selector πk and the interpretable model gk respectively. In this work, πs' of different iterations are neural networks with sigmoid activation. At inference time, the selector routes the jth sample with concept vector cj to gk if and only if πk(cj) 0.5 for k [0, K]. ≥ ∈ Table 1. Datasets and BlackBoxes. DATASET BB # EXPERTS CUB-200 (Wah et al., 2011) CUB-200 (Wah et al., 2011) AWA2 (Xian et al., 2018) AWA2 (Xian et al., 2018) RESNET101 (He et al., 2016) VIT (Wang et al., 2021) RESNET101 (He et al., 2016) VIT (Wang et al., 2021) HAM1000 (Tschandl et al., 2018) INCEPTION (Szegedy et al., 2015) SIIM-ISIC (Rotemberg et al., 2021) INCEPTION (Szegedy et al., 2015) EFFUSION IN MIMIC-CXR (Johnson et al.) DENSENET121 (Huang et al., 2017) 6 6 4 6 6 6 3 The experts: For iteration k, the loss expert gk from f k−1, BB of the previous iteration: k (gk,πk) distills the L k (gk,πk) L xj, cj = l (cid:0) (cid:1) (cid:16) (cid:124) f k−1(xj), gk(cj) (cid:17) trainable component for current iteration k (cid:123)(cid:122) k−1 πk(cj) 1 πi(cj) , − (cid:0) i=1 (cid:89) (cid:1) fixed component trained in the previous iterations (2) (cid:125) (cid:124) (cid:123)(cid:122) (cid:125) k−1 where the term πk(cj) denotes the i=1 probability of the sample going through the residuals for 1 (i.e., all the previous iterations from 1 through k times the probability of going through πi(cj) πi(cj) (cid:81) − − 1 1 (cid:0) (cid:1) k−1 i=1 − (cid:81) (cid:0) (cid:1)(cid:1) Residual (!!)Residual (!")FixResidual (!#)Residual (!$)<latexit sha1_base64="+gD4ZJHyjB5t4kptHPZ9yV/4y2o=">AAAB8XicbVBNS8NAEJ34WetX1aOXxSJ4sSRS1GPBi8cK9gPbWDbbabt0swm7G6GE/gsvHhTx6r/x5r9x0+agrQ8GHu/NMDMviAXXxnW/nZXVtfWNzcJWcXtnd2+/dHDY1FGiGDZYJCLVDqhGwSU2DDcC27FCGgYCW8H4JvNbT6g0j+S9mcToh3Qo+YAzaqz04JFz0o35o1fslcpuxZ2BLBMvJ2XIUe+Vvrr9iCUhSsME1brjubHxU6oMZwKnxW6iMaZsTIfYsVTSELWfzi6eklOr9MkgUrakITP190RKQ60nYWA7Q2pGetHLxP+8TmIG137KZZwYlGy+aJAIYiKSvU/6XCEzYmIJZYrbWwkbUUWZsSFlIXiLLy+T5kXFu6xU76rlWjWPowDHcAJn4MEV1OAW6tAABhKe4RXeHO28OO/Ox7x1xclnjuAPnM8fMcCPRQ==</latexit>1⇡1<latexit sha1_base64="2Fe4l0UWGpyf35hvJkNm/7aI9QM=">AAAB7XicbVBNS8NAEJ3Ur1q/qh69LBbBU0mkqMeCF48V7Ae0sWy2m3btZjfsboQQ+h+8eFDEq//Hm//GTZuDtj4YeLw3w8y8IOZMG9f9dkpr6xubW+Xtys7u3v5B9fCoo2WiCG0TyaXqBVhTzgRtG2Y47cWK4ijgtBtMb3K/+0SVZlLcmzSmfoTHgoWMYGOlziBmD15lWK25dXcOtEq8gtSgQGtY/RqMJEkiKgzhWOu+58bGz7AyjHA6qwwSTWNMpnhM+5YKHFHtZ/NrZ+jMKiMUSmVLGDRXf09kONI6jQLbGWEz0cteLv7n9RMTXvsZE3FiqCCLRWHCkZEofx2NmKLE8NQSTBSztyIywQoTYwPKQ/CWX14lnYu6d1lv3DVqzUYRRxlO4BTOwYMraMIttKANBB7hGV7hzZHOi/PufCxaS04xcwx/4Hz+AKmyjn8=</latexit>⇡1<latexit sha1_base64="n3F6DulcyouwekXrm8KNEomULOc=">AAAB7XicbVBNSwMxEJ2tX7V+VT16CRbBU9ktpXosePFYwX5Au5Zsmm1js8mSZIWy9D948aCIV/+PN/+N2XYP2vpg4PHeDDPzgpgzbVz32ylsbG5t7xR3S3v7B4dH5eOTjpaJIrRNJJeqF2BNORO0bZjhtBcriqOA024wvcn87hNVmklxb2Yx9SM8FixkBBsrdQYxe6iVhuWKW3UXQOvEy0kFcrSG5a/BSJIkosIQjrXue25s/BQrwwin89Ig0TTGZIrHtG+pwBHVfrq4do4urDJCoVS2hEEL9fdEiiOtZ1FgOyNsJnrVy8T/vH5iwms/ZSJODBVkuShMODISZa+jEVOUGD6zBBPF7K2ITLDCxNiAshC81ZfXSadW9RrV+l290qzncRThDM7hEjy4gibcQgvaQOARnuEV3hzpvDjvzseyteDkM6fwB87nD6s3joA=</latexit>⇡2<latexit sha1_base64="oMs7uBKEkR22VboX4oj4symTLCc=">AAAB8XicbVBNSwMxEJ2tX7V+VT16CRbBi2W3FPVY8OKxgv3Adi3ZNNuGZrMhyQpl6b/w4kERr/4bb/4bs+0etPXBwOO9GWbmBZIzbVz32ymsrW9sbhW3Szu7e/sH5cOjto4TRWiLxDxW3QBrypmgLcMMp12pKI4CTjvB5CbzO09UaRaLezOV1I/wSLCQEWys9OChC9SX7LFWGpQrbtWdA60SLycVyNEclL/6w5gkERWGcKx1z3Ol8VOsDCOczkr9RFOJyQSPaM9SgSOq/XR+8QydWWWIwljZEgbN1d8TKY60nkaB7YywGetlLxP/83qJCa/9lAmZGCrIYlGYcGRilL2PhkxRYvjUEkwUs7ciMsYKE2NDykLwll9eJe1a1bus1u/qlUY9j6MIJ3AK5+DBFTTgFprQAgICnuEV3hztvDjvzseiteDkM8fwB87nDzNFj0Y=</latexit>1⇡2<latexit sha1_base64="h4pkrbC+h2TKpeCP6uUxhg/LpoM=">AAAB8XicbVBNSwMxEJ2tX7V+VT16CRbBi2VXi3osePFYwX5gu5Zsmm1Ds9mQZIWy9F948aCIV/+NN/+N2XYP2vpg4PHeDDPzAsmZNq777RRWVtfWN4qbpa3tnd298v5BS8eJIrRJYh6rToA15UzQpmGG045UFEcBp+1gfJP57SeqNIvFvZlI6kd4KFjICDZWevDQGepJ9nhR6pcrbtWdAS0TLycVyNHol796g5gkERWGcKx113Ol8VOsDCOcTku9RFOJyRgPaddSgSOq/XR28RSdWGWAwljZEgbN1N8TKY60nkSB7YywGelFLxP/87qJCa/9lAmZGCrIfFGYcGRilL2PBkxRYvjEEkwUs7ciMsIKE2NDykLwFl9eJq3zqndZrd3VKvVaHkcRjuAYTsGDK6jDLTSgCQQEPMMrvDnaeXHenY95a8HJZw7hD5zPHzTKj0c=</latexit>1⇡3<latexit sha1_base64="fxn0QLBn0RLoEhCqKo3Xfj7feh8=">AAAB7XicbVBNSwMxEJ2tX7V+VT16CRbBU9nVUj0WvHisYD+gXUs2zbax2WRJskJZ+h+8eFDEq//Hm//GbLsHbX0w8Hhvhpl5QcyZNq777RTW1jc2t4rbpZ3dvf2D8uFRW8tEEdoikkvVDbCmnAnaMsxw2o0VxVHAaSeY3GR+54kqzaS4N9OY+hEeCRYygo2V2v2YPVyWBuWKW3XnQKvEy0kFcjQH5a/+UJIkosIQjrXueW5s/BQrwwins1I/0TTGZIJHtGepwBHVfjq/dobOrDJEoVS2hEFz9fdEiiOtp1FgOyNsxnrZy8T/vF5iwms/ZSJODBVksShMODISZa+jIVOUGD61BBPF7K2IjLHCxNiAshC85ZdXSfui6tWrtbtapVHL4yjCCZzCOXhwBQ24hSa0gMAjPMMrvDnSeXHenY9Fa8HJZ47hD5zPH6y8joE=</latexit>⇡3<latexit sha1_base64="AzNuc90EeRk747R0X2aoeYE0G+E=">AAAB6nicbVBNS8NAEJ3Ur1q/qh69LBbBU0lE1GPRi8eK9gPaWDbbSbp0swm7G6GU/gQvHhTx6i/y5r9x2+agrQ8GHu/NMDMvSAXXxnW/ncLK6tr6RnGztLW9s7tX3j9o6iRTDBssEYlqB1Sj4BIbhhuB7VQhjQOBrWB4M/VbT6g0T+SDGaXoxzSSPOSMGivdR49er1xxq+4MZJl4OalAjnqv/NXtJyyLURomqNYdz02NP6bKcCZwUupmGlPKhjTCjqWSxqj98ezUCTmxSp+EibIlDZmpvyfGNNZ6FAe2M6ZmoBe9qfif18lMeOWPuUwzg5LNF4WZICYh079JnytkRowsoUxxeythA6ooMzadkg3BW3x5mTTPqt5F9fzuvFK7zuMowhEcwyl4cAk1uIU6NIBBBM/wCm+OcF6cd+dj3lpw8plD+APn8wfzJI2X</latexit>g1<latexit sha1_base64="AzNuc90EeRk747R0X2aoeYE0G+E=">AAAB6nicbVBNS8NAEJ3Ur1q/qh69LBbBU0lE1GPRi8eK9gPaWDbbSbp0swm7G6GU/gQvHhTx6i/y5r9x2+agrQ8GHu/NMDMvSAXXxnW/ncLK6tr6RnGztLW9s7tX3j9o6iRTDBssEYlqB1Sj4BIbhhuB7VQhjQOBrWB4M/VbT6g0T+SDGaXoxzSSPOSMGivdR49er1xxq+4MZJl4OalAjnqv/NXtJyyLURomqNYdz02NP6bKcCZwUupmGlPKhjTCjqWSxqj98ezUCTmxSp+EibIlDZmpvyfGNNZ6FAe2M6ZmoBe9qfif18lMeOWPuUwzg5LNF4WZICYh079JnytkRowsoUxxeythA6ooMzadkg3BW3x5mTTPqt5F9fzuvFK7zuMowhEcwyl4cAk1uIU6NIBBBM/wCm+OcF6cd+dj3lpw8plD+APn8wfzJI2X</latexit>g1<latexit sha1_base64="+D9JjFZwzq5YXcI7pUsbDRznWIg=">AAAB6nicbVBNSwMxEJ2tX7V+VT16CRbBU9ktRT0WvXisaD+gXUs2zW5Ds8mSZIWy9Cd48aCIV3+RN/+NabsHbX0w8Hhvhpl5QcKZNq777RTW1jc2t4rbpZ3dvf2D8uFRW8tUEdoikkvVDbCmnAnaMsxw2k0UxXHAaScY38z8zhNVmknxYCYJ9WMcCRYygo2V7qPH2qBccavuHGiVeDmpQI7moPzVH0qSxlQYwrHWPc9NjJ9hZRjhdFrqp5ommIxxRHuWChxT7WfzU6fozCpDFEplSxg0V39PZDjWehIHtjPGZqSXvZn4n9dLTXjlZ0wkqaGCLBaFKUdGotnfaMgUJYZPLMFEMXsrIiOsMDE2nZINwVt+eZW0a1Xvolq/q1ca13kcRTiBUzgHDy6hAbfQhBYQiOAZXuHN4c6L8+58LFoLTj5zDH/gfP4A9KiNmA==</latexit>g2Blackbox ModelSymbolic ModelSelector<latexit sha1_base64="VPpH/OEZENfZBoMgqWg5/alwZ24=">AAACDXicbVBLTsMwFHwpvxJ+BZZsLCokVlWCELCsYMOySPQjtVHlOE5j1XEi26moql4BlnARdogtZ+AeHACnzYK2jGRpNPOePR4/5Uxpx/m2SmvrG5tb5W17Z3dv/6ByeNRSSSYJbZKEJ7LjY0U5E7Spmea0k0qKY5/Ttj+8y/32iErFEvGoxyn1YjwQLGQE61zqNSLWr1SdmjMDWiVuQapQoNGv/PSChGQxFZpwrFTXdVLtTbDUjHA6tXuZoikmQzygXUMFjqnyJrOsU3RmlACFiTRHaDRT/25McKzUOPbNZIx1pJa9XPzP62Y6vPEmTKSZpoLMHwozjnSC8o+jgElKNB8bgolkJisiEZaYaFPPwk3BiKWqSP00j23btqnJXS5llbQuau5V7fLhslq/LQorwwmcwjm4cA11uIcGNIFABM/wCm/Wi/VufVif89GSVewcwwKsr18qrpwI</latexit><latexit sha1_base64="+7EUdyM1D7un31irS28tjlc7OkU=">AAACF3icbVDLSsNAFL2prxpfVZduBovgqiQi6rLoxmUF+4AmLZPJpBk6eTAzKZbQ/9Cl/og7cevS//ADnLZZ2NYDA4dz7r1zOF7KmVSW9W2U1tY3NrfK2+bO7t7+QeXwqCWTTBDaJAlPRMfDknIW06ZiitNOKiiOPE7b3vBu6rdHVEiWxI9qnFI3woOYBYxgpaWe0wgZcggTBIU9q1+pWjVrBrRK7IJUoUCjX/lx/IRkEY0V4VjKrm2lys2xUIxwOjGdTNIUkyEe0K6mMY6odPNZ6gk604qPgkToFys0U/9u5DiSchx5ejLCKpTL3lT8z+tmKrhxcxanmaIxmX8UZBypBE0rQD4TlCg+1gQTwXRWREIsMFG6qIVL/oilskj9NI9tmqauyV4uZZW0Lmr2Ve3y4bJavy0KK8MJnMI52HANdbiHBjSBgIBneIU348V4Nz6Mz/loySh2jmEBxtcvAVyfnw==</latexit>h0<latexit sha1_base64="Vp/RmOl/IN5ewyefcY0/9facZeY=">AAACF3icbVDLSsNAFL2prxpfVZduBovgqiQi6rLoxmUF+4AmLZPJpBk6eTAzKZbQ/9Cl/og7cevS//ADnLZZ2NYDA4dz7r1zOF7KmVSW9W2U1tY3NrfK2+bO7t7+QeXwqCWTTBDaJAlPRMfDknIW06ZiitNOKiiOPE7b3vBu6rdHVEiWxI9qnFI3woOYBYxgpaWe0wgZcggTBIU9u1+pWjVrBrRK7IJUoUCjX/lx/IRkEY0V4VjKrm2lys2xUIxwOjGdTNIUkyEe0K6mMY6odPNZ6gk604qPgkToFys0U/9u5DiSchx5ejLCKpTL3lT8z+tmKrhxcxanmaIxmX8UZBypBE0rQD4TlCg+1gQTwXRWREIsMFG6qIVL/oilskj9NI9tmqauyV4uZZW0Lmr2Ve3y4bJavy0KK8MJnMI52HANdbiHBjSBgIBneIU348V4Nz6Mz/loySh2jmEBxtcvAwKfoA==</latexit>h1<latexit sha1_base64="ejQ5m7MQGGsPvDeCsTu8ZCsei/Y=">AAACF3icbVDLTsJAFL3FF9YX6tLNRGLiirSEqEuiG5eYyCOhhUynU5gwfWRmSiQN/6FL/RF3xq1L/8MPcIAuBDzJJCfn3Hvn5HgJZ1JZ1rdR2Njc2t4p7pp7+weHR6Xjk5aMU0Fok8Q8Fh0PS8pZRJuKKU47iaA49Dhte6O7md8eUyFZHD2qSULdEA8iFjCClZZ6TmPIkEOYIGjYq/ZLZatizYHWiZ2TMuRo9Es/jh+TNKSRIhxL2bWtRLkZFooRTqemk0qaYDLCA9rVNMIhlW42Tz1FF1rxURAL/SKF5urfjQyHUk5CT0+GWA3lqjcT//O6qQpu3IxFSapoRBYfBSlHKkazCpDPBCWKTzTBRDCdFZEhFpgoXdTSJX/MEpmnflrENk1T12SvlrJOWtWKfVWpPdTK9du8sCKcwTlcgg3XUId7aEATCAh4hld4M16Md+PD+FyMFox85xSWYHz9AgSon6E=</latexit>h2<latexit sha1_base64="8r5LjvP1Cab72kHDNCw+bxP+zJM=">AAACF3icbVDLTsJAFL3FF9YX6tLNRGLiirRK1CXRjUtM5JFAIdPplE6YPjIzJZKG/9Cl/og749al/+EHOEAXAp5kkpNz7r1zctyEM6ks69sorK1vbG4Vt82d3b39g9LhUVPGqSC0QWIei7aLJeUsog3FFKftRFAcupy23OHd1G+NqJAsjh7VOKFOiAcR8xnBSku9bj1gqEuYICjoXfZLZatizYBWiZ2TMuSo90s/XS8maUgjRTiWsmNbiXIyLBQjnE7MbippgskQD2hH0wiHVDrZLPUEnWnFQ34s9IsUmql/NzIcSjkOXT0ZYhXIZW8q/ud1UuXfOBmLklTRiMw/8lOOVIymFSCPCUoUH2uCiWA6KyIBFpgoXdTCJW/EEpmnfprHNk1T12Qvl7JKmhcV+6pSfaiWa7d5YUU4gVM4BxuuoQb3UIcGEBDwDK/wZrwY78aH8TkfLRj5zjEswPj6BQZOn6I=</latexit>h3 Tackling Shortcut Learning in Deep Neural Networks: An Iterative Approach with Interpretable Models Table 2. MoIE does not hurt the performance of the original BB. We provide AUROC and accuracy for medical imaging (e.g., HAM10000, ISIC, and Effusion) and vision (e.g., CUB-200 and Awa2) datasets, respectively, over 5 random seeds. For MoIE, we also report the "Coverage". We only report the performance of the convolutional CEM (Zarlenga et al., 2022), leaving the construction of VIT-based CEM as future work. As HAM10000 and ISIC have no concept annotation, interpretable-by-design models can not be constructed. MODEL BLACKBOX INTERPRETABLE-BY-DESIGN CEM (Zarlenga et al., 2022) CBM (Sequential) (Koh et al., 2020) CBM + E-LEN (Koh et al., 2020; Barbiero et al., 2022) POSTHOC PCBM (Yuksekgonul et al., 2022) PCBM-h (Yuksekgonul et al., 2022) PCBM + E-LEN (Yuksekgonul et al., 2022; Barbiero et al., 2022) PCBM-h + E-LEN (Yuksekgonul et al., 2022; Barbiero et al., 2022) OURS MoIE (COVERAGE) MoIE + RESIDUAL CUB-200 (RESNET101) CUB-200 (VIT) AWA2 (RESNET101) AWA2 (VIT) HAM10000 SIIM-ISIC EFFUSION DATASET 0.88 0.77 ± 0.002 0.65 ± 0.003 0.71 ± 0.003 0.76 ± 0.001 0.85 ± 0.001 0.80 ± 0.003 0.85 ± 0.003 0.92 - 0.86 ± 0.002 0.88 ± 0.002 0.85 ± 0.002 0.91 ± 0.001 0.89 ± 0.002 0.91 ± 0.002 0.89 0.88 ± 0.005 0.88 ± 0.003 0.86 ± 0.003 0.82 ± 0.002 0.87 ± 0.002 0.85 ± 0.002 0.88 ± 0.002 0.99 - 0.94 ± 0.002 0.93 ± 0.002 0.94 ± 0.001 0.98 ± 0.001 0.96 ± 0.001 0.98 ± 0.002 0.96 NA NA NA 0.85 NA NA NA 0.93 ± 0.001 0.95 ± 0.001 0.94 ± 0.021 0.95 ± 0.032 0.71 ± 0.012 0.79 ± 0.056 0.73 ± 0.011 0.82 ± 0.056 0.91 0.76 ± 0.002 0.79 ± 0.005 0.79 ± 0.002 0.81 ± 0.017 0.87 ± 0.072 0.81 ± 0.014 0.87 ± 0.032 0.86 ± 0.001 (0.9) 0.91 ± 0.001 (0.95) 0.87 ± 0.002 (0.91) 0.97 ± 0.004 (0.94) 0.95 ± 0.001 (0.9) 0.84 ± 0.001 (0.94) 0.87 ± 0.001 (0.98) 0.84 ± 0.001 0.90 ± 0.001 0.86 ± 0.002 0.94 ± 0.004 0.92 ± 0.00 0.82 ± 0.01 0.86 ± 0.00 Table 3. Performance of various shortcut elimination methods on Waterbirds dataset. Method Avg Acc. Worst Acc. ERM (Wah et al., 2011) ERM+aug (Wah et al., 2011) UW (Xian et al., 2018) IRM (Arjovsky et al., 2020) IB-IRM (Ahuja et al., 2022) V-REx (Krueger et al., 2021) CORAL (Sun & Saenko, 2016) Fish (Shi et al., 2021) GroupDRO (Sagawa et al., 2019) JTT (Liu et al., 2021) DM-ADA (Xu et al., 2020) LISA (Yao et al., 2022) 97.0 ± 0.2% 87.4 ± 0.5% 96.3.0 ± 0.3% 87.5 ± 0.7% 88.5 ± 0.9% 88.0 ± 1.4% 90.3 ± 1.1% 85.6 ± 0.4% 91.8 ± 0.3% 93.3 ± 0.3% 76.4 ± 0.3% 91.8 ± 0.3% 63.7 ± 1.9% 76.4 ± 2.0% 76.2 ± 1.4% 75.6 ± 3.1% 76.5 ± 1.2% 73.6 ± 0.2% 79.8 ± 1.8% 64.0 ± 0.3% 90.6 ± 1.1% 86.7 ± 1.5% 53.0 ± 1.3% 88.5 ± 0.8% BB w MDN (ours) 95.01 ± 0.5% 94.4 ± 0.5% MoIE from BB w MDN (ours) (COVERAGE) 91.0 ± 0.5% (0.91) 93.7 ± 0.4% (0.87) MoIE+R from BB w MDN (ours) 90.2 ± 0.5% 92.1 ± 0.4% the interpretable model at iteration k iteration k, π1, . . . πk−1 are not trainable. (cid:0) i.e., πk(cj) . At (cid:1) The Residuals: The last step is to repeat with the residual rk, as rk(xj, cj) = f k−1(xj) gk(cj). We fix Φ and optimize the following loss to update hk to specialize on those samples not covered by gk, effectively creating a new BB f k for the next iteration (k + 1): − k f (xj, cj) = l L rk(xj, cj), f k(xj) (cid:0) (cid:124) trainable component for iteration k (cid:123)(cid:122) (cid:1) (cid:125) k 1 πi(cj) − (cid:0) i=1 (cid:89) (cid:1) non-trainable component for iteration k (cid:123)(cid:122) (cid:124) (3) (cid:125) We refer to all the experts as the Mixture of Interpretable Experts (MoIE). We denote the experts, including the fi- nal residual, as MoIE+R. Each expert in MoIE constructs sample-specific FOLs using the optimization strategy in SelectiveNet (Geifman & El-Yaniv, 2019). 2.2. Applying to mitigate shortcuts Algorithm 1 illustrates a 3-step procedure to eliminate short- cuts. The BB, trained on a dataset with shortcuts, latches on the spurious concepts to classify the labels. Detection. The FOLs from the biased BB-derived MoIE, capture the spurious concepts. Elimination. Assuming the spurious concepts as metadata, we minimize the effect of shortcuts from the representation of the BB using MDN (Lu et al., 2021) layers between two successive layers of the convo- lutional backbone to fine-tune the biased BB. MDN is a regression-based normalization technique to mitigate meta- data effects and improve model robustness. Verfitication. Finally, we distill the MoIE from the new robust BB and generate the FOLs. The FOLs validate if the BB still uses spurious concepts for prediction. 3. Experiments We perform experiments to show that MoIE does not com- promise the accuracy of the original BB across various datasets and architectures and eliminates shortcuts using the Waterbirds dataset (Sagawa et al., 2019). As a stopping criterion, we repeat our method until MoIE covers at least 90% of samples. Furthermore, we only include concepts as input to g if their validation accuracy or AUROC exceeds a certain threshold (in all of our experiments, we fix 0.7 or 70% as the threshold of validation auroc or accuracy). Refer to Table 1 for the datasets and BBs' experimented with. For ResNets, Inception, and DenseNet121, we flatten the feature maps from the last convolutional block to ex- tract the concepts. For VITs, we use the image embeddings from the transformer encoder to perform the same. We use Tackling Shortcut Learning in Deep Neural Networks: An Iterative Approach with Interpretable Models SIIM-ISIC as a real-world transfer learning setting, with the BB trained on HAM10000 and evaluated on a subset of the SIIM-ISIC Melanoma Classification dataset (Yuksekgonul et al., 2022). Appendix A.2 and Appendix A.3 expand on the datasets and hyperparameters. Furthermore, we utilize E-LEN, i.e., a Logic Explainable Network (Ciravegna et al., 2023) implemented with an Entropy Layer as first layer (Bar- biero et al., 2022) as the interpretable symbolic model g to construct FOL explanations of a given prediction. With ResNet50 as the BB for shortcut detection, we use MDN layers between convolution blocks. Figure 2. MoIE fixes shortcuts. Performance of (a) the biased BB and (b) final MoIE extracted from the robust BB. (c) Examples of samples (top-row) and FOLs extracted from the biased (middle- row) and robust BB (bottom-row). (d) Accuracies of the spurious concepts extracted from the biased vs. the robust BB. C → Y X → C Baselines: To show the efficacy of our method compared to other concept-based models, we compare our methods to two concept-based baselines – 1) interpretable-by-design and 2) posthoc. They consist of two parts: a) a concept , predicting concepts from images; and predictor Φ : b) a label predictor g : , predicting labels from the concepts. The end-to-end CEMs and sequential CBMs serve as interpretable-by-design baselines. Similarly, PCBM and PCBM-h serve as post hoc baselines. Convolution-based Φ includes all layers till the last convolution block. VIT-based Φ consists of the transformer encoder block. The standard CBM and PCBM models do not show how the concepts are composed to make the label prediction. So, we create CBM + E-LEN, PCBM + E-LEN, and PCBM-h + E-LEN by using the identical g of MOIE (shown in Appendix A.3), as a replacement for the standard classifiers of CBM and PCBM. We train the Φ and g in these new baselines to sequentially generate FOLs (Barbiero et al., 2022). Due to the unavail- ability of concept annotations, we extract the concepts from the Derm7pt dataset (Kawahara et al., 2018) using the pre- trained embeddings of the BB (Yuksekgonul et al., 2022) for HAM10000. Thus, we do not have interpretable-by-design baselines for HAM10000 and ISIC. For shortcut-based methods, we compare our method with Empirical Risk Minimization (ERM) with and without data augmentations; Up- weighting (UW), which weights the instances of minority groups; Invariant Learning al- gorithms: IRM (Arjovsky et al., 2020), IB-IRM (Ahuja et al., 2022); Domain generalization/adaptation methods: V- REx (Krueger et al., 2021), CORAL (Sun & Saenko, 2016), and Fish (Shi et al., 2021); Instance reweighting methods: GroupDRO (Sagawa et al., 2020), JTT (Liu et al., 2021); Data augmentation methods: DM-ADA (Xu et al., 2020), LISA (Yao et al., 2022). 4. Results MoIE does not compromise the performance of the orig- inal BB. As MoIE uses multiple experts covering different subsets of data compared to the single one by the baselines, MoIE outperforms the baselines for most of the datasets, shown in Table 2. Awa2 comprises rich concept annotation for zero-shot learning, resulting in better performance for the interpretable-by-design baselines. Appendix A.4 illus- trates that MoIE captures a diverse set of concepts quali- tatively. Appendix A.5 shows that later iterations of MoIE cover the "harder" examples. Eliminating shortcuts. Table 3 demonstrates the effi- cacy of MoIE in eliminating the shortcuts than the other shortcut removal method by achieving high worst-case accu- racy. First, the BB's accuracy differs for land-based versus aquatic subsets of the bird species, as shown in Figure 2a. The Waterbird on the water is more accurate than on land (96% vs. 67% in the red bar). In the interpretable "Detec- tion" stage, the FOLs from the biased BB-derived MoIE detect the spurious background concept forest for a water- bird, misclassified as a landbird in Figure 2c (top row). In the "Elimination" stage, the fine-tuned BB with MDN layers removes the specific background from the BB's represen- tation (Φ). Next, we train t, using Φ of the finetuned BB, and compare the accuracy of the spurious concepts with the biased BB in Figure 2d. The validation accuracy of all the spurious concepts retrieved from the finetuned BB falls well short of the predefined threshold of 70% compared to the biased BB. Finally, we distill the MoIE from the robust BB. Figure 2b illustrates similar accuracies of MoIE for Wa- terbirds on water vs. Waterbirds on land (89% - 91%). As the shortcut concepts are removed successfully, MoIE out- performs the other shortcut removal methods in worst group accuracy in Table 3 (the last 2 rows). In the interpretable "Verification" stage, the FOL from the robust BB does not (a)(b)(d)(e)(c)Biased BlackboxRobust Blackbox<latexit sha1_base64="zWwYjLjIrwZ7s03vXmEzdcnk+qY=">AAACwnicbVFLb9NAEF67PIp5BThyWRGBOEU2qijKhao8DxzCI02lOIrW63G87XrX7I7bRsZ/klv/DWvHSCVlJHs/f/N9M+PZpJTCYhheev7OjZu3bu/eCe7eu//g4eDR4yOrK8NhyrXU5jhhFqRQMEWBEo5LA6xIJMyS03dtfnYGxgqtfuC6hEXBVkpkgjN01HJw+SJGuMD6k9GVStFUmI/pjCGYQ2HShsZx0CsmBlLBWxcd0y9MpduCDxelZKqr24zphruik5ChEascmTH6vM/PhFp9z1kJ39r2kJ67b+vEuS0ZhzochV1EJbYVXLHe172TbHN2W6jdeE39URuw2DRNECwHw792eh1EPRiSPibLwe841bwqQCGXzNp5FJa4qJlBwSU0QVxZcFOdshXMHVSsALuou+YNfe6YlGbauEch7dirjpoV1q6LxCkLhrndzrXk/3LzCrM3i1qoskJQfNMoqyRFTdv7pKkwwFGuHWDcCDcr5TkzjLsrtO0Sou1fvg6OXo2i16O9r3vDg8N+HbvkKXlGXpKI7JMD8plMyJRw760HnvK0/94/8X/6diP1vd7zhPwT/q8/lN3ehw==</latexit>Groundtruth:WaterBirdPrediction:LandBirdExplanation:LandBird$WingShapeRoundedwings^Forest<latexit sha1_base64="aEMLxBRMmUrBTifVMb4eo/xAAak=">AAADi3icfVLNbtNAEHZsfkKgkMKRy4oIxCmKaaEl4tCmquihh6AkTaU4itbrib3Keu3ujqHBysPwStx4G9axQSFtGWnl0cz3M55dPxVcY6fzq2Y79+4/eFh/1Hj8ZOfps+bu8wudZIrBiCUiUZc+1SC4hBFyFHCZKqCxL2DsL06K/vgrKM0TOcRlCtOYhpLPOaNoSrPd2o83HsI15p9VkskAVYZRl4wpgupxFayI5zUqRF9BwFlBI3cgTq9TQeVaedUlZW0TKGCOiocRUqWSbxWgx4U4BxlidOwnGQ4jGNAYjvUZ0IIT6ZQyyDvtzjrcFEtH4l1dZTTY+hgPKgNPQrgtPogSZSYZRlQWyuQu6YJvZP4qDPh3GMRUiPfezJt95LKyv92/pG+wI5pCHxSLuAzP+QL+a1tyTsxuZHlzEUdYzZqtP1hyM3GrpGVV0Z81f3pBwrIYJDJBtZ64nRSnOVXImYBVw8s0mBEWNISJSaVZt57m67e0Iq9NJSDzRJkjkayrm4ycxlovY98gY4qR3u4Vxdt6kwznh9OcyzRDkKw0mmeCYEKKh0kCroChWJqEMsXNrIRFVFFmbk03zBLc7V++mVy8a7sf2vtf9ltHvWoddeul9cp6a7nWgXVknVl9a2Qxu2637QP70Nlx9pyu86mE2rWK88L6J5zT30dDIlg=</latexit>Groundtruth:WaterBirdPrediction:WaterBirdExplanation:WaterBird$BillLengthAboutTheSameAsHead^¬BillLengthShorterThanHead^¬SizeSmall59in^¬ShapePerchingLike^CrownColorWhite Tackling Shortcut Learning in Deep Neural Networks: An Iterative Approach with Interpretable Models include any background concepts ( 2c, bottom row). 5. Conclusion This paper proposes a novel method to iteratively extract a mixture of interpretable models from a flexible BB to eliminate shortcuts. We aim to leverage MoIE to eliminate shortcuts with varying complexities in the future. References Ahuja, K., Caballero, E., Zhang, D., Gagnon-Audet, J.-C., Bengio, Y., Mitliagkas, I., and Rish, I. Invariance princi- ple meets information bottleneck for out-of-distribution generalization, 2022. Arjovsky, M., Bottou, L., Gulrajani, I., and Lopez-Paz, D. Invariant risk minimization, 2020. Barbiero, P., Ciravegna, G., Giannini, F., Li ́o, P., Gori, M., and Melacci, S. Entropy-based logic explanations of neural networks. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 36, pp. 6046–6054, 2022. Belle, V. Symbolic logic meets machine learning: A brief survey in infinite domains. In International Conference on Scalable Uncertainty Management, pp. 3–16. Springer, 2020. Besold, T. R., Garcez, A. d., Bader, S., Bowman, H., Domin- gos, P., Hitzler, P., K ̈uhnberger, K.-U., Lamb, L. C., Lowd, D., Lima, P. M. V., et al. Neural-symbolic learning and reasoning: A survey and interpretation. arXiv preprint arXiv:1711.03902, 2017. Bissoto, A., Valle, E., and Avila, S. Debiasing skin lesion datasets and models? not so fast. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops, pp. 740–741, 2020. Ciravegna, G., Barbiero, P., Giannini, F., Gori, M., Li ́o, P., Maggini, M., and Melacci, S. Logic explained networks. Artificial Intelligence, 314:103822, 2023. Daneshjou, R., Vodrahalli, K., Liang, W., Novoa, R. A., Jenkins, M., Rotemberg, V., Ko, J., Swetter, S. M., Bailey, E. E., Gevaert, O., et al. Disparities in dermatology ai: Assessments using diverse clinical images. arXiv preprint arXiv:2111.08006, 2021. Geifman, Y. and El-Yaniv, R. Selectivenet: A deep neural network with an integrated reject option. In International conference on machine learning, pp. 2151–2159. PMLR, 2019. Geirhos, R., Jacobsen, J.-H., Michaelis, C., Zemel, R., Bren- del, W., Bethge, M., and Wichmann, F. A. Shortcut learn- ing in deep neural networks. Nature Machine Intelligence, 2(11):665–673, 2020. Ghosh, S., Yu, K., Arabshahi, F., and Batmanghelich, K. Dividing and conquering a BlackBox to a mix- ture of interpretable models: Route, interpret, repeat. In Krause, A., Brunskill, E., Cho, K., Engelhardt, B., Sabato, S., and Scarlett, J. (eds.), Proceedings of the 40th International Conference on Machine Learn- ing, volume 202 of Proceedings of Machine Learn- ing Research, pp. 11360–11397. PMLR, 23–29 Jul 2023. URL https://proceedings.mlr.press/ v202/ghosh23c.html. He, K., Zhang, X., Ren, S., and Sun, J. Deep residual learn- ing for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016. Huang, G., Liu, Z., Van Der Maaten, L., and Weinberger, K. Q. Densely connected convolutional networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4700–4708, 2017. Jain, S., Agrawal, A., Saporta, A., Truong, S. Q., Duong, D. N., Bui, T., Chambon, P., Zhang, Y., Lungren, M. P., Ng, A. Y., et al. Radgraph: Extracting clinical enti- ties and relations from radiology reports. arXiv preprint arXiv:2106.14463, 2021. Johnson, A., Lungren, M., Peng, Y., Lu, Z., Mark, R., Berkowitz, S., and Horng, S. Mimic-cxr-jpg-chest ra- diographs with structured labels. Kaushik, D., Hovy, E., and Lipton, Z. C. Learning the difference that makes a difference with counterfactually- augmented data. arXiv preprint arXiv:1909.12434, 2019. Kawahara, J., Daneshvar, S., Argenziano, G., and Hamarneh, G. Seven-point checklist and skin lesion classification using multitask multimodal neural nets. IEEE journal of biomedical and health informatics, 23(2):538–546, 2018. Garcez, A. d., Besold, T. R., De Raedt, L., F ̈oldiak, P., Hitzler, P., Icard, T., K ̈uhnberger, K.-U., Lamb, L. C., Miikkulainen, R., and Silver, D. L. Neural-symbolic learning and reasoning: contributions and challenges. In 2015 AAAI Spring Symposium Series, 2015. Kim, B., Wattenberg, M., Gilmer, J., Cai, C., Wexler, J., Viegas, F., and Sayres, R. Interpretability beyond feature attribution: Quantitative testing with concept activation vectors (tcav).(2017). arXiv preprint arXiv:1711.11279, 2017. Tackling Shortcut Learning in Deep Neural Networks: An Iterative Approach with Interpretable Models Koh, P. W., Nguyen, T., Tang, Y. S., Mussmann, S., Pierson, E., Kim, B., and Liang, P. Concept bottleneck models. In International Conference on Machine Learning, pp. 5338–5348. PMLR, 2020. Krueger, D., Caballero, E., Jacobsen, J.-H., Zhang, A., Bi- nas, J., Zhang, D., Priol, R. L., and Courville, A. Out- of-distribution generalization via risk extrapolation (rex), 2021. Liu, E. Z., Haghgoo, B., Chen, A. S., Raghunathan, A., Koh, P. W., Sagawa, S., Liang, P., and Finn, C. Just train twice: Improving group robustness without training group information, 2021. Lu, M., Zhao, Q., Zhang, J., Pohl, K. M., Fei-Fei, L., Niebles, J. C., and Adeli, E. Metadata normalization. In Proceedings of the IEEE/CVF Conference on Com- puter Vision and Pattern Recognition, pp. 10917–10927, 2021. Lucieri, A., Bajwa, M. N., Braun, S. A., Malik, M. I., Den- gel, A., and Ahmed, S. On interpretability of deep learn- ing based skin lesion classifiers using concept activation vectors. In 2020 international joint conference on neural networks (IJCNN), pp. 1–10. IEEE, 2020. Rabanser, S., Thudi, A., Hamidieh, K., Dziedzic, A., and Papernot, N. Selective classification via neural network training dynamics. arXiv preprint arXiv:2205.13532, 2022. Ribeiro, M. T., Singh, S., and Guestrin, C. " why should i trust you?" explaining the predictions of any classifier. In Proceedings of the 22nd ACM SIGKDD international conference on knowledge discovery and data mining, pp. 1135–1144, 2016. Rosenzweig, J., Sicking, J., Houben, S., Mock, M., and Akila, M. Patch shortcuts: Interpretable proxy models efficiently find black-box vulnerabilities. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 56–65, 2021. Rotemberg, V., Kurtansky, N., Betz-Stablein, B., Caffery, L., Chousakos, E., Codella, N., Combalia, M., Dusza, S., Guitera, P., Gutman, D., et al. A patient-centric dataset of images and metadata for identifying melanomas using clinical context. Scientific data, 8(1):1–8, 2021. Sagawa, S., Koh, P. W., Hashimoto, T. B., and Liang, P. Distributionally robust neural networks for group shifts: On the importance of regularization for worst-case gener- alization. arXiv preprint arXiv:1911.08731, 2019. Sagawa, S., Koh, P. W., Hashimoto, T. B., and Liang, P. Distributionally robust neural networks for group shifts: On the importance of regularization for worst-case gener- alization, 2020. Shi, Y., Seely, J., Torr, P. H. S., Siddharth, N., Hannun, A., Usunier, N., and Synnaeve, G. Gradient matching for domain generalization, 2021. Sun, B. and Saenko, K. Deep coral: Correlation alignment for deep domain adaptation, 2016. Szegedy, C., Liu, W., Jia, Y., Sermanet, P., Reed, S., Anguelov, D., Erhan, D., Vanhoucke, V., and Rabinovich, In Proceedings A. Going deeper with convolutions. of the IEEE conference on computer vision and pattern recognition, pp. 1–9, 2015. Tschandl, P., Rosendahl, C., and Kittler, H. The ham10000 dataset, a large collection of multi-source dermatoscopic images of common pigmented skin lesions. Scientific data, 5(1):1–9, 2018. Wadden, D., Wennberg, U., Luan, Y., and Hajishirzi, H. Entity, relation, and event extraction with contextualized span representations. In Proceedings of the 2019 Confer- ence on Empirical Methods in Natural Language Process- ing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 5784–5789, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1585. URL https://aclanthology.org/D19-1585. Wah, C., Branson, S., Welinder, P., Perona, P., and Belongie, S. The caltech-ucsd birds-200-2011 dataset. 2011. Wang, J., Yu, X., and Gao, Y. Feature fusion vision transformer for fine-grained visual categorization. arXiv preprint arXiv:2107.02341, 2021. Xian, Y., Lampert, C. H., Schiele, B., and Akata, Z. Zero- shot learning-a comprehensive evaluation of the good, the bad and the ugly. IEEE transactions on pattern anal- ysis and machine intelligence, 41(9):2251–2265, 2018. Xu, M., Zhang, J., Ni, B., Li, T., Wang, C., Tian, Q., and Zhang, W. Adversarial domain adaptation with domain mixup. Proceedings of the AAAI Conference on Artificial Intelligence, 34(04):6502–6509, Apr. 2020. doi: 10.1609/ aaai.v34i04.6123. URL https://ojs.aaai.org/ index.php/AAAI/article/view/6123. Yao, H., Wang, Y., Li, S., Zhang, L., Liang, W., Zou, J., and Finn, C. Improving out-of-distribution robustness via selective augmentation. In Chaudhuri, K., Jegelka, S., Song, L., Szepesvari, C., Niu, G., and Sabato, S. (eds.), Proceedings of the 39th International Conference on Machine Learning, volume 162 of Proceedings of Machine Learning Research, pp. 25407–25437. PMLR, 17–23 Jul 2022. URL https://proceedings.mlr. press/v162/yao22b.html. Tackling Shortcut Learning in Deep Neural Networks: An Iterative Approach with Interpretable Models Yu, K., Ghosh, S., Liu, Z., Deible, C., and Batmanghelich, K. Anatomy-guided weakly-supervised abnormality local- ization in chest x-rays. arXiv preprint arXiv:2206.12704, 2022. Yuksekgonul, M., Wang, M., and Zou, J. Post-hoc concept bottleneck models. arXiv preprint arXiv:2205.15480, 2022. Zarlenga, M. E., Barbiero, P., Ciravegna, G., Marra, G., Gi- annini, F., Diligenti, M., Shams, Z., Precioso, F., Melacci, S., Weller, A., et al. Concept embedding models. arXiv preprint arXiv:2209.09056, 2022. Tackling Shortcut Learning in Deep Neural Networks: An Iterative Approach with Interpretable Models A. Appendix A.1. Code Refer to the url https://github.com/AI09-guy/ICML-Submission/ for the code. Neuro-symbolic AI is an area of study that encompasses deep neural networks with symbolic approaches to computing and AI to complement the strengths and weaknesses of each, resulting in a robust AI capable of reasoning and cognitive modeling (Belle, 2020). Neuro-symbolic systems are hybrid models that leverage the robustness of connectionist methods and the soundness of symbolic reasoning to effectively integrate learning and reasoning (Garcez et al., 2015; Besold et al., 2017). A.2. Dataset CUB-200 The Caltech-UCSD Birds-200-2011 ((Wah et al., 2011)) is a fine-grained classification dataset comprising 11788 images and 312 noisy visual concepts. The aim is to classify the correct bird species from 200 possible classes. We adopted the strategy discussed in (Barbiero et al., 2022) to extract 108 denoised visual concepts. Also, we utilize training/validation splits shared in (Barbiero et al., 2022). Finally, we use the state-of-the-art classification models Resnet-101 ((He et al., 2016)) and Vision-Transformer (VIT) ((Wang et al., 2021)) as the blackboxes f 0. Animals with attributes2 (Awa2) AwA2 dataset (Xian et al., 2018) consists of 37322 images of a total of 50 animal classes with 85 numeric attributes. We use the state-of-the-art classification models Resnet-101 ((He et al., 2016)) and Vision-Transformer (VIT) ((Wang et al., 2021)) as the blackboxes f 0. HAM10000 HAM10000 ((Tschandl et al., 2018)) is a classification dataset aiming to classify a skin lesion as benign or malignant. Following (Daneshjou et al., 2021), we use Inception (Szegedy et al., 2015) model, trained on this dataset as the blackbox f 0. We follow the strategy in (Lucieri et al., 2020) to extract the eight concepts from the Derm7pt ((Kawahara et al., 2018)) dataset. SIIM-ISIC To test a real-world transfer learning use case, we evaluate the model trained on HAM10000 on a subset of the SIIM-ISIC(Rotemberg et al., 2021)) Melanoma Classification dataset. We use the same concepts described in the HAM10000 dataset. MIMIC-CXR We use 220,763 frontal images from the MIMIC-CXR dataset (Johnson et al.) aiming to classify effusion. We obtain the anatomical and observation concepts from the RadGraph annotations in RadGraph's inference dataset ((Jain et al., 2021)), automatically generated by DYGIE++ ((Wadden et al., 2019)). We use the test-train-validation splits from (Yu et al., 2022) and Densenet121 (Huang et al., 2017) as the blackbox f 0. Waterbirds (Sagawa et al., 2019) creates the Waterbirds dataset by using forest and bamboo as the spurious land concepts of the Places dataset for landbirds of the CUB-200 dataset. We do the same by using oceans and lakes as the spurious water concepts for waterbirds. We utilize ResNet50 as the Blackbox f 0 to identify each bird as a Waterbird or a Landbird. A.3. Architectural details of symbolic experts and hyperparameters Table 4 demonstrates different settings to train the Blackbox of CUB-200, Awa2 and MIMIC-CXR respectively. For the VIT-based backbone, we used the same hyperparameter setting used in the state-of-the-art Vit-B 16 variant in (Wang et al., 2021). To train t, we flatten the feature maps from the last convolutional block of Φ using "Adaptive average pooling" for CUB-200 and Awa2 datasets. For MIMIC-CXR and HAM10000, we flatten out the feature maps from the last convolutional block. For VIT-based backbones, we take the first block of representation from the encoder of VIT. For HAM10000, we use the same Blackbox in (Yuksekgonul et al., 2022). Table 5, Table 6, Table 7, Table 8 enumerate all the different settings to train the interpretable experts for CUB-200, Awa2, HAM, and MIMIC-CXR respectively. All the residuals in different iterations follow the same settings as their blackbox counterparts. Tackling Shortcut Learning in Deep Neural Networks: An Iterative Approach with Interpretable Models Table 4. Hyperparameter setting of different convolution-based Blackboxes used by CUB-200, Awa2 and MIMIC-CXR Setting CUB-200 Awa2 MIMIC-CXR Backbone Pretrained on ImageNet Image size Learning rate Optimization Weight-decay Epcohs Layers used as Φ Flattening type for the input to t ResNet-101 True 448 0.001 SGD 0.00001 95 till 4th ResNet Block Adaptive average pooling ResNet-101 True 224 0.001 Adam 0 90 till 4th ResNet Block Adaptive average pooling DenseNet-121 True 512 0.01 SGD 0.0001 50 till 4th DenseNet Block Flatten A.4. Expert driven explanations by MoIE splits into an interpretable expert (gk) Heterogenity of Explanations: At each iteration of MoIE, the blackbox and a residual (rk). Figure 3i shows this mechanism for VIT-based MoIE and compares the FOLs with CBM + E-LEN and PCBM + E-LEN baselines to classify "Bay Breasted Warbler" of CUB-200. The experts of different iterations specialize in specific instances of "Bay Breasted Warbler". Thus, each expert's FOL comprises its instance-specific concepts of the same class. For example, the concept, leg color grey is unique to expert4, but belly pattern solid and back pattern multicolored are unique to experts 1 and 2, respectively, to classify the instances of "Bay Breasted Warbler" in the Figure 3(i)-c. Unlike MoIE, the baselines employ a single interpretable model g, resulting in a generic FOL with identical concepts for all the samples of "Bay Breasted Warbler" (Figure 3i(a-b)). Thus the baselines fail to capture the heterogeneity of explanations. Due to space constraints, we combine the local FOLs of different samples. hk(Φ(.) (cid:1) (cid:0) Figure 3ii shows such diverse local instance-specific explanations for HAM10000 (top) and ISIC (bottom). In Figure 3ii-(top), the baseline-FOL consists of concepts such as AtypicalPigmentNetwork and BlueWhitishVeil (BWV) to classify "Malignancy" for all the instances for HAM10000. However, expert 3 relies on RegressionStructures along with BWV to classify the same for the samples it covers. At the same time, expert 5 utilizes several other concepts e.g., IrregularStreaks, Irregular dots and globules (IrregularDG) etc. Due to space constraints, Figure 5 demonstrates similar results for the Awa2 dataset. A.5. Identification of harder samples by successive residuals Figure 7 (a-c) display the proportional accuracy of the experts and the residuals of our method per iteration. The proportional accuracy of each model (experts and/or residuals) is defined as the accuracy of that model times its coverage. Recall that the model's coverage is the empirical mean of the samples selected by the selector. Figure 7a show that the experts and residual 0.92 for the CUB-200 dataset in iteration 1, with more contribution from the residual cumulatively achieve an accuracy (black bar) than the expert1 (blue bar). Later iterations cumulatively increase and worsen the performance of the experts and corresponding residuals, respectively. The final iteration carves out the entire interpretable portion from the Blackbox f 0 via all the experts, resulting in their more significant contribution to the cumulative performance. The residual of the last iteration covers the "hardest" samples, achieving low accuracy. Tracing these samples back to the original Blackbox f 0, it also classifies these samples poorly (Figure 7(d-f)). As shown in the coverage plot, this experiment reinforces Figure 1, where the flow through the experts gradually becomes thicker compared to the narrower flow of the residual with every iteration. Figure 8 shows the coverage (top row), performances (bottom row) of each expert and residual across iterations of - (a) ResNet101-derived Awa2 and (b) ResNet101-derived CUB-200 respectively. ∼ Tackling Shortcut Learning in Deep Neural Networks: An Iterative Approach with Interpretable Models Table 5. Hyperparameter setting of interpretable experts (g) trained on ResNet-101 (top) and VIT (bottom) blackboxes for CUB-200 dataset Settings based on dataset Expert1 Expert2 Expert3 Expert4 Expert5 Expert6 CUB-200 (ResNet-101) + Batch size + Coverage (τ ) + Learning rate + λlens +αKD + TKD +hidden neurons +λs + Tlens CUB-200 (VIT) + Batch size + Coverage (τ ) + Learning rate + λlens +αKD + TKD +hidden neurons +λs +Tlens 16 0.2 0.01 0.0001 0.9 10 10 32 0.7 16 0.2 0.01 0.0001 0.99 10 10 32 6.0 16 0.2 0.01 0.0001 0.9 10 10 32 0.7 16 0.2 0.01 0.0001 0.99 10 10 32 6.0 16 0.2 0.01 0.0001 0.9 10 10 32 0.7 16 0.2 0.01 0.0001 0.99 10 10 32 6.0 16 0.2 0.01 0.0001 0.9 10 10 32 0.7 16 0.2 0.01 0.0001 0.99 10 10 32 6.0 16 0.2 0.01 0.0001 0.9 10 10 32 0.7 16 0.2 0.01 0.0001 0.99 10 10 32 6.0 16 0.2 0.01 0.0001 0.9 10 10 32 0.7 16 0.2 0.01 0.0001 0.99 10 10 32 6.0 Table 6. Hyperparameter setting of interpretable experts (g) trained on ResNet-101 (top) and VIT (bottom) blackboxes for Awa2 dataset Settings based on dataset Expert1 Expert2 Expert3 Expert4 Expert5 Expert6 Awa2 (ResNet-101) + Batch size + Coverage (τ ) + Learning rate + λlens +αKD + TKD +hidden neurons +λs + Tlens Awa2 (VIT) + Batch size + Coverage (τ ) + Learning rate + λlens +αKD + TKD +hidden neurons +λs + Tlens 30 0.4 0.001 0.0001 0.9 10 10 32 0.7 30 0.2 0.01 0.0001 0.99 10 10 32 6.0 30 0.35 0.001 0.0001 0.9 10 10 32 0.7 30 0.2 0.01 0.0001 0.99 10 10 32 6.0 30 0.35 0.001 0.0001 0.9 10 10 32 0.7 30 0.2 0.01 0.0001 0.99 10 10 32 6.0 30 0.25 0.001 0.0001 0.9 10 10 32 0.7 30 0.2 0.01 0.0001 0.99 10 10 32 6.0 - - - - - - - - - - - - - - - - - - 30 0.2 0.01 0.0001 0.99 10 10 32 6.0 30 0.2 0.01 0.0001 0.99 10 10 32 6.0 Tackling Shortcut Learning in Deep Neural Networks: An Iterative Approach with Interpretable Models Table 7. Hyperparameter setting of interpretable experts (g) for the dataset HAM10000 Settings based on dataset Expert1 Expert2 Expert3 Expert4 Expert5 Expert6 HAM10000 (Inception-V3) + Batch size + Coverage (τ ) + Learning rate + λlens +αKD + TKD +hidden neurons +λs + Tlens 32 0.4 0.01 0.0001 0.9 10 10 64 0.7 32 0.2 0.01 0.0001 0.9 10 10 64 0.7 32 0.2 0.01 0.0001 0.9 10 10 64 0.7 32 0.2 0.01 0.0001 0.9 10 10 64 0.7 32 0.1 0.01 0.0001 0.9 10 10 64 0.7 32 0.1 0.01 0.0001 0.9 10 10 64 0.7 Table 8. Hyperparameter setting of interpretable experts (g) for the dataset MIMIC-CXR Settings based on dataset Expert1 Expert2 Expert3 Effusion-MIMIC-CXR (DenseNet-121) + Batch size + Coverage (τ ) + Learning rate + λlens +αKD + TKD +hidden neurons +λs +Tlens 1028 0.6 0.01 0.0001 0.99 20 20, 20 96 7.6 1028 0.2 0.01 0.0001 0.99 20 20, 20 128 7.6 1028 0.15 0.01 0.0001 0.99 20 20, 20 256 7.6 Figure 3. MoIE identifies diverse concepts for specific subsets of a class, unlike the generic ones by the baselines. (i) We construct the FOL explanations of the samples of, "Bay breasted warbler" in the CUB-200 dataset for VIT-based (a) CBM + E-LEN as an interpretable-by-design baseline, (b) PCBM + E-LEN as a posthoc baseline, (c) experts in MoIE at inference. We highlight the unique concepts for experts 1,2, and 3 in red, blue, and magenta, respectively. (ii) Comparison of FOL explanations by MoIE with the PCBM + E-LEN baselines for HAM10000 (top) and ISIC (down) to classify Malignant lesion. We highlight unique concepts for experts 3, 5, and 6 in red, blue, and violet, respectively. For brevity, we combine the local FOLs for each expert for the samples covered by them, shown in the figure. <latexit sha1_base64="8nbc0QRHat6a9GDveLpN8MYlwv4=">AAACEHicbVBLTsMwFHTKr4RfgSUbixaJVZVUCFhWsGFZJPqR2qhyHKe16jiR/VJRRT0ELOEi7BBbbsA9OABumwW0jGRpNPOePR4/EVyD43xZhbX1jc2t4ra9s7u3f1A6PGrpOFWUNWksYtXxiWaCS9YEDoJ1EsVI5AvW9ke3M789ZkrzWD7AJGFeRAaSh5wSMFK70gti0JV+qexUnTnwKnFzUkY5Gv3St1mkacQkUEG07rpOAl5GFHAq2NTupZolhI7IgHUNlSRi2svmcaf4zCgBDmNljgQ8V39vZCTSehL5ZjIiMNTL3kz8z+umEF57GZdJCkzSxUNhKjDEePZ3HHDFKIiJIYQqbrJiOiSKUDAN/bkpGPNE56kfF7Ft2zY1uculrJJWrepeVi/ua+X6TV5YEZ2gU3SOXHSF6ugONVATUTRCT+gFvVrP1pv1bn0sRgtWvnOM/sD6/AEQ/J0F</latexit>...Expert6Baseline (PCBM + E-LEN)Expert3<latexit sha1_base64="8nbc0QRHat6a9GDveLpN8MYlwv4=">AAACEHicbVBLTsMwFHTKr4RfgSUbixaJVZVUCFhWsGFZJPqR2qhyHKe16jiR/VJRRT0ELOEi7BBbbsA9OABumwW0jGRpNPOePR4/EVyD43xZhbX1jc2t4ra9s7u3f1A6PGrpOFWUNWksYtXxiWaCS9YEDoJ1EsVI5AvW9ke3M789ZkrzWD7AJGFeRAaSh5wSMFK70gti0JV+qexUnTnwKnFzUkY5Gv3St1mkacQkUEG07rpOAl5GFHAq2NTupZolhI7IgHUNlSRi2svmcaf4zCgBDmNljgQ8V39vZCTSehL5ZjIiMNTL3kz8z+umEF57GZdJCkzSxUNhKjDEePZ3HHDFKIiJIYQqbrJiOiSKUDAN/bkpGPNE56kfF7Ft2zY1uculrJJWrepeVi/ua+X6TV5YEZ2gU3SOXHSF6ugONVATUTRCT+gFvVrP1pv1bn0sRgtWvnOM/sD6/AEQ/J0F</latexit>...Expert5Baseline (PCBM + E-LEN)Expert3<latexit sha1_base64="MvtXFkiIwSGtG11xlwj6/KzKHCE=">AAACZnicbVBNb9NAFNyYrxKgBBDiwGVFBOIU2aiiPZZy4QIKEkkqJVb0vHl2VlnvWrvPbSPLv45fwT+Aa/kDrB0j0ZZ3WI3mzZsdTVIo6SgMf/SCW7fv3L23d7//4OGj/ceDJ0+nzpRW4EQYZexpAg6V1DghSQpPC4uQJwpnyeZjs5+doXXS6G+0LTDOIdMylQLIU8tB/GZBeEFV+yZp9RmUzDRoqmu+UJiSldmawFpzznfK6oP38fdqLLMcNX1BOjd20+qN/Ss6mU3rur8cDMNR2A6/CaIODFk34+XgcrEyomx8hQLn5lFYUFyBJSkU1v1F6bAAsYEM5x5qyNHFVVtDzV97ZsVTHyI1mnjL/ntRQe7cNk+8Mgdau+u7hvzfbl5SehRXUhcloRa7j9JScTK86ZSvpEVBausBCCt9Vi7WYEGQb/6K0+pMFq5LfbGL3ZQUXa/kJpi+G0XvRwdfD4bHJ11de+wle8XesogdsmP2iY3ZhAn2nf1il+x372ewHzwPXuykQa+7ecauTMD/AJrrv14=</latexit>Malignant$AtypicalPigmentNetwork_BWV<latexit sha1_base64="Gxp/2R2p5pwBf1vhj5raRUtu45c=">AAAE43iczVNNb9NAEN0mhpbwlcKRy4qIqlyiBFXQYyhIwAEUPpJUiqNovRk7q6zX1u64bWT5F3BDXPlh/Rv8AtaOEUlTSuDEHKzRzHvz3oy1XiyFwVbrfKtSda5d3965Ubt56/adu/Xde30TJZpDj0cy0sceMyCFgh4KlHAca2ChJ2HgzV7k/cEJaCMi9QnnMYxCFijhC87Qlsa7lXMX4QzT4uv56VsmRaCYwiyjrgQftQimyLSOTukeXcIW0qknE8jSN1pDkEimP6LVnpmCG2nqeiLYX3CeW3ErKrsiCEHhO8DTSM9yHFOTcu7RoJ/llMdr7LyzAv29hZevsp9D3NreP0z6sL5KgVYQXM3IlekV0n84gZ2/0XJ/6WdD8NK6l27wy90mf/I/2KBWG9cbrWarCLqetMukQcrojuvf3UnEk3wrLpkxw3YrxlHKNAouIau5iYGY8RkLYGhTxUIwo7SwktFHtjKhvj2YHymkRXWZkbLQmHnoWWTIcGou9vLiZb1hgv7hKBUqThAUXwj5iaQY0fxB04nQwFHObcK4FtYr5VOmGUf77FcmTU5EbErXZwvb+ZHaF0+ynvSfNNtPmwfvDxqdo/JcO+QBeUj2SZs8Ix3ymnRJj/Bqp+pXo2rsgPPZ+eJ8XUArWyXnPlkJ59sPrbq3cw==</latexit>Malignant$IrregularStreaks_AtypicalPigmentNetwork^BWV_BWV^IrregularDG_BWV^RegularStreaks^¬RegularDG_AtypicalPigmentNetwork^¬IrregularDG^¬RegularDG^¬RegularStreaks_¬AtypicalPigmentNetwork^IrregularDG^¬RegularDG^¬RegularStreaks<latexit sha1_base64="fL0LVcbt0Qnroz4oKt9H7BwtgIs=">AAACiHicbVHLjtMwFHXCa8jwKK8VG4uKEasqGY0Y2A0DEmxABdGZkZqqctyb1KpjR/ZNZyor4jv5AH6AL8BJs5gHd2EdnXvvuUfHWSWFxTj+HYS3bt+5e2/nfrT74OGjx4MnT0+srg2HCddSm7OMWZBCwQQFSjirDLAyk3CarT62/dM1GCu0+ombCmYlK5TIBWfoqfngV4pwga57s9x9ZVIUiilsGppKyNGIYonMGH1O9+il2e6yWwstARv3wUt7STkWRQkKvwGea7PqNLShaUqjvVRBsd13P6CoJTOfPjdNNB8M41HcFb0Jkh4MSV/j+eBvutC8bs9wyaydJnGFM8cMCi6hidLaQsX4ihUw9VCxEuzMdXYb+tozC5p7T7lWSDv28oZjpbWbMvOTJcOlvd5ryf/1pjXm72ZOqKpGUHx7KK8lRU3b1OlCGOAoNx4wboT3SvmSGcbR/80VpcVaVLZ3fbG13YaUXI/kJjjZHyVvRwffD4ZHx31cO+QleUXekIQckiPyhYzJhHDyJ9gNngcvwiiMw8Pw/XY0DPqdZ+RKhcf/ACViya0=</latexit>Malignant$AtypicalPigmentNetwork_¬RegularDG<latexit sha1_base64="R69OWRVQGkBVxQ5ilj6gERDaVDA=">AAACZHicbVBNb9NAEN2YrxIKBCpOSGhFBOIU2aiiPRZ66QUUJNJWSqJovB47q6x3rd1x28jyj+Nn8AfotfALWDs+9IORdvX0ZubN04sLJR2F4a9ecO/+g4ePth73n2w/ffZ88OLlsTOlFTgRRhl7GoNDJTVOSJLC08Ii5LHCk3h12PRPztA6afQPWhc4zyHTMpUCyFOLwfT9jPCCqvaP0+orKJlp0FTXfKYwJSuzJYG15pxfm2wPVxaTuvrsZb2cGsssR03fkM6NXfn1/mIwDEdhW/wuiDowZF2NF4O/s8SIspERCpybRmFB8wosSaGw7s9KhwWIFWQ49VBDjm5etV5q/s4zCU+N9U8Tb9nrGxXkzq3z2E/mQEt3u9eQ/+tNS0r355XURUmoxeZQWipOhjeJ8kRaFKTWHoCw0nvlYgkWBPncbyglZ7JwneuLje0mpOh2JHfB8cdR9Gm0+313ePCli2uLvWZv2QcWsT12wI7YmE2YYD/ZJbtif3q/g+1gJ3i1GQ163c4Ou1HBm3+GE770</latexit>Malignant$AtypicalPigmentNetwork<latexit sha1_base64="bZ0bcD9xiJwfk9Lf8rpSJF3Rays=">AAACc3icbVE9b9swEKXV5qNukrrNmIWIGyBLDKkI2oxBunQpkLS1HcA2DIo6yUwoUiBPaQxC/7Fr/0aBdG0oWUM+egPx+N4d7+ExLqSwGIa/O8GLl2vrG5uvuq+3tnfe9N6+G1ldGg5DrqU2lzGzIIWCIQqUcFkYYHksYRxff6718Q0YK7T6gcsCZjnLlEgFZ+ipee9qinCLrjnj1H1lUmSKKawqOpWQohHZApkx+ielq1Z3Nh41qjb0wXBjxRlIKvcNMgO2XvkdTcmx9Leq6s57/XAQNkWfg6gFfdLW+bz3Z5poXuagkEtm7SQKC5w5ZlBwCVV3WlooGL9mGUw8VCwHO3ONkYoeeCahqTeZaoW0YR9OOJZbu8xj35kzXNinWk3+T5uUmJ7MnFBFiaD4alFaSoqa1gHTRBjgKJceMG6E90r5ghnG0X/Do5eSG1HY1vXtynYdUvQ0kudg9GEQfRwcXxz3T8/auDbJHtknhyQin8gp+ULOyZBw8ov8Jf86pHMX7AX7wftVa9BpZ3bJowqO7gENkcS+</latexit>Malignant$BWV_RegressionStructures<latexit sha1_base64="he2glCZFYCF2CONnC+g9fpSSwfk=">AAACc3icbVFNbxMxFHSWr5LyEeDYi9W0iAvRblUBxwqQgEOlUpq2UjaK3jpvNyZee2W/LY1W+x+58jeQ4Eqd7KqiH+9gjWbGfqNxUijpKAx/dYI7d+/df7D2sLv+6PGTp71nz4+dKa3AoTDK2NMEHCqpcUiSFJ4WFiFPFJ4k8w9L/eQMrZNGH9GiwHEOmZapFECemvS+b/N9UDLToKn7MiY8p2p1Jml1KdQ1jxWmZGU2I7DW/OCN84u1mJUK7DfyS+du6TOWxxqzxlAdNvrHT3U96fXDQbgafhNELeizdg4mvd/x1IgyR01CgXOjKCxoXIElKRTW3bh0WICYQ4YjDzXk6MbVqpOab3tmylOfJjWa+Ir9/0YFuXOLPPHOHGjmrmtL8jZtVFL6blxJXZSEWjSL0lJxMnxZMJ9Ki4LUwgMQVvqsXMzAgiD/DVdemp7JwrWpz5vYXV9SdL2Sm+B4ZxC9Gex+3e3vvW/rWmMbbJO9YhF7y/bYZ3bAhkywn+wv+9dhnT/BRrAZbDXWoNPeecGuTPD6AmZlw2I=</latexit>Malignant$IrregularStreaks_¬RegularDG(b)(ii)(i)(c)<latexit sha1_base64="8nbc0QRHat6a9GDveLpN8MYlwv4=">AAACEHicbVBLTsMwFHTKr4RfgSUbixaJVZVUCFhWsGFZJPqR2qhyHKe16jiR/VJRRT0ELOEi7BBbbsA9OABumwW0jGRpNPOePR4/EVyD43xZhbX1jc2t4ra9s7u3f1A6PGrpOFWUNWksYtXxiWaCS9YEDoJ1EsVI5AvW9ke3M789ZkrzWD7AJGFeRAaSh5wSMFK70gti0JV+qexUnTnwKnFzUkY5Gv3St1mkacQkUEG07rpOAl5GFHAq2NTupZolhI7IgHUNlSRi2svmcaf4zCgBDmNljgQ8V39vZCTSehL5ZjIiMNTL3kz8z+umEF57GZdJCkzSxUNhKjDEePZ3HHDFKIiJIYQqbrJiOiSKUDAN/bkpGPNE56kfF7Ft2zY1uculrJJWrepeVi/ua+X6TV5YEZ2gU3SOXHSF6ugONVATUTRCT+gFvVrP1pv1bn0sRgtWvnOM/sD6/AEQ/J0F</latexit>...<latexit sha1_base64="IN8bGs/hW8EXbkOmFo2cJDJhTUk=">AAAD9HichVPNbtNAEN7YQIv5aQpHLiuSIE5RUlWUY5VeuCCKRJpKcRSt1+N4lfUPu+O0kWV4EW6IK+/DG/AAPABrxwokTWEkr0cz33zzzWjXS6XQ2Ov9aFj2nbv39vbvOw8ePnp80Dx8cqGTTHEY8kQm6tJjGqSIYYgCJVymCljkSRh587MyP1qA0iKJP+AyhUnEZrEIBGdoQtPDxs8OHdT19Gzw1um4CNfoBfmALQeGSSP4I6YMnypo25UQoBKzEJlSyVWb0iBREALz3Wklxp16kvF5iWSx36YSZuvMTMFynaBZmoIJIhNyE7GGVIiUKdRrwFUoEJwX1P2YMd+c9e/PSSv5+T+GKOjWEHXJ7kEKwxjqlHHIj1Isa400E3NppWKHjIpse+xiF8sKeusedtf8p/FtOyvotNnqdXuV0ZtOv3ZapLbzafOX6yc8iyBGLpnW434vxUluuAWXUDhupsHIm7MZjI0bswj0JK+aFrRjIn55OcwXI62if1fkLNJ6GXkGGTEM9XauDO7KjTMMXk9yEacZQsxXjYJMUkxoeb+pLxRwlEvjMK6E0Up5yBTjaF7BBpO/EKmuVV+vZDuOY9bU317KTefiqNt/1T1+f9w6HdQL2yfPyHPykvTJCTklb8g5GRJuvbMy65P12V7YX+yv9rcV1GrUNU/JhtnffwOWy1Ez</latexit>BayBreastedWarbler$foreheadcolorblack^legcolorgrey^uppertailcolorgrey^upperpartscolorwhite(a)Expert2<latexit sha1_base64="hrRdkudzQAwwB+Jt/e1TnrvPxHA=">AAAEAHiclVJLb9NAEN7YPEp4pXDksiJB4hQlVQUcq3DhWCTSVIoja70e26uu16vddVPL8gWu8D+4Ia78E/4GB86sHatgt1LFSCuN5pvvodEGkjNtZrOfA8e9dfvO3b17w/sPHj56PNp/cqKzXFFY0oxn6jQgGjgTsDTMcDiVCkgacFgFZ29rfHUOSrNMfDCFhE1KYsEiRomxI39/8Bt7Bi5MEJULUiwsVRsIV0RZAVXhicchMorFiSFKZdsJDgg983xJjAElPF9bUEJYLxIRTnZiTawy4DlUZcA4t2sJkeD5hHOZK5lpqC4ZLSRB0YSJmLMzuMS2duD5jZznbxNm/kITT0B8nV83X5pzwxocwupGsmiitH4Bt1L/zcmhT+ksxAqKvqRULCWq6Brf6Ntn1cp961yEYCFDGO+qD/3ReDadNYWvNvO2GaO2jv3RLy/MaJ6CMJQTrdfzmTSbkih7Xg7V0Ms1SKtMYljbVpAU9KZsPCv8wk5CHGXKPmFwM/2XUZJU6yIN7GZKTKL7WD28DlvnJnqzKZmQuQFBd0ZRzrHJcP3bccgUUMML2xCqmM2KaUIUofZ3dJXCcyZ1m/piF7s+0rx/kqvNycF0/mp6+P5gfLRoz7WHnqHn6CWao9foCL1Dx2iJqLNxPjmfnS/uR/er+839vlt1Bi3nKeqU++MPIgJX8Q==</latexit>BayBreastedWarbler$backpatternstriped^billshapeallpurpose^shapeperchinglike^wingcolorwhite^¬backpatternmulticolored^¬napecolorblack^¬napecolorblue^¬napecolorgrey^¬primarycolorblack^¬primarycolorgrey^¬undertailcolorblackPCBM + E-LENExpert1<latexit sha1_base64="G35o0yE/fQynIJMXpK5L46cFPVc=">AAAE4HictVPPi9NAFM62Vdf4q6tHL4Ptwnop7SLqRVgqgsdV7HahKWEyeU2GTibDzMu2IeTuTbz6hwn+G/4FTtJStt2ueHEg5PG+733vvW+SQAlusN//ddBotu7cvXd4333w8NHjJ+2jpxcmzTSDEUtFqi8DakBwCSPkKOBSaaBJIGAczN9X+PgKtOGp/IK5gmlCI8lnnFG0Kf+o8fP4w1KBRjJwPYQlBrNiSPOh1TAI4Zhqq6RL0vUEzFDzKEaqdbroEi/g0UlA2dzzFUUELT3fWIaCsGJTGVpOpVgPWQw1Z/PPEJZFpmw/RTUaz68xzw+E1Sk3ZQsuow22iDnCBup6EqIukVTBhhFpyHcJeztjrFOKu12rRV4St+sFqQhNnthX4VlC2SVuveRerQCEyK+vngoeln/ffJZqiIGGt+1t4notaw+LrQWCz+G/W3m7k+6KoDRPqM63G+yI7B1ut7DuXv5L5f572i7MZAgWQ8rFNrG+Ttdvd/q9fn3IzWCwDjrO+pz77d9emLIsAYlMUGMmg77CaWG95UxA6XqZAWXlaQQTG0qagJkWdeOSHNtMSOz12kciqbPXKwqamOrLssyEYmx2sSq5D5tkOHs7LbhUGYJkq0azTBBMSfU3k5BrYChyG1CmuZ2VsJhqyuxHua0UXnFl1lMvV2NXJg12LbkZXJz2Bq97rz6dds6Ga7sOnefOC+fEGThvnDPno3PujBzWfNdkTdFMWkHra+tb6/uK2jhY1zxztk7rxx/9bqqG</latexit>BayBreastedWarbler$backpatternstriped^upperpartscolorblack^wingcolorwhite^¬napecolorgrey^¬throatcolorblack_bellypatternsolid^foreheadcolorblack^shapeperchinglike^upperpartscolorblack^wingcolorwhite^¬napecolorgrey^¬primarycolorblack^¬primarycolorwhite^¬throatcolorblack^¬undertailcolorblack<latexit sha1_base64="DI9Rb11Y4y80UizQQ7crPkfJE4Q=">AAACG3icbVDLTsJAFJ3iC+ur6tLNRDCBDWmJUZdENy4xkUcClUynU5gwnTYzUwJp+BNd6o+4M25d+B9+gAN0IeBJJjk55947J8eLGZXKtr+N3Mbm1vZOftfc2z84PLKOT5oySgQmDRyxSLQ9JAmjnDQUVYy0Y0FQ6DHS8oZ3M781IkLSiD+qSUzcEPU5DShGSks9yyqmgye71K0PaGlcLk+LPatgV+w54DpxMlIAGeo966frRzgJCVeYISk7jh0rN0VCUczI1OwmksQID1GfdDTlKCTSTefJp/BCKz4MIqEfV3Cu/t1IUSjlJPT0ZIjUQK56M/E/r5Oo4MZNKY8TRThefBQkDKoIzmqAPhUEKzbRBGFBdVaIB0ggrHRZS5f8EY1llnq8iG2apq7JWS1lnTSrFeeqcvlQLdRus8Ly4AycgxJwwDWogXtQBw2AwQg8g1fwZrwY78aH8bkYzRnZzilYgvH1C/xjn/8=</latexit>h0((x))<latexit sha1_base64="Vvj7KSHAuELkigHQPz6+CKz+H7Y=">AAACG3icbVDLTsJAFJ3iC+ur6tLNRDCBDWmJUZdENy4xkUcClUynU5gwnTYzUwJp+BNd6o+4M25d+B9+gAN0IeBJJjk55947J8eLGZXKtr+N3Mbm1vZOftfc2z84PLKOT5oySgQmDRyxSLQ9JAmjnDQUVYy0Y0FQ6DHS8oZ3M781IkLSiD+qSUzcEPU5DShGSks9yyqmgyen1K0PaGlcLk+LPatgV+w54DpxMlIAGeo966frRzgJCVeYISk7jh0rN0VCUczI1OwmksQID1GfdDTlKCTSTefJp/BCKz4MIqEfV3Cu/t1IUSjlJPT0ZIjUQK56M/E/r5Oo4MZNKY8TRThefBQkDKoIzmqAPhUEKzbRBGFBdVaIB0ggrHRZS5f8EY1llnq8iG2apq7JWS1lnTSrFeeqcvlQLdRus8Ly4AycgxJwwDWogXtQBw2AwQg8g1fwZrwY78aH8bkYzRnZzilYgvH1C/4UoAA=</latexit>h1((x))<latexit sha1_base64="15CjOPpK8b8Uhve0sNEAZovkTd8=">AAACG3icbVDLTsJAFJ3iC+ur6tLNRDCBDWmJUZdENy4xkUcClUynU5gwnTYzUwJp+BNd6o+4M25d+B9+gAN0IeBJJjk55947J8eLGZXKtr+N3Mbm1vZOftfc2z84PLKOT5oySgQmDRyxSLQ9JAmjnDQUVYy0Y0FQ6DHS8oZ3M781IkLSiD+qSUzcEPU5DShGSks9yyqmg6dqqVsf0NK4XJ4We1bBrthzwHXiZKQAMtR71k/Xj3ASEq4wQ1J2HDtWboqEopiRqdlNJIkRHqI+6WjKUUikm86TT+GFVnwYREI/ruBc/buRolDKSejpyRCpgVz1ZuJ/XidRwY2bUh4ninC8+ChIGFQRnNUAfSoIVmyiCcKC6qwQD5BAWOmyli75IxrLLPV4Eds0TV2Ts1rKOmlWK85V5fKhWqjdZoXlwRk4ByXggGtQA/egDhoAgxF4Bq/gzXgx3o0P43MxmjOynVOwBOPrF//FoAE=</latexit>h2((x))<latexit sha1_base64="S97tL6CV4JO09RiMp7W033bnPD0=">AAAB83icbVBNS8NAEJ3Ur1q/qh69LBahvZREinosevFYwX5AE8tmu2mWbjZhdyOW0L/hxYMiXv0z3vw3btsctPXBwOO9GWbm+QlnStv2t1VYW9/Y3Cpul3Z29/YPyodHHRWnktA2iXksez5WlDNB25ppTnuJpDjyOe3645uZ332kUrFY3OtJQr0IjwQLGMHaSG740Ki6rZBVn2q1Qbli1+050CpxclKBHK1B+csdxiSNqNCEY6X6jp1oL8NSM8LptOSmiiaYjPGI9g0VOKLKy+Y3T9GZUYYoiKUpodFc/T2R4UipSeSbzgjrUC17M/E/r5/q4MrLmEhSTQVZLApSjnSMZgGgIZOUaD4xBBPJzK2IhFhiok1MJROCs/zyKumc152LeuOuUWle53EU4QROoQoOXEITbqEFbSCQwDO8wpuVWi/Wu/WxaC1Y+cwx/IH1+QNGh5CM</latexit>h4((x))<latexit sha1_base64="JCV/iswyVmPE8Qft7ZfUtfoe4J0=">AAAB83icbVBNS8NAEJ34WetX1aOXxSK0l5JoUY9FLx4r2A9oYtlsN83SzSbsbsQS+je8eFDEq3/Gm//GbZuDtj4YeLw3w8w8P+FMadv+tlZW19Y3Ngtbxe2d3b390sFhW8WpJLRFYh7Lro8V5UzQlmaa024iKY58Tjv+6Gbqdx6pVCwW93qcUC/CQ8ECRrA2khs+nFfcZsgqT9Vqv1S2a/YMaJk4OSlDjma/9OUOYpJGVGjCsVI9x060l2GpGeF0UnRTRRNMRnhIe4YKHFHlZbObJ+jUKAMUxNKU0Gim/p7IcKTUOPJNZ4R1qBa9qfif10t1cOVlTCSppoLMFwUpRzpG0wDQgElKNB8bgolk5lZEQiwx0SamognBWXx5mbTPas5FrX5XLzeu8zgKcAwnUAEHLqEBt9CEFhBI4Ble4c1KrRfr3fqYt65Y+cwR/IH1+QNE+pCL</latexit>h3((x))<latexit sha1_base64="dEs/aiJlSKvabYQvCjgBDQZN/kQ=">AAACoHicbVFNb9NAEN2YrxK+Ahy5rBpRcYDIrirgWIVLL4hWIk1FNrLG67GzyvpDu+NSy/Lv4LfxN7gjsXZ86AcjrfX0Zt7M03NUamXJ93+PvHv3Hzx8tPd4/OTps+cvJi9fnduiMhIXstCFuYjAolY5LkiRxovSIGSRxmW0/dL1l5dorCry71SXuM4gzVWiJJCjwskvQXhFTf+NkmYO9dzJLWG8BOOWmLblQmNCRqUbAmOKn5wf8J0qArkVYQlEaHIRWjdUYuwEG1uCxCYoqVNDHgsxPrh2qffdfIUUc4K20ZiKsOdEmBqs23YcTqb+zO+L3wXBAKZsqNNw8kfEhawyt1FqsHYV+CWtGzCkpMZ2LCqLztTW3Vw5mEOGdt30R1v+1jExTwrjXk68Z68rGsisrbPITWZAG3u715H/660qSj6vG5WXFWEud4eSSnMqePc3eKwMStK1AyCNcl653IAB6RK9uSm+VKUdXF/tbHchBbcjuQvOD2fBx9nR2dH0eD7EtcfesH32jgXsEztmJ+yULZhkf0fT0fvRB2/fO/G+eWe7UW80aF6zG+X9+AckOdQU</latexit>BayBreastedWarbler$backpatternstriped^legcolorgreyExpert4Route Interpret RepeatCBM + E-LEN<latexit sha1_base64="SmAwh3uxfJqlSyNIQ9hqVzK2EXs=">AAAEmnichZNLb9NAEMfdxEAJrxSOgLQiSWkvUYIq4Fi5FxBCKlLTVIoja70eO6uuH9odN42ifAe+Hl+DC1fWD0zihrCSpdHMb2b+M7t2E8EVDgY/9hpN8979B/sPW48eP3n6rH3w/FLFqWQwYrGI5ZVLFQgewQg5CrhKJNDQFTB2r8+y+PgGpOJxdIGLBKYhDSLuc0ZRu5yDxvcescp8cmZ9bfVshFt0/aVFF5aupBC8MZW6nlyRri3AR8mDGVIp43mXED+WMAPq2U4uxnZcQdl1RtLI6xIBQRUJJCyqAEmTBLQTKRebRIXkREIlqgqYzzhC65DkIpc7pK5ITSqxXR4cFXmuVripN8N1T2LbVfHtg63IHzKH5jwKNsX9BfJSEQQlijMZU6zDmapjnRHLQiD5j8I1gQWTUESQke0oPWwC3mpDX33963MWxL+uoSL1BLsXUg26c85asW2Ly3fRctqdQX+QH3LXGJZGxyjPudP+aXsxS0OIkAmq1GQ4SHC61O+GMwGrlp0qSLRSGsBEmxENQU2XeesV6WmPlz1i/UVIcu96xpKGSi1CV5MhxZmqxzLnttgkRf/jdMmjJEWIWNHITwXBmGT/IfG4BIZioQ3KJNdaCZtRSZm+zc1K3g1PVKn6tpCdLWlYX8ld4/Jdf/i+f/LtpHNqlevaN14ab4wjY2h8ME6NT8a5MTJY41fzdfOw+dZ8ZVrmZ/NLgTb2ypwXxsYxL34DMe2QOg==</latexit>BayBreastedWarbler$backcolorblack^foreheadcolorblack^wingcolorwhite^¬throatcolorwhite_backcolorblack^backpatternstriped^legcolorgrey^uppertailcolorgrey^¬foreheadcolorblack¬throatcolorwhite^¬wingcolorwhite Tackling Shortcut Learning in Deep Neural Networks: An Iterative Approach with Interpretable Models Figure 4. Construction logical explanations of the samples of "Effusion" in the MIMIC-CXR dataset for various experts in MoIE at inference. The final residual covers the unexplained sample, which is "harder" to explain (indicated in red). Figure 5. Flexibility of FOL explanations by VIT-derived MoIE MoIE and the CBM + E-LEN and PCBM + E-LEN baselines for Awa2 dataset to classify "Otter" at inference. Both the baseline's FOL constitutes identical concepts to distinguish all the samples. However, expert1 classifies "Otter" with hunter, group etc.as the identifying concept for the instances covered by it. Similarly expert5 classifies "Otter" using buckteeth, gray etc.. Note that, meat and gray are shared between the two experts. We highlight the shared concepts (artic) between the experts and the baselines as blue. <latexit sha1_base64="DI9Rb11Y4y80UizQQ7crPkfJE4Q=">AAACG3icbVDLTsJAFJ3iC+ur6tLNRDCBDWmJUZdENy4xkUcClUynU5gwnTYzUwJp+BNd6o+4M25d+B9+gAN0IeBJJjk55947J8eLGZXKtr+N3Mbm1vZOftfc2z84PLKOT5oySgQmDRyxSLQ9JAmjnDQUVYy0Y0FQ6DHS8oZ3M781IkLSiD+qSUzcEPU5DShGSks9yyqmgye71K0PaGlcLk+LPatgV+w54DpxMlIAGeo966frRzgJCVeYISk7jh0rN0VCUczI1OwmksQID1GfdDTlKCTSTefJp/BCKz4MIqEfV3Cu/t1IUSjlJPT0ZIjUQK56M/E/r5Oo4MZNKY8TRThefBQkDKoIzmqAPhUEKzbRBGFBdVaIB0ggrHRZS5f8EY1llnq8iG2apq7JWS1lnTSrFeeqcvlQLdRus8Ly4AycgxJwwDWogXtQBw2AwQg8g1fwZrwY78aH8bkYzRnZzilYgvH1C/xjn/8=</latexit>h0((x))<latexit sha1_base64="Vvj7KSHAuELkigHQPz6+CKz+H7Y=">AAACG3icbVDLTsJAFJ3iC+ur6tLNRDCBDWmJUZdENy4xkUcClUynU5gwnTYzUwJp+BNd6o+4M25d+B9+gAN0IeBJJjk55947J8eLGZXKtr+N3Mbm1vZOftfc2z84PLKOT5oySgQmDRyxSLQ9JAmjnDQUVYy0Y0FQ6DHS8oZ3M781IkLSiD+qSUzcEPU5DShGSks9yyqmgyen1K0PaGlcLk+LPatgV+w54DpxMlIAGeo966frRzgJCVeYISk7jh0rN0VCUczI1OwmksQID1GfdDTlKCTSTefJp/BCKz4MIqEfV3Cu/t1IUSjlJPT0ZIjUQK56M/E/r5Oo4MZNKY8TRThefBQkDKoIzmqAPhUEKzbRBGFBdVaIB0ggrHRZS5f8EY1llnq8iG2apq7JWS1lnTSrFeeqcvlQLdRus8Ly4AycgxJwwDWogXtQBw2AwQg8g1fwZrwY78aH8bkYzRnZzilYgvH1C/4UoAA=</latexit>h1((x))<latexit sha1_base64="15CjOPpK8b8Uhve0sNEAZovkTd8=">AAACG3icbVDLTsJAFJ3iC+ur6tLNRDCBDWmJUZdENy4xkUcClUynU5gwnTYzUwJp+BNd6o+4M25d+B9+gAN0IeBJJjk55947J8eLGZXKtr+N3Mbm1vZOftfc2z84PLKOT5oySgQmDRyxSLQ9JAmjnDQUVYy0Y0FQ6DHS8oZ3M781IkLSiD+qSUzcEPU5DShGSks9yyqmg6dqqVsf0NK4XJ4We1bBrthzwHXiZKQAMtR71k/Xj3ASEq4wQ1J2HDtWboqEopiRqdlNJIkRHqI+6WjKUUikm86TT+GFVnwYREI/ruBc/buRolDKSejpyRCpgVz1ZuJ/XidRwY2bUh4ninC8+ChIGFQRnNUAfSoIVmyiCcKC6qwQD5BAWOmyli75IxrLLPV4Eds0TV2Ts1rKOmlWK85V5fKhWqjdZoXlwRk4ByXggGtQA/egDhoAgxF4Bq/gzXgx3o0P43MxmjOynVOwBOPrF//FoAE=</latexit>h2((x))Expert1Expert2<latexit sha1_base64="8nbc0QRHat6a9GDveLpN8MYlwv4=">AAACEHicbVBLTsMwFHTKr4RfgSUbixaJVZVUCFhWsGFZJPqR2qhyHKe16jiR/VJRRT0ELOEi7BBbbsA9OABumwW0jGRpNPOePR4/EVyD43xZhbX1jc2t4ra9s7u3f1A6PGrpOFWUNWksYtXxiWaCS9YEDoJ1EsVI5AvW9ke3M789ZkrzWD7AJGFeRAaSh5wSMFK70gti0JV+qexUnTnwKnFzUkY5Gv3St1mkacQkUEG07rpOAl5GFHAq2NTupZolhI7IgHUNlSRi2svmcaf4zCgBDmNljgQ8V39vZCTSehL5ZjIiMNTL3kz8z+umEF57GZdJCkzSxUNhKjDEePZ3HHDFKIiJIYQqbrJiOiSKUDAN/bkpGPNE56kfF7Ft2zY1uculrJJWrepeVi/ua+X6TV5YEZ2gU3SOXHSF6ugONVATUTRCT+gFvVrP1pv1bn0sRgtWvnOM/sD6/AEQ/J0F</latexit>...Expert4MoIE<latexit sha1_base64="S97tL6CV4JO09RiMp7W033bnPD0=">AAAB83icbVBNS8NAEJ3Ur1q/qh69LBahvZREinosevFYwX5AE8tmu2mWbjZhdyOW0L/hxYMiXv0z3vw3btsctPXBwOO9GWbm+QlnStv2t1VYW9/Y3Cpul3Z29/YPyodHHRWnktA2iXksez5WlDNB25ppTnuJpDjyOe3645uZ332kUrFY3OtJQr0IjwQLGMHaSG740Ki6rZBVn2q1Qbli1+050CpxclKBHK1B+csdxiSNqNCEY6X6jp1oL8NSM8LptOSmiiaYjPGI9g0VOKLKy+Y3T9GZUYYoiKUpodFc/T2R4UipSeSbzgjrUC17M/E/r5/q4MrLmEhSTQVZLApSjnSMZgGgIZOUaD4xBBPJzK2IhFhiok1MJROCs/zyKumc152LeuOuUWle53EU4QROoQoOXEITbqEFbSCQwDO8wpuVWi/Wu/WxaC1Y+cwx/IH1+QNGh5CM</latexit>h4((x))<latexit sha1_base64="JCV/iswyVmPE8Qft7ZfUtfoe4J0=">AAAB83icbVBNS8NAEJ34WetX1aOXxSK0l5JoUY9FLx4r2A9oYtlsN83SzSbsbsQS+je8eFDEq3/Gm//GbZuDtj4YeLw3w8w8P+FMadv+tlZW19Y3Ngtbxe2d3b390sFhW8WpJLRFYh7Lro8V5UzQlmaa024iKY58Tjv+6Gbqdx6pVCwW93qcUC/CQ8ECRrA2khs+nFfcZsgqT9Vqv1S2a/YMaJk4OSlDjma/9OUOYpJGVGjCsVI9x060l2GpGeF0UnRTRRNMRnhIe4YKHFHlZbObJ+jUKAMUxNKU0Gim/p7IcKTUOPJNZ4R1qBa9qfif10t1cOVlTCSppoLMFwUpRzpG0wDQgElKNB8bgolk5lZEQiwx0SamognBWXx5mbTPas5FrX5XLzeu8zgKcAwnUAEHLqEBt9CEFhBI4Ble4c1KrRfr3fqYt65Y+cwR/IH1+QNE+pCL</latexit>h3((x))<latexit sha1_base64="J+SMEQU67QIFWqmd+kUzaLA1KfY=">AAADAnicbVJLbxMxEPYurxJeKRy5WCRInKJNhYBjVYTEsUikrZQNkdc7m1j12pY9bhutcusVfgg3xJU/wu/gwhHvZpWmDSNZmvm+bzwPOzNSOEyS31F86/adu/d27ncePHz0+El39+mR095yGHEttT3JmAMpFIxQoIQTY4GVmYTj7PR9zR+fgXVCq8+4MDAp2UyJQnCGAZp2/3ZShAvMiupDUfhatqT9VEKBVszmyKzV531ax+nUSPCWyZpnKu/TNk6nXhnga7hJrNWbYgtoNWc2F2xLybVDbeYWlLjiNsG6gtss0Vx0xTovuXdr9lxYWAeF9CJfR3nYKKjV6L1kkDRGt51h6/RIa4fT7p8019yXIZ1L5tx4mBicVMyi4BKWndQ7MIyfshmMg6tYCW5SNS+0pC8DktNC23AU0gbdzKhY6dyizIKyZDh3N7ka/B839li8m1RCGR/m4qtChZcUNa2fOwxsgaNc0HrxVoReKZ8zyziGT3HtpvxMGNd2fdG23QlbGt7cybZztDcYvhm8/rTX2z9o97VDnpMX5BUZkrdkn3wkh2REePQluoy+Rt/iy/h7/CP+uZLGUZvzjFyz+Nc/zZD2VQ==</latexit>E↵usion$leftpleural^pleuralunpec^rightplural^retrocardiac^rightcostophrenic^costophrenicunspec^cardiophrenicsulcus^wire^fluid^distentionFinalResidual(Unexplained)<latexit sha1_base64="qwvvcbxUStlvVzrp4R1hk+NaoM4=">AAACqnicbVHdbtMwFHYCG6MMKHDJjUU7aRdTlUxjcDmBkLjcEN2GmipynJPWmmNb9vFYFfVdeK09x14Ap4s2unEkS9/5fuyj48JI4TBJrqP4ydONzWdbz3svtl++et1/8/bUaW85jLmW2p4XzIEUCsYoUMK5scDqQsJZcfG11c8uwTqh1U9cGJjWbKZEJTjDQOX9P70M4QqLqvlWVb61Lekwk1ChFbM5Mmv17yFt+yw3ErxlstWZKoe067PcKwP8jl4FW/eamWuH2swtKMHbhLuP0EzBLDiYLcW9xXnJvaN5f5CMklXRxyDtwIB0dZz3b7JSc1+DQi6Zc5M0MThtmEXBJSx7mXdgGL9gM5gEqFgNbtqsNrmkO4EpaaVtOArpiv030bDauUVdBGfNcO4eai35P23isfo8bYQyHkHx24cqLylq2n4LLYUFjnIRAONWhFkpnzPLOIbPW7upvBTGdVNfdWP3wpbShzt5DE73R+nh6OBkf3D0pdvXFnlPPpBdkpJP5Ih8J8dkTHi0Ge1FH6PDeC/+Ef+KJ7fWOOoy78haxeVf1izTYw==</latexit>E↵usion$leftpleural^pleuralunpec^rightplural^costophrenicunspec^¬cardiophrenicsulcus<latexit sha1_base64="6BAeIJao3ztlihxQY+WOKxfu8u4=">AAADD3icbVLdbtMwFHbCgBH+OrjkxqJF4qpqJwRcTiAkLodEt0lNVTnOSWrVsa1je1sV9SF2Cw/CHeKWR+A5eAGcNoKl40hRvpzv+3J+7MxIYd1o9CuKb+3dvnN3/15y/8HDR497B09OrPbIYcK11HiWMQtSKJg44SScGQRWZRJOs+X7hj89B7RCq89uZWBWsVKJQnDmQmp+EO0lqYNLlxX1h6LwjW5NB6mEwqEoF44h6osBbb7TuZHgkcmGZyof0I0inUt9ARheXpU0TZMd1shrHpoqKAeUM8yFNgsEJXg6t15ybxtvVwaq1FhCBcr9rZkjE4qV0FWGma31CP/qtwRCHpaIIvPNvF0Ts0bgdg+9/mg42gS9CcYt6JM2jue932muuW8645JZOx2PjJvVDJ3gEtZJ6i0Yxpeh0WmAilVgZ/XmuNb0RcjktNAYnjDZJnvdUbPK2lWVBWXF3MLuck3yf9zUu+LtrBbKeAeKbwsVXlKnaXP2NBcI3MlVAIyjCL1SvmDIuAs3pPOn/FwY23Z92badhC2Nd3dyE5wcDsevh68+HfaP3rX72ifPyHPykozJG3JEPpJjMiE8WkZX0Zfoa3wVf4u/xz+20jhqPU9JJ+KffwCtDvhO</latexit>E↵usion$leftpleural^rightlowerlung^rightplural^¬cardiophrenicsulcus^¬engorgement^drainage^¬pressure^¬redistribution^¬aspiration<latexit sha1_base64="8nbc0QRHat6a9GDveLpN8MYlwv4=">AAACEHicbVBLTsMwFHTKr4RfgSUbixaJVZVUCFhWsGFZJPqR2qhyHKe16jiR/VJRRT0ELOEi7BBbbsA9OABumwW0jGRpNPOePR4/EVyD43xZhbX1jc2t4ra9s7u3f1A6PGrpOFWUNWksYtXxiWaCS9YEDoJ1EsVI5AvW9ke3M789ZkrzWD7AJGFeRAaSh5wSMFK70gti0JV+qexUnTnwKnFzUkY5Gv3St1mkacQkUEG07rpOAl5GFHAq2NTupZolhI7IgHUNlSRi2svmcaf4zCgBDmNljgQ8V39vZCTSehL5ZjIiMNTL3kz8z+umEF57GZdJCkzSxUNhKjDEePZ3HHDFKIiJIYQqbrJiOiSKUDAN/bkpGPNE56kfF7Ft2zY1uculrJJWrepeVi/ua+X6TV5YEZ2gU3SOXHSF6ugONVATUTRCT+gFvVrP1pv1bn0sRgtWvnOM/sD6/AEQ/J0F</latexit>...<latexit sha1_base64="zmOVRbLkSfIWMgk2EnnWf3Ph3eM=">AAADSnicbVJNb9NAEF27BYr5SuHIZUUE4hQlVVU4oQou3CgSaSvFUTRej+NV1mt3d9w2svxz+DVwhAN/A3FBXNgkLtRpRvJq9r2ZeTPjjQolLfX7Pzx/a/vW7Ts7d4N79x88fNTZfXxs89IIHIpc5eY0AotKahySJIWnhUHIIoUn0ezdgj85R2Nlrj/RvMBxBlMtEymAHDTZ9d684CHhJVXLM0qqD0Ro6pqHChMycpoSGJNfNFFpqRe0Y0HHPNQ4bYipycviH76ENFqyRU4OTW0BAqu9guomIuSBUz47K8FdVuf/YhegZrZdLJE2vULWdXXclrhKDNclridmCNSWsBkotWG0AmK7cWKY15NOt9/rL43fdAaN02WNHU06v8I4F2WGmoQCa0eDfkHjCgxJobAOwtKiG2QGUxw5V0OGdlwtf3TNnzsk5klu3KeJL9HrGRVk1s6zyEVmQKld5xbgJm5UUvJ6XEldlIRarISSUnHK+eLV8FgaFKTmzgFhpOuVixQMCPcY2pXic1nYpuvLVdtBELg1DdaXctM53usNDnr7H/e7h2+bhe2wp+wZe8kG7BU7ZO/ZERsy4X32vnjfvO/+V/+n/9v/swr1vSbnCWvZ1vZfuvoU1g==</latexit>Otter$hunter^¬group^nestspot^¬walks^fish^¬ground^¬meat^small^¬pads^¬grayExpert1Expert5(a)(b)<latexit sha1_base64="JruCzw7EXyL3EmxhiW6k88gKY7Y=">AAACd3icbVHLTttAFB27DyB9ENodXXRE2ohVZCNUukR0012p1ABSHEXXk2tnlPHYmrkuRJZ/oR/Hjv9g013HdtRS4EozOjrn3MfciQslLQXBjec/efrs+cbmVu/Fy1evt/s7b85sXhqBY5Gr3FzEYFFJjWOSpPCiMAhZrPA8Xn5p9POfaKzM9Q9aFTjNINUykQLIUbP+r4jwiqr2jpPqGxGauuaRwoSMTBcExuSXnA95Z4xLsSREWjQe0HMeRb1hpDHt5NTA6q/yr3I7ZxWrEusKDEnRtGgS7xgzBKpn/UEwCtrgD0G4BgO2jtNZ/zqa56LMUJNQYO0kDAqadk0U1r2otFiAWEKKEwc1ZGinVTtPzT86Zs6T3Lijibfs3YwKMmtXWeycGdDC3tca8jFtUlLyeVpJXZSEWnSNklJxynnzCXwuDQpSKwdAGOlm5WIBBoTbvu25JYT3n/wQnB2Mwk+jw++Hg+OT9To22Tu2x/ZZyI7YMfvKTtmYCXbr7XoD74P323/vD/39zup765y37L/wwz/l3cLE</latexit>Otter$buckteeth^¬gray^artic^meat<latexit sha1_base64="QMj5XgM8mSjdOQuU2k2NQDMfjLM=">AAACR3icbVBNTxsxEPUGWkJoS9oeuVhElThFuxUCjhG9cGuQmoCUTSOvM7ux4rVX9iwQrfbfceHKjb/AhQNVxRFnk0P4GGmspzdvPvyiTAqLvn/n1dbWP3zcqG82tj59/rLd/Pqtb3VuOPS4ltqcR8yCFAp6KFDCeWaApZGEs2j6a14/uwBjhVZ/cJbBMGWJErHgDB01av4NEa6wqN4oLn4jgilLGkqI0YhkgswYfUlpqCBZSC0arZK5hKkxXWmvjikimUNZMIOCuzmjZstv+1XQtyBYghZZRnfUvA3HmucpKOSSWTsI/AyHi3kSykaYW8gYn7IEBg4qloIdFtXqkv5wzJjG2rhUSCt2taNgqbWzNHLKlOHEvq7Nyfdqgxzjo2EhVJYjKL5YFOeSoqZzU+lYGOAoZw4wboS7lfIJM4w7N23DmRC8/vJb0P/ZDg7a+6f7rc7x0o462SG7ZI8E5JB0yAnpkh7h5Jrck0fyz7vxHrz/3tNCWvOWPd/Ji6h5z2ZVtcQ=</latexit>Otter$¬strong^articBaseline (CBM + E-LEN)Baseline (PCBM + E-LEN)<latexit sha1_base64="RmID97gJTf8fZaaRvCHDHVLb/b8=">AAACRXicbVC7TsMwFHV4U14FRhaLCsRUJQgBI4KFDZAoIDVV5bg3rYVjR/YNUEX5ORZ2Nv6AhQGEWMFNO/C6g3V0zn0cnyiVwqLvP3lj4xOTU9Mzs5W5+YXFperyyoXVmeHQ4FpqcxUxC1IoaKBACVepAZZEEi6j66OBfnkDxgqtzrGfQithXSViwRk6ql0NN0OEO8zLN4rzE0QwRUFDCTEa0e0hM0bf0mHXLRuoTtSGhgq632ZLK3kkMyhyZjgKXhTtas2v+2XRvyAYgRoZ1Wm7+hh2NM8SUMgls7YZ+Cm23D63TkJRCTMLKePXrAtNBxVLwLby8nRBNxzTobGzFmuFtGS/T+QssbafRK4zYdizv7UB+Z/WzDDeb+VCpRmC4sNDcSYpajqIlHaEAY6y7wDjRjivlPeYYdyFZSsuhOD3l/+Ci+16sFvfOdupHRyO4pgha2SdbJGA7JEDckxOSYNwck+eySt58x68F+/d+xi2jnmjmVXyo7zPLwDztiw=</latexit>Otter$water_¬arctic Tackling Shortcut Learning in Deep Neural Networks: An Iterative Approach with Interpretable Models Figure 6. Flexibility of FOL explanations by VIT-derived MoIE MoIE and the CBM + E-LEN and PCBM + E-LEN baselines for Awa2 dataset to classify "Horse" at inference. Both the baseline's FOL constitutes identical concepts to distinguish all the samples. However, expert4 classifies "Horse" with smelly as the identifying concept for the instances covered by it. Similarly, expert5 classifies the same "Horse" using longneck and fields. We highlight the shared concepts between the experts and the baselines as blue. <latexit sha1_base64="8nbc0QRHat6a9GDveLpN8MYlwv4=">AAACEHicbVBLTsMwFHTKr4RfgSUbixaJVZVUCFhWsGFZJPqR2qhyHKe16jiR/VJRRT0ELOEi7BBbbsA9OABumwW0jGRpNPOePR4/EVyD43xZhbX1jc2t4ra9s7u3f1A6PGrpOFWUNWksYtXxiWaCS9YEDoJ1EsVI5AvW9ke3M789ZkrzWD7AJGFeRAaSh5wSMFK70gti0JV+qexUnTnwKnFzUkY5Gv3St1mkacQkUEG07rpOAl5GFHAq2NTupZolhI7IgHUNlSRi2svmcaf4zCgBDmNljgQ8V39vZCTSehL5ZjIiMNTL3kz8z+umEF57GZdJCkzSxUNhKjDEePZ3HHDFKIiJIYQqbrJiOiSKUDAN/bkpGPNE56kfF7Ft2zY1uculrJJWrepeVi/ua+X6TV5YEZ2gU3SOXHSF6ugONVATUTRCT+gFvVrP1pv1bn0sRgtWvnOM/sD6/AEQ/J0F</latexit>...Expert4Expert5<latexit sha1_base64="8NiIRTA0zO27LEI+fEuhEfrxnx8=">AAACL3icbVDLSgMxFM34rPU16tJNsCiuyoyIuhQF6bKCVaEtJZPeaUMzkyG5o5Zh/siNv9KNiCJu/QvTsYv6uJBwOOdcTnKCRAqDnvfizMzOzS8slpbKyyura+vuxua1Uanm0OBKKn0bMANSxNBAgRJuEw0sCiTcBIPzsX5zB9oIFV/hMIF2xHqxCAVnaKmOe7HXQnjArLiDMKspbSDPaUtCiFr0+si0Vvd0ylWEZoFMIc9MBFIO87zjVryqVwz9C/wJqJDJ1DvuqNVVPI0gRi6ZMU3fS7CdMY2CS8jLrdRAwviA9aBpYcwiMO2siM7prmW6NFTanhhpwU5vZCwyZhgF1hkx7Jvf2pj8T2umGJ60MxEnKULMv4PCVFJUdFwe7QoNHOXQAsa1sG+lvM8042grLtsS/N9f/guuD6r+UfXw8rByejapo0S2yQ7ZJz45JqekRuqkQTh5JCPySt6cJ+fZeXc+vq0zzmRni/wY5/ML2tusqA==</latexit>Horse$smelly<latexit sha1_base64="sGHzzEWGc+O6FTtGBMx4UajoWH4=">AAACSXicbVA9b9swEKWctHWcfrjN2IWIkSCTIRVBmtFIl4wOEH8AluFS1EkmTJECeUpjCPp7Xbp163/o0qFFkam07CGxewCJh3fv4e5elEth0fd/eI29/WfPXzQPWocvX71+0377bmh1YTgMuJbajCNmQQoFAxQoYZwbYFkkYRQtPq36ozswVmh1i8scphlLlUgEZ+ioWfvzaYhwj2X9R0l5rY2FqqKhhASNSOfIjNFfaKggfaSsB5eRLKAqpVapAr6oXUzFdK1LBMjYVrN2x+/6ddFdEGxAh2yqP2t/D2PNiwwUcsmsnQR+jtOSGRRcQtUKCws54wuWwsRBxTKw07JeqKInjolpoo17CmnNPnaULLN2mUVOmTGc2+3eivxfb1JgcjkthcoLBMXXg5JCUtR0FSuNhQGOcukA40a4XSmfM8M4uvBbLoRg++RdMPzQDS665zfnnd7VJo4meU+OyRkJyEfSI9ekTwaEk6/kJ/lN/njfvF/eX+9hLW14G88ReVKNvX9rYbbJ</latexit>Horse$¬longneck^fieldsBaseline (PCBM + E-LEN)<latexit sha1_base64="F5eVORehr4T3YdsMLa2LpMX2pes=">AAADDXicjVJNb9NAEF2bAiV8pfTIZUUEKpfIRlXhWJVLj61E2kpxFO1uxs4q611rd1yILP8BLv0rXDhQVb32zo1/w9oJUttUqHNYPb1583ZmNLxQ0mEU/QnCB2sPHz1ef9J5+uz5i5fdjVdHzpRWwEAYZewJZw6U1DBAiQpOCgss5wqO+exzkz8+Beuk0V9wXsAoZ5mWqRQMPTXeCHrvEoRvWLUvT6t9Yx3UNU0UpGhlNkVmrflKEy6zLbrQ8lLMEACnjYzpCb1m0bZUcVVCXSmjMw1i1tj58vdebezC6R4V/3N2OSg1r+u7bRsXBdk9Pf6pNGQr87X+nXG3F/WjNugqiJegR5ZxMO7+TiZGlDloFIo5N4yjAkcVsyiFgrqTlA4KJmYsg6GHmuXgRlXbXE3femZCUz9SajTSlr1eUbHcuXnOvTJnOHW3cw15V25YYvppVEldlAhaLD5KS0XR0OY06ERaEKjmHjBhpe+ViimzTKA/oGYJ8e2RV8HRh368098+3O7t7i3XsU5ekzdki8TkI9kl++SADIgIvgc/gl/BeXgW/gwvwsuFNAyWNZvkRoRXfwHOcgIu</latexit>Horse$buckteeth^longneck_longneck^smelly_longleg^smelly^¬buckteeth<latexit sha1_base64="TaB2lj0f0aXk7rLp7pfWLOzM2P0=">AAAOZ3ictVdbb9NIFDYsl25o0nIRQuLFUIHgpUpQBfuIlhceQaKA1FTV8fjYHjKeMXOpyUb5k/u277zwL3acRjR2TlqHFktJRt+Zy/lmzveNExWCG9vv/3fl6h/Xrt+4ufFn59Zmt7e1ffvOR6OcZrjPlFD6cwQGBZe4b7kV+LnQCHkk8FM0elPFPx2jNlzJD3Zc4GEOqeQJZ2A9dHR7c/p0aPGbncy+o2TyVmmD02k4FJhYzdPMgtaqDIcRT5+ddI0cG1lEm1W9QMbhwgyzjCaRcDidCCVTiWw0DafV6Oe+t9LziSSmqyb7GWo74bDzNBx+/eog/vlzbrKRE5Fypg6mGsZ1pFpRYNqe6BKJRGlIUS8HjBLc7+2YiBTKmgsz/B1kmrt2cZZhgybFchme/8zmAWb5MTZPl9wSlmFJwJlSx2iamJYNSCDIy9lQiukipdwZJhqUlIhLpUVcRwuwnpQ5JwOToxDjhQOddbPARQPhOW8sYJVLMzPicvEAV2hoFan6GJMRUxH1cxpBY4lArb5P4Qy4FmgMEeKyUSunoRzB1iujDZlcOel3UVKLSZ91VeJEqICSGmFyEILCCQmFdQ3R/nD5suKNWo8EVHV9rrGuEF7itG54lD/VfxbqYI75fY7PPZm1xLxUCxdzyPayPTt7Us9VXEOBMTT0aoQqf0n6xmrPYT07ODvxZZ+YwSWIUYNNmXFLSRBS7uucqnLQ/qgYaUDEuwNlNCtzP+3PBK1KpsBYoHSZAOlLCUf/akYGaOsTvCj8G1oLV2xB4xLtMuMRagnkYWXe+Ei7/uIqBa2Tce1arTtyK6O+sB1LxazzRMU6WStGp11ATC2/ruXnoKlUW1wFrRl4D+AFklmVPKdw66REQUVKoKuhRBidcT11OkfbO/3d/uwJlxuDeWMnmD/vjrb/HcaKuRyl9Yo15mDQL+yhtwjvEL7uOkNnsPCXktfNgW9KyNEcTmaOOA2feCQOvUT8R9pwhi6OmEBuzDiPfM8cbGaasQqkYgfOJn8d+julcBYlO1kocSK0Kqz+dIUx18isGPsGMM19riHLQPsryAu/2oRBk/Jy4+OL3cHL3b33ezuv/55vx0bwMHgcPAsGwavgdfA2eBfsB2zze7fTvdu91/3R2+rd7z046Xr1ynzM3aD29B79D5G1UwM=</latexit>Horse$buckteeth^longneck_¬buckteeth^¬longneck_buckteeth^bulbous^gray^longleg^longneck^¬forager^¬solitary^¬spots_buckteeth^gray^longleg^longneck^¬bulbous^¬forager^¬solitary^¬spots_active^buckteeth^chewteeth^hooves^horns^lean^longleg^longneck^muscle^oldworld^patches^smelly^tail^timid^toughskin^¬bulbous^¬bush^¬forager^¬forest^¬gray^¬hairless^¬inactive^¬meatteeth^¬mountains^¬nestspot^¬paws^¬small^¬solitary^¬spots_active^big^black^bulbous^chewteeth^furry^grazer^ground^hooves^horns^inactive^longleg^longneck^muscle^oldworld^patches^quadrapedal^slow^smelly^strong^tail^timid^toughskin^walks^white^¬agility^¬arctic^¬buckteeth^¬bush^¬claws^¬coastal^¬fast^¬fierce^¬fish^¬flippers^¬forager^¬forest^¬gray^¬hairless^¬hibernate^¬hunter^¬jungle^¬lean^¬meat^¬meatteeth^¬mountains^¬nestspot^¬nocturnal^¬ocean^¬pads^¬paws^¬small^¬smart^¬solitary^¬spots^¬stripes^¬swims^¬tunnels^¬water^¬weakBaseline (CBM + E-LEN) Tackling Shortcut Learning in Deep Neural Networks: An Iterative Approach with Interpretable Models Figure 7. The performance of experts and residuals across iterations. (a-c) Coverage and proportional accuracy of the experts and residuals. (d-f) We route the samples covered by the residuals across iterations to the initial Blackbox f 0 and compare the accuracy of f 0 (red bar) with the residual (blue bar). Figures d-f show the progressive decline in performance of the residuals across iterations as they cover the samples in the increasing order of "hardness". We observe the similar abysmal performance of the initial blackbox f 0 for these samples. (a)(b)(c)(d)(e)(f) Tackling Shortcut Learning in Deep Neural Networks: An Iterative Approach with Interpretable Models Figure 8. The performances of experts and residuals across iterations for ResNet derived MoIE for CUB-200 and Awa2. (a-b) Coverage and proportional accuracy of the experts and residuals. (c-d) We route the samples covered by the residuals across iterations to the initial Blackbox f 0 and compare the accuracy of f 0 (red bar) with the residual (blue bar). (a)(b)(c)(d)
http://arxiv.org/abs/2302.10261v2
2023-02-28T18:50:45
2023-02-20T19:47:25
Deep Reinforcement Learning for Cost-Effective Medical Diagnosis
Dynamic diagnosis is desirable when medical tests are costly or time-consuming. In this work, we use reinforcement learning (RL) to find a dynamic policy that selects lab test panels sequentially based on previous observations, ensuring accurate testing at a low cost. Clinical diagnostic data are often highly imbalanced; therefore, we aim to maximize the $F_1$ score instead of the error rate. However, optimizing the non-concave $F_1$ score is not a classic RL problem, thus invalidates standard RL methods. To remedy this issue, we develop a reward shaping approach, leveraging properties of the $F_1$ score and duality of policy optimization, to provably find the set of all Pareto-optimal policies for budget-constrained $F_1$ score maximization. To handle the combinatorially complex state space, we propose a Semi-Model-based Deep Diagnosis Policy Optimization (SM-DDPO) framework that is compatible with end-to-end training and online learning. SM-DDPO is tested on diverse clinical tasks: ferritin abnormality detection, sepsis mortality prediction, and acute kidney injury diagnosis. Experiments with real-world data validate that SM-DDPO trains efficiently and identifies all Pareto-front solutions. Across all tasks, SM-DDPO is able to achieve state-of-the-art diagnosis accuracy (in some cases higher than conventional methods) with up to $85\%$ reduction in testing cost. The code is available at [https://github.com/Zheng321/Deep-Reinforcement-Learning-for-Cost-Effective-Medical-Diagnosis].
[ "Zheng Yu", "Yikuan Li", "Joseph Kim", "Kaixuan Huang", "Yuan Luo", "Mengdi Wang" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10261v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10261v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI" ]
3 2 0 2 b e F 8 2 ] G L . s c [ 2 v 1 6 2 0 1 . 2 0 3 2 : v i X r a Published as a conference paper at ICLR 2023 DEEP REINFORCEMENT LEARNING FOR COST-EFFECTIVE MEDICAL DIAGNOSIS Zheng Yu∗ Princeton University Yikuan Li∗ Northwestern University Joseph C. Kim∗ Princeton University Kaixuan Huang∗ Princeton University Yuan Luo† Northwestern University Mengdi Wang† Princeton University ABSTRACT Dynamic diagnosis is desirable when medical tests are costly or time-consuming. In this work, we use reinforcement learning (RL) to find a dynamic policy that selects lab test panels sequentially based on previous observations, ensuring accurate testing at a low cost. Clinical diagnostic data are often highly imbalanced; therefore, we aim to maximize the F1 score instead of the error rate. However, optimizing the non-concave F1 score is not a classic RL problem, thus invalidates standard RL methods. To remedy this issue, we develop a reward shaping approach, leveraging properties of the F1 score and duality of policy optimization, to provably find the set of all Pareto-optimal policies for budget-constrained F1 score maximization. To handle the combinatorially complex state space, we propose a Semi-Model-based Deep Diagnosis Policy Optimization (SM-DDPO) framework that is compatible with end-to-end training and online learning. SM-DDPO is tested on diverse clinical tasks: ferritin abnormality detection, sepsis mortality prediction, and acute kidney injury diagnosis. Experiments with real-world data validate that SM-DDPO trains efficiently and identifies all Pareto-front solutions. Across all tasks, SM- DDPO is able to achieve state-of-the-art diagnosis accuracy (in some cases higher than conventional methods) with up to 85% reduction in testing cost. Core codes are available on GitHub1. 1 INTRODUCTION In clinical practice, physicians usually order multiple panels of lab tests on patients and their inter- pretations depend on medical knowledge and clinical experience. Each test panel is associated with certain financial cost. For lab tests within the same panel, automated instruments will simultaneously provide all tests, and eliminating a single lab test without eliminating the entire panel may only lead to a small reduction in laboratory cost (Huck & Lewandrowski, 2014). On the other hand, concurrent lab tests have been shown to exhibit significant correlation with each other, which can be utilized to estimate unmeasured test results (Luo et al., 2016). Thus, utilizing the information redundancy among lab tests can be a promising way of optimizing which test panel to order when balancing comprehensiveness and cost-effectiveness. The efficacy of the lab test panel optimization can be evaluated by assessing the predictive power of optimized test panels on supporting diagnosis and predicting patient outcomes. We investigate the use of reinforcement learning (RL) for lab test panel optimization. Our goal is to dynamically prescribe test panels based on available observations, in order to maximize diagno- sis/prediction accuracy while keeping testing at a low cost. It is quite natural that sequential test panel selection for prediction/classification can be modeled as a Markov decision process (MDP). ∗Co-first authors. †Co-senior authors. Contact information: Z. Yu, J. Kim, K. Huang and M. Wang:{zhengy, josephck, kaixuanh, mengdiw}@princeton.edu; Y. Li and Y. Luo:{yikuan.li, yuan.luo}@northwestern.edu 1https://github.com/Zheng321/Deep-Reinforcement-Learning-for-Cost-Effective-Medical-Diagnosis 1 Published as a conference paper at ICLR 2023 However, application of reinforcement learning (RL) to this problem is nontrivial for practical considerations. One practical challenge is that clinical diagnostic data are often highly imbalanced, in some cases with <5% positive cases (Khushi et al., 2021; Li et al., 2010; Rahman & Davis, 2013). In supervised learning, this problem is typically addressed by optimizing towards accuracy metrics suitable for unbalanced data. The most prominent metric used by clinicians is the F1 score, i.e., the harmonic mean of a prediction model's recall and precision, which balances type I and type II errors in a single metric. However, the F1 score is not a simple weighted error rate - this makes designing the reward function hard for RL. Another challenge is that, for cost-sensitive diagnostics, one hopes to view this as a multi-objective optimization problem and fully characterize the cost-accuracy tradeoff, rather than finding an ad-hoc solution on the tradeoff curve. In this work, we aim to provide a tractable algorithmic framework, which provably identifies the set of all Pareto-front policies and trains efficiently. Our main contributions are summarized as follows: • We formulate cost-sensitive diagnostics as a multi-objective policy optimization problem. The goal is to find all optimal policies on the Pareto front of the cost-accuracy tradeoff. • To handle severely imbalanced clinical data, we focus on maximizing the F1 score directly. Note that F1 score is a nonlinear, nonconvex function of true positive and true negative rates. It cannot be formulated as a simple sum of cumulative rewards, thus invalidating standard RL solutions. We leverage monotonicity and hidden minimax duality of the optimization problem, showing that the Pareto set can be achieved via a reward shaping approach. • We propose a Semi-Model-based Deep Diagnostic Policy Optimization (SM-DDPO) method for learning the Pareto solution set from clinical data. Its architecture comprises three modules and can be trained efficiently by combing pretraining, policy update, and model-based RL. • We apply our approach to real-world clinical datasets. Experiments show that our approach exhibits good accuracy-cost trade-off on all tasks compared with baselines. Across the experiments, our method achieves state-of-the-art accuracy with up to 80% reduction in cost. Further, SM-DDPO is able to compute the set of optimal policies corresponding to the entire Pareto front. We also demonstrate that SM-DDPO applies not only to the F1 score but also to alternatives such as the AM score. 2 RELATED WORK Reinforcement learning (RL) has been applied in multiple clinical care settings to learn optimal treatment strategies for sepsis Komorowski et al. (2018), to customize antiepilepsy drugs for seizure control Guez et al. (2008) etc. See survey Yu et al. (2021) for more comprehensive summary. Guidelines on using RL for optimizing treatments in healthcare has also been proposed around the topics of variable availability, sample size for policy evaluation, and how to ensure learned policy works prospectively as intended Gottesman et al. (2019). However, using RL for simultaneously reducing the healthcare cost and improving patient's outcomes has been underexplored. Our problem of cost-sensitive dynamic diagnosis/prediction is closely related to feature selection in supervised learning. The original static feature selection methods, where there exists a common subset of features selected for all inputs, were extensively discussed Guyon & Elisseeff (2003); Kohavi & John (1997); Bi et al. (2003); Weston et al. (2003; 2000). Dynamic feature selection methods He et al. (2012); Contardo et al. (2016); Karayev et al. (2013), were then proposed to take the difference between inputs into account. Different subsets of features are selected with respect to different inputs. By defining certain information value of the features Fahy & Yang (2019); Bilgic & Getoor (2007), or estimating the gain of acquiring a new feature would yield Chai et al. (2004). Reinforcement learning based approaches Ji & Carin (2007); Trapeznikov & Saligrama (2013); Janisch et al. (2019); Yin et al. (2020); Li & Oliva (2021); Nam et al. (2021) are also proposed to dynamically select features for prediction/classification. We give a more detailed discussion in Appendix A. 3 PARETO-FRONT PROBLEM FORMULATION 3.1 MARKOV DECISION PROCESS (MDP) MODEL We model the dynamic diagnosis/prediction process for a new patient as an episodic Markov decision process (MDP) M = (S, A, P, R, γ, ξ). As illustrated in Figure 1, the state of a patient is described by s = x (cid:12) M , where x ∈ Rd denotes d medical tests of a patient, M ∈ {0, 1}d is a binary mask 2 Published as a conference paper at ICLR 2023 indicating whether the entries of x are observed or missing. Let there be D test panels, whose union is the set of all d tests. The action set A = {1, 2, * * * , D} (cid:116) {P, N} contains two sets of actions – observation actions and prediction/diagnosis actions. At each stage, one can either pick an action a ∈ {1, 2, * * * , D} from any one of the available panels, indicating choosing a test panel a to observe, which will incur a corresponding observation cost c(a); Or one can terminate the episode by directly picking a prediction action a ∈ {P, N}, indicating diagnosing the patient as positive class (P) or negative class (N). A penalty will generated if the diagnosis does not match the ground truth y. An example of this process in sepsis mortality prediction is illustrated in Figure 1. We considers the initial distribution ξ to be patients with only demographics panel observed and discount factor γ = 1. Figure 1: MDP model of dynamic diagnosis: illustration of state-action transitions in one episode. 3.2 MULTI-OBJECTIVE POLICY OPTIMIZATION FORMULATION Let π : S → A be the overall policy, a map from the set of states to the set of actions. We optimize π towards two objectives: • Maximizing prediction accuracy. Due to severely imbalanced data, we choose to maximize the F1 score2, denoted by F1(π), as a function of policy π. F1 score measures the performance of the diagnosis by considering both type I and type II errors, which is defined as: F1(π) = TP(π) + 1 TP(π) 2 (FP(π) + FN(π)) = 2TP(π) 1 + TP(π) − TN(π) where TP(π), TN(π), FP(π), FN(π) are normalized true positive, true negative, false positive and false negative that sum up to 1. Remark that TP(π), TN(π), FP(π), FN(π) can all be expressed as sum of rewards/costs over the MDP's state trajectories. However, F1(π) is nonlinear with respect to the MDP's state-action occupancy measure, thus it cannot be expressed as any cumulative sum of rewards. • Lowering cost. Define the testing cost by Cost(π) = Eπ[(cid:80) t≥0 Eπ denotes expectation under policy π, c(k) is the cost of panel k. In this work, we hope to solve for cost-sensitive policies for all possible testing budget. In other words, we aim to find the cost-sensitive Pareto front as follows. k∈[D] c(k) * 1{at = k}], where (cid:80) Definition 3.1 (Cost-F1 Pareto Front of Multi-Objective Policy Optimization). The Pareto front Π∗ for cost-sensitive dynamic diagnosis/prediction is the set of policies such that Π∗ = ∪B>0 argmax π {F1(π) subject to Cost(π) ≤ B} (1) Finding Π∗ requires novel solutions beyond standard RL methods. Challenges are two-folded: (1) Even in the single-objective case, F1(π) is a nonlinear, non-concave function of TP(π), TN(π). Although both TP(π), TN(π) can be formulated as expected sum of rewards in the MDP, the F1 score is never a simple sum of rewards. Standard RL methods do not apply to maximizing such a function. (2) We care about finding the set of all Pareto-optimal policies when there are two conflicting objectives, rather than an ad hoc point on the trade-off curve. 2An alternative to the F1 score is the AM metric that measures the average of true positive rate and true negative rate for imbalanced data Natarajan et al. (2018); Menon et al. (2013). Our approach directly applies to such linear metric. Please refer to Appendix F for details. 3 Published as a conference paper at ICLR 2023 4 FINDING COST-F1 PARETO FRONT VIA REWARD SHAPING The F1 score is a nonlinear and nonconvex function of true positive, true negative, false positive, false negative rates. It cannot be expressed by sum of rewards. This invalidates all existing RL methods even in the unconstrained case, creating tremendous challenges. Despite the non-concavity and nonlinearity of F1, we will leverage the mathematical nature of Markov decision process and properties of the F1 score to solve problem (1). In this section, we provide an optimization duality analysis and show how to find solutions to problem (1) via reward shaping and solving a reshaped cumulative-reward MDP. Step 1: utilizing monotonicity of F1 score To start with, we note that F1 score is monotonically increasing in both TP and TN. Assume, for any given cost budget B, the optimal policy π∗(B) achieves the highest F1 score. Then π∗(B) is also optimal to the following program: {TN(π) subject to Cost(π) ≤ B, TP(π) ≥ TP(π∗(B))} , max π indicating the Pareto front of F1 score is a subset of Π∗ ⊆ ∪B>0,K∈[0,1] argmax π {TN(π) subject to Cost(π) ≤ B, TP(π) ≥ K} . (2) Step 2: reformulation using occupancy measures Fix any specific pair (B, B(cid:48)). Consider the equivalent dual linear program form Zhang et al. (2020) of the above policy optimization problem (2). It is in terms of the cumulative state-action occupancy measure μ : ∆S , defined as: μπ(s, a) := Eπ (cid:104)(cid:80) , ∀s ∈ S, a ∈ A. Then the program (2) is equivalent to: (cid:105) t≥0 1(st = s, at = a) A → RS×A ≥0 max μ TN(μ) subject to Cost(μ) ≤ B, TP(μ) ≥ K, (cid:88) a μ(s, a) = (cid:88) μ(s(cid:48), a(cid:48))P (s|s(cid:48), a(cid:48)) + ξ(s), ∀s s(cid:48),a(cid:48)∈[D] where ξ(*) denotes initial distribution, and TP, TN and cost are reloaded in terms of occupancy μ as: TP(μ) = (cid:88) μ(s, a), TN(μ) = y=P,a=P (cid:88) y=N,a=N μ(s, a), Cost(μ) = (cid:88) c(k) * (cid:88) μ(s, a). k∈[D] s,a=k Step 3: utilizing hidden minimax duality The above program can be equivalently reformulated as a max-min program: max μ min λ≥0,ρ≤0 subject to TN(μ) + λ * (TP(μ) − K) + ρ * (Cost(μ) − B) (cid:88) a μ(s, a) = (cid:88) μ(s(cid:48), a(cid:48))P (s|s(cid:48), a(cid:48)) + ξ(s), ∀s. s(cid:48),a(cid:48)∈[D] Note the max-min objective is linear in terms of λ, ρ and μ. Thus, minimax duality holds, then we can swap the min and max to obtain the equivalent form: min λ≥0,ρ≤0 max μ subject to TN(μ) + λ * (TP(μ) − K) + ρ * (Cost(μ) − B) (cid:88) a μ(s, a) = (cid:88) μ(s(cid:48), a(cid:48))P (s|s(cid:48), a(cid:48)) + ξ(s), ∀s. s(cid:48),a(cid:48)∈[D] For any fixed pair of (λ, ρ), the inner maximization problem of the above can be rewritten equivalently into an unconstrained policy optimization problem: maxπ TN(π) + λ * TP(π) + ρ * Cost(π). This is finally a standard cumulative-sum MDP problem, with reshaped reward: reward ρ * c(t) for the action of choosing test panel t, reward λ for the diagnosis action and get a true positive, reward 1 for getting a true negative. Putting together three steps, we can show the following theorem. The full proof can be found in Appendix E. Theorem 4.1. The Cost-F1 Pareto front defined in (1) is a subset of the collection of all reward- shaped solutions, given by Π∗ ⊆ Π := ∪λ≥0,ρ≤0 argmax π {TN(π) + λ * TP(π) + ρ * Cost(π)} . Thus, to learn the full Pareto front, it suffices to solve a collection of unconstrained policy optimization problems with reshaped cumulative rewards. 4 Published as a conference paper at ICLR 2023 5 METHOD In this section, we propose a deep reinforcement learning pipeline for Pareto-optimal dynamic diagnosis policies. We use a modular architecture for efficient encoding of partially-observed patient information, policy optimization and reward learning. 5.1 ARCHITECTURE Our Semi-Model-based Deep Diagnostic Policy Optimization (SM-DDPO) framework is illustrated in Figure 2. The complete dynamic testing policy π comprises three models: (1) a posterior state encoder for mapping partially-observed patient information to an embedding vector; (2) a state-to- diagnosis/prediction classifier which can be reviewed as a reward function approximator; (3) a test panel selector that outputs an action based on the encoded state. This modular architecture makes RL tractable via a combination of pre-training, policy update and model-based RL. Figure 2: Dynamic diagnostic policy learning via semi-model-based proximal policy optimization. The full policy π comprises of three modules: posterior state encoder, classifier, and panel selector. 5.2 POSTERIOR STATE ENCODER We borrowed the idea of imputation to map the partially observed patient information to a posterior embedding vector. In this work, we consider a flow-based deep imputer named EMFlow3. Given the imputer Impθ(*) parameterized by θ, the RL agent observes tests x(cid:12)M and calculates Impθ(x(cid:12)M ) ∈ Rd as a posterior state encoder. Unlike conventional imputation Lin & Tsai (2020); Austin et al. (2021); Osman et al. (2018), our posterior state encoder aims at resolving exponentially many possible missing patterns. Therefore, we pretrain it on unlabeled augmented data, constructed by repeatedly and randomly masking entries as additional samples. 5.3 END-TO-END TRAINING VIA SEMI-MODEL-BASED POLICY UPDATE Training the overall policy using a standard RL algorithm alone (such as Q learning, or policy gradient) would suffer from the complex state and action spaces. To ease the heavy training, we design a semi-model-based modular approach to train the panel selector and classifier concurrently but in different manners: • The classifier fφ(*) : Rd → R2, parameterized by φ, maps the posterior encoded state Impθ(x(cid:12)M ) to a probability distribution over labels. It is trained by directly minimizing the cross entropy loss (cid:96)c from collected data4. This differs from typical classification in that the data are collected adaptively by RL, rather than sampled from a prefixed source. • The panel selector, a network module parameterized by ψ, takes the following as input θ,φ (s) = semb semb θ,φ (x (cid:12) M ) = (Impθ(x (cid:12) M ), fφ(Impθ(x (cid:12) M )), M ), (3) 3The EMFlow imputation method is originally proposed in Ma & Ghosh (2021) that maps the data space to a Gaussian latent space via normalizing flows. We give a more detailed discussion of this method in Appendix C. 4The forms of the training objective (cid:96)c and (cid:96)rl of classifier and panel selector are given in Appendix D 5 Published as a conference paper at ICLR 2023 and maps it to a probability distribution over actions. We train the panel selector by using the classical proximal policy updates (PPO) Schulman et al. (2017), which aims at maximizing a clipped surrogate objective regularized by a square-error loss of the value functions and an entropy bonus. We denote this loss function as (cid:96)rl and relegate its expanded form to Appendix D. • The full algorithm updates panel selector and classifier concurrently, given in Algorithm 1 and visualized in Figure 2. We call it "semi-model-based" because it maintains a running estimate of the classifier (which is a part of the reward model of the MDP) while making proximal policy update. Algorithm 1 Semi-Model-Based Deep Diagnosis Policy Optimization (SM-DDPO) Impθ, Classifier fφ(0,0), Panel/Prediction Selection Policy πψ(0,0) , number of loops Initialize: L, L1, L2, stepsize η; for i = 0, 1, * * * , L do Construct RL environment using state embedding semb for j = 1, 2, * * * , L1 do θ,φ(i,0) defined in (3) Run RL policy in environment for T timesteps and save observations in Q Update panel selection policy by ψ(i,j) = argmaxψ (cid:96)rl(ψ; ψ(i,j−1)) (cid:46) Policy update inner loop (cid:46) End-to-end training outer loop end for Set ψ(i+1,0) = ψ(i,L1) for j = 1, 2, * * * , L2 do Sample minibatch Bj from Q Update classifier by φi,j = φi,j−1 − η * ∇φ end for Set φ(i+1,0) = φ(i,L2) end for Output: Classifier fφ(L+1,0) , Policy πψ(L+1,0). (cid:46) Classifier update inner loop 1 |Bj | (cid:80) k∈Bj (cid:96)c(φi−1; (xk, Mk)) Such a hybrid RL technique of model learning and policy updates has been used for solving complex games, where a notable example is Deepmind's Muzero Schrittwieser et al. (2020). Further, we remark that Algorithm 1 does end-to-end training. Thus, it is compatible with on-the-fly learning. The algorithm can start with as little as zero knowledge about the prediction task, and it can keep improving on new incoming patients by querying test panels and finetuning the state encoder. 6 EXPERIMENTS We test the method on three clinical tasks using real-world datasets. See Table 1 for a summary. We split each dataset into 3 parts: training set, validation set, and test set. Training data is further split into two disjoint sets, one for pretraining the state encoder and the other one for end-to-end RL training. Validation set is used for tuning hyperparameters 5. During RL training6, we sample a random patient and a random subset of test results as initial observations at the beginning of an episode, for sufficient exploration. We evaluate the trained RL policy on patients from the test sets, initialized at a state with zero observed test result, and report F1 score and AUROC. Table 1: Summary statistics of ferritin, AKI and sepsis datasets Dataset # of tests # test panels # patients % positive class #training #validation #held-out testing Ferritin AKI Sepsis 39 19 28 6 4 4 43,472 23,950 5,783 8.9% 16.5% 14.5% 32,602 17,964 4,335 6,522 3,600 869 4,248 2,386 579 6.1 CLINICAL TASKS We briefly describe three clinical tasks for our experiments. We refer to Appendix B for more details. Ferritin abnormality detection Blood ferritin level can indicate abnormal iron storage, which is commonly used to diagnose iron deficiency anemia Short & Domagalski (2013) or hemochromatosis 5Detailed data splitting, hyperparameter choices and searching ranges are presented in Appendix B. 6Our codes used the implementation of PPO algorithm in package Raffin et al. (2021). 6 Published as a conference paper at ICLR 2023 (iron overload) Crownover & Covey (2013). Machine learning models can predict abnormal ferritin levels using concurrent laboratory measurements routinely collected in primary care Luo et al. (2016); Kurstjens et al. (2022). These predictive models achieve promising results, e.g. around 0.90 AUC using complete blood count and C-reactive protein Kurstjens et al. (2022), and around 0.91 AUC using common lab tests Luo et al. (2016). However, both studies required the full observation of all selected predictors without taking the financial costs into consideration. We applied our proposed models to a ferritin dataset from a tertiary care hospital (approved by Institutional Review Board), following the steps described in Luo et al. (2016). Our dataset includes 43,472 patients, of whom 8.9% had ferritin levels below the reference range that should be considered abnormal. We expected to predict abnormal ferritin results using concurrent lab testing results and demographic information. These lab tests were ordered through and can be dynamically selected from 6 lab test panels, including basic metabolic panel (BMP, n=9, [estimated national average] cost=$36), comprehensive metabolic panel (CMP, n=16, cost=$48), basic blood count (BBC, n=10, cost=$26), complete blood count (CBC, n=20, cost=$44), transferrin saturation (TSAT, n=2, cost=$40) and Vitamin B-12 test (n=1, cost=$66). Acute Kidney Injury Prediction Acute kidney injury (AKI) is commonly encountered in adults in the intensive care unit (ICU), and patients with AKI are at risk for adverse clinical outcomes such as prolonged ICU stays and hospitalization, need for renal replacement therapy, and increased mortality Kellum & Lameire (2013). AKI usually occurs over the course of a few hours to days and the efficacy of intervention greatly relies on the early identification of deterioration Kellum & Lameire (2013). Prior risk prediction models for AKI based on EHR data yielded modest performance, e.g., around 0.75 AUC using a limited set of biomarkers Perazella (2015) or a specific group of patients Sanchez-Pinto & Khemani (2016), or around 0.8 AUC using comprehensive lab panels of general adult ICU populations such as from the MIMIC datasetZimmerman et al. (2019); Sun et al. (2019). In this experiment, we followed steps in Zimmerman et al. (2019) to extract 23,950 ICU visits of 19,811 patients from the MIMIC-III dataset Johnson et al. (2016), among which 16.5% patients develop AKI during their ICU stay. We aimed at predicting the AKI onset within 72 hours of ICU admission using a total of 31 features including demographics, physiologic measurements, and lab testing results extracted within 24 hours of ICU admission. The lab tests were categorized into 4 panels, i.e. CBC (n=3, cost=$44), CMP (n=8, cost=$48), the arterial blood gas panel (ABG, n=2, cost=$473) and the activated partial thromboplastin time panel (APTT, n=6, cost=$26). The demographic information and physiologic measurements were collected before test panel selection, thus they are considered visible. Sepsis Mortality Prediction for ICU Patients Sepsis is a life-threatening organ dysfunction, and is a leading cause of death and cost overruns in ICU patients Angus & Van der Poll (2013) Early identification of risk of mortality in septic patients is important to evaluate the patients' status and improve their clinical outcomes Moreno et al. (2008). Most of the previous sepsis mortality prediction models use all available test results as predictors, without balancing the cost of ordering all the associated test panels Lee et al. (2020); Ding & Luo (2021); Shin et al. (2021); Moreno et al. (2008). We followed steps in Shin et al. (2021) to collect 5,783 septic patients from the MIMIC-III dataset Johnson et al. (2016) according to the Sepsis-3 criteria Singer et al. (2016). The in-hospital mortality rate of this cohort is 14.5%. We focused on predicting in-hospital mortality for these sepsis patients using demographics information, medical histories, mechanical ventilation status, the first present lab testing results and physiologic measurements within 24 hours of ICU admission, and the Sequential Organ Failure Assessment (SOFA) score. Similarly to the setup in the AKI experiment, the lab tests were also categorized into 4 panels of CBC (n=5), CMBP (n=15), ABG (n=6) and APTT (n=2). The components of SOFA score may be based on the lab testing results in CBC, CMP or ABG panels Singer et al. (2016). Demographic features are considered visible. 6.2 PERFORMANCE RESULTS Our method is tested with comparison to a number of baselines that use either full/partial test results or statically/dynamically selected tests for prediction. They include logistic regression, random forest Ho (1995), XGBoost Chen & Guestrin (2016), LightGBM Ke et al. (2017), a 3-layer multi-layer perceptron, as well as RL-based approach Janisch et al. (2019). Experiments results, such as F1 score, AUROC and testing costs are reported in Table 2. We emphasize that these baselines are incapable to handle the task of finding the Pareto front. Thus, we only test them under no budget constraints. 7 Published as a conference paper at ICLR 2023 Table 2: Model performance, measured by F1 score, area under ROC (AUC), and testing cost, for three real-world clinical datasets. The tested models include logistic regression (LR), random forests (RF), gradient boosted regression trees (XGBoost Chen & Guestrin (2016) and LightGBM Ke et al. (2017) ), 3-layer multi-layer perceptron, Q-learning for classification with costly features (CWCF)Janisch et al. (2019), Random Selection (RS), Fixed Selection (FS). All models were fine-tuned to maximize the F1 score. The model yielded the highest F1 score is in bold. The model required the least testing cost is underlined. More detailed results of this table with more dynamic baselines and standard deviations reported in Appendix B. Models Ferritin Metrics F1 AUC Cost LR RF XGBoost LightGBM 3-layer DNN LR (2 panels) RF (2 panels) XGBoost (2 panels) LightGBM (2 panels) FS RS CWCF SM-DDPOpretrained SM-DDPOend2end 0.539 0.605 0.617 0.627 0.616 0.401 0.504 0.519 0.571 0.585 0.437 0.554 0.607 0.624 0.935 0.938 0.938 0.941 0.938 0.859 0.887 0.895 0.901 0.927 0.845 0.718 0.925 0.928 $290 $290 $290 $290 $290 $92 $92 $92 $92 $74 $145 $256 $80 $62 AKI AUC 0.797 0.764 0.785 0.790 0.802 0.797 0.768 0.781 0.792 0.787 0.748 0.510 0.789 0.795 Cost $591 $591 $591 $591 $591 $92 $92 $92 $92 $98 $295 $326 $90 $97 F1 0.452 0.439 0.404 0.474 0.494 0.473 0.425 0.410 0.491 0.434 0.424 0.283 0.519 0.495 Sepsis Test Selection F1 0.506 0.456 0.431 0.500 0.517 0.488 0.478 0.459 0.502 0.500 0.473 0.112 0.567 0.562 AUC Cost 0.825 0.801 0.828 0.844 0.845 0.811 0.828 0.877 0.864 0.837 0.789 0.503 0.836 0.845 $591 $591 $591 $591 $591 $92 $92 $92 $92 $90 $295 $301 $85 $90 Strategy Full Full Full Full Full Fixed Fixed Fixed Fixed Fixed Random Dynamic Dynamic Dynamic • Comparisons with baseline models using full observation of data. The results are presented in Table 2. Across all three clinical tasks, our proposed model can achieve comparable or even state-of-the-art performance, while significantly reducing the financial cost. On sepsis dataset, SM-DDPOend2end yielded better results (F1=0.562, AUROC=0.845) than the strongest baseline mod- els, LightGBM (F1=0.517, AUROC=0.845), when saving up to 84% in test cost. On ferritin dataset, LightGBM (F1=0.627, AUROC=0.948) performed slightly better than our model (F1=0.624, AU- ROC=0.928), however, by using 5x testing cost. On AKI dataset, SM-DDPOend2end (F1=0.495, AUROC=0.795) achieved comparable results to the optimal full observation model, 3-layer MLP (F1=0.494, AUROC=0.802), while saving the testing cost from $591 to $90. • Comparisons with other test selection strategies. Our proposed SM-DDPOend2end, using RL- inspired dynamic selection strategy, consistently yielded better performance and required less testing cost across all three datasets, when compared to the models using fixed or random selection strategy. For fixed test selection strategy, we first tested the classification methods using the two most relevant panels: CBC and CMP. These baselines with reduced testing cost still behaved much worse than our approach in both F1 score and AUROC. We also tested another fixed selection (FS) baseline, where we chose to always observe 2 most selected test panels reported in our approach for all patients, while keeping other modules the same. Our approach outperformed FS on both F1 score and AUROC while having a similar testing cost. The random selection (RS) baseline selected test panels uniformly at random and had a worse performance. Q-learning for classification with costly features (CWCF) Janisch et al. (2019) performed poorly on all three clinical datasets. We believe this is because the model uses the same network for selecting tests and learning rewards. For such imbalanced datasets, this may make the training unstable and difficult to optimize. • Efficiency and accuracy of end-to-end training. The classifier and panel selector of SM-DDPOend2end are both trained from the scratch, using Algorithm 1. As in Table 2, this end- to-end training scheme gives comparable accuracy with policies that rely on a heavily pretrained classifier (SM-DDPOpretrain). If a brand-new diagnostic/predictive task is given, our algorithm can be trained without prior data/knowledge about the new disease. It can adaptively prescribe lab tests to learn the disease model and test selection policy in an online fashion. End-to-end training is also more data-efficient and runtime efficient. • Interpretability. Our algorithm is able to select test panels that are clinically relevant. For ferritin prediction, our algorithm identifies TSAT as a most important panel, which is indeed useful for detecting iron deficiency. For AKI prediction, our algorithm recommends serum creatinine level test as an important predictor for 95% of subjects, i.e., current and past serum creatinine is indicative of future AKI, expanding its utility as a biomarker de Geus et al. (2012). 8 Published as a conference paper at ICLR 2023 6.3 TRAINING CURVES We present the training curves on AKI dataset in Figure 3. We refer more results to Appendix B. • SM-DDPO learns the disease model. In end-to-end training, the diagnostic classifier is trained from the scratch. It maps any partially-observed patient state to a diagnosis/prediction. We evaluate this classifier on static data distributions, in order to eliminate the effect of dynamic test selection and focus on classification quality. Figure 3 shows that the classifier learns to make the high-quality prediction with improved quality during RL, via training only on data selected by the RL algorithm. Figure 3: Classifier improvement during RL training on AKI Dataset. Accuracy of the learned classifier is evaluated on static patient distributions, with 1) random missing pattern, where we uniformly at random augment the test data; 2) missing pattern of the optimal policy's state distribution. During the end-to-end RL training, the classifier gradually improves and has higher accuracy with the second missing pattern. Figure 4: Cost-F1 Pareto Front for maximizing F1-score on Ferritin, AKI and Sepsis Datasets 6.4 COST-F1 PARETO FRONT Figure 4 illustrates the Pareto fronts learned on all three datasets. We trained for optimal policies on 190 MDP instances specified by different value pairs of (λ, ρ) in Theorem 4.1, and present the corresponding performance on F1 score (red) and AUROC (blue) evaluated on the test sets. We identify the Pareto front as the upper envelope of these solutions, which are the yellow curves in Figure 4. These results present the full tradeoff between testing cost and diagnostic/predictive accuracy. As a corollary, given any cost budget B, one is able to obtain the best testing strategy with the optimal F1 performance directly from Figure 4. We present a zoom-in version in Appendix B. 7 SUMMARY In this work, we develop a Semi-Model-based Deep Diagnosis Policy Optimization (SM-DDPO) method to find optimal cost-sensitive dynamic policies and achieve state-of-art performances on real-world clinical datasets with up to 85% reduction in testing cost. 9 Published as a conference paper at ICLR 2023 ACKNOWLEDGMENTS Mengdi Wang acknowledges the support by NSF grants DMS-1953686, IIS-2107304, CMMI- 1653435, ONR grant 1006977, and http://C3.AI. Yuan Luo acknowledges the support by NIH grants U01TR003528 and R01LM013337. Yikuan Li acknowledges the support by AHA grant 23PRE1010660. REFERENCES Derek C Angus and Tom Van der Poll. Severe sepsis and septic shock. N Engl J Med, 369:840–851, 2013. Peter C Austin, Ian R White, Douglas S Lee, and Stef van Buuren. Missing data in clinical research: a tutorial on multiple imputation. Canadian Journal of Cardiology, 37(9):1322–1331, 2021. Jinbo Bi, Kristin Bennett, Mark Embrechts, Curt Breneman, and Minghu Song. Dimensionality reduction via sparse support vector machines. Journal of Machine Learning Research, 3(Mar): 1229–1243, 2003. Mustafa Bilgic and Lise Getoor. Voila: Efficient feature-value acquisition for classification. In Proceedings of the national conference on artificial intelligence, volume 22, pp. 1225. Menlo Park, CA; Cambridge, MA; London; AAAI Press; MIT Press; 1999, 2007. Xiaoyong Chai, Lin Deng, Qiang Yang, and Charles X Ling. Test-cost sensitive naive bayes classification. In Fourth IEEE International Conference on Data Mining (ICDM'04), pp. 51–58. IEEE, 2004. Tianqi Chen and Carlos Guestrin. Xgboost: A scalable tree boosting system. In Proceedings of the 22nd acm sigkdd international conference on knowledge discovery and data mining, pp. 785–794, 2016. Gabriella Contardo, Ludovic Denoyer, and Thierry Artières. Sequential cost-sensitive feature acquisition. In International symposium on intelligent data analysis, pp. 284–294. Springer, 2016. Brian K Crownover and Carlton Covey. Hereditary hemochromatosis. American family physician, 87 (3):183–190, 2013. Hilde RH de Geus, Michiel G Betjes, and Jan Bakker. Biomarkers for the prediction of acute kidney injury: a narrative review on current status and future challenges. Clinical kidney journal, 5(2): 102–108, 2012. Menghan Ding and Yuan Luo. Unsupervised phenotyping of sepsis using nonnegative matrix factorization of temporal trends from a multivariate panel of physiological measurements. BMC Medical Informatics and Decision Making, 21(5):1–15, 2021. Conor Fahy and Shengxiang Yang. Dynamic feature selection for clustering high dimensional data streams. IEEE Access, 7:127128–127140, 2019. Omer Gottesman, Fredrik Johansson, Matthieu Komorowski, Aldo Faisal, David Sontag, Finale Doshi-Velez, and Leo Anthony Celi. Guidelines for reinforcement learning in healthcare. Nature medicine, 25(1):16–18, 2019. Arthur Guez, Robert D Vincent, Massimo Avoli, and Joelle Pineau. Adaptive treatment of epilepsy via batch-mode reinforcement learning. In AAAI, pp. 1671–1678, 2008. Isabelle Guyon and André Elisseeff. An introduction to variable and feature selection. Journal of machine learning research, 3(Mar):1157–1182, 2003. He He, Hal Daumé III, and Jason Eisner. Cost-sensitive dynamic feature selection. In ICML Inferning Workshop, 2012. Tin Kam Ho. Random decision forests. In Proceedings of 3rd international conference on document analysis and recognition, volume 1, pp. 278–282. IEEE, 1995. 10 Published as a conference paper at ICLR 2023 Amelia Huck and Kent Lewandrowski. Utilization management in the clinical laboratory: an introduction and overview of the literature. Clinica Chimica Acta, 427:111–117, 2014. Jaromír Janisch, Tomáš Pevn`y, and Viliam Lis`y. Classification with costly features using deep rein- forcement learning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 3959–3966, 2019. Shihao Ji and Lawrence Carin. Cost-sensitive feature acquisition and classification. Pattern Recogni- tion, 40(5):1474–1485, 2007. Alistair EW Johnson, Tom J Pollard, Lu Shen, Li-wei H Lehman, Mengling Feng, Mohammad Ghassemi, Benjamin Moody, Peter Szolovits, Leo Anthony Celi, and Roger G Mark. Mimic-iii, a freely accessible critical care database. Scientific data, 3(1):1–9, 2016. Sergey Karayev, Mario J Fritz, and Trevor Darrell. Dynamic feature selection for classification on a budget. In International conference on machine learning (ICML): Workshop on prediction with sequential models. Citeseer, 2013. Guolin Ke, Qi Meng, Thomas Finley, Taifeng Wang, Wei Chen, Weidong Ma, Qiwei Ye, and Tie-Yan Liu. Lightgbm: A highly efficient gradient boosting decision tree. Advances in neural information processing systems, 30, 2017. John A Kellum and Norbert Lameire. Diagnosis, evaluation, and management of acute kidney injury: a kdigo summary (part 1). Critical care, 17(1):204, 2013. Matloob Khushi, Kamran Shaukat, Talha Mahboob Alam, Ibrahim A Hameed, Shahadat Uddin, Suhuai Luo, Xiaoyan Yang, and Maranatha Consuelo Reyes. A comparative performance analysis of data resampling methods on imbalance medical data. IEEE Access, 9:109960–109975, 2021. Ron Kohavi and George H John. Wrappers for feature subset selection. Artificial intelligence, 97 (1-2):273–324, 1997. Matthieu Komorowski, Leo A Celi, Omar Badawi, Anthony C Gordon, and A Aldo Faisal. The artificial intelligence clinician learns optimal treatment strategies for sepsis in intensive care. Nature medicine, 24(11):1716–1720, 2018. Steef Kurstjens, Thomas de Bel, Armando van der Horst, Ron Kusters, Johannes Krabbe, and Jasmijn van Balveren. Automated prediction of low ferritin concentrations using a machine learning algorithm. Clinical Chemistry and Laboratory Medicine (CCLM), 2022. Eun Hye Lee, Mi Hwa Shin, Jong-Min Park, Sang-Guk Lee, Nam Su Ku, Young Sam Kim, Moo Suk Park, Jae-Chul Pyun, and Kyung Soo Chung. Diagnosis and mortality prediction of sepsis via lysophosphatidylcholine 16: 0 measured by maldi-tof ms. Scientific reports, 10(1):1–9, 2020. Der-Chiang Li, Chiao-Wen Liu, and Susan C Hu. A learning method for the class imbalance problem with medical data sets. Computers in biology and medicine, 40(5):509–518, 2010. Yang Li and Junier Oliva. Active feature acquisition with generative surrogate models. In International Conference on Machine Learning, pp. 6450–6459. PMLR, 2021. Wei-Chao Lin and Chih-Fong Tsai. Missing value imputation: a review and analysis of the literature (2006–2017). Artificial Intelligence Review, 53(2):1487–1509, 2020. Yuan Luo, Peter Szolovits, Anand S Dighe, and Jason M Baron. Using machine learning to predict laboratory test results. American journal of clinical pathology, 145(6):778–788, 2016. Qi Ma and Sujit K Ghosh. Emflow: Data imputation in latent space via em and deep flow models. arXiv preprint arXiv:2106.04804, 2021. Aditya Menon, Harikrishna Narasimhan, Shivani Agarwal, and Sanjay Chawla. On the statistical consistency of algorithms for binary classification under class imbalance. In Sanjoy Dasgupta and David McAllester (eds.), Proceedings of the 30th International Conference on Machine Learning, volume 28 of Proceedings of Machine Learning Research, pp. 603–611, Atlanta, Georgia, USA, 17–19 Jun 2013. PMLR. URL https://proceedings.mlr.press/v28/menon13a. html. 11 Published as a conference paper at ICLR 2023 Rui P Moreno, Barbara Metnitz, Leopold Adler, Anette Hoechtl, Peter Bauer, and Philipp GH Metnitz. Sepsis mortality prediction based on predisposition, infection and response. Intensive care medicine, 34(3):496–504, 2008. HyunJi Alex Nam, Scott Fleming, and Emma Brunskill. Reinforcement learning with state observation costs in action-contingent noiselessly observable markov decision processes. Advances in Neural Information Processing Systems, 34:15650–15666, 2021. Nagarajan Natarajan, Inderjit S. Dhillon, Pradeep Ravikumar, and Ambuj Tewari. Cost-sensitive learning with noisy labels. Journal of Machine Learning Research, 18(155):1–33, 2018. URL http://jmlr.org/papers/v18/15-226.html. Muhammad S Osman, Adnan M Abu-Mahfouz, and Philip R Page. A survey on data imputation techniques: Water distribution system as a use case. IEEE Access, 6:63279–63291, 2018. Mark A Perazella. The urine sediment as a biomarker of kidney disease. American Journal of Kidney Diseases, 66(5):748–755, 2015. Antonin Raffin, Ashley Hill, Adam Gleave, Anssi Kanervisto, Maximilian Ernestus, and Noah Dormann. Stable-baselines3: Reliable reinforcement learning implementations. Journal of Machine Learning Research, 22(268):1–8, 2021. URL http://jmlr.org/papers/v22/ 20-1364.html. M Mostafizur Rahman and Darryl N Davis. Addressing the class imbalance problem in medical datasets. International Journal of Machine Learning and Computing, 3(2):224, 2013. L Nelson Sanchez-Pinto and Robinder G Khemani. Development of a prediction model of early acute kidney injury in critically ill children using electronic health record data. Pediatric Critical Care Medicine, 17(6):508–515, 2016. Julian Schrittwieser, Ioannis Antonoglou, Thomas Hubert, Karen Simonyan, Laurent Sifre, Simon Schmitt, Arthur Guez, Edward Lockhart, Demis Hassabis, Thore Graepel, et al. Mastering atari, go, chess and shogi by planning with a learned model. Nature, 588(7839):604–609, 2020. John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017. Jiyoung Shin, Yikuan Li, and Yuan Luo. Early prediction of mortality in critical care setting in sepsis patients using structured features and unstructured clinical notes. In 2021 IEEE International Conference on Bioinformatics and Biomedicine (BIBM), pp. 2885–2890. IEEE, 2021. Matthew W Short and Jason E Domagalski. Iron deficiency anemia: evaluation and management. American family physician, 87(2):98–104, 2013. Mervyn Singer, Clifford S Deutschman, Christopher Warren Seymour, Manu Shankar-Hari, Djillali Annane, Michael Bauer, Rinaldo Bellomo, Gordon R Bernard, Jean-Daniel Chiche, Craig M Coopersmith, et al. The third international consensus definitions for sepsis and septic shock (sepsis-3). Jama, 315(8):801–810, 2016. Mengxin Sun, Jason Baron, Anand Dighe, Peter Szolovits, Richard G Wunderink, Tamara Isakova, and Yuan Luo. Early prediction of acute kidney injury in critical care setting using clinical notes and structured multivariate physiological measurements. MedInfo, 264:368–372, 2019. Kirill Trapeznikov and Venkatesh Saligrama. Supervised sequential classification under budget constraints. In Artificial intelligence and statistics, pp. 581–589. PMLR, 2013. Jason Weston, Sayan Mukherjee, Olivier Chapelle, Massimiliano Pontil, Tomaso Poggio, and Vladimir Vapnik. Feature selection for svms. Advances in neural information processing systems, 13, 2000. Jason Weston, André Elisseeff, Bernhard Schölkopf, and Mike Tipping. Use of the zero norm with linear models and kernel methods. The Journal of Machine Learning Research, 3:1439–1461, 2003. 12 Published as a conference paper at ICLR 2023 Haiyan Yin, Yingzhen Li, Sinno Jialin Pan, Cheng Zhang, and Sebastian Tschiatschek. Reinforcement learning with efficient active feature acquisition. arXiv preprint arXiv:2011.00825, 2020. Chao Yu, Jiming Liu, Shamim Nemati, and Guosheng Yin. Reinforcement learning in healthcare: A survey. ACM Computing Surveys (CSUR), 55(1):1–36, 2021. Junyu Zhang, Alec Koppel, Amrit Singh Bedi, Csaba Szepesvari, and Mengdi Wang. Variational policy gradient method for reinforcement learning with general utilities. Advances in Neural Information Processing Systems, 33:4572–4583, 2020. Lindsay P Zimmerman, Paul A Reyfman, Angela DR Smith, Zexian Zeng, Abel Kho, L Nelson Sanchez-Pinto, and Yuan Luo. Early prediction of acute kidney injury following icu admission using a multivariate panel of physiological measurements. BMC medical informatics and decision making, 19(1):1–12, 2019. 13 Published as a conference paper at ICLR 2023 APPENDIX We organized the appendices as follows. We first provide a complete literature review in appendix A. In appendix B, we provided the descriptive statistics of all three clinical datasets, followed by the experimental results and detailed training settings. In appendix C, we described the EMFlow imputation algorithm. In appendix D, we gave more details of the proposed end-to-end training approach. In appendix E, we proved the Theorem 4.1. In appendix F, we discuss the alternative AM metric for evaluating the diagnostic performance as an example to show the capability of our framework to handle classic linear metrics. A RELATED WORK Reinforcement learning (RL) has been applied in multiple clinical care settings to learn optimal treatment strategies for sepsis Komorowski et al. (2018), to customize antiepilepsy drugs for seizure control Guez et al. (2008) etc. See survey Yu et al. (2021) for more comprehensive summary. Guidelines on using RL for optimizing treatments in healthcare has also been proposed around the topics of variable availability, sample size for policy evaluation, and how to ensure learned policy works prospectively as intended Gottesman et al. (2019). However, using RL for simultaneously reducing the healthcare cost and improving patient's outcomes has been underexplored. Our problem of cost-sensitive dynamic diagnosis/prediction is closely related to feature selection in supervised learning. The original static feature selection methods, where there exists a common subset of features selected for all inputs, were extensively discussed Guyon & Elisseeff (2003), including filter models (e.g., variable ranking), wrapper approaches Kohavi & John (1997), as well as integration of the feature selection in the learning process by using (cid:96)1-norm and (cid:96)0-norm Bi et al. (2003); Weston et al. (2003; 2000). Dynamic feature selection methods He et al. (2012), also named as adaptive feature acquisition Contardo et al. (2016) or feature selection with budget Karayev et al. (2013), were then proposed to take the difference between inputs into account. Different subsets of features are selected with respect to different inputs. By defining certain information value of the features Fahy & Yang (2019); Bilgic & Getoor (2007), or estimating the gain of acquiring a new feature would yield Chai et al. (2004), these methods are able to select appropriate features in an adaptive way to balance the costs of the selected features and the learning quality. Recently, reinforcement learning based approaches Ji & Carin (2007); Trapeznikov & Saligrama (2013); Janisch et al. (2019); Yin et al. (2020); Li & Oliva (2021); Nam et al. (2021) are also proposed to dynamically select features for prediction/classification. All these related works are directly given, or pre-define a sum of rewards as objectives. While our task of deriving the cost-F1 Pareto front, or maximizing F1 score under cost budget constraints, is much harder and cannot be expressed using pre-defined reward functions. Work Nam et al. (2021); Ji & Carin (2007); Yin et al. (2020) models the feature selection process as a partially observed Markov Decision Process (POMDP). Ji & Carin (2007) points out that POMDP solutions are hard to train and cannot handle continuous-valued observations. A similar approach is proposed by Janisch et al. (2019) using a deep Q learning method. In our approach, we use a modular network and a combination of various training schemes for more efficient RL. Trapeznikov & Saligrama (2013) ranks features in a prefixed order and only requires the agent to decide if it will add a next feature or stop. The prefixed ranked order makes the problem easier to solve, but it is suboptimal compared to fully dynamic policies. In this work, we deal with datasets with highly imbalancement, i.e., there are much fewer ill patients compared to healthy patients. To handle such data imbalancement, we use the metric of F1 score, which is a well-established and acknowledged evaluation metric in the medical domain Perazella (2015); Sanchez-Pinto & Khemani (2016), to evaluate the diagnostic performance. Alternative metrics includes linear AM metrics Natarajan et al. (2018); Menon et al. (2013) for imbalanced datasets can also handled by our frameworks, which we discussed in Appendix F. B EXPERIMENTS B.1 DESCRIPTION OF DATASETS We summarize a detailed description of all lab tests in three datasets in Table 3, 4 and 5 14 Published as a conference paper at ICLR 2023 Table 3: Summary descriptive statistics of the Ferritin dataset. (N = 43472. Binary variables are reported with positive numbers and percentages. Continuous variables are reported with means and interquartile ranges. N / mean % / IQR Variables N / mean % / IQR Variables Demographics Age Race/Ethnicity 50.41 (37.00, 63.00) Asian Black Hispanic White Other 26887 6354 4272 3708 2251 Comprehensive Metabolic Panel ($48) 20.14 4.3 67.03 9.79 22.06 27.09 15.24 9.49 103.71 0.87 139.27 0.55 7.22 4.11 99.88 3.19 Alanine Transaminase (UL) Albumin (g/dL) Alkaline Phosphatase (U/L) ‡Anion Gap (mEq/L) Aspartate Transaminase (U/L) ‡Bicarbonate (mmol/L) ‡Blood Urea Nitrogen (mg/dL) ‡Calcium (mg/dL) ‡Chloride (mmol/L) ‡Creatinine (mmol/L) ‡Sodium (mmol/L) Total Bilirubin (mg/dL) Total Protein (g/dL) ‡Potassium (mmol/L) ‡Glucose (mg/L) Globulin (g/dL) 5.18% 14.61% 9.83% 61.85% 8.53% (12.00, 21.50) (4.10, 4.50) (48.00, 77.00) (8.00, 12.00) (16.00, 23.00) (26.00, 29.00) (11.00, 17.00) (9.20, 9.75) (102.00, 105.00) (0.69, 0.89) (138.00, 141.00) (0.40, 0.60) (6.90, 7.50) (3.90, 4.30) (86.00, 102.00) (2.70, 3.60) Complete Blood Count Panel ($44) †Abs. Nucleated RBC Count (K/μL) Abs. Basophils (K/μL) Abs. Bosinophils (K/μL) Abs. Lymphocytes (K/μL) Absolute Monocytes (K/μL) Absolute Neutrophils (K/μL) Percent Eosinophils (%) Percent Lymphocytes (%) Percent Monocytes (%) Percent Neutrophils (%) Percent Basophils (%) †White Blood Cell Count (K/μL) †Red Blood Cell Count (M/μL) †Platelets (K/μL) †Mean cell volume (fL) †Mean cell hemoglobin (pg/RBC) Mean cell hemoglobin concentration (g/dL)† †RBC distribution width (%) †Hematocrit (%) †Hemoglobin (g/dL) Transferrin Saturation Test ($40) Iron (μg/dL) Total Iron-binding Capacity (μg/dL) Outcome 0.21 0.05 0.16 2.05 0.53 4.13 2.46 29.49 8 60.23 0.68 6.92 4.34 274.78 28.91 32.07 90.03 13.89 38.87 12.48 82.33 366.81 (0.00, 0.00) (0.00, 0.10) (0.10, 0.20) (1.45, 2.30) (0.40, 0.60) (2.90, 4.96) (1.00, 3.00) (23.67, 35.00) (6.00, 9.00) (53.50, 67.00) (0.00, 1.00 (5.30, 7.90) (4.07, 4.67) (224.00, 315.50) (27.70, 30.70) (31.38, 32.95) (87.00, 94.00) (12.50, 14.60) (36.60, 41.80) (11.60, 13.60) (54.00, 104.00) (321.00, 409.00) Vitamin B-12 Test ($66) Cobalamin (pg/mL) 547.8 (302.00, 668.00) Abnormal Ferritin Level 4649 10.69% †: These variables can also be ordered through basic blood count panel ($26). ‡: These variables can also be ordered through basic metabolic panel ($36). Table 4: Summary descriptive statistics of the AKI dataset. (N = 23950. Binary variables are reported with positive numbers and percentages. Continuous variables are reported with means and interquartile ranges.) Variables Demographics Gender Female Male Age (yr) Race/Ethnicity Black Hispanic White Other N/Mean %/ IQR 9755 14195 60.89 1688 845 17261 4176 40.73% 59.27% (50.66, 73.50) 6.96% 3.53% 72.07% 17.44% Vital Signs or Bedside Measurements Heart Rate Maximum (bpm) Heart Rate Mean (bpm) Systolic BP Minimum (mmHg) Systolic BP Mean (mmHg) Diastolic BP Minimum (mmHg) Diastolic BP Mean (mmHg) Mechanical Ventilation Average Urine Output (ml) Temperature Maximum (celsius) 105.4 86.97 92.51 118.87 45.31 61.98 12273 2202.68 37.6 (91.00, 117.00) (76.58, 96.76) (82.00, 102.00) (107.34, 128.45) (39.00, 52.00) (54.88, 67.87) 51.24% (1315.00, 2792.00) (37.06, 38.06) N/Mean %/ IQR Variables Comprehensive Metabolic Panel ($48) Glucose Level Maximum (mg/dL) Bicarbonate Level Minimum (mg/dL) Creatinine Level Minimum (mg/dL) Creatinine Level Maximum (mg/dL) Blood Urea Nitrogen Level Maximum (mg/dL) Calcium Level Minimum (mg/dL) Estimated Glomerular Filtration Rate (eGFR) Potassium Level Maximum (mg/dL) 173.36 23.87 0.74 0.8 16.87 8.08 110.2 4.39 Activated Partial Thromboplastin Time Test Panel ($26) 32.55 40.22 1.34 1.48 14.66 15.63 Partial Thromboplastin Time Maximum (s) Partial Thromboplastin Time Minimum (s) International Normalized Ratio Minimum International Normalized Ratio Maximum Prothrombin Time Minimum (s) Prothrombin Time Maximum (s) Complete Blood Count Panel ($44) (128.00, 196.00) (21.00, 26.00) (0.60, 0.90) (0.60, 1.00) (11.00, 20.00) (7.62, 8.54) (80.94, 124.30) (3.90, 4.70) (26.60, 34.60) (27.80, 41.92) (1.10, 1.40) (1.20, 1.52) (13.10, 15.08) (13.40, 16.18) Hemoglobin Level Minimum (g/dL) Platelet Count K/μL White Blood Cell Count Maximum (mg/dL) 10.33 210.24 12.78 (8.90, 11.70) (134.00, 261.00) (8.50, 15.50) Arterial Blood Gas Test ($473) SpO2 Minimum (%) SpO2 Maximum (%) 92.23 97.41 (91.00, 95.00) (96.36, 98.78) Outcome Acute Kidney Injury 3945 16.47% B.2 SUPPLEMENT EXPERIMENT RESULTS In this section, we show a more detailed results of Table 2 presented in the main text. B.3 DETAILED TRAINING SETTINGS Computing Resource The experiments are conducted in part through the computational resources and staff contributions provided for the Quest high performance computing facility at Northwestern University which is jointly supported by the Office of the Provost, the Office for Research, and Northwestern University Information Technology. Quest provides computing access of over 11,800 CPU cores. In our experiment, we deploy each model training job to one CPU, so that multiple 15 Published as a conference paper at ICLR 2023 Table 5: Summary descriptive statistics of the Sepsis dataset. (N = 5396. Binary variables are reported with positive numbers and percentages. Continuous variables are reported with means and interquartile ranges.) Variables Demographics Gender Female Male Age (yr) Race/Ethnicity Asian Black Hispanic White Other Marital Status Divorced Married Single Widowed Unknown Admission Type Elective Emergency Urgent Insurance Type Government Medicaid Medicare Private Self-pay Arterial Blood Gas Test ($473) Base excess (mEq/L) PH (unit) Fraction of Inspired Oxygen (%) Mean Arterial Pressure (mmHg) Blood Oxygen Saturation (%) Composite Score N/Mean %/ IQR Variables N/Mean %/ IQR Vital Signs, Bedside Measurements, or Medical Histories 3014 2382 65.5 167 473 182 3923 654 328 2379 1536 795 358 310 5026 60 157 532 3123 1538 46 -1.51 7.36 72.01 82.08 96.73 55.86% 44.14% (53.90, 79.93) 3.09% 8.77% 3.37% 72.70% 12.12% 6.08% 44.09% 28.47% 14.73% 6.63% 5.74% 93.14% 1.11% 2.91% 9.86% 57.88% 28.50% 0.85% Heart Rate (bpm) Respiration Rate (insp/min) Systolic BP (mmHg) Diastolic BP (mmHg) Glasgow Comma Scale Mechanical Ventilation Urine Output (ml) Tidal Volume Temperature (celsius) History of Metastatic Cancer History of Diabetes BMI Comprehensive Metabolic Panel ($48) Glucose Level (mg/dL) Bicarbonate Level (mEq/L) Serum Creatinine (mg/dL) Aspartate aminotransferase (IU/L) Bilirubin (mg/dL) Chloride (mEq/L) Carbon Dioxide (mEq/L) Lactate (mmol/L) Magnesium (mg/dL) Blood Urea Nitrogen Level (mg/dL) Blood albumin (g/dL) Blood sodium (mEq/L) Potassium Level (mEq/L) (-4.00, 1.00) (7.31, 7.43) (50.00, 100.00) (69.00, 93.00) (95.00, 100.00 Complete Blood Count Panel ($44) Hemoglobin Level (g/dL) Hematocrit (%) Platelet Count (K/μL) Red Blood Cell Count (K/μL) White Blood Cell Count (K/μL) 90.99 19.37 124.46 66.75 4.91 2781 214.91 496.98 36.64 342 1629 28.54 4.91 22.95 1.54 4.01 1.57 105.29 24.61 2.16 1.92 28.85 3.01 138.3 4.18 10.83 32.37 5.21 3.58 12.69 (77.00, 104.00) (15.00, 23.00) (107.00, 141.00) (55.00, 77.00) (5.00, 6.00) 48.11% (70.00, 300.00) (450.00, 550.00) (36.10, 37.22) 5.92% 28.18% (23.53, 31.75) (4.65, 5.11) (20.00, 26.00) (0.80, 1.60) (3.18, 4.49) (0.40, 1.30) (101.00, 109.00) (21.00, 28.00) (1.10, 2.60) (1.70, 2.10) (14.00, 35.00) (2.60, 3.40) (135.00, 141.00) (3.70, 4.60) (9.40, 12.20) (28.30, 36.30) (4.93, 5.59) (3.10, 4.05) (7.50, 15.30) Activated Partial Thromboplastin Time Test Panel ($26) Partial Thromboplastin Time (s) International Normalized Ratio 36.75 1.5 (26.50, 37.30) (1.10, 1.50) Sequential Organ Failure Assessment 4.63 (2.00, 6.00) Outcome In-hospital Mortality 3945 16.47% configurations can be tested simultaneously. Each training job requires a wall-time less than 2 hours of a single CPU core. Hyper-Parameters Settings The hyper-parameter of our model is divided onto four parts: param- eter for training imputer, classifier, PPO policy, as well as the end-to-end training parameters. We list all the hyper-parameters we tuned in Table 7, including both the tuning range and final selection. The unmentioned parameters in training EMFlow imputer are set to the same as in its original work Ma & Ghosh (2021). The unmentioned parameters in PPO are set to default values in Python package Raffin et al. (2021). Data Splitting Scheme We split each dataset into 3 parts: training set (75%), validation set (15%), and test set (10%). Training data is further splitted into two disjoint sets, one for pretraining the state encoder (25%) and the other one for end-to-end RL training (50%). The validation set is splitted in the same way, one for tuning hyper-parameters for training the state encoder (5%) and the other one for tuning hyper-parameters for end-to-end RL training (10%). Here, all percentages are calculated w.r.t. the whole dataset size. Policy Improvement During RL Training In Figure 5, we showed the performance of the RL policies evaluated on train, validation and test sets. We note that the three curves closely match one another, confirming the generalizability of the learned dynamic classification policy. Zoom-in Version of the cost-F1 Pareto Front Here we present the cost-F1 Pareto front, com- paring only to baselines with similar testing cost (Figure 6 is a subset of Figure 4). The yellow curve, which is the envelope of the 190 solutions, is the final Pareto front we obtained on the test set. Comparing to baselines with similar cost, our approach gives a better performance on F1 score under the same cost budget. As already shown in Figure 4, even comparing to fully observable approaches 16 Published as a conference paper at ICLR 2023 Table 6: Complete version of Table 2. Model performance, measured by F1 score, area under ROC (AUC), and testing cost, for three real-world clinical datasets. The tested models include logistic regression (LR), random forests (RF), gradient boosted regression trees (XGBoost Chen & Guestrin (2016) and LightGBM Ke et al. (2017) ), 3-layer multi-layer perceptron, Q-learning for classification with costly features (CWCF)Janisch et al. (2019), Random Selection (RS), Fixed Selection (FS). Among them, classical methods including LR, RF, XGBoost, Lightbgm are tested under both fully observable case and fixed observable case where 2 most relavant panels (CMB and CBCP panel) are chosen. All models were fine-tuned to maximize the F1 score. The model yielded the highest F1 score is bold. The model required the least testing cost is underlined. Dataset Models AKI Ferritin LR RF XGBoost Lightbgm 3-layer DNN LR (2 panels) RF (2 panels) XGBoost (2 panels) Lightbgm (2 panels) FS RS CWCF SM-DDPOpretrained SM-DDPOend2end LR RF XGBoost Lightbgm 3-layer DNN LR (2 panels) RF (2 panels) XGBoost (2 panels) Lightbgm (2 panels) FS RS CWCF SM-DDPOpretrained SM-DDPOend2end LR RF XGBoost Lightbgm 3-layer DNN LR (2 panels) RF (2 panels) XGBoost (2 panels) Lightbgm (2 panels) FS RS CWCF SM-DDPOpretrained SM-DDPOend2end Sepsis Test Selection Strategy F1 Full Full Full Full Full Fixed Fixed Fixed Fixed Fixed Random Dynamic Dynamic Dynamic 0.541 ± 0.010 0.597 ± 0.024 0.610 ± 0.027 0.625 ± 0.011 0.615 ± 0.018 0.401 ± 0.016 0.504 ± 0.023 0.519 ± 0.015 0.571 ± 0.010 0.588 ± 0.017 0.427 ± 0.023 0.531 ± 0.021 0.587 ± 0.021 0.613 ± 0.018 Full Full Full Full Full Fixed Fixed Fixed Fixed Fixed Random Dynamic Dynamic Dynamic Full Full Full Full Full Fixed Fixed Fixed Fixed Fixed Random Dynamic Dynamic Dynamic 0.453 ± 0.028 0.438 ± 0.032 0.414 ± 0.023 0.474 ± 0.017 0.492 ± 0.024 0.473 ± 0.006 0.425 ± 0.016 0.410 ± 0.022 0.491 ± 0.011 0.432 ± 0.028 0.411 ± 0.029 0.278 ± 0.053 0.514 ± 0.030 0.489 ± 0.026 0.507 ± 0.035 0.442 ± 0.051 0.451 ± 0.051 0.501 ± 0.046 0.515 ± 0.031 0.488 ± 0.021 0.478 ± 0.053 0.459 ± 0.032 0.502 ± 0.031 0.489 ± 0.039 0.475 ± 0.062 0.118 ± 0.011 0.545 ± 0.034 0.532 ± 0.036 AUC Cost 0.934 ± 0.008 0.931 ± 0.006 0.940 ± 0.004 0.941 ± 0.006 0.937 ± 0.005 0.859 ± 0.013 0.887 ± 0.012 0.895 ± 0.007 0.901 ± 0.006 0.922 ± 0.007 0.837 ± 0.012 0.702 ± 0.018 0.922 ± 0.008 0.926 ± 0.006 0.791 ± 0.018 0.771 ± 0.016 0.789 ± 0.017 0.791 ± 0.012 0.797 ± 0.010 0.797 ± 0.005 0.768 ± 0.004 0.781 ± 0.009 0.792 ± 0.006 0.789 ± 0.015 0.744 ± 0.019 0.510 ± 0.009 0.788 ± 0.022 0.796 ± 0.019 0.814 ± 0.030 0.820 ± 0.016 0.842 ± 0.025 0.850 ± 0.018 0.842 ± 0.014 0.811 ± 0.015 0.828 ± 0.018 0.877 ± 0.036 0.864 ± 0.010 0.830 ± 0.020 0.779 ± 0.030 0.503 ± 0.001 0.834 ± 0.022 0.841 ± 0.023 $290 $290 $290 $290 $290 $92 $92 $92 $92 $74 $144.78 ± 0.52 $261.02 ± 1.20 $80.72 ± 0.63 $62.51 ± 0.46 $591 $591 $591 $591 $591 $92 $92 $92 $92 $98 $294.88 ± 1.32 $340.39 ± 19.01 $90.12 ± 0.68 $97.31 ± 0.58 $591 $591 $591 $591 $591 $92 $92 $92 $92 $90 $295.01 ± 2.41 $401.83 ± 120.76 $86.21 ± 1.44 $90.55 ± 1.20 which have much higher testing cost, our approach exhibits comparing performance on F1 score and AUROC with a much lower testing cost. Lastly, we emphasize that our approach gives the whole Pareto front, which represents a complete and rigorous characterization of the accuracy-cost trade-off in our medical diagnostics tasks. While all the baselines we compared to, only gives single points on this trade-off characterization. 17 Published as a conference paper at ICLR 2023 Hyper-parameters Imputer Batch size Learning rate Regularization α # Iterations Classifier Hidden size (3-layer) Batch size Learning rate Class weight PPO Learning rate Hidden size (2-layer) Batch size # Timesteps per update End-to-end Table 7: Hyper-parameter Table Ferritin AKI Sepsis Selection Range 256 1e-3 1e3 500 64 256 5e-4 3 1e-4 128 128 1024 256 1e-4 1e6 500 256 256 1e-4 5 1e-4 256 128 2048 100 8 50k 256 1e-4 1e6 500 256 256 1e-4 5 1e-4 128 256 2048 4 6 50k {64, 128, 256} {1e-3, 1e-4} {1, 1e3, 1e6} {100, 300, 500} {64, 128, 256} {64, 128, 256} {1e-3, 5e-4, 1e-4, 5e-5, 1e-5} {1,3,5,8,10,12} {1e-3, 1e-4} {128, 256} {64, 128, 256} {1024, 2048} {10,100} {2,4,6,8} {5k, 50k} # Outer loop # Epochs Classifier trained per loop # Timesteps PPO trained per loop 100 6 5k Figure 5: RL training curves on AKI Dataset. We evaluate the policy and classifier learned during the end-to-end training phase on both train, validation and test set. The matching curve confirms generalizability of the learned policies. Figure 6: Cost-F1 Pareto Front for maximizing F1-score on Ferritin, AKI and Sepsis Datasets 18 Published as a conference paper at ICLR 2023 C EMFLOW In this section, we describe the EMFlow imputation algorithm, originally proposed in Ma & Ghosh (2021), used in constructing the posterior state encoder. The key idea of EMFlow is to first map the data onto the latent space via a normalizing flow model, such that it enjoys a Gaussian distribution in the latent space. Then it apply an online version of the expectation maximization algorithm in the latent space. The high-level picture of EMFlow is illustrated in Fig. 7. In each training iteration, we Figure 7: Illustration of EMFlow Ma & Ghosh (2021). first fix the estimate base distribution N (ˆμ, ˆΣ) in the latent space and update the normalizing flow (NF) via optimizing the negative log-likelihood of a batch B of the current imputation result: L1(θ) = − 1 |B| (cid:88) i∈B log pX (ˆxi; θ, ˆμ, ˆΣ) (4) where NF is parametrized by θ and pX denotes the likelihood of the current imputation estimate xi given the base distribution. Then with the current estimate of the normalizing flow, we do an online version of expectation maximization (EM) in the latent space to update the estimate for the base distribution. The expectation step is given as: i = E[ˆzm ˆzm i |ˆzo i ; ˆμ, ˆΣ], i ∈ B (5) And the maximization step follows an iterative update scheme to deal with the memory overhead of the classical EM: ˆμ(t) = ρt ˆμbatch + (1 − ρt)ˆμ(t−1) ˆΣ(t) = ρt ˆΣbatch + (1 − ρt) ˆΣ(t−1) where ˆμbatch and ˆΣbatch are estimated using the conditional mean and variance given a batch of data: ˆμbatch = gμ(ˆμ(t), ˆΣ(t); {zi, Mi}i∈B) ˆΣbatch = gΣ(ˆμ(t), ˆΣ(t); {zi, Mi}i∈B) Lastly, we re-optimize NF via a combination of log-likelihood of current imputation and a regulariza- tion term indicating the distance of the imputation result to the ground truth. (7) (9) (8) (6) L2(θ) = − 1 |B| (cid:88) i∈B [log pX ( ̃xi; θ, ˆμ, ˆΣ) − α(cid:107) ̃xi − xi(cid:107)2 2] (10) In this work, we used the above "supervised" version of EMFlow, as we already know the ground truth data when training this imputer. Finally, the imputation procedure is in similar manner as 19 Published as a conference paper at ICLR 2023 Algorithm 2 Training Phase of EMFlow ("supervised" version) Input: Current imputation ˆX = (ˆx1, ˆx2, * * * , ˆxn)(cid:62), missing masks M = (M1, M2, * * * , Mn)(cid:62), initial estimates of the base distribution (ˆμ(0), ˆΣ(0)), online EM step size sequence: ρ1, ρ2, * * * , for t = 1, 2, * * * , Tepoch do Get a mini-batch ˆXB = {ˆxi}i∈B # update the flow model Compute L1 in Eq. (4) Update θ via gradient descent # update the base distribution zi = f −1 (ˆxi), i ∈ B Impute in the latent space with (ˆμ(t−1), ˆΣ(t−1)) to get {zi}i∈B via Eq. (5) Obtain updated (ˆμ(t), ˆΣ(t)) via Eq. (6) # update the flow model again ̃xi = fθ(ˆzi), i ∈ B Compute L2 via Eq. (10) Update θ via gradient descent θ end for Algorithm 3 Re-imputation Phase of EMFlow Input: Current imputation ˆX = (ˆx1, ˆx2, * * * , ˆxn)(cid:62), missing masks M = (M1, M2, * * * , Mn)(cid:62), initial estimates of the base distribution (ˆμ, ˆΣ) from the previous training phase for t = 1, 2, * * * , n do θ (ˆxi), i ∈ B zi = f −1 Impute in the latent space with (ˆμ(t−1), ˆΣ(t−1)) to get {zi}i∈B via Eq. (5) ̃xi = fθ(ˆzi), i ∈ B ˆxi = ˆxi (cid:12) (1 − Mi) + ̃xi (cid:12) Mi end for Output: {ˆxi}n i=1 20 Published as a conference paper at ICLR 2023 the training phase without updating the parameters. Both the training and imputation scheme are illustrated in Algorithm 2 and 3 respectively. To illustrate the imputation quality of the above EMFlow algorithm, we present a simple results in Table 8 of the root mean square error (RMSE) compared to classical imputation algorithms on UCI datasets as a reference. We do point out unlike conventional usage of imputation, we use EMFlow mainly as a posterior state encoder, instead of a imputer with excellent imputation quality. Table 8: Comparison of Imputers on Public Datasets in RMSE. Each dataset has 20% MCAR. Apart from the time-consuming MissForest Imputer, the EMFlow outperforms other imputers in most datasets. Imputer Mean MICE MissForest Matrix Completion GAIN EMFlow Letter 0.1535 0.1148 0.0608 0.1290 0.1198 0.1111 Spam 0.0573 0.0664 0.0476 0.0528 0.0513 0.0776 News 0.2265 0.1500 0.1365 0.1653 0.1441 0.1395 Air 0.1877 0.1014 0.0869 0.1261 0.1318 0.1022 Credit 0.1592 0.1862 0.1430 0.1632 0.1858 0.1410 D END-TO-END TRAINING In this section, we give more details of the proposed end-to-end training approach discussed in 5. We give out specific form for the objective of training both the classifier module and the panel/prediction selector module. Training objective (cid:96)c for the classifier module The classifier fφ(*) : Rd → RC, parameterized by φ, maps the posterior encoded state Impθ(x (cid:12) M ) to a probability distribution over labels. It is trained by directly minimizing the cross entropy loss (cid:96)c defined as: (cid:96)c(φ; x, M ) = − 2 (cid:88) i=1 wi log exp fφ(Impθ(x (cid:12) M ))i i=1 exp fφ(Impθ(x (cid:12) M ))i (cid:80)2 . from the collected dataset Q in training the RL policy. This differs from typical classification in that the data are collected adaptively by RL rather than sampled from a prefixed source. Here wi's are the class weights which treated as a tuning parameter. In this work, we used a 3-layer DNN as the model for the classifier. Training objective (cid:96)rl for the panel/prediction selector module The panel selector, a network module parameterized by ψ, takes the following as input θ,φ (s) = semb semb θ,φ (x (cid:12) M ) = (Impθ(x (cid:12) M ), fφ(Impθ(x (cid:12) M )), M ), (11) and maps it to a probability distribution over actions. We train the panel selector by using the classical proximal policy updates (PPO) Schulman et al. (2017), which aims at maximizing a clipped surrogate objective regularized by a square-error loss of the value functions and an entropy bonus. We denote this loss function as (cid:96)rl , which is defined as the following regularized clipped surrogate loss Schulman et al. (2017): (cid:96)rl(ψ; ψold) := (cid:96)CLIP (ψ; ψold) − c1(cid:96)V F (ψ) + c2Ent[πψ], (cid:104) (cid:105) πψold (at|ˆst) , 1 − (cid:15), 1 + (cid:15)) ˆAt) ˆAt, clip( πψ(at|ˆst) min( πψ(at|ˆst) πψold (at|ˆst) where (cid:96)CLIP (ψ; ψold) = ˆEt denotes the clipped surrogate loss with ˆAt being the estimated advantages, regularized by the square error loss of the value function (cid:96)V F (ψ) = ˆEt[(Vψ(ˆst) − V targ )2] and an entropy term Ent[πψ] over states. Here ˆEt is empirical average over collected dataset Q, and ˆst = semb θ,φ (st) denotes the state embedding we derived. Note the policy and value network share the parameter ψ. We also show a high-level algorithm 4 here. For more details, please refer to the original paper Schulman et al. (2017). We use the Python package stable-baseline3 Raffin et al. (2021) for implementing PPO. t 21 Published as a conference paper at ICLR 2023 Algorithm 4 Proximal Policy Optization (PPO) for iteration = 0, 1, * * * do for actor = 1, 2, * * * , Nactor do Run policy πψold in environment for T timesteps and save all observations in Q (cid:46) Q is also used to train the classifier module Compute advantage estimate ˆA1, * * * , ˆAT end for Optimizae surrogate (cid:96)rl wrt ψ, with K epochs and minibatch size M ≤ NactorT ψold ← ψ end for E PROOFS OF THEOREM 4.1 For the ease of reading, we present the Theorem 4.1 in Appendix again. Theorem E.1 (Copy of Theorem 4.1). The Cost-F1 Pareto front defined in (1) is a subset of the collection of all reward-shaped solutions, given by Π∗ ⊆ Π := ∪λ≥0,ρ≤0 argmax π {TN(π) + λ * TP(π) + ρ * Cost(π)} . As a natural corollary, we have the following result: Corollary E.1. The Cost-F1 Pareto front defined in (1) is a subset of the solutions of the MDP model for dynamic diagnosis process defined in Section 3 with reward functions: R((s, a) =    ρ * c(a), λ * 1{y = P}, 1{y = N}, if a ∈ [D] (choosing task panels) if a = P (true positive diagnosis) if a = N (true negative diagnosis) , for all pairs of (λ, ρ). Here y denotes the ground-truth label of the patient. Before presenting the proofs for Theorem 4.1, we reintroduce some key notations. First, we define the length of the MDP episode as τ = min{t ≥ 0|at ∈ {P, N}} as a random variable depending on the policy π. Then we can rigorously define the normalized true positive, true negative, false positive and false negative as TP(π) := g(P, P), TN(π) := g(N, N), FP(π) := g(P, N), FN(π) := g(N, P). Here g(i, j) := Eπ[1{aτ = i} * 1{y = j}] denotes the probability of the policy diagnosing class i ∈ {P, N} while the ground truth label is of class j ∈ {P, N}. And the testing cost is defined as: Cost(π) = Eπ   τ −1 (cid:88) (cid:88) c(k) * 1{at = k}  ,  where c(k) is the cost of panel k. t=0 k∈[D] The cumulative state-action occupancy measure μ : ∆S , is defined as A → RS×A (cid:35) ≥0 1(st = s, at = a) , ∀s ∈ S, a ∈ A, μπ(s, a) := Eπ (cid:34) τ (cid:88) t=0 which denotes the expected time spent in state-action pair (s, a) during an episode. There is a one-one correspondence between the policy and the occupancy measure given by π(a|s) = μ(s, a) a∈A μ(s, a) . (cid:80) Proof of Theorem 4.1. We follow the proof framework stated in the main text. 22 Published as a conference paper at ICLR 2023 Step 1: utilizing monotonicity of F1 score To start with, we note that F1 score is monotonically increasing in both true positive and true negative. Assume for any given cost budget B, the optimal policy π∗(B) achieves the highest F1 score. Then π∗(B) is also the optimal to the following program: {TN(π) subject to Cost(π) ≤ B, TP(π) ≥ TP(π∗(B))} , max π indicating the Pareto front of F1 score is a subset of Π∗ ⊆ ∪B>0,B(cid:48)∈[0,1] argmax π {TN(π) subject to Cost(π) ≤ B, TP(π) ≥ B(cid:48)} . (12) Step 2: reformulation using occupancy measures Fix any specific pair (B, B(cid:48)). Consider the equivalent dual linear program form Zhang et al. (2020) of the above policy optimization problem in terms of occupancy measure. Then the program (12) is equivalent to: max μ TN(μ) subject to Cost(μ) ≤ B, TP(μ) ≥ B(cid:48), (cid:88) μ(s, a) = (cid:88) μ(s(cid:48), a(cid:48))P (s|s(cid:48), a(cid:48)) + ξ(s), ∀s, a s(cid:48),a(cid:48)∈[D] where ξ(*) denotes initial distribution, and TP, TN and cost are reloaded in terms of occupancy μ as: TP(μ) = (cid:88) μ(s, a), TN(μ) = (cid:88) μ(s, a), Cost(μ) = (cid:88) c(k) * (cid:88) μ(s, a). s.y=P,a=P s.y=N,a=N k∈[D] s,a=k Step 3: utilizing hidden minimax duality The above program can be equivalently reformulated as a max-min program: max μ min λ≥0,ρ≤0 subject to TN(μ) + λ * (TP(μ) − B(cid:48)) + ρ * (Cost(μ) − B) (cid:88) a μ(s, a) = (cid:88) μ(s(cid:48), a(cid:48))P (s|s(cid:48), a(cid:48)) + ξ(s), ∀s. s(cid:48),a(cid:48)∈[D] Note the max-min objective is linear in terms of λ, ρ and μ. Thus minimax duality holds, then we can swap the min and max to obtain the equivalent form: min λ≥0,ρ≤0 max μ subject to TN(μ) + λ * (TP(μ) − B(cid:48)) + ρ * (Cost(μ) − B) (cid:88) a μ(s, a) = (cid:88) μ(s(cid:48), a(cid:48))P (s|s(cid:48), a(cid:48)) + ξ(s), ∀s. s(cid:48),a(cid:48)∈[D] For any fixed pair of (λ, ρ), the inner maximization problem of the above can be rewritten back in terms of policy π, as the following equivalent unconstrained policy optimization problem: max π TN(π) + λ * TP(π) + ρ * Cost(π). This is finally a standard cumulative-sum MDP problem, with reshaped reward: reward ρ * c(t) for the action of choosing test panel t, reward λ for the action to diagnose and get a true positive, reward 1 for getting a true negative, as stated in Corollary E.1: R((s, a) =    ρ * c(a), λ * 1{y = P}, 1{y = N}, if a ∈ [D] (choosing task panels) if a = P (true positive diagnosis) if a = N (true negative diagnosis) . 23 Published as a conference paper at ICLR 2023 F EXTENSION TO AM METRIC In this section, we show that our framework directly handles classic linear metrics defined as a linear combination of (normalized) true positives and true negatives. We use the AM metric Natarajan et al. (2018); Menon et al. (2013), a linear metric for imbalanced tasks via considering the average of true positive rate and true negative rate, as an example. We can formally define the cost-AM Pareto front as follows: Π∗ AM = ∪B>0 argmax π {AM(π) subject to Cost(π) ≤ B} where AM(π) = 1 respectively as: 2 (TPR(π) + TNR(π)). Here we define the true positive rate and true negative rate TPR(π) := TP(π) TP(π) + FN(π) , TNR(π) := TN(π) TN(π) + FP(π) , where TP(π), TN(π), FP(π), FN(π) are normalized true positive, true negative, false positive and false negative rates that sum up to 1. Let λ > 0 be the known ratio between the number of healthy patients and ill patients. Then we have TP(π)+FN(π) = 1 1+λ , indicating 1+λ and TN(π)+FP(π) = λ AM(π) = 1 + λ 2λ (λTP(π) + TN(π)) Thus, we show the linearity of AM metric, indicating given any fixed budget, the problem already reduced back to a standard MDP. It is a simpler problem and we can directly solve them using our training framework. Rigorously, we have the following result parallel to our Theorem 1: Π∗ AM = ∪ρ≤0 argmax π {TN(π) + λ * TP(π) + ρ * Cost(π)} . Empirically, we show the following Table 9 of our results on AM metric, comparing to the same baselines discussed in our work. The testing costs are similar to the Table 2 in the paper. It is shown that our approach achieves the best AM score while having lower testing costs. Table 9: Model performance measured by balanced accuracy for three real-world clinical dataset. The model yielded the highest balanced accuracy is in bold. Models AKI Metrics AM LR RF XGBoost LightGBM LR (2 panels) RF (2 panels) XGBoost (2 panels) LightGBM (2 panels) SM-DDPO 0.714 0.668 0.644 0.690 0.714 0.660 0.639 0.688 0.741 Cost $591 $591 $591 $591 $92 $92 $92 $92 $92 Ferritin AM 0.842 0.817 0.763 0.832 0.783 0.778 0.683 0.786 0.845 Cost $290 $290 $290 $290 $92 $92 $92 $92 $95 Sepsis AM 0.752 0.722 0.644 0.751 0.746 0.707 0.642 0.737 0.754 Cost $591 $591 $591 $591 $92 $92 $92 $92 $48 G PRECISION AND RECALL We also show the detailed statistics of two sets of optimal solutions that optimizes F1 score and AM metric respectively. It can be shown by comparing Table 10 and 11 that F1 score balances the recall and precision while AM metric balances the true positive and negative rates. 24 Published as a conference paper at ICLR 2023 Table 10: Detailed statistics of our results optimizing F1 score. Dataset Recall 0.664 Ferritin 0.537 AKI 0.573 Sepsis Precision 0.587 0.459 0.551 F1 0.624 0.495 0.562 true positive rate 0.664 0.537 0.573 true negative rate 0.954 0.875 0.921 AM 0.809 0.706 0.747 Table 11: Detailed statistics of our results optimizing AM metric. Dataset Recall 0.798 Ferritin 0.704 AKI 0.613 Sepsis Precision 0.420 0.385 0.497 F1 0.550 0.498 0.549 true positive rate 0.798 0.704 0.613 true negative rate 0.892 0.778 0.895 AM 0.845 0.741 0.754 25
http://arxiv.org/abs/2302.10260v1
2023-02-20T19:46:54
2023-02-20T19:46:54
Unsupervised Learning on a DIET: Datum IndEx as Target Free of Self-Supervision, Reconstruction, Projector Head
Costly, noisy, and over-specialized, labels are to be set aside in favor of unsupervised learning if we hope to learn cheap, reliable, and transferable models. To that end, spectral embedding, self-supervised learning, or generative modeling have offered competitive solutions. Those methods however come with numerous challenges \textit{e.g.} estimating geodesic distances, specifying projector architectures and anti-collapse losses, or specifying decoder architectures and reconstruction losses. In contrast, we introduce a simple explainable alternative -- coined \textbf{DIET} -- to learn representations from unlabeled data, free of those challenges. \textbf{DIET} is blatantly simple: take one's favorite classification setup and use the \textbf{D}atum \textbf{I}nd\textbf{E}x as its \textbf{T}arget class, \textit{i.e. each sample is its own class}, no further changes needed. \textbf{DIET} works without a decoder/projector network, is not based on positive pairs nor reconstruction, introduces no hyper-parameters, and works out-of-the-box across datasets and architectures. Despite \textbf{DIET}'s simplicity, the learned representations are of high-quality and often on-par with the state-of-the-art \textit{e.g.} using a linear classifier on top of DIET's learned representation reaches $71.4\%$ on CIFAR100 with a Resnet101, $52.5\%$ on TinyImagenet with a Resnext50.
[ "Randall Balestriero" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10260v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10260v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.AI", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.AI", "cs.CV", "cs.LG" ]
Unsupervised Learning on a DIET: Datum IndEx as Target Free of Self-Supervision, Reconstruction, Projector Head Randall Balestriero 1 3 2 0 2 b e F 0 2 ] I A . s c [ 1 v 0 6 2 0 1 . 2 0 3 2 : v i X r a Abstract Costly, noisy, and over-specialized, labels are to be set aside in favor of unsupervised learning if we hope to learn cheap, reliable, and transferable models. To that end, spectral embedding, self- supervised learning, or generative modeling have offered competitive solutions. Those methods however come with numerous challenges e.g. es- timating geodesic distances, specifying projector architectures and anti-collapse losses, or speci- fying decoder architectures and reconstruction In contrast, we introduce a simple ex- losses. plainable alternative -coined DIET- to learn representations from unlabeled data, free of those challenges. DIET is blatantly simple: take one's favorite classification setup and use the Datum IndEx as its Target class, i.e. each sample is its own class, no further changes needed. DIET works without a decoder/projector network, is not based on positive pairs nor reconstruction, in- troduces no hyper-parameters, and works out-of- the-box across datasets and architectures. Despite DIET's simplicity, the learned representations are of high-quality and often on-par with the state- of-the-art e.g. using a linear classifier on top of DIET's learned representation reaches 71.4% on CIFAR100 with a Resnet101, 52.5% on TinyIma- genet with a Resnext50. 1. Introduction Unsupervised learning of a model fθ, governed by some parameter θ, has always been and still is one of the most challenging and rewarding task in deep learning (Bengio, 2012). In fact, supervised learning which learns to produce predictions from known input-output pairs can be consid- ered solved in contrast to unsupervised learning which aims to produce descriptive and intelligible representations from inputs only (Hastie et al., 2009; Goodfellow et al., 2016). 1Meta AI, FAIR, NYC, USA. Correspondence to: <[email protected]>. Copyright 2023 by the author(s). Self-Supervised Learning (SSL) (Chen et al., 2020a; Misra & Maaten, 2020) has recently demonstrated that one could learn without labels highly non-trivial Deep Networks (DNs) whose representations are as descriptive as supervised ones. In particular, SSL differs from reconstruction-based meth- ods such as (denoising, variational) Autoencoders (Vincent et al., 2008; 2010; Kingma & Welling, 2013) and their cross- variants by removing the need for a decoder DN and an input-space reconstruction loss, both being difficult to de- sign (Wang et al., 2004; Grimes & Rao, 2005; Larsen et al., 2016; Cosentino et al., 2022a). SSL's recent developments have also led to outperforming reconstruction-free methods e.g. Noise Contrastive Estimation and its variants (Hyväri- nen & Dayan, 2005; Hinton, 2002; Song & Ermon, 2019; Rhodes et al., 2020). Nonetheless, SSL which is the current state-of-the-art unsupervised learning solution, comes with many moving pieces e.g. (i) artificially constructed positive pairs, commonly obtained by applying two a priori known and tailored Data-Augmentations (DAs) to each datum, (ii) a carefully designed projector DN gγ to perform SSL training with the composition gγ ◦ fθ and throwing away the pro- jector gγ afterwards (Chen et al., 2020a), or (iii) advanced anti-collapse techniques involving moving average teacher models (Grill et al., 2020; Caron et al., 2021), representa- tion normalization (Chen & He, 2021; Zbontar et al., 2021), or Entropy estimation (Chen et al., 2020a; Li et al., 2021). An incorrect pick of any of those moving pieces results in a drastic drop in performances (Cosentino et al., 2022b; Bordes et al., 2022). This design sensitivity poses a real challenge as SSL is computationally demanding therefore preventing cross-validation to be employed at every change in the DN's architecture and/or dataset. Even more limiting, SSL's cross-validation relies on assessing the quality of the produced DN through the dataset's labels and test accuracy e.g. from a (supervised) linear probe. This supervised qual- ity assessment is required simply because the actual values of current SSL losses fail to convey any qualitative infor- mation about the representation being learned (Ghosh et al., 2022; Garrido et al., 2022). Instead of further refining of existing SSL methods, and thus inheriting most of their limitations, we propose a stripped down unsupervised learning solution, free of all those chal- lenges -coined DIET. Unsupervised learning on a DIET Unsupervised Learning on a DIET consists in exploiting the most stable and understood set- ting: supervised learning but removing the need for labels by instead using the Datum IndEx as its Target label. Three striking observations will emerge. First, this simple DIET learns high-quality representations that are surprisingly on- par with much more sophisticated state-of-the-art methods. Second, the DIET performs equally well regardless of the dataset and architecture being considered. This is in con- trast with most existing methods that are often architecture specific. Lastly, and perhaps of most importance, the DIET can be employed with low-resources e.g. most of our ex- periments employ a single GPU, and DIET's training loss is informative of downstream performances. Again, since DIET is a supervised learning method with the datum index as target, its training is as stable as the current state-of-the- art supervised methods and any progress made within the supervised learning realm is directly transferable to the pro- posed DIET. We hope that our method provides a novel go-to solution for many practitioners interested in learning high-quality representations, in a stable and minimalist way. We summarize our contributions below: 1. We introduce a DIET for unsupervised learning in Section 3.1 (summarized in Fig. 1), a competitive and minimalist strategy bloating a few key benefits. . . 2. Stable and Out-of-the-box: we validate the DIET on 16 official DN architectures including ConvNexts or ViTs, and on 10 datasets; the same setup (Fig. 2) is successful across all cases (Tables 1 to 3) 3. No hyper-parameter and single-GPU: moving away from decoders/positive pairs/projectors/. . . allows us to propose a DIET introducing no hyper-parameter and requiring only a few lines of code (Algo. 1) and we perform sensitivity analysis on batch size, data- augmentation, training time in Section 3.3 4. Informative training loss: the DIET's training loss strongly correlates with the test accuracy across ar- chitectures and datasets (Fig. 3) enabling informed cross-validation to unsupervised learning Code provided in Algo. 1. 2. Why Unsupervised Learning Needs a DIET The current state of unsupervised learning consists in com- plicated methods combining numerous moving pieces that need re-tweaking for each DN architecture and dataset. As a result reproducibility, scalability, and explainability are hindered. Spectral embedding is untractable. Spectral embedding takes many forms but can be summarized into estimating geodesic distances (Meng et al., 2008; Thomas Fletcher, 2013) between all or some pairs of training samples to then learn a non-parametric (Roweis & Saul, 2000; Belkin & Niyogi, 2001; Balasubramanian & Schwartz, 2002; Brand & Huang, 2003), or parametric (Bengio et al., 2003; Pfau et al., 2018) mapping that produces embeddings whose pair- wise (cid:96)2 distance matches the estimated geodesic ones. As such, spectral embedding heavily relies on the estimation of the geodesic distances which is a challenging problems (Lantuéjoul & Beucher, 1981; Lantuéjoul & Maisonneuve, 1984; Revaud et al., 2015), especially for images and videos (Donoho & Grimes, 2005; Wakin et al., 2005). This limita- tion fueled the development of alternative methods e.g. Self- Supervised Learning (SSL), that often employ similar losses than spectral embedding (HaoChen et al., 2021; Balestriero & LeCun, 2022; Cabannes et al., 2022) but manage to move away from geodesic distance estimation through the ex- plicit generation of positive pairs i.e. samples with known geodesic distances. Self-Supervised Learning is unintelligible. Despite flam- boyant performance reporting and well motivated first prin- ciples, SSL –as of today– falls back to combining numerous hacks driven by supervised performances. In fact, SSL has evolved to a point where novel methods are architecture spe- cific. A few challenges that limit SSL to be widely adopted are (i) loss values which are uninformative of the DN's qual- ity (Reed et al., 2021; Garrido et al., 2022), partly explained by the fact that SSL composes the DN of interest fθ with a projector DN gγ appended to it during training and thrown away afterward, (ii) too many per-loss and per-projector hyper-parameters whose impact on the DN's performances are hard to control or predict (Grill et al., 2020; Tian et al., 2021; He & Ozay, 2022), and which are even widely incon- sistent across datasets and architectures Zhai et al. (2019); Cosentino et al. (2022c), (iii) lack of theoretical guarantees as all existing studies have derived optimality conditions at the projector's output (Wang & Isola, 2020; Tian et al., 2020b; Jing et al., 2021; Huang et al., 2021; HaoChen et al., 2021; Dubois et al., 2022; Zhang & Stratos, 2021; Wang & Liu, 2021) which is not the output of interest since the projector is thrown away after SSL training, and it is known that the DN's output and the projector's output greatly differ, see e.g. Tab. 3, Tab. 1, Tab. 1 and Fig. 1 of (Chen et al., 2020a;b; Cosentino et al., 2022b; Bordes et al., 2022) re- spectively. From a more practical standpoint, SSL requires to generate positive pairs making it much more costly and resource hungry than standard supervised learning. Reconstruction-based learning is unstable. Reconstruc- tion without careful tuning of the loss has been known to be sub-optimal for long (Bishop, 1994; Graves, 2013) and new studies keep reminding us of that (LeCun, 2022). The argument is simple, suppose one aims to minimize a recon- struction metric R for some input x R(dγ(eη(x)), x), (1) where eη and dγ are parametrized learnable encoder and decoder networks respectively; eη(x) is the representation Unsupervised Learning on a DIET Datum IndEx as Target (DIET) • no siamese/teacher-student/projector DN • no representation collapse • informative training loss • out-of-the-box across architectures/datasets datum1 Training dataset datum2 datumN sample a datum index (n) N-output linear layer (logits) . . . T (datumn) (with DA T ) yn X-Ent(n,yn) Figure 1. DIET uses the datum index (n) as the class-target –effectively turning unsupervised learning into a supervised learning problem. In our case, we employ the cross-entropy loss (X-Ent), no extra care needed to handle different dataset or architectures. As opposed to current SOTA, we do not rely on a projector nor positive views i.e no change need to be done to any existing supervised pipeline to obtain the DIET. As highlighted in Fig. 3, DIET's training loss is even informative of downstream test performances, and as ablated in Section 3.3 there is no degradation of performance with longer training, even for very small datasets (Table 3). Deep Network of interest to be used after training. In practice, as soon as some noise (cid:15) is present in the data, i.e. we observe x + (cid:15) and not x, that noise (cid:15) must be encoded by eη to minimize the loss from Eq. (1) unless one carefully designs R so that R(x + (cid:15), x) = 0. However, designing such a noise invariant R has been attempted for decades (Park, 1995; Si- moncelli, 1996; Fienup, 1997; Grimes & Rao, 2005; Wang & Simoncelli, 2005) and remains a challenging open prob- lem. Hence, many solutions rely on learning R e.g. in VAE-GANs (Larsen et al., 2016) bringing even further insta- bilities and training challenges. Other alternatives carefully tweak R per dataset and architectures e.g. to only compute the reconstruction loss on parts of the data as with BERT Devlin et al. (2018) or MAEs He et al. (2022). Lastly, the quality of the encoder's representation depends on its ar- chitecture but also on the decoder's one (Yang et al., 2017; Xu et al., 2021) making cross-validation more costly and unstable (Antun et al., 2020). In numerous scenarios one finds themselves in a position where none of the existing state-of-the-art's limitations can be overcome –motivating the development of our DIET– an overly simple yet highly effective unsupervised learn- ing strategy that inherits none of the aforementioned chal- lenges. 3. Unsupervised Learning on a DIET We first present in Section 3.1 the DIET enabling compet- itive yet simple unsupervised learning; in particular, Sec- tions 3.2 and 3.3 will demonstrate how that DIET competes and sometimes outperforms SSL on a variety of small to medium scale datasets while working out-of-the-box across architectures. Section 3.4 will then demonstrate how to scale DIET to large datasets such as Imagenet and INaturalist. 3.1. The DIET: Datum IndEx as Target The goal of this section is to introduce the proposed DIET, focusing on its simplicity and ease of implementation. Em- pirical validation of the method is deferred to the subsequent Sections 3.2 to 3.4 as summarized as the end of this section. Algorithm: As well indicated by its name, Datum IndEx as Target (DIET) proposes to perform unsupervised learning by employing the datum index as its target class. That is, given a dataset of N samples {x1, . . . , xN }, define the class of sample xn with n ∈ {1, . . . , N } to be n itself, leading to the DIET's loss LDIET for a datum to be LDIET(xn) = ClassificationLoss(W fθ(xn), n), (2) given a sample xn ∈ RD, a DN fθ : RD (cid:55)→ RK, DIET's linear classifier W ∈ RK×N , and one's preferred classifi- cation loss. Unless one expects to sample some data more than others, there is no reason to add a bias vector to DIET's linear classifier. As such, DIET performs unsupervised learning through a supervised scheme meaning that any progress made within the supervised learning realm can be ported as-is to DIET. Throughout our study, we will be employing the cross-entropy loss, denoted as X-Ent. We summarize DIET in Fig. 1 and propose its pseudo-code in Algo. 1 as well as the code to obtain a data loader providing the user with the indices (n) in Algo. 2. Unsupervised Learning on a DIET Algorithm 1 DIET's algorithm, minimal code refactoring is re- quired to employ the DIET given any already built deep learning pipeline, to obtain a dataset that provides the indices (n), see Algo. 2, (nn stands for torch.nn, Pytorch used for illustration). # t a k e any p r e f e r r e d DN e . g . # s e e Algo. 3 f o r o t h e r e x a m p l e s f = t o r c h v i s i o n . m o d e l s . r e s n e t 5 0 ( ) # fθ i n Eq. (2) r e s n e t 5 0 # f comes w i t h a c l a s s i f i e r , K = f . f c . i n _ f e a t u r e s # = fθ ' s o u t p u t dim . f . f c = nn . I d e n t i t y ( ) # remove i t l e t ' s remove i t s o f=fθ i n Eq. (2) # d e f i n e DIET ' s c l a s s i f i e r and X−Ent W = nn . L i n e a r (K , N, b i a s=F a l s e ) # W in Eq. (2) d i e t _ l o s s = nn . C r o s s E n t r o p y L o s s ( l a b e l _ s m o o t h i n g =0.8) l i n e a r # s t a r t DIET t r a i n i n g (Fig. 1) y i s o p t i o n a l f o r x , n i n t r a i n _ l o a d e r : # s e e Algo. 2 f o r p r e d s = f ( t ( x ) ) # t a p p l i e s l o s s = d i e t _ l o s s (W( p r e d s ) , n ) # Eq. (2) # p r o c e e d w i t h b a c k p r o p / o p t i m i z e r / s c h e d u l e r l o a d e r t h e DA (T in Fig. 1) Algorithm 2 Custom loader (train_loader in Algo. 1) to obtain the indices (n) in addition to the inputs xn and (optionally) the labels yn (Pytorch used for illustration). from t o r c h . u t i l s . d a t a i m p o r t D a t a s e t , D a t a L o a d e r c l a s s D a t a s e t W i t h I n d i c e s ( D a t a s e t ) : d e f __init__ ( s e l f , d a t a s e t ) : s e l f . d a t a s e t = d a t a s e t t r u e d e f __getitem__ ( s e l f , n ) : l a b e l # i f x , _ = s e l f . d a t a s e t [ n ] r e t u r n x , n d e f __len__ ( s e l f ) : c l a s s i s g i v e n , d i s r e g a r d i t r e t u r n l e n ( s e l f . d a t a s e t ) t r a i n _ l o a d e r w i t h CIFAR100 # e x a m p l e o f CIFAR100 = t o r c h v i s i o n . d a t a s e t s . CIFAR100 ( r o o t ) CIFAR100_w_ind = D a t a s e t W i t h I n d i c e s ( CIFAR100 ) t r a i n _ l o a d e r = D a t a L o a d e r ( C100_w_ind ) Benefits: We ought to highlight three key benefits of DIET's Eq. (2). First, the amount of code refactoring is minimal (recall Algo. 1): there is no change to be done into the data loading pipelines (recall Algo. 2) as opposed to SSL which requires positive pairs, no need to specify teacher-student architectures, and no need to design a projector/predictor DN. Second, DIET's implementation is not architecture specific as we will validate on Resne(x)ts, ConvNe(x)ts, Vision Transformers and their variants. Third, DIET does not introduce any additional hyper-parameters in addition to the ones already present in one's favorite ClassificationLoss used in Eq. (2), all while providing a training loss that is informative of test time performances, as we depict in Fig. 3. Relation to previous methods: Despite DIET's simplic- ity, we could not find an existing method that considered it perhaps due to the common –but erroneous– belief that deal- ing with hundreds of thousands of classes (N in Fig. 1, the training set size) would not produce successful training. As such, the closest method to ours is Exemplar CNN (Alexey et al., 2015) which extracts a few patches from a given image dataset, and treat each of them as their own class; this way the number of classes is the number of extracted patches, which is made independent from N. Performances are however far below SSL methods. A more recent method, Instance Discrimination (Wu et al., 2018) extends Exemplar CNN by introducing inter-sample discrimination. However, they do so using a non-parametric softmax i.e. by defining a learnable bank of centroids to cluster training samples; for successful training those centroids must be regularized to prevent representation collapse. As we will compare in Table 1, DIET outperforms Instance Discrimination while being simpler. Lastly, methods such as Noise as Targets (Bojanowski & Joulin, 2017) and DeepCluster (Caron et al., 2018) are quite far from DIET as (i) they perform clustering and use the datum's cluster as its class i.e. greatly reducing the dependency on N, and (ii) they perform such clustering in the output space of the model fθ being learned which brings multiple collapsed solutions requiring those methods to employ complicated mechanisms to ensure training to learn non-trivial representations. Empirical validation roadmap: To support the different claims we have made above, we propose to scatter our em- pirical validation in a few subsequent sections. First, we will explore small and medium scale datasets in Section 3.2 that include the eponymous CIFAR100 but also other datasets such as Food101 which have been challenging for SSL. In fact, whenever the number of training samples is small, most SSL methods favor Imagenet pre-training and few- shot transfer learning. In Section 3.2 we will also consider TinyImagenet and Imagenet-100. After having validated the ability of DIET to match and sometimes outperform SSL methods, we will spend Section 3.3 to probe the few hyper-parameters that govern DIET, in our case the label smoothing of the X-Ent loss, and the training time. We will see that without label smoothing, DIET is often as slow as SSL methods to converge, and sometimes slower –but that high values of label smoothing greatly speed up conver- gence. Lastly, we dedicate Section 3.4 to scaling up DIET to large dataset such as Imagenet and INaturalist. In fact, recall from Fig. 1 that DIET's N-output classifier becomes a memory bottleneck when N is large in which case a slightly different treatment is required to employ DIET. We will see that even the most naive solutions e.g. subsampling of a large dataset enables to apply DIET as-is all while producing highly competitive performances. Throughout our subsequent empirical validation, we will religiously follow the experimental setup described in Fig. 2, unless stated otherwise. Our goal in adopting the same setup across experiments is to highlight the stability of DIET to dataset and architectural changes; careful tuning of those design choices should naturally lead to greater performance if desired. Unsupervised Learning on a DIET DIET's experimental setup: • Official Torchvision architectures in init./arch.), only swapping the classification layer with DIET's one (right of Fig. 1), no projector DN (no changes • Same DA pipeline (T in Fig. 1) across datasets/architec- tures with batch size of 256 to fit on 1GPU • AdamW optimizer with linear warmup (10 epochs) and cosine annealing learning rate schedule, X-Ent loss (right of Fig. 1) with label smoothing of 0.8 • Learning rate/weight-decay of 0.001/0.05 for non trans- former architectures and 0.0002/0.01 for transformers Figure 2. In underlined are the design choices directly ported from standard supervised learning (not cross-validated for DIET), in italic are the design choices cross-validated for DIET but held constant across this study unless specified otherwise. Batch-size sensitivity analysis is reported in Ta- ble 4 and Fig. 7 showing that performances do not vary when taking values from 32 to 4096. X-Ent's label smoothing parameter plays a role into DIET's convergence speed, and is cross-validated in Fig. 6 and Table 5; we also report DA ablation in Fig. 8 and Table 6. 3.2. The DIET Competes with the State-Of-The-Art We start the empirical validation of DIET on the eponymous CIFAR100 dataset; following that, we will consider other common medium scale datasets e.g. TinyImagenet, and in particular we will consider datasets such as Food101, Flowers102 for which current SSL does not provide working solutions and for which the common strategy consists in transfer learning. We will see in those cases that applying DIET as-is on each dataset is able to produce high-quality representations for a large set of DN architectures. CIFAR100: Let's first consider CIFAR-100 (Krizhevsky et al., 2009) with a few variations of Resnet (He et al., 2016) and AlexNet (Krizhevsky, 2014). To accomodate with the 32 × 32 resolution, we follow the standard procedure to slightly modify the ResNet architecture: the first convolu- tion layer sees its kernel size go from 7×7 to 3 × 3 and its stride reduce from 2 to 1; the max pooling layer fol- lowing it is removed (details in Algo. 3). On Alexnet, a few non-SSL baselines are available, and we thus compare with SplitBrain (Zhang et al., 2017), DeepCluster (Caron et al., 2018), InstDisc (Wu et al., 2018) (closest to ours, see Section 3.1), AND (Huang et al., 2019), SeLa (Asano et al., 2019), ReSSL (Zheng et al., 2021). The models are trained and linear evaluation is employed to judge the quality of the learned model to solve the original classification task; results are reported in Table 1. We observe that DIET is able to match and often slightly exceed current SSL meth- ods. In particular, even though CIFAR100 is a relatively small dataset, increasing the DN capacity i.e. going from Resnet18 to Resnet101 does not exhibit any overfitting. Table 1. CIFAR100/linear-probe/single-GPU: with the settings of Fig. 2 and optionally longer training (LT) or different label- smoothing (ls) specified, notice the consistent progression of the performance through architectures which is not easily achieved in SSL. In particular, we recall that the alternative methods all employ (except MoCo) a projector network (recall Section 2). Benchmarks taken from † :Ho & Nvasconcelos (2020); ‡ :Peng et al. (2022); ∗:Zhang et al. (2022); •:Pham et al. (2022); (cid:5):da Costa et al. (2022); (cid:63):Yeh et al. (2022); (cid:47):Ren et al. (2022); (cid:46):Yang et al. (2022); (cid:3):Huang et al. (2022). Resnet18 MoCoV2 SimSiam SimCLR SimMoCo ReSSL SimCLR+adv MoCo SimCLR MoCo+CC SimCLR DINO SimCO SimCLR+DCL SimCLR SimCLR W-MSE SimCLR+CC BYOL MoCoV2 DIET BYOL DIET (LT) BYOL+CC SimSiam SwAV SimCLR SimSiam+CC 53.28∗ 53.66• 53.79† 54.11∗ 54.66• 55.51† 56.10‡ 56.30(cid:63) 57.65‡ 57.81(cid:46) 58.12• 58.35∗ 58.50† 60.30‡ 60.45• 61.33(cid:5) 61.91‡ 62.01• 62.34• 62.93 63.75‡ 63.77 64.62‡ 64.79‡ 64.88(cid:5) 65.78(cid:5) 65.82‡ Resnet50 52.04† SimCLR 53.44∗ MoCoV2 54.64∗ SimMoCo 57.71† SimCLR+adv 58.48∗ SimCO 61.10(cid:63) SimCLR SimCLR+DCL 62.20(cid:63) 68.96 DIET 69.00(cid:47) MoCoV3 69.56 DIET (ls:0.95) 69.91 DIET (LT) Resnet101 SimCLR SimCLR+adv MoCoV3 DIET DIET (ls:0.95) DIET (LT) AlexNet SplitBrain InstDisc DeepCluster AND DIET SeLa 52.28† 59.02† 68.50(cid:47) 70.29 71.09 71.39 39.00(cid:3) 39.40(cid:3) 41.90(cid:3) 47.90(cid:3) 48.25 57.40(cid:3) TinyImagenet and IN-100: We continue our empirical validation by now considering the more challenging Ima- genet100 (IN100) (Tian et al., 2020a) dataset which consists of 100 classes of the full Imagenet-1k dataset, the list of classes can be found online1 and the TinyImagenet (Le & Yang, 2015) dataset. Thanks to the higher resolution images present in those datasets, 224 × 224 and 64 × 64 respec- tively, we broaden the range of architecture we consider to include the Resnet variants of the previous section, Swin- Transformer (Liu et al., 2021), VisionTransform (Dosovit- skiy et al., 2020), Densenet (Huang et al., 2017), ConvNext (Liu et al., 2022), WideResnet (Zagoruyko & Komodakis, 2016), ResNext (Xie et al., 2017), and the MLPMixer (Tol- stikhin et al., 2021). We report DIET and benchmark results in Table 2 where we now see that while on TinyImagenet, DIET is able to again strongly match SSL methods, DIET fall on the lower end of the spectrum on Imagenet100. Again we recall that as opposed to competing methods, DIET does 1https://github.com/HobbitLong/CMC/blob/ master/imagenet100.txt Unsupervised Learning on a DIET Figure 3. Depiction of the DIET's training loss (y-axis) against the online test linear probe accuracy (x-axis) for all the models and hyper-parameters corresponding to the experiments of Table 1 for CIFAR100 (left column), and Table 2 for IN100 and TinyImagenet (middle and left columns). We colorize (yellow to blue) the points based on the strength of the label smoothing parameter (recall that it plays a role in DIET's convergence speed from Section 3.3). We clearly identify that for a given label smoothing parameter, there exists a strong relationship between DIET's training loss and the test accuracy showing that model selectin can be performed this way. Therefore, even without labels, DIET's loss can be used as a quantitative quality assessment measure of one's model. The shift observed for different values of label smoothing can be accounted for to re-calibrate all the experiment if needed using the known relationship between that increasing the label smoothing parameter decreases the X-Ent loss, everything else equal. Figure 4. Depiction of DIET's performances (red) against the supervised (blue) using a controlled training set size (x-axis), subsampled from the original training set and identical between methods; evaluation is performed over the original full evaluation set and conducted on various dataset (rows) and architectures (columns). We see that for small training set size, DIET is able to match and sometimes even outperform the supervised benchmark. See Fig. 5 for additional datasets, in the Appendix. not employ any projector DN. Small datasets with and without pre-training: We con- clude the first part of our empirical validation by consid- ering datasets that are commonly handled by SSL through transfer learning: Aircraft (Maji et al., 2013), DTD (Cimpoi et al., 2014), Pets (Parkhi et al., 2012), Flowers (Nilsback & Zisserman, 2008), CUB200 (Wah et al., 2011), Food101 (Bossard et al., 2014), Cars (Krause et al., 2013), where the numbers of training samples and classes are given in Table 3. The goal is to apply DIET directly on those dataset, without any pre-training, a feast that as far as we are aware, SSL was not able to perform successfully. We thus report those performances in Table 3. We see that DIET competes with SSL pre-trained models in most of the cases, and arrives not far behind for very small dataset which are DTD, Pets, Flower which contain 1880, 2940 and 1020 training samples Unsupervised Learning on a DIET Table 2. TinyImagenet+IN100/linear-probe/single-GPU: with the settings of Fig. 2, as per Table 1, notice the consistent pro- gression of the performance through architectures. We observe that DIET comes on par (higher-end for TinyImagenet and lower- end for IN100) with SSL methods. Benchmarks are taken from 1:(Dubois et al., 2022), 2 :(Ozsoy et al., 2022) TinyImagenet Resnet18 SimSiam DIET SimCLR BYOL MoCo SimClR DINO 44.54 ‡ 45.07 46.21‡ 47.23‡ 47.98 ‡ 48.70 1 49.20 1 Resnet50 SimCLr SimSiam Spectral DIET CorInfoMax 54.86 2 48.12 2 46.76 2 49.86 2 51.66 DIET (other archs.) resnet34 resnet101 wide_resnet50_2 resnext50_32x4d densenet121 47.04 51.86 50.03 52.45 49.38 convnext_tiny convnext_small MLPMixer swin_t vit_b_16 Imagenet-100 (IN100) Resnet18 50.88 50.05 39.32 50.80 48.38 SimMoCo MocoV2 SimCo DIET W-MSE2 ReSSL DINO MoCoV2 BYOL SimCLR SimCLR MocoV2 VICReg Barlow 58.20∗ 60.52∗ 61.28 ∗ 64.31 69.06 2 74.02• 74.16• 76.48• 76.60• 77.042 78.722 79.282 79.402 80.382 Resnet50 73.50 DIET 75.60 (cid:63) MoCo+Hyper. 76.80 (cid:63) MoCo+DCL MoCoV2 + Hyper. 77.70 (cid:63) 78.76 2 BYOL MoCoV2 + DCL 80.50 (cid:63) 80.70 (cid:63) SimCLR 81.602 SimSiam 83.10 (cid:63) SimCLR + DCL DIET (other archs.) wide_resnet50_2 resnext50_32x4d densenet121 convnext_tiny 71.92 73.07 67.46 69.77 convnext_small MLPMixer swin_t vit_b_16 71.06 56.46 67.02 62.63 respectively. Even then, we see that IN100 pre-training and Resnet18 is near DIET's performances, and that a stronger gap only appears using SSL pre-training on imagenet-1k with a Resnet50. We additionally propose in Fig. 4 the direct comparison of DIET with supervised learning on a variety of models and dataset but with controlled training size. We clearly observe that for small dataset i.e. for which we only use a small part of the original training set, DIET is matching supervised performances, which can be considered as ideal since in this setting the data dataset and task is used for evaluation (on the full evaluation dataset). 3.3. DIET's Dependency on Data-Augmentation, Training Time and Optimizer We hope in this section to better inform practitioners on the role of Data-Augmentations (DA), training time, and label smoothing into DIET's performances; as well as sensitivity to mini-batch size, which is crucial for single-GPU training. Batch-size does not impact performances. One important question when it comes to training a method with low re- sources is the ability to employ (very) small mini-batch sizes. This is in fact one reason hindering at the deployment of SSL methods which require quite large mini-batch sizes to work (256 is a strict minimum in most cases). We thus propose in Table 4 a small sensitivity analysis where we vary the mini-batch size from 8 to 2048 –without any tun- ing of the hyper-parameters– we use the standard learning rate scaling used in supervised learning: lr = 0.001 bs 256 . We observe small fluctuations of performances (due to a sub-optimal learning rate) but no significant drop in per- formance, even for mini-batch size of 32. When going to 16 and 8, we observe slightly lower performances which we believe to emerge from batch-normalization (Ioffe & Szegedy, 2015) which is known to behave erratically below a mini-batch size of 32 (Ioffe, 2017). Data-Augmentations sensitivity is similar to SSL. We ob- served in the previous Section 3.2 that when using DA, the proposed DIET was able to almost match high engineered state-of-the-art methods, which should reassure the reader on the usefulness of the method. Yet, knowing which DA to employ is not trivial e.g. many data modalities have no know DA. One natural question is thus around the sensi- tivity of DIET's performance to the employed DA. To that end, we propose three DA regimen, one only consistent of random crop and horizontal flips (strength:1), which could be consider minimal in computer vision, one which adds color jittering and random grayscale (strength:2), and one last which further adds Gaussian blur and random eras- ing (Zhong et al., 2020) (strength:3); the exact parameters for those transformations are given in Algo. 4. We ob- serve on TinyImagenet and with a Resnet34 the following performances 32.93± 0.6, 45.60± 0.2, and 45.75± 0.1 re- spectively over 5 independent runs, details and additional architectures provided in Fig. 8 and Table 6 in the Appendix. We thus observe that while DIET greatly benefit from richer DA (strength:1 (cid:55)→ 2), it however does not require heavier transformation such as random erasing. Convergence is slower than SSL but label smoothing helps. One important difference in training behavior be- tween supervised learning and SSL is in the number of epochs required to see the quality of the representation Unsupervised Learning on a DIET 47 No Yes None Arch. IN100† Resnet18 1880 2940 Pretrained Frozen Table 3. Depiction of in-distribution and out-distribution (transfer) performances of DIET on a variety of datasets. They key observation is that even on small datasets such as Cars, Aircraft, DIET is able without any pretraining to come on-par with SSL performances obtained through Imagenet-1k pretraining. In addition, for medium scale dataset such as Food101, we see how DIET is able to significantly outperform SSL methods in both cases where we use DIET without pre-training, or when DIET is used to pretrain the architecture on another dataset. We also report performances for a ViT based architecture (SwinTiny) to demonstrate the ability of DIET to handle different models out-of-the-box, as per Fig. 2, we only adapted the learning rate and weight decay parameters. Every DIET run in this table is done on 1GPU and using a batch-size of 128. †:(Yang et al., 2022), +:(Ericsson et al., 2021) Aircraft DTD Pets Flower CUB-200 Food101 StanfordCars Method/Dataset 6667 N= 100 C= SimCLR 24.19 SimCLR + CLAE 25.87 SimCLR + IDAA 26.02 37.29 DIET 36.87 InsDis 35.55 MoCo 21.61 PCL. 37.08 PIRL 37.03 PCLv2 44.90 SimCLR 41.79 MoCov2 46.38 SimCLRv2 37.29 SeLav2 38.58 InfoMin 53.87 BYOL 54.49 DeepClusterv2 54.04 Swav 44.81 DIET 32.77 DIET 36.20 DIET 35.58 DIET 33.15 DIET 43.13 DIET 1020 102 37 54.35 46.46 75.00 52.12 43.55 76.82 54.97 46.76 77.99 50.62 64.06 72.01 68.46 68.78 83.44 68.83 69.84 82.10 62.87 75.34 64.73 68.99 71.36 83.60 70.59 82.79 85.34 74.20 83.33 90.87 73.88 83.30 90.07 76.38 84.72 92.90 74.15 83.22 90.22 74.73 86.24 87.18 76.91 89.10 94.50 78.62 89.36 94.72 77.02 87.60 94.62 51.75 67.08 73.32 49.34 54.56 67.89 53.85 59.77 77.22 53.48 60.81 77.16 51.88 58.06 70.78 49.52 61.72 67.72 68175 101 - - - 62.00 63.39 62.10 48.02 64.65 64.88 67.47 68.95 73.08 71.08 69.53 73.01 77.94 76.62 71.58 80.43 80.92 81.07 68.86 69.84 11788 200 16.73 17.58 18.15 33.03 - - - - - - - - - - - - - 41.03 24.98 30.31 32.11 32.11 31.44 6509 196 - - - 42.55 28.98 27.99 12.93 28.72 30.51 43.73 39.31 50.37 36.86 41.01 56.40 58.60 54.06 55.82 34.45 39.96 41.12 47.12 40.63 None Tiny IN100 IN-1k None SwinTiny ConvnextSmall None No Yes Yes Yes No No Resnet50 IN-1k+ Yes Table 4. TinyImagenet/Resnet18/single-GPU batch-size sensi- tivity: top1 test accuracy after a fixed number of epochs (3k) and a single learning rate which is adjusted for each batch-size using lr = 0.001 bs 256 ; therefore performing per batch-size cross- validation will improve the reported numbers. We observe that DIET is able to perform well across the spectrum of batch sizes and will a slight drop in performance for very small batch size (8, 16) which is by batch-normalization as (Ioffe, 2017) identified 32 to be the minimal working batch-size. Due to large batch sizes being faster (see Fig. 7 for training times), this should be the preferred solution unless hardware constraint is present. 64 128 256 512 1024 2048 32 bs acc. 32.9 37.9 42.7 43.4 43.3 43.7 43.7 42.6 41.2 16 8 plateau. Due to the supervised loss used in DIET, one might wonder how is the training behavior in our case. We observe that the convergence speed of DIET sometimes on-par but often slower than that of SSL in term of number of epochs required to reach a plateau –at least without using label smoothing. In fact, we surprisingly observe that by enabling large values of label smoothing, e.g. 0.8, it was possible to obtain faster convergence. We provide a sensitivity analysis in Fig. 6 and Table 5 in the Appendix. We believe that con- vergence speed could be improved by designing improved update mechanism for DIET's linear classifier. In fact, one should recall that within a single epoch, only one of each datum/class is observed, making the convergence speed of the classifier's W matrix the main limitation; we hope to ex- plore improved training strategies in the future as discussed in Section 4. 3.4. Pushing the DIET to Large Models and Datasets Given DIET's formulation of considering each datum as its own class, it is natural to ask ourselves how scalable is such a method. Although we saw that on small and medium scale dataset, DIET's was able to come on-par with most current SSL methods, it is not clear at all it remains true for larger datasets. In this section we briefly describe what can be done to employ DIET on datasets such as Imagenet and INaturalist. The first dataset we consider is INaturalist which contains slightly more than 500K training samples for its mini ver- sion (the one commonly employed, see e.g. (Zbontar et al., 2021)). It contains almost 10K actual classes and most SSL methods focus on transfer learning e.g. transferring with a Resnet50 from Imagenet-1k lead to SimCLR's 37.2%, MoCoV2's 38.6, BYOL's 47.6 and BarlowTwins'46.5. How- ever training on INaturalist directly produces lower perfor- Unsupervised Learning on a DIET mances reaching only 29.1 with MSN and a ViT. Using DIET is possible out-of-the-box with Resnet18 and ViT variants as their embedding is of dimension 512 and 762 respectively making W fit in memory. We obtain 22.81 with a convnext small, and 21.6 with a ViT. The second dataset we consider is the full Imagenet-1k dataset which contains more than 1 million training samples and 1000 actual classes. In this case, it is not possible to directly hold W in-memory. We however tried a simple strategy which simply consists of sub-sampling the training set to a more reasonable size. This means that although we are putting aside many training images, we enable sin- gle GPU Imagenet training with DIET. With a training size of 400K, we able to reach 44.05 with a convnext small, 43.78 with a SwinTiny, and 44.89 with a ViT/B/16. A stan- dard SSL pipeline has performances ranging between 64% and 72%. From those experiments, it is clear that DIET's main limitation comes from very large training set sizes. Although the above simple strategy offers a workable so- lution, it is clearly not sufficient to match with existing unsupervised learning method and thus should require fur- ther consideration. As highlighted in Section 4 below, this is one key avenue for future work. 4. Conclusions and Future Work We presented a simple unsupervised learning method coined DIET, for Datum IndEx as Target, which simply casts the task of descriptive representation learning with Deep Net- works (DNs) into a supervised problem of instance dis- crimination. Despite its simplicity, DIET is able to learn competitive representations that are often on-par with cur- rent state-of-the-art methods e.g. Self-Supervised Learning (SSL). We believe that DIET provides an out-of-the-box so- lution for many situations since (i) its training loss functions is informative of the downstream task test accuracy, (ii) it does not introduce any additional hyper-parameters, and training works seamlessly across architectures, and (iii) its implementation is requiring nearly no code refactoring from already built supervised pipelines, which contrast with e.g. SSL or autoencoders for which complicated data pipelines and additional DN specification. That being said, DIET suffers from one main limitations: the computational and memory complexity grows linearly with the dataset size, opening a few avenues. To speed up training, a smarter initialization of the N-output classifier could be envisioned, along with a possibly differ- ent learning schedule for this large matrix and for the rest of the DN. References Alexey, D., Fischer, P., Tobias, J., Springenberg, M. R., and Brox, T. Discriminative unsupervised feature learn- ing with exemplar convolutional neural networks. IEEE Trans. Pattern Analysis and Machine Intelligence, 99, 2015. Antun, V., Renna, F., Poon, C., Adcock, B., and Hansen, A. C. On instabilities of deep learning in image recon- struction and the potential costs of ai. Proceedings of the National Academy of Sciences, 117(48):30088–30095, 2020. Asano, Y. M., Rupprecht, C., and Vedaldi, A. Self-labelling via simultaneous clustering and representation learning. arXiv preprint arXiv:1911.05371, 2019. Balasubramanian, M. and Schwartz, E. L. The isomap algorithm and topological stability. Science, 295(5552): 7–7, 2002. Balestriero, R. and LeCun, Y. Contrastive and non- contrastive self-supervised learning recover global and arXiv preprint local spectral embedding methods. arXiv:2205.11508, 2022. Belkin, M. and Niyogi, P. Laplacian eigenmaps and spectral techniques for embedding and clustering. Advances in neural information processing systems, 14, 2001. Bengio, Y. Deep learning of representations for unsuper- In Proceedings of ICML vised and transfer learning. workshop on unsupervised and transfer learning, pp. 17– 36. JMLR Workshop and Conference Proceedings, 2012. Bengio, Y., Paiement, J.-f., Vincent, P., Delalleau, O., Roux, N., and Ouimet, M. Out-of-sample extensions for lle, isomap, mds, eigenmaps, and spectral clustering. Ad- vances in neural information processing systems, 16, 2003. Bishop, C. M. Mixture density networks. 1994. Bojanowski, P. and Joulin, A. Unsupervised learning by predicting noise. In International Conference on Machine Learning, pp. 517–526. PMLR, 2017. Bordes, F., Balestriero, R., Garrido, Q., Bardes, A., and Vincent, P. Guillotine regularization: Improving deep networks generalization by removing their head. arXiv preprint arXiv:2206.13378, 2022. Bossard, L., Guillaumin, M., and Van Gool, L. Food-101 – mining discriminative components with random forests. In European Conference on Computer Vision, 2014. Unsupervised Learning on a DIET Brand, M. and Huang, K. A unifying theorem for spectral embedding and clustering. In International Workshop on Artificial Intelligence and Statistics, pp. 41–48. PMLR, 2003. Devlin, J., Chang, M.-W., Lee, K., and Toutanova, K. Bert: Pre-training of deep bidirectional transformers for lan- guage understanding. arXiv preprint arXiv:1810.04805, 2018. Cabannes, V., Bietti, A., and Balestriero, R. On minimal variations for unsupervised representation learning. arXiv preprint arXiv:2211.03782, 2022. Donoho, D. L. and Grimes, C. Image manifolds which are isometric to euclidean space. Journal of mathematical imaging and vision, 23(1):5–24, 2005. Caron, M., Bojanowski, P., Joulin, A., and Douze, M. Deep clustering for unsupervised learning of visual features. In Proceedings of the European conference on computer vision (ECCV), pp. 132–149, 2018. Caron, M., Touvron, H., Misra, I., Jégou, H., Mairal, J., Bojanowski, P., and Joulin, A. Emerging properties in self-supervised vision transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 9650–9660, 2021. Chen, T., Kornblith, S., Norouzi, M., and Hinton, G. A simple framework for contrastive learning of visual rep- In International conference on machine resentations. learning, pp. 1597–1607. PMLR, 2020a. Chen, X. and He, K. Exploring simple siamese represen- tation learning. In Proceedings of the IEEE/CVF Con- ference on Computer Vision and Pattern Recognition, pp. 15750–15758, 2021. Chen, X., Fan, H., Girshick, R., and He, K. Improved baselines with momentum contrastive learning. arXiv preprint arXiv:2003.04297, 2020b. Cimpoi, M., Maji, S., Kokkinos, I., Mohamed, S., , and Vedaldi, A. Describing textures in the wild. In Proceed- ings of the IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2014. Cosentino, R., Balestriero, R., Bahroun, Y., Sengupta, A., Baraniuk, R., and Aazhang, B. Spatial transformer k- means. arXiv preprint arXiv:2202.07829, 2022a. Cosentino, R., Sengupta, A., Avestimehr, S., Soltanolkotabi, M., Ortega, A., Willke, T., and Tepper, M. Toward a geometrical understanding of self-supervised contrastive learning. arXiv preprint arXiv:2205.06926, 2022b. Cosentino, R., Shekkizhar, S., Soltanolkotabi, M., Aves- timehr, S., and Ortega, A. The geometry of self- supervised learning models and its impact on transfer learning. arXiv preprint arXiv:2209.08622, 2022c. Dosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., Dehghani, M., Minderer, M., Heigold, G., Gelly, S., et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020. Dubois, Y., Hashimoto, T., Ermon, S., and Liang, P. Improv- ing self-supervised learning by characterizing idealized representations. arXiv preprint arXiv:2209.06235, 2022. Ericsson, L., Gouk, H., and Hospedales, T. M. How well do self-supervised models transfer? In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 5414–5423, 2021. Fienup, J. R. Invariant error metrics for image reconstruc- tion. Applied optics, 36(32):8352–8357, 1997. Garrido, Q., Balestriero, R., Najman, L., and Lecun, Y. Rankme: Assessing the downstream performance of pretrained self-supervised representations by their rank. arXiv preprint arXiv:2210.02885, 2022. Ghosh, A., Mondal, A. K., Agrawal, K. K., and Richards, B. Investigating power laws in deep representation learning. arXiv preprint arXiv:2202.05808, 2022. Goodfellow, I., Bengio, Y., Courville, A., and Bengio, Y. Deep learning, volume 1. MIT Press, 2016. Graves, A. Generating sequences with recurrent neural networks. arXiv preprint arXiv:1308.0850, 2013. Grill, J.-B., Strub, F., Altché, F., Tallec, C., Richemond, P., Buchatskaya, E., Doersch, C., Avila Pires, B., Guo, Z., Gheshlaghi Azar, M., et al. Bootstrap your own latent-a new approach to self-supervised learning. Advances in neural information processing systems, 33:21271–21284, 2020. Grimes, D. B. and Rao, R. P. Bilinear sparse coding for invariant vision. Neural computation, 17(1):47–73, 2005. da Costa, V. G. T., Fini, E., Nabi, M., Sebe, N., and Ricci, E. solo-learn: A library of self-supervised methods for visual representation learning. J. Mach. Learn. Res., 23: 56–1, 2022. HaoChen, J. Z., Wei, C., Gaidon, A., and Ma, T. Provable guarantees for self-supervised deep learning with spec- tral contrastive loss. Advances in Neural Information Processing Systems, 34:5000–5011, 2021. Unsupervised Learning on a DIET Hastie, T., Tibshirani, R., and Friedman, J. Overview of su- pervised learning. In The elements of statistical learning, pp. 9–41. Springer, 2009. Jing, L., Vincent, P., LeCun, Y., and Tian, Y. Understand- ing dimensional collapse in contrastive self-supervised learning. arXiv preprint arXiv:2110.09348, 2021. He, B. and Ozay, M. Exploring the gap between collapsed & whitened features in self-supervised learning. In Interna- tional Conference on Machine Learning, pp. 8613–8634. PMLR, 2022. He, K., Zhang, X., Ren, S., and Sun, J. Deep residual learn- ing for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016. He, K., Chen, X., Xie, S., Li, Y., Dollár, P., and Girshick, R. Masked autoencoders are scalable vision learners. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 16000–16009, 2022. Kingma, D. P. and Welling, M. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013. Krause, J., Stark, M., Deng, J., and Fei-Fei, L. 3d object representations for fine-grained categorization. In 4th International IEEE Workshop on 3D Representation and Recognition (3dRR-13), Sydney, Australia, 2013. Krizhevsky, A. One weird trick for parallelizing convolu- tional neural networks. arXiv preprint arXiv:1404.5997, 2014. Krizhevsky, A., Hinton, G., et al. Learning multiple layers of features from tiny images. 2009. Hinton, G. E. Training products of experts by minimizing contrastive divergence. Neural computation, 14(8):1771– 1800, 2002. Lantuéjoul, C. and Beucher, S. On the use of the geodesic metric in image analysis. Journal of Microscopy, 121(1): 39–49, 1981. Ho, C.-H. and Nvasconcelos, N. Contrastive learning with adversarial examples. Advances in Neural Information Processing Systems, 33:17081–17093, 2020. Lantuéjoul, C. and Maisonneuve, F. Geodesic methods in quantitative image analysis. Pattern recognition, 17(2): 177–187, 1984. Huang, G., Liu, Z., Van Der Maaten, L., and Weinberger, K. Q. Densely connected convolutional networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4700–4708, 2017. Huang, J., Dong, Q., Gong, S., and Zhu, X. Unsupervised deep learning by neighbourhood discovery. In Interna- tional Conference on Machine Learning, pp. 2849–2858. PMLR, 2019. Huang, L., Zhang, C., and Zhang, H. Self-adaptive training: Bridging supervised and self-supervised learning. IEEE Transactions on Pattern Analysis and Machine Intelli- gence, 2022. Huang, W., Yi, M., and Zhao, X. Towards the generalization of contrastive self-supervised learning. arXiv preprint arXiv:2111.00743, 2021. Hyvärinen, A. and Dayan, P. Estimation of non-normalized statistical models by score matching. Journal of Machine Learning Research, 6(4), 2005. Ioffe, S. Batch renormalization: Towards reducing mini- batch dependence in batch-normalized models. Advances in neural information processing systems, 30, 2017. Ioffe, S. and Szegedy, C. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International conference on machine learning, pp. 448– 456. PMLR, 2015. Larsen, A. B. L., Sønderby, S. K., Larochelle, H., and Winther, O. Autoencoding beyond pixels using a learned similarity metric. In International conference on machine learning, pp. 1558–1566. PMLR, 2016. Le, Y. and Yang, X. Tiny imagenet visual recognition chal- lenge. CS 231N, 7(7):3, 2015. LeCun, Y. A path towards autonomous machine intelligence. preprint posted on openreview, 2022. Li, Y., Pogodin, R., Sutherland, D. J., and Gretton, A. Self- supervised learning with kernel dependence maximiza- tion. Advances in Neural Information Processing Systems, 34:15543–15556, 2021. Liu, Z., Lin, Y., Cao, Y., Hu, H., Wei, Y., Zhang, Z., Lin, S., and Guo, B. Swin transformer: Hierarchical vision transformer using shifted windows. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 10012–10022, 2021. Liu, Z., Mao, H., Wu, C.-Y., Feichtenhofer, C., Darrell, T., and Xie, S. A convnet for the 2020s. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11976–11986, 2022. Maji, S., Kannala, J., Rahtu, E., Blaschko, M., and Vedaldi, A. Fine-grained visual classification of aircraft. Technical report, 2013. Unsupervised Learning on a DIET Meng, D., Leung, Y., Xu, Z., Fung, T., and Zhang, Q. Im- proving geodesic distance estimation based on locally linear assumption. Pattern Recognition Letters, 29(7): 862–870, 2008. Misra, I. and Maaten, L. v. d. Self-supervised learning of pretext-invariant representations. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6707–6717, 2020. Nilsback, M.-E. and Zisserman, A. Automated flower clas- sification over a large number of classes. In 2008 Sixth Indian Conference on Computer Vision, Graphics & Im- age Processing, pp. 722–729. IEEE, 2008. Ozsoy, S., Hamdan, S., Arik, S. Ö., Yuret, D., and Erdo- gan, A. T. Self-supervised learning with an information maximization criterion. arXiv preprint arXiv:2209.07999, 2022. Park, F. C. Distance metrics on the rigid-body motions with applications to mechanism design. 1995. Parkhi, O. M., Vedaldi, A., Zisserman, A., and Jawahar, C. Cats and dogs. In 2012 IEEE conference on computer vision and pattern recognition, pp. 3498–3505. IEEE, 2012. Peng, X., Wang, K., Zhu, Z., Wang, M., and You, Y. Craft- ing better contrastive views for siamese representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 16031– 16040, 2022. Revaud, J., Weinzaepfel, P., Harchaoui, Z., and Schmid, C. Epicflow: Edge-preserving interpolation of corre- spondences for optical flow. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1164–1172, 2015. Rhodes, B., Xu, K., and Gutmann, M. U. Telescoping density-ratio estimation. Advances in neural information processing systems, 33:4905–4916, 2020. Roweis, S. T. and Saul, L. K. Nonlinear dimensionality re- duction by locally linear embedding. science, 290(5500): 2323–2326, 2000. Simoncelli, E. A rotation invariant pattern signature. In Proceedings of 3rd IEEE International Conference on Image Processing, volume 3, pp. 185–188. IEEE, 1996. Song, Y. and Ermon, S. Generative modeling by estimating gradients of the data distribution. Advances in Neural Information Processing Systems, 32, 2019. Thomas Fletcher, P. Geodesic regression and the theory of least squares on riemannian manifolds. International journal of computer vision, 105(2):171–185, 2013. Tian, Y., Krishnan, D., and Isola, P. Contrastive multiview coding. In European conference on computer vision, pp. 776–794. Springer, 2020a. Tian, Y., Sun, C., Poole, B., Krishnan, D., Schmid, C., and Isola, P. What makes for good views for contrastive learning? Advances in Neural Information Processing Systems, 33:6827–6839, 2020b. Pfau, D., Petersen, S., Agarwal, A., Barrett, D. G., and Stachenfeld, K. L. Spectral inference networks: Unifying deep and spectral learning. arXiv preprint arXiv:1806.02215, 2018. Tian, Y., Chen, X., and Ganguli, S. Understanding self- supervised learning dynamics without contrastive pairs. In International Conference on Machine Learning, pp. 10268–10278. PMLR, 2021. Pham, T., Zhang, C., Niu, A., Zhang, K., and Yoo, C. D. On the pros and cons of momentum encoder in self- supervised visual representation learning. arXiv preprint arXiv:2208.05744, 2022. Reed, C. J., Metzger, S., Srinivas, A., Darrell, T., and Keutzer, K. Selfaugment: Automatic augmentation poli- cies for self-supervised learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2674–2683, 2021. Tolstikhin, I. O., Houlsby, N., Kolesnikov, A., Beyer, L., Zhai, X., Unterthiner, T., Yung, J., Steiner, A., Keysers, D., Uszkoreit, J., et al. Mlp-mixer: An all-mlp architec- ture for vision. Advances in Neural Information Process- ing Systems, 34:24261–24272, 2021. Vincent, P., Larochelle, H., Bengio, Y., and Manzagol, P.-A. Extracting and composing robust features with denoising autoencoders. In Proceedings of the 25th international conference on Machine learning, pp. 1096–1103, 2008. Ren, S., Wang, H., Gao, Z., He, S., Yuille, A., Zhou, Y., and Xie, C. A simple data mixing prior for improving self- supervised learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 14595–14604, 2022. Vincent, P., Larochelle, H., Lajoie, I., Bengio, Y., Manzagol, P.-A., and Bottou, L. Stacked denoising autoencoders: Learning useful representations in a deep network with a local denoising criterion. Journal of machine learning research, 11(12), 2010. Unsupervised Learning on a DIET Wah, C., Branson, S., Welinder, P., Perona, P., and Belongie, S. Cub200 dataset. Technical Report CNS-TR-2011-001, California Institute of Technology, 2011. Wakin, M. B., Donoho, D. L., Choi, H., and Baraniuk, R. G. High-resolution navigation on non-differentiable image manifolds. In Proceedings.(ICASSP'05). IEEE In- ternational Conference on Acoustics, Speech, and Signal Processing, 2005., volume 5, pp. v–1073. IEEE, 2005. Wang, F. and Liu, H. Understanding the behaviour of con- trastive loss. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 2495– 2504, 2021. Wang, T. and Isola, P. Understanding contrastive represen- tation learning through alignment and uniformity on the hypersphere. In International Conference on Machine Learning, pp. 9929–9939. PMLR, 2020. Wang, Z. and Simoncelli, E. P. Translation insensitive In Pro- image similarity in complex wavelet domain. ceedings.(ICASSP'05). IEEE International Conference on Acoustics, Speech, and Signal Processing, 2005., vol- ume 2, pp. ii–573. IEEE, 2005. Wang, Z., Bovik, A. C., Sheikh, H. R., and Simoncelli, E. P. Image quality assessment: from error visibility to struc- tural similarity. IEEE transactions on image processing, 13(4):600–612, 2004. Yeh, C.-H., Hong, C.-Y., Hsu, Y.-C., Liu, T.-L., Chen, Y., and LeCun, Y. Decoupled contrastive learning. In Eu- ropean Conference on Computer Vision, pp. 668–684. Springer, 2022. Zagoruyko, S. and Komodakis, N. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016. Zbontar, J., Jing, L., Misra, I., LeCun, Y., and Deny, S. Barlow twins: Self-supervised learning via redundancy reduction. arXiv preprint arXiv:2103.03230, 2021. Zhai, X., Puigcerver, J., Kolesnikov, A., Ruyssen, P., Riquelme, C., Lucic, M., Djolonga, J., Pinto, A. S., Neu- mann, M., Dosovitskiy, A., et al. The visual task adapta- tion benchmark. 2019. Zhang, C., Zhang, K., Pham, T. X., Niu, A., Qiao, Z., Yoo, C. D., and Kweon, I. S. Dual temperature helps con- trastive learning without many negative samples: Towards understanding and simplifying moco. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pat- tern Recognition, pp. 14441–14450, 2022. Zhang, R., Isola, P., and Efros, A. A. Split-brain autoen- coders: Unsupervised learning by cross-channel predic- tion. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1058–1067, 2017. Zhang, W. and Stratos, K. Understanding hard nega- tives in noise contrastive estimation. arXiv preprint arXiv:2104.06245, 2021. Wu, Z., Xiong, Y., Yu, S. X., and Lin, D. Unsupervised feature learning via non-parametric instance discrimina- tion. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3733–3742, 2018. Zheng, M., You, S., Wang, F., Qian, C., Zhang, C., Wang, X., and Xu, C. Ressl: Relational self-supervised learning with weak augmentation. Advances in Neural Information Processing Systems, 34:2543–2555, 2021. Xie, S., Girshick, R., Dollár, P., Tu, Z., and He, K. Aggre- gated residual transformations for deep neural networks. In Proceedings of the IEEE conference on computer vi- sion and pattern recognition, pp. 1492–1500, 2017. Zhong, Z., Zheng, L., Kang, G., Li, S., and Yang, Y. Ran- dom erasing data augmentation. In Proceedings of the AAAI conference on artificial intelligence, volume 34, pp. 13001–13008, 2020. Xu, W., Jang-Jaccard, J., Singh, A., Wei, Y., and Sabrina, F. Improving performance of autoencoder-based network anomaly detection on nsl-kdd dataset. IEEE Access, 9: 140136–140146, 2021. Yang, K., Zhou, T., Tian, X., and Tao, D. Identity- disentangled adversarial augmentation for self-supervised learning. In International Conference on Machine Learn- ing, pp. 25364–25381. PMLR, 2022. Yang, Z., Hu, Z., Salakhutdinov, R., and Berg-Kirkpatrick, T. Improved variational autoencoders for text modeling using dilated convolutions. In International conference on machine learning, pp. 3881–3890. PMLR, 2017. Unsupervised Learning on a DIET Supplementary Materials The supplementary materials is providing the proofs of the main's paper formal results. We also provide as much background results and references as possible throughout to ensure that all the derivations are self-contained. Some of the below derivation do not belong to formal statements but are included to help the curious readers get additional insights into current SSL methods. A. Code Algorithm 3 Get the output dimension and remove the linear classifier from a given torchvision model (Pytorch used for illustration). model = t o r c h v i s i o n . m o d e l s . __dict__ [ a r c h i t e c t u r e ] ( ) # CIFAR p r o c e d u r e t o a d j u s t i f i s _ c i f a r and " r e s n e t " i n a r c h i t e c t u r e : t o t h e l o w e r image r e s o l u t i o n model . c o n v 1 = t o r c h . nn . Conv2d ( 3 , 6 4 , k e r n e l _ s i z e =3 , model . maxpool = t o r c h . nn . I d e n t i t y ( ) s t r i d e =1 , p a d d i n g =2 , b i a s=F a l s e ) # f o r e a c h a r c h i t e c t u r e , i f " a l e x n e t " i n a r c h i t e c t u r e : remove t h e c l a s s i f i e r and g e t t h e o u t p u t dim . (K) K = model . c l a s s i f i e r [ 6 ] . i n _ f e a t u r e s model . c l a s s i f i e r [ 6 ] = t o r c h . nn . I d e n t i t y ( ) e l i f " c o n v n e x t " i n a r c h i t e c t u r e : K = model . c l a s s i f i e r [ 2 ] . i n _ f e a t u r e s model . c l a s s i f i e r [ 2 ] = t o r c h . nn . I d e n t i t y ( ) e l i f " c o n v n e x t " i n a r c h i t e c t u r e : K = model . c l a s s i f i e r [ 2 ] . i n _ f e a t u r e s model . c l a s s i f i e r [ 2 ] = t o r c h . nn . I d e n t i t y ( ) e l i f " r e s n e t " i n a r c h i t e c t u r e o r " r e s n e x t " i n a r c h i t e c t u r e o r " r e g n e t " i n a r c h i t e c t u r e : K = model . f c . i n _ f e a t u r e s model . f c = t o r c h . nn . I d e n t i t y ( ) " d e n s e n e t " i n a r c h i t e c t u r e : e l i f K = model . c l a s s i f i e r . i n _ f e a t u r e s model . c l a s s i f i e r = t o r c h . nn . I d e n t i t y ( ) e l i f " m o b i l e " i n a r c h i t e c t u r e : K = model . c l a s s i f i e r [ − 1 ] . i n _ f e a t u r e s model . c l a s s i f i e r [ −1] = t o r c h . nn . I d e n t i t y ( ) e l i f " v i t " i n a r c h i t e c t u r e : K = model . h e a d s . head . i n _ f e a t u r e s model . h e a d s . head = t o r c h . nn . I d e n t i t y ( ) e l i f " s w i n " i n a r c h i t e c t u r e : K = model . head . i n _ f e a t u r e s model . head = t o r c h . nn . I d e n t i t y ( ) B. Impact of Training Time and Label Smoothing Table 5. Final top1 test accuracy values on CIFAR100 with the models and training schedules depicted in Fig. 6, only the label smoothing value with the best accuracy is reported. Epochs resnet18 resnet50 resnet101 50 33.46 37.71 34.03 100 42.94 47.86 46.59 200 48.24 54.04 54.3 500 54.54 60.23 60.8 1000 58.81 64.24 64.71 5000 62.63 69.51 70.56 10000 63.29 69.91 71.39 C. Impact of Mini-Batch Size D. Impact of Data-Augmentation Unsupervised Learning on a DIET Figure 5. Reprise of Fig. 4 but on additional datasets. Algorithm 4 Custom dataset to obtain the indices (n) in addition to inputs xn and (optionally) the labels yn to obtain train_loader used in Algo. 1 (Pytorch used for illustration). t r a n s f o r m s = [ RandomResizedCropRGBImageDecoder ( ( s i z e , R a n d o m H o r i z o n t a l F l i p ( ) , s i z e ) ) , ] i f s t r e n g t h > 1 : t r a n s f o r m s . append ( T . RandomApply ( t o r c h . nn . M o d u l e L i s t ( [ T . C o l o r J i t t e r ( 0 . 4 , 0 . 4 , 0 . 4 , 0 . 2 ) ] ) , p =0.3 ) ) t r a n s f o r m s . append (T . R a n d o m G r a y s c a l e ( 0 . 2 ) ) i f s t r e n g t h > 2 : t r a n s f o r m s . append ( T . RandomApply ( t o r c h . nn . M o d u l e L i s t ( [ T . G a u s s i a n B l u r ( ( 3 , 3 ) , ( 1 . 0 , 2 . 0 ) ) ] ) , p =0.2 ) ) t r a n s f o r m s . append (T . RandomErasing ( 0 . 2 5 ) ) Unsupervised Learning on a DIET Resnet18 Resnet50 Resnet101 Figure 6. Depiction of the evolution of linear top1 accuracy throughout epochs on CIFAR100 with three Resnet variants and three label smoothing parameters represented by the different shades of blue going from light to dark shades with values of 0.1, 0.4, and 0.8 respectively. We clearly observe that higher value of label smoothing speeds up convergence, although in this setting all cases greatly benefit from longer training schedules; final linear probe performances are reported in Table 5. Unsupervised Learning on a DIET Figure 7. TinyImagenet with fixed number of epochs and a single learning rate which is adjusted for each case using the LARS rule therefore per batch-size learning cross-validation can only improve perfor- mances, see Table 4, , the per-epoch time includes training, testing, and checkpointing. Table 6. TinyImagenet top1 test accuracy with a faster training schedule than the Table 2 (2000 epochs) with average and std over 5 runs with 3 different DA augmentation pipelines and 4 different architectures, the per-epoch linear probe evaluation performances are reported in Fig. 8, DAs can be found in Algo. 4. resnet18 resnet34 resnet50 resnet101 strength: 1 31.48± 0.3 32.93± 0.6 40.24± 0.7 40.07± 0.4 strength: 2 43.62± 0.2 45.60± 0.2 48.80± 0.6 49.74± 0.5 strength: 3 43.88± 0.3 45.75± 0.1 50.81± 0.8 50.76± 0.5 Figure 8. TinyImagenet, see Table 6 for table of results, and the specific DAs can be found in Algo. 4.
http://arxiv.org/abs/2302.10258v2
2023-07-03T17:08:05
2023-02-20T19:41:15
Neural Algorithmic Reasoning with Causal Regularisation
Recent work on neural algorithmic reasoning has investigated the reasoning capabilities of neural networks, effectively demonstrating they can learn to execute classical algorithms on unseen data coming from the train distribution. However, the performance of existing neural reasoners significantly degrades on out-of-distribution (OOD) test data, where inputs have larger sizes. In this work, we make an important observation: there are many different inputs for which an algorithm will perform certain intermediate computations identically. This insight allows us to develop data augmentation procedures that, given an algorithm's intermediate trajectory, produce inputs for which the target algorithm would have exactly the same next trajectory step. We ensure invariance in the next-step prediction across such inputs, by employing a self-supervised objective derived by our observation, formalised in a causal graph. We prove that the resulting method, which we call Hint-ReLIC, improves the OOD generalisation capabilities of the reasoner. We evaluate our method on the CLRS algorithmic reasoning benchmark, where we show up to 3$\times$ improvements on the OOD test data.
[ "Beatrice Bevilacqua", "Kyriacos Nikiforou", "Borja Ibarz", "Ioana Bica", "Michela Paganini", "Charles Blundell", "Jovana Mitrovic", "Petar Veličković" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10258v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10258v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "cs.AI", "stat.ME" ]
3 2 0 2 l u J 3 ] G L . s c [ 2 v 8 5 2 0 1 . 2 0 3 2 : v i X r a Neural Algorithmic Reasoning with Causal Regularisation Beatrice Bevilacqua 1 Kyriacos Nikiforou * 2 Borja Ibarz * 2 Ioana Bica 2 Michela Paganini 2 Charles Blundell 2 Jovana Mitrovic † 2 Petar Veliˇckovi ́c † 2 Abstract Recent work on neural algorithmic reasoning has investigated the reasoning capabilities of neu- ral networks, effectively demonstrating they can learn to execute classical algorithms on unseen data coming from the train distribution. How- ever, the performance of existing neural reason- ers significantly degrades on out-of-distribution (OOD) test data, where inputs have larger sizes. In this work, we make an important observation: there are many different inputs for which an al- gorithm will perform certain intermediate com- putations identically. This insight allows us to develop data augmentation procedures that, given an algorithm's intermediate trajectory, produce inputs for which the target algorithm would have exactly the same next trajectory step. We ensure invariance in the next-step prediction across such inputs, by employing a self-supervised objective derived by our observation, formalised in a causal graph. We prove that the resulting method, which we call Hint-ReLIC, improves the OOD general- isation capabilities of the reasoner. We evaluate our method on the CLRS algorithmic reasoning benchmark, where we show up to 3× improve- ments on the OOD test data. 1. Introduction Recent works advocate for building neural networks that can reason (Xu et al., 2020; 2021; Veliˇckovi ́c & Blundell, 2021; Veliˇckovi ́c et al., 2022a). Therein, it is posited that combining the robustness of algorithms with the flexibility of neural networks can help us accelerate progress towards models that can tackle a wide range of tasks with real world impact (Davies et al., 2021; Deac et al., 2021; Veliˇckovi ́c *Equal contribution †Equal Advising 1Purdue University 2DeepMind. Work done while Beatrice Bevilacqua was at DeepMind. Correspondence to: Beatrice Bevilacqua <[email protected]>. Proceedings of the 40 th International Conference on Machine Learning, Honolulu, Hawaii, USA. PMLR 202, 2023. Copyright 2023 by the author(s). 1 et al., 2022b; Bansal et al., 2022; Beurer-Kellner et al., 2022). The rationale is that, if a model learns how to reason, or learns to execute an algorithm, it should be able to apply that reasoning, or algorithm, to a completely novel problem, even in a different domain. Specifically, if a model has learnt an algorithm, it should be gracefully applicable on out-of-distribution (OOD) examples, which are substantially different from the examples in the training set, and return correct outputs for them. This is because an algorithm-and reasoning in general-is a sequential, step-by-step process, where a simple decision is made in each step based on outputs of the previous computation. Prior work (Diao & Loynd, 2022; Dudzik & Veliˇckovi ́c, 2022; Ibarz et al., 2022; Mahdavi et al., 2022) has explored this setup, using the CLRS-30 benchmark (Veliˇckovi ́c et al., 2022a), and showed that while many algorithmic tasks can be learned by Graph Neural Network (GNN) processors in a way that generalises to larger problem instances, there are still several algorithms where this could not be achieved. Importantly, CLRS-30 also provides ground-truth hints for every algorithm. Hints correspond to the state of different variables employed to solve the algorithm (e.g. positions, pointers, colouring of nodes) along its trace. Such hints can optionally be used during training, but are not available during evaluation. In previous work, they have mainly been used as auxiliary targets together with the algorithm output. The prevailing hypothesis is that gradients coming from pre- dicting these additional relevant signals will help constrain the representations in the neural algorithmic executor and prevent overfitting. Predicted hints can also be optionally fed back into the model to provide additional context and aid their prediction at the next step. In practice, while utilising hints in this way does lead to mod- els that follow the algorithmic trajectory better, they have had a less substantial impact on the accuracy of the predicted final output. This is likely due to the advent of powerful strategies such as recall (Bansal et al., 2022), wherein the input is fed back to the model at every intermediate step, constantly "reminding" the model of the problem that needs to be solved. The positive effect of recall on the final output accuracy has been observed on many occasions (Mahdavi et al., 2022), and outweighs the contribution from directly Neural Algorithmic Reasoning with Causal Regularisation Figure 1. An illustration of the key observation of our work, on the depth-first search (DFS) algorithm as implemented in CLRS-30 (Veliˇckovi ́c et al., 2022a). On the left, the first four steps of DFS are visualised. At each step, DFS explores the unvisited neighbour with the smallest index, and backtracks if no unexplored neighbours exist. The next computational step-assigning 2 as the parent of 4-is bound to happen, even under many transformations of this graph. For example, if we were to insert new (dashed) nodes and edges into the graph, this step would still proceed as expected. Capturing this computational invariance property is the essence of our paper. predicting hints and feeding them back. In this work, we propose a method, namely Hint-ReLIC, that decisively demonstrates an advantage to using hints. We base our work on the observation that there are many different inputs for which an algorithm will make identical computations at a certain step (Figure 1). For example, ap- plying the bubble sort algorithm from the left on [2, 1, 3] or [2, 1, 5, 3] will result in the same first step computation: a comparison of 2 and 1, followed by swapping them. Con- versely, the first step of execution would be different for inputs [2, 1, 3] and [2, 5, 1, 3]; the latter input would trigger a comparison of 2 and 5 without swapping them. This obser- vation allows us to move beyond the conventional way of us- ing hints, i.e. autoregressively predicting them (Veliˇckovi ́c et al., 2022a). Instead, we design a novel way that learns more informative representations that enable the networks to more faithfully execute algorithms. Specifically, we learn representations that are similar for inputs that result in iden- tical intermediate computation. First, we design a causal graph in order to formally model an algorithmic execution trajectory. Based on this, we derive a self-supervised ob- jective for learning hint representations that are invariant across inputs having the same computational step. More- over, we prove that this procedure will result in stronger causally-invariant representations. Contributions. Our three key contributions are as follows: 1. We design a causal graph capturing the observation that the execution of an algorithm at a certain step is determined only by a subset of the input; 2. Motivated by our causal graph, we present a self- supervised objective to learn representations that are provably invariant to changes in the input subset that does not affect the computational step; 3. We test our model, dubbed Hint-ReLIC, on the CLRS- 30 algorithmic reasoning benchmark (Veliˇckovi ́c et al., 2022a), demonstrating a significant improvement in out-of-distribution generalisation over the recently pub- lished state-of-the-art (Ibarz et al., 2022). 2. Related Work GNNs and invariance to size shifts. Graph Neural Net- works (GNNs) constitute a popular class of methods for learning representations of graph data, and they have been successfully applied to solve a variety of problems. We refer the reader to Bronstein et al. (2021); Jegelka (2022) for a thorough understanding of GNN concepts. While GNNs are designed to work on graphs of any size, recent work has empirically shown poor size-generalisation capabilities of standard methods, mainly in the context of molecular modeling (Gasteiger et al., 2022), graph property predic- tion (Corso et al., 2020), and in executing specific graph algorithms (Veliˇckovi ́c et al., 2020; Joshi et al., 2020). A theoretical study of failure cases has been recently provided in Xu et al. (2021), with a focus on a geometrical inter- pretation of OOD generalisation. In order to learn models performing equally well in- and out-of-distribution, Bevilac- qua et al. (2021); Chen et al. (2022); Zhou et al. (2022) designed ad-hoc solutions satisfying assumed causal as- sumptions. However, these models are not applicable to our setting, as the assumptions on our data generation pro- cess are significantly different. With the same motivation, Buffelli et al. (2022) introduced a regularisation strategy to improve generalisation to larger sizes, while Yehudai et al. (2021) proposed a semi-supervised and a self-supervised ob- jective that assume access to the test distribution. However, these models are not designed to work on algorithmic data, where OOD generalisation is still underexplored. Neural Algorithmic Reasoning. In order to learn to ex- ecute algorithmic tasks, a neural network must include a recurrent component simulating the individual algorithmic steps. This component is applied a variable number of times, as required by the size of the input and the problem at hand. 2 13245132451324513245132456789 Neural Algorithmic Reasoning with Causal Regularisation The recurrent component can be an LSTM (Gers & Schmid- huber, 2001), possibly augmented with a memory as in Neu- ral Turing Machines (Graves et al., 2014; 2016); it could exploit spatial invariances in the algorithmic task through a convolutional architecture (Bansal et al., 2022); it could be based on the transformer self-attentional architecture, as in the Universal Transformer (Dehghani et al., 2019); or it could be a Graph Neural Network (GNN). GNNs are par- ticularly well suited for algorithmic execution (Veliˇckovi ́c et al., 2020; Xu et al., 2020), and they have been applied to algorithmic problems before with a focus on extrapo- lation capabilities (Palm et al., 2017; Selsam et al., 2019; Joshi et al., 2020; Tang et al., 2020). Recently, Veliˇckovi ́c & Blundell (2021) have proposed a general framework for algorithmic learning with GNNs. To reconcile different data encodings and provide a unified evaluation procedure, Veliˇckovi ́c et al. (2022a) have presented a benchmark of algorithmic tasks covering a variety of areas. This bench- mark, namely the CLRS algorithmic benchmark, represents data as graphs, showing that the graph formulation is gen- eral enough to include several algorithms, and not just the graph-based ones. On the CLRS benchmark, Ibarz et al. (2022) has recently presented several improvements in the architecture and learning procedure in order to obtain bet- ter performances. However, even the latest state-of-the-art models suffer from performance drops in certain algorithms when going out-of-distribution, an aspect we wish to im- prove upon here. Self-supervised learning. Recently, many self-supervised representation learning methods that achieve good perfor- mance on a wide range of downstream vision tasks without access to labels have been proposed. One of the most popu- lar approaches relies on contrastive objectives that make use of data augmentations to solve the instance discrimination task (Wu et al., 2018; Chen et al., 2020; He et al., 2020; Mitrovic et al., 2021). Other approaches that rely on tar- get networks and clustering have also been explored (Grill et al., 2020; Caron et al., 2020). Our work is similar in spirit to Mitrovic et al. (2021), which examines represen- tation learning through the lens of causality and employs techniques from invariant prediction to make better use of data augmentations. This approach has been demonstrated to be extremely successful on vision tasks (Tomasev et al., 2022). In the context of graphs, You et al. (2020); Suresh et al. (2021); You et al. (2022) have studied how to learn contrastive representations, with particular attention paid to data augmentations. Moreover, Veliˇckovi ́c et al. (2019); Zhu et al. (2020) proposed novel objectives based on mu- tual information maximization in the graph domain to learn representations. Several other self-supervised methods (e.g. Thakoor et al. (2022)) have also been studied, and we re- fer the reader to Xie et al. (2022) for a review of existing literature on self-supervision with GNNs. Figure 2. The causal graph formalising our assumption about the outcome of a step depends only on a subset X s t of the snapshot Xt, while the remainder X c t of the snapshot can be arbitrarily different. 3. Causal Model for Algorithmic Trajectories An algorithm's execution trajectory is described in terms of the inputs, outputs and hints, which represent intermediate steps in the execution. We consider a graph-oriented way of representing this data (Veliˇckovi ́c et al., 2022a): inputs and outputs are presented as data on nodes and edges of a graph, and hints are encoded as node, edge or graph features changing over time steps. To better understand the data at hand, we propose to for- malise the data generation process for an algorithmic trajec- tory using a causal graph. In such a causal graph, nodes represent random variables, and incoming arrows indicate that the node is a function of its parents (Pearl, 2009). The causal graph we use can be found in Figure 2. Note that this graph does not represent input data for the model, but a way of describing how any such data is generated. Let us consider the execution trajectory of a certain algo- rithm of interest, at a particular time step t. Assume X1 to be the observed input, and let Xt be the random variable denoting the "snapshot" at step t of the algorithm execution on the input. For example, in bubble sort, X1 will be the initial (unsorted) array, and Xt the array after t steps of the sorting procedure (thus a partially-sorted array). The key contribution of our causal graph is modelling the assumption that outcomes of a particular execution step depend only on a subset of the current snapshot, while the remainder of the snapshot can be arbitrarily different. Accordingly, we assume the snapshot Xt to be generated from two random variables, X c t repre- senting the part of the snapshot that does not influence the current execution step (what can be changed without af- fecting the execution), while X s t the one that determines it (what needs to be stable). t , with X c t and X s Let us now revisit our bubble sort example from this per- spective (see Figure 3). At each execution step, bubble sort compares two adjacent elements of the input list, and swaps them if they are not correctly ordered. Hence, in this par- 3 Neural Algorithmic Reasoning with Causal Regularisation Figure 3. Example of values of X c t on an input array in the execution of the bubble sort algorithm. At every step of computation, bubble sort compares and possibly swaps exactly two nodes-those nodes are the only ones determining the outcome of the current step, and hence they constitute X s t . All other nodes are part of X c t . t and X s ticular example, X s t constitutes these two elements being compared at step t, while the remaining elements-which do not affect whether or not a swap is going to happen at time t-form X c t . By definition this implies that the next algorithm state is a function of only X s t . The data encoding used by Veliˇckovi ́c et al. (2022a) prescribes that hints have values provided in all relevant parts of the graph. That is, in a graph of n nodes, an m-dimensional node hint has shape Rn×m, and an m-dimensional edge hint has shape Rn×n×m. However, in order to keep our causal model simple, we choose to track the next-step hint in only one of those values, using an index, It, to decide which. Specifically, It ∈ {1, 2, . . . , n} are possible indices for node-level hints, and It ∈ {(1, 1), (1, 2), . . . , (1, n), (2, 1), . . . , (2, n), . . . , (n, n)} are possible indices for edge-level hints. For the indexed node/edge only, our causal graph then tracks the next-step value of the hint (either no change from the previous step or the new value), which we denote by Yt+1. Returning once again to our bubble sort example: one spe- cific hint being tracked by the algorithm is which two nodes in the input list are currently considered for a swap. If I2 = 4, then Y3 will track whether node 4 is being consid- ered for a swap, immediately after two steps of the bubble sort algorithm have been executed. Once step t of the algorithm has been executed, a new snap- shot Xt+1 is produced, and it can be decomposed into X c t+1 and X s t+1, just as before. Note that the execution in CLRS- 30 is assumed Markovian (Veliˇckovi ́c et al., 2022a): the snapshot at step t contains all the information to determine the snapshot at the next step. Finally, the execution termi- nates after T steps, and the final output is produced. We can then represent the output in a particular node/edge-indexed by IT , just as before-by Y o T , IT ), with g being the function producing the algorithm output. T +1 := g(X s As can be seen in Figure 2, X s t has all the necessary informa- tion to predict Yt+1, since our causal model encodes the con- ditional independence assumption Yt+1 ⊥ X c t . More importantly, using the independence of mechanisms (Peters t | X s et al., 2017) we can conclude that under this causal model, performing interventions on X c t by changing its value, does not change the conditional distribution P (Yt+1 | X s t ). Note that this is exactly the formalisation of our initial intuition: the output of a particular step of the algorithm (i.e., Yt+1) depends only on a subset of the current snapshot (i.e., X s t ), and thus it is not affected by the addition of input items that do not interfere with it (which we formalise as an interven- t ).1 Therefore, given a step t ∈ [1 . . . T ], for all tion on X c x, x′ ∈ X c t denotes the domain of X c t , where X c t , we have that X s t is an invariant predictor of Yt+1 under interventions on X c t : pdo(X c t )=x(Yt+1|X s t ) = pdo(X c (Yt+1|X s t )=x′ t ), (1) where pdo(X c signing X c t )=x denotes the distribution obtained from as- t the value of x, i.e. the interventional distribution. Note, however, that Equation (1) does not give us a prac- tical way of ensuring that our neural algorithmic reasoner respects these causal invariances, because it only has access to the entirety of the current snapshot Xt, without knowing t and X s its specific subsets X c t . More precisely, it is gener- ally not known which input elements constitute X s t . For this reason, X c t are represented as unobserved random variables (white nodes) in Figure 2. In the next section, we will describe how to ensure invariant predictions for our reasoner, leveraging only Xt. t and X s 4. Size-Invariance through Self-Supervision in Neural Algorithmic Reasoning t , we construct a refinement task Y R Given a step t, to ensure invariant predictions of Yt+1 with- out access to X s t+1 and learn a representation f (Xt, It) to predict Y R t+1, as orig- inally proposed for images in Mitrovic et al. (2021). A refinement for a task (Chalupka et al., 2014) represents a more fine-grained version of the initial task. More formally, given two tasks R : A → B and T : A → 1In bubble sort, adding sorted keys at the end of the array does not affect whether we are swapping the current entries. 4 32415Xc1Xs1X132415Xc2Xs2X232415Xc3Xs3X332415Xc4Xs4X432415Xc5Xs5X5 Neural Algorithmic Reasoning with Causal Regularisation we want to distinguish each hint from all others. This repre- sents the most-fine-grained refinement, because Y R t+1(a) = t+1(a′) ⇐⇒ a = a′, by definition. Our goal is to learn Y R f (Xt, It) to be an invariant predictor of Y R t+1 under changes (interventions) of X c t . Thus, given a step t ∈ [1 . . . T ], for all x, x′ ∈ X c pdo(X c t )=x(Y R t , we want f (Xt, It) such that t+1|f (Xt, It)) = pdo(X c t )=x′ (Y R t+1|f (Xt, It)), (2) Figure 4. Our causal graph with the inclusion of the representation learning components as in Mitrovic et al. (2021). Solid arrows represent the causal relationships. Dashed arrows represent what is used to learn (in the case of f (Xt, It)) or predict (in the case of Y R t+1) the corresponding random variables. B′, task R is more (or equally) fine-grained than task T if, for any two elements a, a′ ∈ A, R(a) = R(a′) =⇒ T (a) = T (a′). We will use this concept to show that a representation learned on the refinement task can be effectively used in the original task. Note that, as for Yt+1, we assume f (Xt, It) to be the representation learned from Xt of a predefined hint value-indexed by It-for example, the representation of the predecessor of a specific element of the input list. Given a step t, let Y R t+1 be a refinement of Yt+1, and let f (Xt, It) be a representation learned from Xt, used for the prediction of the refinement (see Figure 4). As we will formally prove, a representation that is invariant in the prediction of the refinement task across changes in X c t is also invariant in the prediction of the algorithmic step under these changes. Therefore, optimising f (Xt, It) to be an invariant predictor for the refinement task Y R t+1 represents a sufficient condition for the invariance in the prediction of the next algorithmic state, Yt+1. In the next subsection we present how to learn f (Xt, It) in order to be an invariant predictor of Y R t+1 under changes in X c t . Then, we show that this represents a sufficient condition for f (Xt, It) to be an invariant predictor of Yt+1 across changes in X c t . 4.1. Learning an invariant predictor of the refinement We consider Y R t+1 to be the most-fine-grained refinement task, which corresponds to classifying each (hint) instance individually, that is, a contrastive learning objective where t ) is the interventional distribution and X c where pdo(X c t de- notes the domain of X c t . Since we do not have access to X c t , as it is unobserved (it is a white node in Figures 2 and 4), we cannot explicitly intervene on it. Thus, we simulate interventions on X c t through data augmentation. As we are interested in being invariant to appropriate size changes, we design a data augmentation procedure tailored for neural algorithmic reasoning, which mimics interven- tions changing the size of the input. Given a current snap- shot of the algorithm on a given input, the data augmenta- tion procedure should produce an augmented input which is larger, but on which the execution of the current step is going to proceed identically. For example, a valid augmentation in bubble sort at a certain step consists of adding new elements to the tail of the input list, since the currently-considered swap will occur (or not) regardless of any elements added there. Thus, the valid augmentations for the bubble sort algorithm at a given step are all possible ways to add items in such a way that ensures that the one-step execution is unaffected by this addition. To learn an encoder f (Xt, It) that satisfies Equation (2), we propose to explicitly enforce invariance under valid augmen- tations. Such augmentations, as discussed, provide us with diverse inputs with an identical intermediate execution step. Specifically, we use the ReLIC objective (Mitrovic et al., 2021) as a regularisation term, which we adapt to our causal graph as follows. Consider a time step, t, and let Dt be the dataset containing the snapshots at time t for all the inputs. Let it, jt ∈ It be two indices, and denote by alk = (al, ak) ∈ Axt × Axt a pair of augmentations, with Axt the set of all possible valid augmentations at t for xt (which simulate the interventions on X c t ). The objective function to optimise becomes: Lt = (cid:88) − (cid:16) (cid:88) (cid:88) xt∈Dt it − α alk (cid:88) alk,aqm log (cid:80) t , it), f (xak exp (φ(f (xal t jt̸=it exp (φ(f (xal t , it), f (xak t (cid:17) KL(pdo(alk), pdo(aqm)) , it))) , jt))) (3) with xa t the data augmented with augmentation a, and α a weighting of the KL divergence penalty. The first term 5 Neural Algorithmic Reasoning with Causal Regularisation of v: the node from which we have reached v in the current DFS invocation. Note that, in practice, this is a classification task where node v decides which of the other nodes is its parent. Accordingly, given a particular node v, our model computes a representation for every other node u ∈ V . This representation is which is then passed through a final classifier, outputting the (unnormalised) probability of u being the parent of v. Now, consider any augmentation of G's nodes and edges that does not disrupt the current step of the search algorithm, denoted by Ga = (V a, Ea). For example, as the DFS implementation in CLRS-30 prefers nodes with a smaller id value, a valid augmentation can be obtained by adding nodes with a larger id than v to V a, and adding edges from them to v in Ea (dashed nodes and edges in Figure 5). Note that this augmentation does not change the predicted parent of v. We can enforce that our representations respect this constraint by using our regularisation loss in Equation (3). Given a node v ∈ V , we denote the representation of its parent node, πv ∈ V by f (G, (v, πv)). This representation is contrasted to all other representations of nodes w ∈ V a in the augmented graph, that is f (Ga, (v, w)).2 More precisely, representation of the most similar f (G, (v, πv)) is the representation in the augmentation of the parent of v, f (Ga, (v, πv)), while the representations associated to all other nodes (including the added ones) represent the negative examples f (Ga, (v, w)), for w ̸= πv. Figure 5 illustrates the prediction of the parent of node v = 4. In this case, it in Equation (3) indexes the true parent of node 4, namely π4 = 2, and therefore it = (4, 2), while jt iterates over all other possible indices of the form (4, u), u ∈ V a, indeed representing all other possible par- ents of 4. The objective of Equation (3) is to make the true parent representation in the original graph f (G, (4, 2)) sim- ilar to the true parent representation in the augmentation f (Ga, (4, 2)), and dissimilar to the representations of the other possible parents in the augmentation f (Ga, (4, u)), u ∈ V a. The same process applies to the augmentation. 4.2. Implications of the invariance In the previous subsection, we have presented a self- supervised objective, justified by our assumed causal graph, in order to learn invariant predictors for a refinement task Y R t+1 under changes of X c t . However, our initial goal was to ensure invariance in the prediction of algorithmic hints Yt+1 across X c t . Now we will bridge these two aims. In the following, we show how learning a representation t+1 under changes of X c that is an invariant predictor of Y R t 2Note that, in this case, It is a two-dimensional index, choosing two nodes-i.e., an edge-at once. Figure 5. Example of applying our data augmentation and con- trastive loss, following the example in Figure 1. An input graph (left) is augmented by adding nodes and edges (right), such that the next step-making 2 the parent of 4, i.e. π4 = 2-remains the same. The representation of the pair (4, 2) is hence contrasted against all other representations of pairs (4, u) in the augmented graph. In other words, the green edge is the positive pair to the blue edge, with other edges (in red) being negative pairs to it. represents a contrastive objective where we compare a hint t , namely f (xal representation in xal t , it), with all the pos- sible representations in xak , f (xak , jt). Note that this is t t different from standard contrastive objectives, where neg- ative examples are taken from the batch. Due to space constraints, we expand on the derivation of Equation (3) in Appendix A. In practice, we consider only one augmentation per graph, which is equivalent to setting al to the identity transforma- tion. Consequently, the hint representation in the original graph f (xal t , it) is regularised to be similar to the hint rep- resentation in the augmentation f (xak , it) and dissimilar t to all other possible representations in the augmentation f (xak , jt), jt ̸= it. Similarly, the hint representation in t the augmentation f (xak , it) is regularised to be similar to t the hint representation in the original graph f (xal t , it) and dissimilar to all other possible representations in the original graph f (xal t , jt), jt ̸= it. φ(f (xal We follow the standard setup in contrastive learn- t , it), f (xak implement and ing = t ⟨ h(f (xal t ), it), h(f (xak , it)) ⟩/τ with h a fully-connected t neural network and τ a temperature parameter. Finally, we use a KL penalty to ensure invariance in the probability distribution across augmentations. This is a requirement for satisfying the assumptions of our key theoretical result. , it)) Example. To better understand Equation (3), we provide an example illustrated in Figure 5. We will consider one of the algorithms in CLRS-30-Kosaraju's strongly connected component (SCC) algorithm (Aho et al., 1974)-which con- sists of two invocations of depth-first search (DFS). Let G = (V, E) be an input graph to the SCC algorithm. Further, assume that at step t, the algorithm is visiting a node v ∈ V . We will focus on the prediction of the parent 6 132451324576 Neural Algorithmic Reasoning with Causal Regularisation represents a sufficient condition for this representation to be invariant to X c t when predicting Yt+1. Theorem 4.1. Consider an algorithm and let t ∈ [1 . . . T ] be one of its steps. Let Yt+1 be the task representing a prediction of the algorithm step and let Y R t+1 be a refinement of such task. If f (Xt, It) is an invariant representation for Y R t+1 under changes in X c t , then f (Xt, It) is an invariant representation for Yt+1 under changes in X c t , that is, for all x, x′ ∈ X c t , the following holds: We make an additional change with respect to the base model, consisting of including the reversal of hints of pointer type. More specifically, given an input graph, if a node A points to another node B in the graph, we include an additional (edge-based) hint representing the pointer from B to A. This change (which we refer to as reversal in the results) consists simply in the inclusion of these additional hints, and we study the impact of this addition in Section 5.1. The resulting model is what we call Hint-ReLIC. pdo(X c =⇒ pdo(X c t )=x(Y R t+1|f (Xt, It)) = pdo(X c t )=x′ t )=x(Yt+1|f (Xt, It)) = pdo(X c t )=x′ (Y R t+1|f (Xt, It)) (Yt+1|f (Xt, It)). We prove Theorem 4.1 in Appendix D. Note that this jus- tifies our self-supervised objective: by learning invariant representations though a refinement task, we can also guar- antee invariance in the hint prediction. In other words, we can provably ensure that the prediction of an algorithm step is not affected by changes in the input that do not interfere with the current execution step. Since we can express these changes in the form of addition of input nodes, we are en- suring that the hint prediction is the same on two inputs of different sizes, but identical current algorithmic step. 5. Experiments We conducted an extensive set of experiments to answer the following main questions: 1. Can our model, Hint-ReLIC, which relies on the addi- tion of our causality-inspired self-supervised objective, outperform the corresponding base model in practice? 2. What is the importance of such objective when com- pared to other changes made with respect to the previ- ous state-of-the-art model? 3. How does Hint-ReLIC compare to a model which does not leverage hints at all, directly predicting the output from the input? Are hints necessary? Model. As a base model, we use the Triplet-GMPNN architecture proposed by Ibarz et al. (2022), which consists of a fully-connected MPNN (Gilmer et al., 2017) where the input graph is encoded in the edge features, augmented with gating and triplet reasoning (Dudzik & Veliˇckovi ́c, 2022). We replace the loss for predicting the next-step hint in the base model with our regularisation objective (Equation (3)), which aims at learning hint representations that are invariant to size changes that are irrelevant to the current step via constrastive and KL losses. 7 Data augmentations. To simulate interventions on X c t and learn invariant representations, we design augmentation procedures which construct augmented data given an input and an algorithm step, such that the step of the algorithm is the same on the original input and on the augmented data. We consider simple augmentations, which we describe in detail in Appendix E. To reduce the computational overhead, given an input graph, instead of sampling an augmentation at each algorithm step, we sample a single step, ̃t ∼ U{1, T }, and construct an augmentation only for the sampled step. Then, we use the (same) constructed augmentation in all the steps until the sampled one, t ≤ ̃t. This follows from the consideration that, if augmentations are carefully con- structed, the execution of the algorithm is the same not only in the next step but in all steps leading up to that. Whenever possible, we relax the requirement of having the augmentation with exactly the same execution, and we allow for approximate augmentations, in order to avoid over-engineering the methodology and obtain a more robust model. This results in more general and simpler augmenta- tions, though we expect more tailored ones to perform better. We refer the reader to Appendix E for more details. We end this paragraph by stressing that we never run the target algorithm on the augmented inputs: rather, we di- rectly construct them to have the same next execution step as the corresponding inputs. As a result, our method does not require direct access to the algorithm used to generate the inputs. Furthermore, the number of nodes in our aug- mentations is at most one more than the number of nodes in the largest training input example. This means that, in all of our experiments, we still never significantly cross the intended test size distribution shift during training. Datasets. We run our method on a diverse subset of the algorithms present in the CLRS benchmark consisting of: 1. DFS-based algorithms (Articulation Points, Bridges, Strongly Connected Components (Aho et al., 1974), Topo- logical Sort (Knuth, 1973)); 2. Other graph-based algo- rithms (Bellman-Ford (Bellman, 1958), BFS (Moore, 1959), DAG Shortest Paths, Dijkstra (Dijkstra et al., 1959), Floy- d-Warshall (Floyd, 1962), MST-Kruskal (Kruskal, 1956), MST-Prim (Prim, 1957)); 3. Sorting algorithms (Bubble Neural Algorithmic Reasoning with Causal Regularisation Figure 6. Per-algorithm comparison of the Triplet-GMPNN baseline (Ibarz et al., 2022) and our Hint-ReLIC. Error bars represent the standard error of the mean across three random seeds. The final column shows the average and standard error of the mean performances across the different algorithms. Sort, Heapsort (Williams, 1964), Insertion Sort, Quicksort (Hoare, 1962)); 4. Searching algorithms (Binary-search, Minimum). This subset is chosen as it contains most algo- rithms suffering from out-of-distribution performance drops in current state-of-the-art; see Ibarz et al. (2022, Table 2). Results. Figure 6 compares the out-of-distribution (OOD) performances of the Triplet-GMPNN baseline, which we have re-trained and evaluated in our experiments, to our model Hint-ReLIC, as described above. Hint-ReLIC per- forms better or comparable to the existing state-of-the-art baseline, showcasing how the proposed procedure appears to be beneficial not only theoretically, but also in practice. The most significant improvements can be found in the sorting algorithms, where we obtain up to 3× increased performance. 5.1. Ablation study In this section we study the contribution and importance of two main components of our methodology. First, we consider the impact of the change we made with respect to the original baseline proposed in Ibarz et al. (2022), namely the inclusion of the reversal of hint pointers. Second, as we propose a novel way to leverage hints through our self- supervised objective, which is different from the direct su- pervision in the baseline, one may wonder whether com- pletely removing hints can achieve even better scores. Thus, we also study the performance when completely disregard- ing hints and directly going from input to output. Finally, we refer the reader to Appendix F.1 for additional ablation experiments, including the removal of the KL component in Equation (3)-which is necessary for the theoretical results but may not always be needed in practice. Table 1. Effect of the inclusion of pointers' reversal on each al- gorithm. The table shows mean and stderr of the OOD micro-F1 score after 10,000 training steps, across different seeds. Alg. Baseline Baseline + reversal Hint-ReLIC (ours) Articulation points Bridges SCC Topological sort Bellman-Ford BFS DAG Shortest Paths Dijkstra Floyd-Warshall MST-Kruskal MST-Prim Insertion sort Bubble sort Quicksort Heapsort Binary Search Minimum 88.93% ± 1.92 93.75% ± 2.73 38.53% ± 0.45 87.27% ± 2.67 96.67% ± 0.81 99.64% ± 0.05 88.12% ± 5.70 93.41% ± 1.08 46.51% ± 1.30 91.18% ± 1.05 87.64% ± 1.79 91.04% ± 0.92 97.70% ± 0.34 31.40% ± 8.80 88.83% ± 7.29 95.02% ± 0.49 99.93% ± 0.03 96.61% ± 0.61 91.50% ± 1.85 46.28% ± 0.80 89.93% ± 0.43 86.95% ± 2.34 75.28% ± 5.62 79.87% ± 6.85 70.53% ± 11.59 32.12% ± 5.20 87.21% ± 2.80 80.51% ± 9.10 85.69% ± 4.53 49.13% ± 10.35 98.45% ± 0.60 99.32% ± 0.09 76.79% ± 3.04 96.59% ± 0.20 95.54% ± 1.06 99.00% ± 0.21 98.17% ± 0.26 97.74% ± 0.50 72.23% ± 4.84 96.01% ± 0.45 87.97% ± 2.94 92.70% ± 1.29 92.94% ± 1.23 93.30% ± 1.96 95.16% ± 1.27 74.60% ± 3.61 97.78% ± 0.63 50.42% ± 8.45 98.43% ± 0.01 89.68% ± 2.13 99.37% ± 0.20 The effect of the inclusion of pointers' reversal. As discussed above, pointers' reversal simply consists of adding an additional hint for each hint of pointer type (if any), such that a node not only has the information representing which other node it points to, but also from which nodes it is pointed by. We study the impact of this inclusion by running the baseline with these additional hints, and evaluate its performance against both the baseline and our Hint-ReLIC. Table 1 shows that this addition, which we refer to as Baseline + reversal, indeed leads to improved results for certain algorithms, but does not obtain the predictive performances we reached with our regularisation objective. The removal of hints. While previous works directly in- cluded the supervision on the hint predictions, we argue in 8 HeapsortStrongly Conn. Comps.Floyd-WarshallQuicksortInsertion SortBinary SearchBubble SortDAG Shortest PathsArticulation PointsTopological SortBridgesMST KruskalDijkstraMinimumMST PrimBFSBellman-FordOverall Average020406080100Average score [%]Hint-ReLIC (ours)Baseline Neural Algorithmic Reasoning with Causal Regularisation Table 2. Importance of hint usage in the final performance. The table shows mean and stderr of the OOD micro-F1 score after 10,000 training steps, across different seeds. Alg. No Hints Hint-ReLIC (ours) Articulation points Bridges SCC Topological sort Bellman-Ford BFS DAG Shortest Paths Dijkstra Floyd-Warshall MST-Kruskal MST-Prim Insertion sort Bubble sort Quicksort Heapsort Binary Search Minimum 81.97% ± 5.08 95.62% ± 1.03 57.63% ± 0.68 84.29% ± 1.16 93.26% ± 0.04 99.89% ± 0.03 97.62% ± 0.62 95.01% ± 1.14 40.80% ± 2.90 92.28% ± 0.82 85.33% ± 1.21 77.29% ± 7.42 81.32% ± 6.50 71.60% ± 2.22 68.50% ± 2.81 98.45% ± 0.60 99.32% ± 0.09 76.79% ± 3.04 96.59% ± 0.20 95.54% ± 1.06 99.00% ± 0.21 98.17% ± 0.26 97.74% ± 0.50 72.23% ± 4.84 96.01% ± 0.45 87.97% ± 2.94 92.70% ± 1.29 92.94% ± 1.23 93.30% ± 1.96 95.16% ± 1.27 93.21% ± 1.10 99.24% ± 0.21 89.68% ± 2.13 99.37% ± 0.20 favour of a novel way of leveraging hints. We use hints first to construct the augmentations representing the same algo- rithm step, and then we employ their representations in the self-supervised objective. An additional valid model might consist of a model that directly goes from input to output and completely ignores hints. In Table 2 we show that this No Hints model can achieve very good performances, but it is still generally outperformed by Hint-ReLIC. 6. Conclusions In this work we propose a self-supervised learning objective that employs augmentations derived from available hints, which represent intermediate steps of an algorithm, as a way to better ground the execution of GNN-based algo- rithmic reasoners on the computation that the target algo- rithm performs. Our Hint-ReLIC model, based on such self-supervised objective, leads to algorithmic reasoners that produce more robust outputs of the target algorithms, especially compared to autoregressive hint prediction. In conclusion, hints can take you a long way, if used in the right way. Acknowledgements The authors would like to thank Andrew Dudzik and Daan Wierstra for valuable feedback on the paper. They would also like to show their gratitude to the Learning at Scale team at DeepMind for a supportive atmosphere. References Aho, A. V., Hopcroft, J. E., and Ullman, J. D. The design and analysis of computer algorithms. Reading, 1974. Alet, F., Doblar, D., Zhou, A., Tenenbaum, J., Kawaguchi, 9 K., and Finn, C. Noether networks: meta-learning useful conserved quantities. Advances in Neural Information Processing Systems, 34:16384–16397, 2021. Bansal, A., Schwarzschild, A., Borgnia, E., Emam, Z., Huang, F., Goldblum, M., and Goldstein, T. End-to- end algorithm synthesis with recurrent networks: Log- ical extrapolation without overthinking. arXiv preprint arXiv:2202.05826, 2022. Bellman, R. On a routing problem. Quarterly of applied mathematics, 16(1):87–90, 1958. Beurer-Kellner, L., Vechev, M., Vanbever, L., and Veliˇckovi ́c, P. Learning to configure computer networks with neural algorithmic reasoning. In Advances in Neural Information Processing Systems, 2022. Bevilacqua, B., Zhou, Y., and Ribeiro, B. Size-invariant graph representations for graph classification extrapola- tions. In International Conference on Machine Learning, pp. 837–851. PMLR, 2021. Bronstein, M. M., Bruna, J., Cohen, T., and Veliˇckovi ́c, P. Geometric deep learning: Grids, groups, graphs, geodesics, and gauges. arXiv preprint arXiv:2104.13478, 2021. Buffelli, D., Li`o, P., and Vandin, F. Sizeshiftreg: a regu- larization method for improving size-generalization in graph neural networks. In Advances in Neural Informa- tion Processing Systems, 2022. Caron, M., Misra, I., Mairal, J., Goyal, P., Bojanowski, P., and Joulin, A. Unsupervised learning of visual features by contrasting cluster assignments. Advances in Neural Information Processing Systems, 33:9912–9924, 2020. Chalupka, K., Perona, P., and Eberhardt, F. Visual causal feature learning. arXiv preprint arXiv:1412.2309, 2014. Chen, T., Kornblith, S., Norouzi, M., and Hinton, G. A simple framework for contrastive learning of visual rep- In International conference on machine resentations. learning, pp. 1597–1607. PMLR, 2020. Chen, Y., Zhang, Y., Bian, Y., Yang, H., KAILI, M., Xie, B., Liu, T., Han, B., and Cheng, J. Learning causally invariant representations for out-of-distribution generalization on graphs. In Advances in Neural Information Processing Systems, 2022. Corso, G., Cavalleri, L., Beaini, D., Li`o, P., and Veliˇckovi ́c, P. Principal neighbourhood aggregation for graph nets. Advances in Neural Information Processing Systems, 33: 13260–13271, 2020. Neural Algorithmic Reasoning with Causal Regularisation Davies, A., Veliˇckovi ́c, P., Buesing, L., Blackwell, S., Zheng, D., Tomaˇsev, N., Tanburn, R., Battaglia, P., Blun- dell, C., Juh ́asz, A., et al. Advancing mathematics by guiding human intuition with ai. Nature, 600(7887):70– 74, 2021. Deac, A.-I., Veliˇckovi ́c, P., Milinkovic, O., Bacon, P.-L., Tang, J., and Nikolic, M. Neural algorithmic reasoners are implicit planners. Advances in Neural Information Processing Systems, 34:15529–15542, 2021. Dehghani, M., Gouws, S., Vinyals, O., Uszkoreit, J., and Kaiser, L. Universal transformers. In International Con- ference on Learning Representations, 2019. Diao, C. and Loynd, R. Relational attention: Generalizing transformers for graph-structured tasks. arXiv preprint arXiv:2210.05062, 2022. Dijkstra, E. W. et al. A note on two problems in connex- ion with graphs. Numerische mathematik, 1(1):269–271, 1959. Grill, J.-B., Strub, F., Altch ́e, F., Tallec, C., Richemond, P., Buchatskaya, E., Doersch, C., Avila Pires, B., Guo, Z., Gheshlaghi Azar, M., et al. Bootstrap your own latent-a new approach to self-supervised learning. Advances in neural information processing systems, 33:21271–21284, 2020. He, K., Fan, H., Wu, Y., Xie, S., and Girshick, R. Mo- mentum contrast for unsupervised visual representation learning. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 9729–9738, 2020. Hoare, C. A. Quicksort. The Computer Journal, 5(1):10–16, 1962. Ibarz, B., Kurin, V., Papamakarios, G., Nikiforou, K., Ben- nani, M., Csord ́as, R., Dudzik, A. J., Boˇsnjak, M., Vitvit- skyi, A., Rubanova, Y., Deac, A., Bevilacqua, B., Ganin, Y., Blundell, C., and Veliˇckovi ́c, P. A generalist neural algorithmic learner. In The First Learning on Graphs Conference, 2022. Dudzik, A. J. and Veliˇckovi ́c, P. Graph neural networks are dynamic programmers. In Advances in Neural Informa- tion Processing Systems, 2022. Jegelka, S. Theory of graph neural networks: Represen- tation and learning. arXiv preprint arXiv:2204.07697, 2022. Floyd, R. W. Algorithm 97: shortest path. Communications of the ACM, 5(6):345, 1962. Gasteiger, J., Shuaibi, M., Sriram, A., G ̈unnemann, S., Ulissi, Z. W., Zitnick, C. L., and Das, A. How do graph networks generalize to large and diverse molecular sys- tems? ArXiv, abs/2204.02782, 2022. Gers, F. A. and Schmidhuber, J. Lstm recurrent networks learn simple context-free and context-sensitive languages. IEEE transactions on neural networks, 12 6:1333–40, 2001. Gilmer, J., Schoenholz, S. S., Riley, P. F., Vinyals, O., and Dahl, G. E. Neural message passing for quantum chem- istry. In Proceedings of the 34th International Confer- ence on Machine Learning, ICML'17, pp. 1263–1272. JMLR.org, 2017. Joshi, C. K., Cappart, Q., Rousseau, L.-M., and Laurent, T. Learning the travelling salesperson problem requires rethinking generalization. Constraints, 27:70 – 98, 2020. Knuth, D. E. Fundamental algorithms. 1973. Kruskal, J. B. On the shortest spanning subtree of a graph and the traveling salesman problem. Proceedings of the American Mathematical society, 7(1):48–50, 1956. Mahdavi, S., Swersky, K., Kipf, T., Hashemi, M., Thram- poulidis, C., and Liao, R. Towards better out-of- distribution generalization of neural algorithmic reason- ing tasks. arXiv preprint arXiv:2211.00692, 2022. Mitrovic, J., McWilliams, B., Walker, J. C., Buesing, L. H., and Blundell, C. Representation learning via invari- ant causal mechanisms. In International Conference on Learning Representations, 2021. Graves, A., Wayne, G., and Danihelka, I. Neural turing machines. ArXiv, abs/1410.5401, 2014. Moore, E. F. The shortest path through a maze. In Proc. Int. Symp. Switching Theory, 1959, pp. 285–292, 1959. Graves, A., Wayne, G., Reynolds, M., Harley, T., Dani- helka, I., Grabska-Barwi ́nska, A., Colmenarejo, S. G., Grefenstette, E., Ramalho, T., Agapiou, J., Badia, A. P., Hermann, K. M., Zwols, Y., Ostrovski, G., Cain, A., King, H., Summerfield, C., Blunsom, P., Kavukcuoglu, K., and Hassabis, D. Hybrid computing using a neural network with dynamic external memory. Nature, 538 (7626):471–476, October 2016. ISSN 00280836. Palm, R. B., Paquet, U., and Winther, O. Recurrent re- In Neural Information Processing lational networks. Systems, 2017. Pearl, J. Causality. Cambridge university press, 2009. Peters, J., Janzing, D., and Sch ̈olkopf, B. Elements of causal inference: foundations and learning algorithms. The MIT Press, 2017. 10 Neural Algorithmic Reasoning with Causal Regularisation Xie, Y., Xu, Z., Zhang, J., Wang, Z., and Ji, S. Self- supervised learning of graph neural networks: A unified review. IEEE Transactions on Pattern Analysis and Ma- chine Intelligence, 2022. Xu, K., Li, J., Zhang, M., Du, S. S., ichi Kawarabayashi, K., and Jegelka, S. What can neural networks reason about? In International Conference on Learning Representations, 2020. Xu, K., Zhang, M., Li, J., Du, S. S., Kawarabayashi, K.-I., and Jegelka, S. How neural networks extrapolate: From feedforward to graph neural networks. In International Conference on Learning Representations, 2021. Yehudai, G., Fetaya, E., Meirom, E., Chechik, G., and Maron, H. From local structures to size generalization in graph neural networks. In International Conference on Machine Learning, pp. 11975–11986. PMLR, 2021. You, Y., Chen, T., Sui, Y., Chen, T., Wang, Z., and Shen, Y. Graph contrastive learning with augmentations. In Larochelle, H., Ranzato, M., Hadsell, R., Balcan, M. F., and Lin, H. (eds.), Advances in Neural Information Pro- cessing Systems, volume 33, pp. 5812–5823. Curran As- sociates, Inc., 2020. You, Y., Chen, T., Wang, Z., and Shen, Y. Bringing your own view: Graph contrastive learning without prefabri- cated data augmentations. In Proceedings of the Fifteenth ACM International Conference on Web Search and Data Mining, pp. 1300–1309, 2022. Zhou, Y., Kutyniok, G., and Ribeiro, B. OOD link prediction generalization capabilities of message-passing GNNs in larger test graphs. In Advances in Neural Information Processing Systems, 2022. Zhu, Y., Xu, Y., Yu, F., Liu, Q., Wu, S., and Wang, L. Deep Graph Contrastive Representation Learning. In ICML Workshop on Graph Representation Learning and Beyond, 2020. Prim, R. C. Shortest connection networks and some gen- eralizations. The Bell System Technical Journal, 36(6): 1389–1401, 1957. Selsam, D., Lamm, M., B ̈unz, B., Liang, P., de Moura, L., and Dill, D. L. Learning a SAT solver from single-bit supervision. In International Conference on Learning Representations, 2019. Suresh, S., Li, P., Hao, C., and Neville, J. Adversarial graph augmentation to improve graph contrastive learning. In Advances in Neural Information Processing Systems, 2021. Tang, H., Huang, Z., Gu, J., Lu, B.-L., and Su, H. Towards scale-invariant graph-related problem solving by iterative homogeneous gnns. Advances in Neural Information Processing Systems, 33:15811–15822, 2020. Thakoor, S., Tallec, C., Azar, M. G., Azabou, M., Dyer, E. L., Munos, R., Veliˇckovi ́c, P., and Valko, M. Large- scale representation learning on graphs via bootstrapping. In International Conference on Learning Representations, 2022. Tomasev, N., Bica, I., McWilliams, B., Buesing, L., Pascanu, R., Blundell, C., and Mitrovic, J. Pushing the limits of self-supervised resnets: Can we outperform supervised arXiv preprint learning without labels on imagenet? arXiv:2201.05119, 2022. Veliˇckovi ́c, P. and Blundell, C. Neural algorithmic reasoning. Patterns, 2(7):100273, 2021. Veliˇckovi ́c, P., Badia, A. P., Budden, D., Pascanu, R., Ban- ino, A., Dashevskiy, M., Hadsell, R., and Blundell, C. The CLRS algorithmic reasoning benchmark. In Interna- tional Conference on Machine Learning, 2022a. Veliˇckovi ́c, P., Boˇsnjak, M., Kipf, T., Lerchner, A., Hadsell, R., Pascanu, R., and Blundell, C. Reasoning-modulated representations. In The First Learning on Graphs Confer- ence, 2022b. Veliˇckovi ́c, P., Fedus, W., Hamilton, W. L., Li`o, P., Bengio, Y., and Hjelm, R. D. Deep graph infomax. In Interna- tional Conference on Learning Representations, 2019. Veliˇckovi ́c, P., Ying, R., Padovano, M., Hadsell, R., and Blundell, C. Neural execution of graph algorithms. In International Conference on Learning Representations, 2020. Williams, J. W. J. Algorithm 232: heapsort. Commun. ACM, 7:347–348, 1964. Wu, Z., Xiong, Y., Yu, S. X., and Lin, D. Unsupervised feature learning via non-parametric instance discrimina- tion. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3733–3742, 2018. 11 Neural Algorithmic Reasoning with Causal Regularisation A. Derivation of our Self-Supervised Objective Equation (3) represents our objective function to optimise, which we derived by adapting the ReLIC objective (Mitrovic et al., 2021) to our causal graph. Note that we propose a unique and novel way of employing a contrastive-learning based objective, which is also different from Mitrovic et al. (2021), as we consider positive and negative examples for each hint representation in an input graph to be hint representations in valid augmentations of the graph. To better understand the equation, in this section we expand the derivation of our objective. Recall that our goal is to learn f (Xt, It) to be an invariant predictor of Y R do not have access to X c t , because we do not know which subset of the input forms X c through data augmentations. Therefore, our goal becomes to learn f (Xt, It) to be an invariant predictor of Y R (valid) augmentations, that is: t . As we t , we simulate interventions on X c t t+1 under t+1 under changes (interventions) of X c pdo(ai)(Y R t+1|f (Xt, It)) = pdo(aj )(Y R t+1|f (Xt, It)), ∀ai, aj ∈ Axt where Axt contains all possible valid augmentations at t for xt, and pdo(a) represents the simulation of the intervention on X c t through data augmentation a. Following Mitrovic et al. (2021), we enforce this invariance through a regularisation objective, which for every time step t has the following form: E Xt E alk,aqm ∼Axt ×Axt (cid:88) (cid:88) it b∈{alk,aqm} ˆLb(f (Xt, it), Y R t+1 = it) s.t. KL(pdo(alk)(Y R t+1|f (Xt, it)), pdo(aqm)(Y R t+1|f (Xt, it))) ≤ ρ, for some small number ρ. Since we consider ˆL to be a contrastive learning objective, we take pairs of hint representations, indexed by it and jt, to compute similarity scores and use pairs of augmentations alk = (al, ak) ∈ Axt × Axt, that is pdo(alk)(Y R t+1 = jt|f (xt, it)) ∝ exp (φ(f (xal t , it), f (xak t , jt))), where f is a neural network and φ is a (learnable) function to compute the similarity between two representations. Note that, in words, we are computing the similarity of two hint representations (indexed by it and jt, respectively) in two data augmentations (obtained from al and ak). Now, note that we want the representations of the same hint to be similar in the two augmentations. This means that the hint representation indexed by it in xal t must be similar to the hint representation indexed by it in xak . Obviously, the same must be true when considering jt instead of it. Furthermore, we want representations t of different hints to be dissimilar in the two augmentations. Putting all together, our objective function at time t can be rewritten as Lt = − (cid:88) (cid:16) (cid:88) (cid:88) log xt∈Dt alk it exp (φ(f (xal jt̸=it exp (φ(f (xal t , it), f (xak t t , it), f (xak t , it))) (cid:80) , jt))) (cid:88) − α alk,aqm KL(pdo(alk), pdo(aqm)) (cid:17) , where Dt is the dataset containing the snapshots at time t for all the inputs, it, jt ∈ It are two indices, alk = (al, ak) ∈ Axt × Axt is a pair of augmentations, with Axt the set of all possible valid augmentations at t for xt (which simulate t ). Finally, α is the weighting of the KL divergence penalty and pdo(alk) is a shorthand for the interventions on X c pdo(alk)(Y R t+1|f (xt, it)). We note here that jt is such that the hint representations of it and jt are actually different. In the SCC example in the main text (visualised in Figure 5), the sum over jt is a sum over all other possible parents of the node v under consideration. In a DFS's execution, when the hint under consideration is the colour of a node in an input graph, its representation is regularised to be similar to the hint representation of the same node in the augmentation, and dissimilar to all other hint representations in the augmentation corresponding to different colours. B. Causal Graph and Representation Learning Components In this section we expand on the definition of our causal graph and on the representation learning components, justifying design choices that were left implicit in the main paper due to space constraints. Specifically, we first explain thoroughly the causal relationships among the random variables and then stress how we use those variables in a learning setting. Recall that our causal graph (Figure 2) describes the data generation process of an algorithmic trajectory. We denote by X1 the random variable representing the input to our algorithm, and refer by Xt the snapshot at time step t of the algorithm execution on such input, for every time step in the trajectory t ∈ [1 . . . T ]. 12 Neural Algorithmic Reasoning with Causal Regularisation We assume Xt to be generated by two random variables, X c t , which we assume to be distinct parts (or splits) of Xt, which together form the whole Xt. We consider X c t to be the part of the snapshot that does not influence the current execution of the algorithm at time step t, and can therefore be arbitrarily different without affecting it. We instead denote by X s t the part of the snapshot that determines the current execution of the algorithm at time step t, and therefore should not be changed if we do not want to alter the current step execution. t and X s The current execution is represented as hint values on all nodes and/or edges. We call Yt+1 the execution (or hint) on a specific node or edge chosen accordingly to an index It. Note that the current step hint Yt+1 is represented with an increment of the time step, following a convention we adopt to indicate that we first need an execution and only then (in the next time step) we materialise its results. Further, note that Yt+1 represents the algorithmic step in any node or edge, indicating whether or not it is involved in the current execution, thus either encoding that there is no change (and thus it is not involved in the current step) or representing what is its new hint value. By definition of X c by X s t only. t and X s t , the current step of the algorithm on the node or edge indexed by It, namely Yt+1, is determined t+1 and X s t+1 are potentially different from X c Assuming a Markovian execution, executing one algorithm step gives us X c observe Xt+1. Note that X c now be determined by very different subsets. Finally, note that we do not need an arrow from Yt+1 to X c t , and therefore all its information can be recovered from X s Yt+1 is deterministically determined by X s t . Recall now that our goal is to learn an invariant predictor for the refinement task across changes of X c t , as this represents a sufficient condition for the invariance in the prediction of Yt+1 (see Theorem 4.1). We denote by Y R t+1 the refinement task of the execution on a specific node or edge chosen according to It. We omit the arrow from It to Y R t+1 as the dependency is already implicit through Yt+1. t+1, which form the snapshot we t , because the current execution might t , because t+1 and X s t and X s t or X s We denote by f (Xt, It) the representation of the execution step on a particular node or edge indexed by It, which we learn to predict Y R t . Finally, note that f (Xt, It) is used by the network to determine the predicted next snapshot, which is determined by the next step prediction, and therefore it has a (dashed) arrow to Xt+1. t+1 across changes of X c C. Assumptions on Prior Knowledge of the Unobserved X c t t , simulated through data augmentations. However, since X c Given a time step t, to ensure invariant predictions of Yt+1 we learn predictors of Y R t+1 that are invariant across interventions on X c t is an unobserved random variable, we must make assumptions about its properties to create valid data augmentations. In this section, we clarify our assumptions about prior knowledge of X c t and propose potential methods to eliminate this assumption in future work. We start by remarking that our neural network is not assumed to have any prior knowledge about X c t . This knowledge is enforced into the network through our regularisation objective (Equation (3)), which is driven by appropriately chosen data augmentations. Indeed, those data augmentations do rely on priors that assume something about what X c t might look like. This is similar to how the choice of data augmentation in image CNNs governs which parts of the image we consider to be "content" and "style". However, for most algorithms of interest, the required priors are conceptually very simple, and a single augmentation may be reused for many algorithms. As an example, for many graph algorithms, it is an entirely safe operation to add disconnected subgraphs – an augmentation we repeatedly employ. Similarly in several sorting tasks, adding elements to the tail end of the list represent a valid augmentation. We provide an exhaustive list of the augmentation for each algorithm in Appendix E. Performing data augmentations without knowledge of X c t represents an interesting but challenging direction, that can be explored in future work. A simple, computationally-expensive, data-augmentation procedure that does not require any knowledge of X c t could consist in randomly augmenting the input graph, run the actual algorithm and consider the generated graph as a valid augmentation only if the next step execution of the algorithm remains unaltered. A more interesting approach would consist in learning valid augmentations of a given input, perhaps by meta-learning conserved quantities in the spirit of Noether Networks (Alet et al., 2021). Investigating these cases remains an important avenue for future research. 13 Neural Algorithmic Reasoning with Causal Regularisation D. Theoretical Analysis Theorem 4.1. Consider an algorithm and let t ∈ [1 . . . T ] be one of its steps. Let Yt+1 be the task representing a prediction of the algorithm step and let Y R t+1 under changes in X c t , the following holds: t+1 be a refinement of such task. If f (Xt, It) is an invariant representation for Y R t , then f (Xt, It) is an invariant representation for Yt+1 under changes in X c t , that is, for all x, x′ ∈ X c pdo(X c =⇒ pdo(X c t )=x(Y R t+1|f (Xt, It)) = pdo(X c t )=x′ t )=x(Yt+1|f (Xt, It)) = pdo(X c t )=x′ (Y R t+1|f (Xt, It)) (Yt+1|f (Xt, It)). Proof of Theorem 4.1. pdo(X c (cid:90) t )=x(Yt+1|f (Xt, It)) pdo(X c t )=x(Yt+1|Y R t+1)pdo(X c t )=x(Y R t+1|f (Xt, It))dY R t+1 = = = (cid:90) (cid:90) p(Yt+1|Y R t+1)pdo(X c t )=x(Y R t+1|f (Xt, It))dY R t+1 p(Yt+1|Y R t+1)pdo(X c t )=x′ (Y R t+1|f (Xt, It))dY R t+1 = pdo(X c t )=x′ (Yt+1|f (Xt, It)). The first equality is obtained by marginalising over Y R implies that Y R The second equality follows from the fact that the mechanism Yt+1|Y R assumptions. Finally, the third equality follows from the assumption that f (Xt, It) is an invariant predictor of Y R changes in X c t . t+1 and using the assumption of Y R t+1 being a refinement of Yt+1, which t+1 has all the necessary information to predict Yt+1 (and thus we can drop the conditioning on f (Xt, It)). t under our t+1 under t+1 is independent of interventions on X c E. Data Augmentations In this section we expand on our proposed augmentations, which simulate interventions on X c t , valid until step t. Further, we report which hints we use in our objective (see Equation (3)) using the naming convention in Veliˇckovi ́c et al. (2022a). DFS-based algorithms (Articulation Points, Bridges, Strongly Connected Components, Topological Sort). We construct exact augmentations for these kinds of problems. First, we sample a step by choosing uniformly at random amongst those where we enter a node for the first time (in case multiple DFSs are being executed for an input, we only consider the first one). Then, we construct a subgraph of nodes with larger node-ids, and we randomly determine connectivity between subgraph's nodes. Finally, we connect all the subgraph's nodes to the node we are entering in the sampled step. We contrast the following hints up to the sampled step (we mask out the contrastive loss on later steps): pi h in Articulation Points and Bridges; scc id h, color and s prev in Strongly Connected Components; and topo h, color, and s prev in Topological Sort. Graph-based algorithms (Bellman-Ford, BFS, DAG Shortest Path, Dijkstra, Floyd-Warshall, MST-Kruskal, MST- Prim). We construct simple but exact augmentations consisting of adding a disconnected subgraph to each input's graph. The subgraph consists of nodes with larger nodes ids and whose connectivity is randomly generated. We contrast until the end of the input's trajectory the following hints: pi h in Bellman-Ford, BFS, Dijkstra and MST-Prim; pi h, topo h, color in DAG shortest path; Pi h in Floyd-Warshall; pi in MST-Kruskal. Sorting algorithms (Insertion sort, Bubble Sort, Quicksort, Heapsort). We construct general augmented inputs obtained by simply adding items at the end of each input array. We consider as trajectories for those augmentations the ones of the corresponding inputs. We note that those do not correspond to exact augmentations for all sorting algorithms, but only for Insertion Sort. Indeed, running the executor of one of the other algorithms would yield potentially different trajectories than those we consider. However, since we use the inputs' trajectories, our regularisation aims at learning to be invariant to 14 Neural Algorithmic Reasoning with Causal Regularisation Figure 7. Per-algorithm comparison of the Triplet-GMPNN baseline (Ibarz et al., 2022), its augmented version which includes pointers' reversal and our Hint-ReLIC. Error bars represent the standard error of the mean across three random seeds. The final column shows the average and standard error of the mean performances across the different algorithms. added nodes that do not contribute to each currently considered step. We contrast until the end of the input's trajectories the hints pred h, and parent for Heapsort, and pred h for all the other algorithms. Searching algorithms (Binary Search, Minimum). We construct general augmented inputs obtained by simply adding random numbers (different than the searched one) at the end of the input array. For those augmentations, we consider as trajectories the ones of the corresponding input arrays, whose hints are contrasted until the end of the trajectories themselves. We remark that running the searching algorithms on such augmentations could potentially lead to ground-truth trajectories different than those of the inputs. However, since we consider as trajectories for the augmentations the inputs' ones, the contrastive objective is still valid, and can be seen as pushing the hint representations to be invariant to messages coming from nodes that are not involved in the current computation. We run our model by allowing the network to predict the predecessor of every array's item, namely pred h, at every time step and use its representation in our regularisation loss (in other words, we do not run with the static hint elimination of Ibarz et al. (2022)). F. Experiments F.1. Additional experiments Table 3 contains a comprehensive set of experiments, including the performances of the No Hints, Baseline, Baseline + reversal models, as discussed in the main text. The column Baseline + reversal + contr. + KL represents our Hint-ReLIC model, which is obtained with the additional inclusion of the contrastive and KL losses (see Equation (3)). Additionally, we report performances of our model when removing the KL divergence loss (setting α = 0 in Equation (3)), namely Baseline + reversal + contr.. By comparing Baseline + reversal + contr. to Baseline + reversal + contr. + KL, we can see that, even if the KL penalty produces some gain for certain algorithms, it does not represent the component leading to the most improvement. Finally, Table 3 also reports the scores obtained in the DFS algorithm, which appears to be solved by the inclusion of the pointers' reversal. We do not run our contrastive objective on such algorithm as there is no additional improvement to be made. Finally, to further evaluate the impact of the pointers' reversal, we report the performances of Hint-ReLIC without the inclusion of such additional hints. As can be seen in Table 4, the pointers' reversal helps stabilise our model, especially in the sorting algorithms. We remark however how only including those pointers' reversal into a baseline model does not produce the performances of our model (see column Baseline + reversal in Table 3 and Figure 7). 15 HeapsortStrongly Conn. Comps.Floyd-WarshallQuicksortInsertion SortBinary SearchBubble SortDAG Shortest PathsArticulation PointsTopological SortBridgesMST KruskalDijkstraMinimumMST PrimBFSBellman-FordOverall Average020406080100Average score [%]Hint-ReLIC (ours)Baseline + reversalBaseline Neural Algorithmic Reasoning with Causal Regularisation Table 3. Comparison of performances for different models, with last column representing our proposed method Hint-ReLIC. Table shows mean and stderr of OOD micro-F1 score after 10,000 training steps, across different seeds. Alg. No Hints Baseline Baseline + reversal Baseline + reversal + contr. Baseline + reversal + contr. + KL Articulation points Bridges DFS SCC Topological sort Bellman-Ford BFS DAG Shortest Paths Dijkstra Floyd-Warshall MST-Kruskal MST-Prim Insertion sort Bubble sort Quicksort Heapsort Binary Search Minimum 81.97% ± 5.08 95.62% ± 1.03 33.94% ± 2.57 57.63% ± 0.68 84.29% ± 1.16 93.26% ± 0.04 99.89% ± 0.03 97.62% ± 0.62 95.01% ± 1.14 40.80% ± 2.90 92.28% ± 0.82 85.33% ± 1.21 77.29% ± 7.42 81.32% ± 6.50 71.60% ± 2.22 68.50% ± 2.81 88.93% ± 1.92 93.75% ± 2.73 39.71% ± 1.34 38.53% ± 0.45 87.27% ± 2.67 96.67% ± 0.81 99.64% ± 0.05 88.12% ± 5.70 93.41% ± 1.08 46.51% ± 1.30 91.18% ± 1.05 87.64% ± 1.79 75.28% ± 5.62 79.87% ± 6.85 70.53% ± 11.59 32.12% ± 5.20 91.04% ± 0.92 97.70% ± 0.34 100.00% ± 0.00 31.40% ± 8.80 88.83% ± 7.29 95.02% ± 0.49 99.93% ± 0.03 96.61% ± 0.61 91.50% ± 1.85 46.28% ± 0.80 89.93% ± 0.43 86.95% ± 2.34 87.21% ± 2.80 80.51% ± 9.10 85.69% ± 4.53 49.13% ± 10.35 93.21% ± 1.10 99.24% ± 0.21 74.60% ± 3.61 97.78% ± 0.63 50.42% ± 8.45 98.43% ± 0.01 98.91% ± 0.34 98.14% ± 2.00 − 75.78% ± 1.25 95.44% ± 0.52 95.26% ± 0.92 98.41% ± 0.39 97.31% ± 0.51 97.22% ± 0.12 71.43% ± 2.64 95.18% ± 1.29 89.23% ± 1.23 95.06% ± 1.33 94.09% ± 0.80 90.54% ± 2.49 89.41% ± 4.79 87.50% ± 3.62 99.54% ± 0.05 98.45% ± 0.60 99.32% ± 0.09 − 76.79% ± 3.04 96.59% ± 0.20 95.54% ± 1.06 99.00% ± 0.21 98.17% ± 0.26 97.74% ± 0.50 72.23% ± 4.84 96.01% ± 0.45 87.97% ± 2.94 92.70% ± 1.29 92.94% ± 1.23 93.30% ± 1.96 95.16% ± 1.27 89.68% ± 2.13 99.37% ± 0.20 F.2. Implementation details We use the best hyperparameters of the Triplet-GMPNN (Ibarz et al., 2022) base model, and we only reduce the batch size to 16. We set the temperature parameter τ to 1e − 1 and the weight of the KL loss α to 1. We implement the similarity function as φ(f (xal , it)) ⟩/τ with h a two-layers MLP with hidden and output dimensions equal to the input one, and ReLU non-linearities. , it)) = ⟨ h(f (xal t ), it), h(f (xak t t , it), f (xak t 16 Neural Algorithmic Reasoning with Causal Regularisation Table 4. Importance of the inclusion of the pointers' reversal in our Hint-ReLIC. The table shows mean and stderr of the OOD micro-F1 score after 10,000 training steps, across different seeds. Alg. Hint-ReLIC Articulation points Bridges SCC Topological sort Bellman-Ford BFS DAG Shortest Paths Dijkstra Floyd-Warshall MST-Kruskal MST-Prim Insertion sort Bubble sort Quicksort Heapsort Binary Search Minimum Hint-ReLIC (no reversal) 97.33% ± 1.32 99.42% ± 0.20 81.42% ± 2.68 80.25% ± 3.03 95.27% ± 0.97 98.23% ± 0.17 89.23% ± 7.11 96.70% ± 0.92 57.38% ± 1.75 94.53% ± 0.40 74.24% ± 10.85 67.80% ± 10.86 82.36% ± 6.88 74.32% ± 10.12 77.15% ± 4.73 98.45% ± 0.60 99.32% ± 0.09 76.79% ± 3.04 96.59% ± 0.20 95.54% ± 1.06 99.00% ± 0.21 98.17% ± 0.26 97.74% ± 0.50 72.23% ± 4.84 96.01% ± 0.45 87.97% ± 2.94 92.70% ± 1.29 92.94% ± 1.23 93.30% ± 1.96 95.16% ± 1.27 89.68% ± 2.13 99.37% ± 0.20 86.65% ± 2.38 98.91% ± 0.23 17
http://arxiv.org/abs/2302.10255v2
2023-05-27T23:19:43
2023-02-20T19:36:52
NeuralStagger: Accelerating Physics-constrained Neural PDE Solver with Spatial-temporal Decomposition
Neural networks have shown great potential in accelerating the solution of partial differential equations (PDEs). Recently, there has been a growing interest in introducing physics constraints into training neural PDE solvers to reduce the use of costly data and improve the generalization ability. However, these physics constraints, based on certain finite dimensional approximations over the function space, must resolve the smallest scaled physics to ensure the accuracy and stability of the simulation, resulting in high computational costs from large input, output, and neural networks. This paper proposes a general acceleration methodology called NeuralStagger by spatially and temporally decomposing the original learning tasks into several coarser-resolution subtasks. We define a coarse-resolution neural solver for each subtask, which requires fewer computational resources, and jointly train them with the vanilla physics-constrained loss by simply arranging their outputs to reconstruct the original solution. Due to the perfect parallelism between them, the solution is achieved as fast as a coarse-resolution neural solver. In addition, the trained solvers bring the flexibility of simulating with multiple levels of resolution. We demonstrate the successful application of NeuralStagger on 2D and 3D fluid dynamics simulations, which leads to an additional $10\sim100\times$ speed-up. Moreover, the experiment also shows that the learned model could be well used for optimal control.
[ "Xinquan Huang", "Wenlei Shi", "Qi Meng", "Yue Wang", "Xiaotian Gao", "Jia Zhang", "Tie-Yan Liu" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10255v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10255v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.LG", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.LG", "physics.flu-dyn" ]
3 2 0 2 y a M 7 2 ] G L . s c [ 2 v 5 5 2 0 1 . 2 0 3 2 : v i X r a NeuralStagger: Accelerating Physics-constrained Neural PDE Solver with Spatial-temporal Decomposition Xinquan Huang * 1 Wenlei Shi * 2 Qi Meng 2 Yue Wang 2 Xiaotian Gao 2 Jia Zhang 2 Tie-Yan Liu 2 Abstract 1. Introduction Neural networks have shown great potential in ac- celerating the solution of partial differential equa- tions (PDEs). Recently, there has been a growing interest in introducing physics constraints into training neural PDE solvers to reduce the use of costly data and improve the generalization ability. However, these physics constraints, based on cer- tain finite dimensional approximations over the function space, must resolve the smallest scaled physics to ensure the accuracy and stability of the simulation, resulting in high computational costs from large input, output, and neural net- works. This paper proposes a general acceleration methodology called NeuralStagger by spatially and temporally decomposing the original learn- ing tasks into several coarser-resolution subtasks. We define a coarse-resolution neural solver for each subtask, which requires fewer computational resources, and jointly train them with the vanilla physics-constrained loss by simply arranging their outputs to reconstruct the original solution. Due to the perfect parallelism between them, the solution is achieved as fast as a coarse-resolution neural solver. In addition, the trained solvers bring the flexibility of simulating with multiple levels of resolution. We demonstrate the successful appli- cation of NeuralStagger on 2D and 3D fluid dy- namics simulations, which leads to an additional 10 ∼ 100× speed-up. Moreover, the experiment also shows that the learned model could be well used for optimal control. *Equal contribution 1King Abdullah University of Science and Technology, work done during an internship at Microsoft Research AI4Science 2Microsoft Research AI4Science. Correspondence to: Xinquan Huang <[email protected]>, Wenlei Shi <[email protected]>. Proceedings of the 40 th International Conference on Machine Learning, Honolulu, Hawaii, USA. PMLR 202, 2023. Copyright 2023 by the author(s). 1 Partial differential equations (PDEs) are the critical parts of scientific research, describing vast categories of physical and chemical phenomena, e.g. sound, heat, diffusion, electro- statics, electrodynamics, thermodynamics, fluid dynamics, elasticity, and so on. In the era of artificial intelligence, neural PDE solvers, in some works called neural operators, are widely studied as a promising technology to solve PDEs (Guo et al., 2016; Zhu & Zabaras, 2018; Hsieh et al., 2019; Bhatnagar et al., 2019; Bar-Sinai et al., 2019; Berner et al., 2020; Li et al., 2020b;a; Um et al., 2020; Pfaff et al., 2020; Lu et al., 2021b; Wang et al., 2021; Kochkov et al., 2021). Once the neural solver is trained, it can solve unseen PDEs with only an inference step, multiple magnitudes faster than that with traditional numerical solvers. Recently, several works have introduced physics constraints in training the neural PDE solvers in order to reduce the use of costly data and improve the generalization ability. They define the physics-constrained loss with certain finite dimensional approximations to transform the PDEs into algebraic equa- tions, which are further used to define the loss function (Zhu et al., 2019; Geneva & Zabaras, 2020; Wandel et al., 2020; Shi et al., 2022). However, to ensure stability and accuracy, they must define the loss in a relatively high resolution to resolve the smallest-scale physics in the PDE, resulting in huge input and output as well as increased neural network size. The solution by the neural network inference might still be slow, but it seems impossible to get further acceler- ations as the bottleneck comes from the input and output complexity. In this paper, we propose a simple methodology called Neu- ralStagger to jump out of the dilemma. The basic idea is to decompose the original physical fields into several coarser-resolution fields evenly. Then we jointly train a lightweight neural network to predict the solution in each coarse-resolution field respectively, which can be naturally a coarse-resolution neural solver to the original PDE. We design the decomposition rules so that the outputs of these lightweight networks can reconstruct the solutions in the original field with simple arrangements. For ease of read- ing, here and also in most parts of the paper, we illustrate the decomposition methodology in the 2-dimensional exam- NeuralStagger: Accelerating Physics-constrained Neural PDE Solver with Spatial-temporal Decomposition Figure 1. The training pipeline of NeuralStagger. Top: the spatial decomposition that splits the field into several pieces of coarse-resolution fields; Bottom: the temporal decomposition combined with spatial decomposition to construct the physics-constrained loss. ple with regular mesh and finite difference approximation. Figure 1 (top) shows the physical field in a 4 × 4 mesh is decomposed into 4 coarser-resolution fields, each of which is handled by a small neural network. We could also do similar things along the temporal dimension, as is shown in Figure 1 (bottom). The group of coarse-resolution solvers, as well as the decomposition and reconstruction operations, can be seen as an end-to-end neural PDE solver, which can be trained with the physics-constrained loss that resolves small-scale physics in a sufficiently high resolution. Be- cause the neural networks can run in parallel, the original simulation is achieved as fast as a coarse-resolution neural solver. In addition, the trained neural networks can predict the PDE's solution in various levels of resolution, rang- ing from the resolution of the individual coarse-resolution solver to the resolution of the physics-constrained loss by the combination of all these solvers. We believe that such flexibility is vital in balancing the computational resources and the resolution. We demonstrate the effectiveness of the NeuralStagger in the Navier-Stokes equation with three parametric settings, e.g., periodic boundary conditions with varied initial con- ditions, lid-driven cavity boundary conditions with varied initial conditions, and the flow around the obstacle with varied obstacles and initial conditions. We find that with NeuralStagger, the learned networks can conduct accurate and stable simulations with 20 ∼ 400 fold decrease on the computational load per GPU card or practically 10 ∼ 100× speed-up over SOTA neural PDE solvers. In addition, we demonstrate that they can accurately tackle the optimal con- trol task with auto-differentiation. Our contributions can be summarized in three parts: • We propose a general methodology called NeuralStag- ger to accelerate neural PDE solving by spatially and temporally decomposing the learning task and running a group of coarse-resolution solvers in parallelism. • The learned network group can provide solutions in multiple resolutions from the coarsest one by a single network to the original resolution, which provides the flexibility to balance the computational resources and the resolution. • We demonstrate that the methodology leads to 10 ∼ 100× speed-up over SOTA neural PDE solvers as well as the efficient solution on optimal control. In the following sections, we first briefly summarize the re- lated works in Section 2 and then introduce the preliminaries and the proposed NeuralStagger in Section 3. To showcase the efficiency and accuracy of the proposed method, we present the settings of the experiments and results in Sec- tion 4. Finally, we conclude and discuss the future work in Section 5. 2. Related Work Numerical methods. The concept of stagger has been used in several classical methods, e.g., the Leapfrog inte- gration scheme (Birdsall & Langdon, 1985) and the stag- gered grid method (Harlow & Welch, 1965). However, NeuralStagger is fundamentally different from these meth- ods in both targets and technical details. NeuralStagger is proposed to accelerate neural PDE solving under certain physics-constrained loss, while the classical methods tell how the continuous PDE can be discretized and solved with algebra, which can be naturally used to define the physics- constrained loss. As you would see in Section 4.2, we lever- age staggered grid method to define the physics-constrained loss in the flow around obstacles case. In addition, the ways of decomposition are also different. The Leapfrog integra- tion scheme updates positions and velocities at staggered time points, giving nice properties like time-reversibility and 2 NeuralStagger: Accelerating Physics-constrained Neural PDE Solver with Spatial-temporal Decomposition second-order accuracy; the staggered grid method stores the scalar variables in the cell centers and vector variables at the cell faces. In contrast, each coarse-resolution solver in NeuralStagger updates all the variables spatially in the same grid and temporally at the same time points. Neural PDE solvers. The neural PDE solver learns to solve a parametric PDE with merely an inference step, which is much faster than the numerical methods. Many impressive works have been done to improve the neural solver for para- metric PDEs in terms of neural network design, e.g., convo- lutional neural network (Guo et al., 2016; Tompson et al., 2017; Bhatnagar et al., 2019), graph neural networks (Pfaff et al., 2020), the multipole graph kernel (Li et al., 2020b), Fourier neural operators (Li et al., 2020a; Guibas et al., 2021), deepOnet (Lu et al., 2021a), the message passing neural network (Brandstetter et al., 2022b), Clifford neu- ral networks (Brandstetter et al., 2022a) and so on. After being trained with pre-generated simulated data and labels, they can solve the PDE several magnitudes faster than con- ventional numerical solvers with competitive accuracy. Re- cently there are raising concerns about the cost of collecting training data and the generalization ability, so several works have introduced the physics-constrained loss for training. For example, Wang et al. (2021) combined the DeepOnet with a physics-informed way to improve the sample effi- ciency. Zhu et al. (2019) proposed physics-constrained loss for high-dimensional surrogate modeling and Geneva & Zabaras (2020) introduced the use of a physics-constrained framework to achieve the data-free training in the case of Burgers equations. Wandel et al. (2020; 2021b) proposed the physics-constrained loss based on the certain approx- imation of the Navier-Stokes equation to solve fluid-like flow problems. Shi et al. (2022) proposed a general physics- constrained loss called mean square residual (MSR) loss as well as a neural network called LordNet for better perfor- mance. However, the physics-constrained loss by certain approximation requires the approximation to be sufficiently close to the continuous version, resulting in a relatively high- resolution discretization. Thus in complex and large-scale problems, the neural solver must be large enough for ex- pressiveness and its inference would still be slow. Although some works (Wang et al., 2021) directly calculate the deriva- tives via back-propagation through the neural network, they are known to have similar training problems as PINN, e.g., converging to trivial solutions. One parallel work (Ren et al., 2022) shares some similarities to the spatial decomposition of NeuralStagger, which leverages pixel shuffle and physics- constrained loss in the super-resolution tasks. However, we are different in target and solution. For example, we train multiple solvers to work in full parallelism and obtain the solution in multiple levels of resolution without training them again. 3. Methodology 3.1. Preliminaries Consider a connected domain Ω ⊆ Rn with boundary ∂Ω, and let (A, U, V) be separable Banach spaces. Then the parametric PDEs can be defined as the form S(u, a)(x) = 0, x ∈ Ω (1) where S : U × A → V is a linear or nonlinear differential operator, a ∈ A denotes the parameters under certain distri- bution μ, such as coefficient functions or boundary/initial conditions, and u ∈ U is the corresponding unknown solu- tion function. Further, we can define the solution operator of the parametric PDE G : A → U, which maps two infinite- dimensional function spaces. A main branch of works in neural PDE solvers approximate the solution operator by discretizing the functions into finite- dimensional spaces denoted by ˆA and ˆU and learning the mapping fθ : ˆA → ˆU. Correspondingly, we have the discretized version of the PDE's operator S by certain finite- dimensional approximations such as the finite difference method (FDM) and finite element method (FEM), which is denoted by ˆS. We denote the vector of the function values in a mesh with the hat symbol, e.g., ˆa is the vector of the PDE's parameter a ∼ μ. Then the physics-constrained loss is defined by forcing the predicted solution ˆu ∈ ˆU to satisfy ˆS given ˆa ∈ ˆA. For example, LordNet (Shi et al., 2022) proposed the general form with the mean squared error as follows, L(θ) = Ea∼μ|| ˆS(fθ(ˆa), ˆa)||2, (2) In this paper, we mainly focus on time-dependent problems as follows, S(u, a)(t, x) = 0, (t, x) ∈ [0, T ] × Ω (3) The temporal dimension is discretized with the timestep ∆t and the neural solver solves the PDE in an auto-regressive way, ˆut+∆t = fθ(ˆut, ˆa) (4) where ˆut is the corresponding discretized vector of the func- tion u at time t. Notice that similar to traditional numerical methods, the resolution of the finite-dimensional approxima- tion in physics-constrained loss, either in the spatial dimen- sion or in the temporal dimension, must be sufficiently high, otherwise, the approximation error will be too large to guide the neural PDE solver. This leads to huge input and output as well as large neural networks to ensure expressiveness, whose inference would also be slow. 3.2. NeuralStagger We propose a general methodology called NeuralStagger to gain further accelerations by exploiting the potential paral- lelism in the neural PDE solver. NeuralStagger decomposes 3 NeuralStagger: Accelerating Physics-constrained Neural PDE Solver with Spatial-temporal Decomposition the original learning task that maps ˆut to ˆut+∆t into sev- eral parallelizable subtasks in both spatial and temporal dimensions. The meshes of the subtasks spread evenly in the original field and stagger with each other. Then we can handle each subtask with a computationally cheap neu- ral network. The decomposition strategy is introduced as follows. Spatial decomposition. The upper part of Figure 1 shows the 2-dimensional example with regular mesh. We first split the grid into patches of the size sH × sW and construct a subgrid by selecting only one point in each patch, resulting in sH × sW subgrids evenly spread in the domain. We denote the functions in each sub-grid as ˆui,j t where t i and j represents the relative position of the sub-grid in horizontal and vertical directions. Then we use sH × sW neural networks to learn to predict the solution at t + ∆t as follows, and ˆai,j t+∆t = fθi,j (ˆui,j ˆui,j t , ˆai,j), (5) where fθi,j is the neural network for the sub-grid at the position (i, j). The outputs ˆui,j t+∆t compose the solution at the original grid. Then the neural networks can be jointly trained with the physics-constrained loss defined on the orig- inal grid. Notice that the neural networks are independent of each other and can be fully paralleled. As the input and output decrease by sH × sW times, the neural network can be much smaller and faster than the original one to be used for the neural solver. The decomposition rules can be ex- tended to higher-dimensional cases. In addition, the learning tasks at the subgrids are quite close to each other, except for the difference in the boundary of the domain, so we share the parameters of the neural networks fθi,j to reduce redundancy and accelerate training. Meanwhile, because there are often tiny differences between the inputs of the subtasks, we encourage the neural network to distinguish them by adding positional information of each grid point as additional input channels. Temporal decomposition. We can treat the temporal di- mension as a 1-dimensional grid with a fixed step ∆t. Thus we can also decompose the grid into sT sub-grids by select- ing a point for every sT points, where instead of predicting ˆut+∆t, the neural network predicts ˆut+sT ∆t, ˆut+sT ∆t = fθ (ˆut, ˆa) , (6) Given the solution sequence from t to t + (sT − 1) ∆t de- noted by ˆut,sT for simplicity, we can get the next sequence of the solution ˆut+sT ∆t,sT . Then the physics-constrained loss is defined on the sequence with timestep ∆t, as is shown in the lower part of Figure 1. Once the neural net- work is trained, we can generate the sequence ˆut+sT ∆t,sT by running the neural network inference of Formula 6 with sT threads in parallel with inputs ˆut,sT . The non-auto- regressive process can generate the solution in sT time steps within one inference step, which can be much faster than the original version with sT inference steps. Note that though we only need the initial condition for the coarsest-resolution test, we must prepare the first sT states with numerical solvers for training and the high-resolution test. However, this drawback is neglectful for long-time simulations. The spatial and temporal decompositions are orthogonal and can be used at the same time. We denote the joint de- composition operator as Ds, the transformation operator of the neural networks as FΘ and the reconstruction operator Es, where s represents all decomposition factors including sH , sW and sT , Θ represents all parameters of the neu- ral network group. The physics-constrained loss with the spatial-temporal decomposition can be written as, L(Θ) = Eˆut,sT || ˆS (Es (FΘ (Ds (ˆut,sT , ˆa))) , ˆut,sT , ˆa) ||2. (7) In addition, as the sub-grids spread evenly in the domain of the PDE, each of them can be seen as the down-sampled version of the original problem, where a local patch is re- duced to the point at a fixed relative position in the patch. Therefore, the learned neural networks are naturally coarse- resolution solvers to the PDE. Suppose (H, W, T ) is the tuple of the original height, width, and time span that the physics-constrained loss is conducted on. Then the coarse-resolution solvers are conducted on the resolution ( H ). Meanwhile, we can infer multiple levels of sH resolutions ranging from that of coarse-resolution solvers to the original one, all of which can reach the same speed by parallelism. , W sW , T sT 3.3. Choice of the decomposition factors Obviously, the acceleration effect by NeuralStagger grows as we use larger sH , sW and sT . However, these decom- position factors cannot be arbitrarily large. We conclude two potential constraints, i.e., the increased complexity of the learning task and the information loss in the input. We would like to leverage the following 2-dimensional diffu- sion equation with the periodic boundary condition as an example to explain the two constraints, ∂u(x, y, t) ∂t = ∆u(x, y, t), x, y, t ∈ [0, 1], u(x, y, 0) = f (x, y), x, y ∈ [0, 1], (8) (9) where u is the density function of diffusing material, ∆ is the Laplacian operator and f is the function of the initial condition. We use the regular mesh with d points in total and leverage the central difference scheme with the spatial step ∆x and temporal step ∆t. Then the PDE is transformed into a matrix equation on the discretized solution at a certain time t, denoted by ˆut ∈ Rd. Increased complexity of learning task. For the temporal 4 NeuralStagger: Accelerating Physics-constrained Neural PDE Solver with Spatial-temporal Decomposition By applying spatial decomposition, the input and out- put are equally partitioned into K = sH sW subgrids {ˆu1 t+1, * * * , ˆuK t+1}. Then according to the physics-constrained loss, the optimization goal becomes: t } and {ˆu1 t , * * * , ˆuK Figure 2. The bandwidth curve. dimension, we find that the larger decomposition factor might make the mapping from the input to the prediction more complex. For the linear diffusion equation, we can explicitly calculate the transfer matrix from ˆui to ˆui+∆t based on the matrix equation. Suppose the transfer matrix is Ti ∈ Rd×d. By iterative applying the transfer matrix, we can get the transformation from the initial condition ˆu0 to the solution at any time step k as follows, ˆuk∆t = ˆu0 k−1 (cid:89) 0 Ti. (10) For notational simplicity, we denote the resulting transfer matrix from ˆu0 to ˆuk∆t as Tk. By certain arrangements, Tk is a band matrix where the non-zero values are centralized around the diagonal. The bandwidth indicates the sparsity of the matrix as well as how local the points in the mesh entangle with each other. We observe that the bandwidth grows linearly with regard to k. For example, Figure 2 shows the case of d = 642. When the k ≥ 60, the matrix is dense and every element in ˆuk∆t is a weighted summation of almost all the elements in ˆut. This indicates that increasing k may make the entanglements between the grid points more complex, leading to a harder learning task for the neural network. Information loss. By spatial decomposition, each subgrid only reserves a small part of the original grid. Obviously, it may introduce the problem of information loss if the dropped points are important for the prediction in the sub- tasks. Here we theoretically characterize the information loss caused by spatial decomposition under the linear model setting, i.e., f (ˆut) = ˆutW ∗. Consider the diffusion equa- tion and the corresponding matrix equation. With some abuse of notation, the superscript i denotes the index of training samples, such as ˆui t and the bold symbol without the superscript i denotes the matrix composed of all the samples, such as ˆut. With N training samples, the physics- constrained loss aims to learn the parameters W ∗ of the linear model that satisfies: W ∗ = arg min W 1 N N (cid:88) i=1 ∥ˆui tW − yi∥2, (11) W ∗ 1 , * * * , W ∗ K = arg min W1,*** ,WK 1 N N (cid:88) K (cid:88) i=1 k=1 ∥(ˆui,k t Wk − yi,k)∥2, (12) where Wk ∈ Rm×m, m = d/K for k = 1, * * * , K. The next proposition shows a sufficient condition for equal pre- diction for Eq.(11) and Eq.(12). Proposition 3.1. If rank( ˆut) = rank( ˆuk ˆutW ∗ and ˆuk k will make the same prediction on yk. t ), the model t W ∗ We put the proof in Appendix A.1. In practice, the propo- sition is held approximation in many physical scenarios. This is because local patches of size sH sW do not distribute arbitrarily in the ambient space RsH sW , but rather live in some low-dimensional manifold. Hence, there is much in- formation redundancy in ˆut and with careful settings of sH and sW , the rank after the decomposition does not change much. In addition, the information loss can be made up by adding information that describes the local patches to the input. Such supplementary information can be extracted by either neural network layers or feature engineering, which can be designed for specific problems. In Section 4.4, we test several choices of design for fluid dynamics systems. 4. Experiments To evaluate the acceleration effect and accuracy of the pro- posed method, we test three cases of fluid dynamics simu- lation governed by the Navier-Stokes equation. We first target two benchmark settings, i.e., the periodic bound- ary condition and the lid-driven cavity boundary condi- tion (Zienkiewicz et al., 2006). In both settings, the initial condition changes, and the neural PDE solver learns to gen- eralize to various initial conditions. Next, we test the more challenging case called flow around obstacles in both the 2-dimensional (30 thousand grid points) and 3-dimensional (∼0.5 million grid points) cases. The neural PDE solver is trained to generalize to different obstacles as well as ini- tial conditions. Thirdly, we evaluate the capability of the learned solvers to handle the inverse problem. At last, we also demonstrate that adding supplementary information to the input helps alleviate the problem of information loss. where yi denotes the rest parts of the matrix equation. In general, we consider the incompressible Navier-Stokes 5 020406080100Iteration01000200030004000WidthBandwidth NeuralStagger: Accelerating Physics-constrained Neural PDE Solver with Spatial-temporal Decomposition Figure 3. Tests on Navier-Stokes equation with (left) periodic boundary condition and (right) Lid-driven cavity boundary condition. equation as follows: (cid:18) ∂⃗v ∂t ρ (cid:19) + (⃗v * ∇)⃗v = −∇p + μ∆⃗v + ⃗f ∇ * ⃗v = 0 (13) (14) where ⃗v is the fluid velocity field, p is the pressure field, μ is the viscosity, and ⃗f is the external force. In all exper- iments, we trained neural networks with Adam optimizer and decayed learning rates. The speed-up effect is mainly evaluated with the computational load called GMACs (Giga multiply-accumulate operations) per GPU card rather than the inference time of the neural network because it depends largely on the computational hardware. See Appendix A.2 for more details on the implementation. 4.1. Periodic and Lid-driven cavity boundary condition We first test the Navier-Stokes equation with the periodic boundary condition and the lid-driven cavity boundary con- dition. In both cases, the physics-constrained loss is ob- tained by discretizing the vorticity-stream equation with the central-difference scheme and the Crank-Nicolson method in the 64 × 64 regular mesh. The time step ∆t is 1e − 2 and the viscosity ν is 1e − 3. We use the popular FNO (Li et al., 2020a) to test the accuracy and speed in different set- tings of decomposition factors. The ground truth is obtained by FDM. We evaluate the accuracy by auto-regressively running the inference of the neural solver across the target length along time LT and compare the terminal state with that from the ground truth. Note that we compare all the re- sults on the original mesh and thus the spatially decomposed results reconstruct to the 64 × 64 resolution for evaluation. We measure with the relative error which is calculated by dividing the L2 norm of the error by the L2 norm of the ground truth. The measurement is denoted by Error-k where k is the number of time steps. Following the notations in Section 3.2, the decomposition factors along x dimension, z dimension, and the temporal dimension are denoted by sW , sH , and sT . In general, NeuralStagger achieves acceleration in both cases without losing much accuracy. As you can see in Figure 4, the coarse-resolution solver is also accurate when applied alone without reconstruction. In the case of the periodic boundary condition, the target length along time LT equals 2, which is 200 time steps. The flow is driven by the external force ⃗f , which is introduced in Appendix A.2. As you can see in Figure 3 (left), the relative errors of the learned neural solvers are lower than 0.2% in all settings of spatial and temporal decomposition factors. In terms of speed, with the most aggressive setting sT = 40, sH = sW = 2, and full parallelism, the GMACs of the 200-time-steps inference decrease from 31.92 to 0.24, which is 133 fold reduction, corresponding to 47× speed-up in time if the inference is conducted on A100 cards. We can also observe some trends in accuracy with regard to the choice of spatial and temporal factors. Error-1 grows like a linear function with the temporal factor sT in both spatial factor settings. The reason is that the learning task becomes more complex as we discuss in Section 3.3, and with the neural network unchanged, the accuracy drops. Meanwhile, the accumulated errors, i.e., Error-200, almost keep at the same level. This is because the steps in the auto-regressive procedure reduce as sT grows, e.g., when sT = 40, the neural networks for subtasks only predict 200/40 = 5 steps ahead. The benefit perfectly neutralizes the detriment of the increased task complexity. In the case of the lid-driven cavity boundary condition, the fluid acts in a cavity consisting of three rigid walls with no-slip conditions and a lid moving with a steady tangential velocity 1. We set the length of time LT = 27, much larger than that with the periodic boundary, to see if the simulation converges to the right steady state. With larger LT , we try larger temporal skip factors such as sT = 108. As is shown in Figure 3 (right), the relative errors are all controlled below 0.5% even after 2700 time steps. Again, with the most aggressive setting sT = 108, sH = sW = 2 and full parallelism, the GMACs per card of 2700-steps inference decreases from 404.92 to 1.12, which is 362 fold reduction, corresponding to 119× speed-up in time with 6 NeuralStagger: Accelerating Physics-constrained Neural PDE Solver with Spatial-temporal Decomposition Figure 4. The predictions in two resolutions. Top: lid-driven cavity boundary condition (left) and periodic boundary condition (right) and Bottom: flow around obstacles. A100 cards. Different from the periodic boundary condition, the accuracy drops when we increase sT , because in this case, the increase of sT brings more detriments of task complexity than the benefits from the shorter auto-regressive sequence. 4.2. Flow around obstacles In this section, we evaluate NeuralStagger in a larger and more complex setting called flow around obstacles. The set- ting is the same as that used in (Wandel et al., 2020), which is also our baseline. The fluid runs through a pipe, where we put different shapes of obstacles to affect the flow, including rotating cylinders and walls constructing a folded pipe. The external forces in Eq. 13 are neglected and set to 0. The neural solver is trained to generalize to different settings of the obstacles, including the shape and the velocity on the surface as well as the inflow/outflow velocities. Then we evaluate the neural solver in 5 randomly sampled configura- tions in both the cylinder case and the folded pipe case. You may refer to Appendix A.2 for more details. We leverage the same configurations as that in Wandel et al. (2020) in- cluding the discretization method, the physics-constrained loss, training strategies, the input features, the predicted variables as well as the evaluation metric. Specifically, the rectangular domain is discretized into a 100 × 300 regular mesh and ∆t = 4. The physics-constrained loss is used as the evaluation metric, measuring to what extent the predic- tion at the next time step satisfies the PDE given the current fluid state and the boundary conditions. As the fields of the fluid change much over time, we maintain a training pool initialized with a set of initial conditions and incrementally enrich it as the training goes on. This is achieved because the predictions from the neural network can be seen as new data if the neural network has been well-fitted in the current pool. One can refer to Wandel et al. (2020) for more details. Wandel et al. (2020) leverages U-net as the neural solver, but to demonstrate the full potential of NeuralStagger, we also try the other two neural network architectures, i.e., FNO and LordNet (Shi et al., 2022) which also leverages the physics-constrained loss to train the neural PDE solver. The experiments in Table 1 show that LordNet outperforms the other two neural networks in the baseline setting without NeuralStagger. Therefore, we use LordNet for further ex- periments on the choice of spatial and temporal factors (see the performance on other networks in Appendix A.5). We find that in this case, the information from the 100 × 100 grid (sH = 1, sW = 3) is sufficient to achieve compara- ble results to the U-net baseline, while larger spatial steps will introduce too much information loss. In addition, we observe that increasing the temporal factors hurts the accu- racy more obviously than those in the periodic boundary condition and the lid-driven boundary condition, though the accuracy is still comparable to U-net even with sT = 16. We believe this is because the dataset is incrementally ex- plored by maintaining a training pool and enriching it with the neural network's predictions during training while those predictions may not be accurate. As the physics constrained loss is defined on ˆut+(sT −1)∆t and ˆut+sT ∆t, inaccurate ˆut+(sT −1)∆t may mislead the neural network to the wrong direction. When we increase sT , more errors will be accu- mulated along the sequence from ˆut the ˆut+(sT −1)∆t and the training will be harder. Designing training algorithms to support NeuralStagger better remains unexplored and we leave it for future work. In terms of speed, the choices of spatial and temporal factors lead to different levels of acceleration, as is shown in Table 1, where GMACs per card is the average computational load of simulation for 16 timesteps. As you can see, for Lord- Net, there is an approximately linear relationship between GMACs per card and the inverse of each decomposition factor. The largest factor configuration to keep the accuracy comparable to the baseline is sT = 16, sH = 1, sW = 3, leading to the largest decrease in GMACs per card, i.e., 1/58 of LordNet without NeuralStagger, which can be attributed to 1/16 from the decrease of temporal steps and approxi- 7 {100x100, =8}Δt{32x32, =1.08}Δt{64x64, =0.01}Δt{100x300, =4}Δt{32x32, =0.4}Δt{64x64, =0.01}ΔtReferenceReferenceReference NeuralStagger: Accelerating Physics-constrained Neural PDE Solver with Spatial-temporal Decomposition mately 1/4 from the decrease of the neural network size and input size. The actual speed-up effect depends on the hardware devices we use. For example, when tested with NVIDIA RTX 2080ti, it leads to 23× speed-up and when tested with A100, it leads to 17× speed-up as the baseline of LordNet is already very fast. Table 1. The Performance of NeuralStagger with different decom- position factors and neural networks in the flow-around-obstacles settings. Config U-net FNO LordNet Temporal Spatial Folded factors factor pipe Cylinder GMACs per card - - - 1 1 2 2 8 16 - - - 6.32 e-5 1.24 e-4 4.01 e-4 4.54 e-4 1.05 e-5 4.11 e-5 (1, 3) 2.21 e-5 8.97 e-5 (2, 6) 5.00 e-4 2.98 e-3 (1, 1) 3.59 e-5 7.68 e-5 (1, 3) 5.51 e-5 1.19 e-4 (1, 3) 3.93 e-4 6.60 e-4 (1, 3) 3.47 e-4 8.55 e-4 29.60 18.51 71.04 19.84 4.46 35.52 9.92 2.48 1.24 Accelerations in the 3D case. We would like to further stress that the acceleration effect by the spatial decomposi- tion is even larger in 3-dimensional scenarios. Following the work (Wandel et al., 2021a), we test the 3-dimensional flow around obstacles case with U-net3d, FNO3d, and Lord- Net3d. In this case, the rectangular domain is discretized into 128 × 64 × 64 regular mesh and ∆t=4. We still train the neural network for the fluid dynamics from scratch like what we have done in 2-dimensional cases. More details and re- sults can be found in Appendix A.2. We evaluate the choice of decomposition factors per dimension. As you can see in Table 4.2, without losing much in accuracy, i.e., keeping the PDE residuals in the same magnitude, the spatial decompo- sition alone can introduce up to about 19 fold decrease on GMACs. What's more, the experiments demonstrate that for more realistic and challenging tasks, e.g. learning 3D fluid dynamics, the NeuralStagger can still work well. Table 2. The performance of NeuralStagger with different neural networks in the 3-dimensional flow-around-obstacles setting. Network U-net3d FNO3d LordNet3d Spatial factors - - - (2,2,2) (4,2,2) PDE residual 1.05 e-4 1.15 e-4 1.01 e-4 4.54 e-4 4.67 e-4 GMACs per card 62.73 21.89 73.86 8.23 3.99 4.3. Application in optimal control To further showcase the capability of the neural solver with NeuralStagger on the inverse problem, we conduct the opti- mal control experiment introduced in Wandel et al. (2020). The task is to change the flow speed to control the shedding frequency of a K ́arm ́an vortex street behind an obstacle. Here, we take an example of LordNet using NeuralStagger with setting sH = 1, sW = 3, sT = 2, which outperforms the baseline U-net in Table 1. We observe that it tackles this inverse problem much faster and also stabler than the baseline does. One may refer to Appendix A.3 and Figure 5 for more details about the settings and results. 4.4. Supplementary to the information loss As is discussed in Section 3.3, introducing supplement infor- mation can alleviate the bad influence of spatial decompo- sition on accuracy. We design and try two methods for the fluid cases. The first is the vorticity field that describes the local spinning motion of the fluid. While it introduces an additional input channel, the computational overhead does not increase much as we only change the first layer to fit the input size. The second is to add positional encoding (PE) that embeds the coordinates in the original grid to each of the input channels so as to help distinguish different sub- tasks. One may refer to Appendix A.4 for more details. As is shown in Table 3, with either choice, we observe obvious performance gains in the flow around obstacles case. Table 3. The performance of U-net w/wo the supplement informa- tion in flow-around-obstacles setting. Spatial factors None Vorticity Folded pipe PE Cylinder None Vorticity PE (1,3) 1.94e-4 1.79e-4 8.06e-5 2.84e-4 2.56e-4 1.46e-4 (2,6) 4.35e-4 2.28e-4 2.93e-4 1.09e-3 6.21e-4 7.46e-4 5. Conclusion and Limitation We present NeuralStagger, a general framework for acceler- ating the neural PDE solver trained by physics-constrained loss. By spatially and temporally decomposing the learning task and training multiple lightweight neural networks, the neural solver is better paralleled and much faster with suffi- cient computational resources. In addition, each lightweight neural network is naturally a coarse-resolution solver and they bring the flexibility of producing the solutions on mul- tiple levels of resolution, which is important for balancing the resolution and computational resources. We discuss the choice of decomposition factors and empirically test their influence on accuracy and speed. The experiments in fluid dynamics simulation show that NeuralStagger brings an additional 10 to 100× speed-up over SOTA neural PDE 8 NeuralStagger: Accelerating Physics-constrained Neural PDE Solver with Spatial-temporal Decomposition solvers with mild sacrifice on accuracy. One limitation of our work is that we only define the spatial decomposition over regular meshes, while it turns to the non-trivial vertex coloring problem for irregular meshes. Heuristic coloring algorithms would be useful for this prob- lem, and we would like to explore it in future works. Acknowledgments The authors thank the reviewers and area chairs for their helpful suggestions. Xinquan Huang acknowledges finan- cial support from King Abdullah University of Science and Technology (KAUST). References Bar-Sinai, Y., Hoyer, S., Hickey, J., and Brenner, M. P. Learning data-driven discretizations for partial differen- tial equations. Proceedings of the National Academy of Sciences, 116(31):15344–15349, 2019. Bartlett, P. L., Long, P. M., Lugosi, G., and Tsigler, A. Benign overfitting in linear regression. Proceedings of the National Academy of Sciences, 117(48):30063–30070, 2020. Berner, J., Dablander, M., and Grohs, P. Numerically solv- ing parametric families of high-dimensional kolmogorov partial differential equations via deep learning. arXiv preprint arXiv:2011.04602, 2020. Bhatnagar, S., Afshar, Y., Pan, S., Duraisamy, K., and Kaushik, S. Prediction of aerodynamic flow fields using convolutional neural networks. Computational Mechanics, 64(2):525–545, 2019. Birdsall, C. K. and Langdon, A. B. Plasma physics via computer, 1985. Brandstetter, J., Berg, R. v. d., Welling, M., and Gupta, J. K. Clifford neural layers for pde modeling. arXiv preprint arXiv:2209.04934, 2022a. Brandstetter, J., Worrall, D., and Welling, M. Message pass- ing neural pde solvers. arXiv preprint arXiv:2202.03376, 2022b. Geneva, N. and Zabaras, N. Modeling the dynamics of pde systems with physics-constrained deep auto-regressive networks. Journal of Computational Physics, 403: 109056, 2 2020. ISSN 00219991. doi: 10.1016/j.jcp.2019. 109056. URL https://linkinghub.elsevier. com/retrieve/pii/S0021999119307612. Guibas, J., Mardani, M., Li, Z., Tao, A., Anandkumar, A., and Catanzaro, B. Adaptive fourier neural operators: Efficient token mixers for transformers. arXiv preprint arXiv:2111.13587, 2021. Guo, X., Li, W., and Iorio, F. Convolutional neural networks for steady flow approximation. Proceedings of the 22nd ACM SIGKDD international conference on knowledge discovery and data mining, pp. 481–490, 2016. Harlow, F. H. and Welch, J. E. Numerical calculation of time-dependent viscous incompressible flow of fluid with free surface. The physics of fluids, 8(12):2182–2189, 1965. Hsieh, J.-T., Zhao, S., Eismann, S., Mirabella, L., and Er- mon, S. Learning neural pde solvers with convergence guarantees. In International Conference on Learning Representations, 2019. Kingma, D. P. and Ba, J. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. Kochkov, D., Smith, J. A., Alieva, A., Wang, Q., Bren- ner, M. P., and Hoyer, S. Machine learning accel- erated computational fluid dynamics. arXiv preprint arXiv:2102.01010, 2021. Li, Z., Kovachki, N., Azizzadenesheli, K., Liu, B., Bhat- tacharya, K., Stuart, A., and Anandkumar, A. Fourier Neural Operator for Parametric Partial Differential Equations, 2020a. URL http://arxiv.org/abs/ 2010.08895. arXiv: 2010.08895. Li, Z., Kovachki, N., Azizzadenesheli, K., Liu, B., Stu- art, A., Bhattacharya, K., and Anandkumar, A. Mul- tipole graph neural operator for parametric partial dif- ferential equations. In Advances in Neural Information Processing Systems, volume 33, pp. 6755–6766, 2020b. Lu, L., Jin, P., and Karniadakis, G. E. DeepONet: Learn- ing nonlinear operators for identifying differential equa- tions based on the universal approximation theorem of operators. Nature Machine Intelligence, 3(3):218– ISSN 2522-5839. doi: 10.1038/ 229, March 2021a. s42256-021-00302-5. URL http://arxiv.org/ abs/1910.03193. arXiv:1910.03193 [cs, stat]. Lu, L., Jin, P., Pang, G., Zhang, Z., and Karniadakis, G. E. Learning nonlinear operators via deeponet based on the universal approximation theorem of operators. Nature Machine Intelligence, 3(3):218–229, 2021b. Paszke, A., Gross, S., Chintala, S., Chanan, G., Yang, E., DeVito, Z., Lin, Z., Desmaison, A., Antiga, L., and Lerer, A. Automatic differentiation in pytorch. NIPS 2017 Workshop Autodiff, 2017. Pfaff, T., Fortunato, M., Sanchez-Gonzalez, A., and Battaglia, P. W. Learning mesh-based simulation with graph networks. arXiv preprint arXiv:2010.03409, 2020. 9 NeuralStagger: Accelerating Physics-constrained Neural PDE Solver with Spatial-temporal Decomposition Zhu, Y. and Zabaras, N. Bayesian deep convolutional encoder–decoder networks for surrogate modeling and uncertainty quantification. Journal of Computational Physics, 366:415–447, 2018. Zhu, Y., Zabaras, N., Koutsourelakis, P.-S., and Perdikaris, Physics-constrained deep learning for high- P. surrogate modeling and uncertainty dimensional quantification without Journal of Computational Physics, 394:56–81, October 2019. ISSN 00219991. 10.1016/j.jcp.2019.05.024. https://linkinghub.elsevier.com/ URL retrieve/pii/S0021999119303559. labeled data. doi: Zienkiewicz, O., Taylor, R., and Nithiarasu, P. The finite element method for fluid dynamics. 6th edition. Elsevier, 2006. Ren, P., Rao, C., Liu, Y., Ma, Z., Wang, Q., Wang, J.-X., and Sun, H. Physics-informed Deep Super-resolution for Spatiotemporal Data, August 2022. URL http:// arxiv.org/abs/2208.01462. arXiv:2208.01462 [physics]. Ronneberger, O., Fischer, P., and Brox, T. U-net: Con- volutional networks for biomedical image segmenta- tion. In International Conference on Medical image computing and computer-assisted intervention, pp. 234– 241. Springer, 2015. Shi, W., Huang, X., Gao, X., Wei, X., Zhang, J., Bian, J., Yang, M., and Liu, T.-Y. LordNet: Learning to Solve Parametric Partial Differential Equations without Simu- lated Data, 2022. URL https://arxiv.org/abs/ 2206.09418. ArXiv: 2206.09418. Tompson, J., Schlachter, K., Sprechmann, P., and Perlin, K. Accelerating eulerian fluid simulation with convolu- tional networks. In International Conference on Machine Learning, pp. 3424–3433. PMLR, 2017. Um, K., Brand, R., Fei, Y. R., Holl, P., and Thuerey, N. Solver-in-the-loop: Learning from differentiable physics to interact with iterative pde-solvers. In Advances in Neural Information Processing Systems, volume 33, pp. 6111–6122, 2020. Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L., and Polosukhin, I. Attention is all you need. arXiv preprint arXiv:1706.03762, 2017. Wandel, N., Weinmann, M., and Klein, R. Learning Incom- pressible Fluid Dynamics from Scratch – Towards Fast, Differentiable Fluid Models that Generalize, 2020. URL http://arxiv.org/abs/2006.08762. arXiv: 2006.08762. Wandel, N., Weinmann, M., and Klein, R. Teaching the Incompressible Navier-Stokes Equations to Fast Neural Surrogate Models in 3D. Physics of Fluids, 33(4):047117, April 2021a. ISSN 1070-6631, 1089-7666. doi: 10.1063/ 5.0047428. URL http://arxiv.org/abs/2012. 11893. arXiv:2012.11893 [physics]. Wandel, N., Weinmann, M., Neidlin, M., and Klein, R. Spline-PINN: Approaching PDEs without Data using Fast, Physics-Informed Hermite-Spline CNNs. arXiv preprint, 2021b. URL http://arxiv.org/abs/ 2109.07143. Wang, S., Wang, H., and Perdikaris, P. Learning the so- lution operator of parametric partial differential equa- tions with physics-informed deeponets. arXiv preprint arXiv:2103.10974, 2021. 10 NeuralStagger: Accelerating Physics-constrained Neural PDE Solver with Spatial-temporal Decomposition A. Appendix A.1. Information loss caused by spatial decomposition In this section, we provide the proof to proposition 3.1 in the linear model setting. In this section, we will theoret- ically characterize the information loss caused by spatial decomposition under the linear model setting. Note that the proof is done on the 1-dimensional diffusion equation with the explicit method for ease of understanding, but as we will see, the conclusion is the same in the case with 2 dimensions or the implicit method. We consider a simple 1d partial differential equation with Dirichlet boundary condition: ∂tu = ∆u, x ∈ Ω ut(x) = ft(x), x ∈ ∂Ω (15) (16) Discretizing the function u on grid (x1, * * * , xd), we denote ˆuj = u(xj). We consider the finite difference discretization: t+1 − ˆuj ˆuj δt t = (ˆuj+1 t − ˆuj t − ˆuj−1 t t ) − (ˆuj δx2 ˆuj t+1 = ft+1(xj), xj = {x1, xd} ) , xj ̸= {x1, xd} (17) (18) Given the input ˆut ∈ Rd and output ˆut+∆t ∈ Rd, the output ˆut+∆t is parameterized by linear model as ˆut+∆t = ˆutW where W ∈ Rd×d denotes the learned parameters. The physics constrained loss aims to learn the parameters W ∗ of the linear model that satisfies: W ∗ = arg min W 1 N N (cid:88) i=1 ∥ˆui tW − yi∥2, (19) where i denotes the index of training samples and yj = ft+1(xj), xj = {x1, xd}; yj = ˆuj t − t − ˆuj−1 δt δx2 , xj ̸= {x1, xd}. t − ˆuj t ) − (ˆuj (ˆuj+1 (cid:16) (cid:17) ) t By applying spatial decomposition, the input and output are equally partitioned into K blocks {ˆu1 t } and {ˆu1 t+∆t}. Each block contains d/K coordi- nates Then according to the MSR loss, the optimization goal becomes: t+∆t, * * * , ˆuK t , * * * , ˆuK W ∗ 1 , * * * , W ∗ K = arg min W1,*** ,WK 1 N N (cid:88) K (cid:88) i=1 k=1 ∥(ˆui,k t Wk − yi,k)∥2, (20) where Wk ∈ Rm×m, m = d/K for k = 1, * * * , K. Proof: We first consider the case that (cid:80)N i=1(ˆui,k is full rank. ((cid:80)N i=1(ˆui,k The minimizer of Eq.(20) is W ∗ t )−1((cid:80)N t )τ ˆui,k t k = t )τ yi,k). We denote the t )τ ˆui,k i=1(ˆui,k 11 t)τ ˆui i=1(ˆui i=1(ˆut i=1(ˆui,k t )τ ˆui,k matrix A = ((cid:80)N t )−1, We construct a d × d matrix B by letting B(k + id/K, k + jd/K) = A(i, j), for i = 0, * * * , d/K; j = 0, * * * , d/K; otherwise, B(i, j) = 0. Then it is easy to check that the matrix B is the pseudo- inverse of (cid:80)N t. The minimizer of Eq.(19) is (Bartlett et al., 2020) B((cid:80)N i)τ yi). As the matrix B only has non-zero values on the coordinates that cor- respond to the k-th block, we have the k-the block of W ∗ equals W ∗ k and other blocks equal zero matrices. De- noting the matrix composed of all the samples with the bold symbol without the superscript i such as ˆut for (cid:8)ˆui (cid:9) t (cid:111) , we have (cid:80)N t )τ ˆuk and ˆuk t and (cid:80)N t = ( ˆut)τ ˆut. By Rank–nullity theorem, it is easy to see that rank(( ˆut)τ ˆut) = rank( ˆut) and rank(( ˆuk t ). Then we get the results in the proposition. For the case that (cid:80)N i )τ ˆut,k i ≤ d/K, we can select its maximal linearly independent group to obtain its pseudo- inverse and apply similar analyses to get the results. In the case of the implicit method, the term ˆui tW in the physics constrained loss becomes ˆui tW V where V is an invertible matrix. This also does not change the conclusion. t for i=1(ˆui t ) = rank( ˆuk ˆui,k t t)τ ˆui t = ( ˆuk t )τ ˆui,k i=1(ˆut,k i=1(ˆui,k t )τ ˆuk (cid:110) A.2. Implementation details We implemented FNO with the original 2-dimensional ver- sion in the official repository, where we set the truncation mode to 12 and the width to 64. For the LordNet, we only stack 2 Lord modules and fix the channel count to 64 in all layers. In the position-wise embedding of the 2 Lord modules, we stack two 1×1 Convolutional layers, where the hidden embedding contains 256 and 128 channels separately, and GELU activation is used between the Convolutional lay- ers. The implementation of Unet is based on the U-Net architecture (Ronneberger et al., 2015) with 20 hidden chan- nels, which is consistent with that in (Wandel et al., 2020) The learning rates and training samples are described as follows. To keep out the potential influence of computa- tional resources like cores and memory, we test the speed of NeuralStagger under the setting that each coarse-resolution solvers have sufficient resources to use. Therefore, we run each solver on Nvidia A100 GPUs with the batch size equals to 1. The time per step shown in Table 1 is calculated by dividing the inference time of the coarse-resolution solver by the temporal factor sT . The time of decomposition and reconstruction is ignored because the operation supported by 'pixel shuffle' is super efficient. We also calculated GMACs (Giga multiply-accumulate Operations) per card, which is the average computational load of simulation for 16 timesteps. Note that for the GMACs of FFT operation, we calculate it by 2N log2N , where N is the number of spatial grids. NeuralStagger: Accelerating Physics-constrained Neural PDE Solver with Spatial-temporal Decomposition Periodic Boundary Condition We generate the data with random fields to generate a periodic function on a 64×64 grid with a time-step of 1e-2 where we record the solution every time step, where the external force is fixed f (x) = 0.1sin(2π(x + y)) + cos(2π(x + y)). For the perioidc boundary and lid-driven boundary conditions, we use the vorticity-stream function form of Eq. 13 as the physics- constrained loss. With the Helmholtz decomposition to Eq. 13, we rewrite the Navier-Stokes equation: (cid:19) (cid:18) ∂2ω + + ∂2ω ∂y2 (21) = − 1 Re ∂ω ∂t ∂ψ ∂y ∂ψ ∂x ∂x2 + ∂ω ∂x ∂2ψ ∂x2 + ∂ω ∂y ∂2ψ ∂y2 = −ω, where ω is the vorticity function, ψ is the stream func- tion, and Re is the Reynolds number. The initial condition ω0 is generated by random field satisfying the distribution N (cid:0)0, 83(−∆ + 64I)−4.0(cid:1). We use 6000 states for training. In this case, we use FNO to test NeuralStagger and decay the initial learning rate 3e-3 with a factor of 0.9 every 5000 iterations. (22) Lid-driven Cavity boundary condition We generate data on a 64×64 domain but we train the neural network to predict the values of ψ inside the boundary, which is a 2- dimensional matrix of the shape (H − 2) × (W − 2). The random initial conditions are generated in the same way as the periodic boundary conditions. To make the initial state consistent with the boundary condition, we solve with the numerical solver for the first T0 = 1.98 and use ωT0 as the initial state. We use 8200 states for training with FNO, and decay the initial learning rate 3e-3 with a factor of 0.9 every 10000 iterations. Flow around Obstacles The data generation is the same as the setting used in (Wandel et al., 2020), where the resolu- tion of the domain is 100×300, ∆t = 4, ρ = 4, μ = 0.1. In training, different types of environments are used including magnus, box, and pipe. The locations and the velocity are variable during the training, e.g., the velocity is ranged from 0.0 to 3 m/s, the diameter of the obstacle is ranged from 10 to 40, and the coordinate x of the location is randomly from 65 to 75 and the coordinate y of that is from 40 to 60. And then for the test, we randomly select the location and flow velocity to test and in our experiment, the Reynolds number of tests is 517. In this case, we train the model from scratch without any data for sT = 1. For sT > 1, we use the bench- mark to pre-generate the initial sequence ˆu0,sT for training. During the training, the predicted samples ˆusT ,sT are not accurate, and feeding them into the training pool might col- lapse the training. Thus, we use the benchmark to correct the parts of predicted samples ˆusT +1,sT −1. The learning rate is 1e-3 for Lordnet and 3e-3 for FNO, both with a factor of 0.9 every 5000 iterations. The quantitative comparison in this paper is conducted on a 100×300 grid. For the optimal 12 control of the vortex shedding experiment, the domain size is 100×300, and used the trained neural PDE solver based on the above training settings. The Reynolds number here is 880. The optimizer for both Unet and LordNet is Adam optimizer with a learning rate of 1e-3. 3-dimensional Flow around obstacles Similar to the 2- dimensional case, the training and testing were conducted in a 128×64×64 domain with ∆t=4 and the neural networks are trained from scratch. In training, various types of en- vironments are used in which including obstacles such as boxes, spinning balls, or cylinders. The locations of the obstacles and inflow/outflow velocities are variable, e.g., the velocity is ranged from 0.0 to 3.0 m/s, the diameter of the obstacle is ranged from 10 to 45, and the coordinates, y and z, of the location is randomly from 22 to 42 and the coordinate x of that is from 22 to 42 and 86 to 106. And then for the test, we choose the same benchmark test in (Wandel et al., 2021a) to compare the performance of different neural networks and different spatial-temporal factors. We use a learning rate of 1e-3 and Adam optimizer to train the model. The networks used are extensions of the original networks to the 3D version. The U-net3d (baseline) is the version from the repository of (Wandel et al., 2021a). For the FNO3d, we set the truncation mode to 12 and the width to 64. For the LordNet3d, we only stack 2 Lord modules and fix the channel count to 64 in all layers. The quantitative com- parison is based on the PDE residuals on the 128×64×64 domain. Here, the GMACs are the cost for one timestep of simulation. Difference scheme We use the 2nd-order central finite dif- ference, while staggered Marker-And-Cell (MAC) for the Flow around obstacles, which is the same as the benchmark (Wandel et al., 2020). It is worth noting that the application of a higher-order finite difference method would incur ad- ditional computational costs during the calculation of the physics-constrained loss in the training process. However, it would not impact the inference stage of the model. A.3. Application in optimal control The example of the inverse problem used in this paper is the same as the one in Wandel et al. (2020). The goal is to change the flow speed to control the shedding frequency of a K ́arm ́an vortex street. The shedding frequency is estimated by the frequency spectrum V (f ) of the y-component of the velocity field behind the obstacle over 200 time steps, denoted by E . We define the loss function L = |V (f )|2(cid:105) (cid:16) , where ˆf is the target frequency. Then we compute the gradient of the velocity with regard to the loss by auto-differentiation through the neural solver and leverage Adam optimizer (Paszke et al., 2017; Kingma & Ba, 2014) to update the velocity. We compare the result of |V (f )|2(cid:105) (cid:104) (cid:17)2 − ˆf E (cid:104) NeuralStagger: Accelerating Physics-constrained Neural PDE Solver with Spatial-temporal Decomposition the learned model with the setting sH = 1, sW = 3, sT = 2 to that shown in Wandel et al. (2020). As is shown in Figure 5, the velocity controlled by LordNet converges to the target velocity with fewer iterations. by introducing supplement information. Notice that, for the way of PE, there is no increase in the parameter size. For the way using vorticity, the input channel will increase by 1, yielding the increase of the parameter and computational overhead, but they can be ignored because it just influences the first layer to fit the input size. A.5. The full results of three cases with different spatial-temporal factors The full results of three cases with different spatial-temporal factors are presented in Tables 4, 5, 6, 7. Table 4. Tests on Navier-Stokes equation with periodic boundary condition. Temporal Skipping (2,2) Error-200. (1,1) Error-200 LT = 2, LT = 2, Error-1 Error-1 Figure 5. The optimization curve of the frequency control for vor- tex streets. The U-net converged after almost 72 iterations, while the LordNet using NeuralStagger converged after 55 iterations. A.4. The alleviation of the accuracy decrease from the spatial decomposition Adding supplement information that could communicate the information between decomposed patches can alleviate the accuracy decrease due to the information loss. For example, vorticity, which describes the local spinning motion of the fluid, is defined by ω = ∂vy ∂x − ∂vx ∂y . (23) It contains the communications between the velocity compo- nent in different directions, which is suitable to make up the lost information to improve the accuracy. Another way is to embed the coordinates using positional encoding (Vaswani et al., 2017) (PE) as the additional input feature and then add them to the input of the neural networks to improve the accuracy. Here we take the 2-dimensional flow around obstacles cases to test. For the LordNet, its capacity will decrease when applied to the coarse-resolution grids. For the FNO, the main feature is embedded into the Fourier domain, whose information is well-reserved if the physical fields are smooth and the samples are not aliasing. Both of them will introduce ambiguous factors to the demonstration. To focus on the demonstration of the help of supplement information for accuracy improvement, we select the Unet to test. As shown in Table 3, when there is no network capacity decrease, the accuracy decrease of the NeuralStagger can be improved 1 5 10 20 25 40 0.0000058 0.0011939 0.0000074 0.0016352 0.0000297 0.0012140 0.0000308 0.0016848 0.0000626 0.0013126 0.0000654 0.0016719 0.0001074 0.0011042 0.0001321 0.0017580 0.0001623 0.0013976 0.0001833 0.0017831 0.0002501 0.0012091 0.0002545 0.0012931 Table 5. Tests on Navier-Stokes equation with Lid-driven cavity boundary condition. Temporal (1,1) Skipping Error-1 Error-2700 Error-1 Error-2700. LT = 27, LT = 27, (2,2) 1 27 54 108 1.82 e-5 3.76 e-4 8.78 e-4 1.86 e-3 0.00228 0.00255 0.00404 0.00461 1.78 e-5 5.38 e-4 1.18 e-3 2.30 e-3 0.00283 0.00390 0.00420 0.00478 A.6. Application to a larger-scale problem with large Reynolds number To showcase the effectiveness of the proposed method in handling larger-scale problems with high Reynolds numbers, we conducted experiments on the Navier-Stokes equation with periodic boundary conditions. The resolution for this case was set to 256×256, and the viscosity was set to 1e-4. The results of these experiments are presented in Table 8. In this particular case, which falls within the turbulence regime (Li et al., 2020a), the results highlight the robust performance of NeuralStagger in turbulent flows. Regard- less of the spatial and temporal decomposition used during training, the network's predictions achieved a similar level of accuracy. To further demonstrate the effectiveness of the NeuralStag- ger rather than a trivial interpolation, we compared the pre- 13 050100150200Iteration0246810FrequencyE[|V(f)|2]: NeuralStaggerE[|V(f)|2]: U-netTarget NeuralStagger: Accelerating Physics-constrained Neural PDE Solver with Spatial-temporal Decomposition Table 6. The Performance of NeuralStagger with different decom- position factors and neural networks in the flow-around-obstacles setting. Config U-net FNO LordNet Temporal Spatial Folded factors factor pipe Cylinder GMACs per card - 1 1 2 8 16 - 1 1 2 8 16 - 1 1 2 8 16 - 6.32 e-5 1.24 e-4 (1, 3) 1.94 e-4 2.84 e-4 (2, 6) 4.35 e-4 1.09 e-3 (1, 3) 6.76 e-4 9.12 e-4 (1, 3) 6.43 e-4 2.02 e-3 (1, 3) 1.11 e-3 3.70 e-3 - 4.01 e-4 4.54 e-4 (1, 3) 6.01 e-4 1.01 e-3 (2, 6) 1.81 e-3 3.27 e-3 (1, 3) 3.88 e-4 6.74 e-4 (1, 3) 5.23 e-4 2.19 e-3 (1, 3) 5.77 e-4 3.49 e-3 - 1.05 e-5 4.11 e-5 (1, 3) 2.21 e-5 8.97 e-5 (2, 6) 5.00 e-4 2.98 e-3 (1, 3) 5.51 e-5 1.19 e-4 (1, 3) 3.93 e-4 6.60 e-4 (1, 3) 3.47 e-4 8.55 e-4 29.60 9.76 2.40 4.88 1.22 0.61 18.51 6.22 1.69 3.11 0.78 0.39 71.04 19.84 4.46 9.92 2.48 1.24 Table 7. The performance of NeuralStagger with different neural networks in the 3-dimensional flow-around-obstacles setting. Network U-net3d FNO3d LordNet3d Spatial factors - (2,2,2) (4,2,2) - (2,2,2) (4,2,2) - (2,2,2) (4,2,2) PDE residual 1.05 e-4 2.85 e-4 4.34 e-4 1.15 e-4 2.17 e-4 4.07 e-4 1.01 e-4 4.54 e-4 4.67 e-4 GMACs per card 62.73 7.84 3.92 21.89 2.80 1.42 73.86 8.23 3.99 and trained model with sT = 1, sH = sW = 2, the predic- tion error is 1.93 e-4, while the error of the result via bilinear interpolation based on the coarse-resolution field is 1.29 e-2. As for temporal decomposition, given a sequence of states ˆu0,5 and the trained model with sT = 5, sH = sW = 1, the average prediction error of predictions ˆu6,4 is 9.88 e-4, while the average error of results via the bilinear interpo- lation based on the predicted states at 5 and 10 is 3.78e-3. These tests mean the extra information, which satisfies the equation, is contained in intermediate states. A.7. The limitations of scalability to the irregular meshes As we mentioned earlier, one limitation of our work is that the decomposition is specifically defined on the regular meshes. To address this limitation, there are several well- established numerical methods available to handle irregular domains, such as the finite volume method with a triangular mesh. To construct the physics-constrained loss in such cases, we could adopt a similar approach to constructing algebraic equations in those numerical methods. Specifi- cally, the neural network takes the physical properties in each volume as input and predicts the properties at the next time step as output. Regarding the decomposition algorithm, the key is to split the mesh into a fixed number of groups as evenly as possible, enabling the neural network to learn each subtask effectively. As it is unnecessary to strictly obey the graph coloring rules, i.e., no adjacent nodes have the same color, there is much flexibility in choosing or designing the coloring algorithm. Taking the classical greedy algorithm as an example, we can define a coloring order by depth-first search in the mesh and assign a legal color to a node each time. We can further reweigh the priority of color to the inverse of the assignment times of that color so that each group tends to have similar amounts of nodes. Table 8. Further tests on Navier-Stokes equation with periodic boundary condition. Temporal LT = 2, LT = 2, Skipping Error-1 Error-200 Error-1 Error-200 Error-1 Error-200. LT = 2, (1,1) (2,2) (4,4) 1 5 10 2.46 e-4 5.01 e-2 1.93 e-4 4.77 e-2 2.38 e-4 4.93 e-2 9.91 e-4 4.67 e-2 9.89 e-4 4.66 e-2 1.36 e-3 5.00 e-2 2.87 e-3 5.04 e-2 2.67 e-3 4.84 e-2 3.03 e-3 5.09 e-2 dictions from NeuralStagger to the interpolation-based re- sults. As for spatial decomposition, given the initial states 14
http://arxiv.org/abs/2302.10249v1
2023-02-20T19:27:21
2023-02-20T19:27:21
Faster high-accuracy log-concave sampling via algorithmic warm starts
Understanding the complexity of sampling from a strongly log-concave and log-smooth distribution $\pi$ on $\mathbb{R}^d$ to high accuracy is a fundamental problem, both from a practical and theoretical standpoint. In practice, high-accuracy samplers such as the classical Metropolis-adjusted Langevin algorithm (MALA) remain the de facto gold standard; and in theory, via the proximal sampler reduction, it is understood that such samplers are key for sampling even beyond log-concavity (in particular, for distributions satisfying isoperimetric assumptions). In this work, we improve the dimension dependence of this sampling problem to $\tilde{O}(d^{1/2})$, whereas the previous best result for MALA was $\tilde{O}(d)$. This closes the long line of work on the complexity of MALA, and moreover leads to state-of-the-art guarantees for high-accuracy sampling under strong log-concavity and beyond (thanks to the aforementioned reduction). Our starting point is that the complexity of MALA improves to $\tilde{O}(d^{1/2})$, but only under a warm start (an initialization with constant R\'enyi divergence w.r.t. $\pi$). Previous algorithms took much longer to find a warm start than to use it, and closing this gap has remained an important open problem in the field. Our main technical contribution settles this problem by establishing the first $\tilde{O}(d^{1/2})$ R\'enyi mixing rates for the discretized underdamped Langevin diffusion. For this, we develop new differential-privacy-inspired techniques based on R\'enyi divergences with Orlicz--Wasserstein shifts, which allow us to sidestep longstanding challenges for proving fast convergence of hypocoercive differential equations.
[ "Jason M. Altschuler", "Sinho Chewi" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10249v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10249v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "math.ST", "@scheme": "http://arxiv.org/schemas/atom" }
[ "math.ST", "cs.DS", "cs.LG", "math.AP", "stat.ML", "stat.TH" ]
Faster high-accuracy log-concave sampling via algorithmic warm starts Jason M. Altschuler NYU [email protected] Sinho Chewi MIT [email protected] February 22, 2023 Abstract Understanding the complexity of sampling from a strongly log-concave and log-smooth dis- tribution π on Rd to high accuracy is a fundamental problem, both from a practical and theo- retical standpoint. In practice, high-accuracy samplers such as the classical Metropolis-adjusted Langevin algorithm (MALA) remain the de facto gold standard; and in theory, via the proxi- mal sampler reduction, it is understood that such samplers are key for sampling even beyond log-concavity (in particular, for distributions satisfying isoperimetric assumptions). In this work, we improve the dimension dependence of this sampling problem to d1/2 , ) ( d whereas the previous best result for MALA was . This closes the long line of work on ) ( the complexity of MALA, and moreover leads to state-of-the-art guarantees for high-accuracy sampling under strong log-concavity and beyond (thanks to the aforementioned reduction). O ̃ O ̃ Our starting point is that the complexity of MALA improves to , but only under a ) warm start (an initialization with constant R ́enyi divergence w.r.t. π). Previous algorithms took much longer to find a warm start than to use it, and closing this gap has remained an important open problem in the field. Our main technical contribution settles this problem by establishing the first R ́enyi mixing rates for the discretized underdamped Langevin diffusion. For this, we develop new differential-privacy-inspired techniques based on R ́enyi divergences with Orlicz–Wasserstein shifts, which allow us to sidestep longstanding challenges for proving fast convergence of hypocoercive differential equations. d1/2 ( O ̃ ) O ̃ d1/2 ( 3 2 0 2 b e F 0 2 ] T S . h t a m [ 1 v 9 4 2 0 1 . 2 0 3 2 : v i X r a 1 Contents 1 Introduction 3 1.1 Contributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Challenges and techniques 1.3 Related work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.4 Simultaneous work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 1.5 Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2 Preliminaries 14 2.1 Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.2 R ́enyi divergences 3 Improved shifted divergence analysis 15 3.1 Shifted R ́enyi divergence using Orlicz–Wasserstein shifts . . . . . . . . . . . . . . . . . 16 3.2 Proof of Theorem 3.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 4 Low-accuracy sampling with O 21 complexity 4.1 Background on Underdamped Langevin Monte Carlo . . . . . . . . . . . . . . . . . . . 22 4.2 Discrete mixing of Underdamped Langevin Monte Carlo . . . . . . . . . . . . . . . . . 23 4.3 Warm start with Underdamped Langevin Monte Carlo . . . . . . . . . . . . . . . . . . 25 √d ( ) 5 High-accuracy sampling with O 27 5.1 Strongly-log-concave setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 5.2 Extensions to weakly-log-concave and non-log-concave settings . . . . . . . . . . . . . 29 complexity √d ) ( 6 Discussion A Background on functional inequalities 31 32 B Deferred details for §3 33 B.1 Proof for Remark 3.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 B.2 Remarks on tightness of Lemma 3.7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 B.3 Proof for Remark 3.9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 C Deferred details for §4 35 C.1 Proof of Lemma 4.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 C.2 Proof of Lemma 4.6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 C.3 Proof of Lemma 4.8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 D Deferred details for §5 39 D.1 Background on the Metropolis-Adjusted Langevin Algorithm . . . . . . . . . . . . . . 39 D.2 Background on the proximal sampler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 D.3 Weak version of Theorem 5.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 D.4 Proof of Theorems 5.1 and 5.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 D.5 Proof of Theorem 5.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 D.6 Proof of Theorem 5.6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 D.7 Explicit bounds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 References 53 2 1 Introduction We consider the algorithmic problem of efficiently sampling from a high-dimensional probability distribution π on Rd. Due to the many important applications of sampling throughout applied mathematics, engineering, and statistics, significant research effort has been devoted to designing fast sampling algorithms and analyzing their convergence rates. We refer to the book draft [Che23] for a recent exposition of the extensive literature and its history. Yet, despite several decades of progress, many fundamental theoretical questions remain open about the complexity of sampling. Arguably one of the foremost questions in this field is: What is the first-order query complexity for sampling from π? Rd, where f Recall that a first-order query refers to accessing f denotes the negative log-density of π (up to an additive normalization constant). This well-studied notion of a first-order query is inspired on one hand by the fact that such queries do and thus are readily available in not require knowledge of the normalization constant many practical applications, and on the other hand also inspired by the analogous and influential theory of complexity for convex optimization [NY83]. at a query point x f ∇ x ( x ( and exp exp (− (− ∝ f f ∫ ) ) ) ) ∈ This problem of determining the query complexity for sampling has remained open even for the canonical and seemingly simple class of strongly log-concave and log-smooth (in brief, "well- conditioned") distributions π, let alone in more complicated settings. It is worth emphasizing that this state of affairs for sampling is in sharp contrast to that for optimization-indeed, the analogous query complexity questions for convex optimization were solved long ago in celebrated results from the 1980s [NY83; Nes18]. Within the literature, it is of central interest to understand this complexity question in the high- accuracy regime 1, since classical high-accuracy samplers such as the Metropolis-adjusted Langevin algorithm (MALA) and the Metropolized Hamiltonian Monte Carlo algorithm (MHMC) remain the de facto gold standard in practice. Yet the complexity for this high-accuracy setting has been particularly difficult to pin down, as we explain shortly. The purpose of this paper is to develop faster high-accuracy samplers, and in doing so move towards a better understanding of the first-order complexity of sampling. For simplicity of expo- sition, let us presently assume that π is well-conditioned, since by the proximal reduction frame- work [LST21b; Che+22a], it is known that improvements to the complexity of well-conditioned sam- pling lead to improvements in more general settings such as when π is (non-strongly) log-concave, or even non-log-concave but satisfies standard isoperimetric assumptions such as the log-Sobolev or Poincar ́e inequality. (Indeed, our results improve upon the state-of-the-art for all these settings.) The gap between low-accuracy and high-accuracy samplers. A central motivation of this paper is the large gap between (our current understanding of) the complexity of low-accuracy samplers and high-accuracy samplers. To explain this gap, let us briefly provide relevant background on both classes of algorithms. Low-accuracy samplers arise as discretizations of stochastic processes with stationary distribu- tion π, such as the Langevin diffusion [the sampling analog of the gradient flow, see JKO98; Wib18] or the underdamped Langevin diffusion [the sampling analog of the accelerated gradient flow, see Ma+21]. Once discretized, however, the resulting discrete-time Markov chain is typically biased, 1 Throughout, we use the standard terminology low accuracy to refer to complexity results which scale polynomially in 1/ε, and the term high accuracy for results which scale polylogarithmically in 1/ε; here, ε is the desired target accuracy. These two regimes require different algorithms and analyses, as explained in the sequel. 3 i.e., its stationary distribution is no longer equal to π. In order to control the size of the bias, the step size of the algorithm is chosen to scale polynomially with ε, and hence the overall running ε. Despite this drawback, the discretization analysis is by now time scales polynomially with 1 / [SL19; FLO21; well-understood, with state-of-the-art results achieving a complexity of BM22]; see [CLW21] for a discussion of tightness. 3 d1 / ( 3 ε2 / O ̃ ) / High-accuracy samplers, in contrast, are typically designed in such a way that there is no bias. This is achieved by, e.g., appending a Metropolis–Hastings filter to each step (see Appendix D.1 for background). Common examples of these algorithms include MALA and MHMC, which are routinely deployed in large-scale applications and are the default implementations of sampling routines in many modern software packages [GLG15; Aba+16b]. However, the filter which debiases the algorithm also greatly complicates the analysis, and thus far the best complexity result for these algorithms2 is [Dwi+18; Che+20; LST20]. Note that the dimension dependence of this result is substantially worse than what is known in the low-accuracy regime and is at odds with the popularity of high-accuracy samplers in practice. d logO ( ε )) 1 / ( 1 ) ( O ̃ ∥ π μ0 ( The mystery of warm starts. A promising first step towards resolving this gap was put forth in [Che+21] and later refined in [WSC22]: when initialized from a warm start (i.e., a measure μ0 with χ2 O since it can safely ), the complexity of MALA improves to 1 ) ( 2 rather than d− 1 take much larger step sizes (of size d− is / the warm start condition merely an artefact of the analyses? Rather surprisingly, it was shown in [LST21a] that there exist bad initializations for MALA for which the dimension dependence is at d least . Taken together, these results show that the complexity of MALA fundamentally hinges Ω ̃ ) ( on the warmness of its initialization. ε 1 )) / ( 1). This raises the natural question: 2 log2 d1 / ( O ̃ ) ≤ The key question is thus: can such a warm start be obtained algorithmically? Or more precisely: Is there an algorithm which makes and outputs a measure μ0 with χ2 O ̃ 2 d1 / ( ) queries to a first-order oracle for f ? 1 ) ( μ0 ( ) ≤ O π ∥ 2 d1 The requirement that the algorithm makes queries is essential, else the cost of obtaining / ( the warm start dominates the subsequent cost of running MALA. Yet this was the state of affairs- previously, the fastest algorithms took significantly longer to produce a warm start than to actually use it, defeating the purpose of the warm start. Resolving this discrepancy has been posed as an important question in many papers, e.g., [Che+21; LST21a; Che+22b; LW22; WSC22]. O ̃ ) The main challenge for answering this warm start question is that the chi-squared divergence is quite a strong performance metric. (We emphasize that it is essential to obtain the warm start in the chi-squared divergence, or more generally in a R ́enyi divergence 1, rather than other common metrics such as total variation, Wasserstein, or KL divergence; see §1.2 for an in-depth discussion.) The aforementioned results in the low-accuracy regime fall short of achieving this goal, since they only hold in the Wasserstein metric (for which standard coupling arguments are readily available). Despite significant effort, the best known guarantee for producing a warm start-achieved by the Langevin Monte Carlo (LMC) algorithm [Che+22b]-is far too costly as it requires queries, which defeats the purpose of the warm start. q of order q R > Towards this hope of algorithmic warm starts, [WSC22] made the promising empirical observa- tion that MALA mixes much faster if it is initialized at the output of the underdamped Langevin Monte Carlo (ULMC) algorithm. However, they left open the question of rigorously proving that this yields a warm start. While it is widely believed that ULMC is substantially faster than LMC, the previous best results for computing a warm start with ULMC had dimension dependence O ̃ d ) ( 2 We discuss the result of [LW22] for the zigzag sampler further in §1.3. 4 ) O ̃ 2 d5 / ( 2 d1 / ( (implicit from [GT20]) or very recently d2 O O (implicit from [Zha+23]), see the prior work ̃ ̃ ( section §1.3 for details. We emphasize that this dimension dependence is not only a far cry from the elusive goal, but moreover is even worse than known results for the simpler LMC algorithm. Unfortunately, any improvement to these ULMC warm start bounds appears to require overcoming fundamental difficulties with studying hypocoercive differential equations which remain unsolved today, despite being the focus of intensive research activity within the PDE community since the work of Kolmogorov [Kol34]. For a further discussion of these technical obstacles, see §1.2. ) ) 1.1 Contributions In this paper, we develop techniques which bypass longstanding challenges for analyzing hypocoer- 2 d1 R ́enyi mixing results for ULMC. This resolves cive dynamics, thereby establishing the first / ( the aforementioned warm start conjecture, which has been raised in a number of prior works, e.g., [Che+21; LST21a; Che+22b; LW22; WSC22]. As discussed above, this enables us to design significantly faster high-accuracy samplers-both for the log-concave setting and far beyond. Fi- nally, this also closes the long line of work devoted to understanding the complexity of MALA (see Table 1). We present our results in more detail below, and then discuss our new techniques in §1.2. O ̃ ) Result 1: Algorithmic warm starts via ULMC. Our first main result is an improvement . This resolves the of the state-of-the-art R ́enyi mixing bounds for ULMC from ) warm start question in the affirmative. We remark that although the warm start problem was stated above for χ2 convergence, our result actually holds more generally for R ́enyi divergences of any order q 2 since χ2 q 1 is of constant size when log-concavity and log-smoothness bounds; their ratio κ q 1, and thus we state it as such. (For the purpose of warm starts, it suffices to take R 2 is.) Below, α and β denote the strong exp β α is the condition number. 2 d1 / ( d2 ( ≥ = O ̃ O ̃ ) − to = ) 2 ( R ∶= R / Theorem 1.1 (R ́enyi guarantees for ULMC; informal version of Theorem 4.1). Consider the class of densities of the form π . The ULMC < ∞ algorithm outputs a measure μ satisfying first-order queries. 2f ⪯ ∇ ε2 using exp ) ≤ As we detail in §1.2, the main barrier to obtaining this result is that the underdamped Langevin dynamics falls within a class of PDEs known as hypocoercive equations, for which fundamental questions remain unresolved.3 on Rd, where αI μ ( β βI and κ ∶= / 2 2q1 2d1 κ3 ε / / / ) ( ⪯ O ̃ (− R ∝ α π f ) ∥ / q Result 2: Faster high-accuracy log-concave sampling. Theorem 1.1 provides the first al- gorithm for computing warm starts that is not significantly slower than the use of the warm start. This enables us to exploit, for the first time, the recent breakthroughs on MALA [Che+21; WSC22] from a warm start.4 By combining d which improve the complexity of MALA from ) ( this with additional algorithmic tools for improving the dependence on the condition number, we obtain our second main result, which substantially advances the state-of-the-art for high-accuracy log-concave sampling. 2 d1 / ( O ̃ O ̃ to ) Theorem 1.2 (High-accuracy log-concave sampling; informal version of Theorem 5.1). Consider α. There is the class of densities of the form π on Rd, where αI βI and κ exp 2f β f ∝ (− ) ⪯ ∇ ⪯ ∶= / 3 Implications of our techniques for the analysis of hypocoercive diffusions are explored in shortly forthcoming work. 4 We remark that all of our results could replace MALA with the zigzag algorithm [LW22]. Indeed, the zigzag sampler has the same key issue as MALA: it requires a warm start in chi-squared divergence for the known d1/2 mixing result to apply. However, we focus on MALA because MALA's robust empirical performance has made it a central focus of study in the MCMC literature for nearly three decades [Bes+95]. 5 Reference [Dwi+18] [Che+20] [LST20] [Che+21] [WSC22] Theorem 5.1 Complexity κ3 2 2d1 κd / / + κ3 2 2d1 κd / / + κd 2 2d1 κ3 / / κd1 2 / 2 κd1 / Algorithmically Achievable? No, requires a warm start Yes Yes No, requires a warm start No, requires a warm start Yes, warm start provided in Theorem 4.1 Table 1: This table summarizes the community's progress towards non-asymptotic complexity bounds for MALA; the asymptotic study of MALA is much more classical, and dates back to at least [RR98]. The complexity bounds displayed are upper bounds; for brevity, we hide logarithmic factors as well as the dependence on ε since all results scale polylogarithmically in 1 ε. As discussed in the main text, Theorem 5.1 completes our understanding of MALA due to matching lower bounds in [Che+21; LST21a; WSC22]. / ∈ { 2 logO , after making κd1 / } an algorithm which outputs a sample with law μ satisfying d μ, π ( d ε κd ) / ( TV, √KL, √χ2, √α W2 The algorithmic warm start result of Theorem 1.1 confirms the aforementioned empirical con- jecture of [WSC22] and provides the final missing piece in our understanding of the complexity of MALA, closing the line of work developed in [RR98; Dwi+18; Che+20; LST20; Che+21; LST21a; Indeed, due to matching lower bounds in [Che+21; LST21a; WSC22], the WSC22] (Table 1). κd complexities with or without a warm start are known to be tight, and hence and ) ( the key remaining question was whether a warm start is actually efficiently computable. ε, for any performance metric first-order queries. 2 κd1 / ( 1 ) ( O ̃ O ̃ ) ≤ ) The complexity in Theorem 1.2 constitutes a natural barrier for high-accuracy sampling. Indeed, regarding the dimension dependence, any further progress beyond would seem to require completely different algorithms-both for obtaining a warm start and also for exploiting a warm complexity of MALA is unimprovable even under arbitrarily start. For example, the warm starts [Che+21; WSC22]. And regarding the condition number dependence, any further in the high-dimensional regime5 would constitute a major breakthrough in progress beyond the complexity of sampling since it is currently unknown whether an acceleration phenomenon holds in the sampling context. 2 d1 / ( 2 d1 / ( κ ) ( O ̃ O ̃ O ̃ ) ) More broadly, our result provides evidence of the potential for designing faster high-accuracy samplers by combining low-accuracy samplers for computing a warm start, together with improved high-accuracy mixing from the warm start. We believe that this research program may be crucial for future progress in high-accuracy sampling, since faster mixing from a warm start seems likely to hold for other Metropolized algorithms. See §6 for further discussion in this direction. Result 3: Faster high-accuracy sampling beyond log-concavity. High-accuracy log-concave sampling is the key to obtaining state-of-the-art complexity results for a wide class of distributions beyond log-concavity. This is achieved by using our faster log-concave sampler in Theorem 1.2 to improve the per-iteration complexity of the proximal sampler [LST21b; Che+22a]. This approach is overviewed in the techniques section §1.2, and leads to the following result. Corollary 1.3 (Sampling from other classes of distributions; informal version of results in §5.2). For each of the following classes of distributions, we obtain complexity bounds which improve by a 2 over the state-of-the-art results in [Che+22a]: factor of d1 / 5 Analogous to classical optimization results, there are sampling algorithms which achieve logarithmic dependence on κ at the expense of larger polynomial dependence on d. The open question mentioned here is really: can one improve the condition dependence beyond near-linear while also maintaining comparable dimension dependence? 6 • π is log-smooth and weakly log-concave. • π is log-smooth and satisfies a log-Sobolev inequality. • π is log-smooth and satisfies a Poincar ́e inequality. The latter two assumptions of log-Sobolev and Poincar ́e-called functional inequalities-capture strictly richer classes of target distributions than strong-log-concavity. There are two major moti- vations for studying the complexity of sampling in this setting. First, functional inequalities are quite flexible, as they are preserved under common operations such as bounded perturbations and Lipschitz mappings (see §A). Consequently, they often capture the breadth of settings encountered in practice, including non-log-concave settings. Second, these functional inequalities classically im- ply convergence of diffusions in continuous time, making them natural assumptions under which to study the corresponding discretizations. Despite the appeal of this program, proving sampling guarantees under functional inequalities introduces a number of additional technical complications and was only accomplished recently, starting with [VW19] and continued in the works [Wib19; LE20; Ma+21; Che+22b]. Our result continues this line of work, and in particular highlights the use of high-accuracy samplers for well- conditioned distributions as a powerful algorithmic tool for the broader problem of sampling under isoperimetry. 1.2 Challenges and techniques 1.2.1 Challenges for warm starts: R ́enyi divergence and hypocoercivity Why R ́enyi? To explain what properties are needed for a warm start requires first explaining why a warm start helps. Briefly, the complexity of MALA is governed by the largest possible step size for which the algorithm still accepts a reasonable fraction of the proposals (see Appendix D.1 for background on MALA). The basic reason why we might expect to improve the complexity of 2 d1 O is that at the stationary distribution π, the step size can be increased O to MALA from / ̃ ̃ ) ( 2 while keeping the acceptance probability high. More precisely, with 1 1 to d− significantly from d− / 2, the acceptance probability is large from a typical point from π; however, it can be 1 step size d− / exponentially small in regions that are atypical (i.e., exponentially rare under π). The existence of such regions implies that there are "bottlenecks" in the state space which take exponentially long to traverse. The role of a warm start initialization is to avoid such bottlenecks. d ) ( In other words, a key property that a warm start μ0 must satisfy is that if π assigns exponentially small probability to an event, then so must μ0. Crucially, this property does not hold if μ0 is only known to be close to π in common probability metrics such as total variation, Wasserstein, or KL divergence-but this property does hold if μ0 is close to π in the chi-squared divergence, or more 1.6 generally any R ́enyi divergence q of order q > R The key to warm starts: low-accuracy algorithms. In the preceding discussion, taking large step sizes from a non-warm initialization was problematic due to the rejections in the Metropolis– Hastings filter step. A natural idea, then, is to remove the filter for the initial stage of the algorithm and later reinstate it when the law of the iterate is closer to the target π. Since the proposal of MALA is just one step of the LMC algorithm, this amounts to using LMC to procure the warm start. More generally, we can consider using any low-accuracy sampler as our warm start algorithm, 6 This is the same reason why differential privacy requires guarantees in R ́enyi divergences [Mir17]. 7 O ̃ 2 d1 / ( ) and indeed, as we discuss next, it will be crucial to consider ULMC instead of LMC in order to achieve the desired dimension dependence. At a high level, if we discretize a diffusion with step size h for continuous time T , then the total number of iterations is N h. In order to understand the dimension dependence of the algorithm, one must therefore understand both h and T . These two terms reflect two distinct aspects of mixing analysis: the discretization bias and the convergence time. T = / The first part-the discretization bias-is now relatively well-understood (see the prior work discussions in §1.3), even for the chi-squared divergence and more general R ́enyi divergences. In particular, it is known that the R ́enyi bias of LMC is controlled for step sizes h , and the ) √dT . (In fact, we streamline arguments in R ́enyi bias of ULMC is controlled for step sizes h the literature in order to provide a shorter and simpler proof of this in Appendix C.3.) Since the log d Langevin diffusion does not reach approximate stationarity until time T , it follows that ) ( d LMC requires at least N Ω = ̃ ) ( ULMC is more promising, as the discretization bounds lead to iteration complexity bounds of , this means ) N that the convergence time T must be nearly dimension-free, i.e., of size 2. However, in order to reach our warm start goal of N 2T 3 d1 O / / = ̃ . 1 ) ( iterations, which is too slow for our purposes. 2 d1 / ( 1 /( 1 / O ̃ dT Ω T T h h ≲ ≥ ≲ = = = / / Why are nearly dimension-free convergence rates possible in continuous time? Since the R ́enyi divergence to π initially scales as d , in order to obtain nearly dimension-free bounds ) ( on T , we require the diffusion to converge to stationarity in R ́enyi divergence with an exponential rate. This is a strong property of the diffusion, which we call hyperequilibration. Θ ̃ Hyperequilibration was not even known for the simpler (standard, overdamped) Langevin dif- fusion (LD) until quite recently [CLL19; VW19]. While a spectral gap for LD (or equivalently, a Poincar ́e inequality for π) classically implies exponential decay of the chi-squared divergence, this 2, is far weaker than hyperequilibration. Indeed, hyperequilibration requires exponential decay of χ2 which amounts to doubly exponential decay of the chi-squared divergence, since . 1 ) + ( R Under the stronger assumption of a log-Sobolev inequality for π, it is well-known that the KL di- vergence decays exponentially fast, but it was unclear that the same holds for the R ́enyi divergence which, as discussed above, is crucial for warm starts. It was only through the inspired semigroup calculations of [CLL19; VW19] that we now know this to be true, namely, a log-Sobolev inequality implies hyperequilibration for LD.7 log R = 2 Recall, though, that the LD incurs too much discretization bias. To obtain sufficient control over both the discretization bias and the convergence time, we therefore need to establish hyper- equilibration for the underdamped Langevin diffusion (ULD). However, this question brings us to longstanding challenges from the theory of hypocoercive PDEs. Hypocoercivity: a fundamental barrier for underdamped analysis. To recap: for LD, we have exponential decay of the chi-squared divergence under a Poincar ́e inequality, exponential decay of the KL divergence under a log-Sobolev inequality, and finally hyperequilibration under a log-Sobolev inequality. What, then, are the analogous results for ULD? Since its introduction in the 1930s by Kolmogorov [Kol34], the regularity and convergence of ULD have been the focus of intensive research. It took nearly half a century to establish mixing [Tro77], and a further 30 years and Villani's "slightly miraculous-looking computations" [Vil09a, pg. 42] to prove exponential decay of the KL divergence under a log-Sobolev inequality. Establishing hyperequilibration for ULD remains out of reach for existing techniques. 7 This explains our choice of the terminology hyperequilibration: it is inspired by the analogy to the classical property of hypercontractivity, which is equivalent to the logarithmic Sobolev inequality (LSI) [Gro75]. 8 The reason for this sudden jump in difficulty from the overdamped to the underdamped diffu- sions is due to a fundamental issue: the degeneracy of ULD. In brief, whereas LD is driven by a full-dimensional Brownian motion, ULD is driven by a degenerate one which is only added to a subset of the coordinates. For sampling purposes, this degeneracy is a desirable feature as it leads to smoother sample paths and smaller discretization error; however, this same degeneracy is also the source of deep questions in PDE theory which have motivated research in that field for nearly a century. The key challenge here is that the standard tools of Markov semigroup theory-which provide the backbone of the analysis for LD-completely break down for ULD. To address this difficulty, the theory of hypocoercivity, inspired by H ̈ormander's groundbreaking work on hypoellip- ticity [H ̈or67], was laid down by Villani in the monograph [Vil09a] as a principled framework for the study of degenerate diffusions. However, this is still a relatively nascent area of PDE and many important questions remain wide open; see the prior work in §1.3 for further background. In contrast, we note that it is well-known how to obtain fast rates of convergence in the Wasser- stein metric via standard coupling arguments. Consequently, the state-of-the-art guaran- tees for the ULMC algorithm hold in the Wasserstein metric or the KL divergence [Che+18; SL19; DR20; Ma+21; Zha+23], whereas for R ́enyi divergence bounds, it was previously unknown how to obtain rates which are better than even 2 d1 / ( O ̃ ) O ̃ d2 ( . ) 1.2.2 Settling the warm start conjecture: regularization via privacy Our approach to hyperequilibration. To settle the warm start conjecture, we adopt a fun- damentally different perspective. Namely, instead of trying to directly establish hyperequilibration via hypocoercivity techniques, we ask whether it can be deduced from simpler Wasserstein coupling arguments. At the heart of this approach is the fact that diffusions often enjoy strong regularizing properties, which allow for bounding stronger metrics (e.g., R ́enyi) in terms of weaker ones (e.g., Wasserstein). Such regularization results are typically established for continuous-time diffusions via abstract calculus methods, such as the theory of Markov semigroups [BGL14]. However, as dis- cussed above, these techniques do not extend to ULD due to the fundamental issue of degeneracy. Our key insight is to prove a regularization result for the discrete-time algorithm directly. This is enabled by the fact that although the noise added to each iteration of ULMC is nearly degenerate- and indeed degenerates as the step size h 0, as it must because ULD is degenerate-this ULMC noise remains non-degenerate for any positive step size h 0. Hence, we can expect some mild amount of regularization for ULMC, a fact that we establish for the first time. On a technical level, we accomplish this via a more sophisticated version of techniques from the differential privacy literature-namely, the shifted R ́enyi analysis-which we describe next. ↘ > R ́enyi divergences with Orlicz–Wasserstein shifts. The regularization result we seek is of the following form: if we initialize two copies of our process of interest at the distributions μ0, ν0, and arrive at distributions μn, νn respectively at iteration n, we wish to control in terms of an initial Wasserstein distance W . In our application, the process of interest- ) namely ULMC-is an instance of what is sometimes called a "contractive noisy iteration" (CNI): an algorithm that interleaves Lipschitz mappings with (Gaussian) noise convolution steps. This notion of a Contractive Noisy Iteration is of broad interest as it captures algorithms in differential privacy (e.g., noisy optimization algorithms) and in sampling (e.g., discretizations of diffusions), and we therefore place our results in a framework which encompasses these various use cases. μ0, ν0 ( μn ( νn R ∥ ) q A generalization of the regularization result we seek is to prove that for a CNI, q μn ( ∥ νn ) ≲ w )q ( ν0 μ0 ( ∥ ) + error term depending on w , ) ( ⋆ R R [ 9 ] where w )q ( is the shifted R ́enyi divergence, defined as R w )q ( μ ν ∶= μ′ s.t. W w q μ′ ν , )≤ ), then the term R ( ∥ ) inf μ,μ′ ( in ( ⋆ μ0, ν0 ( R ) W ∥ see §3 for details. Indeed, if we take w ν0 μ0, ν0 vanishes, and = in terms of W we will have controlled ) is more general, ) ( as it allows for carefully tracking the shift parameter w throughout. This proof technique, called ( shifted divergence analysis, was first introduced in the context of differential privacy by [Fel+18] for the purpose of establishing Privacy Amplification by Iteration, and was recently honed into a form amenable to sampling analyses in [AT22a; AT22b]. μ0 as desired. However, ( w )q ( μn νn R R ⋆ ∥ ( ) ) ( ∥ ) q ∞ ⋆ ⋆ ) required the W A subtle yet essential technical issue that arises in establishing ( ) is: which Wasserstein metric W do we use? All previous versions of ( metric, which is problematic for our setting as the W metric is infinite at initialization. Here, our main insight is to use a non-standard Wasserstein metric, called the Orlicz–Wasserstein metric, based on the sub-Gaussian Orlicz norm. As we discuss in Remark 3.9, this is exactly the right metric to use: in fact, ( ) cannot hold for any weaker metric (e.g., Wp for any finite p), and the initialization bound cannot be finite for ) indeed holds, with the any stronger metric. We then show that for Orlicz–Wasserstein shifts, ( caveat that the order of the shifted R ́enyi divergence on the right-hand side of ( ) is increased. ), as the This increase in the order also means that additional care is required when applying ( inequality cannot be iterated too many times, but we bypass this issue by showing that it suffices to only exploit the regularization from a single step. ⋆ ⋆ ⋆ ⋆ ∞ Finally, we note that our analysis answers the open question raised in [AT22b] of how to use the shifted divergence technique in order to obtain sampling guarantees for discretized diffusions w.r.t. the true target distribution π, rather than w.r.t. the biased limit of the algorithm. 1.2.3 From warm starts to faster high-accuracy samplers O 2 d1 / In light of the discussion thus far, combining our warm start result with the recent advances on MALA [Che+21; WSC22] immediately improves the dimension dependence of high-accuracy log- concave sampling to . However, two further issues remain. First, thus far we have ignored the dependence on the condition number κ for simplicity of exposition, but the combined approach of ULMC and MALA incurs suboptimal dependence on κ, namely κ3 2 rather than κ. Second, the / result only holds for strongly log-concave targets. We address both of these issues simultaneously by adding a third algorithmic building block: the proximal sampler. Below, we briefly overview the proximal sampler and the final remaining technical challenges in its application. ̃ ( ) Algorithmic framework. The proximal sampler [TP18; LST21b] is a Gibbs sampling method that can be viewed as the sampling analog of the proximal point method from optimization (see Appendix D.2 for further background). Each iteration requires sampling from a regularized distri- bution called the restricted Gaussian oracle (RGO), parametrized by y Rd: πX Y ∣ = y x exp f x − − ∝ If f is β-smooth, and the step size h is chosen as h ) log-concave and log-smooth with condition number O ( ( ) ( ≍ 1 ∈ . 2 y x − 1 2h 1 β , one can check that πX ∥ . Hence: ) ∥ Y ∣ = y is strongly complexity of the proximal sampler = # outer loops × complexity of sampling from ( ) O -conditioned distributions 1 to high accuracy ( ) 10 The requirement of sampling from the RGO to high accuracy arises to avoid accumulation of the errors from inexact implementation of the RGO. So far, we have not made use of any assumptions on π beyond smoothness of f . Additional assumptions on π, such as log-concavity, can then used to control the number of outer loops. This program was carried out in [Che+22a], which carefully studied the outer loop complexity of the proximal sampler under a variety of assumptions on the target π which, when combined with the implementation of the RGO via existing high-accuracy samplers, yielded state-of-the-art complexity bounds for sampling under those assumptions. Our faster high-accuracy log-concave sampler provides a better implementation of the RGO, and hence we improve upon these prior 2 in each setting. Moreover, in the strongly log-concave setting, results by a factor of roughly d1 / the number of outer iterations of the proximal sampler is shown to be [LST21b], so using ULMC + MALA to implement the RGO boosts the condition number dependence of the overall sampler to near-linear. This resolves the two issues described above, but in doing so we must also develop an inexact error analysis for the proximal sampler. O ̃ κ ( ) Inexact error analysis. In order to apply the proximal reduction framework, we must under- stand how the error from inexact implementation of the RGO propagates into the final sampling error. This was carried out in [LST21b] for the TV distance via a simple coupling argument, which amounts to a union bound over failure events at each iteration. Similarly, it is straightforward to carry out the inexact error analysis in the Wasserstein metric due to the availability of the triangle inequality. However, to establish our guarantees in §5, which hold also in the KL and χ2 metrics, we must perform an error analysis in χ2 (or equivalently, in R ́enyi). This is also complicated by the fact while the outer loop of the proximal sampler converges exponentially fast in the strongly log- concave setting, which facilitates summing up the geometrically decaying errors from each iteration, the convergence in the weakly log-concave setting does not have an exponential rate and moreover uses a modified Lyapunov functional, changing the nature of the error analysis. We remark that prior works such as [Che+22a] did not encounter such issues, since their rejection sampling imple- mentation of the RGO is exact. Therefore, we believe that our inexact error analysis will also be useful for any future applications of the proximal sampler. We also remark that our application of the proximal sampler, and the ensuing need for careful inexact error analysis, resembles the use of the (accelerated) proximal point method in optimization, e.g., [Fro+15; LMH15]. 1.3 Related work O Low-accuracy sampling and R ́enyi guarantees. R ́enyi guarantees for sampling are relatively recent. Indeed, [VW19] proved fast R ́enyi mixing for LD and LMC to their respective stationary distributions, and this was translated into R ́enyi sampling guarantees for LMC in [GT20; Che+21; Che+22b; EHZ22], for the proximal sampler in [Che+22a], and for ULMC in [GT20; Zha+23]. dimension dependence for LMC and the proximal sampler, These lines of work have led to but for ULMC the rates are much worse, namely dependence [GT20] and only very recently O d2 In contrast, there are many more works which break the O rate in R ́enyi. barrier in the Wasserstein metric: ̃ ̃ the randomized midpoint discretization of Langevin [HBE20], unadjusted Hamiltonian Monte Carlo (HMC) [CV19], ULMC [Che+18; DR20; Mon21], and more sophisticated discretizations of ULMC and HMC [SL19; FLO21; BM22]. Among these algorithms, at present we only understand how to perform R ́enyi discretization analysis for ULMC, but for ULMC it is the convergence of the corresponding continuous-time diffusion which remains elusive, as we review next. ( dependence [Zha+23]. In Theorem 4.1, we obtain the first 2 d5 / 2 d1 / O O ̃ ̃ ̃ d d ) ( ( ( ) ) ) ( ) 11 Underdamped Langevin, hypoellipticity, and hypocoercivity. The underdamped Langevin diffusion has a rich history, dating back to Kolmogorov [Kol34]. The PDE governing the evolution of its marginal density is referred to as the kinetic Fokker–Planck equation. Unlike the Langevin diffusion, which is driven by a full-dimensional Brownian motion and for which regularity and con- vergence fall within the purview of classical elliptic and parabolic PDE theory, the underdamped Langevin diffusion is the canonical example of a degenerate diffusion for which these and related questions remain active areas of research within PDE. See §4.1 for background. The question of regularity for these equations was largely solved by H ̈ormander [H ̈or67] in arguably one of the most influential breakthroughs in PDE theory of the last century through the introduction of the theory of hypoellipticity. In turn, it inspired Villani to coin the study of the convergence of such equations hypocoercivity in his seminal monograph [Vil09a]. While convergence of this diffusion has been studied for nearly a century, early convergence results were qualitative in nature. It took intensive developments in the PDE community to get to a point where quantitative rates could be extracted, beginning in the 1970s [Tro77]. We do not attempt to comprehensively survey the extensive literature here. We refer to the monograph [Vil09a] for history; see also, e.g., the papers [DMS09; Bau17; RS18] for more modern references. We also mention the recent space-time Poincar ́e approach of [Alb+19; CLW20], which is also directly inspired by H ̈ormander's hypoelliptic theory. As we discuss in §1.2, however, all of these approaches fall short of establishing the key property of hyperequilibration. MALA. MALA has been intensely studied over the past three decades since its introduction in [Bes+95], in large part due to its strong practical performance-in fact, it and its variants com- prise the default implementations of sampling routines in many modern software packages [GLG15; Aba+16b]. Many classical works studied the geometric ergodicity and asymptotic properties of MALA. With regards to the dimension dependence, particularly influential was the optimal scal- 3 leads to a non-trivial diffusion 1 ing result of [RR98], which showed that taking step size h d− / limit for MALA as d → , at least for product measures π satisfying strong regularity assumptions and when initialized at stationarity. Modern analysis techniques have enabled an understanding of the non-asymptotic complexity of MALA [Dwi+18; Che+20; LST20; Che+21; LST21a; WSC22], see Table 1 for a summary of the progress in this direction. Our work closes this line of work by showing that the warm start rate of [WSC22], which is tight due to their matching lower bound, is achievable. Moreover, our work provides theoretical justification for the improved empirical perfor- mance of MALA after using a low-accuracy algorithm for warm starts, as observed in [WSC22]. ∞ ∝ Proximal sampler. The proximal sampler is an algorithmic framework introduced in [TP18; LST21b]. In [LST21b], it was used as a mechanism for boosting the condition number dependence of any high-accuracy log-concave sampler to near-linear, which was then used to design samplers for composite and finite-sum potentials. Then, in [Che+22a], it was shown that the proximal sampler reduces the problem of sampling from distributions satisfying weak log-concavity or functional inequalities to the problem of high-accuracy log-concave sampling. In this work, we exploit both these properties of the proximal sampler, and we contribute to its inexact error analysis (see §1.2). We also mention that in recent work, the proximal sampler has been connected to stochastic localization, leading to recent progress on the KLS conjecture [KP21; CE22; KL22], as well as to diffusion models [Che+23]. There are also applications to sampling from semi-smooth or non- smooth potentials [LC21; LC22a; LC22b], and to differential privacy [GLL22; Gop+23a; Gop+23b]. 12 Zigzag sampler. The zigzag sampler is an alternative high-accuracy sampler that was recently proposed in [BFR19]. Instead of using a Metropolis–Hastings filter, the zigzag sampler is a piecewise deterministic Markov process which can be implemented without discretization bias. It was recently shown in [LW22] that similarly to MALA, the zigzag sampler has a dimension dependence of from a warm start. Morever, in [LW22, Corollary 1.4], Lu and Wang show that by using LMC with ) a large step size to warm start the algorithm, one obtains a high-accuracy log-concave sampler with . Indeed, the same strategy can be used with the warm start results dimension dependence O of [Che+21; WSC22] to obtain complexities strictly better than ; however, it is clear that such an approach can never reach the desired complexity of -and in fact there is a fundamental ) ( because it is bottlenecked by the discretization bias of LMC. The goal barrier even at ) of this paper is achieving complexity as this is this a natural barrier for high-accuracy samplers given a warm start, and LMC cannot work for this goal.8 In direct analogy to our use of MALA, our new complexity result for ULMC (Theorem 4.1) can also be used to warm start the 2 logO κd1 zigzag sampler, leading to the same final complexity bound of . This answers / the open questions in [LW22] regarding warm starting the zigzag sampler. 2 d1 / 5 d4 / 2 d1 / 4 d3 / 2 d1 / 1 ) ( O O O O O O ̃ ̃ ̃ ̃ ̃ ̃ d 1 ε ( ( ( ) ( ( ) ) ̃ ( ( / )) Differential privacy and sampling. Sampling algorithms have been widely used in differential privacy ever since the invention of the exponential mechanism [MT07]; for an exposition of the surrounding history and applications, see the textbook [DR14]. Sampling-inspired analyses have also been recently used to prove privacy properties of optimization algorithms [CYS21; RBP22; YS22]. Most related to this paper are connections in the other direction: the use of techniques from differential privacy in order to analyze sampling. There are two lines of work in this direction. One involves the technique of adaptive composition for R ́enyi divergences and its use for establishing R ́enyi bias bounds for LMC and ULMC [GT20; EHZ22; Zha+23]. The other involves the technique of Privacy Amplification by Iteration (PABI), which was originally used to bound the privacy loss of differentially private optimization algorithms [Fel+18; Bal+19; ADP20; FKT20; SBD21; AT22a], and its recent use for analyzing the mixing time of LMC to its biased stationary distribution [AT22b]. In this paper, we build upon this technique in several key ways: we show how to improve mixing results for the biased distribution to mixing results for the target distribution, we show how to use these ideas for ULMC rather than LMC, and most importantly we overcome the key issue of unboundedness by replacing W shifts by Orlicz–Wasserstein shifts, see §1.2 for an overview. 1.4 Simultaneous work ∞ While preparing a draft of this paper for submission, it came to our attention that another group was simultaneously working towards the same problem using completely different techniques and algorithms [FYC23]. We are grateful to them for coordinating simultaneous arXiv submissions. We look forward to reading their paper after it is posted, and we will add a detailed comparison about the differences in a future revision. 1.5 Organization We recall preliminaries in §2, especially regarding R ́enyi divergences. We isolate in §3 our key new technique involving Orlicz–Wasserstein shifted R ́enyi divergences. We use this technique to obtain 8 With regards to dimension dependence, running LMC with step size h for 1/h steps yields a distribution μ with (μ ∥ π) ≤ ̃O(dh) [Che+22b]. By optimizing the step size h and combining this with the best known complexity ) [LW22]. We point out that log (μ ∥ π)), the total complexity would still log χ2 ̃O(d1/2 even if the complexity of the zigzag sampler were improvable to ̃O(d1/2 be at least 1/h + d1/2 (μ ∥ π)) of the zigzag sampler, one obtains the final complexity ̃O(d4/5 is a natural barrier for any warm starting approach using LMC. (dh) ⩾ ̃Ω(d3/4 ). Thus d3/4 log χ2 3/2 χ2 13 faster algorithmic warm starts in §4, and then use these warm starts to develop faster high-accuracy samplers in §5. We conclude in §6 by discussing several future research directions that are motivated by our results. For brevity, we defer various proofs and technical details to the appendices. 2 Preliminaries 2.1 Notation f ∝ exp denotes the target density and f Rd → R denotes the potential. We Throughout, π assume f is twice continuously differentiable for simplicity. We reserve the symbol N for the number of iterations that the Markov Chain Monte Carlo algorithm is run, h for the discretization step size, and T to denote the space of probability distributions over Rd, and we write with finite second moment. All logarithms are natural. N h for the total elapsed time. We write to denote the subset of − ( P( Rd Rd Rd = ) ) 2 ∶ For simplicity of exposition, we assume throughout that we have access to an algorithm for P ( ) P( ) g 1 ) ( generating independent standard Gaussian random variables. We use the standard notation = g logO to suppress low-order terms. Note that since our final results depend polynomially on the dimension d and condition number κ, the O hides polylogarithmic factors in these terms-on the other hand, since ε occurs only polylogarithmically in our high-accuracy results, we do not hide the polylogarithmic factors in ε. ̃ ̃ ) ( ) ( O g 2f We say that f is α-strongly convex if f is convex, then f is β-smooth if and only if number κ α-strongly log-concave (resp. β-log-smooth). All other notation is introduced in the main text. β. If βId. We always denote by κ the condition where f is α-strongly convex (resp. β-smooth), we say that π is αId, and that f is β-smooth if 2f α. If π ∇ ∥ ⪰ ∇ exp 2f ∝ ∇ ∶= op β ≤ ⪯ f ∥ / − ( ) 2.2 R ́enyi divergences Definition 2.1 (R ́enyi divergence). The R ́enyi divergence of order q measures μ and ν is defined as ∈ between probability 1, ( ∞ ) are defined by continuity. if μ ≪ ν, and otherwise is ∞ μ q ν 1 q = 1 log ∫ q dν dμ dν − . The R ́enyi divergences of order q R ) ( ∥ ( ) 1, ∈ ∞ } Remark 2.2 (Special cases of R ́enyi divergence). The R ́enyi divergence of order q with the KL divergence, i.e., { 1 coincides = The R ́enyi divergence of order q = 2 is related to the χ2 divergence via the formula ) R ( ∥ ) μ 1 ν KL μ ν . = ( ∥ χ2 μ ν . μ 2 ν log 1 = + The R ́enyi divergence of order q ( ) is given by ∥ ( ( ∥ )) R = ∞ μ ν ∞ = log ess sup dμ dν . Our analysis makes use of the following elementary properties of the R ́enyi divergence. Fur- ther details about these properties and their proofs can be found in, e.g., the R ́enyi divergence survey [VH14] as Theorem 1, Theorem 3, Equation 10, and Remark 1, respectively. R ( ∥ ) 14 Lemma 2.3 (Post-processing inequality for R ́enyi divergences). For any R ́enyi order q Markov transition kernel P , and any probability distributions μ, ν, ⩾ 1, any μP q νP ⩽ μ ν . q Lemma 2.4 (Monotonicity of R ́enyi divergences). For any R ́enyi orders q′ ( probability distributions μ, ν, R R ) ) ( ∥ ∥ q ⩾ ⩾ 1, and any μ q ν μ q′ ν . ⩽ Lemma 2.5 (R ́enyi divergence between isotropic Gaussians). For any R ́enyi order q ∥ variance σ2 0, and any means x, y R ( Rd, R ) ∥ ) ( 1, any ⩾ > − ∈ x, σ2Id q y, σ2Id q = x y − 2σ2 2 . ∥ ∥ ( ∞ ) (N ( Lemma 2.6 (Relation to f -divergences). For any R ́enyi order q tion exp , the corresponding func- is an f -divergence, and thus in particular is jointly convex in its arguments. ) ∥ N ( )) R 1, 1 q ∈ ⋅ ⋅ q ( ∥ (( )) ) R We end this section with one last property of R ́enyi divergences: the weak triangle inequality. The name of this property arises from the fact that although R ́enyi divergences do not satisfy the triangle inequality, they do satisfy a modified version of it in which the R ́enyi order is increased and the bound is weakened by a multiplicative factor. Since this property does not appear in the aforementioned survey [VH14] on R ́enyi divergences, we provide a brief proof for completeness. It can also be found in, e.g., [Mir17, Proposition 11]. Lemma 2.7 (Weak triangle inequality for R ́enyi divergence). For any R ́enyi order q λ , and any probability distributions μ, ν, π, 0, 1 1, any > ∈ ( ) μ q π q − λ q − 1 ≤ μ ν + q λ / q ( λ 1 − )/( − λ ) ν π . Proof. Expand q H ̈older's inequality R μ R ν f g ∥ ) ⩽ ( ∫ ∥ ) 1 1 log q − 1 a f a / ( R R ∥ f g where f gb ∥ νq = 1 b using H ̈older exponents a / / ( λ and g − ) = μq ) νq − 1 = λ 1, and then apply πq − 1 − λ λ and b / 1 . = 3 ) Improved shifted divergence analysis ) / /( ) ( = ∫ ( ∫ ∫ ( In this section we isolate from our analysis a key new technique of independent interest. As overviewed in §1.2, this technique is a strengthening of the "shifted divergence" analysis, a.k.a., "privacy amplification by iteration" (PABI), in which we crucially improve the ∞-Wasserstein shift to an Orlicz–Wasserstein shift. This enables obtaining R ́enyi divergence bounds on the mixing of any Markov chain which interleaves Lipschitz mapping steps (e.g., gradient descent steps) and noise convolution steps (e.g., adding a Gaussian). This notion captures a variety of algorithms from the differential privacy and sampling communities, often called "contractive noisy iterations". The main result of this section is formally stated as follows. This result makes use of the Wasserstein metric Wψ2 that evaluates a coupling's quality via the sub-Gaussian Orlicz norm; see §3.1 for background on this notion. Theorem 3.1 (Shifted R ́enyi divergence analysis). Consider two Markov chains μ′n 0 with possibly different initialization, but with the same update transitions n μn n ⩾ 0 and { } ⩾ { } μn μ′n 1 + 1 + = = μnPn μ′nPn ( ) ∗ ∗ 0, σ2Id 0, σ2Id N ( ( N ( ) 15 ) ) where Pn is a Markov transition kernel that is c-Lipschitz in the Wψ2 metric. Then for any R ́enyi order q 1, ⩾ μN q μ′N so long as N log1 c / ⩾ √q q ( ( R μ0,μ′ 1 Wψ2 0 ) ( σ√2 − ) ∥ . q W 2 ψ2 μ0, μ′0 2σ2 ( , ) c2N ⩽ ) (3.1) ( We remark that unlike previous versions of the shifted divergence technique, Theorem 3.1 re- quires a restriction on the number of iterations N .9 But this restriction is mild due to the loga- rithmic dependence. In fact, it is equivalent to requiring the upper bound in (3.1) to be at most 1 q − 1 The rest of this section is devoted to proving Theorem 3.1. In §3.1 we define a new Lyapunov . ) /( function, and in §3.2 we use it to prove Theorem 3.1. ) 3.1 Shifted R ́enyi divergence using Orlicz–Wasserstein shifts Key to our proof of Theorem 3.1 is a new Lyapunov function for tracking how indistinguishable the Markov chains become as they evolve. This new Lyapunov function is a shifted R ́enyi divergence, but unlike the standard shifted divergence technique, here we measure the shift using an "Orlicz– Wasserstein metric" rather than W . ∞ We begin by recalling the definition of a sub-Gaussian Orlicz norm. For shorthand, we drop the adjective "sub-Gaussian" as this is the only Orlicz norm considered in this paper. For further background on Orlicz norms, we refer the reader to, e.g., the textbooks [RR91; Ver18], and we mention that the standard significance of this particular (sub-Gaussian) Orlicz norm is that a random variable is sub-Gaussian if and only if this norm is finite [Ver18, Example 2.7.13]. Definition 3.2 (Orlicz norm). The Orlicz norm of a random variable X is X ψ2 ∶ = inf λ > 0 ∶ Eψ2 ∥ ∥ { X λ ∥ x2 ( exp ≤ ∥ ) − 1. 1 , } where the function ψ2 ∶ R → R is defined as ψ2 ∶ = Our proof of Theorem 3.1 uses the Orlicz norm for defining an optimal transport metric between to denote the set of couplings between of random variables with first marginal ) probability distributions. In what follows, we write C μ and ν; that is, the set of all jointly defined pairs law μ and second marginal law X, Y ( ( μ, ν ν. X Y x ) ( ) = ( ) Definition 3.3 (Orlicz–Wasserstein metric). The Orlicz–Wasserstein metric between distributions ( μ, ν is ( ) ) Wψ2 μ, ν inf C X − Y ψ2 . μ,ν ( Note that since the Orlicz norm satisfies the triangle inequality, the standard gluing lemma from classical optimal transport theory shows that Wψ2 is indeed a metric; see, e.g., [Vil09b, Chapter 6]. The Orlicz–Wasserstein metric has also been considered in prior works [Stu11; Kel17; GHN23], but to our knowledge this paper constitutes the first use of this metric for sampling analysis. X,Y ( )∈ ( ∥ ) ∥ ) = ∶ = 9 This restriction comes from the fact that with this new Orlicz–Wasserstein shifted R ́enyi divergence, the new shift-reduction lemma (Lemma 3.7) does not apply to arbitrarily large shifts. 16 Remark 3.4 (Comparison to Wp). Let Wp denote the standard p-Wasserstein metric on Rd. Then 1 p Wp ≲ Wψ2 1 log 2 W . ∞ ⩽ √ √ Intuitively, the first inequality is because a finite Orlicz norm implies sub-Gaussianity with a re- lated bound on the concentration parameter, which implies related moment bounds; and the second inequality is because an ess sup bound implies compact support, which implies sub-Gaussianity by Hoeffding's lemma. Proofs of these bounds are provided in Appendix B.1. We also note that the re- verse inequalities do not hold, even if one weakens them by an arbitrarily large amount. For example, for the first inequality, take μ on R; then, Wp take μ x ∞. And for the second inequality, ( ∣) δ0 and ν the Laplace distribution with density ν = is finite for any 1 ; then Wψ2 0, 1 p ≤ μ, ν 1 2 exp μ, ν μ, ν ∞. − x = ) ( ∣ Definition 3.5 (Orlicz–Wasserstein shifted R ́enyi divergence). For any R ́enyi order q ) w 0, the Wψ2-shifted R ́enyi divergence between probability distributions μ and ν is defined as ⩾ ) ) ( 1 and shift ∞, but Wψ2 < is finite but W ( ∞ = μ, ν ) ( = δ0 and ν ( = = ) N ( ⩾ w )q ( μ ν R ( ∥ ) ∶ = inf μ′ s.t. Wψ2 μ,μ′ ( w )≤ q μ′ ν . R ( ∥ ) 3.2 Proof of Theorem 3.1 Here we describe how the standard shifted divergence analysis is modified when using shifts in Wψ2 rather than W , and how this modified argument leads to a proof of Theorem 3.1. ∞ At a high level, the shifted divergence technique-in both its original form and the new form here-is built upon two key lemmas. These two lemmas track how the shifted R ́enyi divergence evolves when both distributions are either (1) pushed forward through a Lipschitz map; or (2) convolved with Gaussian noise. These two lemmas are called the "contraction-reduction lemma10" and the "shift-reduction lemma." The contraction-reduction lemma is the simpler of these two lemmas, and extends unchanged- shift is replaced by our proposed in terms of both statement and proof-when the standard W Wψ2 shift. For completeness, we provide a brief proof. ∞ Lemma 3.6 (New contraction-reduction lemma, for Orlicz–Wasserstein shifted R ́enyi). For any R ́enyi order q 0, any Markov transition kernel P that is Wψ2-Lipschitz with parameter c, and any distributions μ, ν 1, any shift w Rd ⩾ ⩾ , ∈ μP P( νP ) w )q ( w q ( c / ) μ ν . R ν ( ∥ ) . Then by definition, Wψ2 ⩽ μ w ∥ q ( c / ) ) μ, μ′ ⩽ w c and ( ) / ( Proof. Let μ′ be the surrogate for μ in ) . Thus w q ( c / R μ ν ν q μ′ = R ( ∥ ) R ( w ∥ )q ( ) μP νP ∥ ) R μ′P q ( νP q μ′ ν w q ( c / ) μ ν , ⩽ ⩽ where the first step is because Wψ2 c Wψ2 w by Lipschitzness of P ; ∥ ) R the second step is by the data-processing inequality for R ́enyi divergences (Lemma 2.3); and the third step is by construction of μ′. μP, μ′P R ( μ, μ′ ( ∥ = c w R ( = ) ⩽ R ⩽ ) ∥ ) ∥ ( ) ( ) ) ( ( c / The shift-reduction lemma, however, requires substantial modification. 10 Although we use this name to be consistent with the previous literature on the shifted divergence technique, we note that this map need not be a contraction, i.e., the Lipschitz constant can be greater than 1. 17 Lemma 3.7 (New shift-reduction lemma, for Orlicz–Wasserstein shifted R ́enyi). For any R ́enyi or- der q , and any distributions μ, ν 0, any initial shift w , 1, any noise variance σ2 0, any shift increase δ 2q − 1 q − 1 > Rd σ ⩾ ⩽ ⩾ ∈ P( 0, σ2Id w )q ( μ ∗ ) ν ∗ 0, σ2Id w ( 2q δ + 1 − ) ⩽ μ ν + √ / ( δ2 log 2 . ) ( ) 2q − 1 2σ2 ) ( 0, σ2Id ( R N ( N ( ) ∥ 0. For shorthand, let γ denote R Proof. Case 1: initial shift w Y + Z divergence between law δ ν μ surrogate for )2q ( 1 ( ≤ optimally coupled with X ∼ μ with respect to the Orlicz–Wasserstein metric Wψ2 − ( ∥ x − x′ δ )) . We bound the R ́enyi , where X ∼ μ, Y ∼ ν, and Z ∼ γ. Let μ′ be the ) ∼ μ′ be μ, μ′ = X + Z ν , so that ( ( ) (3.2) δ. Let X ′ μ, μ′ N ( and Wψ2 dx, dx′ and law so that δ )2q ( − pX,X ′ ⩽ 1 , ψ2 μ′ R R R ) = μ 2q ν ) ) ) ∥ ∥ ( ( ) ( ) ) ∥ ( − 1 1 where here and henceforth we write pη as shorthand for the law of a random variable η. Note that X+Z and Y +Z are the result of the same function applied to the tuples ( ) and Y, Z respectively. Thus, by the data-processing inequality for R ́enyi divergences (Lemma 2.3), ) X ′, X−X ′ +Z ( law Y, Z . ( q μ ∗ γ ) ν ∗ γ = law q X + Z law Y + Z law q X ′, X − X ′ + Z ≤ ( R By expanding the definition of R ́enyi divergence and applying H ̈older's inequality, we bound this by R R ) ∥ ) ∥ )) )) ( ( ( ( ) ( ( ∥ ∫∫ ∥ ( ∥ ) X ′ − Z + dx′, dz q 1 − pX ( X ′ − ) x′ = X ′ Z + ∣ dz pX ′ dx′ 1 ) q − pX X ′ − X ′ Z + ∣ = x′ ( dz ) μ′ ( dx′ ) ( ) ( ) ) ) 1 q − 1 1 q − 1 log log log 1 q − 1 1 q − 1 2 ⋯ = = = ≤ ∫∫ ∫∫ ( ( ∫∫ x′, z q 1 − pX ′,X Z + x′, z ( pX X ′ ) ( − pZ X ′ − pX ′,X pX ′ pY μ′ ν ′ X ′ − pY,Z x′ x ( x′ ( x ′ ( μ′ ( ν ) pX ) ) ) X ′ Z + Y ∣ x′ x′ = z z ( z ) x′ ( = = X ′ ∣ z ∣ Z + γ 1 ) μ′ ( ) 2 ) ( q ( log ) x′ ) x ( ( 1 ́111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 ̧1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111¶ z ( dx′ ) ) ∫ ( ) ) ) ( ( − ′ pX X ′ + 2 1 q − 1 log − x′ Z + γ X ′ ∣ z = ∫∫ ( 2 q ( 1 ) pX − X ′ − X ′ Z + ∣ = x′ dz μ′ dx′ . ( ) ( ) ( ) ) ( ) 2 ́1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 ̧11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111¶ ( ) By definition of R ́enyi divergence and then the construction of μ′, the first term 1 simplifies to 1 = μ′ ν 2q 1 − = δ )2q ( − 1 μ ν . R ( ∥ ) R ( ∥ ) 18 The second term 2 can be bounded as ∫ ∫∫ ∫∫ ∫∫ 2 = ⩽ = = ⩽ ⩽ log log log log 2 2 2 1 q − 1 1 ( ) q − 1 1 ( ) q − 1 1 ( ) q − 1 2 δ2 2q − 1 ) ( 2σ2 ( ) 2q − 1 2σ2 ( δ2 ) log ∫∫ log 2 . exp 2 q − 1 pX 2q 1 − X ′ − X ′ Z + ∣ = x′ γ μ′ dx′ ( exp ( 2 ) R q − 1 2q ( 1 − px exp ( 2 ( q − 1 ) R ( )) ∥ pX,X ′ x′ Z γ − + )) ∥ x − x′, σ2Id ) ( dx, dx′ ( ) 0, σ2Id pX,X ′ dx, dx′ ( q − 1 ( exp (N ( x − x′ 2 ) ∥ N ( pX,X ′ dx, dx′ ))) ( ) 2q 1 − 2q − 1 ) R σ2 2 ) ( x − x′ δ2 ( ( exp ( ∥ ∥ ) ) ∥ pX,X ′ ( ) ∥ ) dx, dx′ ( ) ∣ ∣ ∣ = + − Z x′ x′ X ′ X ′ X ′ x′ px dx = ∫ Z pX + Above, the first step is by definition of the R ́enyi divergence; the second step is by noting that pX and using convexity of f -divergences (Lemma 2.6); the − fourth step is by the closed-form expression for the R ́enyi divergence between Gaussians (Lemma 2.5); ) δ2 the fifth step is by the assumption that ρ ∶ 1, which enables us to use Jensen's = inequality to bound E ρ where R ∶ Rρ ; and the final step is by the prop- = ( . Combining these bounds on 1 and 2 completes the proof for erty (3.2) of the coupling ] case 1. ) w + δ. Let X ′ μ, μ′ 2q −1 X − X ′ )/ ∥ 0. Let μ′ denote the surrogate for ν = ∼ μ′ be optimally coupled with X ∼ μ with respect to ( ∥ μ, μ′ and Wψ2 the Orlicz–Wasserstein metric Wψ2 R ( E R ⩽ X, X ′ [ ∥ w + δ. Decompose Case 2: initial shift w ] ( > μ, μ′ δ + 1 − Wψ2 X − X ′ q −1 exp , so that so that ) w ( 2q ) ( (∥ δ + 1 − σ2 2 w ( 2q ≤ δ2 μ′ R μ μ ≤ ⩽ 2q ν ν ( ) ) ) ) ( ∥ ( / [ − 1 ) ) τ X + ) 1 − τ X ′ ∥ + τ X ′ ( = ψ2 R = X ′ − X ∥ , ( ) where τ ∶ = δ w + δ . Then X ′ ( 1 ́111111111111111111111111111111111111111111 ̧1111111111111111111111111111111111111111111¶ ) ( X ′ ) 2 ́11111111111111111111111 ̧11111111111111111111111¶ /( ) w )q ( μ ∗ γ ν ∗ γ q pX ′ 1 ∗ γ R ( ∥ Above, the first step is by using pX ′ 1 ν ∗ γ δ2 ) + ⩽ 1 ) ∥ 2q ⩽ ∥ ν R R δ2 δ ( )q ( pX ′ log 2 2q − 1 2σ2 ( 2q − 1 2σ2 ) ( δ2 2q − 1 2σ2 ( ∗ γ as a surrogate for μ ∗ γ, which is allowed since ( δ + ) 1 − log 2 . log 2 ( 1 − w ( 2q ∥ μ ) ν μ′ R R + + = ⩽ ν ) ( ∥ ) ) ) Wψ2 μ ∗ γ, pX ′ 1 ∗ γ Wψ2 μ, pX ′ 1 ≤ ⩽ X − X ′1 ψ2 = 1 − τ X − X ′ ψ2 1 − τ w + δ w . = ⩽ ( ( 1, which is allowed since Wψ2 The second step is by using the result from case 1; the third step is by using μ′ as a surrogate for ∥ ) − X ′1 δ; and μ′, pX ′ pX ′ the final step is by construction of μ′. ∥ ( X − X ′ ) w + δ ) ( τ X ′2 X ′ ) ∥ ψ2 ψ2 ψ2 = ⩽ = ⩽ = ( ∥ ) τ 1 ( ) ∥ ∥ ∥ ∥ ∥ ∥ ( ) 19 δ2 σ2 log 2 q − λ 1 − λ ) ) 2 ( ( (3.3) Remark 3.8. Lemma 3.7 can be generalized to w )q ( μ ∗ 0, σ2Id ν ∗ 0, σ2Id ⩽ w ( q ( δ + λ + ) 1 − λ )/ μ ν + 1 2 ] [ ∈ ⩽ σ R R 0, 1 ) ∥ 1−λ N ( q ( ( N ( and any δ )) for any λ 2 recovers Lemma 3.7. Different λ ) choices of λ enable trading off the increase in the R ́enyi order in the first term against the penalty in the second term. The proof of this generalized bound is identical except for one change: replace the λ. Cauchy–Schwarz inequality in the proof with H ̈older's inequality − We conjecture that (3.3) is tight in that for any input parameters q, σ2, w, there exist distribu- tions μ, ν such that this bound holds with equality when it is optimized over the knobs δ, λ. Details on this conjecture are provided in Appendix B.2. ( . Choosing λ = ∫ ( ∫ ( 1 λ / q ) ( λ ) f g √ ∥ 1 ⩽ f /( g ∫ ) ( ) ) ) / − − − λ 1 1 1 ∣ ∣ ∣ ∣ Remark 3.9 (Failure of the shift-reduction lemma for weaker shifts). The Orlicz–Wasserstein met- ric is the "right" metric to use for the shifted R ́enyi analysis in the sense that (1) Lemma 3.7 holds with this Orlicz–Wasserstein shifted R ́enyi divergence; and (2) the Orlicz–Wasserstein distance at initialization is bounded for sampling algorithms (shown in Lemma 4.7). ∞ In contrast, (2) fails for all previous versions of the shifted R ́enyi divergence analysis, since they use W shifts. And (1) fails for other natural candidates of the Wasserstein metric for which the initialization distance is bounded. This includes the Wp metric for any finite p, as well as the Orlicz– Wasserstein metric for any Orlicz norm that is weaker than sub-Gaussian. See Appendix B.3 for details. Finally, we remark that this discussion is tailored to the fact that we are analyzing Markov chains with Gaussian noise; if for example, this were replaced by Laplacian noise, then the right notion of shift would be the Orlicz–Wasserstein metric with the sub-exponential Orlicz norm, and our techniques would extend in a straightforward way. We now use Lemmas 3.6 and 3.7 to prove Theorem 3.1. 1 μN ( 1PN − μN − 1PN − 1PN − = μ′N qδ2 2σ2 log 2 − Proof of Theorem 3.1. Let δ = chain update, Lemma 3.7 (in the form of Remark 3.8 with λ μ0, μ′0 cN Wψ2 . By using, in order: the definition of the Markov 0), and then Lemma 3.6, we obtain 0, σ2Id 0, σ2Id ∗ 1 ) ∗ μN q μ′N q = δ (( ) ( ∞ + ) ∥ ( 1 1 − ) ∥ ( ) ⩽ ⩽ + ) 1 R R R μN N ( ∥ μ′N ( c δ ( ) / ∞ ) Note that the use of Lemma 3.7 is valid since δ ⩽ N ( μ′N 1PN − − qδ2 ) 2σ2 log 2 . σ It suffices to show that the R ́enyi term in the above display vanishes. To this end, let Qn denote . Clearly ρ, ρ′ for the transition kernel for the n-th step of the Markov chain, i.e., ρQn Qn is Wψ2-Lipschitz with parameter c since Wψ2 Wψ2 ⩽ N ( any distributions ρ, ρ′. Thus we may apply Lemma 3.7 N − 1 times to argue that ) μ′N ∗ ρPn = ρPn, ρ′Pn ( by the assumption on N . 0, σ2Id c Wψ2 ρQn, ρ′Qn ( μ′0QN μ0QN 2 q ( μN ) ( 1 ) √ R ⩽ ) ) ∥ ( )) − − − − 1 1 1 1 q ) c δ ( / ∞ − − = R ( ∥ ) R R ⩽ = ) 1 − μ′0 ( c δ / ( ) ∞ cN δ μ0 ( ) / ( ∞ μ0,μ′ Wψ2 0 ( ( )) ∥ ( ∞ μ′0 μ′0 ∥ μ0 ) ) μ′0 R 0 . R Here, the third step is by the choice of δ, and the fourth step is by definition of the shifted R ́enyi divergence. The proof is complete by combining the above displays. = ⩽ ∞ ∥ ) ( ( ∥ ) 20 4 Low-accuracy sampling with O √d ( ) complexity The main result of the section is the first R ́enyi convergence guarantee for log-concave sampling that d. This improves requires a number of first-order queries that scales in the dimension d only as over the state-of-the-art which has d2 scaling. This result is formally stated as follows. √ d Theorem 4.1 (Low accuracy sampling with O ε ≲ 1 f is α-strongly-convex and β-smooth, and let 0 √ < ) ( given knowledge of the minimizer of f and access to complexity). Suppose that π ∝ exp where √q . There is a randomized algorithm that, −f ( ) 2d1 2 2q1 κ3 / / / ε N O = gradient queries for f , outputs a random point in Rd with μ satisfying ̃ ( ) μ q π ε2 . ⩽ ) ( R ∥ Remark 4.2 (Extension to arbitrary initialization). The algorithm in Theorem 4.1 initializes at the Dirac distribution δx∗. This is reasonable because the cost of using gradient descent to compute x∗ approximately, using the same first-order oracle access, is dominated by the cost of subsequently running the sampling algorithm. If the algorithm is initialized at some other point x, the runtime only increases by a logarithmic factor of log Wψ2 , which is lower order unless x is exponentially far from x∗, since Wψ2 by Lemma 4.7 and the triangle ) inequality. x − x∗ ( δx, π δx, π α + ≲ d √ ( ) / ∥ ∥ O 2 d1 / While the results of [Che+18; DR20; Ma+21; Zha+23] have also shown iteration complexities that scale in the dimension d as , a key difference is that these results do not hold for R ́enyi In particular, past work has only proven weaker mixing results in the Wasserstein divergences. metric or the KL divergence. As discussed in the introduction, Wasserstein and KL guarantees are insufficient for the purpose of warm-starting high-accuracy sampling algorithms-for this, it is essential to have guarantees in the more stringent R ́enyi divergence. (Note that Wasserstein bounds are weaker than KL bounds by Talagrand's T2 inequality, and moreover KL bounds are weaker than R ́enyi bounds by monotonicity of R ́enyi divergences.) See §1.2 for a detailed discussion of this and of the many longstanding technical difficulties involved with establishing R ́enyi guarantees. ̃ ) ( The algorithm we use is Underdamped Langevin Monte Carlo (ULMC) with certain parameters (stated explicitly in the proof in §4.3). Background on this algorithm is recalled in §4.1. At a high level, the proof of Theorem 4.1 uses the weak triangle inequality for R ́enyi divergences to decompose the sampling error of ULMC into the following two terms, both measured in R ́enyi divergence: 1. The "bias" error between the stationary distribution of ULMC and the target distribution π. 2. The "discrete mixing" error of ULMC to its biased stationary distribution. The bias error (1) is readily handled by recent results such as [GT20; Zha+23]. Bounding the discrete mixing error (2) is the key technical challenge; see §1.2 for a detailed discussion of the technical obstacles related to this, and the connections to open problems about hypocoercivity in the PDE literature. The key contribution of this section is to bound this quantity in Theorem 4.4 below. To do this, we use the new shifted divergence technique developed in §3. The section is organized as follows. In §4.1 we recall relevant background about ULMC, in §4.2 we bound the discrete mixing error of ULMC, and in §4.3 we use this to prove Theorem 4.1. 21 Remark about notation in this section: the ULMC algorithm studied naturally operates on the augmented Hamiltonian state space R2d, so in this section we use boldface to denote probability distributions on R2d from non-boldfaced distributions on Rd. For example, we write π to denote the target distribution π ⊗ in this augmented space. 0, Id ) 4.1 Background on Underdamped Langevin Monte Carlo N ( The exposition in this subsection is based on the corresponding section in [Che23]; we refer the interested reader there for further details. Underdamped Langevin diffusion. Studied since the work of Kolmogorov in the 1930s [Kol34], the underdamped Langevin diffusion-sometimes also called the kinetic Langevin diffusion-is the solution to the stochastic differential equation dXt dYt = = Yt dt , −∇f Xt dt − γYt dt + 2γ dBt , (4.1) √ ) ( ( t ≥ Bt 0 is a standard d-dimensional Brownian motion. Analogous to the classical theory of where convex optimization, here the auxiliary state variable Yt has the physical interpretation of momen- tum, and the linking parameter γ has the physical interpretation of friction. A related interpretation of the underdamped Langevin diffusion is as a variant of the idealized Hamiltonian Monte Carlo al- gorithm, in which the momentum is refreshed continuously rather than periodically. The stationary distribution for this SDE is the joint distribution ) π x, y ∝ exp −f x − 1 2 2 y . (4.2) ) In this section, we slightly abuse notation by using the boldface π to distinguish this joint dis- tribution on R2d from the target distribution π ∝ exp on Rd; of course the latter is the x-marginalization of the former. ∥ −f ( ( ∥ ) ( ) A major obstacle for analyzing the convergence of the underdamped Langevin diffusion is that this process exhibits hypocoercive dynamics, i.e., the standard Markov semigroup approach based on isoperimetric inequalities does not work. It is a longstanding question in PDE theory to develop general tools for establishing fast convergence of hypocoercive dynamics. See the discussion in §1.2. We bypass these issues by instead developing tools for analyzing a discrete-time version of this diffusion. (In forthcoming work, we detail the extent to which these discrete-time analyses enable analysis of continuous-time hypocoercive dynamics.) ( ) Underdamped Langevin Monte Carlo. There are several ways to discretize the underdamped Langevin diffusion. Perhaps the simplest way is the Euler–Maruyama discretization, as is standard for defining (unadjusted) Langevin Monte Carlo. However, for these underdamped Langevin dy- namics, there is a better discretization which dates back at least to 1980 [EB80], namely: Yt dt −∇f dXt dYt = = Xnh dt − γYt dt + 2γ dBt , √ n+1 h nh, for t . This process is called Underdamped Langevin Monte Carlo (ULMC) or Kinetic Langevin Monte Carlo; we use the former term in this paper. The point of this discretization is that since the gradient is refreshed periodically rather than continuously, the SDE is linear within ) ( ) ( ∈ ] [ 22 these periods, and thus can be integrated exactly in closed form (see, e.g., [Che+18, Appendix A]). This is called an "exponential integrator" in the lingo of numerical analysis, and is formalized as follows. Xnh, Ynh , the law of Lemma 4.3 (Explicit Gaussian law for ULMC iterates). Conditioned on X n ( is the Gaussian distribution h, Y 1 ) Xnh, Ynh , Σ ⊗ Id n ( F + 1 x + γ− 1 − a 1 y − γ− 1 h − γ− N ( 1 − a ( ∇f x ) 1 , ay − γ− ) where ( 1 − a 1 h + ) x, y ∶ ) = F ( and ( ) ( Σ ∶ = ( 2 γ ) h − 2 γ ( 1 − a 1 2 + 1 2γ − a + a2 ) 2 γ ( ( [ )) ( 1 − a2 ( −γh ) )) . ) 1 − a + a2 2 1 − a2 2 γ ( ( ( . ) ] ) x ∇f ) ( )) Above, we use the notational shorthand a ∶ = In the rest of this section, we write P ∶ = P h,γ to denote the Markov transition kernel on R2d that corresponds to an iteration of ULMC. We suppress the dependence of P on the parameters h and γ for simplicity of notation. exp ( ) ( 4.2 Discrete mixing of Underdamped Langevin Monte Carlo Theorem 4.4 (Discrete mixing of ULMC). Suppose that π ∝ exp where f is α-strongly- convex and β-smooth. Let P denote the Markov transition kernel for ULMC when run with friction parameter γ 1 , any = − R ́enyi order q 2β and step size h ≲ 1 1, and any two initial distributions μ0, μ′ √ 0 ⩾ . Then, for any target accuracy 0 log 2 q ≤ √ R2d −f /( √ κ β < ε ) ( , ) μ0P N q ′ 0P N μ ∈ ε2 , P( ⩽ if the number of ULMC iterations is R ( N ≳ β αh √ log ∥ q W 2 ψ2 where ( is the linear map defined in (4.3). ) #μ0, 2 ε2 h3 β1 / (M M #μ′ 0 ) , ) ) M 0, Id 0, Id #μ′ 0 Wψ2 N ( distribution of the form μ0 ⊗ , and is compared to the target distribution μ′ 0 We remark that in a typical use case of this discrete mixing result, μ0 is initialized at a product π ⊗ . In this setting, the Orlicz–Wasserstein metric in the upper bound can be simplified to #μ0, ) To prove Theorem 4.4, we appeal to our new shifted divergence technique developed in §3. This (M requires analyzing the ULMC iterates in a twisted norm, since an iteration of the ULMC algorithm (or more precisely, the mean-shifting function F defined in Lemma 4.3) is not contractive with respect to the standard Euclidean norm. This twisted norm is the Euclidean norm after the change of coordinates N ( μ0, π 2Wψ2 M π ⩽ = = ) ( ) ) . u, v ∶ = x, y ∶ = x, x + 2 γ y . ) ) In these new coordinates, the mean of the next iterate of ULMC started at ̄F , we can explicitly write ( u, v ○ F ○ v − u M( ( ) 1 1. Since − − = ̄F M u, v M u + 1 − a 2 = M v − u ( − ( ) ( ( ) u, γ 2 1 − a ( = 1 h − γ− ( ) γ ( ∇f )) u , u + ) ( ) 1 + a 2 v − u − ( ) 23 (4.3) u, v is ̄F u, v , where ( 1 h + γ− ) ( 1 − a ) ∇f u . γ ( ) (4.4) )) ( By Lemma 4.3, it follows that conditioned on sian distribution , ̄Σ ⊗ Id Unh, Vnh ̄F Unh, Vnh , the law of N ( ( ) ) where ( ̄Σ = ) T . Σ U h, V 1 ) + n ( n ( 1 h ) + is the Gaus- ( ) (4.5) We make use of the following two helper lemmas about the dynamics of ULMC in this twisted norm. The first helper lemma shows that the ULMC algorithm sends two iterates to Gaussians with means that are closer in the twisted norm than the original iterates. Since the two Gaussians have the same covariance ̄Σ ⊗ Id, this implies that the ULMC Markov transition kernel P is contractive in Wψ2, which will allow us to use our new shifted divergence technique from §3. This lemma first appeared in the recent paper [Zha+23]; for completeness, a proof is provided in Appendix C.1. M M Lemma 4.5 (Contractivity of ULMC in the twisted norm). Suppose that π ∝ exp α-strongly-convex and β-smooth. For step size h ≲ 1 and friction parameter γ ̄F ∶ R2d → R2d defined in (4.4) is a contraction with α 2β h + O βh2 1 − ̄F √ Lip = . ⩽ −f where f is 2β, the function ( ) The second helper lemma estimates the noise of ULMC in this twisted norm. The proof is an ∥ ∥ √ ( ) explicit computation and is provided in Appendix C.2. Lemma 4.6 (Noise of ULMC in the twisted norm). Suppose that h ≲ 1 defined in (4.5) satisfies λmin ̄Σ = γh3 6 1 − O γh . / γ. Then the matrix ̄Σ Armed with Lemmas 4.5 and 4.6, we are now ready to prove Theorem 4.4. ( )) ( ( μn Proof of Theorem 4.4. Let 0 and μ′ 0P n obtained by running ULMC from initialization distributions μ0 and μ′ νn twisted processes coordinates matrix defined in (4.3). Since } { for R ́enyi divergences (Lemma 2.3) in both directions implies μ0P n and μ′ n = 0, respectively. Define } is the change-of- = is invertible, applying the data-processing inequality M 0 denote the two processes μn #μn and ν′ n { 0 by νn n, where { 0 and #μ′ ν′ } n M M = = { } n n n n ⩾ ⩾ ⩾ ⩾ ) μ′ n M ′ μ N μN q = νN q ′ N ν . We now show that the latter term is at most ε2. For shorthand, define λ ∶ = ∥ Q to be the Markov operator given by νQ change of measure, the law of νn+1 is ) 0, ̄Σ ⊗ Id − λI2d ̄Σ and define . Then by Lemma 4.3 and a ( R ) ̄F#ν ∗ λmin R = ) ( ∥ ( ̄F#νn ∗ 0, ̄Σ ⊗ Id Similarly, the law of ν′ n+1 is N ( N ( νnQ ∗ ) . 0, λI2d N ( ) = ) ̄F#ν ′ n ∗ 0, ̄Σ ⊗ Id ′ nQ ∗ ν 0, λI2d . = Thus, letting c denote the Lipschitz constant of the Markov operator Q w.r.t. the Wψ2 metric, we ) may invoke11 the new shifted divergence result (Theorem 3.1) to bound N ( N ( ) νN q ′ N ν c2N q 2λ ⩽ W 2 ψ2 ν0, ν′0 . (4.6) 11 The application of this result requires the number of iterations N to be large enough that the right hand side ) , is at most (log 2)/(q − 1). But this holds by assumption. R ( ∥ ( ) of (4.6), later set to ε2 24 We now use the two helper lemmas to quantify the various terms in (4.6). First, by a simple cou- pling argument and then an application of Lemma 4.5, the Markov operator Q is Wψ2-contractive with parameter c, where c ⩽ ̄F Lip ⩽ exp −Ω αh β . Second, because ULMC is run with step size h ≲ 1 ∥ ∥ ( )) γ, Lemma 4.6 implies √ ( Therefore, by combining the above displays, we conclude that ) Ω λ = . β h3 / √ ( μN q ′ μ N = νN q ′ N ν ≲ exp −Ω αh β N q β h3 W 2 ψ2 #μ0, ′ #μ 0 . Setting this bound to ε2 and solving for N completes the proof. R ( ∥ ) R ( ∥ ) ( ( √ )) √ (M M ) 4.3 Warm start with Underdamped Langevin Monte Carlo We begin by bounding the distance to the target at initialization. We emphasize that this initial- ization is not a warm start. Indeed, this initialization is even weaker than what is typically called x∗, β− a "feasible start" in the literature (namely ), and moreover can be further relaxed to an arbitrary initialization x0 so long as the distance between x0 and the mode x∗ of the target distribution is sub-exponentially large (since our final bound depends only logarithmically on this distance). 1Id N ( ) Lemma 4.7 (Orlicz–Wasserstein distance at initialization). Suppose that π ∝ exp α-strongly convex. Let x∗ denote the minimizer of f . Then −f where f is ( ) Proof. Let X ∼ π and define Y ∶ = X − x∗ ( . By definition of the Orlicz–Wasserstein metric, ) / Wψ2 δx∗, π ⩽ 6 √ d α . Wψ2 δx∗, π = ∥ X − x∗ ∥ ψ2 Y ψ2 = = inf λ > 0 ∶ E exp Y 2 λ2 2 . ⩽ ) By the elementary inequality 2. Thus 2 Y − EY ( ∥ a + b 2 ∥ 2 ⩽ ∥ ∥ a2 + b2 { , we can bound Y 2 ( = ) } Y − EY + EY ( ) ( ) 2 ( ) Y λ2 [ For the first term, use the basic inequality E bound for strongly log-concave distributions (Lemma A.8) to obtain ⋅ E exp E exp ( Y 2 ] Y exp E ) 2 ≤ ⩽ 2 ( ) ( Y − EY λ2 Y 2 λ2 2 E ( 2 . ( and a standard second-moment-type ) ) 2 ⩽ ) 2 E Y 2 + [ ] ) For the second term, we use sub-Gaussian concentration. Specifically, combining the log-Sobolev is a 1-Lipschitz function of X ∼ π, it follows that X − x∗ inequality on π with the fact that Y Y − EY is sub-Gaussian with variance proxy 1 α (see, e.g., [BGL14, equation (5.4.1)] and [BLM13, ∥ = ( ( ) ∥ ] [ 2 [ ] 2d αλ2 . exp ⩽ exp 2 E Y λ2 [ ] / 25 §2.3]). Therefore, by a standard moment generating function bound for the square of a sub-Gaussian random variable (see, e.g., [BLM13, §2.3]), 2 E exp Y − EY λ2 2 αλ2 ⩽ 216 /( ) , ( α. By combining the above displays and setting λ ( ) ) for any λ2 ⩾ 16 32d α, we conclude that = √ / E exp Y 2 λ2 2d αλ2 + 16 log 2 αλ2 exp ⩽ exp log 2 ⩽ = / 2 . ( Therefore this choice of λ is an upper bound on the Orlicz–Wasserstein norm Wψ2 ) ) ( ) ( δx∗, π . ( The second lemma uses Girsanov's theorem to bound the bias of ULMC. Here, we build upon recent advances in the literature on R ́enyi discretization of stochastic processes. Beginning with the works [GT20; Che+21; EHZ22] and culminating in the paper [Che+22b], it is now understood that the Girsanov discretization technique leads to bias bounds for LMC in R ́enyi divergence matching prior results which only held for weaker divergences, and yet remains flexible enough to cover varying assumptions. The recent paper [Zha+23] extends this technique for ULMC. Since the results of [Zha+23] hold under more general assumptions at the expense of a more involved analysis, and in the interest of keeping our derivations more self-contained, in Appendix C.3 we simplify and streamline the Girsanov argument of [Zha+23] for our setting of interest. In order to clarify where the d1 2 comes from, we write the final bound in terms of the total elapsed continuous / time T N h rather than the number of iterations N . ) = x −f Lemma 4.8 (Bias of ULMC). Suppose that f is α-strongly-convex and β-smooth. Let π exp of ULMC with friction parameter γ ∥ number of iterations and T ∝ , and let P denote the Markov transition kernel corresponding to an iteration 1/2 , where N is the total N h is the total elapsed time. Then, β and step size h ≲ 1 T log N ( β3/4d1/2q − 1 2 x, y √ ≍ y ( ) ∥ ) ) ( ( 2 ) = πP N q π 2dh2qT . ≲ β3 / ( = 0, Id δx∗ ⊗ To this end, given a joint distribution ν ∥ R to obtain an iterate Proof of Theorem 4.1. Consider the following algorithm: run ULMC for N iterations from initial- ) R2d, and then output X. We show that for ization μ0 X, Y a certain setting of the ULMC parameters, this algorithm satisfies the guarantees of the theorem. Rd × Rd Πx , let denote ≅ the marginal on the first d coordinates, where Πx ∶ R2d → Rd maps ↦ x. Then in particular, x, y ( ) P( the law of the algorithm's output is μ ∶ #π. , and the target distribution is π = ( Thus by the data-processing inequality for R ́enyi divergences (Lemma 2.3), the sampling error of the algorithm is bounded by P( ) μ0P N ) R2d Πx Πx N ( #ν P( Rd = # ( ) ) ) ) ( ) ( ) ∈ ∈ ∈ ( μ q π ) μ0P N q π . ⩽ By the weak triangle inequality for R ́enyi divergence (Lemma 2.7), we can further bound this by R R ( ) ∥ ∥ ) ( μ0P N q π ⩽ q − 1 2 q − 1 / μ0P N πP n + 2q πP N π . 2q 1 − (4.7) R ( ∥ ) R ( ∥ ) can be crudely bounded by 2, say, since it suffices to bound the 2 (indeed, monotonicity of R ́enyi divergences in the order q then 2). R ( q − 1 2 The coefficient R ́enyi divergence error for q ⩾ implies the same bound for q < )/( ( / ) ∥ q − 1 3 ) 3 / / 26 Now, by combining our discrete mixing result for ULMC (Theorem 4.4), our initialization bound (Lemma 4.7), and the ULMC bias bound (Lemma 4.8), we conclude that if ULMC is run with friction parameter γ, step size h, and iteration complexity N that satisfy: R ( ∥ ) μ0P N q π ε2 , (4.8) ⩽ γ 2β = √ and h ≲ ε 2 2T 1 2q1 4d1 β3 / / / / and N ≳ β αh √ log dq 2ε2h3 αβ1 / . By recalling that T ∶ = we conclude that it suffices to run ULMC with the following choices of parameters: N h, solving for these choices of parameters, and omitting logarithmic factors, ) ( γ = √ 2β and Θ h = 2 εα1 / 2 2q1 βd1 / / ) 5 High-accuracy sampling with O ( ̃ N Θ = ̃ ( 2 2q1 2d1 κ3 / / / ε . ) complexity and √d ( ) Establishing fast mixing results for MALA is a longstanding problem. As detailed in §1, recent breakthroughs have made it clear that the key barrier for fast mixing of MALA is the question of warm starts. In this section, we use the faster low-accuracy sampling result developed in §4 to effi- ciently warm start MALA. This leads to the fastest known high-accuracy sampling algorithms not only in strongly log-concave settings (details in §5.1), but also in weakly-log-concave and isoperi- metric, non-log-concave settings (details in §5.2), for which we improve over state-of-the-art query complexity results by a factor of d. 5.1 Strongly-log-concave setting √ Here we improve the query complexity for high-accuracy sampling from a strongly log-concave target distribution to . This result is formally stated as follows. O 1 ε 2 polylog κd1 / −f Theorem 5.1 (Faster high-accuracy sampler for well-conditioned targets). Suppose that π ∝ where f is α-strongly-convex and β-smooth. There is an algorithm with randomized run- exp time that, given knowledge of the minimizer of f and access to N first-order queries for f , outputs a random point in Rd with law μ satisfying d π ε for any of the following metrics: )) ̃ μ ( ( ( ) / d ∈ TV, KL, ( ∥ √ ⩽ χ2, ) √ √ α W2 . Moreover, for any δ 0, 1 ∈ ( ) { with probability at least 1 − δ, the number of queries made satisfies } 1 δ 2 log4 max κd1 / , log 1 ε N O . ≤ ̃ In analogy to the familiar concept from algorithm design for deterministic problems [Cor+22], the algorithm in Theorem 5.1 may be called a "Las Vegas" algorithm because it has a randomized runtime which is small with high probability. The fact that this runtime is randomized is not an issue in practice because the iteration complexity depends on a quantity that is efficiently estimable during the execution of the algorithm. }) { ( In the rest of this subsection, we overview the algorithm in Theorem 5.1 and its analysis; see Appendix D for full technical details. This algorithm combines three algorithms as building blocks: ULMC, MALA, and the proximal sampler algorithm. Let us explain this by building up to the full complexity in two steps-both because this will motivate why all three algorithmic components are needed, and also because this is how our analysis actually proceeds. 27 ( ) d ̃ O O 2 d1 / rather than Weak version of Theorem 5.1 (full details in Appendix D.3). First, consider the following simplified version of the algorithm in Theorem 5.1 which is only comprised of two algorithmic components: run ULMC, and then use this as a warm start for MALA. In order to argue that this two-phase algorithm mixes rapidly, we crucially use our result from §4 to guarantee that ULMC mixes to constant R ́enyi divergence error in a number of iterations that scales in the dimension d as . This allows us to provide an algorithm for warm-starting MALA which is not significantly slower than MALA is when initialized from a warm start. In other words, this lets us exploit, for the first time, the recent breakthroughs on MALA [Che+21; WSC22] which show that the mixing time of MALA scales in the dimension as when it is initialized at a warm start rather than a feasible start. We recall that such an improvement cannot be obtained without the warm start, due to the lower bound of [LST21a]. This leads to a final ε ; a formal statement is given in Theorem D.1. runtime of roughly However, while this simple combination of ULMC and MALA achieves the desired dependence )) on the dimension d, it leads to a suboptimal dependence on the condition number κ, namely . This worsened dependence in κ arises from the state-of-the-art bounds O on the discretization of ULMC [Zha+23]. For full details on this weak version of Theorem 5.1, see ̃ ) Appendix D.3. 2 polylog 2 + κd1 2d1 κ3 / / / rather than rather than 2 κ3 / 2 d1 / ( O O O O ̃ ̃ ̃ ̃ ̃ κ d 1 ( ) ) ( ( ) ( ( ) ( / The full version of Theorem 5.1 (full details in Appendix D.4). In order to improve the condition number dependence of the weak version of Theorem 5.1, we require an extra algorithmic component: the recently proposed proximal sampler algorithm. See Appendix D.2 for background on this proximal sampler algorithm. Briefly, this algorithm reduces the problem of sampling a κ strongly log-concave distribution with condition number κ, to the the problem of sampling related strongly log-concave distributions each with constant condition number. The upshot is that ) O the latter can be accomplished in the desired runtime by using the weak version of the algorithm since each sampling subproblem is well-conditioned. 2 polylog κd1 / O ̃ 1 ε ( ̃ ( ( / )) Mixing in R ́enyi divergence. While the main conceptual innovation here is the high-level strat- egy of combining these three algorithmic building blocks, we remark that an additional technical obstacle for proving Theorem 5.1 is showing mixing in more stringent notions of distance than TV. See the discussion in §1.2. Indeed, while our new ULMC result proves fast mixing in R ́enyi divergence, existing results on MALA and its combination with the proximal sampler are limited to TV. We boost this mixing in TV to R ́enyi divergences (and thus all the other desired metrics by standard comparison inequalities) using two additional ideas. The first improves mixing bounds for the proximal sampler from TV to R ́enyi divergence. To do this, we control the propagation of error when each step of the proximal sampler algorithm is per- formed approximately in R ́enyi divergence. As we show, this is readily accomplished by appealing to the "strong composition rule" of R ́enyi divergences from the differential privacy literature. The second improves mixing bounds for MALA from TV to R ́enyi divergence. We accomplish this by further exploiting the fact that MALA is warm started in R ́enyi divergence. Note that this means we use the R ́enyi warm start in two ways: first to show that MALA mixes fast in TV, which is what we can conclude from the above argument and appealing to [Che+21; WSC22]; and second, to boost the TV bound at the final iterate to a more stringent bound. We isolate this TV-to-R ́enyi boosting technique in the following simple lemma as it may be of independent interest: indeed, since it uses the TV mixing bound in an entirely black-box way, this lemma may be useful for establishing R ́enyi mixing of other warm-started algorithms. This lemma improves the previous which is currently result of [Che+21, Lemma 28] because that result required a warm-start in ∞ R 28 unavailable algorithmically, whereas this lemma here only requires the weaker condition of a warm start in a R ́enyi divergence of finite order (stated here with q 3 for simplicity). = Lemma 5.2 (Boosting TV to R ́enyi mixing given R ́enyi warm start). Let P be a Markov transition kerrnel which has stationary distribution π. Consider running P from any initialization distribution μ0P N . Then for N steps to obtain a distribution μN ∶ = TV μN , π ⋅ exp 2 μ0 3 π χ2 μN π + 1 . ⩽ √ ( ) See Appendices D.1 and D.2 for background on MALA and the proximal sampler algorithm, respectively; and see Appendices D.3 and D.4 for proofs of the weak version and full version of Theorem 5.1, respectively. )) R ) ( ∥ ( ( ( ∥ ) 5.2 Extensions to weakly-log-concave and non-log-concave settings Our faster algorithm for sampling from well-conditioned targets (Theorem 5.1) yields faster samplers for a variety of other settings, due essentially to the reductions in [Che+22a]. We present here several such extensions that concern target distributions which satisfy isoperimetric inequalities, which is quite flexible in the sense that this allows for non-log-concavity and also is preserved under, e.g., bounded perturbations and Lipschitz mappings. See §A for background on these isoperimetric inequalities. A comment on notation for these isoperimetric settings: we still use the condition number κ to denote the ratio κ α, but now α denotes the (inverse) parameter of an isoperimetric bound, rather than the parameter for strong convexity. The motivation behind this notation is that α- α, which in turn implies the strong-convexity implies the log-Sobolev inequality with parameter 1 Poincar ́e inequality with parameter 1 α (see Lemma A.3). β = / / = 1 2β , namely for any y In this section, for simplicity of exposition, in addition to the first-order oracle for f we also assume access to a prox oracle which can compute the proximal operator for f with step size h . Note that for this choice of step size, computing the proximal operator is a strongly convex and { } smooth optimization problem with condition number O , so this can be done with off-the-shelf optimization methods such as gradient descent. We emphasize, however, that this assumption is only made to ease the presentation of the results, and we provide more detailed results without this assumption in Appendix D that more closely mirror Theorem 5.1. Rd the oracle returns return proxhf arg minx + 1 2h y − x ∶ = Rd x 1 y f ) ) ( ( ∥ ) ∥ ( ∈ 2 ∈ / satis- α-LSI and that f is β-smooth. There is an algorithm that, given access to a first-order + prox ε Theorem 5.3 (Faster high-accuracy sampling from LSI targets). Suppose that π ∝ exp fies 1 ( oracle for f and initialized at μ0, outputs a random point in Rd with law μ satisfying d for any of the following metrics: −f ) π μ ⩽ / ( ∥ ) d ∈ TV, KL, χ2, α W2 , √ √ √ { } using at most N O 2 log κd1 / 2 = μ0 ε2 π log3 1 ε queries . R Theorem 5.4 (Faster high-accuracy sampling from PI targets). Suppose that π ∝ exp 1 satisfies α-PI and that f is β-smooth. There is an algorithm that, given access to a first-order + prox −f )) ̃ ( ( ) ( ) ∥ ( ( ) / 29 oracle for f and initialized at μ0, outputs a random point in Rd with law μ satisfying d for any of the following metrics: μ π ε ⩽ ( ∥ ) using at most N d ∈ TV, KL, χ2, α W2 , √ √ √ { } O 2 log κd1 / χ2 μ0 ε2 ≤ π queries . ̃ ( Remark 5.5 (Extensions to Lata la–Oleszkiewicz targets). Just as in [Che+22a], we could also obtain a result for distributions satisfying a Lata la–Oleszkiewicz inequality, which interpolates be- tween PI and LSI. In this setting, we again improve over the previous state-of-the-art bounds by a factor of d1 2. However, for the sake of brevity, we omit this extension as it is conceptually similar / but requires more involved technical details. )) ( ( ) ∥ These results are the direct analogs of the state-of-the-art complexity results in [Che+22a, 2. Corollary 7], but here with a dimension dependence that is improved by a factor of d1 / We mention another consequence of our improved high-accuracy sampler for the strongly-log- concave setting. Namely, via the same proximal reduction framework, this gives the following alternative complexity bound for target distributions which are (non-strongly) log-concave, some- times called weakly-log-concave. This bound is a direct analog of [Che+22a, Corollary 6], but here with a dimension dependence that is also improved by a factor of d1 2. Note that this theo- / rem is a low-accuracy guarantee; one can also obtain high-accuracy samplers from our results in this log-concave setting by using the fact that log-concavity implies a Poincar ́e inequality, albeit with a function-dependent constant [KLS95], and then appealing to Theorem 5.4. The resulting low-accuracy and high-accuracy results are incomparable in the sense that each can dominate in different settings-but in any case, our theorems for both settings yield improvements by a factor 2. of d1 / Theorem 5.6 (Faster low-accuracy sampling from log-concave targets). Suppose that π ∝ exp , where f is convex and β-smooth. There is an algorithm that, given access to a first-order + prox ) oracle for f and initialized at μ0, outputs a random point in Rd with law μ satisfying KL ε2, using at most ( ≤ −f μ π ( ∥ ) N O ≤ ̃ ( 2 W 2 βd1 2 / ε2 μ0, π ( ) ) queries . Proofs for the results in this section are provided in Appendix D. At a high level, the proof of all these results use the same reduction to the problem of sampling from well-conditioned distributions. This reduction is based on the proximal sampler (described in Appendix D.2) and lets us apply our improved sampler for the well-conditioned case (Theorem 5.1). In each case, however, we must track the propagation of error due to the inexact implementation of the backwards step of the proximal sampler, which was not previously done in any work except for in the TV distance. , 2 μ0 μ0, π In Appendix D.7, we provide more explicit, albeit more complicated, statements of these results to address the following two points. (1) The above results depend on the initialization (through W2 ) and it may be unclear how large these quantities are in a given application. (2) We assumed that the algorithm has access to a stronger oracle than just 1 a first-order oracle for f , namely, we also assumed access to a prox oracle for hf with h 2β . We address (1) by explicitly bounding these initialization quantities in terms of other, more easily computable problem parameters, and we address (2) by removing the assumption of a prox oracle. , or χ2 μ0 R π π = ) ( ∥ ∥ ( ) ) ( 30 6 Discussion Here we mention several interesting questions for future research that are inspired by our results. • Are warm starts essential for future progress in high-accuracy sampling? Our work is the first to show the achievability of the faster rates proven for high-accuracy samplers under a warm start assumption. We do this by exhibiting an efficient algorithm for producing the warm start. We believe that this general strategy may be important for future progress in high-accuracy sampling. Indeed, the natural next candidate for improving upon MALA is Metropolized Hamiltonian Monte Carlo [Nea+11], or related variants. For such Metropolized algorithms, we suspect that much of the intuition from §1.2 remains true; namely, that the algorithm can benefit from a more aggressive step size near stationarity. Hence, to extract the full potential of these algorithms, it seems likely that we must again pursue the dual plan of improving the rates under a warm start, and efficiently computing that warm start. Insofar as warm starts continue to play an important role in sampling analysis, the R ́enyi analysis techniques that we developed in §3 and §4 could prove useful for future progress in this direction. • Can we leverage shifted divergence techniques for further advances in differential privacy and beyond? Core to our results is an improved version of the shifted R ́enyi divergence technique that uses Orlicz–Wasserstein shifts rather than W shifts. Since their introduction, shifted divergences have been instrumental for advances in differentially private optimization (see the prior work discussion in §1.3), and also very recently in the context of sampling ([AT22b] and Theorem 4.1). We believe that we are only scratching the surface of potential applications, extensions, and refinements of this technique, and we are optimistic that a deeper understanding of our R ́enyi analysis toolbox will have implications far beyond. ∞ Acknowledgments. We thank Mufan (Bill) Li and Matthew Zhang for many insightful conver- sations regarding hypocoercivity. JMA acknowledges funding from an NYU Faculty Fellowship. SC acknowledges funding from NSF TRIPODS program (award DMS-2022448). 31 A Background on functional inequalities In this section, we collect relevant background material for the convenience of the reader. To go beyond the strongly log-concave case, we can instead assume that the target distribu- tion π satisfies a functional inequality, which encodes geometric information (e.g., isoperimetric properties) about π. We focus primarily on the two most well-studied functional inequalities in this context, namely the log-Sobolev inequality and the Poincar ́e inequality. For each of these two functional inequalities, the class of distributions satisfying this assumption not only includes all strongly log-concave distributions (see Lemma A.3 below), but also includes many more examples because of closedness properties of these functional inequalities under operations such as bounded perturbations of the potential, pushforwards via Lipschitz mappings, or taking suitable mixtures. We refer to [BGL14] for many of these properties, and to [CCN21] for the closure under taking mixtures. Definition A.1. A probability distribution π on Rd satisfies a log-Sobolev inequality (LSI) with constant CLSI if for all smooth and compactly supported functions φ ∶ Rd → R, entπ φ2 Eπ φ2 log ∶ = φ2 Eπ φ2 ≤ 2CLSI Eπ 2 ∇φ . Definition A.2. A probability distribution π on Rd satisfies a Poincar ́e inequality (PI) with con- [ stant CPI if for all smooth and compactly supported functions φ ∶ Rd → R, ] ( ) [ ] [∥ ∥ ] varπ φ ≤ CPI Eπ 2 ∇φ . We next collect together key facts about these functional inequalities. The following results show that the class of distributions satisfying these inequalities is larger than the class of strongly log-concave distributions; see [BGL14, Proposition 5.1.3 and Corollary 5.7.2]. [∥ ) ∥ ( ] Lemma A.3 (Strong log-concavity implies LSI implies PI). Let π be a distribution on Rd. 1. ( Bakry– ́Emery theorem) If π is α-strongly log-concave, then it satisfies an LSI with constant at most 1 α. 2. If π satisfies an LSI with constant CLSI, then it also satisfies a PI with constant at most CLSI. / A useful consequence of the LSI is the following sub-Gaussian concentration inequality, typically established via the Herbst argument; see [BGL14, Proposition 5.4.1]. Lemma A.4 (LSI implies sub-Gaussian concentration). Suppose that π is a distribution on Rd R, satisfying an LSI with constant CLSI. Then, for any L-Lipschitz function φ ∶ Rd → R and any λ ∈ Consequently, for all η 0, ≥ Eπ exp λ φ − Eπφ λ2CLSIL2 2 exp ≤ ( ( )) ( . ) π φ − Eπφ exp − η ≥ ≤ η2 2CLSIL2 . Similarly, the PI implies subexponential concentration, see [BGL14, §4.4.3]. { } ( ) 32 Lemma A.5 (PI implies subexponential concentration). Suppose that π is a distribution on Rd satisfying a PI with constant CPI. Then, for any L-Lipschitz function φ ∶ Rd → R and any η 0, ≥ π φ − Eπφ 3 exp − η ≥ ≤ η CPI L . { } ( √ ) Next we recall two comparison inequalities which enable proving sampling guarantees in Wasser- stein distance as an immediate corollary of proving sampling guarantees in other metrics-namely KL divergence in the LSI setting, and chi-squared divergence in the PI setting. Such comparison inequalities are often called transport inequalities. Specifically, the first result, attributed to Otto and Villani [OV00], shows that under an LSI, a transportation inequality between Wasserstein and KL divergence holds (this inequality is often referred to as Talagrand's T2 inequality). Lemma A.6 (Otto–Villani theorem). Suppose that π is a distribution on Rd satisfying an LSI with constant CLSI. Then, for all distributions μ Rd , 2 W 2 2 μ, π ≤ ∈ 2CLSI KL P ( μ ) π . The second result shows a similar transport inequality in the PI setting [Liu20]. Under a PI, Talagrand's T2 inequality does not necessarily hold anymore. Nevertheless, a useful transport inequality still holds if one replaces the KL divergence by the chi-squared divergence. ( ( ) ) ∥ Lemma A.7 (Quadratic transport-variance inequality). Suppose that π is a distribution on Rd satisfying a PI with constant CPI. Then, for all distributions μ Rd , 2 W 2 2 μ, π ≤ 2CPI χ2 μ π . ∈ P ( ) Finally, we record the following standard second-moment-type bound for strongly log-concave measures; see, e.g., [DKR22, Proposition 2]. We give a short proof sketch for the convenience of the reader. ) ( ∥ ) ( Lemma A.8 (Second-moment-type bound under strong log-concavity). Suppose that the distribu- tion π ∝ exp is α-strongly log-concave, and that x∗ is the minimizer of f . Then, 2 −f ( ) EX π ∼ X − x∗ d α . ⩽ Proof. Integration by parts shows that for any smooth function φ ∶ Rd → R of controlled growth, it holds that Eπ x − x∗ and ∆φ ∇f, ∇φ d. By strong convexity of f , 2, for which ∇φ = 2, and the result follows. ] [∥ 0. We apply this to φ , x − x∗ x − x∗ ∆φ − ∇f x x = ∥ / x α ) ≥ ( 1 ∶ 2 = x − x∗ ∥ = [ ⟨ ⟩] ∥ ( ) B Deferred details for §3 ⟨ ( ) ⟩ ∥ ∥ B.1 Proof for Remark 3.4 Here, we prove the inequality in Remark 3.4, repeated here for convenience: 1 p Wp ≲ Wψ2 1 log 2 W . ∞ ⩽ (B.1) Bounding Wp by Wψ2. By [Ver18, Proposition 2.5.2], if ν for the Wψ2 distance, then √ √ X, Y is an optimal coupling of μ and Wp μ, ν ≤ E X − Y p 1 p ≲ / p ( ) [∥ ∥ ] √ 33 ∥ ( X − Y ) Wψ2 = ψ2 ∥ μ, ν . ( ) . Observe that for any random variable Z, if we denote Z Bounding Wψ2 by W then we can bound ∞ E ψ2 Z ∞ Z and therefore / ∥ ∞ to the random variable Z = ∥ [ Z ∥ ⩽ ψ2 ( ∥ ∥ ∥ Z 2 Z Z ∥ ∥ E exp ⋅ log 2 − 1 exp √ = )] log 2 2 ∥ ∞ ∥ X − Y , we conclude the desired inequality √ / ⩽ ( ) [ ] ( ess sup Z , ∶ = ∥ ∥ ∞ ∥ 1 , ∥ − 1 = log 2 ) log 2 by the definition of the Orlicz norm. Now, applying this bound Wψ2 μ, ν inf C )∈ μ,ν ( ) = X,Y ( X − Y ψ2 ⩽ ( ) ∥ ∥ √ B.2 Remarks on tightness of Lemma 3.7 1 log 2 inf C )∈ μ,ν ( ) X,Y ( X − Y ∥ ∞ = ∥ 1 log 2 W μ, ν . ∞ √ ( ) ⩾ c2q x 2σ2 ∥ 2 , ∥ Here we remark that, conditional on the following plausible conjecture, the generalized version of Lemma 3.7 (as stated in Remark 3.8) is tight. This conjecture states that the shifted R ́enyi divergence between two isotropic Gaussians with same covariance is achieved by a deterministic shift. Understanding this simple case could be more broadly helpful for understanding tightness of other inequalities and analyses using the shifted R ́enyi divergence. Conjecture B.1. For any R ́enyi order q 1, noise variance σ2 ⩾ 0, shift w > 0, and mean x Rd, ∈ w )q ( x, σ2Id 0, σ2Id q = cx, σ2Id 0, σ2Id R max (N ( 0, 1 − w ) ∥ N ( x log 2 . )) R (N ( ) ∥ N ( = )) where c ∶ = √ ( Of course, the conjecture here is the first equality (the second equality is just the closed-form " is clear expression for the R ́enyi divergence between Gaussians in Lemma 2.5). The direction " because satisfies cx, σ2Id ∥) /∥ ⩽ N ( ) Wψ2 x, σ2Id , cx, σ2Id x − cx ψ2 ⩽ 1 − c log 2 = x w , ⩽ )) and therefore is feasible for the optimization problem defining the shifted R ́enyi divergence. The direction " " is the one requiring justification. (N ( N ( √ ∥ ∥ ∥ ∥ ) In the rest of this subsection, we show the claimed tightness assuming Conjecture B.1. Fix any δae1 and ⩾ log 2. We claim that the bound in Remark 3.8 holds with equality when its 0. Consider distributions μ 1, noise variance σ2 0, and initial shift w = R ́enyi order q > ν w parameters δ, λ are optimized; that is, ⩾ δ0, where a > = √ ⩾ w )q ( μ ∗ 0, σ2Id ν ∗ 0, σ2Id δ = 0, λ inf ∈[ > 0,1 ] w ( q ( δ + λ + ) 1 − λ )/ μ ν + R To this end, supposing Conjecture B.1 holds, the left hand side of (B.2) is equal to N ( N ( [R ) ∣ )) ( ∥ ) ( q − λ 1 − λ ) ) 2 ( ( δ2 σ2 log 2 ] . (B.2) w )q ( ae1, σ2Id 0, σ2Id R (N ( ) ∥ N ( )) = = q a − w (N (( q R a − w log 2 log 2 √ 2 . e1, σ2Id 0, σ2Id ) ) ∥ N ( )) 2σ2 √ ) ( 34 On the other hand, note that μ ν is equal to 0 if a is equal to ∞. This means that the optimal value of δ is a of (B.2) simplifies to R ) ( ∥ w ( q ( δ + λ + ) 1 − λ )/ w + δ log 2, and otherwise log 2 − w. Thus the right hand side ⩽ ( √ ) ] ( where the final step is because the optimal value of λ is at λ right-hand sides of (B.2) indeed match, as desired. ( ) ) log 2 2 q a − w 1 − λ σ2 √ = inf 0,1 λ ∈[ q − λ 2 ) ( ( √ / a − w log 2 2 , 2σ2 √ ) 0. We conclude that the left- and = B.3 Proof for Remark 3.9 Here we provide details for why Lemma 3.7 fails if the shifted R ́enyi divergence is defined using the Wp metric for any p finite, or alternatively with the Orlicz–Wasserstein metric with any Orlicz norm that is weaker than sub-Gaussian (i.e., with Orlicz function ψb 2). Specifically, for any of these Wasserstein metrics W , we claim that if μ is the distribution on R with density proportional to exp for an appropriate constant a − 1 for b ) δ0, then: xb − x < a ⋅ exp ∶ = ( ) 2, and ν = ( < (i) W μ, ν (ii) μ ∗ ) ( q < ∞. 0, σ2 ν ∗ ( ∣ 0, σ2 ∣ ) ∞. = ( R σ N ( 2q − 1 This comprises a counterexample to Lemma 3.7 by taking w ) ∥ q − 1 if δ for a sufficiently large b > ) W , then we can simply dilate the space (i.e., replace μ ( ( 0) and repeat the same argument. 0 and δ √ ( N ( )( )) = = > / μ, ν x and noting that bx ∝ μ x by μb ) ) ( ) ( ) In the case that W Proof of (i). finite for any p than sub-Gaussian, then W is equal to the p-th norm of μ, which is ∞. In the case that W is an Orlicz–Wasserstein norm with Orlicz norm weaker ) b. is equal to the Orlicz norm of ν, which is finite if we choose a Wp, then Wp μ, ν μ, ν < = ( = ( ) Proof of (ii). Note that μ ∗ is sub- Gaussian. We may therefore appeal to the fact that the R ́enyi divergence is infinite whenever the N ( first argument is not sub-Gaussian, but the second argument is. For a proof of this fact in the 2, see [Che+22b, Lemma 21]; this proof readily extends to any finite q case that q by replacing the Cauchy–Schwarz inequality by H ̈older's inequality. is not sub-Gaussian, yet ν ∗ ) 1, ∞ N ( N ( = = ) ) ∈ 0, σ2 0, σ2 0, σ2 ( ) C Deferred details for §4 C.1 Proof of Lemma 4.5 Compute the partial derivatives 1 h − γ− 1 − a γ ( 1 1 − a h + γ− ) γ ( ) ∇2f u , ∇2f ( ) u , ( ) 1 + a 2 1 − a 2 1 − a 2 1 + a 2 Id − Id − Id , Id . = = = = ∂u ̄F u, v ∂u ̄F ( ) u, v u v ∂v ̄F ( u, v ) u ∂v ̄F ( ) u, v v ( ) 35 Since 1 γ 1 h − γ− 1 − a O h2 , we have = ( ( )) u, v ∇ ̄F ( op ) 1 2 ≤ ∥ ( )∥ u Id Id 1 − a Id − b ∇2f 1 + a 1 − a 1 + a ( ) ) ∥[ ( ( ) A =∶ ́1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 ̧1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111¶ 1 h + γ− 1 − a Id ( ( ) . ) ∥ ] + O βh2 , op ( ) where we use the notational shorthand b ∶ = To bound this operator norm, we compute ( 2 γ 1 − a 1 + a 2 2 Id + 1 − a2 ) ( and b O Id − (( ) γ h = ( [ γh 1 + a ) Id − b ∇2f b ∇2f u u ( ( )) ) b ∇2f 2 Id 1 − a ) Id − 2 + ( ( 1 + a 1 + a ) ) u . ( ) ] ( , we can approximate AAT by the following matrix B with error ( ) (( ) ) ( 2 )) 1 − a2 2 AAT Since 1 − a O = = ( ) AAT − 2 ∥ 1 + a2 Id ) ( / Id − b ∇2f ) 1 − a2 ( u 1 − a2 u Id − b ∇2f 1 + a2 ) Id ( [ ) ( B =∶ ́1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 ̧1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111¶ ( ( ) ) ( op = ) ∥ ] O β2h2 γ2 ( + βh2 . ) By a direct computation, the eigenvalues of B are 1 + a2 ± eigenvalues of ∇2f . The strong-convexity and smoothness of f implies that λ , where λ ranges over the α, β 1 − a2 − bλ . Thus u ( ) B op max ≤ ( 2a2 + βb, 2 − αb ) ∈ . [ ] We note that ∥ ∥ { } 2a2 + βb = 2 exp −2γh + 2β 1 h + γ− −γh 1 − exp γ 2 1 − 2γh + = 2βh γ + O γ2h2 + βh2 . ( In order for this to be strictly smaller than 2, we must take γ ( ) ( ( ( ))) ( β. We choose γ √ 1 − αh 2 β + O > 2 = √ βh2 )) 2β, whereby . B op ≤ We deduce that ∥ ∥ 2 max 1 − h 2β, 1 − αh 2 β + O βh2 √ √ { / } ( ) ( √ / ) ( ) = AAT op ≤ 4 1 − αh 2 β + O βh2 and therefore ∥ ∥ ( ∇ ̄F u, v op ≤ C.2 Proof of Lemma 4.6 ∥ ( )∥ 1 − αh √ ¿ Á ÁÀ √ / ) ( ) 2 β + O βh2 1 − ≤ α 2β h + O βh2 . ( ) √ ( ) By definition of and Σ, M ̄Σ = T Σ 1 γ2 = 2γh + 4a − a2 − 3 2γh + a2 − 1 2γh + a2 − 1 2γh + 5 − a2 − 4a . M M [ ] 36 The smallest eigenvalue of this matrix is tr ̄Σ − tr ̄Σ 2 − 4 det ̄Σ λmin ̄Σ ( ) = = = 1 2 1 ( γ2 γh3 ( 6 ( ) √ 2γh + 1 − a2 − ( ) √ γ2h2 240 γh 2 1 − + 17 − 32a + 14a2 + a4 − 4γh + 4a2γh + 4γ2h2 )) ( − ⋯ . ) Above, the first step is by the explicit formula for the eigenvalues of a 2 × 2 matrix; the second step is by plugging in the entries of ̄Σ and simplifying; and the third step is by performing a Taylor expansion in the variable γh. ( ) C.3 Proof of Lemma 4.8 We invoke the following result, which appears as Lemma 26 in [Zha+23]. Proposition C.1 (Movement bound for underdamped Langevin). Let time underdamped Langevin diffusion (4.1) with potential f that is β-smooth and minimized at x∗. Assume that 0 0 denote the continuous- λ ≲ 1 γdh3 . Then, conditioned on ( X0, Y0 h ≲ Xt, Yt t ≥ ) , 2 ≲ β2h4 X0 − x⋆ ( 2 + h2 Y0 ) 2 + γdh3 λ . 1 √β γ and 0 < ∨ log E exp λ sup 0,h t ∈[ ] ( ∥ ≤ Xt − X0 Proof. This result can be easily adapted from the proof of [Zha+23, Lemma 26], noting that in our situation the bound simplifies as we are assuming ∇f is β-Lipschitz rather than merely H ̈older continuous. ∥ ) ( ∥ ∥ ∥ ∥ ) Let ΠT , ΠT denote the path measures (i.e., probability measures over ) for the discretized and continuous underdamped Langevin processes respectively, both started at the sta- tionary measure π. Girsanov's theorem [Le 16, Theorem 5.22] yields C([ ̂ ) ] 0, T ; Rd ΠT d dΠT = ̂ N 1 − exp ∑k 0 = ∶ exp MT , ( = √ 1 h ) + 1 2γ ∫ k ( kh ∇f Xt − ∇f Xkh , dBt − 1 h ) + 1 4γ ∫ k ( kh ∇f Xt − ∇f Xkh 2 dt ⟨ ( ) ( ) ⟩ ∥ ( ) ( )∥ ) provided that Novikov's condition (see [Le 16, Theorem 5.23]) holds: EΠT exp N 1 − ∑k 0 = 1 h ) + 1 4γ ∫ k ( kh ∇f Xt − ∇f Xkh 2 dt ∞ . < (C.1) Assuming for the moment that (C.1) is indeed verified, Itˆo's formula yields ∥ ( ) ( )∥ EΠT ΠT d dΠT ̂ [( q − 1 ) ] = ≤ q ( q2 4γ q − 1 4γ N 1 − ) 0 ∫ ∑k = EΠT + k ( kh k ( kh N 1 − 0 ∫ ∑k = 1 h ) 1 h ) + exp qMt ∇f Xt − ∇f Xkh 2 dt EΠT exp ( 2qMt ) ∥ EΠT ( ∇f ) Xt ( − ∇f )∥ Xkh 4 dt . ( ) [∥ ( ) ( )∥ ] √ 37 Bounding the first term. For t Schwarz inequality, ∈ kh, k + 1 h , let ∆t ∶ = ∇f Xt − ∇f Xkh . By the Cauchy– EΠT exp 2qMt ( ≤ ) ¿ Á ÁÀ 0 ∫ ∑k = [ ( 1 − N EΠT exp ) ] ( ) 1 h ) + t ∧ k ( kh 2 √ 2 q γ ∆s, dBs − ( 4q2 γ ) ∆s 2 ds √ † ) ( ́11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 ̧11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111¶ t ∧ 1 h ) N − + 1 ∥ ∥ ( ⟨ ⟩ ) × EΠT exp 4q2 γ − q γ ∆s 2 ds . k ( kh 0 ∫ ∑k = ( ) ∥ ∥ ¿ Á ÁÀ † We claim that the term marked equals 1; this would follow if the quantity inside the expectation is a martingale. In general, it is only a local martingale, but it is a bona fide martingale provided that Novikov's condition holds: it suffices to have ) ( EΠT exp N 1 − ∑k 0 = 1 h ) + 4q2 γ ∫ k ( kh ∇f Xt − ∇f Xkh 2 dt ∞ . < (C.2) ∥ Note that this condition is stronger than (C.1). ( ) ( )∥ Towards this end, we bound, for a parameter p 1 to be chosen later,12 ≥ N 1 − 4β2q2 ∑k 0 = γ ∫ k ( kh 1 h ) + Xt − Xkh 2 dt ∥ ∥ EΠT exp ∇f Xt − ∇f Xkh 2 dt EΠT exp ≤ 1 h ) 1 − + N k ( kh 4q2 γ ∫ EΠT exp max 0,1,...,N k ∑k 0 = = = EΠT exp max 0,1,...,N k { N 1 p / max 0,1,...,N 1 − k = { ≤ ≤ ≤ ∥ 1 − ) ( sup k ( + kh, t ∈[ 1 h ) ] sup k ( + 1 h ) ] 1 − kh, t ∈[ EΠT exp )∥ 4β2q2T ( γ Xt − Xkh 2 ∥ 4β2pq2T γ ∥ Xt − Xkh 1 p / 2 ∥ 4β2pq2T γ } ∥ Xt − Xkh 2 1 p / . sup k ( + kh, t ∈[ 1 h ) ] By conditioning on Xkh, Ykh ∥ and applying Proposition C.1, this is bounded by } ∥ N 1 p / ⋯ ≤ k = { provided that h ≲ bounds for ( max 0,1,...,N 1 − ) EΠT exp O β2pq2T γ β2h4 Xkh − x∗ 2 + h2 Ykh 2 + γdh3 1 p / ( β2/3d1/3p1/3q2/3T 1/3 . We choose p ( ( 1 ∥ ∥ log N so that N 1 p / ∥ )))} 1. We now need tail ∥ ≍ Ykh Using the argument in the proof of Lemma 4.7, for c Xkh − x∗ and . ≍ ( ∥ ∥ ) exp ( EΠT exp [∥ 0, > EΠT exp Xkh − x∗ 2 2 ∥ Xkh − x∗ ]) (∥ ( ∥ ∥ 2c EΠT 2cd α exp ( O cd ) ( α ≤ ≤ ≤ Xkh − x∗ 2 36c ∥ α / ∥) ) Xkh − x∗ Xkh − x∗ ∥ − EΠT 2 ∥ ∥) )) 2c − EΠT ( (∥ α 36 / EΠT exp c ∥ ∥ Xkh − x∗ 2 ∥ exp 12 This argument avoids the use of the "conditioning lemma" from [GT20] (Lemma 23 in [Zha+23]). ( ( )) 38 provided that c α 36. Therefore, ≤ / EΠT exp O β4h4q2T log N γ Xkh − x∗ 2 exp O ≤ β4dh4q2T log N αγ provided that h ≲ 1/4 . ) The same argument applied to βq1/2 ( ( α1/4γ1/4 T log N ( ∥ ∥ )) ( ( )) Ykh yields EΠT exp O β2h2q2T log N ∥ γ ∥ 2 Ykh exp O ≤ β2dh2q2T log N γ provided that h ≲ βq ( γ1/2 T log N ( ) ( 1/2 . ∥ ∥ )) ( ( )) If we put these bounds together and take γ β, we deduce that if h ≲ √ ≍ βd1/3q γ1/2 T log N ( 1/2 and ) T ≳ √β α , then it holds that EΠT exp 1 h ) + N 1 − ∑k 0 = 4q2 γ ∫ k ( kh ∇f Xt − ∇f Xkh 2 dt ≤ exp O 2dh2q2T log N β3 / . This verifies (C.1) and (C.2), and moreover shows that for h ≲ ∥ ( ) ( )∥ ( ( β3/4d1/2q 1 T log N ( 1/2 , ) )) sup 0,T t ∈[ ] EΠT exp 2qMt ≲ 1 . ( ) Bounding the second term. Next, EΠT ∇f Xt − ∇f Xkh 4 [∥ Applying Proposition C.1 and the above tail estimates, )∥ ) ( ( ] √ ≤ β2 EΠT Xt − Xkh 4 . √ [∥ ∥ ] ⋯ ≲ β2 EΠT β2h4 Xkh − x∗ 2 + h2 Ykh 2 + γdh3 ≲ β4dh4 α + β2dh2 + β2γdh3 ≲ β2dh2 . ∥ Concluding the proof of Lemma 4.8. ∥ ∥ [ ∥ ] In summary, we have shown Hence, by definition of the R ́enyi divergence, we conclude that EΠT ΠT d dΠT ̂ [( ) ] q − 1 ≲ β2dh2q2T γ . ΠT q ΠT ≲ β2dh2qT γ . R D Deferred details for §5 ( ̂ ∥ ) D.1 Background on the Metropolis-Adjusted Langevin Algorithm −f be a target probability distribution on Rd, and let Q be a proposal kernel (that Let π ∝ exp is, a Markov transition kernel). Then, the Metropolis-adjusted algorithm with proposal Q is the ( following Markov chain 0, 1, 2, . . . , N: for n Xn ) n ∈ = ( ) 39 1. Propose a new point Yn ∼ Q Xn, ⋅ ; Yn 2. Accept the new point with probability 1∧ π ( ) Xn π ) ( Xn. we set Xn ) ( Yn,Xn Q ) ( Xn,Yn Q ) ( 1 ∶ + = Yn, otherwise we set Xn 1 ∶ + = It can be shown that under mild conditions on the proposal Q, the resulting Metropolis-adjusted algorithm is a reversible Markov chain with stationary distribution π. Since Markov chains often exhibit geometrically ergodicity, the family of Metropolis-adjusted chains is often used to design high-accuracy samplers. . That is, if the proposal is accepted, In this work, we are primarily considered with the Metropolis-adjusted Langevin algorithm, in which the proposal kernel is taken to be one step of the discretized Langevin algorithm, i.e., Q x, ⋅ ∶ = x − h ∇f x , 2hId . ) ( ( ) ) N ( For this choice of proposal kernel, generating a proposal and computing the acceptance ratio can be carried out with a constant number of evaluations of f (zeroth-order queries) and ∇f (first-order queries). Actually, in order for the mixing time results we invoke to be valid, we must instead 2 -lazy version of the chain, in which each proposal is discarded with probability 1 consider the 1 2 . Since this only affects the mixing time bounds by a factor of 2, we henceforth ignore this distinction. The Metropolis-adjusted Langevin algorithm (MALA) has been studied for nearly three decades since [Bes+95], especially within an asymptotic framework; see, e.g., the influential work of [RR98]. By way of contrast, the non-asymptotic study of the complexity of MALA over the class of strongly log-concave and log-smooth targets is relatively recent. Through the work of [Dwi+18; Che+20; LST20; Che+21; LST21a; WSC22], we now know that when initialized at a suitable (and com- putable) Gaussian initialization, MALA outputs a sample whose law is ε-close to π in total varia- κd polylog O ε tion distance using queries, and when initialized at a warm start the complexity 2 polylog κd1 ε ; moreover, these rates are tight due to matching lower bounds. improves to / ̃ / ( See Table 1 and the prior works section §1.3 for more discussion. )) )) O ̃ 1 1 ( ( ( / D.2 Background on the proximal sampler The next component of our combined high-accuracy sampler (Theorem 5.1) is the proximal sampler, first proposed in [TP18; LST21b]. In this algorithm, we first augment the target distribution π to a joint distribution π on Rd × Rd via π x, y ∝ exp −f x − 1 2h x − y 2 . ( Next, we perform Gibbs sampling on the augmented target; namely, we alternate between the following steps. ( ) ∥ ∥ ) ) ( • Forwards step (convolution): Sample Yk Xk ∼ πY ∣ X ⋅ Xk • Backwards step (RGO): Sample Xk Yk ∼ πX ∣ ∣ Y ⋅ Yk ( ∣ . 1 + Xk, hId . = ) N ( ) The backwards step is known as the restricted Gaussian oracle (RGO), and any successful use of the proximal sampler hinges upon an efficient implementation of the RGO. ( ) ∣ ∣ Just as the Langevin diffusion is recognized as the Wasserstein gradient flow of the KL diver- gence w.r.t. π, thanks to the seminal result of [JKO98], the proximal sampler admits an appealing interpretation as a proximal discretization of that same gradient flow. Indeed, the RGO can be interpreted as the proximal operator for the KL divergence over the Wasserstein space, evaluated 40 at a Dirac measure; moreover, the convergence rates established for the proximal sampler exactly match the classical rates for the proximal point method (PPM) in Euclidean space, a fact which led to a new sharp analysis of the PPM under a Polyak– Lojasiewicz inequality. For this and further discussion, we refer to [Che+22a]. From an algorithmic standpoint, we are interested in two key features of the proximal sampler: (1) the proximal reduction framework which allows us to boost the condition number dependence of any high-accuracy sampler to near-linear [LST21b], and (2) its uses for sampling beyond strong log-concavity [Che+22a]. ( ) ε 1 1 O 1 αh log iterations. This is at most , as soon as the step size h is taken to be h ≲ 1 Boosting the condition number dependence of any high-accuracy sampler to near- linear. When f is β-smooth, then one can check that the RGO is strongly log-concave and β. This log-smooth, with condition number O observation was the starting point of [LST21b], who used the proximal sampler to great effect as a proximal reduction framework. Namely, they showed that when π is α-strongly log-concave, the proximal sampler (with perfect implementation of the RGO), outputs a sample whose law is ε-close in total variation to π in when we take h ≍ 1 β. Moreover, they showed that when the RGO is only implemented approximately, then the additional TV error incurred can be tracked and controlled, provided that the RGO is implemented via a high-accuracy sampler, such as MALA. Hence, the original problem of sampling from the distribution π with condition number κ is reduced to solving subproblems, each 1 with condition number O In particular, when passed through this reduc- ( tion framework, the condition number dependence of any high-accuracy sampler is automatically boosted to near-linear in κ. We take advantage of this framework in passing from the weak ver- sion of Theorem 5.1 to the full version. (Although one important difference is that we improve this reduction framework to control the error propagation from approximate RGO implementation in each iteration, in order to obtain final guarantees in metrics stronger than TV, namely R ́enyi divergence.) , to high accuracy. κ polylog κ log )) )) )) O O ̃ ̃ ̃ 1 1 ε ε ( ( ( ( ( ) ( / / / / / Reducing sampling in general settings to the strongly-log-concave setting. The other virtue of the proximal sampler exploited in this work is its application to sampling beyond the strongly log-concave setting, as was put forth in [Che+22a]. In this paper, the authors analyzed the outer loop complexity of the proximal sampler under weak log-concavity and under a variety of standard isoperimetric assumptions (e.g., the log-Sobolev or Poincar ́e inequality). In all of these cases, however, as soon as f is β-smooth, the approximate implementation of the RGO can be handled, as before, by a high-accuracy sampler for strongly log-concave and log-smooth distributions. Hence, the results of [Che+22a] effectively reduce the problem of sampling from each of the aforementioned classes of distributions to the problem of high-accuracy strongly log-concave and log-smooth sampling. They used this reduction to provide new state-of-the-art guarantees for sampling from these classes, and in §5.2 we leverage our faster implementation of the RGO to improve each of their complexity bounds by a factor of d. D.3 Weak version of Theorem 5.1 √ Here, we show the following weaker version of Theorem 5.1 as it provides the key building block to prove it. Like Theorem 5.1, this result here shows that from a feasible start, the query complexity of high-accuracy sampling from a strongly-log-concave distribution scales in the dimension d as O . The difference from Theorem 5.1 is that the weaker result here has a suboptimal dependence on the condition number κ, namely . This ̃ rather than rather than 2 κ3 / 2 d1 / O O O ̃ κ d ( ) ( ) 41 ̃ ( ) ̃ ( ) dependence will later be boosted using the proximal sampler in §D.4, allowing us to prove the full Theorem 5.1. Theorem D.1 (Weak version of Theorem 5.1). Suppose that π ∝ exp where f is α-strongly- convex and β-smooth. Let x∗ denote the minimizer of f . For any sampling error ε > 0 and any initialization distribution δx0 ∈ , there is an algorithm that uses −f Rd ( ) ε for any μ π ⩽ ( ∥ ) O 2 log 2d1 κ3 / / ) P( x0 − x∗ 2 log3 + κd1 / 1 ε N = first-order queries for f to output a random point in Rd with law μ satisfying d of the following metrics: )) ∥) (∥ ̃ ( ( / TV, KL, χ2, α W2 . d ∈ { √ √ Remark D.2 (Handling other metrics). To prove convergence in the various metrics, due to standard comparison inequalities it usually suffices to prove a convergence result in the strongest metric, namely, the chi-squared divergence. Indeed, convergence in the KL divergence follows from the monotonicity of R ́enyi divergences (Lemma 2.4) and convergence in the TV distance follows from Pinsker's inequality. If π satisfies an LSI, then convergence in W2 follows from Talagrand's T2 inequality (Lemma A.6); otherwise, if π only satisfies a PI, then convergence in W2 follows from the quadratic transport-variance inequality (Lemma A.7). √ } The proof has three steps: 1. Run ULMC from this arbitrary initialization δx0 to obtain a 3 warm start (which also implies a χ2 warm start). R 2. Use the χ2 warm start to argue that MALA mixes rapidly in TV. 3. Use the 3 warm start to argue that the TV mixing guarantee implies mixing guarantees in χ2 (and therefore also the other desired metrics by Remark D.2). R Our main technical contribution here is the ability to implement step 1 in queries-this is an immediate application of our result on ULMC (Theorem 4.1). Step 2 follows from known results about MALA [Che+22a; WSC22], with only minor modification as described below, and step 3 follows from the helper Lemma 5.2. ̃ ) ( O 2 d1 / The rest of this Appendix section is organized as follows. Step 2 is described in §D.3.1, step 3 is proved in §D.3.2, and then we combine these to prove Theorem D.1 in §D.3.3. D.3.1 Rapid mixing of MALA from a R ́enyi warm start We first formally state the result in step 2, namely, that MALA mixes rapidly in TV from a χ2 warm start. This is [WSC22, Theorem 1], except with a less stringent assumption on the initialization μ0. Specifically, [WSC22, Theorem 1] assumes that μ0 is an M -warm start with respect to the log M ), whereas the following lemma only assumes that target π (or equivalently, μ0 has bounded χ2 (or equivalently, bounded 2) distance to π. This requires only very minor modification to their analysis, but is essential for our purposes, since our result in §4 can only R produce warm starts in R ́enyi divergences of finite order. μ0 R π ≤ ∞ ( ∥ ) Theorem D.3 (Runtime of MALA from warm start; implicit from [WSC22]). Let π ∝ exp where f is α-strongly-convex and β-smooth. For any error ε with appropriate step size requires −f 2-lazy MALA algorithm ) , the 1 0, 1 ( ∈ ( ) / π O 2 log3 κd1 / N = ̃ ( ( 42 χ2 μ0 ε2 ( ∥ ) )) first-order queries to f to output a random point in Rd whose law μN satisfies TV μN , π ε. ⩽ Proof. We first recall the proof of [WSC22, Theorem 1]. The majority of their analysis is to bound the s-conductance Φs. They then appeal to the classical result [LS93, Corollary 1.6], which states ) ( μN − π TV Hs + ⩽ Hs s N Φ2 s/ 2 , e− (D.1) μ0 sup where Hs ∶ A = respect to π is that Hs ) ( the TV error is at most ε if they set s = equation (39)] on Φs finishes their proof. A {∣ )∣ ⩽ ) ( ( A ∥ ∶ π − π . A consequence of μ0 being an M -warm start with M s. By plugging this into the right hand side of (D.1), they conclude that ε . Plugging in their bound [WSC22, ∥ s ⩽ ε 2M and N log 2M } 2 Φ2 s ⩾ The proof here differs only in that we bound the right hand side of (D.1) by using the χ2 warm start. Specifically, observe that for any set A, the Cauchy–Schwarz inequality implies μ0 A − π A = ∣ ∫ )∣ ) ∣ It follows that Hs ⩽ √ ( ( 1A dμ0 dπ − 1 dπ ⩽ √ ∫ 1A dπ ⋅ ∫ − 1 2 dπ dμ0 dπ π = √ A χ2 μ0 π . s χ2 ( μ0 π ) ∣ , and thus we obtain the following modified version of (D.1): ( ) ( ) ( ∥ ) ∥ ( μN − π ) TV s χ2 χ2 μ0 π + √ μ0 s ⩽ √ ( and N Thus the TV error is at most ε if we set s bound [WSC22, equation (39)] on Φs completes the proof.13 ) ε2 μ0 ( ∥ 4χ2 π ∥ = ( ∥ ∥ ) ∥ = π N Φ2 s/ 2 . e− (D.2) ) log 2 Φ2 s 8χ2 μ0 ( ε2 π ∥ ) . Plugging in their ( ) D.3.2 Proof of Lemma 5.2 By the stationarity property of P and the data-processing inequality for R ́enyi divergences (Lemma 2.3), π we have ⩽ = inequality holds for any distributions μ, π: . It now suffices to argue that the following μ0P n πP n μn μ0 π 3 3 3 R ( ∥ ) R ( χ2 ∥ μ π ) TV R ( μ, π ∥ ⋅ ) ⩽ √ ∥ To prove (D.3), we use the Cauchy–Schwarz inequality to bound R ( ) ( ( ( ∥ ) ( )) ) exp 2 μ 3 π + 1 . (D.3) χ2 μ π 2 − 1 dπ dμ dπ = ∫ The first integral is precisely TV = ∫ ) ∥ ( ∣ ∣ ∣ μ, π 2 1 / − 1 dμ dπ dμ dπ 2 3 / dπ − 1 dμ dπ − 1 dπ ⋅ ∫ 3 − 1 dπ . dμ dπ ⩽ √ ∫ ∣ ∣ . The second integral can be bounded by ∣ ∣ ∣ ∣ 3 ( dπ − 1 dμ dπ ) ⩽ ∫ 3 dμ dπ dπ + 1 = ∫ exp 2 μ 3 π + 1 , where above, the first step is by the elementary inequality 0; and the second inequality is by the definition of R ́enyi divergence. This completes the proof of (D.3) and thus also the proof of the lemma. ⩽ ⩾ ∣ ∣ ( R a − 1 ( 3 )) ∥ a3 + 1, which holds for all a ∣ ∣ ∣ ∣ ∣ 13 In fact, one can simply set M = 2χ2 (μ0 ∥ π)/ε in their final bounds to obtain Theorem D.3. 43 D.3.3 Proof of Theorem D.1 By Theorem 4.1-or rather the extension in Remark 4.2 to arbitrary initial distributions-ULMC outputs a distribution ν satisfying log 2, say, using π ν 3 ⩽ 2 log 2d1 κ3 ) ∥ / / R O ( x0 − x∗ gradient queries, where δx0 is its initial distribution. By monotonicity of R ́enyi divergences (Lemma 2.4) ∥ and the identity between χ2 and = 1, so ν is a warm start in χ2 divergence. Thus we − 1 exp may invoke Theorem D.3 to run MALA from initialization ν in order to produce a distribution μ ( satisfying TV ̃ ( 2 (Remark 2.2), this ULMC guarantee implies χ2 − 1 π R )) ( 5, say, using )) μ, π exp (R (R ε4 ∥) π π ⩽ ⩽ ν ν ν ∥ ( ) ∥ ∥ 2 3 ⩽ ( ) / O 2 log3 κd1 / 1 ε first-order queries. Now by Lemma 5.2, we can use the warm start property of ν to boost the TV guarantee on MALA's output μ to the following χ2 guarantee: )) ( ( / ̃ χ2 μ π TV ⩽ √ μ, π ⋅ exp 2 ν 3 π + 1 ε2 . ⩽ This implies the desired χ2 mixing bound. Mixing in the other metrics then follows from Re- ( mark D.2. )) R ) ) ∥ ) ( ( ( ( ∥ D.4 Proof of Theorems 5.1 and 5.3 Here we prove our main results about faster high-accuracy sampling algorithms in the setting that the target distribution π is strongly-log-concave (Theorem 5.1) or satisfies a log-Sobolev inequality (Theorem 5.3). Since our analysis only relies upon the LSI property, we are able to prove both theorems simultaneously. (Indeed, recall that strong-log-concavity implies a log-Sobolev inequality by the Bakry– ́Emery theorem, see the first part of Lemma A.3). See §5.2 for a high-level overview of the algorithm and analysis. We begin with a helper lemma, which is similar to the Orlicz–Wasserstein initialization bound that is used for π in Lemma 4.7, but now generalized to the RGO πX in the backwards step of the proximal sampler. −f − 1 2h y ∝ exp ⋅ −y Y = 2 ∣ Lemma D.4 (Orlicz–Wasserstein distance at initialization of RGO step). Suppose that π ∝ Rd and any exp proximal step size h where f is β-smooth. Let x∗ denote the mode of π. Then for any y −f 2β 1 ∈ , ( ∥ ∥ ) ( ) ⩽ /( ) Wψ2 δy, πX ∣ Y y = ≤ 9 √ dh + 3βh y − x∗ . Proof. Let xy denote the mode of πX ( ∣ Y = y. By the triangle inequality, ∥ ) ∥ Wψ2 Y πX ∣ y, δy = ⩽ Wψ2 Y πX ∣ y, δxy = + Wψ2 δxy , δy . ) The former term is bounded above by 9 that πX = bound the latter term −f − 1 2h y ∝ exp ⋅ −y ( Y 2 ∣ ( ∥ ∥ ) Wψ2 ( ) is strongly-log-concave with parameter −β + 1 h dh by an application of Lemma 4.7 and the observation 1 2h . Next, we √ ( ) ⩾ δxy , δy = xy − y ψ2 ( ) ∥ ∥ 44 . xy − y log 2 ∥ ∥ √ = y, it is the minimizer of the convex log-density, thus by first-order . By rearranging this identity, using the Since xy is the mode of πX xy − y optimality conditions we have 0 smoothness of f , and then using the triangle inequality, ) + 1 h ∇f xy = ) Y = ∣ ( x∗ ( βh xy − x∗ xy − y h ∇f xy − ∇f = Now by the assumption on the step size, βh )∥ ∥ ( ( ) ∥ ∥ βh xy − y + y − x∗ . ⩽ 1 2. Plugging this in and re-arranging yields ∥ (∥ ∥) ∥ ∥ ∥ ⩽ ⩽ ⩽ ∥ xy − y 2βh / y − x∗ . Combining the above displays completes the proof. ∥ ∥ ∥ Armed with this initialization lemma, we are now ready to prove the main results of this section. Proof of Theorems 5.1 and 5.3. Recall from the discussion at the beginning of this subsection that it suffices to prove Theorem 5.3. Hence, in this proof we assume that π is 1 α-LSI but do not necessarily assume that it is α-strongly-log-concave. We prove the mixing time for the χ2 divergence, which suffices by Remark D.2. / First, suppose that the RGO in the proximal sampler algorithm is implemented exactly. Let Xn and Yn denote the proximal sampler iterates at iteration n; and let μX n and μY n denote their respective laws. Then after initializing at μX 0 ∶ 2β , the laws of the iterates are given = μY by μY ⋅ y . By analyzing the simultaneous heat flow, n n N ( it was shown in [Che+22a, Appendix A.4] that the forwards step of the proximal algorithm is a ) contraction in R ́enyi divergence, in the sense that x∗, dy ( ) , and μX n + μX n ∗ 0, hId 1Id − = ∫ πX N ( = ) ) ) ( ( Y 1 ∣ ∣ μY n q πY 1 1 + αh 1 q / ⩽ μX n q πX . (D.4) R Now suppose that we have oracle access to an approximate RGO in the sense that given any ) Rd, we can sample from a distribution ̃πX Y ∣ ) y that satisfies R ( ) ( ∥ ( ∥ point y ∈ Y ̃πX ∣ y = q Y πX ∣ = ε2 RGO , = y ⩽ first-order queries to f . Let ̃Xn, ̃Yn denote the iterates with inexact implementation R ∥ ) ( n , ̃μY n denote their laws respectively. We can bound the error of a backwards step using this approximate RGO as follows. Let using NRGO y of the RGO, and let ̃μX ( ) n , so that ̃Xn ̃Yn ∼ ̃μY 1 is a sample from the approximate RGO ̃πX + Y ∣ = ̃Yn. Then q ̃μX n + 1 πX R ( ∥ ) ⩽ ⩽ law ̃μY n ( ̃Xn πY ( q q R ⩽ R ( ̃μY n q ∥ πY π 1, ̃Yn + + sup ) ∥ Rd yn ∈ + ε2 R RGO . ) q ) Y ̃πX ∣ yn = Y πX ∣ yn = ( ∥ ) (D.6) Above, the first step is by the data-processing inequality for R ́enyi divergences (Lemma 2.3); the ) second step is by the "strong composition rule" for R ́enyi differential privacy (this lemma has appeared in many equivalent forms, see, e.g., [Aba+16a; DR16; Mir17]; here we apply the version from [AT22a, Lemma 2.9]); and the final step is by the guarantee (D.5) of the approximate RGO. By combining the error bounds (D.4) and (D.6) for the forward step and approximate backwards R ( ∥ step of the proximal sampler, we conclude the one-iteration bound q ̃μX n + 1 πX ⩽ 1 1 + αh 1 q / ̃μX n q πX + ε2 RGO . (D.7) R ( ∥ ) R ( ∥ ) ( ) 45 (D.5) Iterating this bound Nprox times gives the following R ́enyi divergence bound on the mixing error of the proximal sampler when using this approximate RGO: ̃μX Nprox q πX ⩽ 1 1 + αh Nprox q / μX 0 q πX + ε2 RGO Nprox 1 − ∑n 0 = 1 1 + αh . n q / (D.8) This error is at most ε2 if we run the proximal sampler with step size h ≍ 1 ( β for ) ) ( R ( ∥ ) R ( ∥ ) iterations and perform each approximate RGO to accuracy Nprox ≍ κq log q μX 0 ε2 R ( ∥ ) πX / εRGO ≍ ε κq . (D.9) Henceforth, consider q 1 2β = 2, so that 2 ⩽ , say, then the RGO is strongly-log-concave and has condition number of size at most √ χ2 (see Remark 2.2). Observe that if the step size h < /( ) R β + 1 −β + 1 / / h h = 1 + βh 1 − βh = Θ 1 . ( ) We next consider the complexity of implementing the RGO. If, as we have assumed in §5, we ̃Yn Y can compute the proximal operator for hf exactly, then we can compute the mode x . Otherwise, we initialize at νn δx and initialize at νn = can implement the approximate RGO ̃πX Y queries, where ( ̃Yn in the n-th iteration by using NRGO ̃Yn ( δ ̃Yn = = ) ∣ . In either case, by Theorem D.1, we NRGO ̃Yn = O 2 log3 d1 / ( , πX Y ) = ̃Yn ̃ ( ≲ Wψ2 νn, πX εRGO ( ( ̃Yn Y ∣ = . ) Y )) ̃Yn = By Lemma D.4, Wψ2 In the former case, we conclude that the total number of gradient queries required by this inexact proximal sampler algorithm is β and Wψ2 ̃Yn ( δ ̃Yn δx √ √ d d ( ( ∥ ) ∥ ) / / . ) ∣ ∣ β + ̃Yn − x∗ , πX ≲ ̃Yn of πX ∣ = ) ̃Yn first-order ( ) (D.10) N = Nprox 1 − ∑n 0 = NRGO ̃Yn = O 2 log κd1 / ( Otherwise, the number of gradient queries is ) ( ̃ πX 2 μX 0 ε2 ( ∥ log3 1 ε . ( )) ) ) R ( N Nprox 1 − = ∑n 0 = NRGO ̃Yn = O 2 log κd1 / ( ) ̃ ( 2 μX 0 ε2 ( R ( πX maxn log3 ∥ ) ) ( = 0,1,...,Nprox ε 1 − ̃Yn − x∗ ∥ ∥ )) The latter expression will be made more explicit in Appendix D.7, and upon doing so it leads to the final statement of Theorem 5.1. D.5 Proof of Theorem 5.4 We prove the χ2 mixing bound; the other desired mixing bounds then follow immediately due to standard comparison inequalities (see Remark D.2). We consider the same inexact RGO algorithm as in the LSI setting (see Appendix D.4). Under the present Poincar ́e assumption, the forwards step 46 (D.11) . (D.12) of the proximal algorithm is known to be a contraction in χ2-in direct analog to (D.4). Specifically, by analyzing the simultaneous heat flow, it was shown in [Che+22a, Appendix A.4] that χ2 μY n πY 1 1 + αh ⩽ χ2 μX n πX . (D.13) The bound (D.6) on the error of a backwards step of the proximal sampler using an approximate RGO (D.5) remains unchanged (as it never uses the LSI assumption). This R ́enyi bound is equiv- alent to the χ2 bound ( ∥ ) ( ) ∥ χ2 πX 1 ̃μX n + 1 + χ2 ∥ eε2 RGO χ2 ̃μY n πY , ⩽ (D.14) by using the relationship between the chi-squared and R ́enyi divergences (see ) Remark 2.2). By combining the above two displays, we obtain the following convergence bound for ( one full step of the proximal sampler: log ( R = ( ∥ ) ) 2 ⩽ if we solve each approximate RGO to accuracy ( ∥ ) χ2 ̃μX n + 1 πX Θ e− αh ( ) χ2 ̃μX n πX , ( ∥ ) By iterating this one-step bound (D.15), we conclude that the final mixing error χ2 this inexact proximal sampler is at most ε2 if it is run for Nprox iterations, where εRGO ≲ αh √ 1 κ . ≍ √ (D.15) (D.16) ̃μX Nprox πX of ( ∥ ) χ2 κ log Nprox ≍ πX . μX 0 ε2 ∥ Y ( Now by the same argument as the LSI setting (see Appendix D.4), by the choice of the proximal , and thus can be implemented using is the quantity in (D.10). Therefore step size h, the RGO ̃πX NRGO the total number of gradient queries required by this inexact proximal sampler algorithm is ̃Yn has condition number Θ gradient queries by Theorem D.1, where NRGO ( ( ) log3 2 log κd1 / 1 ̃Yn ) πX ̃Yn Nprox χ2 NRGO ̃Yn N O ) ( ) ( ) − = 1 ∣ max 0,1,...,Nprox 1 − ̃Yn − x∗ . (D.17) n = μX 0 ε2 ∥ ∑n 0 = = The term log3 maxn hf ; otherwise, it is made more explicit in Appendix D.7. ) 0,1,...,Nprox ̃Yn − x∗ ̃ ( 1 = ) ( ( − = ( vanishes if we have access to the proximal operator for ∥) ) ∥ ∥ D.6 Proof of Theorem 5.6 ∥ The proof for the weakly convex case is similar to the proofs of Theorems 5.1, 5.3, and 5.4, in that we carefully keep track of the error from inexact implementation of the RGO, but the proof requires key modifications. It was shown in [Che+22a, Appendix A.3] that along the simultaneous heat flow, 1 μY n KL πY KL ≥ 1 μX n πX + 2W 2 2 h μX n , πX . Let us assume that the RGO is implemented inexactly, so that for each y ) ̃πX y satisfying ( ∥ ( ) ∥ ( ) Y ∣ = (D.18) Rd we sample from ∈ KL Y ̃πX ∣ y = Y πX ∣ y = ( ∥ ≤ ) ε2 RGO , W2 Y ̃πX ∣ y, πX ∣ Y y = = ( 47 2β εRGO . ≤ √ ) (D.19) = In fact, the second guarantee follows from the first together with Talagrand's T2 inequality (see Lemma A.6) if we choose step size h 1 2β , because the RGO is then β-strongly log-concave. By applying (D.6) for the proximal sampler with inexact RGO implementation, convexity of the map x ↦ 1 x, and (D.18), we deduce that KL 1 ̃μX n + 1 / πX KL ̃μY n ≥ 1 πY ( ∥ ) ( ∥ ) + ε2 RGO ≥ KL KL ≥ 1 ̃μY n 1 ( ̃μX n − KL πY ε2 RGO ̃μY n πY 2 ∥ ) πX + ( 2W 2 2 h ∥ ) n , πX ̃μX − KL ε2 RGO ̃μY n πY 2 . (D.20) We now split into two cases. In the first case, suppose that KL ∥ εRGO for some 0, 1, . . . , Nprox −1. By repeatedly applying (D.6) and the data-processing inequality (Lemma 2.3), ̃μY ) n πY ≤ ) ∥ ( ) ( ( ( ∥ ) √ n we obtain = KL ̃μX Nprox πX ( ∥ ) ≤ ≤ ≤ KL ̃μY Nprox ̃μX KL Nprox ( ̃μY KL n ( 1 − 1 − πY ∥ ∥ RGO + ε2 πY + ε2 πX ) + Nprox ε2 ) RGO ≤ RGO ≤ ⋯ εRGO + Nprox ε2 RGO . √ εRGO for all n 0, 1, . . . , Nprox − 1. Then, = For the other case, suppose that KL ( ̃μY ∥ n ) πY from (D.20), we have ( πX KL ≥ ∥ 1 ̃μX n KL 1 ̃μX n + 1 ≥ ) √ πX + 2W 2 2 h ̃μX n , πX − εRGO . Iterating this, ( ∥ ) ( ∥ ) ( ) 1 KL ̃μX Nprox πX KL ≥ 1 μX 0 + h 2 πX Nprox 1 − ∑n 0 = 1 ̃μX n , πX W 2 2 − Nprox εRGO . Moreover, from the second condition in (D.19), a standard coupling argument (see, e.g., [Che+22a, Appendix A.2]), and Wasserstein contractivity of the exact proximal sampler steps under log- concavity [Che+22a, Theorem 1], we obtain ( ∥ ) ( ∥ ) ) ( W2 1, πX ̃μX n + ≤ W2 ( ) Therefore, we obtain ≤ √ ≤ √ ≤ √ ∣ Y ∫ dy πX ̃μX 1, n + 2β εRGO + W2 ( 2β εRGO + W2 2β Nprox εRGO + W2 y ̃μY n = n , πY ̃μY )) n , πX ̃μX ⋯ ) ( ≤ 0 , πX μX ) ( ( Y πX ∣ y ̃μY n = dy , πX ( ) ) + W2 ∫ ( . ( ) 1 KL ̃μX Nprox πX KL ≥ 1 μX 0 + πX 2 W2 μX 0 , πX Nprox h + 2β Nprox εRGO − Nprox εRGO . 2 ( Let us assume that εRGO ≲ W2 ( ) ∥ ∥ 0 , πX μX ) β Nprox ( ( √ and εRGO ≲ h ) W2 0 , πX μX ) . This reads 1 ( ̃μX Nprox πX KL √ KL )/( ≥ 1 μX 0 ) πX + Ω Nprox h / ( μX 0 , πX 2W 2 2 ) . ( ∥ ) ( ) ∥ 48 ( ( ) ) Upon rearranging this and taking h 1 2β , it implies = KL ̃μX Nprox πX ≲ βW 2 2 0 , πX μX Nprox ( . ) Therefore, we obtain KL ̃μX Nprox ( πX ≤ ∥ ) ε2 if we take ( ∥ ) βW 2 2 Nprox ≍ 0 , πX μX ε2 ( . ) To summarize, after considering both cases, we obtain KL ̃μX Nprox πX ≤ ε2 if we take Nprox d + βm2 ε2 ≍ and εRGO ≲ min ε4, ε4 μX 0 , πX , ∥ ) ( ε2 μX 2W2 β3 0 , πX / , 1 μX 0 , πX βW2 βW 2 2 By invoking Theorem D.1, the total number of first-order queries is ( ) ( { ) ( . } ) The term log3 maxn hf ; otherwise, it is made more explicit in Appendix D.7. − = 1 vanishes if we have access to the proximal operator for 0 , πX μX N O = ̃ ( 0,1,...,Nprox 2 W 2 βd1 / 2 ε2 ( ̃Yn − x∗ ∥ ∥ log3 max 0,1,...,Nprox 1 − n = ) ̃Yn − x∗ . ∥ ∥) D.7 Explicit bounds Here, we make the statements of the results in §5.2 more explicit by bounding the initialization quantities in terms of other, more easily computable problem parameters. Moreover, we carry through the analysis without assuming access to a prox oracle for hf . To do so, we instead assume that the algorithm has access to a stationary point x∗ of f , which Eπ . Our − min f , and we will provide is realistic even for the non-convex potentials considered in §5.2, and we let m ∶ = bounds will depend on m as well as on the objective gap ∆ ∶ = comments on these assumptions after stating the results. ⋅ − x∗ x∗ f ∥ ∥ We remark that these explicit bounds also involve randomized runtimes. The reason for this is that in each iteration of the proximal sampler, the implementation of the RGO takes a number of queries which depends on the size of the proximal sampler iterate; in turn, this is a random quantity. ( ) D.7.1 Initialization We make use of the following R ́enyi divergence bound at initialization when using a Gaussian "feasible start". This bound is imported from [Che+22b, Lemma 30]14 and can be thought of as a tighter, more explicit version of [VW19, Lemma 4]. Observe that this lemma does not require convexity of the potential f , which makes it applicable to the LSI and PI settings in §5. If f is assumed convex, then every stationary point x0 is a minimizer of f , hence the upper bound improves since f − min f vanishes. x0 14 Their lemma has an extra β because it is written for the general setting of any H ̈older smoothness exponent s. Lemma D.5 is obtained by setting s = 1, in which case the extra β trivially drops in the second line of their proof. ( ) 49 Lemma D.5 (R ́enyi divergence bound from Gaussian initialization). Suppose π ∝ exp f is β-smooth. Denote m dπ. For any stationary point x0 of f , ⋅ = ∫ ∥ x0, ∞ ∥ 2β 1Id − π ⩽ 2 + f x0 − min f + log 2βm2 . d 2 ( ) R In particular, if f is also convex, then (N ( ( ) ) ∥ ) ( ) −f where ( ) (N ( D.7.2 Bounding the size of the proximal sampler iterates ) ∥ R ) ( ( ) ) ∞ x0, 2β 1Id − π 2 + log 2βm2 . ⩽ In our high-accuracy sampling results in §D.7.3, the algorithm runtimes will be random because they depend on the largest size maxn of the iterates of the proximal sampler. 1 The following lemma provides a general bound on this quantity to ensure that the runtime of the ∥ overall randomized algorithm is typically small. Since the final dependence on this quantity is only polylogarithmic, we will only focus on obtaining crude polynomial bounds. ̃Yn − x∗ 0,1,...,Nprox ∥ − = Lemma D.6 (Size of the proximal sampler iterates). Suppose that we run the proximal sam- pler algorithm for Nprox iterations with inexact implementation of the RGO. Namely, for n and ̃Xn 0, 1, . . . , Nprox − 1, we set ̃Yn ∼ Y satisfies ̃Yn, where for each y ∈ Rd, ̃πX 1 ∼ ̃πX + ̃Xn, hId = y = Y = ∣ ∣ N ( ) Y ̃πX ∣ 2 y = Y πX ∣ y = ≤ ε2 RGO . −f Assume that the target π ∝ exp R ( 0, 1 ( . Then, for δ that m ∶ = ⋅ − x∗ Eπ ∈ ∥ n ∥ max 0,1,...,Nprox 1 − ̃Yn − x∗ ( ) poly ≤ ∥ satisfies 1 α-PI, that x∗ is a stationary point of f , and ) , with probability at least 1 − δ, it holds that ) / εRGO, CPI, Nprox, d, h, m, μX 0 3 πX , log 1 δ . = Proof. Let ̃μX n ∶ . Let = Xn, Yn denote the iterates of the proximal sampler with exact RGO implementation at iteration ) n, with respective laws μX 2 and λ n . By the weak triangle inequality (Lemma 2.7) with q 4, together with the data-processing inequality (Lemma 2.3), . We first give a crude bound on ∥ and ̃μY n ∶ = ) n , μY ( law ∥ Xn ) ̃μY n ∥ = law 2 3 / πY Yn R R 3 3 ( ( ) ) ( ∥ ( = / / ̃μY n πY 2 3 / R ( ∥ ) 3 2 3 2 ≤ ≤ ̃μY n 2 μY n + μY n 3 πY R ̃μY ( n 2 ∥ μY n ) + R μX ( 0 3 ∥ πX ) . Next, by the strong composition rule in R ́enyi differential privacy, R ( ∥ ) R ( ∥ ) ̃μY n 2 1 + μY n 1 + ≤ 2 ̃μX n + 1 μX n + 1 By iterating this inequality, we deduce that for all n R R ( ∥ ∥ ) ( ) ≤ ̃μY n 2 ≤ Nprox − 1, ( R μY n + ε2 RGO . ∥ ) ̃μY n πY 2 3 / 3Nprox ε2 RGO ≤ 2 + μX 0 3 πX . (D.21) This inequality will be used later for a change of measure argument. R ( ∥ ) R ( ∥ ) 50 However, we must first investigate the concentration of is a 1-Lipschitz function, then concentration under a Poincar ́e inequality (Lemma A.5) implies the following tail bound: for all η 0, under πY . Since ⋅ − x∗ ⋅ − x∗ ∥ ∥ ∥ ∥ ≥ π ⋅ − x∗ m + CPI η 3 exp −η . √ . Standard concentration estimates for ρh yield {∥ } ) ( ∥ ≥ ≤ Also, let ρh = 0, hId N ( ) ρh ⋅ dh + η ≥ √ exp − η2 2h . ( ) ≤ } Since πY = πX ∗ ρh, a union bound yields {∥ ∥ πY ⋅ − x∗ which implies the simpler bound {∥ ∥ m + dh + CPI η + 2hη √ √ √ ≥ 4 exp −η ( ) 4 exp −η . ≤ } ≤ πY ⋅ − x∗ ≥ m + 3 dh + 2 CPI + h η √ √ We now adapt the change-of-measure argument from [Che+22b, Lemma 21]. Namely, let Eη ( {∥ } ) ( ) ∥ denote the event above. By H ̈older's inequality, ̃μY n Eη 1Eη = ∫ ) This implies that ( d ̃μY n dπY dπY ≤ πY Eη 3 1 / ( ) ∫ ( ( d ̃μY n dπY 2 3 / dπY 3 2 / = πY Eη 3 exp 1 / ) ( ) 2 3 / ̃μY n , πY 2 ( . ) ) R ( ̃μY n ⋅ − x∗ ≥ m + 3 dh + 3 CPI + h √ √ ̃μY n πY 2 3 / 2 CPI + h η 4 exp − ≤ η 3 . ) 0, 1, . . . , Nprox − 1 and using (D.21), it shows that for δ R } ( ) ∥ ( ( ) ∥ After taking a union bound over n with probability at least 1 − δ, it holds: {∥ = ) + √ max 0,1,...,Nprox 1 − k = This completes the proof. ∥ √ √ ∥ ̃Yn − x∗ ≲ m + dh + CPI + h Nprox ε2 RGO + μX 0 3 πX + log ( R ( ∥ ) ) 0, 1 , ( ) ∈ . Nprox δ D.7.3 Explicit versions of the results beyond strong log-concavity Finally, we state and prove the more explicit versions of the results in §5.2. −f Theorem D.7 (Faster low-accuracy sampling from log-concave targets, explicit). Suppose that π ∝ exp , where f is convex and β-smooth. There is an algorithm with randomized runtime that, given access to a minimizer x∗ of f and to N first-order queries for f , outputs a random point in Rd with law μ satisfying KL ε2. Moreover, for any δ with probability at least 1 − δ, π the number of queries made satisfies ) 0, 1 μ ≤ ∥ ) ( ( ) ( ∈ 2 d1 / d + βm2 ε2 ( ) N O ≤ ̃ ( log3 log 1 δ . ) 51 −f Theorem D.8 (Faster high-accuracy sampling from LSI targets, explicit). Suppose that π ∝ α-LSI and that f is β-smooth. There is an algorithm with randomized run- exp time that, given access to a stationary point x∗ of f and to N first-order queries for f , outputs a random point in Rd with law μ satisfying d π ε for any of the following metrics: satisfies 1 μ ( ) / ⩽ χ2, TV, d ∈ ( √ KL, ) ∥ √ α W2 . √ with probability at least 1 − δ, the number of queries made satisfies } { Moreover, for any δ 0, 1 ∈ ( ) O 2 log4 max κd1 / N ≤ , ∆, m, log 1 ε 1 δ . ̃ ( { }) Theorem D.9 (Faster high-accuracy sampling from PI targets, explicit). Suppose that π ∝ exp −f α-PI and that f is β-smooth. There is an algorithm with randomized runtime that, given satisfies 1 ) access to a stationary point x∗ of f and to N first-order queries for f , outputs a random point in Rd with law μ satisfying d ε for any of the following metrics: μ π ( / ⩽ ( ∥ ) d ∈ TV, KL, χ2, α W2 . √ √ √ with probability at least 1 − δ, the number of queries made satisfies } { Moreover, for any δ 0, 1 ∈ ( N ) ≤ O 2 max κd1 / ∆, d, log 1 ε log3 max m, log 1 δ . ̃ ( { } { }) Proofs of Theorems D.7, D.8, and D.9. For the proofs of Theorems D.8 and D.9, we can simply use the proofs of Theorems 5.3 and 5.4 given in Appendices D.4 and D.5 respectively, substituting in the R ́enyi initialization bound of Lemma D.5 and the bound on the size of the proximal sampler iterates in Lemma D.6. For the proof of Theorem D.7, we again follow the proof of Theorem 5.6 in Appendix D.6 and use Lemmas D.5 and D.6, but with the following additional ingredients. First, we bound the Wasserstein distance at initialization. We note that for μX 0 x∗, 2β 1Id − , = W2 0 , πX μX ≤ W2 μX 0 , δx∗ + W2 δx∗, πX d 2β + ≤ √ E πX ⋅ − x∗ 2 ≲ ( ) ) N ( d β + m , √ √ ( ) where the last inequality makes use of a reverse H ̈older inequality for log-concave measures; see [AB15, Proposition A.5]. [∥ ) ( ( ∥ ) ] Second, although we could invoke Lemma D.6 directly, this would incur a dependence on the Poincar ́e constant of π. Although all log-concave measures indeed satisfy a PI, it is not always straightforward to estimate the Poincar ́e constant. Therefore, we note that by invoking the reverse H ̈older inequality in [AB15, Proposition A.5] rather than the concentration under a PI (Lemma A.5), it is possible to eliminate the dependence on CPI in Lemma D.6 when π is log-concave, which gives the final statement of the result. Remark D.10 (Interpretation of the bounds). We remark that the parameters m and ∆ have already appeared in prior sampling analyses such as [Che+22a; Che+22b]. For the reader's conve- nience, we pause to discuss the interpretation of the dependencies in the final bounds. First, we note that the dependence on the failure probability δ is polynomial in log log , and is therefore negligible. 1 δ ( / ) 52 The dependence on the first moment bound m is logarithmic in all of the results and hence typically negligible, with the exception of Theorem 5.6 in which case it is usually the dominant term. x∗ Finally, in the isoperimetric settings, there is additionally a dependence on the objective gap ∆ ∶ −min f , which measures the quality of the stationary point. If ∆ ≲ d, which is realistic for f = many applications (it reflects the situation in which the user has some reasonable prior knowledge about the mode), then this is never the dominant term in the bounds; and for Theorem 5.3, the dependence on ∆ is only logarithmic. ( ) Although these parameters have to be controlled for any given application, for interpretability we give simplified statements of the bounds: we assume ∆ ≲ d, that m is polynomially bounded, and we omit logarithmic factors for simplicity. assumptions log-concavity and log-smoothness LSI and log-smoothness PI and log-smoothness complexity 2m2 ε2 βd1 / κd1 2 polylog 1 / / 2 polylog κd3 1 / / ( / ( ε ε ) ) References [Aba+16a] M. Abadi, A. Chu, I. Goodfellow, H. B. McMahan, I. Mironov, K. Talwar, and L. Zhang. "Deep learning with differential privacy". In: Conference on Computer and Communications Security. 2016, pp. 308–318. [Aba+16b] M. Abadi, P. Barham, J. Chen, Z. Chen, A. Davis, J. Dean, M. Devin, S. Ghemawat, G. Irving, M. Isard, et al. "TensorFlow: a system for large-scale machine learning". In: Symposium on Operating Systems Design and Implementation. 2016, pp. 265–283. [Alb+19] [AB15] [AT22a] [AT22b] [ADP20] [BGL14] [Bal+19] D. Albritton, S. Armstrong, J.-C. Mourrat, and M. Novack. "Variational methods for the kinetic Fokker–Planck equation". In: arXiv preprint arXiv:1902.04037 (2019). D. Alonso-Guti ́errez and J. Bastero. Approaching the Kannan–Lov ́asz–Simonovits and variance conjectures. Vol. 2131. Lecture Notes in Mathematics. Springer, Cham, 2015, p. 148. J. M. Altschuler and K. Talwar. "Privacy of noisy stochastic gradient descent: more iterations without more privacy loss". In: Advances in Neural Information Processing Systems. 2022. J. M. Altschuler and K. Talwar. "Resolving the mixing time of the Langevin al- gorithm to its stationary distribution for log-concave sampling". In: arXiv preprint arXiv:2210.08448 (2022). S. Asoodeh, M. D ́ıaz, and F. du Pin Calmon. "Privacy amplification of iterative al- gorithms via contraction coefficients". In: International Symposium on Information Theory (2020), pp. 896–901. D. Bakry, I. Gentil, and M. Ledoux. Analysis and geometry of Markov diffusion oper- ators. Vol. 103. Springer, 2014. B. Balle, G. Barthe, M. Gaboardi, and J. Geumlek. "Privacy amplification by mixing and diffusion mechanisms". In: Conference on Neural Information Processing Systems. 2019. 53 [Bau17] [Bes+95] [BFR19] [BM22] [BLM13] [CLL19] [CLW20] [CLW21] [CCN21] [Che+23] F. Baudoin. "Bakry– ́Emery meet Villani". In: Journal of Functional Analysis 273.7 (2017), pp. 2275–2291. J. Besag, P. Green, D. Higdon, and K. Mengersen. "Bayesian computation and stochas- tic systems". In: Statistical Science 10.1 (1995), pp. 3–66. J. Bierkens, P. Fearnhead, and G. Roberts. "The zig-zag process and super-efficient sampling for Bayesian analysis of big data". In: The Annals of Statistics 47.3 (2019), pp. 1288–1320. N. Bou-Rabee and M. Marsden. "Unadjusted Hamiltonian MCMC with stratified Monte Carlo time integration". In: arXiv preprint arXiv:211.11003 (2022). S. Boucheron, G. Lugosi, and P. Massart. Concentration inequalities. A nonasymptotic theory of independence, With a foreword by Michel Ledoux. Oxford University Press, Oxford, 2013, pp. x+481. Y. Cao, J. Lu, and Y. Lu. "Exponential decay of R ́enyi divergence under Fokker– Planck equations". In: Journal of Statistical Physics 176.5 (2019), pp. 1172–1184. Y. Cao, J. Lu, and L. Wang. "On explicit L2-convergence rate estimate for under- damped Langevin dynamics". In: arXiv preprint arXiv:1908.04746 (2020). Y. Cao, J. Lu, and L. Wang. "Complexity of randomized algorithms for underdamped Langevin dynamics". In: Communications in Mathematical Sciences 19.7 (2021), pp. 1827– 1853. H.-B. Chen, S. Chewi, and J. Niles-Weed. "Dimension-free log-Sobolev inequalities for mixture distributions". In: Journal of Functional Analysis 281.11 (2021), p. 109236. S. Chen, S. Chewi, J. Li, Y. Li, A. Salim, and A. Zhang. "Sampling is as easy as learning the score: theory for diffusion models with minimal data assumptions". In: International Conference on Learning Representations. 2023. [Che+22a] Y. Chen, S. Chewi, A. Salim, and A. Wibisono. "Improved analysis for a proximal algorithm for sampling". In: Conference on Learning Theory. Vol. 178. PMLR, 2022, pp. 2984–3014. [Che+20] Y. Chen, R. Dwivedi, M. J. Wainwright, and B. Yu. "Fast mixing of Metropolized Hamiltonian Monte Carlo: benefits of multi-step gradients". In: Journal of Machine Learning Research 21 (2020). [CE22] [CV19] Y. Chen and R. Eldan. "Localization schemes: a framework for proving mixing bounds for Markov chains". In: arXiv preprint arXiv:2203.04163 (2022). Z. Chen and S. S. Vempala. "Optimal convergence rate of Hamiltonian Monte Carlo for strongly logconcave distributions". In: Approximation, randomization, and combi- natorial optimization. Algorithms and techniques. Vol. 145. LIPIcs. Leibniz Int. Proc. Inform. Schloss Dagstuhl. Leibniz-Zent. Inform., Wadern, 2019, Art. No. 64, 12. [Che+18] X. Cheng, N. S. Chatterji, P. L. Bartlett, and M. I. Jordan. "Underdamped Langevin MCMC: a non-asymptotic analysis". In: Conference on Learning Theory. PMLR. 2018, pp. 300–323. [Che23] S. Chewi. Log-concave sampling. Draft available at https://chewisinho.github.io/. Forthcoming, 2023. 54 [Che+22b] S. Chewi, M. A. Erdogdu, M. Li, R. Shen, and S. Zhang. "Analysis of Langevin Monte Carlo from Poincar ́e to log-Sobolev". In: Conference on Learning Theory. Vol. 178. PMLR, 2022, pp. 1–2. [Che+21] [CYS21] [Cor+22] [DKR22] [DR20] [DMS09] [Dwi+18] [DR14] [DR16] [EHZ22] [EB80] [FYC23] [FKT20] [Fel+18] S. Chewi, C. Lu, K. Ahn, X. Cheng, T. Le Gouic, and P. Rigollet. "Optimal dimen- sion dependence of the Metropolis-adjusted Langevin algorithm". In: Conference on Learning Theory. PMLR. 2021, pp. 1260–1300. R. Chourasia, J. Ye, and R. Shokri. "Differential privacy dynamics of Langevin dif- fusion and noisy gradient descent". In: Advances in Neural Information Processing Systems. Vol. 34. 2021, pp. 14771–14781. T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein. Introduction to algorithms. MIT Press, 2022. A. S. Dalalyan, A. Karagulyan, and L. Riou-Durand. "Bounding the error of dis- cretized Langevin algorithms for non-strongly log-concave targets". In: Journal of Machine Learning Research 23.235 (2022), pp. 1–38. A. S. Dalalyan and L. Riou-Durand. "On sampling from a log-concave density using kinetic Langevin diffusions". In: Bernoulli 26.3 (2020), pp. 1956–1988. J. Dolbeault, C. Mouhot, and C. Schmeiser. "Hypocoercivity for kinetic equations with linear relaxation terms". In: Comptes Rendus Math ́ematique 347.9-10 (2009), pp. 511– 516. R. Dwivedi, Y. Chen, M. J. Wainwright, and B. Yu. "Log-concave sampling: Metropolis– Hastings algorithms are fast!" In: Conference on Learning Theory. PMLR. 2018, pp. 793– 797. C. Dwork and A. Roth. "The algorithmic foundations of differential privacy." In: Foun- dations and Trends in Theoretical Computer Science 9.3-4 (2014), pp. 211–407. C. Dwork and G. N. Rothblum. "Concentrated differential privacy". In: arXiv preprint arXiv:1603.01887 (2016). M. A. Erdogdu, R. Hosseinzadeh, and S. Zhang. "Convergence of Langevin Monte Carlo in chi-squared and R ́enyi divergence". In: Conference on Artificial Intelligence and Statistics. Vol. 151. PMLR, 2022, pp. 8151–8175. D. L. Ermak and H. Buckholz. "Numerical integration of the Langevin equation: Monte Carlo simulation". In: Journal of Computational Physics 35.2 (1980), pp. 169–182. J. Fan, B. Yuan, and Y. Chen. "Improved dimension dependence of a proximal algo- rithm for sampling". Forthcoming. 2023. V. Feldman, T. Koren, and K. Talwar. "Private stochastic convex optimization: opti- mal rates in linear time". In: Symposium on the Theory of Computing. 2020, pp. 439– 449. V. Feldman, I. Mironov, K. Talwar, and A. Thakurta. "Privacy amplification by it- eration". In: Symposium on Foundations of Computer Science. IEEE. 2018, pp. 521– 532. [FLO21] J. Foster, T. Lyons, and H. Oberhauser. "The shifted ODE method for underdamped Langevin MCMC". In: arXiv preprint arXiv:2101.03446 (2021). 55 [Fro+15] [GT20] [GLG15] R. Frostig, R. Ge, S. Kakade, and A. Sidford. "Un-regularizing: approximate proximal point and faster stochastic algorithms for empirical risk minimization". In: Interna- tional Conference on Machine Learning. Vol. 37. Proceedings of Machine Learning Research. PMLR, July 2015, pp. 2540–2548. A. Ganesh and K. Talwar. "Faster differentially private samplers via R ́enyi divergence analysis of discretized Langevin MCMC". In: Advances in Neural Information Pro- cessing Systems. Vol. 33. 2020, pp. 7222–7233. A. Gelman, D. Lee, and J. Guo. "Stan: a probabilistic programming language for Bayesian inference and optimization". In: Journal of Educational and Behavioral Statistics 40.5 (2015), pp. 530–543. [GLL22] S. Gopi, Y. T. Lee, and D. Liu. "Private convex optimization via exponential mecha- nism". In: Conference on Learning Theory. Vol. 178. PMLR, 2022, pp. 1948–1989. [Gop+23a] S. Gopi, Y. T. Lee, D. Liu, R. Shen, and K. Tian. "Algorithmic aspects of the log-Laplace transform and a non-Euclidean proximal sampler". In: arXiv preprint arXiv:2302.06085 (2023). [Gop+23b] S. Gopi, Y. T. Lee, D. Liu, R. Shen, and K. Tian. "Private convex optimization in general norms". In: Symposium on Discrete Algorithms. 2023, pp. 5068–5089. [Gro75] [GHN23] [HBE20] [H ̈or67] [JKO98] [KLS95] [Kel17] [KL22] [KP21] [Kol34] [Le 16] L. Gross. "Logarithmic Sobolev inequalities". In: American Journal of Mathematics 97.4 (1975), pp. 1061–1083. A. Guha, N. Ho, and X. Nguyen. "On excess mass behavior in Gaussian mixture mod- els with Orlicz–Wasserstein distances". In: arXiv preprint arXiv:2301.11496 (2023). Y. He, K. Balasubramanian, and M. A. Erdogdu. "On the ergodicity, bias and asymp- totic normality of randomized midpoint sampling method". In: Advances in Neural Information Processing Systems. Ed. by H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin. Vol. 33. Curran Associates, Inc., 2020, pp. 7366–7376. L. H ̈ormander. "Hypoelliptic second order differential equations". In: Acta Mathemat- ica 119 (1967), pp. 147–171. R. Jordan, D. Kinderlehrer, and F. Otto. "The variational formulation of the Fokker– Planck equation". In: SIAM Journal on Mathematical Analysis 29.1 (1998), pp. 1– 17. R. Kannan, L. Lov ́asz, and M. Simonovits. "Isoperimetric problems for convex bod- ies and a localization lemma". In: Discrete & Computational Geometry 13.3 (1995), pp. 541–559. M. Kell. "On interpolation and curvature via Wasserstein geodesics". In: Advances in Calculus of Variations 10.2 (2017), pp. 125–167. B. Klartag and J. Lehec. "Bourgain's slicing problem and KLS isoperimetry up to polylog". In: Geometric and Functional Analysis 32.5 (2022), pp. 1134–1159. B. Klartag and E. Putterman. "Spectral monotonicity under Gaussian convolution". In: (2021). A. Kolmogoroff. "Zufallige bewegungen (zur theorie der Brownschen bewegung)". In: Annals of Mathematics (1934), pp. 116–117. J.-F. Le Gall. Brownian motion, martingales, and stochastic calculus. Vol. 274. Grad- uate Texts in Mathematics. Springer, 2016, p. 273. 56 [LST20] [LST21a] [LST21b] [LE20] [LC21] [LC22a] [LC22b] [LMH15] [Liu20] [LS93] [LW22] [Ma+21] [MT07] [Mir17] [Mon21] Y. T. Lee, R. Shen, and K. Tian. "Logsmooth gradient concentration and tighter runtimes for Metropolized Hamiltonian Monte Carlo". In: Conference on Learning Theory. Vol. 125. PMLR, 2020, pp. 2565–2597. Y. T. Lee, R. Shen, and K. Tian. "Lower bounds on Metropolized sampling methods for well-conditioned distributions". In: Advances in Neural Information Processing Systems 34 (2021), pp. 18812–18824. Y. T. Lee, R. Shen, and K. Tian. "Structured logconcave sampling with a restricted Gaussian oracle". In: Conference on Learning Theory. Vol. 134. PMLR, 2021, pp. 2993– 3050. M. Li and M. A. Erdogdu. "Riemannian Langevin algorithm for solving semidefinite programs". In: arXiv preprint arXiv:2010.11176 (2020). J. Liang and Y. Chen. "A proximal algorithm for sampling from non-smooth poten- tials". In: arXiv preprint arXiv:2110.04597 (2021). J. Liang and Y. Chen. "A proximal algorithm for sampling". In: arXiv preprint arXiv:2202.13975 (2022). J. Liang and Y. Chen. "A proximal algorithm for sampling from non-convex poten- tials". In: arXiv preprint arXiv:2205.10188 (2022). H. Lin, J. Mairal, and Z. Harchaoui. "A universal catalyst for first-order optimiza- tion". In: Advances in Neural Information Processing Systems. Ed. by C. Cortes, N. Lawrence, D. Lee, M. Sugiyama, and R. Garnett. Vol. 28. Curran Associates, Inc., 2015. Y. Liu. "The Poincar ́e inequality and quadratic transportation-variance inequalities". In: Electronic Journal of Probability 25 (2020), Paper No. 1, 16. L. Lov ́asz and M. Simonovits. "Random walks in a convex body and an improved volume algorithm". In: Random Structures & Algorithms 4.4 (1993), pp. 359–412. J. Lu and L. Wang. "Complexity of zigzag sampling algorithm for strongly log-concave distributions". In: Statistics and Computing 32.3 (2022), Paper No. 48, 12. Y.-A. Ma, N. S. Chatterji, X. Cheng, N. Flammarion, P. L. Bartlett, and M. I. Jordan. "Is there an analog of Nesterov acceleration for gradient-based MCMC?" In: Bernoulli 27.3 (2021), pp. 1942–1992. F. McSherry and K. Talwar. "Mechanism design via differential privacy". In: Sympo- sium on Foundations of Computer Science. IEEE. 2007, pp. 94–103. I. Mironov. "R ́enyi differential privacy". In: Computer Security Foundations Sympo- sium. IEEE. 2017, pp. 263–275. P. Monmarch ́e. "High-dimensional MCMC with a standard splitting scheme for the underdamped Langevin diffusion." In: Electronic Journal of Statistics 15.2 (2021), pp. 4117–4166. [Nea+11] R. M. Neal et al. "MCMC using Hamiltonian dynamics". In: Handbook of Markov Chain Monte Carlo 2.11 (2011), p. 2. [NY83] A. S. Nemirovsky and D. B. Yudin. Problem complexity and method efficiency in optimization. Wiley-Interscience Series in Discrete Mathematics. John Wiley & Sons, Inc., New York, 1983, p. 388. 57 [Nes18] [OV00] [RR91] [RR98] [RS18] [RBP22] [SL19] [SBD21] [Stu11] [TP18] [Tro77] [VH14] [VW19] [Ver18] [Vil09a] [Vil09b] [Wib18] Y. Nesterov. Lectures on convex optimization. Vol. 137. Springer Optimization and Its Applications. Springer, Cham, 2018, pp. xxiii+589. F. Otto and C. Villani. "Generalization of an inequality by Talagrand and links with the logarithmic Sobolev inequality". In: Journal of Functional Analysis 173.2 (2000), pp. 361–400. M. M. Rao and Z. D. Ren. Theory of Orlicz spaces. Vol. 146. M. Dekker New York, 1991. G. O. Roberts and J. S. Rosenthal. "Optimal scaling of discrete approximations to Langevin diffusions". In: Journal of the Royal Statistical Society, Series B, Statistical Methodology 60.1 (1998), pp. 255–268. J. Roussel and G. Stoltz. "Spectral methods for Langevin dynamics and associated error estimates". In: ESAIM. Mathematical Modelling and Numerical Analysis 52.3 (2018), pp. 1051–1083. T. Ryffel, F. Bach, and D. Pointcheval. "Differential privacy guarantees for stochastic gradient Langevin dynamics". arXiv:2201.11980. 2022. R. Shen and Y. T. Lee. "The randomized midpoint method for log-concave sampling". In: Advances in Neural Information Processing Systems 32 (2019). M. Sordello, Z. Bu, and J. Dong. "Privacy amplification via iteration for shuffled and online PNSGD". In: Machine Learning and Knowledge Discovery in Databases. Research Track. Ed. by N. Oliver, F. P ́erez-Cruz, S. Kramer, J. Read, and J. A. Lozano. Cham: Springer International Publishing, 2021, pp. 796–813. K.-T. Sturm. "Generalized Orlicz spaces and Wasserstein distances for convex-concave scale functions". In: Bulletin des Sciences Math ́ematiques 135.6-7 (2011), pp. 795–802. M. K. Titsias and O. Papaspiliopoulos. "Auxiliary gradient-based sampling algorithms". In: Journal of the Royal Statistical Society: Series B (Statistical Methodology) 80.4 (2018), pp. 749–767. M. Tropper. "Ergodic and quasideterministic properties of finite-dimensional stochas- tic systems". In: Journal of Statistical Physics 17 (1977), pp. 491–509. T. Van Erven and P. Harremos. "R ́enyi divergence and Kullback–Leibler divergence". In: IEEE Transactions on Information Theory 60.7 (2014), pp. 3797–3820. S. Vempala and A. Wibisono. "Rapid convergence of the unadjusted Langevin algo- rithm: isoperimetry suffices". In: Advances in Neural Information Processing Systems 32. 2019, pp. 8092–8104. R. Vershynin. High-dimensional probability: an introduction with applications in data science. Vol. 47. Cambridge Series in Statistical and Probabilistic Mathematics. Cam- bridge University Press, 2018, p. 284. C. Villani. "Hypocoercivity". In: Memoirs of the American Mathematical Society 202.950 (2009), p. 141. C. Villani. Optimal transport: old and new. Vol. 338. Grundlehren der Mathematischen Wissenschaften. Springer-Verlag, Berlin, 2009, p. 973. A. Wibisono. "Sampling as optimization in the space of measures: the Langevin dy- namics as a composite optimization problem". In: Conference on Learning Theory. PMLR. 2018, pp. 2093–3027. 58 [Wib19] [WSC22] A. Wibisono. "Proximal Langevin algorithm: rapid convergence under isoperimetry". In: arXiv preprint arXiv:1911.01469 (2019). K. Wu, S. Schmidler, and Y. Chen. "Minimax mixing time of the Metropolis-adjusted Langevin algorithm for log-concave sampling". In: Journal of Machine Learning Re- search 23.270 (2022), pp. 1–63. [YS22] J. Ye and R. Shokri. "Differentially private learning needs hidden state (or much faster convergence)". arXiv:2203.05363. 2022. [Zha+23] M. Zhang, K. Balasubramanian, S. Chewi, M. A. Erdogdu, and M. Li. "Improved discretization analysis for underdamped Langevin Monte Carlo". In: arXiv preprint arXiv:2302.08049 (2023). 59
http://arxiv.org/abs/2302.10248v2
2023-03-06T13:38:57
2023-02-20T19:27:14
VoxSRC 2022: The Fourth VoxCeleb Speaker Recognition Challenge
This paper summarises the findings from the VoxCeleb Speaker Recognition Challenge 2022 (VoxSRC-22), which was held in conjunction with INTERSPEECH 2022. The goal of this challenge was to evaluate how well state-of-the-art speaker recognition systems can diarise and recognise speakers from speech obtained "in the wild". The challenge consisted of: (i) the provision of publicly available speaker recognition and diarisation data from YouTube videos together with ground truth annotation and standardised evaluation software; and (ii) a public challenge and hybrid workshop held at INTERSPEECH 2022. We describe the four tracks of our challenge along with the baselines, methods, and results. We conclude with a discussion on the new domain-transfer focus of VoxSRC-22, and on the progression of the challenge from the previous three editions.
[ "Jaesung Huh", "Andrew Brown", "Jee-weon Jung", "Joon Son Chung", "Arsha Nagrani", "Daniel Garcia-Romero", "Andrew Zisserman" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10248v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10248v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.SD", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.SD", "cs.LG", "eess.AS" ]
3 2 0 2 r a M 6 ] D S . s c [ 2 v 8 4 2 0 1 . 2 0 3 2 : v i X r a VoxSRC 2022: The Fourth VoxCeleb Speaker Recognition Challenge Jaesung Huh1, Andrew Brown1, Jee-weon Jung2, Joon Son Chung1,3, Arsha Nagrani1†, Daniel Garcia-Romero4, Andrew Zisserman1 1Visual Geometry Group, Department of Engineering Science, University of Oxford, UK 2Naver Corporation, South Korea 3Korea Advanced Institute of Science and Technology, South Korea 4AWS AI Labs, USA https://mm.kaist.ac.kr/datasets/voxceleb/voxsrc/competition2022.html Abstract This paper summarises the findings from the VoxCeleb Speaker Recognition Challenge 2022 (VoxSRC-22), which was held in conjunction with INTERSPEECH 2022. The goal of this chal- lenge was to evaluate how well state-of-the-art speaker recog- nition systems can diarise and recognise speakers from speech obtained "in the wild". The challenge consisted of: (i) the pro- vision of publicly available speaker recognition and diarisation data from YouTube videos together with ground truth annota- tion and standardised evaluation software; and (ii) a public chal- lenge and hybrid workshop held at INTERSPEECH 2022. We describe the four tracks of our challenge along with the base- lines, methods, and results. We conclude with a discussion on the new domain-transfer focus of VoxSRC-22, and on the pro- gression of the challenge from the previous three editions. Index Terms: speaker verification, diarisation, unconstrained conditions 1. Introduction The fourth edition of the VoxCeleb Speaker Recognition Chal- lenge was held in 2022 (VoxSRC-22). The main objectives of this series are to: (i) investigate and advance new speaker recog- nition research "in the wild"; (ii) gauge and calibrate the perfor- mance of current technology through open evaluation tools; and (iii) provide open-source data that is available to all members of the research community. Each year, VoxSRC introduces a new special focus. In the second installation (VoxSRC-20 [1]), we introduced two new tracks: (i) the self-supervised verification track (inspired by the successes in self-supervised learning [2, 3]), where no speaker labels can be used during the pretrain phase; and (ii) a speaker diarisation track which exploits the VoxConverse [4] dataset. In the third edition (VoxSRC-21 [5]), we added a multi-lingual fo- cus to the verification tracks, to encourage fairness and diversity and to build a more challenging test set. This year, we introduced a new track focused on semi- supervised domain adaptation. The goal was to assess how models pretrained on large labelled data in a source domain can adapt to a new target domain, given (i) a large set of un- labelled data from the target domain and (ii) a small set of la- belled data from the target domain. This is especially relevant and important to low resource real-world scenarios, where large scale labelled data is not available in a target domain, but a suffi- ciently large dataset from another domain such as VoxCeleb [6] is available. †Also at Google Research. For the existing speaker verification tracks, we also applied two novel techniques for making more challenging positive and negative pairs for the speaker verification test set, by using a face age classifier and a speaker diarisation dataset, respectively. This paper details the four evaluation tasks, provided datasets, the submissions, and winners of VoxSRC-22 chal- lenge. Please refer to our website for more information. 2. Task Description 2.1. Tracks The challenge consisted of the following four tracks: 1. Speaker Verification (Closed) 2. Speaker Verification (Open) 3. Semi-supervised domain adaptation (Closed) 4. Speaker diarisation (Open) For the verification tracks, the open and closed training con- ditions refer to the training data that is allowed. The tasks of Tracks 1, 2, and 4 were identical to those of last year's challenge, whereas the track 3 task of semi-supervised domain adaptation was newly introduced this year. Please see the fol- lowing section for further details. 2.2. Data 2.2.1. Speaker Verification – Track 1 and 2 The VoxCeleb datasets [6, 7, 8] contain speech utterances from YouTube videos, including celebrity interviews and TV shows. Please refer to [7] for more detailed descriptions. Training sets: For track 1 (closed) participants were permitted only to use the VoxCeleb2 dev set [8], which contains more than a million utterances from 5,994 speakers. For track 2 (open), participants were permitted to use any other external datasets in addition to the VoxCeleb2 dev set for training, but not the challenge's test data. Validation and Test sets: This year, we focused on making the validation and the test sets more challenging by introducing two new trial types – hard positives and hard negatives. We constructed hard positives where the age of the speaker differs considerably between the two utterances. The hard pos- itives were found by selecting utterance pairs from the same speaker that have a large age gap (i.e. two audio files for the same identity where the age is very different) via a two step process on private VoxCeleb video data. In this VoxCeleb data, for each video segment we have the face, identity and speech. First, the age of the speaker is estimated by predicting the age for a random set of frames, using an open-source age prediction network [9], and averaging the result. Second, we sample pos- itive pairs from utterances for the same speaker with large age gaps. We constructed hard negatives using utterances from the same video. When sampling a negative pair using utterances from different videos, speaker verification systems may be able to rely on cues from the different microphones or room environ- ments to help discriminate the different identities of the speak- ers, which can make the task easier. Our goal here was there- fore to construct harder negative pairs by sampling utterances from different speakers that are from the same audio file. In this case, the microphone and environment noise are shared across the two utterances, and only the identity of the speaker changes. We sampled the hard negative pairs using speaker diarisation datasets, where each audio file consists of multiple short speech segments from different speakers. To generate these trials, we first cropped short speech segments. We then removed segments that are either too short (<1.5s) or contains overlapping speech. Finally, we selected trials using two segments within an audio file. Full details are given in [10]. We released 305,196 validation pairs and 317,973 test pairs, including these hard positives and negatives. We also included the VoxSRC-19 test pairs in our test set to track the state-of-the- art performance on the same trials. No overlapping speakers exist between validation set and test set. Statistics of the val / test sets are reported in Table 1. 2.2.2. Semi-supervised domain adaptation – Track 3 This year, we introduced a new track focused on semi- supervised domain adaptation. Here, we focused on the prob- lem of how models, pretrained on a large set of data with labels in a source domain, can adapt to a new target domain given: (i) a large set of unlabelled data from the target domain, and (ii) a small set of labelled data from the target domain. Specifically, the domain adaptation that we focused on is from one language in a source domain (mainly English), to a different language in a target domain (Chinese), for the task of speaker verifica- tion. Here we use VoxCeleb [7] for the source domain, and CN-Celeb [11] for the target domain. Train set: Participants were allowed to use three types of datasets in this track: • VoxCeleb2 dev set with speaker labels (Source domain). This can be used for pretraining. • A large subset of CN-Celeb without speaker labels (Tar- get domain). This can be used for domain adaptation. • A small subset of CN-Celeb with speaker labels (Target domain) consisting of 20 utterances each from 50 differ- ent speakers. VoxCeleb2 data consists mainly of interview-style utter- ances, whereas CN-Celeb consists of several different genres. To focus on the language domain adaptation task, we have therefore removed utterances in the "singing", "play", "movie", "advertisement", and "drama" genres from CN-Celeb. Validation and Test sets: For the validation and test set, we provided a list of trial speech pairs from identities in the tar- get domain. We created and released a validation set consist- ing of 40,000 validation pairs. The test set consists of 30,000 pairs from disjoint identities not present in either CN-Celeb1 Track Split # Pairs # Utter. Segment length (s) 1 & 2 3 val test val test 305,196 317,973 110,366 34,684 2.00 / 8.43 / 314.44 1.98 / 7.36 / 282.16 40,000 30,000 2,400 18,377 0.44 / 9.38 / 224.65 1.23 / 9.06 / 89.83 Table 1: Statistics of the speaker verification validation and test sets (Tracks 1–3). # Pairs refers to the number of evalu- ation trial pairs, whereas # Utter. refers to the total number of unique speech segments. Segment lengths are reported as min/mean/max. Split # audios # spks Duration (s) speech % val test 448 360 1 / 5.5 / 21 1 / 5.5 / 28 22.0 / 512.9 / 1200.0 27.5 / 449.2 / 1777.8 11 / 91 / 100 9 / 88 / 100 Table 2: Statistics of the speaker diarisation val and test sets (Track 4). Entries that have 3 values are reported as min/mean/max. # spks: Number of speakers per video. Du- ration (s): Length of videos in seconds. speech %: Percentage of video time that is speech. or CN-Celeb2. Each trial contains two single-speaker speech segments, of variable length. See Table 1 for detailed statistics. 2.2.3. Speaker Diarisation – Track 4 VoxConverse [4] is a speaker diarisation dataset from diverse domains such as panel discussions, news segments and talk shows. It consists of multi-speaker audio segments with chal- lenging background conditions and overlapping speech. Please refer to [4] for more details. Training set: Similar to previous years, participants were al- lowed to train their models on any data, except for the test set of the challenge. Validation set: Participants were allowed to use both dev / test sets of the VoxConverse dataset. The total duration of Vox- Converse is approximately 64 hours, and the average number of speakers per audio segment ranges between 4 and 6. The average percentage of speech per each audio file is 91%. Test set: The test set contains 360 audio files, created with the identical semi-automatic pipeline used for creating VoxCon- verse. The Track 4 VoxSRC-2021 test set is included as a subset of the test set. In addition, we included an additional 96 au- dio files from YouTube videos in diverse categories, including news, documentary, lecture and commercial. Details for both validation and test set are described in Table 2. 3. Challenge Mechanics 3.1. Evaluation metrics A validation toolkit* was provided for both speaker verifica- tion and speaker diarisation. Participants were advised to test their models on the validation set for each track using this open- sourced code. The evaluation metrics are identical to VoxSRC 2021 [5]. Speaker verification. We reported two evaluation metrics: (i) *https://github.com/JaesungHuh/VoxSRC2022 Track Rank Team Name Organisation minDCF EER 1 2 3 3 2 1 3 2 1 3 2 1 SJTU-AISPEECH [12] KristonAI [13] ravana - ID R&D [14] Shanghai Jiao Tong University, AISpeech Ltd KristonAI Lab ID R&D Lab Strasbourg-Spk KristonAI [13] ravana - ID R&D [14] Microsoft KristonAI Lab ID R&D Lab SJTU-AISPEECH [12] DKU-Tencent [15] zzdddz [16] Shanghai Jiao Tong University, AISpeech Ltd Duke Kunshan University, Tencent AI Lab Chinese Academy of Sciences 0.101 0.090 0.088 0.073 0.072 0.062 0.437 0.389 0.388 1.911 1.401 1.486 1.436 1.119 1.212 8.087 7.153 7.030 Table 3: Winners for the speaker verification tracks (Tracks 1, 2 and 3). The primary metric for Track 1 & 2 is minDCF while the primary metric for Track 3 is EER. For both metrics, a lower score is better. Note that Track 1 & 2 have an identical test set. Rank Team Name Organisation DER JER 3 2 1 AiTER [17] KristonAI [13] DKU-DukeECE [18] Gwangju Institute of Science and Technology KristonAI Lab Duke Kunshan University, Duke University 5.12 4.87 4.75 30.82 25.49 27.85 Table 4: Winners for the speaker diarisation track (Track 4). The primary metric is DER. For both metrics, a lower score is better. the Equal Error Rate (EER) which is a location on a ROC or DET curve where the false acceptance rate and false rejection rate are equal; and (ii) minDCF (CDET ) used by the previous VoxSRC [5, 19] evaluations. We used Cmiss = Cf a = 1 and Ptar = 0.05 in our cost function. The main metric for Tracks 1 and 2 was minDCF, and the final ranking was based only on this score. EER was used as the main metric for Track 3. Speaker diarisation. We chose two diarisation metrics, Diari- sation Error Rate (DER) and Jaccard Error Rate (JER). DER is the sum of speaker error, false alarm speech and missed speech. We used a 0.25-second forgiving collar, and overlapping speech was not disregarded. JER is based on the Jaccard index, which is defined as the ratio between the intersection and union of two segmentations. It is computed as a 1 minus the average of Jac- card index of optimal mappings between reference and system speakers [20]. 3.2. Baselines We used same the baseline models as for last year's challenge, so please refer to [5] for more details. We used the publicly released speaker verification network trained only with VoxCeleb2 dev set for verification tracks [21]. The model is ResNet-34 [22] with ASP pooling [23] and is trained with a combination of angular prototypical loss [24] and cross-entropy loss. This baseline achieved a minDCF of 0.346 and an EER of 5.63% on track 1 and 2 test pairs, but a minDCF of 0.823 and an EER of 16.9% on track 3 test pairs. This per- formance gap shows the necessity of domain adaptation on dif- ferent language utterances. For the diarisation track, we adopted a system described in [25] using a speaker embedding extractor to our baseline speaker model, publicly available py-webrtcvad [26], and an agglomerative hierarchical clustering (AHC) of speaker repre- sentation. The resulting model achieved 19.6% DER and 41.4% JER on the challenge test set. 3.3. Submission The challenge was hosted based on publicly available CodaLab code †, but hosting on our own evaluation instance for efficient maintenance. Similar to last year, we introduced two phases: "Challenge workshop" and "Permanent" and the challenge re- sults were based on the former phase. Participants could only submit one submission per day and ten submissions in total. Submission for the "Challenge workshop" phase was available until 14th of September, 2022. Participants were required to submit reports of their methods and results by 20th of Septem- ber 2022. 4. Workshop VoxSRC-22 was a hybrid workshop with both in-person and virtual attendance options. The in-person workshop was held on the 22nd of September in Incheon Songdo Convensia, the conference venue of INTERSPEECH 2022. The workshop was free of cost for attendees. The workshop began with an introductory talk from the or- ganisers, followed by a keynote speech from professor Junichi Yamagishi, titled "The use of speaker embeddings in neural au- dio generations". The winners then gave short presentations about their methods and results. All slides and presentation videos are available on our workshop website‡. 5. Methods and Results There were a total of 554 submissions across all four tracks this year. The performances of the top three ranked teams for each track are reported in Table 3 and Table 4, along with their scores. In this section, we give details on the methods used by †https://github.com/codalab/codalab- competitions ‡https://mm.kaist.ac.kr/datasets/voxceleb/ voxsrc/interspeech2022.html the top two ranked teams from each track. 5.1. Speaker Verification (Track 1 and 2) This year, Tracks 1 and 2 had the same winners and runner-up. The winning team [14] adopted a fusion of deep ResNets and ECAPA-TDNN [27] along with extensive data augmentations using the MUSAN noise database [28] and RIR [29] responses. they trained the model with their own Self- For Track 2, VoxCeleb dataset inspired by the data collection pipeline from VoxCeleb but only using speech-based filtering. The inclusion of Self-VoxCeleb improved 20-50% of relative performance compared to the models trained only with VoxCeleb2. AS- Norm and QMF functions were employed for post-processing the scores. The second-place [13] employed ResNet variants with di- verse input features, model depths and kernel sizes in Track 1. Data augmentation was carried out using the MUSAN noise database and RIR responses, which are similar to the win- ner's method. Moreover, they applied 3-fold speed augmen- tation to enlarge the training dataset, resulting in obtaining 17,982 speakers. For Track 2, they utilised several recently pro- posed pretrained networks, such as WavLM [30] and variants of Wav2Vec2 [31] and ensembled these networks with the mod- els that they trained for Track 1. All of their models followed two-step training, training the model only with short utterances followed by training the model including longer ones with large margin fine-tuning. Their submission performed better than the winning team in terms of EER, but performed slightly worse in minDCF, which is our primary metric. Effect of self-supervised speaker models. This year, the top two winning teams in Track 2 obtained impressive performance gains by utilising models trained with self-supervision on large scale data, which had not been observed in previous additions. Following the great success in the fields of vision [32, 33, 34] and NLP [35, 36, 37], self-supervised learning has also shown prominent results in speech processing [30, 31, 38]. Since the supervised training of speech networks with labels and annotations disregards rich information in the input sig- nal, self-supervised methods instead enable the model to learn a universal representation, such as speaker information. The winner [14] utilised WavLM [30] and Hubert [38] pretrained models and achieved 30% relative improvement on minDCF, our primary metric. The second place leveraged pretrained WavLM [30] and Wav2Vec2 [31] and finetuned them with Vox- Celeb before fusing with other models. They also achieved 20% relative improvement on our primary metric (0.090 to 0.062). Analysis on hard positive and negative pairs. This year we introduced new trial types to make the test set harder, as de- scribed in Section 2.2.1. Here we analyse how these pairs af- fect the winners' performance. The VoxSRC-22 test set con- sists of four types of trials, (i) hard positive pairs taken from the same speaker at different ages (P-H), (ii) hard negative pairs taken from the same environment (N-H), (iii) positive pairs from VoxSRC-19 test set (P-Vox19), and (iv) negative pairs from VoxSRC-19 test set (N-Vox19). We compare the perfor- mance of our baseline model and the top 2 winners of track 1 on these subsets. Table 5 shows the results. The 1st [14] and 2nd place [13] performed better than our baseline model by a large margin. Comparing the performance of E-1 to the others shows that both the hard positives and the hard negatives made the chal- lenge more difficult. For the most challenging set, E-4 with both Eval. set Positive Pairs Negative Pairs Baseline 1st place 2nd place E-1 E-2 E-3 E-4 P-Vox19 N-Vox19 P-Vox19 P-H P-H N-H N-Vox19 N-H 1.47 3.25 4.50 9.27 0.90 1.35 1.33 2.07 0.65 1.15 1.18 2.28 Table 5: Performance of baseline model and winning methods in Track 1 on four subsets of the test set. We report % EER. Lower is better. P-Vox19 : positive pairs from VoxSRC-19 test set, N-Vox19 : negative pairs from VoxSRC-19 test set, P-H : hard positive pairs taken from same speaker at different ages, and N-H : hard negative pairs taken from the same environment. Model Train dataset minDCF EER Baseline 1 Baseline 2 Baseline 3 L-S L-T L-S + L-T L-S + U-T + L-T 1st place [16] 2nd place [15] L-S + U-T + L-T 0.823 0.999 0.687 0.388 0.389 16.88 32.47 13.93 7.03 7.15 Table 6: Comparison of winning methods in Track3 with base- lines. L-S : Labelled data in Source domain, U-T: Unlabelled data in Target domain and L-T Labelled data in Target domain. hard positive and negative pairs, the 1st place method (which achieves an impressive 0.9 % EER on the VoxSRC-19 test set) could only achieve 2.07% on the E-4 eval set. Interestingly, the 2nd place method performed better in E-1, E-2 and E-3 than the 1st place but achieved worse results in E-4. In fact, there is not much difference in overall performance between the first and second placed methods (See Table 3). 5.2. Semi-Supervised Domain Adaptation (Track 3) The first placed team [16] used two frameworks, pseudo la- belling and self-supervised learning, to achieve the winning per- formance on the target domain. A novel sub-graph clustering al- gorithm based on two Gaussian fitting and multi-model voting was used for generating pseudo-labels. The model was trained with two stages, first using the labelled source domain data and pseudo-labelled target domain data, and second finetuning CN- Celeb data by fixing the VoxCeleb weights of the classification layer using circle loss. Then the pseudo label correction method was adopted and the model was retrained with them. They also tried various types of domain adaptation techniques, such as CORAL [39] or CORAL+ [40], but the performance did not improve. The second placed team [15] followed the FFSVC base- line system method [41]. The clustering-based method wass used to generate the pseudo-labels of unlabelled target domain data. They used the track 1 speaker model as their initial check- point and finetuned with CN-Celeb data and pseudo labels. Sub- center ArcFace was used for the loss function which was persis- tent with noisy labels. QMF-based score calibration and score normalisation were used as post-processing steps. Discussion. Table 6 shows the top two teams' performance on the test set compared to several baselines. We trained three baseline models using same architecture and loss functions de- scribed in Section 3.2 but with different training sets. Baseline 1 is identical to the baseline model for Tracks 1 and 2 which was trained only with the VoxCeleb2 dev set, the labelled data in the source domain (L-S). We also provide Baseline 2, which was trained only with the labelled data in the target domain (L-T) from scratch. Baseline 3 was trained starting from Baseline 1 and finetuned with labelled data in the target domain using a low learning rate (1e-5). None of these baselines utilised the large amounts of unlabelled target domain data that was available to participants. A comparison on Baseline 1 and 3 shows that including the labelled data in the target domain results in a performance improvement, relatively 2% in terms of EER, even though the size of the labelled target domain data is negligible. However, Baseline 2 shows that using only the labelled target domain data results in a substantial performance decrease due to over-fitting. Finally, the two winners' performances show that utilising the extensive unlabelled target domain data is essential for perfor- mance improvement in the train set, such as in the form of pseudo-labelling during training. 5.3. Speaker diarisation (Track 4) Track 4 saw 101 submissions from 17 different teams this year. The performances of the top three ranked teams are shown in Table 4. The winner [18] of this track employed a similar approach to their previous year's system [42] in VoxSRC-21. They adopted several conventional clustering-based diarisation sys- tem pipelines, which were fused using DOVER-LAP [43]. The differences from their last year's submission are two-fold. First, they adopted a better speaker embedding extractor to bridge the domain gap between VoxCeleb and VoxConverse. Second, they used four different voice activity detection models, ResNet- based, Conformer-based, VAD from pyannote.audio 2.0 [44] and ASR-based VAD, and performed majority voting from the results of these models. The winner achieved 4.57% DER on the challenge test set. The second place [13] team also adopted a conventional clustering-based system pipeline. They re-trained the VAD models explained in [42] but with different acoustic features, including 30-dim MFCC and 80-dim filterbank, and fused the results with pyannote.audio 2.0. A speaker embedding ex- tractor, also used in their track 1 submission that achieves an EER 0.44% in VoxCeleb1-O has been employed. They applied two steps of clustering, initially with AHC, followed by a re- clustering step using a Bayesian hidden Markov model. Unlike the winning team, they employed an additional module for han- dling overlapped speech where its training process was similar to that of their VAD models. They assigned the two most likely speakers to the overlapping speech. 6. Discussion This year, the number of workshop participants was high be- cause we offered two options for participation, in-person or vir- tual attendance. 50 participants attended in person, and 100 par- ticipants attended virtually on average. For the winners' talks, the virtual attendees sent the organisers pre-recorded videos which explained their methods and results, while the in-person attendees gave their talks in the workshop venue. Questions were collected from both Zoom and people who attended in- person. All the slides and recorded talks are now available on our website. For Track 3 which was newly introduced this year, we re- Team Track 2019 test 2020 test 2021 test 2022 test VoxSRC 2019 winner [45] VoxSRC 2020 winner [46] VoxSRC 2020 2nd place [47] VoxSRC 2021 winner [48] VoxSRC 2021 2nd place [49] VoxSRC 2022 winner [14] VoxSRC 2022 2nd place [13] VoxSRC 2022 winner [14] VoxSRC 2022 2nd place [13] 1 1,2 1,2 1,2 1,2 1 1 2 2 1.42 0.80 0.75 0.57 0.62 0.90 0.65 0.69 0.50 - 3.73 3.81 - - - - - - - - - 1.85 2.84 - - - - - - - - - 1.49 1.40 1.21 1.12 Table 7: Comparison of methods (% EER) on the four work- shop test sets of Track 1 and 2. The 2019 test set is contained in the test sets of 2020, 2021 and 2022, meaning performance can be compared via the 2019 test set. We compare the VoxSRC 2019 winning submission and the top-2 submissions from both VoxSRC 2020 and VoxSRC 2021 on the 2019 test set, show- ing the large performance improvement in a year. For % EER shown, lower is better. Team Track DER JER DER JER VoxSRC 2021 winner [42] VoxSRC 2021 second place [50] 4 4 5.07 5.15 29.16 26.02 - - - - 2021 test 2022 test VoxSRC 2022 winner [18] VoxSRC 2022 second place [13] 4 4 Table 8: Comparison of methods on the test sets of Track 4. We report the performance of the top two teams on the 2021 test set, demonstrating the performance improvement in a year. For both % metrics, lower is better. 24.75 21.73 27.85 25.49 4.75 4.87 4.16 4.05 ceived a large number of submissions: 89 submissions from 42 participants. This indicates a great interest from the speaker verification community in building methods for bridging the gap between two different domains. The winning methods here leveraged pseudo-labelling using a model pretrained on the abundant labelled source domain data. Interestingly, the win- ning methods did not see performance boosts from using classic domain adaptation techniques such as CORAL [39]. Explana- tions for this could be the recent availability of powerful self- supervised speaker models, which have been shown to achieve outstanding speaker verification performance in recent years. We hope more methods specific to domain adaptation could be explored next year. We have included the entire VoxSRC-19 test set in the ver- ification test set every year, allowing us to compare the tech- niques from previous rounds of the challenge. Table 7 shows the improvement in the challenge-winning methods over the last four years. By comparing the Track 1 winning methods over the years, we see that this year the winners' performance were slightly worse than in both the 2020 and 2021 editions. How- ever, when comparing Track 2 submissions, the performance improved significantly, possibly due to the inclusion of the self- supervised trained speaker models, such as WavLM [30] or Wav2Vec [31]. Note that the 2nd place performs better on EER than the first place this year but performs worse on the Detection Cost Function (minDCF), which is our primary metric. For the diarisation track, we also included the VoxSRC-21 test set in the VoxSRC-22 test set to assess the performance of all submissions made this year based solely on the 2021 test set. Table 8 shows the result. Comparing the winners' performance on VoxSRC-21 test set, we see a significant performance im- provement of state-of-the-art methods in a year. (DER 5.07% vs 4.16%). We also compare the performance between top-2 winners' submissions on the 2021 and 2022 test sets. It demon- strates that this year's test set is more challenging than last year's. Somewhat surprisingly, the second place [13] achieved better performance on the 2021 test set compared to the winner. Acknowledgements. We thank the authors of CN-Celeb for their help and support. We also thank Rajan from Elancer and his team, http://elancerits.com/, for their huge assis- tance with diarisation annotation, Kihyun Nam, Doyeop Kwak and Youngjoon Jang for double-checking the diarisation test set labels and David Pinto for supporting the evaluation server. We are grateful to Mitchell McLaren and Doug Reynolds for their continued support to VoxSRC. This work is funded by the EP- SRC programme grant EP/T028572/1 VisualAI. Jaesung Huh is funded by a Global Korea Scholarship. We are grateful to Naver for sponsoring the workshop. 7. References [1] A. Nagrani, J. S. Chung, J. Huh, A. Brown, E. Coto, W. Xie, M. McLaren, D. A. Reynolds, and A. Zisserman, "VoxSRC 2020: The second voxceleb speaker recognition challenge," arXiv preprint arXiv:2012.06867, 2020. [2] A. Nagrani, J. S. Chung, S. Albanie, and A. Zisserman, "Disen- tangled speech embeddings using cross-modal self-supervision," in Proc. ICASSP. IEEE, 2020, pp. 6829–6833. [3] J. Huh, H. S. Heo, J. Kang, S. Watanabe, and J. S. Chung, "Aug- mentation adversarial training for unsupervised speaker recogni- tion," in Workshop on Self-Supervised Learning for Speech and Audio Processing, NeurIPS, 2020. [4] J. S. Chung, J. Huh, A. Nagrani, T. Afouras, and A. Zisserman, "Spot the conversation: speaker diarisation in the wild," in Proc. Interspeech, 2020. [5] A. Brown, J. Huh, J. S. Chung, A. Nagrani, and A. Zisserman, "VoxSRC 2021: The third voxceleb speaker recognition chal- lenge," arXiv preprint arXiv:2201.04583, 2022. [6] A. Nagrani, J. S. Chung, and A. Zisserman, "VoxCeleb: a large- scale speaker identification dataset," in Proc. Interspeech, 2017. [7] A. Nagrani, J. S. Chung, W. Xie, and A. Zisserman, "Voxceleb: Large-scale speaker verification in the wild," Computer Speech & Language, vol. 60, p. 101027, 2020. [8] J. S. Chung, A. Nagrani, and A. Zisserman, "Voxceleb2: Deep speaker recognition," in Proc. Interspeech, 2018. [9] "Facelib," https://github.com/sajjjadayobi/FaceLib, 2022. [10] J.-w. Jung, H.-S. Heo, B.-J. Lee, J. Huh, A. Brown, Y. Kwon, S. Watanabe, and J. S. Chung, "In search of strong em- bedding extractors for speaker diarisation," arXiv preprint arXiv:2210.14682, 2022. [11] L. Li, R. Liu, J. Kang, Y. Fan, H. Cui, Y. Cai, R. Vipperla, T. F. Zheng, and D. Wang, "Cn-celeb: multi-genre speaker recogni- tion," Speech Communication, 2022. [12] Z. Chen, B. Han, X. Xiang, H. Huang, B. Liu, and Y. Qian, "Sjtu-aispeech system for voxceleb speaker recognition challenge 2022," arXiv preprint arXiv:2209.09076, 2022. [13] Q. Cai, G. Hong, Z. Ye, X. Li, and H. Li, "The kriston ai sys- tem for the voxceleb speaker recognition challenge 2022," arXiv preprint arXiv:2209.11433, 2022. [14] R. Makarov, N. Torgashov, A. Alenin, I. Yakovlev, and A. Okhot- nikov, "Id r&d system description to voxceleb speaker recog- nition challenge 2022," https://www.robots.ox.ac.uk/∼vgg/data/ voxceleb/data workshop 2022/reports/ravana idrnd.pdf, 2022. [16] Z. Zhao, Z. Li, W. Wang, and P. Zhang, "The hccl system for voxceleb speaker recognition challenge 2022," 2022. [17] D. Park, Y. Yu, K. W. Park, J. W. Kim, and H. K. Kim, "Gist- aiter system for the diarization task of the 2022 voxceleb speaker recognition challenge," arXiv preprint arXiv:2209.10357, 2022. [18] W. Wang, X. Qin, M. Cheng, Y. Zhang, K. Wang, and M. Li, "The dku-dukeece diarization system for the voxceleb speaker recogni- tion challenge 2022," arXiv preprint arXiv:2210.01677, 2022. [19] J. S. Chung, A. Nagrani, E. Coto, W. Xie, M. McLaren, D. A. Reynolds, and A. Zisserman, "VoxSRC 2019: The first voxceleb speaker recognition challenge," arXiv preprint arXiv:1912.02522, 2019. [20] N. Ryant, K. Church, C. Cieri, A. Cristia, J. Du, S. Ganapathy, and M. Liberman, "The second dihard diarization challenge: Dataset, task, and baselines," arXiv preprint arXiv:1906.07839, 2019. [21] Y. Kwon, H.-S. Heo, B.-J. Lee, and J. S. Chung, "The ins and outs of speaker recognition: lessons from VoxSRC 2020," in Proc. ICASSP. IEEE, 2021, pp. 5809–5813. [22] K. He, X. Zhang, S. Ren, and J. Sun, "Deep residual learning for image recognition," in Proc. CVPR, 2016. [23] K. Okabe, T. Koshinaka, and K. Shinoda, "Attentive statis- tics pooling for deep speaker embedding," arXiv preprint arXiv:1803.10963, 2018, 2018. [24] J. S. Chung, J. Huh, S. Mun, M. Lee, H. S. Heo, S. Choe, C. Ham, S. Jung, B.-J. Lee, and I. Han, "In defence of metric learning for speaker recognition," Proc. Interspeech, 2020. [25] Q. Wang, C. Downey, L. Wan, P. A. Mansfield, and I. L. Moreno, IEEE, 2018, "Speaker diarization with lstm," in Proc. ICASSP. pp. 5239–5243. [26] "Webrtc voice activity detector," 2021 (accessed 31 May 2021), https://github.com/wiseman/py-webrtcvad. [27] B. Desplanques, J. Thienpondt, and K. Demuynck, "Ecapa-tdnn: Emphasized channel attention, propagation and aggregation in tdnn based speaker verification," Proc. Interspeech, 2020. [28] D. Snyder, G. Chen, and D. Povey, "Musan: A music, speech, and noise corpus," arXiv preprint arXiv:1510.08484, 2015. [29] T. Ko, V. Peddinti, D. Povey, M. L. Seltzer, and S. Khudanpur, "A study on data augmentation of reverberant speech for robust speech recognition," in Proc. ICASSP. IEEE, 2017, pp. 5220– 5224. [30] S. Chen, C. Wang, Z. Chen, Y. Wu, S. Liu, Z. Chen, J. Li, N. Kanda, T. Yoshioka, X. Xiao et al., "Wavlm: Large-scale self- supervised pre-training for full stack speech processing," IEEE Journal of Selected Topics in Signal Processing, vol. 16, no. 6, pp. 1505–1518, 2022. [31] A. Baevski, Y. Zhou, A. Mohamed, and M. Auli, "wav2vec 2.0: A framework for self-supervised learning of speech representa- tions," in NeurIPS, vol. 33, 2020, pp. 12 449–12 460. [32] T. Chen, S. Kornblith, M. Norouzi, and G. Hinton, "A sim- ple framework for contrastive learning of visual representations," arXiv preprint arXiv:2002.05709, 2020. [33] J.-B. Grill, F. Strub, F. Altch ́e, C. Tallec, P. Richemond, E. Buchatskaya, C. Doersch, B. Avila Pires, Z. Guo, M. Ghesh- laghi Azar et al., "Bootstrap your own latent-a new approach to self-supervised learning," in NeurIPS, vol. 33, 2020, pp. 21 271– 21 284. [34] J. Zbontar, L. Jing, I. Misra, Y. LeCun, and S. Deny, "Barlow twins: Self-supervised learning via redundancy reduction," in Proc. ICML. PMLR, 2021, pp. 12 310–12 320. [35] J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova, "Bert: Pre- training of deep bidirectional transformers for language under- standing," arXiv preprint arXiv:1810.04805, 2018. [15] X. Qin, N. Li, Y. Lin, Y. Ding, C. Weng, D. Su, and M. Li, "The dku-tencent system for the voxceleb speaker recognition chal- lenge 2022," arXiv preprint arXiv:2210.05092, 2022. [36] Z. Yang, Z. Dai, Y. Yang, J. Carbonell, R. R. Salakhutdinov, and Q. V. Le, "Xlnet: Generalized autoregressive pretraining for lan- guage understanding," in NeurIPS, vol. 32, 2019. [37] Z. Lan, M. Chen, S. Goodman, K. Gimpel, P. Sharma, and R. Sori- cut, "Albert: A lite bert for self-supervised learning of language representations," arXiv preprint arXiv:1909.11942, 2019. [38] W.-N. Hsu, B. Bolte, Y.-H. H. Tsai, K. Lakhotia, R. Salakhut- dinov, and A. Mohamed, "Hubert: Self-supervised speech rep- resentation learning by masked prediction of hidden units," IEEE/ACM Transactions on Audio, Speech, and Language Pro- cessing, vol. 29, pp. 3451–3460, 2021. [39] B. Sun, J. Feng, and K. Saenko, "Correlation alignment for unsu- pervised domain adaptation," in Domain Adaptation in Computer Vision Applications. Springer, 2017, pp. 153–171. [40] K. A. Lee, Q. Wang, and T. Koshinaka, "The coral+ algorithm for unsupervised domain adaptation of plda," in ICASSP 2019-2019 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP). IEEE, 2019, pp. 5821–5825. [41] X. Qin, M. Li, H. Bu, W. Rao, R. K. Das, S. Narayanan, and H. Li, "The interspeech 2020 far-field speaker verification challenge," arXiv preprint arXiv:2005.08046, 2020. [42] W. Wang, D. Cai, Q. Lin, L. Yang, J. Wang, J. Wang, and M. Li, "The dku-dukeece-lenovo system for the diarization task of the 2021 voxceleb speaker recognition challenge," arXiv preprint arXiv:2109.02002, 2021. [43] D. Raj, L. P. Garcia-Perera, Z. Huang, S. Watanabe, D. Povey, A. Stolcke, and S. Khudanpur, "Dover-lap: A method for com- bining overlap-aware diarization outputs," in Proc. SLT, 2021. [44] H. Bredin, R. Yin, J. M. Coria, G. Gelly, P. Korshunov, M. Lavechin, D. Fustes, H. Titeux, W. Bouaziz, and M.-P. Gill, "Pyannote. audio: neural building blocks for speaker diarization," in Proc. ICASSP. IEEE, 2020, pp. 7124–7128. [45] H. Zeinali, S. Wang, A. Silnova, P. Matˇejka, and O. Plchot, "BUT system description to voxceleb speaker recognition chal- lenge 2019," arXiv preprint arXiv:1910.12592, 2019. [46] J. Thienpondt, B. Desplanques, and K. Demuynck, "The IDLAB voxceleb speaker recognition challenge 2020 system description," arXiv preprint arXiv:2010.12468, 2020. [47] X. Xiang, "The xx205 system for the voxceleb speaker recogni- tion challenge 2020," arXiv preprint arXiv:2011.00200, 2020. [48] M. Zhao, Y. Ma, M. Liu, and M. Xu, "The speakin system for voxceleb speaker recognition challange 2021," 2021. [49] L. Zhang, H. Zhao, Q. Meng, Y. Chen, M. Liu, and L. Xie, "Beijing zkj-npu speaker verification system for voxceleb speaker recognition challenge 2021," 2021. [50] K. Wang, X. Mao, H. Wu, C. Ding, C. Shang, R. Xia, and Y. Wang, "The bytedance speaker diarization system for the voxceleb speaker recognition challenge 2021," arXiv preprint arXiv:2109.02047, 2021.
http://arxiv.org/abs/2302.10238v2
2023-03-01T05:22:32
2023-02-20T19:07:42
Multiagent Inverse Reinforcement Learning via Theory of Mind Reasoning
We approach the problem of understanding how people interact with each other in collaborative settings, especially when individuals know little about their teammates, via Multiagent Inverse Reinforcement Learning (MIRL), where the goal is to infer the reward functions guiding the behavior of each individual given trajectories of a team's behavior during some task. Unlike current MIRL approaches, we do not assume that team members know each other's goals a priori; rather, that they collaborate by adapting to the goals of others perceived by observing their behavior, all while jointly performing a task. To address this problem, we propose a novel approach to MIRL via Theory of Mind (MIRL-ToM). For each agent, we first use ToM reasoning to estimate a posterior distribution over baseline reward profiles given their demonstrated behavior. We then perform MIRL via decentralized equilibrium by employing single-agent Maximum Entropy IRL to infer a reward function for each agent, where we simulate the behavior of other teammates according to the time-varying distribution over profiles. We evaluate our approach in a simulated 2-player search-and-rescue operation where the goal of the agents, playing different roles, is to search for and evacuate victims in the environment. Our results show that the choice of baseline profiles is paramount to the recovery of the ground-truth rewards, and that MIRL-ToM is able to recover the rewards used by agents interacting both with known and unknown teammates.
[ "Haochen Wu", "Pedro Sequeira", "David V. Pynadath" ]
10.5555/3545946.3598703
[ { "@title": "doi", "@href": "http://dx.doi.org/10.5555/3545946.3598703", "@rel": "related", "@type": null }, { "@title": null, "@href": "http://arxiv.org/abs/2302.10238v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10238v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.AI", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.AI", "cs.LG", "cs.MA", "68T01" ]
Multiagent Inverse Reinforcement Learning via Theory of Mind Reasoning Haochen Wu University of Michigan Dept. of Mechanical Engineering Ann Arbor, MI, United States [email protected] Pedro Sequeira SRI International Artificial Intelligence Center Menlo Park, CA, United States [email protected] David V. Pynadath University of Southern California Institute for Creative Technologies Los Angeles, CA, United States [email protected] 3 2 0 2 r a M 1 ] I A . s c [ 2 v 8 3 2 0 1 . 2 0 3 2 : v i X r a ABSTRACT We approach the problem of understanding how people interact with each other in collaborative settings, especially when individu- als know little about their teammates, via Multiagent Inverse Rein- forcement Learning (MIRL), where the goal is to infer the reward functions guiding the behavior of each individual given trajectories of a team's behavior during some task. Unlike current MIRL ap- proaches, we do not assume that team members know each other's goals a priori; rather, that they collaborate by adapting to the goals of others perceived by observing their behavior, all while jointly performing a task. To address this problem, we propose a novel approach to MIRL via Theory of Mind (MIRL-ToM). For each agent, we first use ToM reasoning to estimate a posterior distribution over baseline reward profiles given their demonstrated behavior. We then perform MIRL via decentralized equilibrium by employing single-agent Maximum Entropy IRL to infer a reward function for each agent, where we simulate the behavior of other teammates ac- cording to the time-varying distribution over profiles. We evaluate our approach in a simulated 2-player search-and-rescue operation where the goal of the agents, playing different roles, is to search for and evacuate victims in the environment. Our results show that the choice of baseline profiles is paramount to the recovery of the ground-truth rewards, and that MIRL-ToM is able to recover the rewards used by agents interacting both with known and unknown teammates. KEYWORDS Inverse Reinforcement Learning; Multiagent Systems; Theory of Mind; Decentralized Equilibrium; Cooperation ACM Reference Format: Haochen Wu, Pedro Sequeira, and David V. Pynadath. 2023. Multiagent Inverse Reinforcement Learning via Theory of Mind Reasoning. In Proc. of the 22nd International Conference on Autonomous Agents and Multiagent Systems (AAMAS 2023), London, United Kingdom, May 29 – June 2, 2023, IFAAMAS, 9 pages. 1 INTRODUCTION Understanding the underlying strategies of how humans interact with each other in collaborative teaming scenarios is a vital compo- nent of creating systems that appropriately predict team behavior, understand collaboration dynamics, and provide assistance to po- tentially improve performance. This is particularly challenging Proc. of the 22nd International Conference on Autonomous Agents and Multiagent Sys- tems (AAMAS 2023), A. Ricci, W. Yeoh, N. Agmon, B. An (eds.), May 29 – June 2, 2023, London, United Kingdom. © 2023 International Foundation for Autonomous Agents and Multiagent Systems (www.ifaamas.org). All rights reserved. when people are collaborating for the first time and therefore know little about the goals, strategies, and intentions of others, yet have to adapt to each other as they perform a cooperative task. One way to predict what individuals will do is to create models of their decision-making process given traces of their behavior, using machine learning techniques. One approach is to learn a policy, i.e., a mapping from states to actions, directly from observation. This includes imitation learning techniques, e.g., behavior cloning [12] that has the power of replicating the behavior of others without the need for environment and dynamics modeling [22]. However, such approaches lack the capability of understanding the under- lying intentions of individuals or the goals in the task. Further, in teamwork settings, knowing the policy of individuals alone makes it hard to understand how they coordinate their behavior [25], or whether there are impediments to cooperation, e.g., a mismatch between the preferences of each team member. An alternative, more robust method is to assume that the be- havior of each individual is the result of a Reinforcement Learning (RL) process, where agents learn how to perform a task through trial-and-error interactions with a dynamic and uncertain environ- ment [20]. The goal of an RL agent is specified by a reward function that encodes its preferences and whose output the agent wants to maximize over its lifetime. Therefore, understanding the underly- ing strategy of an individual by observing its behavior relies on recovering the reward function guiding the behavior during task performance. This problem is known as Inverse Reinforcement Learning (IRL) [3, 11] and involves inferring the reward function used by an individual, referred to as the expert, given traces of its behavior. IRL has advantages compared to imitation learning ap- proaches in that the reward function is the most succinct and robust representation of the expert's goals and allows for the prediction of behavior in novel situations or different tasks (generalization) [11]. Within IRL, apprenticeship learning [1] established a linear pro- gramming method to match the learned reward model to the feature counts derived from state-action pairs in the expert's demonstra- tions. A game-theoretic approach [21] was also proposed to learn from playing repeated games even in the absence of experts. Maxi- mum margin IRL [18] formulates a quadratic problem to find the reward solution producing behavior paths that are closer to the expert's behavior than others by a margin that scales with the path difference loss. One of the main challenges of IRL that is addressed by these approaches is that the IRL problem is ill-posed - the same observed behavior can be explained by multiple reward functions, and the same reward function can lead to different behaviors un- der stochastic dynamics [3]. To resolve this ambiguity, many IRL Figure 1: Overview of the proposed approach for Multiagent Inverse Reinforcement Learning via Theory of Mind reasoning (MIRL-ToM). Given the environment and the demonstrated behaviors of a team of humans, each learner agent performs single- agent IRL by reasoning about other agents' behavior via ToM and output the resulting reward functions. algorithms provide probabilistic formulations by finding the re- ward function that maximizes the likelihood of the demonstrated trajectories. In particular, Maximum entropy (MaxEnt) IRL [27] finds a trajectory distribution where the expert demonstrations are exponentially preferred. Bayesian IRL [17] presents an efficient sam- pling method to infer the posterior distributions of reward function parameters. Understanding the strategies and intentions underlying the be- havior of a team in collaborative tasks requires extending IRL to multiagent settings, which is known as Multiagent Inverse Rein- forcement Learning (MIRL). In MIRL, the goal is to infer the indi- vidual reward functions guiding the behavior of each agent, given trajectories of a team's (joint) behavior. It is often assumed that the joint behavior is the result of an equilibrium solution concept, such as Nash equilibrium [5, 7]. This makes the MIRL problem harder because, in addition to multiple reasonable reward functions given the demonstrations, there may be multiple equilibria that are a solution to a combination of individual rewards [5, 9]. Many of the existing approaches to MIRL assume the existence of a centralized learner that computes the joint action equilibrium given the (known) reward functions of each individual [9, 19, 23]. This implies that all individuals perfectly know each other's pref- erences (task payoffs/reward functions) at all times and then play according to the equilibrium solution. However, assuming perfect information about others in a team might be too restrictive. First, the individuals might be interacting with unknown teammates, e.g., the observed behavior was produced by individuals recruited to per- form a collaborative task who tried to adapt to each other's behav- iors while performing the task. Second, the assumptions formed by each individual regarding the teammates' goals and intentions, cre- ated by observing their behavior, might be incorrect due to the noisy nature of human behavior. Finally, because individuals are adapting their behavior to that of their team members (non-stationarity), the assumptions about their preferences must constantly be updated as a result of the individuals' interaction. All of this makes it less likely that a team's demonstrated behavior was derived from a unique, stationary, known a priori equilibrium. To address the aforementioned issues, we borrow the concept Theory of Mind (ToM) from cognitive science [24] which ascribes mental states to explain and predict the actions of others. In par- ticular, we model each individual as adapting to the behavior of the teammates by maintaining a probability distribution over base- line behavior profiles for each other member of the team, which is updated as the task unfolds and interactions between team mem- bers occur. Computationally, these profiles correspond to domain- specific reward models encoding typified preferences in a task. We then split MIRL into two phases (see overview in Fig. 1): (1) Model inference: for each individual in the team, we use ToM reasoning to estimate a posterior distribution over baseline profiles for each other teammate given their behavior in- cluded in the trajectories - this models how each team member might have modeled each other by observing their behavior during task performance. (2) Decentralized MIRL: We perform MIRL via a decentralized equilibrium approach where we break down the MIRL prob- lem into multiple single-agent IRL problems similar to the approach in [5]. A reward function is inferred given the cor- responding individual's demonstrated behavior via MaxEnt IRL, where we simulate the behavior of other team mem- bers according to the time-varying distribution over baseline profiles computed in Phase 1 - this models best-response strategies conditioned on the perceived models of others. The analogy between IRL and ToM has been drawn in [8] to link the mental states of humans to the reward models of IRL agents [14]. Despite applications of ToM in multiagent RL [16], limited research has been done to investigate the underlying strategic behaviors and motivations of teams in the MIRL setting. The main contribution of this paper is a decentralized MIRL framework using ToM reason- ing (MIRL-ToM) that extends MaxEnt IRL to multiagent settings. Our framework allows modeling interactions between arbitrarily unknown teammates under the assumption of a set of baseline reward profiles. We deal with uncertainties in the intentions of other teammates by performing ToM reasoning over the profiles in a Bayesian setting. We evaluate our approach in a simulated 2-player search-and- rescue task where each agent plays a different role with a distinct set of skills in the task. We designed rewards for each agent that include both task- and social-related aspects allowing for different types of coordination strategies to emerge. We assess the capability of our MIRL-ToM approach in recovering the original reward functions of agents given different sets of baseline profiles. Overall, our results show that the choice of baseline profiles in Phase 1 is paramount to the recovery of ground-truth rewards in phase 2. In particular, including baseline profiles corresponding to the opposite goals of team-members prevents the convergence of MaxEnt IRL, while including baselines whose goals are close to those of the original teammates leads to reward functions similar to the ground-truth. Further, we show that our method, using ToM reasoning over the demonstrated behaviors, can be used to recover the rewards used by agents interacting both with known and unknown teammates, which attests to the robustness of our approach. 2 RELATED WORK Generalizing IRL to multiagent systems is hard, because we aim to learn individual reward functions that explain both how each agent behaves-which involves recovering the rewards via IRL-and how together the agents coordinate-that involves modeling the joint behavior as a solution to an equilibrium concept. Within MIRL, in [10] an algorithm was developed to train a centralized agent that optimizes coordination of behaviors for traffic-routing problems; however, while learning the rewards via IRL, the agents ignore their teammates which are treated as part of the environment. In [9], Bayesian inference is performed on zero-sum two-person games by optimizing rewards under a likelihood function that encodes the notion of a minimax equilibrium, but the solution is not scalable to n-player games and complex domains. Further, many MIRL so- lutions rely on computing some notion of equilibrium given the individual reward functions at each iteration. Some approaches deal with competitive games by learning Markov perfect equilib- rium policies given individual rewards [19], playing against Nash Equilibrium policies through adversarial training [23], evaluating undesirable strategic behavior by extracting utility functions from demonstrations [5], and leveraging Generative Adversarial Net- works [4] to retrieve reward functions in high-dimensional domains [26]. However, these methods still require finding an equilibrium policy throughout learning, and it is assumed that experts have perfect knowledge of the goals and intentions of their teammates, ignoring the dynamic nature of interactions and the possibility of first encounters. The proposed MIRL-ToM, combining ToM reason- ing with single-agent MaxEnt IRL, is able to not only decentralize the model reasoning and reward learning process but also considers situations of unknown teammates and adaptation via belief updates over a set of baseline reward profiles. 3 BACKGROUND 3.1 Reinforcement Learning Reinforcement learning (RL) [20] relies on the formalism of (single- agent) Markov Decision Process (MDP), which is defined as a tuple of ⟨S, A,T , R, γ⟩, where s ∈ S is a finite set of states, a ∈ A is a finite set of actions, T := Pr (s ′, a, s) is the transition probability between states given an action, R := R(s, a) is the reward of reaching a state and performing an action, and γ ∈ [0, 1) is the discount factor that encourages receiving larger reward at earlier steps. Under the Bellman equations, the optimal quality value of an action given a state satisfies Q∗ (s, a) = R(s, a) +γEs′∼T [maxQ∗ (s ′, a′)]. (Forward) RL algorithms find the optimal policy π : S → A that can be retrieved using π ∗ = argmaxaQ∗ (s, a). 3.2 Inverse Reinforcement Learning Inverse Reinforcement Learning (IRL) [11] represents the inverse problem of RL, i.e., finding the reward function R of the learner agent given S, A,T and a collection of demonstrated trajectories D = {ζ0 . . . ζi . . . } following the internal policy of an expert. Each trajectory ζi = {(s0, a0) . . . (s j , a j ) . . . (st , at )} consists of state- action pairs over t steps. IRL aims to find the reward function parameters that maximize the likelihood of demonstrations. Maxi- mum Entropy IRL [27] (MaxEnt IRL) utilizes the principle of maxi- mum entropy and assumes that the demonstrated action given a state is exponentially preferred over other actions. MaxEnt IRL con- siders the trajectory reward R(ζ ) as a linear combination of state feature counts (i.e., R(ζ ) = θT φ (ζ )) and iteratively finds the param- eters θ ∗ = arg maxθ Eζ ∼Pr (ζ |θ ) [(cid:205)j r (s j , a j |θ )] that best reproduce the demonstrated behaviors such that the probability of taking a trajectory ζ is proportional to the exponential of the rewards along the path (i.e., Pr (ζ |θ ) ∝ eR (ζ ) ). 3.3 Multiagent Inverse Reinforcement Learning Multiagent Inverse Reinforcement Learning (MIRL) extends IRL to multiagent settings. The collected team trajectories are denoted as D = {ζ0 . . . ζi . . . }, where ζi = {(s0, ˆa0) . . . (s j , ˆa j ) . . . (st , ˆat )} is each team trajectory in the form of state-joint action pairs (s j , ˆa j ) over t steps, where ˆak j denotes the action of agent k at step j. MIRL then aims to recover a set of reward function parameters for all agents Θ∗ = {θ ∗} = arg maxΘ Eζ ∼Pr (ζ |Θ) [(cid:205)j r (s j , ˆa j |Θ)] that best match the collected team trajectories. 3.4 PsychSim We implemented our approach using PsychSim [13], a framework that models decision-theoretic agents with recursive Theory-of- Mind (ToM) for interactive social simulation [13]. To achieve this, PsychSim models world dynamics under the Multiagent Partially- Observable Markov Decision Process (MPOMDP) formalism [2, 15]. At each step, each agent selects an action based on the values computed for each available action by assessing risk/reward trade- offs in decisions up to a specified planning horizon (cumulative discounted reward), conditioned on the actions of others. Namely, during planning each agent computes the action values for all other agents using recursive ToM, where others are considered reward maximizers under the (mental) models that the agent has of them. To model uncertainty, agents can form beliefs about the state of the environment and the models of other agents, which are updated via Bayesian inference based on observations of state features and the actions of others, respectively. 4 MULTIAGENT INVERSE REINFORCEMENT LEARNING VIA THEORY OF MIND We assume that individuals in a team coordinate their behavior without explicit communication. In such cases, they need to reason 4.2 Decentralized MIRL After each learner agent computes the (time-varying) beliefs about the expected reward models of its teammates, we perform decen- tralized MIRL by computing a reward function for each individual agent separately. Without loss of generality, here we assume that the reward functions R(s, a) := θT φ (s, ˆa) are linear combinations of (potentially nonlinear) reward features φ (s, ˆa) parameterized by reward weights θ . We follow the maximum entropy principle to find the individual reward function where the demonstrated trajectories of the agent are exponentially preferred [27], i.e.: Figure 2: Two phases of the Multiagent Inverse Reinforce- ment Learning via Theory of Mind θ ∗ = arg max θ L (θ |b (m)) = arg max θ ∑︁ ζi ∈ D log Pr (ζi |θ, b (m)) (2) about the goals and intentions of others while computing their own actions. We also assume the existence of a set of baseline agent profiles that encode domain-specific, notional preferences in the task of interest. For example, in a search-and-rescue task, this might correspond to having profiles for trying to search for victims, triage them, calling for backup, etc. Before a task, an individual might assume that teammates behave according to a prior distribution over the baseline profiles, e.g., uniform, or a preference given to a profile given background information. As the task progresses and individuals observe the behavior of others, this distribution is updated accordingly. We propose Multiagent Inverse Reinforce- ment Learning via Theory of Mind (MIRL-ToM) to allow reasoning about others' behavior while performing a task, corresponding to a decentralized approach to learn the reward functions of each team member. The approach consists of two phases as shown in Fig. 2, the details of which are discussed in the following sections. 4.1 Model Inference In the model inference phase, we use ToM reasoning to update a probability distribution (belief) over baseline profiles given the behavior of an agent in the trajectories. Before the inference process, we pre-select the set of baseline profiles for each agent. In general, the profiles can encode any agent decision-making model, and we denote the initial profile set by {mi }. In this paper, we consider profiles to correspond to predefined reward functions, i.e., reward profiles. Let us denote by bk (m) the prior distribution that an agent holds over the models of another agent k. For each step of each trajectory ζi , bk (m) is updated via Bayesian inference: b ′(m) ∝ Pr (a|m, ζ ) × b (m|ζ ) (1) where we drop the agent indexing k for convenience. This phase augments the team trajectories, ˆD = { ˆζi }, by adding the agent's belief over agent models at each step, resulting in a set of state-joint action-model distribution tuple sequences: ˆζi = {(s j , ˆa j , b j (m)}. In loose terms, this phase captures how the intentions of agents could be modeled by others given their actions in the trajectories, conditioned on a set of agent profiles and the prior distribution.1 We propose an algorithm that extends the MaxEnt IRL [27] to the MIRL setting via decentralized equilibrium computation, where at each iteration, we approximate the distribution over paths of an agent conditioned on both the current reward weight and the belief over agent models computed in the model inference phase, as shown in Alg. 1. For ease of explanation, in Alg. 1 we show the case where the team contains only two agents, i.e., there is only one model distribution, b (m), to be computed. To solve the MIRL problem, we learn a reward weight vector θk for each individual agent k by iteratively improving according to whether the weight vector leads to the behavior similar to that exhibited by the cor- responding expert in the demonstrated trajectories, as measured by comparing the estimated feature counts (FCs) against the em- pirical FCs (Alg. 1, line 5). Therefore, we achieve a decentralized equilibrium by having each individual reward function be the solu- tion to the best response strategy to the perceived models of the other agents during estimated FCs computation. We note that, as an advantage to this approach, the learning process for each agent can be completely distributed and parallelized. At each iteration, we assume the existence of a forward RL solver computing the policy πk given the current reward weight vector candidate, θk , where the actions of the other agent are optimized according to the distribution over models b (m) at each timestep (Alg. 1, line 8). During the gradient descent step (Alg. 1, lines 9-11), the estimated Algorithm 1 Decentralized MIRL via ToM 1: D ← Collection of team trajectories 2: for each learner agent k do 3: b0 (m): prior model distribution, φ (s, a): feature vector ˆD = { ˆζi } ← Model inference on D using ToM reasoning φk φ (s j , ˆak emp ← (cid:205)ζi ∈ D j ) Initialize reward vector weights θk (s j , ˆak j ) ∈ζi (cid:205) 4: 5: 9: 10: 11: 6: 7: while θk not converging do 8: πk (a|s, b (m), θk ) ← forward pass φk est ← (cid:205)ζi ∼π (cid:205) (s j , ˆak ∇L(θk ) ← φk est − φk θk ← θk − α∇L(θk ) j |b j (m)) ∈ζi emp Pr (s j |πk, θk )φ (s j , ˆak j ) 1We note that the initial set of profiles and the prior distribution need not to be the same for all observing agents. Similarly, the belief update process can be different for distinct agents observing the same teammate, e.g., by restricting observability to local interactions between agents. end while 12: 13: end for 14: return {θk } Figure 4: Transition dynamics of the victim status. sear ch ei- ther finds a victim or an empty cell, tr iage prepares a victim and requires two agents at the same location to evacuate it. allows an agent to incentivize others to come to its location. The state transition of the victims' status is deterministic, the dynamics of which are illustrated in Fig. 4. As denoted by the red arrow, to model the need for cooperation, we require the two agents to be at the same location and perform action evacuate at the same time for a victim to be evacuated. Table 1: Ground-truth reward functions for the two agents as linear combinations of features φi weighted by θi. ■ Role-Related Tasks ■ Social/Helping φi (s, a) Dist2Vic Search Triage Evacuate Wait Call Description θi Distance to the nearest f ound victim 0.06 0.06 Whether to search unknown locations 0.19 Whether to triage f ound victims 0.63 Whether to evacuate ready victims 0.03 Whether to standby 0.03 Whether to call for help if needed (a) Medic φi (s, a) Dist2Help Search Evacuate Description θi 0.25 Distance to the agent with call action 0.25 Whether to search unknown locations 0.50 Whether to evacuate ready victims (b) Explorer 5.1.2 Ground-Truth Agents (Experts). We consider a team of two agents with designated roles-Medic and Explorer-each defining different action sets and reward functions. The Medic agent has the full action set, while the Explorer agent is not able to wait, triage, or call, i.e., it can only explore the environment. The reward func- tion of each agent R(s, a) := (cid:205)i θiφi (s, a) is linearly parameterized by ground truth weights θ as defined in Table 1. The distance fea- tures compute the Manhattan distance from the agent to the target location. The action-related features are indicator functions that denote whether an action was taken in the current state. As seen in Table 1, reward features are categorized into role-related task features (orange) and social features (blue). We model the Medic as prioritizing the rescue of victims, while the Explorer prioritizes searching but also reacts to the call for help from the Medic. 5.2 Collecting and Visualizing Trajectories Given the ground-truth reward functions defined in Table 1, we start with the case where the two agents interact with each other and perform the task knowing exactly each other's reward function (perfect models). Notwithstanding, we note that the MIRL-ToM procedure is unaware of this and is only given the generated team Figure 3: Forward pass of feature count estimation. Each learner agent uses the model distribution data to select the actions of other agents and select an action given the cur- rent reward model. The feature counts are computed from the environment states and the team actions. FCs φest are computed by sampling Monte Carlo trajectories using the resulting joint policy. This process can be visualized in Fig. 3. 5 RESULTS To assess the effectiveness of the proposed MIRL-ToM approach, we consider a collaborative environment and a team of two agents. Instead of evaluating our approach with real human data, where the underlying reward functions cannot be accessed, here we specify a set of ground-truth rewards, collect trajectories by having the agents maximize those rewards according to some predefined model of others, and then compare the learned to the ground-truth reward functions for each agent. This is a necessary first step to assess the capabilities (and limitations) of our approach before testing with human data.2 5.1 Experiment 5.1.1 Environment. We designed a collaborative multiagent search- and-rescue (S&R) operation using PsychSim [13] which allows the modeling of partial observations, stochastic state-action dynamics, and ToM reasoning via agent modeling. In our S&R task, two agents need to cooperate in order to search all locations in a gridworld environment and evacuate all victims as quickly as possible. Ini- tially, the victims' locations are unknown to the agents, which we model via a uniform belief over the existence of victims in each location, which is set to the real value once agents enter the corre- sponding cell. The state of the environment s ∈ S := SP 1 × * * * × SP n describes a gridworld with n locations, where each location has a feature v ∈ V := {unknown, f ound, ready, clear, empty} denoting the victim status at that location. The action set includes three types of actions: 1) movement actions: {up, down, le f t, right, wait } that deterministically move the agent in the corresponding direction, 2) victim-handling actions: {search, triage, evacuate} that changes the victim status feature, and 3) communication action, call, which 2Our implementation and experiments are available at https://github.com/usc- psychsim/mirl-tom-aamas23. Figure 5: An example trajectory at timestep t = 4 (left), t = 10 (center), and t = 16 (right) for the Medic (top) and Explorer (bottom) agents. trajectories and a set of baseline profiles. The goal is to test the importance of different priors over profiles for the recovery of the original rewards. We collected 16 trajectories, each with 25 steps, for the team of agents, produced by having the agents plan with a horizon of 2 using a soft-max action selection. Fig. 5 shows the collaborative behavior of two agents at three different steps in one example trajectory. At t = 4, the Medic calls for help, and the Explorer moves toward the Medic instead of searching or moving away; t = 10 illustrates role-dependent actions: the Medic is waiting, because all victims are either unknown or clear, while the Explorer keeps searching other locations; at t = 16, both agents evacuate the victim together.3 5.3 Model Inference Results Based on the reward features φi detailed in Sec. 5.1.2, we designed a set of baseline profiles as shown in Table 2 by creating different variations of the ground-truth rewards and the task- and social- oriented features. The goal was to create a set of reward functions one would typically expect individuals to follow in our S&R task. From these reward profiles, we define the following experimental conditions, i.e., each defining the set of agent models/profiles used in the Model Inference phase (see Sec. 5.3): Table 2: Baseline reward profiles Reward Function Description Gt Op Rd Tk Sc θgt −θgt θ0 [θtask, θsocial = 0] [θtask = 0, θsocial ] Ground truth rewards Opposite goals No goals / random behavior Focus on task-specific aspects Focus on social aspects cond-1: Gt, always believe the other agent uses Gt rewards. cond-2: Op, always believe the other agent uses Op rewards. cond-3: Gt-Op-Rd, update belief b ({Gt, Op, Rd }) via ToM. cond-4: Rd-Tk-Sc, update belief b ({Rd,T k, Sc}) via ToM. 3Example simulated animations showing the agents interacting in the S&R environ- ment are included HERE as the supplementary material. Figure 6: Average model probabilities with standard devia- tions (shaded) of 16 trajectories for Medic (top) and Explorer (bottom) agents under two experimental conditions: cond-3 (Gt-Op-Rd, left) and cond-4 (Rd-Tk-Sc, right). Condition cond-1 corresponds to the setting where the learner agent uses the ground-truth rewards of the other (perfect model) to compute the estimated FCs during MaxEnt IRL. The rationale is to assess the best-response (decentralized equilibrium) computation during single-agent IRL. cond-2 presents a situation where the learner agent always believes its teammate has goals opposite to those of the ground-truth agent. Here we assess the importance of agent co-dependencies in the task and test the limits of MIRL in recovering the original rewards given contradictory models of others. For these first two conditions, the model distribution is fixed so we do not perform model inference via ToM reasoning. In contrast, cond-3 and cond-4 both use ToM reasoning. cond-3 verifies the accuracy of the model inference procedure in identifying the ground truth model given the observed behavior, while cond-4 investigates whether MIRL-ToM can still recover rewards close to the original without being given the Gt model given, i.e., such as it might happen when analyzing real human data. For cond-3 and cond-4, we perform Bayesian inference using PsychSim by computing the posterior distribution over agent mod- els given their behavior at each step of the 16 collected trajectories using Eq. 1. The mean model probabilities at each timestep are shown in Fig. 6. In cond-3 (Fig. 6 left), the Gt models can clearly be identified apart from the Rd models, meaning that the observed behavior does denote different agent strategies (otherwise, a ran- dom behavior could be equally probable). In addition, the Op model has a very low associated probability at the end of trajectories. For cond-4 (Fig. 6 right), the Medic agent is identified as being more task-oriented, which makes sense since it has available the full action set. However, for the Explorer agent, it is harder to differen- tiate between the Tk and Sc models, meaning that the ground-truth behavior is perceived as being equally task- and social-oriented. 5.4 Decentralized MIRL Results We applied the proposed decentralized MIRL-ToM approach in each of the aforementioned experimental conditions, with initially uniform reward weights (θ0), maximum 30 IRL training epochs, and a learning rate (α) exponential decay of 0.9. For the forward pass (Alg. 1, line 8), we collected 16 Monte Carlo trajectories in PsychSim to estimate the FCs. cond-4 14.48 2.06 2.94 2.66 7.78 4.44 4.50 0.13 Figure 7: Learning curves of the reward weights during IRL for Medic (top) and Explorer (bottom) in two experimental condi- tions: cond-2 (left) and cond-3 (right). Table 3: Learned reward functions for the two agents, for all conditions in the known teammates setting. Table 4: Similarity of recovered behavior for the two agents, for all conditions in the known teammates setting. Feature φi (s, a) Dist2Vic Search Triage Evacuate Wait Call Profile θi Op Gt -0.06 0.06 -0.06 0.06 -0.19 0.19 -0.63 0.63 -0.03 0.03 -0.03 0.03 MIRL θi cond-1 0.02 0.18 0.23 0.25 0.27 0.06 (a) Medic cond-2 - - - - - - MIRL-ToM θi cond-4 cond-3 0.00 0.02 0.16 0.16 0.29 0.27 0.28 0.26 0.26 0.23 0.01 0.06 Feature φi (s, a) Dist2Vic Search Triage Evacuate Wait Call MIRL cond-1 cond-3 Op Gt Empirical Feature Counts 11.86 2.40 2.97 2.94 8.97 4.78 11.53 1.75 2.91 2.81 10.88 2.72 0.00 0.00 0.00 0.00 0.00 0.00 15.39 3.13 2.97 2.63 6.28 4.38 Profile MIRL-ToM MIRL θi cond-2 - - - MIRL-ToM θi cond-4 cond-3 0.26 0.62 0.43 0.21 0.30 0.17 Profile θi Feature φi (s, a) Op Gt -0.25 Dist2Help 0.25 -0.25 0.25 Search -0.50 0.50 Evacuate cond-1 0.01 0.23 0.76 (b) Explorer The learned reward functions inferred via MIRL-ToM for each condition are summarized in Table 3. We observe that the reward weights obtained for cond-3 and 4 using ToM reasoning are very close to those of cond-1, where the Gt model is used for both agents. Especially for cond-4, we see that model inference via ToM cap- tured the behavior of the teammates accurately enough to allow for the recovery of the original behavior. Some results in this table can better be understood by looking at the learning curves, i.e., the evolution of the reward weights θi at each IRL iteration. In particu- lar, Fig. 7 shows the curves for cond-2 and cond-3. As can be seen, the reward weights converge to their final values approximately within 15 training epochs except for cond-2, where agents always believe the other agent uses the Op model. The reward weights for this condition were not able to converge (Fig. 7, left), either oscillat- ing or not converging within the maximum number of iterations.4 Because the agent uses an incorrect model of its teammate, the resulting coordination behavior, computed via the best-response 4The seemingly converging curves are due to the decreased learning rate α. Similarity Metrics FC Diff π Div 2.38 0.00 30.55 0.25 4.52 0.13 7.53 0.10 (a) Medic Feature φi (s, a) Profile Op MIRL cond-1 MIRL-ToM cond-3 cond-4 Gt Empirical Feature Counts Dist2Help 6.50 6.59 Search 2.94 Evacuate 0.00 0.00 0.00 2.41 7.06 2.81 6.45 6.34 2.63 4.24 7.38 2.66 Similarity Metrics 2.25 0.00 2.13 0.03 FC Diff π Div 3.06 14.84 0.02 0.32 (b) Explorer strategy learned by the agent given the current rewards and the other's model distribution (Alg. 1, line 8) leads to feature counts that are inconsistent with the empirical ones (lines 9-10), which in turn leads to a dramatic change in the reward vectors (line 11) in the next iteration. 1.26 0.04 As shown in Table 3, the reward weights recovered through IRL do not exactly match the ground-truth rewards (Gt column). Still, they allow us to recover the relative importance that some features have on the agents' behavior, e.g., dealing with victims (including waiting for the Explorer for evacuation) is more important for the Medic agent, while searching for and evacuating victims are Table 5: Similarity of recovered behavior for the two agents in the unknown teammates setting. Feature φi (s, a) Demo θgt MIRL-ToM θirl Empirical Feature Counts Dist2Vic Search Triage Evacuate Wait Call FC Diff 14.05 1.99 2.49 2.68 7.13 5.88 Similarity Metric - (a) Medic 14.44 2.16 2.97 2.81 7.88 5.25 2.55 Feature φi (s, a) Demo θgt MIRL-ToM θirl Empirical Feature Counts Dist2Help Search Evacuate 6.49 8.25 2.68 Similarity Metric FC Diff - 7.23 6.50 2.81 2.63 (b) Explorer the priorities of the Explorer agent. As discussed earlier, different reward functions can lead to similar behavior, so a better way to investigate the similarities between the learned and expert behavior is by using similarity metrics. Here we use the following: FC Diff: feature count difference between a policy using the IRL rewards vs. demonstrated behavior: (cid:205)i |φθ i − φ D i |. π Div: mean Jensen-Shannon Divergence[6] between the action distributions of the ground-truth and learned policy, over all steps in all trajectories: JSD (π (a j |s j ; θ ), π (a j |s j ; θgt )). The results are summarized in Table 4. The Profile columns corre- spond to the best (Gt) and worst (Op) behavior similarities achieved. The FC Diff for Gt denotes the expected error in sampling policies using the same rewards but different random seeds (hence not zero). As the number of simulated trajectories (currently 16) increases, the FC Diff would approach to zero. The MIRL column shows very sim- ilar feature counts and behavior, which is again expected because it corresponds to using a fixed Gt model of the teammate (no ToM). As for the MIRL-ToM columns, they show that our method can achieve very similar behavior (highlighted in bold), which denotes the importance of the model inference phase. Interestingly, more similar behavior was attained in cond-4, which does not include the Gt rewards in the model distribution, although we did not as- sess the statistical significance of this result. We also note that π Div is not as close to zero due to the observed difference in the reward weights in Table 3, and the probabilities are dependent on the reward weight magnitude. 5.5 Unknown Teammates Setting In this section, we consider demonstrations that are collected from a team of agents who form beliefs about each other's goals and update them based on observations of their behavior during task performance. We again use PsychSim to generate the demonstrated trajectories, but now the expert agents infer the models of each other given a uniform prior over three reward profiles: Gt, Op and Rd. We applied MIRL-ToM by performing model inference given the demonstrations followed by MaxEnt IRL for each agent. In Table 5, we compare the empirical feature counts, computed from the demonstrations (column Demo) where agents use the ground- truth rewards, θgt , with the feature counts produced by the agents using the reward weights resulting from MIRL-ToM, θirl . The results show that even in the case where the demonstrations are generated by agents that have imperfect models of their team- mates, our approach can recover similar behavior. By performing model inference, we are able to model the process whereby the in- dividuals "discover" about and adapt to their teammates' behavior. 6 CONCLUSIONS We proposed an approach to Multiagent Inverse Reinforcement Learning using Theory of Mind reasoning (MIRL-ToM). Unlike other approaches to MIRL, our method does not assume full knowl- edge of teammates' reward functions while performing the task to compute the equilibrium strategy. Rather, we use ToM to reason about how each individual might have modeled the intentions of others by observing their behavior throughout the task, given a set of baseline reward profiles. We then break down MIRL into single- agent MaxEnt IRL for each individual, where we infer the reward functions guiding their behavior conditioned on the inferred distri- bution over profiles. Ascribing mental states and reward models of teammates not only accounts for imperfect knowledge about indi- vidual behavior and uncertain strategies of others but also enables a computationally efficient approach to compute the equilibrium strategy in a decentralized manner. The proposed MIRL-ToM shows the ability to recover similar behavior in terms of trajectory feature counts in both known- and unknown-teammate cases. In addition, although we experimented with a 2-player collaborative scenario, our framework can be applied to n-player, general-sum problems. Our preliminary experiments were conducted using synthetic expert demonstration data to show the validity and effectiveness of MIRL-ToM. A natural next step is to apply the method to data collected from humans to provide insights into which factors-task-, social-, and emotional-related-affect their behavior the most in collaborative settings. Further, we will explore more interpretable reward structures that do not rely on linear relationships between basis features. We are also interested in exploring ways to create the baseline profiles, because the effectiveness of MIRL-ToM seems to rely heavily on the initial set. One option is to create an iterative approach, whereby the learned reward functions in one iteration are added to the set of baseline profiles until convergence. ACKNOWLEDGMENTS This material is based upon work supported by the Defense Ad- vanced Research Projects Agency (DARPA) under Contract No. W911NF-20-1-0011. Any opinions, findings and conclusions or rec- ommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the Defense Advanced Research Projects Agency (DARPA). [26] Lantao Yu, Jiaming Song, and Stefano Ermon. 2019. Multi-Agent Adversarial Inverse Reinforcement Learning. Proceedings of the 36th International Conference on Machine Learning (2019), 7194–7201. [27] Brian D. Ziebart, Andrew Maas, J. Andrew Bagnell, and Anind K. Dey. 2008. Maximum Entropy Inverse Reinforcement Learning. AAAI Conference on Artificial Intelligence (2008), 1433–1438. REFERENCES [1] Pieter Abbeel and Andrew Y. Ng. 2004. Apprenticeship Learning via Inverse Reinforcement Learning. Proceedings of the Twenty-First International Conference on Machine Learning (2004). [2] Christopher Amato and Frans A. Oliehoek. 2015. Scalable Planning and Learning for Multiagent POMDPs. Proceedings of the Twenty-Ninth AAAI Conference on Artificial Intelligence (2015), 1995–2002. [3] Saurabh Arora and Prashant Doshi. 2021. A survey of inverse reinforcement learning: Challenges, methods and progress. Artificial Intelligence 297 (2021), 103500. [4] Chelsea Finn, Paul F. Christiano, Pieter Abbeel, and Sergey Levine. 2016. A Connection between Generative Adversarial Networks, Inverse Reinforcement Learning, and Energy-Based Models. CoRR abs/1611.03852 (2016). [5] Justin Fu, Andrea Tacchetti, Julien Perolat, and Yoram Bachrach. 2021. Evaluating Strategic Structures in Multi-Agent Inverse Reinforcement Learning. Journal of Artificial Intelligence Research 71 (9 2021), 925–951. [6] B. Fuglede and F. Topsoe. 2004. Jensen-Shannon divergence and Hilbert space embedding. In Proceedings of the International Symposium on Information Theory, 2004. (SIT 2004). 31–37. https://doi.org/10.1109/ISIT.2004.1365067 [7] Junling Hu and Michael P. Wellman. 1998. Multiagent Reinforcement Learning: Theoretical Framework and an Algorithm. Proceedings of the Fifteenth Interna- tional Conference on Machine Learning (1998), 242–250. [8] Julian Jara-Ettinger. 2019. Theory of mind as inverse reinforcement learning. Current Opinion in Behavioral Sciences 29 (2019), 105–110. https://doi.org/10. 1016/j.cobeha.2019.04.010 Artificial Intelligence. [9] Xiaomin Lin, Peter A. Beling, and Randy Cogill. 2018. Multiagent Inverse Re- inforcement Learning for Two-Person Zero-Sum Games. IEEE Transactions on Games 10, 1 (2018), 56–68. [10] Sriraam Natarajan, Gautam Kunapuli, Kshitij Judah, Prasad Tadepalli, Kristian Kersting, and Jude Shavlik. 2010. Multi-Agent Inverse Reinforcement Learning. 2010 Ninth International Conference on Machine Learning and Applications (2010), 395–400. [11] Andrew Y. Ng and Stuart J. Russell. 2000. Algorithms for Inverse Reinforcement Learning. Proceedings of the Seventeenth International Conference on Machine Learning (2000), 663–670. [12] Dean A. Pomerleau. 1991. Efficient Training of Artificial Neural Networks for Autonomous Navigation. Neural Computation 3, 1 (1991), 88–97. https://doi.org/ 10.1162/neco.1991.3.1.88 [13] David V. Pynadath and Stacy C. Marsella. 2005. PsychSim: Modeling Theory of Mind with Decision-Theoretic Agents. International Joint Conferences on Artificial Intelligence (2005), 1181–1186. [14] David V. Pynadath, Paul S. Rosenbloom, and Stacy C. Marsella. 2014. Reinforce- ment Learning for Adaptive Theory of Mind in the Sigma Cognitive Architecture. Artificial General Intelligence (2014), 143–154. [15] David V. Pynadath and Milind Tambe. 2002. The Communicative Multiagent Team Decision Problem: Analyzing Teamwork Theories and Models. Journal of Artificial Intelligence Research 16, 1 (6 2002), 389–423. [16] Neil Rabinowitz, Frank Perbet, Francis Song, Chiyuan Zhang, S. M. Ali Eslami, and Matthew Botvinick. 2018. Machine Theory of Mind. Proceedings of the 35th International Conference on Machine Learning 80 (07 2018), 4218–4227. [17] Deepak Ramachandran and Eyal Amir. 2007. Bayesian Inverse Reinforcement Learning. Proceedings of the 20th International Joint Conference on Artificial Intelligence (2007), 2586–2591. [18] Nathan D. Ratliff, J. Andrew Bagnell, and Martin A. Zinkevich. 2006. Maximum Margin Planning. Proceedings of the Twenty-Third International Conference on Machine Learning (2006), 729–736. [19] Tummalapalli Sudhamsh Reddy, Vamsikrishna Gopikrishna, Gergely Zaruba, Inverse reinforcement learning for decentralized and Manfred Huber. 2012. non-cooperative multiagent systems. (2012), 1930–1935. [20] Richard S. Sutton and Andrew G. Barto. 2018. Reinforcement Learning: An Intro- duction. A Bradford Book, Cambridge, MA, USA. [21] Umar Syed and Robert E Schapire. 2007. A Game-Theoretic Approach to Ap- prenticeship Learning. Advances in Neural Information Processing Systems 20 (2007). [22] Faraz Torabi, Garrett Warnell, and Peter Stone. 2018. Behavioral Cloning from Observation. Proceedings of the 27th International Joint Conference on Artificial Intelligence (2018), 4950–4957. [23] Xingyu Wang and Diego Klabjan. 2018. Competitive Multi-agent Inverse Re- inforcement Learning with Sub-optimal Demonstrations. Proceedings of the Thirty-Fifth International Conference on Machine Learning 80 (2018), 5143–5151. [24] Andrew Whiten. 1991. Natural Theories of Mind: Evolution, Development and Simulation of Everyday Mindreading. Blackwell. [25] Haochen Wu, Amin Ghadami, Alparslan Emrah Bayrak, Jonathon M. Smereka, and Bogdan I. Epureanu. 2023. Evaluating Emergent Coordination in Multi-Agent Task Allocation Through Causal Inference and Sub-Team Identification. IEEE Robotics and Automation Letters 8, 2 (2023), 728–735.
http://arxiv.org/abs/2302.10175v1
2023-02-20T18:59:05
2023-02-20T18:59:05
Spatio-Temporal Momentum: Jointly Learning Time-Series and Cross-Sectional Strategies
We introduce Spatio-Temporal Momentum strategies, a class of models that unify both time-series and cross-sectional momentum strategies by trading assets based on their cross-sectional momentum features over time. While both time-series and cross-sectional momentum strategies are designed to systematically capture momentum risk premia, these strategies are regarded as distinct implementations and do not consider the concurrent relationship and predictability between temporal and cross-sectional momentum features of different assets. We model spatio-temporal momentum with neural networks of varying complexities and demonstrate that a simple neural network with only a single fully connected layer learns to simultaneously generate trading signals for all assets in a portfolio by incorporating both their time-series and cross-sectional momentum features. Backtesting on portfolios of 46 actively-traded US equities and 12 equity index futures contracts, we demonstrate that the model is able to retain its performance over benchmarks in the presence of high transaction costs of up to 5-10 basis points. In particular, we find that the model when coupled with least absolute shrinkage and turnover regularization results in the best performance over various transaction cost scenarios.
[ "Wee Ling Tan", "Stephen Roberts", "Stefan Zohren" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10175v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10175v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "q-fin.PM", "@scheme": "http://arxiv.org/schemas/atom" }
[ "q-fin.PM", "cs.LG", "q-fin.TR", "stat.ML" ]
3 2 0 2 b e F 0 2 ] M P . n i f - q [ 1 v 5 7 1 0 1 . 2 0 3 2 : v i X r a Spatio-Temporal Momentum: Jointly Learning Time-Series and Cross-Sectional Strategies Wee Ling Tan Department of Engineering Science Oxford-Man Institute of Quantitative Finance University of Oxford [email protected] Stephen Roberts Department of Engineering Science Oxford-Man Institute of Quantitative Finance University of Oxford [email protected] Stefan Zohren Department of Engineering Science Oxford-Man Institute of Quantitative Finance University of Oxford [email protected] Abstract We introduce Spatio-Temporal Momentum strategies, a class of models that unify both time-series and cross-sectional momentum strategies by trading assets based on their cross-sectional momentum features over time. While both time-series and cross-sectional momentum strategies are designed to systematically capture mo- mentum risk premia, these strategies are regarded as distinct implementations and do not consider the concurrent relationship and predictability between temporal and cross-sectional momentum features of different assets. We model spatio-temporal momentum with neural networks of varying complexities and demonstrate that a simple neural network with only a single fully connected layer learns to simultane- ously generate trading signals for all assets in a portfolio by incorporating both their time-series and cross-sectional momentum features. Backtesting on portfolios of 46 actively-traded US equities and 12 equity index futures contracts, we demonstrate that the model is able to retain its performance over benchmarks in the presence of high transaction costs of up to 5-10 basis points. In particular, we find that the model when coupled with least absolute shrinkage and turnover regularization results in the best performance over various transaction cost scenarios. 1 Introduction Momentum strategies form a class of systematic strategies that rely on the premise of a persistence in the direction of asset returns over time [25, 15]. These strategies are constructed to exploit the continuation of the underlying trend by increasing or assuming long positions during uptrends, and decreasing or assuming short positions during downtrends. Momentum strategies are often accompanied by volatility targeting, allowing momentum strategies to leverage positions taken during periods of low volatility, and reduce exposures during periods of high volatility. Volatility targeting at both the asset and portfolio level has been shown to boost Sharpe ratios, reducing the probability of extreme tail returns and minimizing maximum drawdowns for risk asset portfolios [12, 16]. Momentum strategies can be distinguished as belonging to a time-series or cross-sectional strategy. In terms of predictability, the former is primarily driven by the persistence in the trend of individual and market-level returns while the latter is usually deployed as a relative value strategy due to its perceived market-neutrality [4]. As such, current work has mainly regarded time-series and cross-sectional momentum as distinct implementations. In time-series momentum strategies [25, 11, 20, 41], trading signals for individual assets are con- structed based on the asset's own historical returns. In addition, the signals for individual assets in the portfolio are typically constructed independently of other assets. In the presence of a defined universe or portfolio of assets, this strategy does not take into consideration any form of mutual interactions and predictability between assets. We believe that momentum features from other assets represent sources of information as these assets collectively represent the market state at any point in time, and should be considered when constructing trading signals for a given asset. On the other hand, cross-sectional momentum strategies [15, 33, 29, 30, 31], require a momentum score to first be quantified for each individual asset in the portfolio, before computing a relative ranking of these scores in order to formulate positions for a select group of assets. In the first step of calculating a momentum score, cross-sectional momentum strategies ultimately consider only an asset's own historical returns, independent of returns from other assets. In principle, this is still identical to the way a trading signal is constructed in a time-series momentum strategy. Subsequently in the ranking step, a typical cross-sectional momentum strategy would allocate positions by assuming a maximum long position for assets ranked in the top decile, while taking a maximum short position for assets ranked in the bottom decile. We argue that this maximum long-short allocation does not accurately reflect the underlying trading signal for the selected assets. Moreover, this approach leaves a large majority of assets classified in intermediate deciles with no directional positions. As such, a cross-sectional strategy is unable to exploit any underlying trends for these intermediate assets. In this work, we combine both types of strategies by considering a form of multi-asset momentum that simultaneously constructs trading signals based on momentum features from multiple assets over time. We model the spatio-temporal momentum strategy using a variety of neural networks trained in a data-driven manner, each representing different complexities. In predicting the trend and position size for any given asset, we consider the asset's own momentum features as well as the momentum features from other assets in the portfolio. In contrast to a time-series momentum strategy, our model learns to incorporate information collectively from the universe of assets into signal construction. Our proposed strategy also directly generates trading signals for every asset as a multi-target output of the neural network, effectively bypassing the need to manually rank assets relative to one another as in the case of cross-sectional momentum. We directly optimize the models with the Sharpe ratio [35], allowing the spatio-temporal momentum networks to learn from risk-adjusted performance [20]. Our strategy closely resembles multitask learning [7, 9], a training framework that aims to train a learner on multiple tasks simultaneously. We observe that the prediction of momentum signals for different assets can be treated as multiple different, but closely related prediction tasks. In the context of spatio-temporal momentum, the model leverages on the usefulness of a shared feature representation between different assets, and is trained by optimizing over an aggregate Sharpe ratio computed from the multi-output model. 2 Related Work Momentum strategies are typically classified as either time-series or cross-sectional. The work of [25] incorporates volatility scaling [12] into a time-series momentum strategy and documents significant excess returns arising from trading based on the sign of an asset's own returns over the past 12 months, backtesting across 58 instruments and more than 25 years of data. Since then, other works have introduced more complex trend estimation techniques, such as using volatility normalised MACD signals [4] and blending slow and fast momentum strategies with various weights to reduce downside exposure [11]. On the other hand, [15] show that a cross-sectional momentum strategy of buying winners and selling losers over a lookback horizon of 3 to 12 months led to significant excess returns for a portfolio of NYSE and AMEX stocks. The cross-sectional momentum effect has also been observed in international equity markets [33] and futures contracts [29]. 2 Machine learning algorithms have been increasingly developed to perform predictions by extracting and modelling features from data. Deep learning has eliminated the need for manual feature engineer- ing, allowing for hierarchical feature representations to be learnt directly from data [18]. With recent advances in deep learning methods and open source libraries [1, 27], deep neural networks have been applied to model financial datasets such as high frequency limit order book data [43] and to construct portfolios [44]. Very often, neural networks that depend on recurrence and backpropagation through time, like recurrent neural networks (RNN) and long short-term memory networks (LSTM) [14], are used to model temporal relationships commonly present in financial data. Deep learning algorithms have also been applied to momentum strategies. The work of [20] introduces Deep Momentum Networks (DMNs), a series of neural network architectures directly optimised for portfolio Sharpe ratio, in place of standard regression and classification methods for time-series momentum. The models directly output positions for individual contracts, combining trend estimation and position sizing into a single function. However, we note that the single-output DMN model is trained on batches of input features belonging to different asset classes. This requires the model to learn to construct and output trading signals individually for all types of instruments, regardless of the possibility of negative transfer between asset classes. Our approach adopts a multitask learning approach that incorporates a multi-output target, permitting specialization for individual assets while retaining the advantage of having only a single model that leverages on a common shared representation between different assets. Multitask learning [7, 9, 34] aims to train a model on multiple tasks simultaneously to improve gener- alization performance across tasks. It has has been successfully adopted in a range of applications, including computer vision [42, 24, 21] and natural language processing [23, 10, 32]. Training a deep learning-based multitask model involves backpropagation with training signals from multiple related tasks. This can be seen as a form of model regularization via shared representations, specifically by coupling a main task with auxiliary tasks to introduce an inductive bias to the model [34]. We take the approach where all tasks (assets in the portfolio) are treated equally, unlike some multitask learning models that distinguish between a main task and one or more auxiliary tasks. 3 Momentum Strategies Following the definition of [3, 25], the overall returns of a time-series momentum (TSMOM) strategy that equally diversifies over Nt assets at time t is: rTSMOM t,t+1 = 1 Nt Nt(cid:88) i=1 X (i) t σtgt σ(i) t r(i) t,t+1 (1) where X (i) t ∈ [−1, 1] denotes the trading signal or position for asset i at time t. Given the differences in volatility across individual assets, we scale the realized returns r(i) t,t+1 by their volatility to target equal risk assignments. We set the annualized volatility target σtgt to be 15% and estimate the ex-ante volatility σ(i) Most momentum strategies are concerned with designing a proper trading signal X (i) t this with the following examples which we incorporate as benchmarks in our work: t with a 60-day exponentially weighted moving standard deviation of daily returns. . We illustrate t = 1 for Long Only each asset and performs a daily rebalancing according to changes in the ex-ante volatility estimate. In the simplest case, a long only strategy takes a maximum long position X (i) TSMOM In the time-series momentum strategy of Moskowitz et al., 2012 [25], the position taken for an asset is based on the sign of the asset's returns over the past 12 months: X (i) t−252,t) t = sgn(r(i) 3 MACD In Baz et al., 2015 [4], volatility normalised moving average convergence divergence (MACD) indicators are used in place of the sign of returns as signals for trend estimation: MACD(i, t, S, L) = m(i, t, S) − m(i, t, L) MACD(i, t, S, L) std(pt−63:t) MACDnorm(i, t, S, L) = Y (i) t = MACDnorm(i, t, S, L) std(MACDnorm(i, t − 252 : t, S, L)) X (i) t := ̃Y (i) t = 1 3 3 (cid:88) k=1 φ(Y (i) t (Sk, Lk)) (2) where MACD(i, t, S, L) is the MACD value of asset i at time t with a short time scale S and long time scale L. Further, m(i, t, j) is defined as the exponentially weighted moving average of asset i prices at time t, with a time scale j that corresponds to a half-life of HL = log(0.5)/ log(1 − 1 j ). The MACD value is normalized by std(p(i) t−63:t), the 63-day rolling standard deviation of asset i prices. Multiple intermediate MACD signals over different short and long time scales Sk ∈ {8, 16, 32} and Lk ∈ {24, 48, 96} are combined in an equally weighted sum to yield a position X (i) (or an t aggregated MACD signal ̃Y (i) ) where φ(y) = y exp( −y2 4 ) is a response function as defined in [4]. t 0.89 Deep Momentum Networks (DMN) Lim et al., 2019 [20] use deep neural networks to directly generate trading signals for individual assets, combining trend estimation and position sizing into a single function as approximated by the learnt model f using time-series momentum features u(i) t : X (i) t = f (cid:16) u(i) t ; θ (cid:17) (3) The model parameters θ are learnt by optimizing over loss metrics that include volatility characteris- tics of returns. As a benchmark, we consider f to be the Sharpe-optimized LSTM. CSMOM Following Jegadeesh & Titman, 1993 [15], we consider a cross-sectional momentum (CSMOM) strategy that scores and ranks an asset based on its returns computed over the past 12 months. The strategy utilizes a decile portfolio, taking a maximum long and short position for the top and bottom 10% of ranked assets respectively. 4 Spatio-Temporal Momentum Multitask Learning Premise We observe that the prediction of individual momentum signals X (i) for different assets can be treated as multiple different, but closely related prediction tasks. In the context of an equally weighted portfolio, we take the approach where all assets (tasks) are treated equally in a multi-target setting. In addition, we follow the definition of multitask learning in [7], where all tasks share the same inputs, unlike some definitions of multitask learning where different inputs are utilized for different tasks. t 4.1 Multitask Learning in Spatio-Temporal Momentum We model the simultaneous prediction of multiple trading signals X (i) t with model f as a multitask learning problem, with each task i corresponding to predicting the trading signal for asset i. Given time t, our goal is to construct a multitask learning model f that is able to perform N t tasks of predicting an aggregate trading signal Xt ∈ [−1, 1]N t In general, we have an input spatio-temporal tensor ut ∈ RN t×τ ×d, where N t is the number of assets, τ is the temporal history, d is the number of features, and ut(i, j, k) represents the k-th feature of the i-th asset at time t − j. We want to learn a model f parameterized by θ: over all assets. Xt = f (ut; θ) 4 (4) where Xt =       (5)  X (1) t X (2)   t  ...   X (N t) t In this framework, trading signals X (i) are directly computed using features from the universe of assets in the form of the spatio-temporal tensor ut. Specifically, this reduces to a time-series momentum strategy for N t = 1. The realized returns of this framework still follows Equation (1). t 4.2 Deep Learning Architectures Given that the choice of model architecture is crucial in modelling the relationship between the trading signals and the spatio-temporal momentum features, we examine a range of architectures of different complexities that are able to serve as candidate end-to-end functions. Single Layer Perceptron (SLP) We consider the simplest case of a fully connected neural network with a single hidden layer that computes a linear combination of the input features prior to activation: Xt = f (ut; θ) = g(W(cid:62)ut + b) (6) where W ∈ Rm×N t , ut ∈ Rm with m = N t * τ * d, b ∈ RN t and g = tanh is the activation function. Multilayer Perceptron (MLP) We consider a fully connected neural network with two hidden layers, representing a step up in model complexity from the SLP model: Xt = f (ut; θ) = g[W[2](cid:62)σ(W[1](cid:62)ut + b[1]) + b[2]] (7) where W[l] and b[l] are the weights and biases of the hidden layers and g = σ = tanh are the activation functions. Given the non-linear activation function σ, the model incorporates non-linearity with respect to the features of ut prior to mapping into trading signals. Convolutional Neural Networks (CNN) Apart from their applications in computer vision [37, 13], CNNs have been used to model multivariate time-series by incorporating convolutional filters that extract features from temporal data [6]. These models rely on autoregressive causal convolutions and optionally, dilated convolutions [26] that allow the encoding of features over various receptive fields. The use of causal convolutions preserves the autoregressive ordering of temporal features, in that predictions made at time t cannot depend on any future time steps t + 1, * * * , T . Long Short-term Memory (LSTM) Given the issues with exploding and (primarily) vanishing gradients in learning neural networks especially with long sequential data [5], RNNs that incorporate memory cell states and gating mechanisms such as LSTMs [14] have been used to address these limitations [19]. The combination of memory cell states and gating functions helps in backpropagating gradients through time, allowing RNNs to better learn long-range dependencies in sequences. We consider both the CNN and LSTM architectures for modelling spatio-temporal momentum. For full details of the implementations, we refer the reader to Appendix A. 4.3 Training Details 4.3.1 Loss Function Incorporating risk-adjusted metrics such as the Sharpe ratio during optimization have allowed models to better incorporate risk into learning and generation of trading signals [20]. Given a set D = {(ut, Xt = f (ut; θ)) | Xt ∈ [−1, 1]N t }T t=1 of spatio-temporal tensors and their corresponding 5 signals, we define the loss function Lsharpe(θ) over D as the annualized Sharpe ratio: Lsharpe(θ) = N t (cid:88) i=1 λi * L(i) sharpe(θ) L(i) sharpe(θ) = − (cid:80)T t=1 Ri(t) × (cid:104)(cid:80)T (cid:80)T t=1 Ri(t)2 − √ 252 (cid:105)2 t=1 Ri(t) Ri(t) = X (i) t σtgt σ(i) t r(i) t,t+1 (8) (9) (10) where Ri(t) represents the volatility-scaled captured returns for asset i from time t to t + 1. The multitask loss weights λi balance task importance for the individual task-specific loss functions L(i) sharpe(θ). In the case where all tasks (assets) are treated equally, we have λi = 1/N t. Shrinkage Penalty Taking into account the high dimensionality of the weight matrix W as per Equation (6), we incorporate L1 regularization as an additional penalty term to the loss function of the SLP. This encourages feature selection and model sparsity as the weight coefficients of features that are of less relevance to prediction are shrunk towards zero. We incorporate L1 regularization in the form of a penalty term on the sum of absolute weights of matrix W in the overall loss function: L(θ) = Lsharpe(θ) + α (cid:88) |wij| wij ∈W (11) where α is a hyperparameter controlling the shrinkage penalty term. 4.3.2 Optimization In processing our datasets, we conduct a train-validation split with the earlier 90% of data for training and the most recent 10% reserved for validation. To minimize the overall empirical loss, we perform backpropagation using minibatch stochastic gradient descent with the Adam optimizer [17], and initiate early stopping based on the validation set loss. For all machine learning methods, we conduct hyperparameter optimization with 100 iterations of random search for selecting optimal candidate models. We refer the reader to Appendix A for a detailed description of training parameters and specific details for the models. 5 Performance Evaluation 5.1 Overview of Datasets US Equities Our first dataset consists of 46 actively-traded US equities from the Financials sector with data obtained from the Center for Research in Security Prices (CRSP) [8]. We work with daily returns data, rebalancing the portfolio daily and performing strategy backtesting from 1990 to 2022. Equity Index Futures Our second dataset comprises 12 ratio-adjusted continuous equity index futures contracts with data obtained from the Pinnacle Data Corp CLC Database [28]. We work with daily returns data, performing portfolio rebalancing daily and backtesting from 2003 to 2020. The full list of instruments is detailed in Appendix B. 5.2 Backtest Details We utilize an expanding window approach, where all models are trained with every iteration of 5 additional years as it becomes available. Taking US Equities as an example, the first iteration would involve training and validating on the period from 1990 to 1995, then fixing the model weights and evaluating the model on out-of-sample data from 1995 to 2000. The second iteration would involve training and validating from 1990 to 2000, and evaluating from 2000 to 2005, and so on. We conduct each experiment over multiple random seeded runs and report the aggregate performance. 6 5.3 Momentum Features In constructing a general input spatio-temporal tensor ut ∈ RN t×τ ×d as per Equation (4), we include the below d momentum features: F.1 Volatility Normalized Returns – we use r(i) k), representing asset returns nor- malized by daily volatility estimates scaled to a time scale k ∈ {1, 20, 63, 126, 252}, corre- sponding to daily, monthly, quarterly, semiannual and annual returns. t−k,t/(σ(i) t √ F.2 MACD – we take volatility normalised MACD signals Y (i) (Sk, Lk) as per Equation (2) as t input features, using short and long time scales Sk ∈ {8, 16, 32} and Lk ∈ {24, 48, 96}. 5.4 Results and Discussion In evaluating the performance of all strategies, we use the following annualized metrics: M.1 Profitability – Expected Returns (E[Returns]), Hit Rate M.2 Risk – Volatility (Vol.), Downside Deviation, Maximum Drawdown (MDD) M.3 Performance Ratios – Sharpe, Sortino and Calmar Ratios, Average Profit over Loss (cid:0) Ave. P Ave. L (cid:1) For US Equities (and respectively for Equity Index Futures), we report the aggregated out-of-sample performance of all strategies from 1995 to 2022 (2008 to 2020) for overall returns computed in accordance with Equation (1). In this section, we compute the performance of the strategies in the absence of transaction costs to understand the raw predictive ability of the strategies. We provide an analysis of the impact of transaction costs in Section 5.6. We first present the performance of all strategies from their raw signal outputs in Table 1 (Table 3). In order to facilitate the comparison between different strategies, we apply to all strategies an additional layer of volatility scaling at the portfolio level to target an annualized volatility of 15% and report the performance in Table 2 (Table 4) and cumulative returns in Figure 1 (Figure 2). 5.4.1 US Equities From Table 1, we first observe that the cross-sectional decile portfolio was an unprofitable strategy as seen from the CSMOM strategy delivering negative returns over the backtest period. In addition, classical time-series momentum portfolios like TSMOM and MACD generally underperformed compared to a simple long only approach. Two machine learning methods, the DMN and SLP were able to outperform the long only approach as seen from their performance ratios. With the introduction of volatility scaling at the portfolio level, we observe improvements in perfor- mance across all strategies as shown in Table 2. In particular, we see that spatio-temporal momentum (STMOM) methods, with the exception of CNN, experienced the largest increase in performance ratios among machine learning methods, with the Sharpe ratio of the SLP increasing by about 134% (MLP - 251%, LSTM - 217%) as compared to an increase of 43% for the DMN. This increase led to the MLP and LSTM outperforming the long only strategy. Both the DMN and SLP demonstrated the best performance and exhibited a large gap above all other methods as seen from Table 2 and the cumulative returns plot in Figure 1. This can be attributed to the DMN and SLP both capturing higher expected returns while being subject to lower downside risks. Within STMOM models, we observe a deterioration in performance of the STMOM strategy with an increased level of model complexity, as seen from the underperformance of the MLP, LSTM and CNN relative to a simple SLP model trained with a shrinkage penalty. This is contrary to the expectation that a model of greater complexity would be better suited to model the dynamics of spatio-temporal momentum. It is also possible that the underperformance in complex architectures is associated with difficulties in training models with multiple model configurations, especially the CNN as seen from its poor performance, echoing a similar conclusion from [20]. The underperformance of some STMOM models as compared to the DMN may be attributed to the relatively low signal-to-noise ratio of returns data, coupled with the limited amount of data available to STMOM strategies. During training, STMOM deep learners are exposed to only t samples, while deep TSMOM strategies like the DMN have access to a much larger pool of t × N t samples. As a result, overly complex STMOM models also run the risks of overfitting to in-sample data. 7 Table 1: Performance Metrics for Strategies – Raw Signal Outputs (US Equities) Benchmarks Long Only TSMOM MACD CSMOM Reference DMN STMOM SLP MLP CNN LSTM E[Return] Vol. Downside Deviation MDD Sharpe Sortino Calmar 0.068 0.012 0.001 -0.033 0.102 0.067 0.045 0.048 0.072 0.050 0.033 0.036 0.235 0.287 0.237 0.631 0.667 0.177 0.021 -0.702 0.944 0.240 0.029 -0.937 0.290 0.042 0.004 -0.053 Hit Rate 0.541 0.526 0.519 0.494 Ave. P Ave. L 0.951 0.932 0.931 0.911 0.056 (0.008) 0.028 (0.008) 0.018 (0.005) 0.067 (0.029) 2.043 (0.263) 3.145 (0.452) 0.924 (0.258) 0.598 (0.005) 1.055 (0.054) 0.032 (0.006) 0.013 (0.005) 0.010 (0.006) 0.014 (0.004) 0.029 (0.005) 0.044 (0.008) 0.051 (0.006) 0.044 (0.008) 0.020 (0.004) 0.032 (0.006) 0.037 (0.005) 0.031 (0.006) 0.075 (0.015) 0.176 (0.044) 0.167 (0.037) 0.159 (0.053) 1.114 (0.182) 0.296 (0.106) 0.195 (0.106) 0.320 (0.108) 1.609 (0.288) 0.410 (0.148) 0.273 (0.150) 0.458 (0.158) 0.435 (0.092) 0.082 (0.040) 0.066 (0.043) 0.103 (0.061) 0.581 (0.007) 0.544 (0.007) 0.516 (0.007) 0.546 (0.009) 0.955 (0.041) 0.902 (0.038) 0.980 (0.029) 0.903 (0.036) (Standard deviation shown in parentheses) Table 2: Performance Metrics for Strategies – Rescaled to Target Volatility (US Equities) Benchmarks Long Only TSMOM MACD CSMOM Reference DMN STMOM SLP MLP CNN LSTM E[Return] Vol. Downside Deviation MDD Sharpe Sortino Calmar 0.131 0.056 0.038 -0.101 0.155 0.157 0.157 0.154 0.109 0.112 0.112 0.115 0.344 0.470 0.524 0.964 0.841 0.358 0.245 -0.655 1.197 0.501 0.343 -0.880 0.380 0.119 0.073 -0.105 Hit Rate 0.541 0.526 0.519 0.494 Ave. P Ave. L 0.976 0.960 0.968 0.919 0.487 (0.019) 0.167 (0.001) 0.105 (0.002) 0.260 (0.029) 2.920 (0.119) 4.647 (0.229) 1.887 (0.181) 0.598 (0.005) 1.179 (0.020) 0.423 (0.048) 0.175 (0.030) 0.035 (0.041) 0.178 (0.040) 0.162 (0.001) 0.169 (0.013) 0.200 (0.059) 0.182 (0.028) 0.102 (0.002) 0.110 (0.002) 0.139 (0.056) 0.136 (0.035) 0.301 (0.033) 0.410 (0.070) 0.665 (0.318) 0.544 (0.264) 2.609 (0.282) 1.040 (0.178) 0.192 (0.223) 1.015 (0.305) 4.161 (0.524) 1.590 (0.270) 0.314 (0.340) 1.422 (0.511) 1.428 (0.252) 0.439 (0.109) 0.079 (0.082) 0.405 (0.202) 0.581 (0.007) 0.544 (0.007) 0.516 (0.007) 0.546 (0.009) 1.170 (0.034) 1.032 (0.020) 0.977 (0.032) 1.025 (0.028) 5.4.2 Equity Index Futures Similar to US Equities, it is clear from Table 3 that the cross-sectional decile portfolio was again unprofitable with the CSMOM strategy delivering negative returns. Both classical time-series momen- tum portfolios like TSMOM and MACD and the reference DMN were profitable but underperformed a long only approach. With the exception of CNN, all STMOM methods demonstrated the best performance, with the SLP and MLP models outperforming the DMN by more than four times as seen from their performance ratios. Incorporating volatility scaling at the portfolio level, we notice improvements in the performance for all strategies as shown in Table 4. The increase in performance ratios for the benchmarks strategies and DMN were minimal, whereas STMOM methods experienced larger increases in their performance ratios with volatility scaling. This increase drove STMOM strategies to further outperform all other strategies, with the SLP model outperforming the DMN by more than six times in risk-adjusted returns. Echoing the observation for US Equities, the simplest SLP model again demonstrated the best performance above all other STMOM methods as seen from Table 4 and the cumulative returns 8 plot in Figure 2, further lending support to the notion that a model of lower complexity is better suited to model spatio-temporal momentum. Table 3: Performance Metrics for Strategies – Raw Signal Outputs (Equity Index Futures) Benchmarks Long Only TSMOM MACD CSMOM Reference DMN STMOM SLP MLP CNN LSTM E[Return] Vol. Downside Deviation MDD Sharpe Sortino Calmar 0.054 0.020 0.006 -0.048 0.125 0.107 0.068 0.081 0.093 0.078 0.050 0.060 0.275 0.251 0.175 0.554 0.427 0.191 0.081 -0.584 0.574 0.262 0.111 -0.786 0.195 0.081 0.032 -0.086 Hit Rate 0.549 0.523 0.529 0.489 Ave. P Ave. L 0.883 0.944 0.905 0.946 0.012 (0.017) 0.034 (0.024) 0.026 (0.018) 0.102 (0.066) 0.301 (0.220) 0.410 (0.307) 0.110 (0.088) 0.525 (0.009) 0.971 (0.042) 0.047 (0.017) 0.037 (0.014) -0.016 (0.014) 0.039 (0.013) 0.049 (0.019) 0.032 (0.013) 0.065 (0.020) 0.057 (0.014) 0.035 (0.015) 0.022 (0.010) 0.049 (0.015) 0.040 (0.010) 0.152 (0.081) 0.088 (0.063) 0.291 (0.111) 0.172 (0.070) 1.242 (0.834) 1.319 (0.593) -0.215 (0.170) 0.746 (0.329) 1.856 (1.433) 2.050 (1.065) -0.283 (0.228) 1.079 (0.529) 0.657 (0.781) 0.683 (0.478) -0.045 (0.033) 0.289 (0.198) 0.574 (0.018) 0.559 (0.014) 0.518 (0.014) 0.550 (0.016) 0.992 (0.142) 1.075 (0.127) 0.886 (0.048) 0.973 (0.098) (Standard deviation shown in parentheses) Table 4: Performance Metrics for Strategies – Rescaled to Target Volatility (Equity Index Futures) Benchmarks Long Only TSMOM MACD CSMOM Reference DMN STMOM SLP MLP CNN LSTM E[Return] Vol. Downside Deviation MDD Sharpe Sortino Calmar 0.070 0.033 0.023 -0.107 0.154 0.154 0.156 0.154 0.114 0.112 0.114 0.115 0.319 0.355 0.390 0.838 0.456 0.212 0.145 -0.697 0.616 0.291 0.198 -0.929 0.221 0.092 0.058 -0.128 Hit Rate 0.549 0.523 0.529 0.489 Ave. P Ave. L 0.887 0.946 0.915 0.929 0.055 (0.026) 0.162 (0.006) 0.115 (0.002) 0.391 (0.086) 0.340 (0.165) 0.478 (0.233) 0.156 (0.093) 0.525 (0.009) 0.966 (0.028) 0.333 (0.084) 0.288 (0.058) 0.030 (0.046) 0.251 (0.085) 0.161 (0.003) 0.162 (0.004) 0.164 (0.015) 0.195 (0.115) 0.104 (0.004) 0.107 (0.005) 0.112 (0.002) 0.103 (0.004) 0.244 (0.076) 0.238 (0.059) 0.443 (0.121) 0.298 (0.063) 2.066 (0.498) 1.776 (0.333) 0.174 (0.279) 1.389 (0.384) 3.228 (0.910) 2.699 (0.560) 0.270 (0.412) 2.451 (0.892) 1.619 (0.957) 1.302 (0.452) 0.089 (0.101) 0.890 (0.415) 0.574 (0.018) 0.559 (0.014) 0.518 (0.014) 0.550 (0.016) 1.121 (0.071) 1.123 (0.048) 0.963 (0.023) 1.118 (0.087) For subsequent sections, we focus our analysis on the US Equities dataset. 5.5 Signal Diversification From Figure 3, the SLP exhibits mostly zero to moderately positive correlation with other momentum strategies, with the correlation between SLP and DMN at about 46%. The correlations of the SLP with other strategies are also fairly unstable, with the SLP periodically displaying a negative correlation with TSMOM, CSMOM and DMN, translating into possible benefits from signal diversification. We evaluate the combination of time-series momentum (TSMOM and DMN) with a cross-sectional momentum strategy (CSMOM) and compare it to a spatio-temporal momentum strategy. Focusing on the Sharpe ratio, we see from Table 5 that the combinations of both TSMOM+CSMOM (0.177) and DMN+CSMOM (2.115) portfolios do not outperform a single SLP portfolio (2.609), demonstrating that the benefit of using a spatio-temporal momentum strategy outweighs a portfolio that combines 9 Figure 1: Cumulative Returns - Rescaled to Target Volatility (US Equities) Figure 2: Cumulative Returns - Rescaled to Target Volatility (Equity Index Futures) 10 1996200020042008201220162020Date101100101102103104105Cumulative Returns (Log Scale)Long OnlyTSMOMMACDCSMOMDMNSLPMLPCNNLSTM2008201020122014201620182020Date100101102Cumulative Returns (Log Scale)Long OnlyTSMOMMACDCSMOMDMNSLPMLPCNNLSTM both time-series and cross-sectional momentum, thus indicating that the model is learning meaningful interactions between the time-series and cross-sectional domain which are not captured by separate models. In addition, we analyze the combination of a time-series momentum (DMN) with a spatio- temporal momentum strategy (SLP). The combination of DMN (2.920) and SLP (2.609) yielded an overall higher Sharpe ratio (3.304), highlighting substantial scope for strategy diversification by incorporating a spatio-temporal momentum strategy. Figure 3: (Left) Correlation of Strategies (Right) 1Y Rolling Correlations of SLP (US Equities) Table 5: Performance Metrics for Strategy Combinations – Rescaled to Target Volatility (US Equities) E[Return] Vol. Downside Deviation MDD Sharpe Sortino Calmar Hit Rate Ave. P Ave. L Combination TSMOM+CSMOM DMN+CSMOM DMN+SLP 0.028 0.340 (0.025) 0.551 (0.027) 0.156 0.161 (0.001) 0.167 (0.001) 0.113 0.106 (0.001) 0.101 (0.001) 0.577 0.307 (0.045) 0.230 (0.013) 0.177 2.115 (0.153) 3.304 (0.151) 0.245 3.222 (0.261) 5.441 (0.308) 0.048 1.132 (0.189) 2.402 (0.147) 0.521 0.572 (0.005) 0.603 (0.005) 0.946 1.099 (0.017) 1.229 (0.026) 5.6 Transaction Costs and Turnover Regularization In this section, we analyze the impact of transaction costs on the performance of all strategies. Following [3], we define turnover TO(i) as the absolute daily change in the trading signal of an asset: t TO(i) t = σtgt (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) X (i) t σ(i) t − X (i) t−1 σ(i) t−1 (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) (12) which encompasses the amount of rebalancing as determined by shifts in both volatility estimates and underlying positions. In Figure 4, we plot the distributions of turnover averaged across all assets for individual strategies. We observe that machine learning models trade considerably more than the benchmarks, with the SLP having a lower turnover than the DMN. To study the impact of transactions costs on performance, we compute ex-cost Sharpe ratios using captured returns net of transaction costs ̃rTSMOM t,t+1 : ̃rTSMOM t,t+1 = 1 Nt Nt(cid:88) i=1 (cid:18) X (i) t σtgt σ(i) t t,t+1 − c * TO(i) r(i) t (cid:19) (13) where c is a constant approximating the specific transaction cost scenario. Based on the ex-cost Sharpe Ratios in Table 6, the non-regularized DMN and SLP models are able to retain their performance over benchmarks for transactions costs of up to c = 5 to 10 basis points, which are considered to be realistic transaction costs for equity markets. Following the approach of [20], we investigate the 11 Long OnlyTSMOMMACDCSMOMDMNSLPLong OnlyTSMOMMACDCSMOMDMNSLP10.2610.140.721-0.0070.260.2110.670.110.012-0.00710.410.087-0.094-0.0010.4611996200020042008201220162020Date1.000.750.500.250.000.250.500.751.00Correlation of StrategiesSLP-TSMOMSLP-CSMOMSLP-DMN (cid:102)TO (i) t = σtgt effect of incorporating turnover regularization during training in the form of optimizing for ex-cost Sharpe ratios computed using ̃rTSMOM t,t+1 . For non-recurrent models that do not generate sequential signals, such as the SLP, we introduce a localized minibatch turnover regularization in the form: (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) where t (cid:54)= t∗ with t and t∗ representing consecutive samples within a given training minibatch. Compared to its non-regularized counterpart, incorporating turnover regularization for the DMN resulted in a lower turnover but better performance is only observed at a transaction cost of c = 10 basis points, while performance for all other transaction cost scenarios deteriorated. On the other hand, turnover regularization consistently improved the SLP's performance across all transaction cost scenarios. Referring to the distribution of average turnover for the regularized SLP, we observe a lower mean turnover but an increase in the spread between the minimum, maximum and interquartile range. This is likely a direct consequence of performing stochastic gradient descent with the localized minibatch turnover regularization as per Equation (14), requiring batching over a shuffled training set. X (i) t∗ σ(i) t∗ X (i) t σ(i) t (14) (cid:12) (cid:12) (cid:12) (cid:12) (cid:12) − Table 6: Impact of Transactions Costs on Sharpe Ratio – Rescaled to Target Volatility (US Equities) Transaction Cost (Basis Points) 0.0 0.5 1.0 2.0 3.0 4.0 5.0 10.0 Benchmarks Long Only TSMOM MACD CSMOM Reference DMN DMN+Reg STMOM SLP SLP+Reg 0.841 0.358 0.245 -0.655 0.839 0.347 0.238 -0.683 0.838 0.336 0.232 -0.710 0.835 0.315 0.219 -0.765 0.832 0.293 0.207 -0.820 0.829 0.271 0.194 -0.875 0.826 0.249 0.182 -0.930 0.812 0.140 0.119 -1.204 2.920 2.073 2.844 2.044 2.768 2.015 2.615 1.957 2.462 1.899 2.308 1.840 2.153 1.782 1.375 1.486 2.609 2.672 2.518 2.603 2.427 2.534 2.243 2.395 2.060 2.256 1.876 2.116 1.691 1.976 0.762 1.271 Figure 4: Average Turnover of Strategies (US Equities) 5.7 Interpretability Apart from demonstrating the best performance, the SLP is the simplest model out of all STMOM architectures. We perform an analysis on the interpretability of the trained SLP using SHAP (SHapley Additive exPlanations) [22], a model-agnostic interpretation method for computing feature importance and effects for machine learning models. SHAP values associated to each individual feature measures the change in the expected value of the model's prediction when conditioning on that feature. We approximate SHAP values with Deep SHAP [22], a high-speed approximation algorithm which builds on DeepLIFT [36]. 12 Long OnlyTSMOMMACDCSMOMDMNDMN+RegSLPSLP+RegMLPCNNLSTM0.0000.0250.0500.0750.1000.1250.1500.1750.200Average Turnover Prediction for a Single Asset We analyze the importance and effects of the spatio-temporal features on the predicted signal of a single asset – BAC, by plotting SHAP values for the top 20 features ordered according to their importance in Figure 5. It is evident that the top features are dominated by volatility normalized MACD, indicating that the MACD features of assets are, on average, contributing more to the predicted signal of BAC as compared to other types of features like volatility normalized returns. This could mean that the cross over of exponentially weighted moving averages are considered significant momentum features for the model in generating its trading signals. Interestingly, the top features do not contain much of the BAC's own features, and instead other assets' features in the cross-section are considered important in its own predicted signal. Moving from low to high feature values and vice versa, there are clear patterns in the resultant impact of spatio-temporal features on the predicted signal output as seen from the gradual transitions in colour. Momentum and mean-reversion effects of individual features are also relatively distinct and can be inferred from the SHAP plot. Taking the first two features as examples, the first feature "AJG_t-4_MACD_32_96" exhibits a mean-reversion effect as higher feature values lead to a lower predicted signal for BAC, while the second feature "JEF_t-3_MACD_32_96" shows a momentum effect as higher feature values lead to a higher predicted signal for BAC. Prediction for All Assets To examine global feature importance, we compute the mean absolute SHAP values for each spatio-temporal feature on the predicted signal for all assets in US Equities and plot their cumulative impact in Figure 6. Ordered according to importance, the top 20 features are again dominated by volatility normalized MACD features. We note that the cumulative absolute impact of a feature does not distinguish between its momentum or mean-reversion effects, and serves only as a proxy of its feature importance over all assets. Figure 5: Impact on Predicted Signal Output for a Single Asset – BAC (US Equities) 13 0.150.100.050.000.050.100.15SHAPSRCE_t-1_MACD_32_96AJG_t-1_MACD_16_48AFG_t-3_MACD_32_96AFG_t-4_MACD_16_48JEF_t-2_MACD_32_96AJG_t-2_MACD_32_96TRC_t-2_MACD_32_96STT_t-2_MACD_32_96UFCS_t-2_MACD_32_96MCO_t-2_MACD_32_96SNV_t-5_MACD_32_96STT_t-4_MACD_16_48STT_t-3_MACD_32_96INDB_t-2_MACD_32_96UFCS_t-4_MACD_32_96AJG_t-1_MACD_32_96STT_t-1_MACD_32_96JEF_t-1_MACD_32_96JEF_t-3_MACD_32_96AJG_t-4_MACD_32_96Spatio-Temporal FeaturesLowHighFeature value Figure 6: Cumulative Mean Absolute Impact on Predicted Signal Output for All Assets (US Equities) 6 Conclusions We introduce Spatio-Temporal Momentum, a class of machine learning models that combine time- series and cross-sectional momentum strategies. This class of momentum strategies simultaneously generates trading signals for a portfolio of assets in a multitask setting, using both time-series and cross-sectional features from all assets in the portfolio. We demonstrate that the SLP, a neural network with a single hidden layer trained with a shrinkage penalty, is able to outperform more complex models in modelling spatio-temporal momentum, demonstrating its effectiveness over benchmarks on two different datasets. We show that the performance of a spatio-temporal momentum strategy can be superior to a simple blend of time-series and cross-sectional momentum strategies. Exhibiting unstable correlation with other momentum strategies, the spatio-temporal momentum strategy when combined with a time- series momentum strategy like the DMN yields higher risk-adjusted returns, making spatio-temporal momentum a valuable strategy for diversification. Given various cost scenarios, we examine the impact of transaction costs on the performance of all strategies and show that both the DMN and SLP were able to retain their performance over benchmarks for costs up to 5 to 10 basis points when tested on the US equities data. We incorporate turnover regularization for the DMN and a different localized minibatch turnover regularization for non-recurrent models like the SLP, resulting in the SLP achieving better performance ratios across all transaction cost scenarios. With the simplicity of the SLP model, it is possible to directly visualize and interpret its weights corresponding to each spatio-temporal momentum feature. We analyze the importance of individual spatio-temporal momentum features using the model-agnostic SHAP method, revealing clear patterns in momentum and mean-reversion effects of individual features for predicting the trading signal of an individual asset, as well as showing global feature importance for all assets. In future works, we would like to study the performance of spatio-temporal momentum using alternative feature representations. Another extension of this work includes adapting attention-based deep learning architectures [40, 2, 39] and investigating their effectiveness in modelling spatio- temporal momentum. 14 0.00.20.40.60.81.0mean(|SHAP|)AFG_t-5_MACD_16_48INDB_t-5_MACD_32_96SBCF_t-3_MACD_32_96UFCS_t-5_MACD_32_96STT_t-5_MACD_32_96SRCE_t-5_MACD_32_96STT_t-3_MACD_32_96INDB_t-1_MACD_32_96AJG_t-4_MACD_16_48AJG_t-4_MACD_32_96INDB_t-2_MACD_32_96AJG_t-1_MACD_32_96UFCS_t-4_MACD_32_96JEF_t-4_MACD_32_96JEF_t-2_MACD_32_96SRCE_t-1_MACD_32_96JEF_t-5_MACD_32_96JEF_t-3_MACD_32_96INDB_t-3_MACD_32_96INDB_t-4_MACD_32_96Spatio-Temporal FeaturesBACNWLIINDBMCYTROWTMPWFCSNVSBCFSIGIZIONJPMSTTTFCVLYMKLAFGGLCPFUFCSTRCSEICAFLSCHWUBSIVALUWRBMCOTRSTWABCUSBNTRSPNCCADECFRFITBJEFCAJGSRCEKEYIBCPCHCOSIVBCBSHCVBF References [1] Martín Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, et al. TensorFlow: A System for Large-Scale Machine Learning. In 12th USENIX Symposium on Operating Systems Design and Implementation (OSDI 16), pages 265–283, 2016. [2] Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural Machine Translation by Jointly Learning to Align and Translate. arXiv:1409.0473, 2014. [3] Nick Baltas and Robert Kosowski. Demystifying Time-Series Momentum Strategies: Volatility Estimators, Trading Rules and Pairwise Correlations. Market Momentum: Theory and Practice, Wiley, 2020. [4] Jamil Baz, Nicolas Granger, Campbell R Harvey, Nicolas Le Roux, and Sandy Rattray. Dissect- ing Investment Strategies in the Cross Section and Time Series. SSRN 2695101, 2015. [5] Yoshua Bengio, Patrice Simard, and Paolo Frasconi. Learning Long-Term Dependencies with Gradient Descent is Difficult. IEEE Transactions on Neural Networks, 5(2):157–166, 1994. [6] Mikolaj Binkowski, Gautier Marti, and Philippe Donnat. Autoregressive Convolutional Neural Networks for Asynchronous Time Series. In International Conference on Machine Learning, pages 580–589. PMLR, 2018. [7] Rich Caruana. Multitask Learning. Machine Learning, 28(1):41–75, 1997. [8] The University of Chicago Booth School of Business Center for Research in Security Prices (CRSP). Calculated (or Derived) based on data from CRSP Daily Stock 2022. [9] Michael Crawshaw. Multi-Task Learning with Deep Neural Networks: A Survey. arXiv:2009.09796, 2020. [10] Daxiang Dong, Hua Wu, Wei He, Dianhai Yu, and Haifeng Wang. Multi-Task Learning for Multiple Language Translation. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 1723–1732, 2015. [11] Ashish Garg, Christian L Goulding, Campbell R Harvey, and Michele Mazzoleni. Momentum Turning Points. SSRN 3489539, 2021. [12] Campbell R Harvey, Edward Hoyle, Russell Korgaonkar, Sandy Rattray, Matthew Sargaison, and Otto Van Hemert. The Impact of Volatility Targeting. The Journal of Portfolio Management, 45(1):14–33, 2018. [13] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep Residual Learning for Image Recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 770–778, 2016. [14] Sepp Hochreiter and Jürgen Schmidhuber. Long Short-Term Memory. Neural Computation, 9(8):1735–1780, 1997. [15] Narasimhan Jegadeesh and Sheridan Titman. Returns to Buying Winners and Selling Losers: Implications for Stock Market Efficiency. The Journal of Finance, 48(1):65–91, 1993. [16] Abby Y Kim, Yiuman Tse, and John K Wald. Time Series Momentum and Volatility Scaling. Journal of Financial Markets, 30:103–124, 2016. [17] Diederik P Kingma and Jimmy Ba. Adam: A Method for Stochastic Optimization. arXiv:1412.6980, 2014. [18] Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep Learning. Nature, 521(7553):436–444, 2015. [19] Bryan Lim and Stefan Zohren. Time Series Forecasting with Deep Learning: A Survey. Philosophical Transactions of the Royal Society A, 379(2194):20200209, 2021. [20] Bryan Lim, Stefan Zohren, and Stephen Roberts. Enhancing Time-Series Momentum Strategies Using Deep Neural Networks. The Journal of Financial Data Science, 1(4):19–38, 2019. [21] Mingsheng Long, Zhangjie Cao, Jianmin Wang, and Philip S Yu. Learning Multiple Tasks with Multilinear Relationship Networks. Advances in Neural Information Processing Systems, 30, 2017. 15 [22] Scott M Lundberg and Su-In Lee. A Unified Approach to Interpreting Model Predictions. Advances in Neural Information Processing Systems, 30, 2017. [23] Minh-Thang Luong, Quoc V Le, Ilya Sutskever, Oriol Vinyals, and Lukasz Kaiser. Multi-Task Sequence to Sequence Learning. arXiv:1511.06114, 2015. [24] Ishan Misra, Abhinav Shrivastava, Abhinav Gupta, and Martial Hebert. Cross-Stitch Networks for Multi-task Learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 3994–4003, 2016. [25] Tobias J Moskowitz, Yao Hua Ooi, and Lasse Heje Pedersen. Time Series Momentum. Journal of Financial Economics, 104(2):228–250, 2012. [26] Aaron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alex Graves, Nal Kalchbrenner, Andrew Senior, and Koray Kavukcuoglu. Wavenet: A Generative Model for Raw Audio. arXiv:1609.03499, 2016. [27] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. PyTorch: An Imperative Style, High-Performance Deep Learning Library. Advances in Neural Information Processing Systems, 32, 2019. [28] Pinnacle Data Corp. CLC Database. https://pinnacledata2.com/clc.html. [29] Craig Pirrong. Momentum in Futures Markets. SSRN 671841, 2005. [30] Daniel Poh, Bryan Lim, Stefan Zohren, and Stephen Roberts. Building Cross-Sectional Systematic Strategies By Learning to Rank. The Journal of Financial Data Science, 3(2):70–86, 2021. [31] Daniel Poh, Bryan Lim, Stefan Zohren, and Stephen Roberts. Enhancing Cross-Sectional Currency Strategies by Context-Aware Learning to Rank with Self-Attention. The Journal of Financial Data Science, 4(3):89–107, 2022. [32] Marek Rei. Semi-supervised Multitask Learning for Sequence Labeling. arXiv:1704.07156, 2017. [33] K Geert Rouwenhorst. International Momentum Strategies. The Journal of Finance, 53(1):267– 284, 1998. [34] Sebastian Ruder. An Overview of Multi-Task Learning in Deep Neural Networks. arXiv:1706.05098, 2017. [35] William F Sharpe. The Sharpe Ratio. The Journal of Portfolio Management, 21(1):49–58, 1994. [36] Avanti Shrikumar, Peyton Greenside, and Anshul Kundaje. Learning Important Features Through Propagating Activation Differences. In International Conference on Machine Learning, pages 3145–3153. PMLR, 2017. [37] Karen Simonyan and Andrew Zisserman. Very Deep Convolutional Networks for Large-Scale Image Recognition. arXiv:1409.1556, 2014. [38] Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A Simple Way to Prevent Neural Networks from Overfitting. The Journal of Machine Learning Research, 15(1):1929–1958, 2014. [39] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention Is All You Need. Advances in Neural Information Processing Systems, 30, 2017. [40] Kieran Wood, Sven Giegerich, Stephen Roberts, and Stefan Zohren. Trading with the Mo- mentum Transformer: An Intelligent and Interpretable Architecture. arXiv:2112.08534, Risk, 2023. [41] Kieran Wood, Stephen Roberts, and Stefan Zohren. Slow Momentum with Fast Reversion: A Trading Strategy Using Deep Learning and Changepoint Detection. The Journal of Financial Data Science, 4(1):111–129, 2022. [42] Zhanpeng Zhang, Ping Luo, Chen Change Loy, and Xiaoou Tang. Facial Landmark Detection by Deep Multi-task Learning. In European Conference on Computer Vision, pages 94–108. Springer, 2014. 16 [43] Zihao Zhang, Stefan Zohren, and Stephen Roberts. DeepLOB: Deep Convolutional Neural Networks for Limit Order Books. IEEE Transactions on Signal Processing, 67(11):3001–3012, 2019. [44] Zihao Zhang, Stefan Zohren, and Stephen Roberts. Deep Learning for Portfolio Optimization. The Journal of Financial Data Science, 2(4):8–20, 2020. 17 A Deep Learning Architectures & Optimization A.1 Deep Learning Architectures For the CNN and LSTM models, we consider the spatio-temporal tensor ut ∈ Rτ ×m(cid:48) with m(cid:48) = N t * d, representing an input sequence of momentum features of all assets over a temporal history τ . Convolutional Neural Networks (CNN) We consider a 1-D autoregressive CNN of the following: ht = Pσ[W[2] Xt = f (ut; θ) = g[W[2](cid:62)σ(W[1](cid:62)ht + b[1]) + b[2]] c ∗ ut + b[1] c ∗ σ(W[1] c ) + b[2] c ] (15) (16) c represent convolutional kernels with associated bias terms b[l] where W[l] c and activations σ = tanh, and w ∗ u representing the causal convolution operation between the input sequence u and kernel w. Additionally, we interface an average pooling layer P that performs a downsampling step prior to propagating the activations ht into an MLP as per Equation (7). Long Short-term Memory (LSTM) We consider a single layer LSTM model: Γi t = σS(Wiut + Viht−1 + bi) Γf t = σS(Wf ut + Vf ht−1 + bf ) Γo t = σS(Wout + Voht−1 + bo) ̃ct = g(Wcut + Vcht−1 + bc) ct = Γi ht = Γo Xt = g(Wdistht + b) t (cid:12) ̃ct + Γf t (cid:12) g(ct) t (cid:12) ct−1 (17) (18) (19) (20) (21) (22) (23) t, Γf where W∗, V∗ represent the weights and b∗ the biases of the input, forget and output gates Γi t , Γo t respectively, with activation functions σS = sigmoid and g = tanh. Subsequently, the LSTM computes the memory cell state ct, hidden state activation ht with (cid:12) representing the Hadamard product. Given the spatio-temporal input of the form ut ∈ Rτ ×m(cid:48) , the network then maps the hidden state activation ht to a sequence of trading signals Xt ∈ [−1, 1]τ ×N t by a fully connected layer with time-distributed weights Wdist. A.2 Fixed Parameters & Hyperparameter Optimization We perform hyperparameter optimization with 100 iterations of random search for all machine learning models, using the search range as shown in Table 8. We initiate early stopping with a patience of 25 epochs for the validation loss. We include regularization via dropout [38] for the reference DMN, as well as the MLP, CNN and LSTM STMOM models. 18 Table 7: Fixed Parameters for Machine Learning Models Parameters DMN SLP MLP CNN LSTM Epochs Patience Random Search Iterations Temporal History 100 25 100 63 500 25 100 5 500 25 100 5 500 25 100 63 500 25 100 63 Table 8: Hyperparameter Search Range for Machine Learning Models Hyperparameters Random Search Grid Minibatch Size Dropout Rate Hidden Layer Size Learning Rate Max Gradient Norm L1 Regularisation Weight (α) 32, 64, 128, 256 0.1, 0.2, 0.3, 0.4, 0.5 5, 10, 20, 40, 80, 160 10−5, 10−4, 10−3, 10−2, 10−1, 100 10−4, 10−3, 10−2, 10−1, 100, 101 10−5, 10−4, 10−3, 10−2, 10−1, 100 B Dataset Details All individual instruments in our datasets have less than 10% missing data. To reduce the effect of extreme outliers, we winsorize all data to limit values to be within 5 times its 252-day exponentially weighted moving standard deviation from its exponentially weighted moving average. Equity Index Futures consists of 12 ratio-adjusted continuous equity index futures contracts ob- tained from the Pinnacle Data Corp CLC Database. We perform backtesting from 2003 to 2020. Ticker Symbol Ticker Description SP YM EN ER MD XU XX CA LX AX HS NK S & P 500, day session Mini Dow Jones ($5.00) NASDAQ, MINI RUSSELL 2000, MINI S&P 400 (Mini electronic) DOW JONES EUROSTOXX50 DOW JONES STOXX 50 CAC40 INDEX FTSE 100 INDEX GERMAN DAX INDEX HANG SENG NIKKEI INDEX 19 US Equities consists of actively-traded US equities with data obtained from the Center for Research in Security Prices (CRSP). We screen for common stocks of domestic US companies listed on the NYSE, AMEX and NASDAQ with market capitalization from Small (300M-2B) to Mega (>200B) using the Stock Screener provided by Nasdaq. We perform a random sample of 46 stocks from the Financials sector. We perform backtesting from 1990 to 2022. Ticker Symbol Ticker Description AFG AFL AJG BAC C CADE CBSH CFR CHCO CPF CVBF FITB GL IBCP INDB JEF JPM KEY MCO MCY MKL NTRS NWLI PNC SBCF SCHW SEIC SIGI SIVB SNV SRCE STT TFC TMP TRC TROW TRST UBSI UFCS USB VALU VLY WABC WFC WRB ZION AMERICAN FINANCIAL GROUP INC NEW AFLAC INC GALLAGHER ARTHUR J & CO BANK OF AMERICA CORP CITIGROUP INC CADENCE BANK COMMERCE BANCSHARES INC CULLEN FROST BANKERS INC CITY HOLDING CO CENTRAL PACIFIC FINANCIAL CORP C V B FINANCIAL CORP FIFTH THIRD BANCORP GLOBE LIFE INC INDEPENDENT BANK CORP MICH INDEPENDENT BANK CORP MA JEFFERIES FINANCIAL GROUP INC JPMORGAN CHASE & CO KEYCORP NEW MOODYS CORP MERCURY GENERAL CORP NEW MARKEL CORP NORTHERN TRUST CORP NATIONAL WESTERN LIFE GROUP INC P N C FINANCIAL SERVICES GRP INC SEACOAST BANKING CORP FLA SCHWAB CHARLES CORP NEW S E I INVESTMENTS COMPANY SELECTIVE INSURANCE GROUP INC S V B FINANCIAL GROUP SYNOVUS FINANCIAL CORP 1ST SOURCE CORP STATE STREET CORP TRUIST FINANCIAL CORP TOMPKINS FINANCIAL CORP TEJON RANCH CO T ROWE PRICE GROUP INC TRUSTCO BANK CORP NY UNITED BANKSHARES INC UNITED FIRE GROUP INC U S BANCORP DEL VALUE LINE INC VALLEY NATIONAL BANCORP WESTAMERICA BANCORPORATION WELLS FARGO & CO NEW BERKLEY W R CORP ZIONS BANCORPORATION N A 20
http://arxiv.org/abs/2302.10174v1
2023-02-20T18:59:04
2023-02-20T18:59:04
Towards Universal Fake Image Detectors that Generalize Across Generative Models
With generative models proliferating at a rapid rate, there is a growing need for general purpose fake image detectors. In this work, we first show that the existing paradigm, which consists of training a deep network for real-vs-fake classification, fails to detect fake images from newer breeds of generative models when trained to detect GAN fake images. Upon analysis, we find that the resulting classifier is asymmetrically tuned to detect patterns that make an image fake. The real class becomes a sink class holding anything that is not fake, including generated images from models not accessible during training. Building upon this discovery, we propose to perform real-vs-fake classification without learning; i.e., using a feature space not explicitly trained to distinguish real from fake images. We use nearest neighbor and linear probing as instantiations of this idea. When given access to the feature space of a large pretrained vision-language model, the very simple baseline of nearest neighbor classification has surprisingly good generalization ability in detecting fake images from a wide variety of generative models; e.g., it improves upon the SoTA by +15.07 mAP and +25.90% acc when tested on unseen diffusion and autoregressive models.
[ "Utkarsh Ojha", "Yuheng Li", "Yong Jae Lee" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10174v1", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10174v1", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.CV", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.CV", "cs.LG" ]
Towards Universal Fake Image Detectors that Generalize Across Generative Models Utkarsh Ojha* Yuheng Li* Yong Jae Lee University of Wisconsin-Madison 3 2 0 2 b e F 0 2 ] V C . s c [ 1 v 4 7 1 0 1 . 2 0 3 2 : v i X r a Abstract With generative models proliferating at a rapid rate, there is a growing need for general purpose fake image In this work, we first show that the existing detectors. paradigm, which consists of training a deep network for real-vs-fake classification, fails to detect fake images from newer breeds of generative models when trained to detect GAN fake images. Upon analysis, we find that the result- ing classifier is asymmetrically tuned to detect patterns that make an image fake. The real class becomes a 'sink' class holding anything that is not fake, including generated im- ages from models not accessible during training. Build- ing upon this discovery, we propose to perform real-vs-fake classification without learning; i.e., using a feature space not explicitly trained to distinguish real from fake images. We use nearest neighbor and linear probing as instantia- tions of this idea. When given access to the feature space of a large pretrained vision-language model, the very simple baseline of nearest neighbor classification has surprisingly good generalization ability in detecting fake images from a wide variety of generative models; e.g., it improves upon the SoTA [49] by +15.07 mAP and +25.90% acc when tested on unseen diffusion and autoregressive models. Our code, models, and data can be found at https://github. com/Yuheng-Li/UniversalFakeDetect 1. Introduction The digital world finds itself being flooded with many kinds of fake images these days. Some could be natural images that are doctored using tools like Adobe Photoshop [1, 48], while others could have been generated through a machine learning algorithm. With the rise and maturity of deep generative models [22,29,41], fake images of the latter kind have caught our attention. They have raised excitement because of the quality of images one can generate with ease. They have, however, also raised concerns about their use for malicious purposes [4]. To make matters worse, there *Equal contribution Figure 1. Using images from just one generative model, can we detect images from a different type of generative model as fake? is no longer a single source of fake images that needs to be dealt with: for example, synthesized images could take the form of realistic human faces generated using generative adversarial networks [29], or they could take the form of complex scenes generated using diffusion models [41, 44]. One can be almost certain that there will be more modes of fake images coming in the future. With such a diversity, our goal in this work is to develop a general purpose fake detection method which can detect whether any arbitrary image is fake, given access to only one kind of generative model during training; see Fig. 1. A common paradigm has been to frame fake image de- tection as a learning based problem [10, 49], in which a training set of fake and real images are assumed to be avail- able. A deep network is then trained to perform real vs fake binary classification. During test time, the model is used to detect whether a test image is real or fake. Impressively, this strategy results in an excellent generalization ability of the model to detect fake images from different algorithms within the same generative model family [49]; e.g., a clas- sifier trained using real/fake images from ProGAN [28] can accurately detect fake images from StyleGAN [29] (both being GAN variants). However, to the best of our knowl- edge, prior work has not thoroughly explored generalizabil- ity across different families of generative models, especially to ones not seen during training; e.g., will the GAN fake classifier be able to detect fake images from diffusion mod- els as well? Our analysis in this work shows that existing methods do not attain that level of generalization ability. Specifically, we find that these models work (or fail to work) in a rather interesting manner. Whenever an image contains the (low-level) fingerprints [25, 49, 51, 52] particu- 1 lar to the generative model used for training (e.g., ProGAN), the image gets classified as fake. Anything else gets classi- fied as real. There are two implications: (i) even if diffu- sion models have a fingerprint of their own, as long as it is not very similar to GAN's fingerprint, their fake images get classified as real; (ii) the classifier doesn't seem to look for features of the real distribution when classifying an image as real; instead, the real class becomes a 'sink class' which hosts anything that is not GAN's version of fake image. In other words, the decision boundary for such a classifier will be closely bound to the particular fake domain. We argue that the reason that the classifier's decision boundary is unevenly bound to the fake image class is be- cause it is easy for the classifier to latch onto the low-level image artifacts that differentiate fake images from real im- ages. Intuitively, it would be easier to learn to spot the fake pattern to classify an image as fake, rather than to learn all the ways in which an image could be real. To rectify this undesirable behavior, we propose to perform real-vs-fake image classification using features that are not trained to separate fake from real images. As an instantiation of this idea, we perform classification using the fixed feature space of a CLIP-ViT [24, 40] model pre-trained on internet-scale image-text pairs. We explore both nearest neighbor classifi- cation as well as linear probing on those features. We empirically show that our approach can achieve significantly better generalization ability in detecting fake images. For example, when training on real/fake images associated with ProGAN [28] and evaluat- ing on unseen diffusion and autoregressive model (LDM+Glide+Guided+DALL-E) images, we obtain im- provements over the SoTA [49] by (i) +15.05mAP and +25.90% acc with nearest neighbor and (ii) +19.49mAP and +23.39% acc with linear probing. We also study the in- gredients that make a feature space effective for fake image detection. For example, can we use any image encoder's feature space? Does it matter what domain of fake/real im- ages we have access to? How large should the training fea- ture bank be for the real/fake classes? Our key takeaways are that while our approach is robust to the breed of genera- tive model one uses to create the feature bank (e.g., GAN data can be used to detect diffusion models' images and vice versa), one needs the image encoder to be trained on internet-scale data (e.g., ImageNet [21] does not work). In sum, our main contributions are: (1) We analyze the limitations of existing deep learning based methods in de- tecting fake images from unseen breeds of generative mod- els. (2) After empirically demonstrating prior methods' ineffectiveness, we present our theory of what could be wrong with the existing paradigm. (3) We use that analy- sis to present two very simple baselines for real/fake image detection: nearest neighbor and linear classification. Our approach results in state-of-the-art generalization perfor- mance, which even the oracle version of the baseline (tun- ing its confidence threshold on the test set) fails to reach. (4) We thoroughly study the key ingredients of our method which are needed for good generalizability. 2. Related work Types of synthetic images. One category involves alter- ing a portion of a real image, and contains methods which can change a person's attribute in a source image (e.g., smile) using Adobe's photoshop tool [1, 38], or methods which can create DeepFakes replacing the original face in a source image/video with a target face [2, 3]. Another recent technique which can optionally alter a part of a real image is DALL-E 2 [41], which can insert an object (e.g., a chair) in an existing real scene (e.g., office). The other category deals with any algorithm which generates all pixels of an image from scratch. The input for generating such images could be random noise [28, 29], categorical class information [7], text prompts [35, 41, 45], or could even by a collection of images [31]. In this work, we consider primarily this latter category of generated images and see if different detection methods can classify them as fake. Detecting synthetic images. The need for detecting fake images has existed even before we had powerful image gen- erators. When traditional methods are used to manipulate an image, the alteration in the underlying image statistics can be detected using hand-crafted cues such as compression artifacts [5], resampling [39] or irregular reflections [36]. Several works have also studied GAN synthesized images in their frequency space and have demonstrated the exis- tence of much clearer artifacts [25, 52]. Learning based methods have been used to detect ma- nipulated images as well [15, 43, 48]. Earlier methods stud- ied whether one can even learn a classifier that can detect other images from the same generative model [25, 33, 46], and later work found that such classifiers do not generalize to detecting fakes from other models [19, 52]. Hence, the idea of learning classifiers that generalize to other genera- tive models started gaining attention [17, 34]. In that line of work, [49] proposes a surprisingly simple and effective solution: the authors train a neural network on real/fake im- ages from one kind of GAN, and show that it can detect images from other GAN models as well, if an appropriate training data source and data augmentations are used. [10] extends this idea to detect patches (as opposed to whole im- ages) as real/fake. [6] investigates a related, but different, task of predicting which of two test images is real and which one is modified (fake). Our work analyses the paradigm of training neural networks for fake image detection, showing that their generalizability does not extend to unseen families of generative models. Drawing on this finding, we show the effectiveness of a feature space not explicitly learned for the task of fake image detection. 2 3. Preliminaries Given a test image, the task is to classify whether it was captured naturally using a camera (real image) or whether it was synthesized by a generative model (fake image). We first discuss the existing paradigm for this task [10, 49], the analysis of which leads to our proposed solution. 3.1. Problem setup The authors in [49] train a convolutional network (f ) for the task of binary real (0) vs fake (1) classification using im- ages associated with one generative model. They train Pro- GAN [28] on 20 different object categories of LSUN [50], and generate 18k fake images per category. In total, the real- vs-fake training dataset consists of 720k images (360k in real class, 360k in fake class). They choose ResNet-50 [27] pretrained on ImageNet [21] as the fake classification net- work, and replace the fully connected layer to train the net- work for real vs fake classification with the binary cross en- tropy loss. During training, an intricate data augmentation scheme involving Gaussian blur and JPEG compression is used, which is empirically shown to be critical for general- ization. Once trained, the network is used to evaluate the real and fake images from other generative models. For example, BigGAN [7] is evaluated by testing whether its class-conditioned generated images (FBigGAN ) and corre- sponding real images (RBigGAN : coming from ImageNet [21]) get classified correctly; i.e., whether f (RBigGAN ) ≈ 0 and f (FBigGAN ) ≈ 1. Similarly, each generative model (discussed in more detail in Sec. 5.1) has a test set with an equal number of real and fake images associated with it. 3.2. Analysis of why prior work fails to generalize We start by studying the ability of this network-which is trained to distinguish ProGAN fakes from real images- to detect generated images from unseen methods. In Ta- ble 1, we report the accuracy of classifying the real and fake images associated with different families of genera- tive models. As was pointed out in [49], when the target model belongs to the same breed of generative model used for training the real-vs-fake classifier (i.e., GANs), the net- work shows good overall generalizability in classifying the images; e.g., GauGAN's real/fake images can be detected with 79.25% accuracy. However, when tested on a different family of generative models, e.g., LDM and Guided (vari- ants of diffusion models; see Sec. 5.1), the classification accuracy drastically drops to near chance performance!1 Now, there are two ways in which a classifier can achieve chance performance when the test set has an equal number of real and fake images: it can output (i) a random pre- diction for each test image, (ii) the same class prediction for all test images. From Table 1, we find that for diffu- 1Corresponding precision-recall curves can be found in the appendix. CycleGAN GauGAN LDM Guided DALL-E Real acc. Fake acc. Average Chance performance 98.64 62.91 80.77 50.00 99.4 59.1 79.25 50.00 99.61 3.05 51.33 50.00 99.14 4.67 51.9 50.00 99.61 4.9 52.26 50.00 Table 1. Accuracy of a real-vs-fake classifier [49] trained on Pro- GAN images in detecting real and fake images from different types of generative models. LDM, Guided, and DALL-E represent the breeds of image generation algorithms not seen during training.1 Figure 2. t-SNE visualization of real and fake images associated with two types of generative models. The feature space used is of a classifier trained to distinguish Fake (GAN) from Real (GAN). sion models, the classifier works in the latter way, classify- ing almost all images as real regardless of whether they are real (from LAION dataset [47]) or generated. Given this, it seems f has learned an asymmetric separation of real and fake classes, where for any image from either LDM (unseen fake) or LAION (unseen real), it has a tendency to dispro- portionately output one class (real) over the other (fake). To further study this unusual phenomenon, we visualize the feature space used by f for classification. We consider four image distributions: (i) FGAN consisting of fake im- ages generated by ProGAN, (ii) RGAN consisting of the real images used to train ProGAN, (iii) FDiffusion consist- ing of fake images generated by a latent diffusion model [45], and (iv) RDiffusion consisting of real images (LAION dataset [47]) used to train the latent diffusion model. The real-vs-fake classifier is trained on (i) and (ii). For each, we obtain their corresponding feature representations using the penultimate layer of f , and plot them using t-SNE [32] in Fig. 2. The first thing we notice is that f indeed does not treat real and fake classes equally. In the learned fea- ture space of f , the four image distributions organize them- selves into two noticeable clusters. The first cluster is of FGAN (pink) and the other is an amalgamation of the re- maining three (RGAN + FDiffusion + RDiffusion ). In other words, f can easily distinguish FGAN from the other three, but the learned real class does not seem to have any property (a space) of its own, but is rather used by f to form a sink class, which hosts anything that is not FGAN . The second thing we notice is that the cluster surrounding the learned fake class is very condensed compared to the one surround- ing the learned real class, which is much more open. This indicates that f can detect a common property among im- 3 the classification in pixel space? This would not work, as pixel space would not capture any meaningful information (e.g., edges) beyond point-to-point pixel correspondences. So, any classification decision of an image should be made after it has been mapped into some feature space. This fea- ture space, produced by a network and denoted as φ, should have some desirable qualities. First, φ should have been exposed to a large number of images. Since we hope to design a general purpose fake im- age detector, its functioning should be consistent for a wide variety of real/fake images (e.g., a human face, an outdoor scene). This calls for the feature space of φ to be heavily populated with different kinds of images, so that for any new test image, it knows how to embed it properly. Second, it would be beneficial if φ, while being general overall, can also capture low-level details of an image. This is because differences between real and fake images arise particularly at low-level details [10, 52]. To satisfy these requirements, we consider leveraging a large network trained on huge amounts of data, as a possi- ble candidate to produce φ. In particular, we choose a vari- ant of the vision transformer, ViT-L/14 [24], trained for the task of image-language alignment, CLIP [40]. CLIP:ViT is trained on an extraordinarily large dataset of 400M image- text pairs, so it satisfies the first requirement of sufficient exposure to the visual world. Additionally, since ViT-L/14 has a smaller starting patch size of 14 × 14 (compared to other ViT variants), we believe it can also aid in modeling the low-level image details needed for real-vs-fake classifi- cation. Hence, for all of our main experiments, we use the last layer of CLIP:ViT-L/14's visual encoder as φ. The overall approach can be formalized in the follow- ing way. We assume access to images associated with a single generative model (e.g., ProGAN, which is the same constraint as in [49]). R = {r1, r2, ..., rN }, and F = {f1, f2, ..., fN } denote the real and fake classes respec- tively, each containing N images. D = {R∪F} denotes the overall training set. We investigate two simple classifica- tion methods: nearest neighbor and linear probing. Impor- tantly, both methods utilize a feature space that is entirely untrained for real/fake classification. Nearest neighbor. Given the pre-trained CLIP:ViT visual encoder, we use its final layer φ to map the entire training data to their feature representations (of 768 dimensions). The resulting feature bank is φbank = {φR ∪ φF } where φR = {φr1, φr2 , ..., φrN } and φF = {φf1, φf2, ..., φfN }. During test time, an image x is first mapped to its feature represen- tation φx. Using cosine distance as the metric d, we find its nearest neighbor to both the real (φR) and fake (φF ) fea- ture banks. The prediction-real:0, fake:1-is given based Figure 3. Average frequency spectra of each domain. The first four correspond to fake images from GANs and diffusion models. The last one represents real images from LAION [47] dataset. ages from FGAN with more ease than detecting a common property among images from RGAN . But why is it that the property that f finds to be com- mon among FGAN is useful for detecting fake images from other GAN models (e.g., CycleGAN), but not for detect- ing FDiffusion ? In what way are fake images from diffusion models different than images from GANs? We investigate this by visualizing the frequency spectra of different image distributions, inspired by [8, 9, 49, 52]. For each distribu- tion (e.g., FBigGAN ), we start by performing a high pass filtering for each image by subtracting from it its median blurred image. We then take the average of the resulting high frequency component across 2000 images, and com- pute the Fourier transform. Fig. 3 shows this average fre- quency spectra for four fake domains and one real domain. Similar to [49], we see a distinct and repeated pattern in StarGAN and CycleGAN. However, this pattern is miss- ing in the fake images from diffusion models (Guided [23] and LDM [45]), similar to images from a real distribution (LAION [47]). So, while fake images from diffusion mod- els seem to have some common property of their own, Fig. 3 indicates that that property is not of a similar nature as the ones shared by GANs. Our hypothesis is that when f is learning to distin- guish between FGAN and RGAN , it latches onto the arti- facts depicted in Fig. 3, learning only to look for the pres- ence/absence of those patterns in an image. Since this is sufficient for it to reduce the training error, it largely ignores learning any features (e.g., smooth edges) pertaining to the real class. This, in turn, results in a skewed decision bound- ary where a fake image from a diffusion model, lacking the GAN's fingerprints, ends up being classified as real. 4. Approach If learning a neural network f is not an ideal way to sep- arate real (R) and fake (F) classes, what should we do? The key, we believe, is that the classification process should happen in a feature space which has not been learned to separate images from the two classes. This might ensure that the features are not biased to recognize patterns from one class disproportionately better than the other. Choice of feature space. As an initial idea, since we might not want to learn any features, can we simply perform 4 Figure 4. Nearest neighbors for real-vs-fake classification. We first map the real and fake images to their corresponding feature repre- sentations using a pre-trained CLIP:ViT network not trained for this task. A test image is mapped into the same feature space, and cosine distance is used to find the closest member in the feature bank. The label of that member is the predicted class. on the smaller distance of the two: (cid:40) pred(x) = if mini (d(φx, φfi)) < mini (d(φx, φri)) 1, 0, otherwise. The CLIP:ViT encoder is always kept frozen; see Fig. 4. Linear classification. We take the pre-trained CLIP:ViT encoder, and add a single linear layer with sigmoid activa- tion on top of it, and train only this new classification layer ψ for binary real-vs-fake classification using binary cross entropy loss: L = − (cid:88) fi∈F log(ψ(φfi)) − (cid:88) ri∈R log(1 − ψ(φri)). Since such a classifier involves training only a few hun- dred parameters in the linear layer (e.g., 768), conceptually, it will be quite similar to nearest neighbor and retain many of its useful properties. Additionally, it has the benefit of being more computation and memory friendly. 5. Experiments We now discuss the experimental setup for evaluating the proposed method for the task of fake image detection. 5.1. Generative models studied Since new methods of creating fake images are always coming up, the standard practice is to limit access to only one generative model during training, and test the result- ing model on images from unseen generative models. We follow the same protocol as described in [49] and use Pro- GAN's real/fake images as the training dataset. During evaluation, we consider a variety of generative models. First, we evaluate on the models used in [49]: Pro- GAN [28], StyleGAN [29], BigGAN [7], CycleGAN [53], StarGAN [13], GauGAN [37], CRN [12], IMLE [30], SAN [18], SITD [11], and DeepFakes [46]. Each genera- tive model has a collection of real and fake images. Addi- tionally, we evaluate on guided diffusion model [23], which is trained for the task for class conditional image synthesis on the ImageNet dataset [21]. We also perform evaluation on recent text-to-image generation models: (i) Latent diffu- sion model (LDM) [45] and (ii) Glide [35] are variants of diffusion models, and (iii) DALL-E [42] is an autoregres- sive model (we consider its open sourced implementation DALL-E-mini [20]). For these three methods, we set the LAION dataset [47] as the real class, and use the corre- sponding text descriptions to generate the fake images. LDMs, being diffusion models, can be used to generate images in different ways. The standard practice is to use a text-prompt as input, and perform 200 steps of noise re- finement. One can also generate an image with the help of guidance, or use fewer steps for faster sampling. So, we consider three variants of a pre-trained LDM for eval- uation purposes: (i) LDM with 200 steps, (ii) LDM with 200 steps with classifier-free diffusion guidance (CFG), and (iii) LDM with 100 steps. Similarly, we also experiment with different variants of a pre-trained Glide model, which consists of two separate stages of noise refinement. The standard practice is to use 100 steps to get a low resolution image at 64 × 64, then use 27 steps to upsample the image to 256 × 256 in the next stage. We consider three Glide variants based on the number of refinement steps in the two stages: (i) 100 steps in the first stage followed by 27 steps in the second stage (100-27), (ii) 50-27, and (iii) 100-10. All generative models synthesize 256 × 256 resolution images. 5.2. Real-vs-Fake classification baselines We compare with the following state-of-the-art base- lines: (i) Training a classification network to give a real/fake decision for an image using binary cross-entropy loss [49]. The authors take a ResNet-50 [27] pre-trained on ImageNet, and finetune it on ProGAN's real/fake images (henceforth referred as trained deep network). (ii) We include another variant where we change the backbone to CLIP:ViT [24] (to match our approach) and train the network for the same task. (iii) Training a similar classification network on a patch level instead [10], where the authors propose to trun- 5 cate either a ResNet [27] or Xception [14] so that a smaller receptive field is considered when making the decision. This method was primarily proposed for detecting gener- ated facial images, but we study whether the idea can be extended to detect more complex fake images. We con- sider two variants within this baseline; ResNet50-Layer1 and Xception-Block2, where Layer1 and Block2 denote the layers after which truncation is applied. (iv) Training a classification network where input images are first con- verted into their corresponding co-occurrence matrices [34] (a technique shown to be effective in image steganalysis and forensics [16, 26]), conditioned on which the network pre- dicts the real/fake class. (v) Training a classification net- work on the frequency spectrum of real/fake images [52], a space which the authors show as better in capturing and dis- playing the artifacts present in the GAN generated images. All details regarding the training process of the baselines (e.g. number of training iterations, learning rates) can be found in the appendix. 5.3. Evaluation metrics We follow existing works [10, 25, 34, 49, 52] and report both average precision (AP) and classification accuracy. To compute classification accuracy for the baselines, we tune the classification threshold on the held-out training valida- tion set of the available generative model. For example, when training a classifier on data associated with ProGAN, the threshold is chosen so that the accuracy on a held out set of ProGAN's real and fake images can be maximized. In addition, we also compute an upper-bound oracle accu- racy for [49], where the classifier's threshold is calibrated directly on each test set separately. This is to gauge the best that the classifier could have performed on each test set. The details of tuning the threshold are explained in the appendix. 6. Results We start by comparing our approach to the state-of-the- art baselines in their ability to classify real/fake images from a suite of generative models. We then study the different components of our approach, e.g., the effect of network ar- chitecture, size of the feature bank for nearest neighbor. 6.1. Detecting fake images from unseen methods Table 2 and Table 3 show the average precision (AP) and classification accuracy, respectively, of all methods (rows) in detecting fake images from different generative models (columns). For classification accuracy, the numbers shown are averaged over the real and fake classes for each gener- ative model.2 All methods have access to only ProGAN's data (except [52], which uses CycleGAN's data), either for training the classifier or for creating the nearest neighbor feature bank. As discussed in Sec. 3.2, the trained classifier base- line [49] distinguishes real from fakes with good accuracy for other GAN variants. However, the accuracy drops dras- tically (sometimes to nearly chance performance ∼50-55%; e.g., LDM variants) for images from most unseen generative models, where all types of fake images are classified mostly as real (please see Table C in the supplementary). Impor- tantly, this behavior does not change even if we change the backbone to CLIP:ViT (the one used by our methods). This tells us that the issue highlighted in Fig. 2 affects deep neural networks in general, and not just ResNets. In fact, CLIP:ViT performs slightly worse than using a ResNet, which shows that the higher the capacity, the easier it is for that model to overfit to the fake artifacts during train- ing. Performing classification on a patch-level [10], using co-occurence matrices [34], or using the frequency space [52] does not solve the issue either, where the classifier fails to have a consistent detection ability, sometimes even for methods within the same generative model family (e.g., GauGAN/BigGAN). Furthermore, even detecting real/fake patches in images from the same training domain (ProGAN) can be difficult in certain settings (Xception). This indi- cates that while learning to find patterns within small image regions might be sufficient when patches do not vary too much (e.g., facial images), it might not be sufficient when the domain of real and fake images becomes more complex (e.g., natural scenes). Our approach, on the other hand, show a drastically bet- ter generalization performance in detecting real/fake im- ages. We observe this first by considering models from the same family as the training domain, i.e., GANs, where our NN variants and linear probing achieve an average accuracy of ∼93% and ∼95% respectively, while the best performing baseline, trained deep networks - Blur+JPEG(0.5) achieves ∼85% (improvements of +8-10%). This discrepancy in performance becomes more pronounced when considering unseen methods such as diffusion (LDM+Guided+Glide) and autoregressive models (DALL-E), where our NN vari- ants and linear probing achieve 82-84% average accuracy and ∼82% respectively compared to 53-58% by trained deep networks variants [49] (improvements of +25-30%). In terms of average precision, the best version of the trained deep network's AP is very high when tested on models from the same GAN family, 94.19 mAP, but drops when tested on unseen diffusion and autoregressive models, 75.51 mAP. Our NN variants and linear probing maintain a high AP both within the same (GAN) family domain, 96.36 and 99.31 mAP, and on the diffusion and autoregressive models, 90.58 and 95.00 mAP, resulting in an improvement of about +15- 20 mAP for those unseen models. 2See appendix which further breaks down the accuracies for real/fake. Also, the performance of our NN remains similar even 6 Detection method Variant Generative Adversarial Networks Pro- GAN Cycle- GAN Big- GAN Style- GAN Gau- GAN Star- GAN Deep fakes Low level vision Perceptual loss Guided SITD SAN CRN IMLE LDM Glide DALL-E 200 steps 200 w/ CFG 100 steps 100 27 50 27 100 10 Trained deep network [49] Blur+JPEG (0.1) Blur+JPEG (0.5) 100.0 93.47 84.5 99.54 89.49 98.15 89.02 73.75 100.0 96.83 88.24 98.29 98.09 95.44 66.27 86.0 ViT:CLIP (B+J 0.5) 99.98 93.32 83.63 88.14 92.81 84.62 67.23 93.48 Patch classifier [10] ResNet50-Layer1 Xception-Block2 98.86 72.04 68.79 92.96 55.9 92.06 60.18 65.82 80.88 72.84 71.66 85.75 65.99 69.25 76.55 76.19 59.47 61.2 55.21 52.87 76.34 98.24 98.94 88.75 68.74 74.52 98.4 99.52 96.22 67.59 68.52 73.72 70.62 68.57 66.0 55.74 52.52 70.05 87.84 87.1 75.03 71.0 66.68 54.51 84.94 86.72 70.54 80.65 84.91 82.07 65.39 73.29 78.02 76.23 52.2 56.64 61.13 56.64 88.1 74.54 76.28 75.84 86.4 85.37 83.73 78.38 70.59 65.93 62.74 77.07 75.67 Total mAP 83.58 81.52 73.44 75.28 77.73 Co-occurence [34] - 99.74 80.95 50.61 98.63 53.11 67.99 59.14 68.98 60.42 73.06 87.21 70.20 91.21 89.02 92.39 89.32 88.35 82.79 80.96 78.11 Freq-spec [52] CycleGAN 55.39 100.0 75.08 55.11 66.08 100.0 45.18 47.46 57.12 53.61 50.98 57.72 77.72 77.25 76.47 68.58 64.58 61.92 67.77 66.21 Ours NN, k = 1 NN, k = 3 NN, k = 5 NN, k = 9 LC 100.0 98.14 94.49 86.68 99.26 99.53 93.09 78.46 100.0 98.13 94.46 86.67 99.25 99.53 93.03 78.54 100.0 98.13 94.46 86.66 99.25 99.53 93.02 78.54 100.0 98.13 94.46 86.66 99.25 99.53 91.67 78.54 100.0 99.46 99.59 97.24 99.98 99.60 82.45 61.32 67.54 67.54 67.54 67.54 79.02 83.13 83.13 83.12 83.12 96.72 91.07 91.06 91.06 91.06 99.00 79.31 95.84 79.26 95.81 79.25 95.81 79.24 95.81 87.77 99.14 79.84 79.78 79.78 79.77 92.15 95.97 93.98 95.17 96.05 95.94 93.94 95.13 94.60 95.94 93.94 95.13 94.60 95.93 93.93 95.12 94.59 99.17 94.74 95.34 94.57 88.51 88.47 88.46 88.45 97.15 90.32 90.22 90.22 90.14 93.38 Table 2. Generalization results. Average precision (AP) of different methods for detecting real/fake images. Models outside the GANs column can be considered as the generalizing domain, since ProGAN data is being used as the train set. The improvements using the fixed CLIP:ViT feature backbone (Ours NN/LC) over the best performing baseline i.e., the trained deep network [49], is particularly noticeable when evaluating on unseen generative models (e.g., LDM), where our best performing method has significant gains over the best performing baseline: +9.8 mAP across all settings and +19.49 mAP across unseen diffusion & autoregressive models (LDM+Glide+Guided+DALL-E). Detection method Variant Generative Adversarial Networks Pro- GAN Cycle- GAN Big- GAN Style- GAN Gau- GAN Star- GAN Deep fakes Low level vision Perceptual loss Guided SITD SAN CRN IMLE LDM Glide DALL-E 200 steps 200 w/ CFG 100 steps 100 27 50 27 100 10 Trained deep network [49] 99.99 85.20 70.20 85.7 78.95 91.7 53.47 66.67 Blur+JPEG (0.1) 100.0 80.77 58.98 69.24 79.25 80.94 51.06 56.94 Blur+JPEG (0.5) Oracle∗ (B+J 0.5) 100.0 90.88 82.40 93.11 93.52 87.27 62.48 76.67 ViT:CLIP (B+J 0.5) 98.94 78.80 60.62 60.56 66.82 62.31 52.28 65.28 Patch classifier [10] ResNet50-Layer1 Xception-Block2 94.38 67.38 64.62 82.26 57.19 80.29 55.32 64.59 75.03 68.97 68.47 79.16 64.23 63.94 75.54 75.14 48.69 47.73 57.04 47.97 51.24 75.28 86.31 87.58 95.28 64.09 54.29 72.33 86.26 94.07 96.93 79.54 55.11 55.3 60.07 54.03 51.90 51.33 65.20 63.15 50.66 50.74 65.14 79.09 76.5 67.41 54.96 51.93 62.39 51.04 76.17 76.1 54.14 60.78 63.8 65.66 51.28 54.43 55.97 54.36 61.50 65.36 69.52 66.18 50.76 52.15 53.07 52.06 79.36 67.06 68.55 68.04 75.77 74.81 73.28 68.52 55.58 52.26 60.10 53.18 69.44 67.91 Total Avg. acc 69.58 64.73 76.26 60.57 68.39 71.24 Co-occurence [34] - 97.70 63.15 53.75 92.50 51.1 54.7 57.1 63.06 55.85 65.65 65.80 60.50 70.7 70.55 71.00 70.25 69.60 69.90 67.55 66.86 Freq-spec [52] CycleGAN 49.90 99.90 50.50 49.90 50.30 99.70 50.10 50.00 48.00 50.60 50.10 50.90 50.40 50.40 50.30 51.70 51.40 50.40 50.00 55.45 Ours NN, k = 1 NN, k = 3 NN, k = 5 NN, k = 9 LC 99.58 94.70 86.95 80.24 96.67 98.84 80.9 71.0 99.58 95.04 87.63 80.55 96.94 98.77 83.05 71.5 99.60 94.32 88.23 80.60 97.00 98.90 83.85 71.5 99.54 93.49 88.63 80.75 97.11 98.97 84.5 71.5 100.0 98.50 94.50 82.00 99.50 97.00 66.60 63.00 56.0 59.5 60.0 61.0 57.50 66.3 66.69 67.04 69.27 59.5 76.5 76.87 78.02 79.21 72.00 68.76 89.56 70.02 90.37 70.55 90.89 71.06 91.29 70.03 94.19 68.99 70.17 70.97 72.02 73.76 89.51 86.44 88.02 87.27 90.57 87.84 89.34 88.78 91.01 88.42 90.07 89.60 91.29 89.05 90.67 90.08 94.36 79.07 79.85 78.14 77.52 79.29 80.19 81.47 86.78 82.30 83.28 83.72 84.25 81.38 Table 3. Generalization results. Analogous result of Table 2, where we use classification accuracy to compare the methods. Numbers indicate the average accuracy over real and fake images from a test model. Oracle with ∗ indicates that the method uses the test set to calibrate the confidence threshold. Similar to Table 2, the generalization ability of the fixed feature backbone (Ours NN/LC) can be seen in the significant gain in accuracy (+25-30% over the baselines) when testing on unseen generative model families. if one varies the voting pool size from k=1 to k=9. This is good, as it shows that our method is not too sensitive to this hyperparameter in nearest neighbor search. Performing linear classification on that same feature space of CLIP:ViT encoder (Ours LC) preserves, and sometimes enhances the generalization ability of nearest neighbor classification. In sum, these results clearly demonstrate the advantage of our approach of using the feature space of a frozen, pre- trained network that is blind to the downstream task of real- vs-fake classification. 6.2. Allowing the trained classifier to cheat As described in Sec. 5.3, we experiment with an ora- cle version of the trained classifier baseline [49], where the threshold of the classifier is tuned directly on each test set. Even this flexibility, where the network essentially cheats(!) by looking at the test set, does not make the trained classifier perform nearly as well as our approach, especially for mod- 7 els from unseen domains; for example, our nearest neighbor k = 9 variant achieves an average classification accuracy of 84.25%, which is 7.99% higher than that of the oracle baseline (76.26%). This shows that the issue with training neural networks for this task is not just the improper thresh- old at test time. Instead, the trained network fundamentally cannot do much other than look for a certain set of fake patterns; when those patterns are not available, it does not have the tools to look for features pertaining to the real dis- tribution. And that is precisely where we believe the feature space of a model not trained on this task has its advantages; when certain (e.g., GAN's) low-level patterns are not found, there will still be other features that could be useful for clas- sification, which was not learned to be ruled out during the real-vs-fake training process. Figure 5. Ablation on the network architecture and pre-training dataset. A network trained on the task of CLIP is better equipped at separating fake images from real, compared to networks trained on ImageNet classification. The red dotted line depicts chance performance. Figure 6. t-SNE visualization of real (red) and fake (blue) images using the feature space of different image encoders. CLIP:ViT's feature space best separates the real features from fake. layers. We also provide a visual analysis of the pre-trained dis- tributions. Using each of the four model's feature banks consisting of the same real and fake images from ProGAN, we plot four t-SNE figures and color code the resulting 2-D points using binary (real/fake) labels in Fig. 6. CLIP:ViT- L/14's space best separates the real (red) and fake (blue) features, followed by CLIP:ResNet-50. ImageNet:ResNet- 50 and ImageNet:ViT-B/16 do not seem to have any proper structure in separating the two classes, suggesting that the pre-training data matters more than the architecture. 6.3. Effect of network backbone 6.4. Effect of training data source So far, we have seen the surprisingly good generalizabil- ity of nearest neighbor / linear probing using CLIP:ViT- L/14's feature space. In this section, we study how im- portant this choice is, and what happens if the backbone architecture or pre-training dataset is changed. We ex- periment with our linear classification variant, and con- sider the following <dataset/task>:<architecture> set- tings: (iii) ImageNet:ResNet-50, and (iv) ImageNet:ViT-B/16. For each, we again use ProGAN's real/fake image data as the training data. (ii) CLIP:ResNet-50, (i) CLIP:ViT-L/14, Fig. 5 shows the accuracy of these variants on the same models. The key takeaway is that both the network architec- ture as well as the dataset on which it was trained on play a crucial role in determining the effectiveness for fake image detection. Visual encoders pre-trained as part of the CLIP system fare better compared to those pre-trained on Ima- geNet. This could be because CLIP's visual encoder gets to see much more diversity of images, thereby exposing it to a much bigger real distribution than a model trained on ImageNet. Beyond that, CLIP is trained to align an image with a caption whereas an ImageNet classification model is trained to align an image with a label. Since a caption naturally presents more information about the image, the features extracted by CLIP need to be more descriptive, as opposed to ImageNet model's features which can focus only on the main object. Within CLIP, ViT-L/14 performs better than ResNet-50, which could partly be attributed to its big- ger architecture and global receptive field of the attention 8 So far, we have used ProGAN as the source of training data. We next repeat the evaluation setup in Table 2 us- ing a pre-trained LDM [45] as the source instead. The real class consists of images from LAION dataset [47]. Fake images are generated using an LDM 200-step variant using text prompts from the corresponding real images. In total, the dataset consists of 400k real and 400k fake images. Fig. 7 (top) compares our resulting linear classifier to the one created using ProGAN's dataset. Similar to what we have seen so far, access to only LDM's dataset also enables the model to achieve good generalizability. For example, our model can detect images from GAN's domain, which now act as the unseen image generation method, with an average of 97.32 mAP. In contrast, the trained deep net- work (Fig. 7 bottom) performs well only when the target model is from the same generative model family, and fails to generalize in detecting images from GAN variants, 60.17 mAP; i.e., the improvement made by our method for the unseen GAN domain is +37.16 mAP. In summary, with our linear classifier, one can start with ProGAN's data and de- tect LDM's fake images, or vice versa. This is encouraging from the point of view of image forensics because it tells us that, so far, with all the advancements in generative mod- els, there is still a hidden link which connects various fake images. 6.5. Effect of training data size How much training data does one need for these encour- aging results on CLIP:ViT's feature space to hold? So far, Figure 7. Average precision of methods with respect to training data. Both our linear classifier on CLIP:ViT's features (top) and the baseline trained deep network [49] (bottom) are given access to two different types of training data: (i) R = LSUN [50] and F = ProGAN [28], (ii) R = LAION [47] and F = LDM [45]. Irrespective of the training data source, our linear classifier preserves its ability to generalize well on images from other unseen generative model families. The baseline trained deep network's ability, on the other hand, suffers similarly in both settings. Figure 8. Performance of our linear classifier when the number of available images (N ) in both R and F are varied. Its performance remains more or less similar even after drastically reducing the size of the training set. our dataset sizes have been 720k/800k for ProGAN/LDM's domains. We use ProGAN's data and experiment with the following overall (real + fake) dataset size: {8k, 20k, 80k, 200k, 720k}. As one would expect, performance generally increases with bigger training data; see Fig. 8. Since the fake class in the training data comes from a GAN, the effect of data size is not felt as much in the GAN's model fam- ily (e.g., GauGAN) as it is in the diffusion model family. Still, it is worth noting that even for those unseen genera- tive models, one can reduce the dataset size requirement by ×3-4 without a large loss in generalization ability. 6.6. Visualizing distances in φ's space We next see whether distances in CLIP:ViT's feature space can tell us something about the visual quality of fake images. We use the same feature bank of ProGAN's fake images and visualize the closest/farthest nearest neighbor fake images from LDM. Fig. 9 shows that LDM generated images which are the closest nearest neighbors to ProGAN fakes do tend to be less realistic compared to LDM images which are the farthest nearest neighbors. Overall, this fur- ther adds to the utility of the feature space of a large scale model not trained for the task of interest. Figure 9. Top/bottom rows indicate fake images from LDM which are closest/farthest from ProGAN's feature space respectively. The images in the top row visually appear to be more fake than images in the bottom row. 6.7. Robustness to post-processing operations Finally, in order to evade a fake detection system, an attacker might apply certain low-level post-processing op- erations to their fake images. Therefore, following prior work [34, 49, 51, 52], we evaluate how robust our classi- fiers are to such operations. We study the effects of JPEG compression and Gaussian blurring, and compare our lin- ear classification approach using CLIP:ViT's features (Ours LC) to the trained deep network baseline [49]. Fig. 10 (left) shows the results on three types of generative models: GANs (averaged over CycleGAN, BigGAN etc.), diffusion models (averaged over LDM, Glide etc.) and autoregres- 9 Figure 10. Left: Robustness to different image processing operations. Gaussian blur (top) and JPEG compression (bottom) when tested on fake images of different breeds of generative models (columns). Both our linear classifier and the trained deep network baseline [49] are generally robust to these artifacts, while our performance is significantly higher in absolute AP on unseen generative models (Diffusion and Autoregressive). Right: Effect of Gaussian blur (top) and JPEG compression (bottom), where the corruption strength is increasing from left to right. sive model (DALL-E). Note that both our linear classifier as well as the baseline train with jpeg+blur data augmenta- tion on ProGAN real and fakes. First, we see that both our method and the baseline are generally robust to blur and jpeg artifacts. The trained deep network baseline is more consistent in its performance across the varying degrees of blur/compression, but its ab- solute AP is still much lower than ours when testing on un- seen diffusion and autoregressive model fakes. This makes sense since the baseline trains the whole network (i.e., in- cluding the features) to be specifically robust to blur+jpeg effects, whereas our linear classifier only trains the last clas- sification layer while using a pretrained backbone that was not explicitly trained to be robust to blur+jpeg artifacts. More importantly, when visualizing the effect of these op- erations on images in Fig. 10 (right), we notice that at a certain point (e.g., Gaussian blur sigma=2), the image be- comes quite blurry; thus, it's not clear that one would want to degrade image quality to such an extent solely to evade a fake detection system. Therefore, we believe that the need for robustness in such extreme cases becomes less impor- tant. 7. Conclusion and Discussion We studied the problem associated with training neural networks to detect fake images. The analysis paved the way for our simple fix to the problem: using an informative fea- ture space not trained for real-vs-fake classification. Per- forming nearest neighbor / linear probing in this space re- sults in a significantly better generalization ability of detect- ing fake images, particularly from newer methods like diffu- sion/autoregressive models. As mentioned in Sec. 6.4, these results indicate that even today there is something common between the fake images generated from a GAN and those from a diffusion model. However, what that similarity is remains an open question. And while having a better under- standing of that question will be helpful in designing even better fake image detectors, we believe that the generaliza- tion benefits of our proposed solutions should warrant them as strong baselines in this line of work. References [1] Adjust and exaggerate facial features. https://helpx.adobe.com/photoshop/how-to/face- awareliquify.html. [2] Deepfacelab. https://github.com/iperov/deepfacelab. [3] Dfaker. https://github.com/dfaker/df. [4] Faceswap. https://faceswap.dev/. [5] Shruti Agarwal and Hany Farid. Photo forensics from jpeg dimples. In IEEE Workshop on Information Forensics and Security, 2017. [6] Vishal Asnani, Xi Yin, Tal Hassner, Sijia Liu, and Xiaom- ing Liu. Proactive image manipulation detection. In CVPR, 2022. [7] Andrew Brock, Jeff Donahue, and Karen Simonyan. Large scale gan training for high fidelity natural image synthesis. arXiv, 2018. [8] Mu Cai and Yixuan Li. Out-of-distribution detection via frequency-regularized generative models. In WACV, 2023. [9] Mu Cai, Hong Zhang, Huijuan Huang, Qichuan Geng, Yix- uan Li, and Gao Huang. Frequency domain image trans- lation: More photo-realistic, better identity-preserving. In ICCV, pages 13930–13940, 2021. 10 [10] Lucy Chai, David Bau, Ser-Nam Lim, and Phillip Isola. What makes fake images detectable? understanding prop- erties that generalize. In ECCV, 2020. [11] Chen Chen, Qifeng Chen, Jia Xu, and Vladlen Koltun. Learning to see in the dark. In CVPR, 2018. [12] Qifeng Chen and Vladlen Koltun. Photographic image syn- thesis with cascaded refinement networks. In ICCV, 2017. [13] Yunjey Choi, Minje Choi, Munyoung Kim, Jung-Woo Ha, Sunghun Kim, and Jaegul Choo. Stargan: Unified genera- tive adversarial networks for multi-domain image-to-image translation. In CVPR, 2018. [14] Franc ̧ois Chollet. Xception: Deep learning with depthwise separable convolutions. In arXiv, 2017. [15] Davide Cozzolino, Giovanni Poggi, and Luisa Verdoliva. Splicebuster: A new blind image splicing detector. In IEEE International Workshop on Information Forensics and Secu- rity, 2015. [16] Davide Cozzolino, Giovanni Poggi, and Luisa Verdoliva. Recasting residual-based local descriptors as convolutional neural networks: an application to image forgery detection. In arXiv, 2017. [17] Davide Cozzolino, Justus Thies, Rossler Andreas, Riess Christian, Niessner Matthias, and Luisa Verdoliva. Forensic- transfer: Weakly-supervised domain adaptation for forgery detection. In arXiv, 2019. [18] Tao Dai, Jianrui Cai, Yongbing Zhang, Shu-Tao Xia, and Zhang Lei. Second-order attention network for single image super-resolution. In CVPR, 2019. [19] Cozzolino Davide, Thies Justus, Andreas Rossler, Matthias Niessner, and Luisa Verdoliva. Forensictransfer: Weakly- supervised domain adaptation for forgery detection. In arXiv, 2019. [20] Boris Dayma, Suraj Patil, Pedro Cuenca, Khalid Saifullah, Tanishq Abraham, Ph ́uc Lˆe Khac, Luke Melas, and Ritobrata Ghosh. Dall*e mini, 2021. [21] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, 2009. [22] Prafulla Dhariwal and Alex Nichol. Diffusion models beat gans on image synthesis. In NeurIPS, 2021. [23] Prafulla Dhariwal and Alex Nichol. Diffusion models beat gans on image synthesis. In NeurIPS, 2021. [24] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Syl- vain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In arXiv, 2020. [25] Joel Frank, Thorsten Eisenhofer, Lea Schonherr, Asja Fis- cher, Dorothea Kolossa, and Thorsten Holz. Leveraging fre- quency analysis for deep fake image recognition. In ICML, 2020. [26] Jessica Fridrich and Jan Kodovsky. Rich models for steganal- ysis of digital images. In IEEE Transactions on Information Forensics and Security, 2012. [27] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. CVPR, 2016. [28] Terro Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of gans for improved quality, stability, and variation. In ICLR, 2018. [29] Terro Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In CVPR, 2019. [30] Ke Li, Tianhao Zhang, and Jitendra Malik. Diverse image synthesis from semantic layouts via conditional imle. In ICCV, 2019. [31] Yuheng Li, Krishna Kumar Singh, Utkarsh Ojha, and Yong Jae Lee. Mixnmatch: Multifactor disentanglement and encoding for conditional image generation. In CVPR, 2020. [32] Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of Machine Learning Research, 2008. [33] Francesco Marra, Diego Gragnaniello, Cozzolino Davide, and Luisa and Verdoliva. Detection of gan-generated fake images over social networks. In IEEE Conference on Multi- media Information Processing and Retrieval, 2018. [34] Lakshmanan Natraj, Tajuddin Manhar Mohammed, Shiv- kumar Chandrasekaran, Arjuna Flenner, Amit K. Roy- Chowdhuri, and B.S. Manjunath. Detecting gan generated In Electronic fake images using co-occurrence matrices. imaging, 2019. [35] Alex Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin, Bob McGrew, Ilya Sutskever, and Mark Chen. Glide: Towards photorealistic image genera- tion and editing with text-guided diffusion models. In ICML, 2022. [36] James F. O'Brien and Hany Farid. Exposing photo manipu- lation with inconsistent reflections. In ACM Transactions on Graphics, 2012. [37] Taesung Park, Ming-Yu Liu, Ting-Chun Wang, and Jun-Yan Zhu. Semantic image synthesis with spatially-adaptive nor- malization. In Proceedings of the IEEE Conference on Com- puter Vision and Pattern Recognition, 2019. [38] Taesung Park, Jun-Yan Zhu, Oliver Wang, Jingwan Lu, Eli Shechtman, Alexei A. Efros, and Richard Zhang. Swapping In Advances in autoencoder for deep image manipulation. Neural Information Processing Systems, 2020. [39] Alin C. Popescu and Hany Farid. Exposing digital forgeries by detecting traces of resampling. In IEEE Transactions on signal processing, 2005. [40] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning transferable visual models from natural language supervision. In ICML, 2021. [41] Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical text-conditional image gener- ation with clip latents. In arXiv, 2022. [42] Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. In ICML, 2021. [43] Yuan Rao and Jiangqun Ni. A deep learning approach to detection of splicing and copy-move forgeries in images. In IEEE International Workshop on Information Forensics and Security, 2016. 11 [44] Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Bj ̈orn Ommer. High-resolution image syn- thesis with latent diffusion models, 2021. [45] Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Bjorn Ommer. High-resolution image syn- thesis with latent diffusion models. In CVPR, 2022. [46] Andreas R ̈ossler, Davide Cozzolino, Luisa Verdoliva, Chris- tian Riess, Justus Thies, and Matthias Niessner. FaceForen- sics++: Learning to detect manipulated facial images. In International Conference on Computer Vision, 2019. [47] Christoph Schuhmann, Richard Vencu, Romain Beaumont, Robert Kaczmarczyk, Clayton Mullis, Aarush Katta, Theo Coombes, Jenia Jitsev, and Aran Komatsuzaki. Laion-400m: Open dataset of clip-filtered 400 million image-text pairs. In Data Centric AI NeurIPS Workshop 2021, 2021. [48] Sheng-Yu Wang, Oliver Wang, Andrew Owens, Richard Zhang, and Alexei A Efros. Detecting photoshopped faces by scripting photoshop. In ICCV, 2019. [49] Sheng-Yu Wang, Oliver Wang, Richard Zhang, Andrew Owens, and Alexei A Efros. Cnn-generated images are sur- prisingly easy to spot...for now. In CVPR, 2020. [50] Fisher Yu, Yinda Zhang, Shuran Song, Ari Seff, and Jianx- iong Xiao. Lsun: Construction of a large-scale image dataset using deep learning with humans in the loop. 2015. [51] Ning Yu, Larry S. Davis, and Mario Fritz. Attributing fake images to gans: Learning and analyzing gan fingerprints. In ICCV, 2019. [52] Zu Zhang, Svebor Karaman, and Shih-Fu Chang. Detecting and simulating artifacts in gan fake images. In WIFS, 2019. [53] Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle- consistent adversarial networks. In ICCV, 2017. 12
http://arxiv.org/abs/2302.10167v2
2023-05-25T06:30:04
2023-02-20T18:54:04
Cross-domain Compositing with Pretrained Diffusion Models
Diffusion models have enabled high-quality, conditional image editing capabilities. We propose to expand their arsenal, and demonstrate that off-the-shelf diffusion models can be used for a wide range of cross-domain compositing tasks. Among numerous others, these include image blending, object immersion, texture-replacement and even CG2Real translation or stylization. We employ a localized, iterative refinement scheme which infuses the injected objects with contextual information derived from the background scene, and enables control over the degree and types of changes the object may undergo. We conduct a range of qualitative and quantitative comparisons to prior work, and exhibit that our method produces higher quality and realistic results without requiring any annotations or training. Finally, we demonstrate how our method may be used for data augmentation of downstream tasks.
[ "Roy Hachnochi", "Mingrui Zhao", "Nadav Orzech", "Rinon Gal", "Ali Mahdavi-Amiri", "Daniel Cohen-Or", "Amit Haim Bermano" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10167v2", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10167v2", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.CV", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.CV", "cs.GR", "cs.LG" ]
Cross-domain Compositing with Pretrained Diffusion Models Roy Hachnochi1 Ali Mahdavi-Amiri2 Mingrui Zhao2 Daniel Cohen-Or1 Nadav Orzech1 Rinon Gal1 Amit Haim Bermano1 1Tel Aviv University 2Simon Fraser University https://github.com/cross-domain-compositing/cross-domain-compositing 3 2 0 2 y a M 5 2 ] V C . s c [ 2 v 7 6 1 0 1 . 2 0 3 2 : v i X r a Figure 1: Various applications of our method. Top-left: local editing of an image by using scribble and text guidance. Top-right: Cross-domain immersion of real image into painting. Bottom: Constructing a geometrically coherent scene around a CG-object and simultaneously altering its style for data augmentation of downstream tasks such as Single View Reconstruction (SVR). ABSTRACT Diffusion models have enabled high-quality, conditional image edit- ing capabilities. We propose to expand their arsenal, and demon- strate that off-the-shelf diffusion models can be used for a wide range of cross-domain compositing tasks. Among numerous others, these include image blending, object immersion, texture-replacement and even CG2Real translation or stylization. We employ a localized, iterative refinement scheme which infuses the injected objects with contextual information derived from the background scene, and enables control over the degree and types of changes the object may undergo. We conduct a range of qualitative and quantitative com- parisons to prior work, and show that our method produces higher quality and realistic results without requiring any annotations or training. Finally, we demonstrate the advantage of cross-domain compositing in data augmentation for downstream tasks. 1 INTRODUCTION The ability to compose new scenes from given visual priors is a long standing task in computer graphics. Commonly, the goal is to extract objects from one or more images, and graft them onto new scenes. This task is already challenging, requiring the novel objects to be harmonized with the scene, with consistent illumina- tion and smooth transitions. However, this challenge is exacerbated when the components originate in different visual domains - such as when inserting elements from natural photographs into paint- ings, or when introducing 3D-rendered objects into photo-realistic scenes. In such cases, the objects should be further transformed to match the style of the new domain, without harming their content. We propose to tackle this Cross-Domain Compositing task by leveraging diffusion-based generative models. Such models have recently lead to remarkable strides in image synthesis and manip- ulation tasks, where pre-trained diffusion models often serve as powerful visual priors which can ensure realism and coherency while also preserving image content. Here, we aim to use such models to naturally infuse new scenes with cross-domain objects. Our approach aims to accomplish two goals: First, it must be ca- pable of inducing local changes in an image, based on a visual input. Second, it should allow for minor changes in the input, to better immerse it in the surrounding scene. Ideally, these changes should be controllable, allowing a user to dictate the type and extent of sim- ilarity they wish to preserve. We tackle these goals by expanding on recent work in diffusion-based inpainting and conditional guidance. We propose an iterative, inference-time conditioning scheme, where localized regions of the image are infused with controllable levels of information from given conditioning inputs. In fig. 1, we demonstrate a range of applications enabled by this approach, including: injecting real objects into paintings, convert- ing low-quality renders into realistic objects, and scribble-based editing. We compare our method to existing baselines across multiple tasks and demonstrate its visually pleasing results, to the extent that it can even serve as a data-augmentation pipeline, diminishing the gap between performance on simulated data and real images. 2 RELATED WORK Image composition is a well-studied task in computer graphics. Compositions are used for image editing and manipulation [31], 1 SVRModelTraining Data and even for data augmentation [14; 58]. Traditional techniques for inserting 2D object patches into images include alpha matting [44] and Poisson image editing [37]. These approaches involve blending a foreground object into a background image by creat- ing a transition region. However, compositing typically requires additional transformations, which have recently been tackled in the context of deep learning literature. Some learn to apply ap- propriate transformations (e.g., scale and translation) [31; 58] to an object patch to better place it into a scene image. Some works leverage Conditional GANs to map images of different objects (e.g., a basket and a bottle) into a combined sample (e.g., a basket with a bottle in it) that captures the realistic interactions between the objects [2]. Others improve realism by inserting appropriate shad- ows [22]. Another fundamental sub-field is image harmonization, which aims to correct for any mismatch in illumination between the new patch and the background [10; 11; 47]. [9] do this by encod- ing illumination information from the background and translating the foreground domain accordingly, while [23] disentangle image representation into content and appearance, and accomplish har- monization by translating solely the appearance of the foreground by that of the background. Finally, compositing methods that aim at inserting 3D objects into scenes typically first determine the geometry and lighting of the scene. They then generate an im- age of the 3D object conditioned on these and insert it into the scene [12; 15; 26; 27; 29; 54]. In contrast to these approaches, our work tackles the task of cross-domain compositing, where the inserted patch and the scene belong to different visual domains. Our goal is therefore not only object preservation and blending, but also simultaneous matching of domains. Moreover, we leverage pretrained models without having to rely on pretrained detectors or additional labels. Image editing with diffusion models. The use of diffusion models [20; 45] to modify images is a topic of considerable research. These models have been employed for image inpainting [33; 43; 45], scribble-based modifications [6; 34] or in-domain compositing operations [34]. More recently, text-based diffusion models [36; 39; 41] have been leveraged for editing operations guided by natural language. These include text or reference-based inpainting [1; 16; 36; 53] and outpainting [39], to directly modifying an image according to given prompts [19; 28; 35; 48; 49]. Our method is related to the guided inpainting line of work, where the inpainting is guided using a visual reference. However, in contrast to current approaches, the visual reference need not be from the same visual domain. Moreover, our work employs pretrained diffusion models, without requiring task-specific train- ing [36; 43; 53] or tuning on individual reference images [16]. Single-view 3D reconstruction (SVR) is the task of recon- structing a 3D model from a single 2D image. One major challenge in this domain is that existing deep learning solutions, which heav- ily rely on synthetic data [5] for training, struggle when applied to real-world images. Existing works [7; 8; 50; 51] attempted on this issue by fine-tuning SVR networks over in-the-wild images, pre- segmenting objects from the backgrounds or augmenting training data background by naive composition, while none of them explic- itly tackle the sim-to-real domain gap between synthetic training dataset and real-world testing images. In this paper, we demonstrate 2 Hachnochi, R. et al. that our composition method can serve as an effective augmenta- tion technique to address this domain gap by seamlessly generating a realistic and plausible scene around a rendered 3D model. 3 METHOD 3.1 Preliminaries Diffusion models [20] have advanced the state-of-the-art in image generation [13]. They work by learning to reverse a time-dependent noising process, given by the closed form equation: √ 1 − σt xt −1, σt I), qθ (xt |xt −1) = N ( √︁αt x0 + xt = √ (1) s=1 1 − αt ε where x0 is a given, noise-less image, t is a timestep, ε ∼ N (0, I) is a random noise sample, σt is a predefined noise-level schedule, αt = Πt αs and αt = 1 − σt . At inference time, diffusion models can be used to synthesize new images by taking a random noise sample xT ∼ N (0, I) and iteratively denoising it. Given a noised image xt at time-step t, the model predicts the next-step xt −1 as: pθ (xt −1|xt ) = N (μθ (xt , t), σt I), (cid:18) xt − μθ (xt , t) = 1 − αt √ 1 − αt 1 √ αt εθ (xt , t) (cid:19) , (2) where εθ is a neural network that learns to predict the noise at each step. Additionally, at each timestep, one can approximate the noiseless image ˆx0 through: xt √ αt 1 − αt εθ (xt , t) αt ˆx0 = √ √ (3) − . This method may be further generalized for sampling from conditional distributions by conditioning the denoising network εθ (xt , t, y) and applying classifier-free guidance [21]. y may be any type of condition, such as a class label or a text-embedding derived from an LLM such as CLIP [38]. 3.2 Masked ILVR Our goal is to create composite images which contain parts from dif- ferent visual domains. To do so, we require a method that allows for retaining the structure and semantics of the object, while changing its appearance to match the new domain. The result should ideally both appear similar to the reference image, and realistically match the background domain. Moreover, this method should tackle other compositing requirements, such as realistic blending. We propose to tackle all these requirements at once at inference- time by leveraging a pretrained diffusion model. To do so, we would like to condition the diffusion process on external image inputs, such as a desired background and a set of foreground objects. One way to do so is to leverage ILVR [6]: for each denoising step t, the diffusion model first predicts a proposal x ′ t −1|xt ). Then, the proposal is refined by injecting low-frequency data from a reference image via the following update rule: t −1), t −1), xt −1 = φ (yt −1) + (I − φ)(x ′ t −1 + φ (yt −1) − φ (x ′ t −1 ∼ pθ (x ′ = x ′ (4) Cross-domain Compositing with Pretrained Diffusion Models Figure 2: Single diffusion step of our method. Top: In each step the image is denoised using the diffusion model, and blended with the noised reference image using our method. Bottom left: The image is refined by mixing low frequencies of the reference image with high frequencies of the current step image, using the same LPF. The result is blended with the current image according to the time mask. Bottom right: Our blending algorithm allows control over the filters in different image regions and blends the result by using smoothed mask. where yt −1 ∼ q(yt −1|y0) is a noised version of the conditioning image (sampled through eq. (1)), and φ is a low-pass filter operation. Intuitively, this process overwrites all the low-frequency infor- mation with that derived from the conditioning image, allowing for a degree of structure to be inherited while still enabling high- frequency modifications. In practice, φ is implemented through a bi-linear down-sampling and up-sampling step with a scaling factor of N . This refinement operation is repeated for every dif- fusion step until some user-defined threshold Tstop , after which denoising continues without guidance for every t < Tstop . These two parameters, N and Tstop , grant control over similarity to the reference image. Higher N and higher Tstop will result in higher diversity but less fidelity to the conditioning image, since fewer frequencies are overridden and for fewer steps. These parameters therefore introduce control over the inherent trade-off between fidelity to the reference image and its realism. We aim to expand this idea to provide the user with local control over this trade-off. A naïve way to leverage ILVR for localized editing is to apply it inside local masks. There, we can control the ILVR parameters Tstop and N individually. However, ILVR was designed as a global method, and attempts to apply it in a local manner lead to the advent of visual artifacts (see fig. 3). We investigate these artifacts and observe that they appear along the boundaries of the masked regions, and become more pronounced as the gap increases between the noise statistics of the image regions (e.g., when N changes significantly between regions). We hypothesize that this is a consequence of frequency aliasing [24; 56], originating from the sharp transition 3 Figure 3: Demonstration of the aliasing artifacts and an intermediate timestep of φ (yt ) for t = 50. We hypothesize that the sharp edges intro- duced at intermediate steps are the cause of these artifacts. Our blending method mitigates these artifacts. between regions. To overcome these hurdles, we propose to modify ILVR with the following scheme, illustrated in fig. 2. Localizing the control. To allow local control, we apply the ILVR process into separate image regions. Given a reference image y ∈ RH ×W ×C and a mask M ∈ [0, 1]H ×W , the user may separately define Nin, Nout for the low-pass filters φin, φout respectively, and Tin,Tout as the ILVR strengths per region. These allow us to define a combined linear low-pass filtering operator: φ (x; Mb ) = Mbφin (x) + (1 − Mb )φout (x), (5) Freq.Blendq(yt−1|y)yyt−1xtxt−1x0xTpθ(xt−1′|xt)Diffusion Modelxt−1′φφoutφin⋅(1−Mb)⋅MbφHPFI−φyt−1xt−1′LPFφLinear Blendxt−1Freq.BlendMtφ(yt=50)Resultw.o.blendw. blendReference + Mask where Mb is the blending mask. Following ILVR, we would also like to enable different conditioning-stop times in each region. This is done by introducing a 'time-mask' Mt into eq. (4): xt −1 = x ′ t −1 + Mt (φ (yt −1) − φ (x ′ (6) where Mt is set to 0 in regions for which t < Tstop . Formally, the blending mask Mb and the time mask Mt are defined as: t −1)), , T T (7) 1 0 (cid:40) (t) = M (i,j ) t Mb = M, MT = (1 − Tin)T * M + (1 − Tout )T * (1 − M), : t < M (i,j ) : t ≥ M (i,j ) where T is the total number of diffusion steps and Tin, Tout define the fraction of steps that should use the ILVR condition in each region. For example, Tin = 0.2,Tout = 1 would result in applying ILVR guidance for 20% of the diffusion steps inside the mask and 100% outside. This per-region parameter separation allows for local control over the fidelity-realism trade-off, independently within each area of the image. We note that this control may also be applied to latent diffusion models [42] if the latent space has spatial consistency with the pixel space. In such cases, we can simply apply low-pass filtering in latent space. Overcoming the aliasing artifacts. As noted, we find that for pixel space diffusion models (e.g., Guided Diffusion [13]) this method induces unnatural, wave-like artifacts on the resulting image. To mitigate them, we propose two alternatives that aim to remove the sharp boundaries in the noise statistics. As a first alternative, we propose to apply the ILVR blending steps (i.e., eqs. (5) and (6)) in the approximated ˆx0-space instead of xt . When doing so, the low-pass filter φ is applied only to the image and not to the noise, which can then be added to the image post-blending. This ensures that no sharp edges are existent in the noise map, maintains the appropriate noise levels for each timestep, and successfully overcomes the artifacts. A second alternative is to add a smoothing operator b (M) to be applied on the masks Mb, Mt . This approach can overcome the alias- ing effect by smoothing transitions between different regions of the images. We observe experimentally (appendix B) that the blurring factor should have a spatial length of roughly max (Nin, Nout ). That is, it should ensure that the transition remains smooth even in the down-scaled images. This eliminates the sharp transitions of the noise levels between image regions, and eliminates the noise, as shown in fig. 3. Additional analysis and implementation details of this approach are given in appendix A and appendix B. In practice, we find that the first method works better when using a model which is able to predict a plausible ˆx0 image in inter- mediate diffusion steps, such as models trained on more constrained domains. We hypothesize that this is related to the ability to mean- ingfully interpolate between the reference image and the prediction. If the prediction is out-of-domain, the interpolation will deteriorate the image, and result in non-meaningful guidance. In such cases, it is preferable to use the smoothed noise-space blending approach. Finally, we note that for latent diffusion models this effect is more subdued. We theorize that this is due to the latent decoder's abilities to compensate for some of the artifacts in the diffused latents. 4 Hachnochi, R. et al. Step repetitions. Our approach allows for cross-domain infor- mation to diffuse between the two image regions, allowing for a degree of domain-matching. However, the rate of information trans- fer is largely limited by the receptive field of the denoising network which in some cases may be too low (e.g., for compositing large objects). We would therefore like to infuse the object with more cross-domain information from the background, without changing it or causing it to lose structure. RePaint [33] showed that simply repeating denoising steps can have such an effect, in essence extend- ing the receptive field and allowing more time for information to pass between the regions. We thus employ a similar approach. We note that dedicated inpainting models can also provide an advan- tage for structure preservation when such are available. However, these are not designed to perform inpainting with a given visual object, while our method does. 4 APPLICATIONS AND EVALUATION We demonstrate various applications of our method and perform qualitative and quantitative evaluations and comparisons. In sec- tion 4.2 we present results on image modification guided by a rough user edit, including comparisons with prior baselines. Section 4.3 shows how our compositing method may be applied to object im- mersion, and how it compares with state-of-the-art approaches. In section 4.4 we utilize our method to bridge the domain gap between rendered and photo-realistic images which are then used to train Single View 3D-Reconstruction (SVR) models. We show that train- ing on such data can lead to improved downstream performance on real images. In section 4.5 we conduct an ablation study and demonstrate the effects of the model's parameters. Throughout these experiments we use Stable Diffusion [40] as our diffusion model. For additional results see appendix J. 4.1 Evaluation metrics. We evaluate our method on two aspects: fidelity to the original images, and realism. For fidelity analysis, we use LPIPS [57] and PSNR to measure the similarity between the foreground object pre- and post-composition. For realism, we use two metrics: First, the CLIP directional similarity score (eq. (8)), introduced in [17] and established as a metric in [4]. Here, we compare the pre- and post-composition CLIP-space embeddings of the foreground object and ensure they match a given textual direction (e.g., "photo" to "painting"). Second, we use a CLIP similarity improvement metric (eq. (9)), where we investigate if the CLIP-similarity between the object and the background domain has improved post-composition. These metrics are defined by: ΔT = ET (ttarget ) − ET (tsource ), ΔI = EI (Ipred ) − EI (Ire f ), CLIPdir = ΔI * ΔT |ΔI ||ΔT | , CLIPSI = EI (Ipred ) * ET (ttarget ) EI (Ire f ) * EI (Itarget ) , (8) (9) where ET , EI are CLIP's textual and image encoders, respectively, and ttarget , tsource are the texts describing the target and source domains. Last, we evaluate background preservation using LPIPS and PSNR. Cross-domain Compositing with Pretrained Diffusion Models 4.2 Image modification via scribbles We investigate the use of our method for scribble-based editing, where only a user-designated area should change based on the scribble and some text prompt. Qualitative comparison. In fig. 4 we compare our method qual- itatively to SDEdit and ILVR, including a masked-SDEdit approach. SDEdit and ILVR struggle at preserving the image background. For high editing strength (high strength for SDEdit, high Tstop for ILVR) their results match the text prompt but have no similarity to the reference image, while low edit strengths result in failure to transform the scribbles to realistic objects. This is natural since these are both global guidance methods. Masked-SDEdit succeeds in preserving the image but often fails in morphing the scribbles. Our method succeeds both in preserving background features and in adherence to the scribbled guidance. Moreover, our results are altered to better fit the background. These are a consequence of the increased control over the amount of overridden frequencies and separated foreground-background control. Quantitative comparison. We evaluate all methods over a set of 24 scribble images, using the metrics of section 4.1. Re- sults are shown in table 1 (top). For CLIP-based scores we use tsource = "drawing", ttarget = "photo". Our method better matches the target domain and improves background preservation, but has lower fidelity scores. This is due to the comprehensive domain changes, which modify the content in a way that harms pixel-level scores. Figure 4: Qualitative comparison of local image editing using scrib- ble guidance. For each method we run a parameter sweep and choose the empirically best results. Other methods fail in preserving the background or in altering the scribble into a realistic object. Specifically notice the high-frequency details which were added to the scribbles, such as folds and buttons to the suit or shadows and texture to the pillows. Textual prompts from top to bottom: a corgi wearing a business suit, a cat reading a book, a living room with a sofa and a table, a sofa with pillows. 5 4.3 Object Immersion Figure 5: Object immersion comparison. We compare our method on the task of object immersion across several methods. Our results (right column) exhibit more adequate style-matching, crafting the object to match its background while leaving it intact. The goal of object immersion is to blend an object into a given styled target image, (e.g. a painting) while preserving the coarse features of the object and transforming only its style to that of the target. Quantitative evaluation. We compare our method with Deep Image Blending [55], Poisson Image Blending [37], and Paint By Example [53], a concurrent work that trains a Diffusion Model to allow subject-driven image inpainting, based on a single ref- erence image. Qualitative results are provided in fig. 5. For our method we choose Tin = 0.5, Nin = 2, R = 0.2 (see section 4.5), providing a reasonable trade-off between fidelity to the reference image and style-matching, and Tout = 1, Nout = 1 to perfectly preserve the background. We manually curate a 40-image evalu- ation set, constructed by pasting cropped objects of various sizes from [32] on top of paintings from [18]. We evaluate our method through two approaches. First, we conducted a user study where users were asked to pick the best results between pairs of our re- sult and one of the compared methods. We collected answers from 116 participants, each answering 20 questions, for a total of 2, 320 comparisons. The results are provided in fig. 6. Our method out- performs the baselines on user preference scores. In table 1 we show the fidelity and realism metrics. For the CLIP-based scores, we use tsource = "photo", ttarget = "oil painting". Our method outperforms all baselines in foreground fidelity and realism scores, but shows diminished background preservation. Further examina- tion shows that this is the result of the use of a latent diffusion model, which contains an encoder-decoder setup. This approach compresses the image and therefore loses some information. To better quantify our background preservation, we thus also evaluate a reconstruction-only setup. We report reconstruction background PSNR and LPIPS results as 23.478 and 0.181 respectively, which align with our scores (23.064, 0.159, table 1), and with Paint By Example (20.789, 0.208), which is also an LDM-based method. 4.4 Single-view 3D Reconstruction (SVR) Current SVR works struggle when applied to real-world images, due to training on synthetic data but inferring on real images. Our method stands as a powerful tool for bridging this domain gap. We demonstrate this on rendered shapes from ShapeNet [52] by gener- ating backgrounds with Stable Diffusion's inpainting model [41]. OursILVRMasked SDEditSDEditReferenceInputCopy and PastePoisson BlendingDeep ImageBlendingOursPaint By Example Table 1: Quantitative comparison. We evaluate fidelity and realism for the foreground, as well as background preservation. Our method demonstrates the best balance between fidelity and realism, and achieves the best background preservation scores among the other latent-diffusion-based methods. Hachnochi, R. et al. PSNR FG (↑) LPIPS FG (↓) PSNR BG (↑) LPIPS BG (↓) CLIPdir (↑) CLIPSI (↑) Scribbles Immersion SDEdit ILVR Masked SDEdit Ours Poisson Image Blending Deep Image Blending Paint By Example Ours 25.596 26.015 25.562 25.059 27.387 27.742 24.128 29.683 0.399 0.364 0.379 0.394 0.439 0.345 0.535 0.339 17.880 19.047 25.504 29.526 40.233 38.297 20.789 23.064 0.431 0.383 0.215 0.068 0.037 0.046 0.208 0.159 0.054 0.058 0.076 0.093 0.019 -0.003 -0.030 0.028 1.046 1.059 1.061 1.074 1.135 1.110 1.027 1.214 Figure 6: Object immersion user study. Participants were presented with input images and pairs of outputs from our method and a baseline and asked to select the result which best matches the object to the background, while preserving its characteristics. We show the percentage of users who preferred each method. Using our method, we maintain control over the degree of domain matching between the foreground and augmented background us- ing Tin. We focus our experiments on two model types: sofas and chairs. For each, we generate augmented datasets for different Tin values. In addition, we prepare baseline data by naïve image com- position (copy & paste) with background images generated using Stable Diffusion. Subsequently, we trained an off-the-shelf SVR network, D2IMNet [30], on each of these datasets, and assessed it against real in-the-wild images. Note that Tin = 1 in our method re- duces to vanilla inpainting and prevents changes to the foreground. SVR models trained on Tin = 1, original and copy & paste datasets together serve as baselines. Quantitative evaluation. We collect 100 sofa and chair images from the internet with typical poses, no obstructions, and varying backgrounds and lighting conditions. Figure 7 shows qualitative SVR results across different augmentation setups. Both naïve base- lines (original, and copy & paste) fail on real images. We quantify our advantage through a 2D IoU [59] metric between the input object mask and the reconstructed 3D entity silhouette rendered at the corresponding camera pose, shown in table 2, for more details see appendix I. Our augmentation method improves the baselines by: (a) generating a realistic and contextual-aware background, (b) transforming the objects from low-quality renders to more photo- realistic results. Please refer to appendix J for additional results and discussion. 4.5 Parameter Ablation In fig. 8 we inspect the effect of each parameter on the results. We denote Tin as the portion of diffusion steps for which our method is applied in the masked region, Nin as the scaling factor for the Figure 7: Single View 3D Reconstruction results of D2IMNet trained on different dataset. Top: Sample image from each dataset. Bottom: SVR results on in-the-wild images produced by respective SVR model. Using our method as augmentation proves to generalize better to real images. Table 2: 2D IoU evaluated on models trained on different datasets. The numbers in the first row describe the Tin value used for background aug- mentation. CP stands for copy-paste dataset. Original 0.25 0.5 0.75 1.0 CP Sofa Chair 0.535 0.434 0.650 0.623 0.554 0.464 0.486 0.529 0.564 0.474 0.455 0.301 masked region and R as the relative diffusion step from which re-sampling is performed (see appendix G). For each parameter we fix the other two and investigate its effect. Lower Tin results in less similarity to the reference image, allowing more details to be added, with the extreme case of Tin = 0 reducing to simple inpainting. This results in less-appealing and less-accurate outputs, showing that naive inpainting with textual guidance is not sufficient for these edits. Increasing Nin has a similar effect, while using a large Nin may result in breaking the structure of the object. R controls the effective receptive field of the guided inpainting, such that increasing it allows for more semantic and style details to be transferred into the edited region. In appendix D we provide a deeper analysis of these effects, including a quantitative evaluation 6 OursOursDeep ImageBlendingPoisson ImageBlendingInputOriginal!.#$!.$!.%$&.!Copy and Paste Cross-domain Compositing with Pretrained Diffusion Models Figure 8: Effect of parameters. Nin is the foreground scaling factor, and controls the structural similarity to the reference object. Tin is the strength of ILVR for the foreground, and controls fine-grained changes of the object. R is the relative timestep from which re-sampling begins, allowing details and style from the background to propagate into the object. of the fidelity-realism tradeoffs induced by these parameters, and an investigation of automatic approaches for parameter selection. 4.6 Implementation Details We implemented our method over two open-source diffusion mod- els: Guided Diffusion [13] and Stable Diffusion [40]. For Guided Diffusion, we use the unconditional FFHQ [25] models from [6] (see appendix C). For Stable Diffusion we use the sd-v1-4 checkpoint, except for the SVR experiments where we use the sd-v1-5 inpainting checkpoint. For all Stable Diffusion experiments we set the number of diffusion steps as T = 50 and use DDIM sampling [46], for Guided Diffusion we set T = 250 and use DDPM sampling. Inference times are affected by R, and are displayed in table 3. For quantitative metrics evaluation, we use CLIP ViT-L/14@336px. The SVR model D2IMNet is constituted of two sub-networks, SDFNet and CamNet. Both sub-networks are trained using Adam with 5e−5 learning rate and 16 batch size for 400 epochs. This con- figuration remains the same for all trained models. For additional implementation details for SVR see appendix H. 5 LIMITATIONS Figure 9 demonstrates several failure cases of our method. A pri- mary limitation lies in applying our method to small objects. This mainly originates in our use of LDMs, which work in a low-resolution latent space and may fail to preserve fine details. We address this limitation in appendix F and propose to tackle this limitation by applying our method to cropped portions of the background, where the small inserted object represents a larger portion of the image. Table 3: Inference times of a single-image batch for varying R values, evaluated on an Nvidia GeForce RTX 2080 Ti. R time [sec] 0 7 0.2 19 0.4 30 0.6 42 0.8 54 7 Figure 9: Limitations. Failure cases of our method include: (1) Difficult and detailed objects, (2) Difficult viewpoints, making it challenging for the model to understand the semantics, (3) Small and detailed objects, (4) Out of domain content, e.g., text. Another challenge arises when the diffusion model misattributes the infused object to its semantic class. This issue often arises with challenging reference images, such as non-standard models, unnat- ural CG renders, or difficult views for SVR augmentation. This is no- tably prevalent with small, hard-to-identify images (e.g., ShapeNet airplanes). Possible mitigation strategies could involve modify- ing the attention layers, using methods like Paint-By-Word [3] or Prompt-to-Prompt [19] for improved text and object-mask align- ment. For additional discussion see appendix J. Our method does not tackle all aspects of image compositing. Although it succeeds in blending the targets, and often generates proper lighting and shading that matches the scene (see fig. 4), it fails in generating appropriate shadows without user guidance. Finally, as discussed throughout the paper, our method contains an inherent trade-off between fidelity and realism. This trade-off is controlled mostly by Nin,Tin, R (section 4.5), but it may require a user to generate a grid of results for multiple configurations and manually choose the most pleasing ones. In appendix E we propose a method to expedite this process by suggesting a score function based on the metrics presented in section 4.1. 6 CONCLUSIONS We presented a technique for cross-domain compositing, using pre- trained diffusion models. Our approach works at inference time, requiring no fine-tuning or optimization. Through various quantita- tive and qualitative studies, we demonstrated that our technique is effective for seamlessly merging partial images from distinct visual domains across different applications, including: image modifica- tion, object integration, and data augmentation for SVR. The use of diffusion models for compositing should not be taken for granted. Diffusion models are typically trained on the whole im- age, and hence they excel in global applications which consider the entire image, rather than local regions. However, models that were trained on a large number of domains have the innate capacity to compose coherent images from separate partial results. Our Cross- domain Compositing technique is based on these characteristics of large conditional diffusion models. An interesting future work is extending cross-domain composi- tion and its application to video. While many principles that were used for images can be easily extended to video, the maintenance of the temporal coherence along the video remains challenging. 00.20.40.60.8Tin00.20.40.60.8RReferenceNin124ReferenceResult(1)(2)(3)(4) REFERENCES [1] Omri Avrahami, Ohad Fried, and Dani Lischinski. 2022. Blended Latent Diffusion. arXiv preprint arXiv:2206.02779 (2022). [2] Samaneh Azadi, Deepak Pathak, Sayna Ebrahimi, and Trevor Darrell. 2020. Com- positional GAN: Learning image-conditional binary composition. 128, 10 (2020). [3] Yogesh Balaji, Seungjun Nah, Xun Huang, Arash Vahdat, Jiaming Song, Karsten Kreis, Miika Aittala, Timo Aila, Samuli Laine, Bryan Catanzaro, et al. 2022. ediffi: Text-to-image diffusion models with an ensemble of expert denoisers. arXiv preprint arXiv:2211.01324 (2022). [4] Tim Brooks, Aleksander Holynski, and Alexei A Efros. 2022. InstructPix2Pix: Learning to Follow Image Editing Instructions. arXiv preprint arXiv:2211.09800 (2022). [5] Angel X Chang, Thomas Funkhouser, Leonidas Guibas, Pat Hanrahan, Qix- ing Huang, Zimo Li, Silvio Savarese, Manolis Savva, Shuran Song, Hao Su, et al. 2015. Shapenet: An information-rich 3d model repository. arXiv preprint arXiv:1512.03012 (2015). Jooyoung Choi, Sungwon Kim, Yonghyun Jeong, Youngjune Gwon, and Sungroh Yoon. 2021. Ilvr: Conditioning method for denoising diffusion probabilistic models. arXiv preprint arXiv:2108.02938 (2021). [6] [8] [7] Christopher B Choy, JunYoung Gwak, Man-Hsin Chen, and Silvio Savarese. 2016. 3D-R2N2: A unified approach for single and multi-view 3D object reconstruction. In CVPR. 1951–1960. Jasmine Collins, Shubham Goel, Kenan Deng, Achleshwar Luthra, Leon Xu, Erhan Gundogdu, Xi Zhang, Tomas F Yago Vicente, Thomas Dideriksen, Himan- shu Arora, et al. 2022. Abo: Dataset and benchmarks for real-world 3d object understanding. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. 21126–21136. [9] Wenyan Cong, Li Niu, Jianfu Zhang, Jing Liang, and Liqing Zhang. 2021. Bar- gainnet: Background-guided domain translation for image harmonization. In 2021 IEEE International Conference on Multimedia and Expo (ICME). IEEE, 1–6. [10] Wenyan Cong, Jianfu Zhang, Li Niu, Liu Liu, Zhixin Ling, Weiyuan Li, and Liqing Zhang. 2020. Dovenet: Deep image harmonization via domain verification. In Pro- ceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. 8394–8403. [11] Xiaodong Cun and Chi-Man Pun. 2020. Improving the harmony of the compos- ite image by spatial-separated attention module. IEEE Transactions on Image Processing 29 (2020), 4759–4771. [12] Paul Debevec. 1998. Rendering synthetic objects into real scenes: Bridging traditional and image-based graphics with global illumination and high dynamic range photography. In SIGGRAPH. [13] Prafulla Dhariwal and Alexander Nichol. 2021. Diffusion models beat gans on image synthesis. Advances in Neural Information Processing Systems 34 (2021), 8780–8794. [14] Debidatta Dwibedi, Ishan Misra, and Martial Hebert. 2017. Cut, paste and learn: Surprisingly easy synthesis for instance detection. In Proceedings of the IEEE international conference on computer vision. 1301–1310. [15] Farshad Einabadi, Jean-Yves Guillemaut, and Adrian Hilton. 2021. Deep Neu- ral Models for Illumination Estimation and Relighting: A Survey. In Computer Graphics Forum. [16] Rinon Gal, Yuval Alaluf, Yuval Atzmon, Or Patashnik, Amit H Bermano, Gal Chechik, and Daniel Cohen-Or. 2022. An image is worth one word: Personalizing text-to-image generation using textual inversion. arXiv preprint arXiv:2208.01618 (2022). [17] Rinon Gal, Or Patashnik, Haggai Maron, Gal Chechik, and Daniel Cohen-Or. 2021. StyleGAN-NADA: CLIP-Guided Domain Adaptation of Image Generators. arXiv:2108.00946 [cs.CV] [18] Rob Gonsalves. 2020. Impressionist-landscapes-paintings. https://www.kaggle. com/datasets/robgonsalves/impressionistlandscapespaintings. [20] [19] Amir Hertz, Ron Mokady, Jay Tenenbaum, Kfir Aberman, Yael Pritch, and Daniel Cohen-Or. 2022. Prompt-to-prompt image editing with cross attention control. arXiv preprint arXiv:2208.01626 (2022). Jonathan Ho, Ajay Jain, and Pieter Abbeel. 2020. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems 33 (2020), 6840–6851. Jonathan Ho and Tim Salimans. 2022. Classifier-free diffusion guidance. arXiv preprint arXiv:2207.12598 (2022). [21] [22] Yan Hong, Li Niu, and Jianfu Zhang. 2022. Shadow generation for composite image in real-world scenes. In Proceedings of the AAAI Conference on Artificial Intelligence, Vol. 36. 914–922. [23] Yifan Jiang, He Zhang, Jianming Zhang, Yilin Wang, Zhe Lin, Kalyan Sunkavalli, Simon Chen, Sohrab Amirghodsi, Sarah Kong, and Zhangyang Wang. 2021. Ssh: A self-supervised framework for image harmonization. In Proceedings of the IEEE/CVF International Conference on Computer Vision. 4832–4841. [24] Tero Karras, Miika Aittala, Samuli Laine, Erik Härkönen, Janne Hellsten, Jaakko Lehtinen, and Timo Aila. 2021. Alias-Free Generative Adversarial Networks. In Proc. NeurIPS. [25] Tero Karras, Samuli Laine, and Timo Aila. 2019. A style-based generator ar- chitecture for generative adversarial networks. In Proceedings of the IEEE/CVF Hachnochi, R. et al. conference on computer vision and pattern recognition. 4401–4410. [26] Kevin Karsch, Varsha Hedau, David Forsyth, and Derek Hoiem. 2011. Rendering synthetic objects into legacy photographs. ACM Transactions on Graphics 30, 6 (2011). [27] Kevin Karsch, Kalyan Sunkavalli, Sunil Hadap, Nathan Carr, Hailin Jin, Rafael Fonte, Michael Sittig, and David Forsyth. 2014. Automatic scene inference for 3D object compositing. ACM Transactions on Graphics 33, 3 (2014). [28] Bahjat Kawar, Shiran Zada, Oran Lang, Omer Tov, Huiwen Chang, Tali Dekel, Inbar Mosseri, and Michal Irani. 2022. Imagic: Text-Based Real Image Editing with Diffusion Models. arXiv preprint arXiv:2210.09276 (2022). [29] Natasha Kholgade, Tomas Simon, Alexei Efros, and Yaser Sheikh. 2014. 3D object manipulation in a single photograph using stock 3D models. ACM Transactions on Graphics 33, 4 (2014). [30] Manyi Li and Hao Zhang. 2021. D2im-net: Learning detail disentangled implicit fields from single images. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. 10246–10255. [31] Chen-Hsuan Lin, Ersin Yumer, Oliver Wang, Eli Shechtman, and Simon Lucey. 2018. ST-GAN: Spatial transformer generative adversarial networks for image compositing. In CVPR. [32] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. 2014. Microsoft coco: Common objects in context. In European conference on computer vision. Springer, 740–755. [33] Andreas Lugmayr, Martin Danelljan, Andres Romero, Fisher Yu, Radu Timofte, and Luc Van Gool. 2022. Repaint: Inpainting using denoising diffusion proba- bilistic models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. 11461–11471. [34] Chenlin Meng, Yutong He, Yang Song, Jiaming Song, Jiajun Wu, Jun-Yan Zhu, and Stefano Ermon. 2021. Sdedit: Guided image synthesis and editing with stochastic differential equations. In International Conference on Learning Representations. [35] Ron Mokady, Amir Hertz, Kfir Aberman, Yael Pritch, and Daniel Cohen-Or. 2022. Null-text Inversion for Editing Real Images using Guided Diffusion Models. arXiv preprint arXiv:2211.09794 (2022). [36] Alex Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin, Bob McGrew, Ilya Sutskever, and Mark Chen. 2021. Glide: Towards photorealistic image generation and editing with text-guided diffusion models. arXiv preprint arXiv:2112.10741 (2021). [37] Patrick Pérez, Michel Gangnet, and Andrew Blake. 2003. Poisson image editing. ACM Transactions on Graphics 22, 3 (2003). [38] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sand- hini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. 2021. Learning transferable visual models from natural language supervision. In International Conference on Machine Learning. PMLR, 8748–8763. [39] Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. 2022. Hierarchical text-conditional image generation with clip latents. arXiv preprint arXiv:2204.06125 (2022). [40] Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. 2021. High-Resolution Image Synthesis with Latent Diffusion Models. arXiv:2112.10752 [cs.CV] [41] Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. 2022. High-Resolution Image Synthesis with Latent Diffusion Models. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, CVPR 2022, New Orleans, LA, USA, June 18-24, 2022. IEEE, 10674–10685. https://doi.org/10. 1109/CVPR52688.2022.01042 [42] Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. 2022. High-resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recogni- tion. 10684–10695. [43] Chitwan Saharia, William Chan, Huiwen Chang, Chris Lee, Jonathan Ho, Tim Salimans, David Fleet, and Mohammad Norouzi. 2022. Palette: Image-to-image diffusion models. In ACM SIGGRAPH 2022 Conference Proceedings. 1–10. [44] Alvy Ray Smith and James F Blinn. 1996. Blue screen matting. In SIGGRAPH. [45] Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. 2015. Deep unsupervised learning using nonequilibrium thermodynamics. In International Conference on Machine Learning. PMLR, 2256–2265. Jiaming Song, Chenlin Meng, and Stefano Ermon. 2020. Denoising diffusion implicit models. arXiv preprint arXiv:2010.02502 (2020). [46] [47] Yi-Hsuan Tsai, Xiaohui Shen, Zhe Lin, Kalyan Sunkavalli, Xin Lu, and Ming- Hsuan Yang. 2017. Deep image harmonization. In Proceedings of the IEEE Confer- ence on Computer Vision and Pattern Recognition. 3789–3797. [48] Narek Tumanyan, Michal Geyer, Shai Bagon, and Tali Dekel. 2022. Plug-and-Play Diffusion Features for Text-Driven Image-to-Image Translation. arXiv preprint arXiv:2211.12572 (2022). [49] Dani Valevski, Matan Kalman, Yossi Matias, and Yaniv Leviathan. 2022. Unitune: Text-driven image editing by fine tuning an image generation model on a single image. arXiv preprint arXiv:2210.09477 (2022). Jiajun Wu, Yifan Wang, Tianfan Xue, Xingyuan Sun, Bill Freeman, and Josh Tenenbaum. 2017. Marrnet: 3d shape reconstruction via 2.5 d sketches. Advances in neural information processing systems 30 (2017). [50] 8 Cross-domain Compositing with Pretrained Diffusion Models [51] Shangzhe Wu, Ruining Li, Tomas Jakab, Christian Rupprecht, and Andrea Vedaldi. 2022. MagicPony: Learning Articulated 3D Animals in the Wild. arXiv preprint arXiv:2211.12497 (2022). [52] Qiangeng Xu, Weiyue Wang, Duygu Ceylan, Radomir Mech, and Ulrich Neumann. 2019. Disn: Deep implicit surface network for high-quality single-view 3d reconstruction. Advances in Neural Information Processing Systems 32 (2019). [53] Binxin Yang, Shuyang Gu, Bo Zhang, Ting Zhang, Xuejin Chen, Xiaoyan Sun, Dong Chen, and Fang Wen. 2022. Paint by Example: Exemplar-based Image Editing with Diffusion Models. arXiv preprint arXiv:2211.13227 (2022). [54] Renjiao Yi, Chenyang Zhu, Ping Tan, and Stephen Lin. 2018. Faces as lighting probes via unsupervised deep highlight extraction. In ECCV. [55] Lingzhi Zhang, Tarmily Wen, and Jianbo Shi. 2020. Deep image blending. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision. 231–240. [56] Richard Zhang. 2019. Making Convolutional Networks Shift-Invariant Again. In ICML. [57] Richard Zhang, Phillip Isola, Alexei A Efros, Eli Shechtman, and Oliver Wang. 2018. The Unreasonable Effectiveness of Deep Features as a Perceptual Metric. In CVPR. [58] Hang Zhou, Rui Ma, Ling-Xiao Zhang, Lin Gao, Ali Mahdavi-Amiri, and Hao Zhang. 2022. SAC-GAN: 3Structure-Aware Image Composition. IEEE Transactions on Visualization and Computer Graphics (2022). [59] Xueyan Zou, Jianwei Yang, Hao Zhang, Feng Li, Linjie Li, Jianfeng Gao, and Yong Jae Lee. 2023. Segment everything everywhere all at once. arXiv preprint arXiv:2304.06718 (2023). 9 Hachnochi, R. et al. Appendix A MASK-SMOOTHING IMPLEMENTATION Section 3.2 presents our mitigation for the aliasing artifacts by smoothing the blend-mask using an operator b (M), in this section we expand on our implementation of this operator. Naively blurring the mask using Gaussian blur results in an undesirable overriding of the reference in the masked regions, since the blur introduces erosion of pixels that were previously 1 in the mask for the following equations: φ (x; Mb ) = Mbφin (x) + (1 − Mb )φout (x), t −1)). t −1 + Mt (φ (yt −1) − φ (x ′ xt −1 = x ′ (10) (11) Instead, we would like to only blur outside the mask. We thus define b as the BlurOutwards operator, and implement it via algorithm 1. Algorithm 1 Blur Outwards Input: Mask M ∈ {0, 1}H ×W , number of blending pixels pblend , smoothing function s : [0, 1] → [0, 1]. Output: Blurred mask M ′ ∈ [0, 1]H ×W . Initialize M ′ = 0 for p = 0, ..., pblend − 1 do (cid:17) (cid:17)(cid:17) (cid:16) M ′ ← M ′ + M ← Dilate (M) (cid:16) s (cid:16) p+1 pblend − s p pblend * M end for return M ′ Algorithm 1 blurs the mask by iteratively dilating it by one pixel, and adding up the results weighted by the smoothing function. The smoothing function s : [0, 1] → [0, 1] must be monotonically increasing and satisfy s (0) = 0, s (1) = 1. In practice, we define a linear smoothing function s (x) = x, but other functions may also be used, e.g., so f tmax. The parameter pblend > 0 controls the amount of smoothing applied to the mask, in units of pixels. B ALIASING ARTIFACTS This section provides a deeper dive into the effects of the aliasing ar- tifacts mentioned in section 3.2. Figure 10 demonstrates the effect of varying Nin, Nout on the strength of the observed aliasing artifacts. As the difference between the scaling factors increases, in effect increasing the strength of the low-pass filtering, sharper edges are introduced to the intermediate images. This causes an aliasing ef- fect which results in wave-like artifacts around the edges. A similar effect happens upon setting a large difference between Tin and Tout , which inflates the sharp edges for a longer period during the in- termediate steps. Our blending mitigation is presented in fig. 11, establishing a clear relationship between the Nin, Nout ,Tin,Tout and the blending strength required to diminish the effect. C FACE MODIFICATION In addition to the various applications displayed in the main paper, our method may also be used for editing facial features. This is done by employing diffusion models trained on portrait datasets, e.g., FFHQ. Figure 13 displays results on this task, proving the ability to blend faces, add smiles, or even perform face-swapping. 10 Figure 10: Artifacts as a variation of Nin, Nout . As the difference be- tween the scaling factors increases, creating sharper edges between regions, the artifact effect increases. These results also demonstrate how the strength of our method relies on the expressiveness capabilities of the diffusion model. A model trained on a uni-domain dataset (as in this case) has a better ability to perform challenging edits, due to its capability to keep intermediate results in-domain. In most applications displayed in this paper, control parameters of the outer region were fixed at Nout = 1,Tout = 1 as to locally modify only the masked region, and keep the rest of the image unchanged. In fig. 12, results are shown for a different case, set- ting Nout = 2,Tout = 0.8 and thus allowing slight changes to the outer region as well, while simultaneously editing the inner region to a different level. These results also demonstrate the diversity introduced by increasing N , as presented in ILVR. D ANALYSIS OF FIDELITY-REALISM TRADE-OFF As discussed in section 3, our method contains an inherent trade-off between fidelity to the reference image and realism to the target domain. We present a deeper dive into this trade-off by analyzing metrics from section 4.1. We focus on the scribble-based editing task, using 24 example images. We generate 300 results for each image, comprised of 10 Tin values, 6 Nin values, and 5 R values. We then calculate LPIPS as the fidelity score and CLIP Directional Similarity score as the realism score. Figure 14 presents an analysis of these scores. First, it is notice- able that the fidelity and realism scores are clearly anti-correlated, as one decays when the other improves. Second, as explained in sec- tion 4.5, the method's parameters have control over this trade-off. A higher Nin passes less information from the reference image to the 82416328241632NinNout Cross-domain Compositing with Pretrained Diffusion Models Figure 11: Blending mitigation. Top: Effect of varying Tin (top) and Nin (bottom) on the artifacts, mitigated by increasing pblend . Other parameters are fixed at Tout = 0.8, Nout = 8, and Nin = 8 (top), Tin = 0.8 (bottom). prediction, and thus results in lower fidelity, but allows for better realism. It is worth noting that the realism score reaches some plato for Nin, which coincides with our observation that high Nin values have little diversity from one another. Adversely, increasing Tin performs the frequency-overriding process for more steps, resulting in higher fidelity but lower realism. Interestingly, both scores are not monotonic for R in one point (R = 0.2), but overall increasing R improves the realism of the image by applying more diffusion steps, at the cost of fidelity. E SEMI-AUTOMATIC SCORING METHOD A limitation of our method is the lack of a single set of parameters that result in satisfying results for all inputs, impelling the user to generate a grid of results, and then manually choose the most appealing result out of all images. To mitigate this issue, we propose Figure 12: Modifying both regions simultaneously. In this experiment, parameters were fixed at Nin = Nout = 2,Tout = 0.8, pblend = 30, while Tin and the seed vary. Our method allows changing different image regions with different levels of control, presenting diversity of the results. Figure 13: Face modification examples. a scoring method based on the metrics presented in section 4.1, and the analysis discussed in appendix D. Let sf idelit y, srealism denote the fidelity and realism scores, and defined here as LPIPS and CLIP Directional Similarity respectively. We first normalize both scores to [0, 1] (and take the negative of LPIPS since lower is better). The score function is defined as 1 1 + λ (cid:16) sf idelit y + λsrealsim f (sf idelit y, srealism) = (12) (cid:17) . We set λ = 2 with the justification that realism is somewhat prefer- able over fidelity. To analyze this scoring method we focus on the scribble-based editing task. For each input image, we manually choose a set of the most appealing results out of the 300 generated. We sort all 300 results using the score function and report the first appearance of one of the selected appealing results by applying this sorting method. In fig. 15 we compare the percentile curves of this sorting method and a random sorting method. For a random sort, the mean first appearance of an appealing image would be 300 k , where k is the number of selected appealing images for a certain reference image. Using our proposed score function to sort results may help the user to find a pleasing result quicker, by examining results in the order of decreasing scores. F SMALL OBJECTS To relieve our method's difficulty with processing small objects, we propose a simple method in the preprocessing phase. Instead of using the entire original image as a reference, we crop a bounding 11 0.40.00.20.60.82001030Tinpblend81416322001030Ninpblend0.40.00.20.60.8TinseedReference + MaskReference +MaskResult Hachnochi, R. et al. Figure 15: Comparison of percentile curves for scoring method vs. random sampling method. Percentiles of the minimal number of samples required to find a pleasing result using both random configurations and our sorting method. Error bars are calculated by bootstrapping. Our score function provides an improved sorting method to find pleasing results. Figure 16: Small objects mitigation using crops. Top: reference image. Middle: original result using our method, small objects tend to become smeared. Bottom: using cropped images as reference results in fine-detail preservation, leading to improved results. Figure 17: Small objects in large images. An example of an edit on a 1688 × 1688 image. Prompt: a photo of a flower vase on a window, configu- ration: Nin = 2, Tin = 0.8, R = 0.8. 12 Figure 14: Deeper analysis of fidelity-realism trade-off using. Top: Each graph shows the effect of different parameters on fidelity (LPIPS) and realism (CLIP Directional Similarity) scores. For each graph we fix a certain parameter, and average the other two amongst all images. Bottom: Each curve demonstrates how the average scores change together with the change of the parameter. box two times the size of a tight bounding box around the object, upsample and resize it, process it via our method (section 3), re- size the result back to the original size, and finally paste it back in the original image. This process assists in preserving enough information from the small reference object in the low-resolution latent space, as opposed to using the original-sized object which results in an insufficient latent representation of the object in LDMs. Results using this method are presented in fig. 16, demonstrating improved results with better preservation of the reference image's finer details and semantics. This preprocessing method has the bonus effect of unlocking the ability to work on arbitrarily sized images, even those that are too large for the diffusion model's capacity. To do so, one may crop a small bounding box around the desired editing region, process it, and seamlessly paste it back into the original image. An example of this on a 1688 × 1688 image is shown in fig. 17. Note that this is applicable only as long as the editing region is not larger than the model's capacity. ReferenceOriginalCropReferenceResult Cross-domain Compositing with Pretrained Diffusion Models G TIMESTEP SCHEDULE As described in section 3.2, we add control over transferring se- mantic and style details into the edited region by controlling the scheduling of the backward-diffusion. RePaint offers to perform resampling during the prediction (renoise and perform another forward-pass of the diffusion model), effectively increasing the receptive field of the model. Our control is achieved by setting the timestep in which resampling starts, defined as R in the pa- per. Figure 18 displays several schedules achieved by altering R. R = 0 reduces to no resampling at all, falling back to a normal backward-diffusion schedule. More resampling gives rise to deeper harmonization between the object and the background but may cause corruption of the object. Figure 18: RePaint Schedule. Changing the value of R sets the timestep from which resampling is applied. R = 0 reduces to a normal backward- diffusion schedule. H SVR DATA AUGMENTATION DETAILS We utilized a dataset of rendered images from [52] for augmenting ShapeNet object data with background features, intended for train- ing our SVR models. This dataset encompasses 36 rendered views across 20 categories of ShapeNet models. Three separate sets of SVR experiments were conducted, each with unique data augmentation procedures involving distinct prompts and subsampled rendered views. The specific methodologies for each experiment are detailed in table 4. To construct a copy-and-paste dataset, where background aug- mentation is achieved through naïve image composition, we em- ployed pretrained diffusion models to generate background images which were then composited with ShapeNet objects. The genera- tion of background images was guided by customized text prompts tailored specifically for each object category. More than 3,500 back- ground images were produced for each category. I 2D IOU IMPLEMENTATION In lack of a sufficient 3D ground-truth for evaluating results on internet-sourced images, we propose to apply 2D IoU as a proxy which allows us to take maximal leverage of the available informa- tion. This metric is determined over a 2D mask on internet-sourced input images and reconstructed model silhouette. We extract object masks from input images through off-the-shelf segmentation model SEEM [59], and render SVR results under camera pose predicted by 13 Figure 19: 2D IoU evaluation samples. Odd rows: Input images and the 3D reconstruction results by models trained on respective dataset. Even rows: Mask overlays of the rendered object silhouette on the input image. The measured 2D IoU between object silhouette and input image mask is annotated at the top left corner of the image. CamNet. The input image mask and model silhouette are aligned with their geometric center, then the intersection over union be- tween these two masks is determined. A sample 2D IoU measured over several internet-sourced images is shown in fig. 19. This metric evaluates how faithful the reconstruction results are with respect to the input view-point. J ADDITIONAL RESULTS In this section, we supply additional quantitative and qualitative results for the various applications displayed in the paper. In figs. 20 to 22 we provide additional results generated by our method, demon- strating the robustness and generalization capabilities of our local editing method. Figure 20 shows additional scribble + text prompt examples, establishing how setting an intermediate Tin aids in trans- forming the scribble to become more realistic, and that a naïve at- tempt of inpainting with no guidance (Tin = 0) is often insufficient. Figure 21 presents examples for Object Immersion, including a few failure cases, mostly originating from small objects. In fig. 22 additional SVR augmentation examples on various object categories are displayed, demonstrating our method's ability to generate real- istic and diverse images merely from a single image of the object. An interesting failure case is observed in the second row of the left grid, where the diffusion model sometimes chooses to break Original!.#$!.$!.%$&.!CPInput Hachnochi, R. et al. Table 4: Implementation details of background augmentation on rendered views of ShapeNet objects. Category # Objects # Views Tin Prompt Sofa 3173 Chair 6778 Table 8436 6 36 8 20 7 0.25,0.75,1.0 0.5 "A photograph of a sofa in a living room with windows and a rug" 0.25,0.75,1.0 0.5 "Photograph of a chair sitting on the floor in a room, interior design, natural light, photorealistic" 0.5 "Photograph of a table in the room, natural light, interior design, realistic indoor scenes, cozy room" Table 5: 2D IoU evaluated on models trained on different datasets with extended views. Original Ours (Tin = 0.5) CP Sofa (36 views) Chair (20 views) Table (7 views) 0.514 0.416 0.280 0.601 0.581 0.417 0.524 0.491 0.334 the single L-sofa into two regular sofas, probably due to its prior knowledge from training. Additional SVR models are trained on additional object cate- gories with extended views. The quantitative measurements are demonstrated in table 5, further establishing the superiority of our augmentation method. The number of views is extended to 36 for sofas, 20 for chairs, and 7 for tables. The augmentation pipeline follows from appendix H. The models are tested on 100 internet- sourced images for each category, and additional qualitative results are shown in figs. 23 to 25. Results using our augmentation method appear to have better coherency to the input object and better overall structure. While our method outperforms the baselines in all cases, the SVR models often struggle with the reconstruction of thin elements in input images. This is due to the inherent challenge of implic- itly recognizing and extracting these fine details from in-the-wild images, and the fact that our augmentation pipeline occasionally overlooks these parts due to their small size. Another notable limitation lies in the range of input image view- points. The views rendered from ShapeNet provide limited vari- ations in camera poses, a stark contrast to the virtually infinite camera pose possibilities in-the-wild images can present. While our augmentation of background aids in bridging the real-to-sim domain gap, developing a model with robust camera pose tolerance extends beyond the scope of this work. However, these limitations can be partially mitigated by pre- processing in-the-wild images, such as by positioning the object centrally and/or applying random scaling. We hope to stimulate further research in these areas to improve upon these limitations and advance the capabilities of single-view reconstruction models. 14 Cross-domain Compositing with Pretrained Diffusion Models Figure 20: Additional scribble images generated using our method, for various Tin values, the most appealing results (as rated by users) are highlighted. Text prompts from top to bottom are: A cat playing with a yarn ball, A playing guitar, A cat reading a book, A cat wearing a tie, A cat drinking a cocktail, A corgi with a snorkel mask, A living room with a sofa and a table, A cat reading a book. 15 Reference0.40.00.20.60.8Tin Hachnochi, R. et al. Figure 21: Additional object immersion results edited using our method, all generated using Tin = 0.5, Nin = 2,Tout = 1, Nout = 1, R = 0.2. 16 Reference + MaskResult Cross-domain Compositing with Pretrained Diffusion Models Figure 22: Additional augmentation results of various sofa, table, chair, car, bench and watercraft images and views, all generated using Tin = 0.5, Nin = 1,Tout = 0, R = 0 and a pretrained inpainting model. Text prompt for sofa: Photograph of a sofa in the living room with window and a rug; chair: Photograph of a chair sitting on the floor in a room, interior design, natural light, photorealistic and Photograph of a chair in the study near a bookshelf ; table: Photograph of a table in the room, natural light, interior design, realistic indoor scenes, cozy room; car: Photograph of a car driving on the road; bench: Photograph of a bench in the park with grasses in a sunny day; watercraft: Photograph of a watercraft in the ocean under blue sky and white clouds. 17 ReferenceResultReferenceResult Hachnochi, R. et al. Figure 23: Additional SVR results tested on internet-sourced sofa images. The SVR model is trained on an augmented sofa dataset with Tin = 0.5, compared with original and copy-paste baselines. Figure 25: Additional SVR results tested on internet-sourced chair images. The SVR model is trained on an augmented chair dataset with Tin = 0.5, compared with original and copy-paste baselines. Figure 24: Additional SVR results tested on in-the-wild table images. The SVR model is trained on augmented table dataset with Tin = 0.5, compared with original and copy-paste baselines. 18 InputOriginal!.#Copy and PasteInputOriginal!.#Copy and PasteInputOriginal!.#Copy and Paste
http://arxiv.org/abs/2302.10166v3
2023-03-07T06:47:30
2023-02-20T18:53:56
Learning Deep Semantics for Test Completion
Writing tests is a time-consuming yet essential task during software development. We propose to leverage recent advances in deep learning for text and code generation to assist developers in writing tests. We formalize the novel task of test completion to automatically complete the next statement in a test method based on the context of prior statements and the code under test. We develop TeCo -- a deep learning model using code semantics for test completion. The key insight underlying TeCo is that predicting the next statement in a test method requires reasoning about code execution, which is hard to do with only syntax-level data that existing code completion models use. TeCo extracts and uses six kinds of code semantics data, including the execution result of prior statements and the execution context of the test method. To provide a testbed for this new task, as well as to evaluate TeCo, we collect a corpus of 130,934 test methods from 1,270 open-source Java projects. Our results show that TeCo achieves an exact-match accuracy of 18, which is 29% higher than the best baseline using syntax-level data only. When measuring functional correctness of generated next statement, TeCo can generate runnable code in 29% of the cases compared to 18% obtained by the best baseline. Moreover, TeCo is significantly better than prior work on test oracle generation.
[ "Pengyu Nie", "Rahul Banerjee", "Junyi Jessy Li", "Raymond J. Mooney", "Milos Gligoric" ]
[ { "@title": null, "@href": "http://arxiv.org/abs/2302.10166v3", "@rel": "alternate", "@type": "text/html" }, { "@title": "pdf", "@href": "http://arxiv.org/pdf/2302.10166v3", "@rel": "related", "@type": "application/pdf" } ]
null
{ "@xmlns:arxiv": "http://arxiv.org/schemas/atom", "@term": "cs.SE", "@scheme": "http://arxiv.org/schemas/atom" }
[ "cs.SE", "cs.CL", "cs.LG" ]
Learning Deep Semantics for Test Completion Pengyu Nie, Rahul Banerjee, Junyi Jessy Li, Raymond J. Mooney, Milos Gligoric UT Austin, USA {pynie,rahulb517,jessy,mooney,gligoric}@utexas.edu 3 2 0 2 r a M 7 ] E S . s c [ 3 v 6 6 1 0 1 . 2 0 3 2 : v i X r a Abstract-Writing tests is a time-consuming yet essential task during software development. We propose to leverage recent advances in deep learning for text and code generation to assist developers in writing tests. We formalize the novel task of test completion to automatically complete the next statement in a test method based on the context of prior statements and the code under test. We develop TECO-a deep learning model using code semantics for test completion. The key insight underlying TECO is that predicting the next statement in a test method requires reasoning about code execution, which is hard to do with only syntax-level data that existing code completion models use. TECO extracts and uses six kinds of code semantics data, including the execution result of prior statements and the execution context of the test method. To provide a testbed for this new task, as well as to evaluate TECO, we collect a corpus of 130,934 test methods from 1,270 open-source Java projects. Our results show that TECO achieves an exact-match accuracy of 18, which is 29% higher than the best baseline using syntax-level data only. When measuring functional correctness of generated next statement, TECO can generate runnable code in 29% of the cases compared to 18% obtained by the best baseline. Moreover, TECO is significantly better than prior work on test oracle generation. Index Terms-test completion, deep neural networks, program- ming language semantics I. INTRODUCTION Software testing is the most common approach in industry to check the correctness of software. However, manually writing tests is tiresome and time-consuming. One option is to automatically generate tests. Researchers have proposed a number of techniques in this domain, in- cluding fuzz testing [1]–[3], property-based testing [4]–[10], search-based testing [11], [12], combinatorial testing [13], etc. Despite being effective in detecting software bugs, these techniques generate tests with stylistic issues, as test code generated through these techniques rarely resemble manually- written tests [14]–[16] and can be hard to maintain. As a result, these automated techniques end up being used only as supplements to manually-written tests. Another option is to use machine learning (ML), namely training a model on existing manually-written tests and apply- ing it when writing new tests, which is a plausible methodol- ogy supported by the naturalness of software [17], [18]. Ad- vances in deep learning such as recurrent neural networks [19], [20] and large-scale pre-trained transformer models [21]–[24] have led to promising new research in a variety of software engineering tasks, such as code completion [25]–[30] and code summarization [31]–[35]. Code generated with modern models are intelligible to humans, yet we cannot fully rely on them to generate large chunks of meaningful code, or expect them to understand larger project context. Our goal is to design machine learning approaches to aid developer productivity when writing tests. We present a novel task-test completion-to help developers write tests faster. Specifically, once a developer starts writing a test method, she can leverage test completion to automatically obtain the next statement in the test code (at any point she desires). Despite being closely related to code completion [25]–[29], test completion is distinct in that test code has several unique characteristics. First, the method under test provides extra context that can be leveraged when completing a test method. Second, test code follows a different programming style that focuses on exercising the method under test. Specifically, a test method usually consists of a sequence of statements in the following order: prepare inputs to the method under test, execute method under test, and check the results of the execution using assert statements (i.e., test oracles). We present the first deep learning solution-TECO-that takes into account these unique characteristics of tests. TECO uses code semantics as inputs for novel ML models and performs reranking via test execution. Code semantics refers to the information related to test/code execution not available in the syntax-level data (i.e., source code). TECO extracts code semantics (e.g., types of local variables) using software engineering tools and feeds them directly to the model. Once top-k predictions are produced, TECO further ensures the output quality by executing the gen- erated statements, and prioritize the runnable and compilable statements over the others. We design the code semantics used by TECO based on our experience with software analysis in order to best capture the unique characteristics of the test completion task. In total, we consider six different kinds of code semantics that can be grouped to two categories: (1) execution result, including the types of the local variables and whether fields are initialized; (2) execution context, including the setup and teardown meth- ods, the last called method in the test method, and statements in non-test code with similar previous statements. We implemented TECO to support test methods written in Java. We evaluate TECO on a newly collected corpus consisting of 130,934 test methods with 645,633 statements from 1,270 projects. We release this corpus to the community as a testbed for the test completion task. We performed extensive evaluations of TECO on this corpus-covering lexical similarity, functional correctness, and downstream application-to show the importance of 1 combining code semantics with deep learning. We report results comparing the generated statements against the gold manually-written statements using a suite of automatic met- rics: exact-match accuracy, top-10 accuracy, BLEU [36], CodeBLEU [37], edit similarity [29], and ROUGE [38]. TECO significantly outperforms baselines that use only syntax-level data on all metrics. We also measure functional correctness by trying to compile and run the generated statements. TECO can produce a runnable next statement 29% of the time, while the figure for the best baseline model is only 18%. Moreover, we also evaluated TECO on the task of test oracle generation [39], [40], which is a downstream application of test completion. TECO achieves an exact-match accuracy of 16, which significantly outperforms the prior state-of-the-art's exact-match accuracy of 9. The main contributions of this paper include the following: • Task. We propose a novel task, test completion, with the goal to help developers write test methods faster. • Idea. We propose using code semantics and code execution when designing ML models targeting code-related tasks. • Model. We developed TECO, the first transformer model trained on large code semantics data for test completion. Furthermore, TECO performs reranking by execution. The use of code semantics is vital for correctly modeling the execution process in the test methods. • Corpus. We created a large corpus of 130,934 test methods from 1,270 open-source projects. We believe this corpus will also be useful to many other tasks related to testing. • Evaluation. Our extensive evaluation shows that TECO significantly outperforms strong baselines on all automatic metrics, both on test completion and its downstream applica- tion: test oracle generation. We also evaluate the functional correctness of generated code by compiling and running the generated statements. TECO and our corpus are publicly available on GitHub: https://github.com/EngineeringSoftware/teco. II. TASK In this section, we more formally describe the test comple- tion task and illustrate the task using an example. Given an incomplete test method, our goal is to auto- matically generate the next statement in that test method. We assume that the following inputs are provided to a test completion system: (1) the code under test, which includes both the test method's associated method under test as well as other non-test-method code in the project, (2) the test method signature, (3) prior statements in the incomplete test method (which can be zero or more statements). We illustrate our task in Fig. 1. The example shows (in the yellow boxes) the method under test, the test method signature, and the prior statements (only one statement in this example), as well as (in the last green box) the next statement that should be generated by a test completion system. method under test public GMOperation addImage(final File file) { if (file == null) { throw new IllegalArgumentException( "file must be defined"); } getCmdArgs().add(file.getPath()); return this; } test method signature @Test public void addImage_ThrowsException_WhenFileIsNull() throws Exception prior statements exception.except(IllegalArgumentException.class); next statement sut.addImage((File) null); Fig. 1: Example of test completion: given the code under test (represented by the method under test), test method signature, and prior statements, the goal is to generate the next statement. Code from sharneng/gm4java in class GMOperationTest. We seek to generate statements in the body of the test method, thus the test method signature (including the annota- tion and the name of test method) are only used as inputs and they are not the prediction target of the test completion task. We also do not consider the context of other already available test methods from the same project when completing a test method, to prevent any model from cheating by copying code from other similar test methods. Our defined test completion task is applicable to the situation when a developer already knows what to test (thus knows the method under test and the test method signature), and wants to complete the next statement at any point when writing the test method, regardless of whether the project has existing tests or not. We also focus on modeling the body of test methods as a sequence of statements, because test methods with control flows (e.g., if statements, loops, and try blocks) are rare; we found less than 10% test methods have control flows in our experiments. Most testing frameworks recommend sequential test method body and provide annotations to replace control flows, for example, @ParameterizedTest for replacing loops in JUnit 5 [41]. III. EXTRACTION OF CODE SEMANTICS In this section, we describe the six kinds of code semantics extracted and used by TECO. For each kind of code semantics, we design and implement a static analysis algorithm to extract it. Static analysis is the analysis of code without executing it, guided by the grammar and semantics of programming languages. The advantage of using static analysis is that it does not require configuring the runtime environment which can be cumbersome for some projects, and can be applied on partial code (for example, without accessing the dependency libraries of a project, which is needed when executing the code). It is also much faster than executing the code directly, which enables us to collect code semantics on a large corpus of code. However, static 2 Fig. 2: TECO's workflow of using static analysis to extract code semantics. analysis can sometimes be inaccurate; for example, when some values are unknown without executing code (e.g., user inputs), static analysis has to over-estimate the analysis results (e.g., assuming both branches of an if statement may be executed). This may not be a problem for TECO as the deep learning model can learn to ignore the inaccurate parts. Fig. 2 illustrates the general workflow of TECO's static analysis which consists of two phases: given a project, in the collection phase TECO collects a shared set of all code elements (classes, methods, fields), and in the analysis phase TECO extracts each kind of code semantics from the code elements set using a specific algorithm. The code semantics can be organized into two categories based on their content: ex- ecution result and execution context. Execution result includes: (S1) local var types, (S2) absent types, and (S3) unset fields; execution context includes: (S4) setup teardown, (S5) last called method, and (S6) similar statement. In the following paragraphs we describe the collection phase and the analysis phase for each kind of code semantics in more detail. The collection phase. The goal of this phase is to collect a set of code elements that will be shared by all test methods and all six kinds of code semantics. TECO collects three kinds of code elements: classes, methods, and fields; each method and field should have one class as its parent. For each element, TECO collects its metadata, including name, type, access modifiers, annotations (if any), etc. For each class, TECO records if it is a non-test class, test class, or a class in a dependency. TECO additionally collects the source code and bytecode for all their methods of non-test and test classes. We do not utilize the source code or bytecode in dependency libraries because they are not needed for the analysis. local var types data refers to the types of (S1) the are local types variables extracted by partially interpreting the bytecode of the test method without considering the values of variables. Note that this is more accurate than reading the local variable table which contains the declared types of local variables; interpreting the statement AbstractWComponent comp = new SimpleComponent(), the type of comp is SimpleComponent, which is more accurate than its declared type AbstractWComponent. This data provides information on what types of test inputs are available to be used in the next statement. (S2) absent types are the types of the variables that are needed by calling the method under test but have not been prepared in the test method. Types needed by calling the method under for example, after test method. The the in test include its parameter types, plus the class under test (the declaring class of the method under test) if the method under test is not a static method. A type is prepared if a local variable or a field of the test class with this type is initialized. This data focuses on what types of test inputs are missing, and thus may likely need to be prepared in the next statement. (S3) unset fields data refers to the fields of the test class and the class under test that have not been initialized. We deem a field as is initialized if there is any statement for setting the value of the field in the test method, the setup methods, or methods transitively called from the test method or the setup methods (up to 4 jumps, as initializations of the fields of our interest in more in-depth calls are rare). The fields in this data may likely need to be initialized in the next statement. (S4) setup teardown data refers to the source code of the setup and teardown methods in the test class. When a test framework executes tests, setup methods are executed before the test method to set up the environment (e.g., connection to a database), and teardown methods are executed after the test method to clean up the environment. By providing this context, the test completion system can know what environment is available to use in the test method, and also can avoid duplicating the statements already in setup/teardown methods. (S5) last called method data is the source code of the last called method in the prior statements, which could be empty if no method has been called yet. This data provides more context on what has been executed in prior statements. (S6) similar statement data is a statement in the non-test code of the project that has the most similar prior statements context to the prior statements in the incomplete test method. TECO uses the BM25 algorithm [42] to search for similar prior statements. Only 2 prior statements are considered during the search, as increasing the window size leads to much longer search time without improving the quality of the returned similar statement. We expect this data to be similar to the next statement to be predicted. Implementation. In the collection phase, TECO uses Java- Parser [43] to collect source code and ASM [44] to collect bytecode. The collection phase takes 136s per project on average. All analysis algorithms are implemented in Python, with the help of ASM for partially interpreting bytecode (for S1) and scikit-learn [45] for the BM25 algorithm. The analysis phase takes 0.018s–0.247s per test method on average, depending on code semantics data. Example. Fig. 3 shows two kinds of code semantics (S2 and S4) extracted for the example in Fig. 1 that help the generating the correct next statement. The (S2) absent types data is File, because calling the method under test addImage requires GMOperation (because addImage is not a static method) and File, but GMOperation is already available as a field sut in the test class (on line 7). The (S4) setup teardown data is the method setup in the test class GMOperationTest which initializes the sut field (on line 9). Note that the other kinds of code semantics are either empty or not useful for this example, but are useful for some other examples. 3 extends org.im4java.core.GMOperation { public GMOperation addImage(final File file) {...} (S2) absent types 1 public class GMOperation 2 3 4 ...} 5 6 public class GMOperationTest { 7 8 9 10 11 12 13 14 15 16 17 ...} throws Exception { } GMOperation sut; @Before public void setup() {... sut = new GMOperation(); ...} @Test public void addImage_ThrowsException_WhenFileIsNull() (S4) setup teardown exception.except(IllegalArgumentException.class); sut.addImage((File) null); Fig. 3: Some kinds of code semantics (S2 and S4, highlighted in the first two blue boxes) extracted for the example in Fig. 1, which help TECO generate the correct next statement (highlighted in the last green box). IV. TECO'S DEEP LEARNING MODEL Fig. 4: TECO's model architecture. This section describes the deep learning approach that TECO uses to solve the test completion task. Fig. 4 illustrates the overall model architecture: an encoder-decoder transformer model whose input includes both code semantics and syntax- level data and output is the next statement. A. Encoder-Decoder Transformer Model Our model is based on the encoder-decoder architecture that considers both input and output as sequences, which has been applied to many sequence generation tasks including code summarization [31]–[33] and code generation [46], [47]. In the context of TECO, the input is the syntax-level data (method under test, test signature, and prior statements) plus the code semantics extracted from the test to be completed (S1-S6), and the output is the next statement. More formally, TECO is given the test to be completed T and the code under test C as inputs, where C includes the method under test xmut, and T consists of two parts: the test signature xsign and prior statements xprior. The goal is to generate the next statement y. TECO extracts code semantics as described in Section III: number of subtokens in the input sequence ranges from 23 to 2,426 (average: 243.88) and exceeds the limitation of 512 subtokens in 6% of the cases. As a result, more important information should be placed at the end of the input sequence to avoid being truncated. The ordering of code semantics is decided based on our domain knowledge of which kind of data would contain more important information, and we always put the syntax-level data at the end (as they deliver the basic information for the task). Exploring all possible orderings may discover better models but is too computationally expensive. We plan to investigate the impact of the orderings by designing experiments with more affordable costs in the future. Then, TECO uses a transformer model [21] to learn the con- ditional probability distribution P (y|x). The model computes this by first using an encoder to encode the input sequence into a deep representation, and then using a decoder which reads the deep representation and generates the output sequence one subtoken at a time: h =encoder(x) xS1, xS2, xS3, xS4, xS5, xS6 = analysis(T, C) P (y[i]|y[: i], x) =decoder(y[: i], h), for each i Each input piece x and output y is a sequence of subtokens, which is obtained by subtokenizing the code or extracted data's string format using the BPE (byte-pair encoding) al- gorithm [22], [48]. TECO combines the input pieces into a single input sequence by concatenating them with a delimiter (cid:104)sep(cid:105) (the ordering of the sequences is configurable): x = xS3 (cid:104)sep(cid:105) xS5 (cid:104)sep(cid:105) xS1 (cid:104)sep(cid:105) xS2 (cid:104)sep(cid:105) xS6 (cid:104)sep(cid:105) xS4 (cid:104)sep(cid:105) xmut (cid:104)sep(cid:105) xsign (cid:104)sep(cid:105) xprior The maximum number of subtokens that TECO can accept, due to the limitation of the underlying model, is 512. If the input sequence is longer than that, TECO truncates the input sequence from the beginning. In our experiments, the B. Fine-tuning Recent work shows that pre-training a large-scale trans- former model on a large corpus of code and text and then fine-tuning the model on downstream tasks lead to better performance than training a model from scratch [30], [34], [35], [49]. However, pre-training is only performed on syntax- level data in order to be generalizable to many downstream tasks with different semantics. Prior work shows that large- scale pre-trained models may not perform well on simple tasks of executing the code [50]. This indicates that they learned little about the semantics of execution. We believe that fine-tuning on code semantics is vital for pre-trained models to perform well on execution-related tasks 4 such as test completion. During pre-training, the model mainly learns the syntax and grammar of programming languages. If only syntax-level data is used during fine-tuning, the model would have to infer the semantics of execution, which can be very inaccurate because the execution can be complicated and the context provided by the syntax-level data is limited. By contrast, code semantics are extracted using reliable static analysis algorithms in TECO so that the model can directly use such data instead of inferring. Thus, during fine-tuning of TECO, the model learns how to understand and process the additional code semantics in addition to the syntax-level data. For the pre-trained model, we use CodeT5 [35], which is a large-scale encoder-decoder transformer model pre-trained on a bimodal corpus of code in multiple programming languages (including Java) and text. We fine-tune the model on a corpus for test completion T C by minimizing the cross-entropy loss: loss = (cid:88) − log P (y|x) = x,y∈T C (cid:88) x,y∈T C i∈[0,|y|) − log P (y[i]|y[: i], x) C. Evaluation At evaluation time, TECO uses the beam search algorithm with a beam size of 10. Specifically, starting from a special begin-of-sequence subtoken y[0] = (cid:104)s(cid:105), TECO iteratively runs decoder to generate the most likely next subtokens which is appended to the output sequence; only the top 10 sequences with the highest total probability are kept at each step. Each output sequence is completed upon generating a special end- of-sequence subtoken (cid:104)/s(cid:105). The beam search terminates after generating 10 completed output sequences. As repeating the same subtoken is unlikely, we apply a repetition prevention mechanism that penalizes the probability of generating the same subtoken as the previous subtoken [51]. D. Reranking by Execution The model can generate plausible outputs by maximizing the generation probability that it learnt during fine-tuning. However, there is no guarantee for the generated statements- subtoken sequences-to be compilable and runnable code. Arguably, generating compilable and runnable code is more important than generating plausible but non-executable code in the test completion task, because it is crucial for developers to run the code and observe the runtime behavior, in order to further improve the codebase. We propose to use reranking by test execution to improve the quality of the generated statements. Specifically, after collecting the top-10 predictions from beam search Y ranked by their probabilities, TECO checks whether each of them is compilable and runnable. Then, TECO reranks the outputs into ˆY where one output yi is ranked higher than another yj if: (1) yi is runnable and yj is not; or (2) both are not runnable, but yi is compilable and yj is not; or (3) both have the same runnable and compilable status, and P (yi) > P (yj). In this way, generated statements that are compilable and runnable are prioritized over the others. Fig. 5: Procedure of detecting whether a generated statement is compilable and runnable. TECO detects whether a generated statement is compilable and runnable by putting it in an ad-hoc test class with the required context, isolated from being affected by other test methods in the same project. The procedure is illustrated in Fig. 5, specifically: 1) Create a class with a test method using the signature and prior statements, followed by the generated statement. 2) Extract the other non-test methods from the original test class (including setup, teardown, and utility methods) into the created class. 3) Generate an ad-hoc main method which calls setup meth- ods, the test method, and teardown methods in order. 4) Compile the generated class with all the dependencies specified in the project's build configuration as well as all non-test classes in the project. 5) If the compilation succeeds (at which point the statement is considered to be compilable), execute the compiled class; the statement is considered to be runnable only if there is no exception or assertion failure during the execution. The execution of the class is performed by one of the following: a) If the project is using JUnit 4 [52] testing framework, we try to use its command line runner to run the class with the generated statement; the JUnit 4 runner is more robust because it properly utilizes all JUnit features that our ad-hoc main method does not handle, e.g., @RunWith. b) If the project is not using JUnit 4 or running with JUnit 4 runner failed, we run the ad-hoc main method. V. CORPUS As test completion is a new task, we construct a large-scale corpus that can serve as a testbed for our work and future re- search. We collected data from the same subject projects used by CodeSearchNet [53], which is a large corpus of code and comments that is frequently used in ML+code research [35], [49], [54]. Out of the 4,767 Java projects in CodeSearchNet, we used the 1,535 projects that: (1) use the Maven build system (for the simplicity of data collection; TECO is not limited to any build system); (2) compile successfully, and (3) have a license that permits the use of its data. We collected 5 TABLE I: Statistics of our corpus. #proj = number of projects; #test = number of test method; #stmt = number of statements; len(test) = average number of tokens in test method; len(MUT) = average number of tokens in method under test. #proj #test #stmt len(test) len(MUT) all training validation evaluation 1,270 130,934 645,633 1,163 120,521 584,924 30,515 5,413 30,194 5,000 43 64 79.57 79.58 73.24 86.26 40.88 40.61 45.09 42.85 the corpus in Spring 2022. To ensure corpus quality, we try to use the latest stable revision of each project by finding its latest git-tag; but if it does not have any git-tag on or after Jan 1st, 2020, we use its latest revision. To extract test methods from these projects, we first col- lected the set of code elements from each project using the same toolchain for the collection phase of TECO's static analysis (Section III). We identified the test methods written in JUnit 4 [52] and JUnit 5 [41] testing frameworks, which are the main frameworks used for writing tests in Java. Specifically, we searched for methods with a test annotation (@org.junit.Test or @org.junit.jupiter.api.Test) and without an ignored-test annotation (@org.junit.Ignore or @org.junit.jupiter.api.Disabled). This initial search re- sulted in 221,666 test methods in all projects. Then, we further filtered the test methods to ensure corpus quality. We filtered test methods that are badly named (e.g., test0; 2,490 cases) or do not follow the required signature of tests (e.g., parameter list is not empty, return type is not void; 1,908 cases). Then, we tried to locate the method under test for each test method, using the following enhanced procedure originally proposed by Waston et al. [39]: 1) If there is only one call to a method, select it (as the method under test); 2) If a class under test can be found by removing "Test" from the test class's name: a) If there is only one call to a method declared in class under test, select it; b) Select the last method declared in class under test called before the first assertion statement, if any; 3) Select the last method called before the first assertion statement, if any; 4) Select the last method called, if any. We removed 36,818 test methods for which we could not locate the method under test after this procedure. We used the line number table to find the bytecode in- structions corresponding to each statement, and we removed 633 cases where we could not do this because of multiple statements on the same line. After that, we set size constraints on the data: the test method should have at least 1 statement (filtered 5 cases) and at most 20 statements (filtered 8,222 cases); the method under test should have at most 200 tokens the method under test and the test (filtered 9,787 cases); method together should have at most 400 tokens (filtered 1,288 cases); each statement in the test method should have at most 100 tokens (filtered 1,726 cases). We also removed several cases that introduce extra overhead during analysis: test methods with if statements, loops, and try blocks, because they entail non-sequential control flow which is not suitable to be modeled by predicting the next statement given prior statements (22,435 cases); and test methods using lambda expressions [55], because they prevent many static analysis algorithms from working (5,420 cases). We plan to lift these limitations in future work. Lastly, we mask the string literals in the data by replacing them with a common token "STR", similar to prior work on code completion [29]. Although string literals are frequently used in test methods, for example as logging messages, test inputs, or expected outputs, they pose challenges for a pure-deep-learning solution to generate because they have a different style than other parts of the code and can sometimes be very long. Thus, we focus on predicting the next statement with masked string literals, and leave predicting the content of the string literals as future work. After filtering, we obtained a corpus with 1,270 projects (removed 265 projects because no data was left after filtering), 130,934 test methods, and 645,633 statements. We follow the same project-level training/validation/evalua- tion split as CodeSearchNet. Because CodeT5, the pre-trained model that TECO uses in our experiments, also followed the same project-level split, our experiments will not have data leakage issues of evaluating on the data that the model was pre-trained on. Table I shows the statistics of our corpus, where the first row is for the entire corpus, and the other three rows are for each set after the split. Out of the 130,934 test meth- ods, 101,965 (77.88%) are runnable following our procedure described in Section IV-D. Note that with the masking of string literals, some test methods that would originally pass may be considered as "not runnable" in our current corpus (e.g., when the test method compares a variable with a string literal). VI. EXPERIMENTS SETUP We assess the performance of TECO by answering the following research questions: RQ1: What is the performance of TECO on the test completion task and how does it compare to baselines? RQ2: On the runnable subset of evaluation set, how frequently can TECO predict a compilable and runnable next statement? RQ3: What is the performance of TECO on test oracle generation, which is a downstream application of the test completion task, and how does it compare to prior work? RQ4: How does reranking by execution help with more accurately predicting the next statement? RQ5: How does each kind of code semantics help with more accurately predicting the next statement, and how complemen- tary are different kinds of code semantics? 6 to To answer these questions, we setup an experiment evaluate TECO and baseline models on our test completion corpus. We train each model on the training and validation sets (validation set is used for tuning hyper-parameters and early stopping), apply the model to predict each statement of each test method in the evaluation set (or subsets of the evaluation set), and measure the quality of the prediction via a number of evaluation metrics, both intrinsically and extrinsically. All models are trained and evaluated on machines equipped with 4 NVidia 1080-TI GPUs and Intel(R) Xeon(R) CPU E5- 2620 v4 @ 2.10GHz. We ran each experiment three times with different random seeds and report average values. When comparing models, we conducted statistical significance tests using bootstrap tests [56] with a 95% confidence level. We next describe the TECO models (Section VI-A) and baseline models (Section VI-B) used in the experiments, the subsets of the evaluation set for computing compilable and runnable metrics and evaluating on the test oracle generation task (Section VI-C), and the evaluation metrics (Section VI-D). A. TECO Models We run a TECO model that uses all six kinds of code semantics and with reranking by test execution. To study RQ4, we run a TECO-noRr model that uses the same code semantics but does not use reranking. To study RQ5, we run six TECO models with only one kind of code semantics at a time, which we call TECO-ID (e.g., TECO-S1 only uses S1). B. Baseline Models We compare our TECO models to the following baseline models that only use syntax-level data. CodeT5 [35] is a pre-trained encoder-decoder transformer model for code-related tasks, and is built on top of Google's popular T5 framework [24]. CodeT5 was pre-trained on eight commonly used programming languages (including Java) us- ing both mask language modeling and identifier name recov- ering tasks. We fine-tune TECO models based on CodeT5. As such, we compare to a baseline CodeT5 model that is finetuned on syntax-level data. For completeness, we also compare to a CodeT5-noFt that is only pre-trained and not fine-tuned. CodeGPT [54] is a decoder-only transformer model built on GPT-2 [22]. We used the java-adapted version of it, which is initialized from GPT-2 pre-trained on natural language, and then further pre-trained on a corpus of Java code. Svyatkovskiy et al. [29] used a very similar model (which is not publicly available) for code completion. As CodeGPT tends to gen- erate longer code than a statement (without generating the (cid:104)/s(cid:105) subtoken to stop the generation), we slightly modify its decoding algorithm to terminate upon generating the first ';' subtoken for the test completion task. Test oracle generation is the task of generating the assertion statement given the code under test (including the method un- der test), test method signature, and prior statements before the assertion statement. When studying this task, we additionally compare to the following two deep learning baseline models for test oracle generation developed in prior work, both of which only use syntax-level data. Following the prior works, we only consider generating the first assertion statement in each test method. ATLAS [39] is a RNN encoder-decoder model for test oracle generation. We used the "raw model" version of it, i.e., that does not abstract out the identifiers in code. TOGA [40] is a transformer encoder-only model for classify- ing the suitability of an assertion statement for an incomplete test method without assertions. It can be used for test oracle generation by first generating a set of assertion statements and then using the model to rank them and select the best one. The model is initialized from CodeBERT [49], which is also pre- trained on the CodeSearchNet corpus [53]. For all baseline models, we use the default hyper-parameters and training configurations recommended by the authors. We train CodeT5 and CodeGPT on the entire training and validation set of our corpus. We train ATLAS and TOGA on a subset of our training and validation set that only predicts the first assertion statement in each test method, which contains 92,567 statements and 3,050 statements, respectively. C. Subsets of the Evaluation Set To study the ability of models in predicting a compilable and runnable next statement, we evaluate models on the runnable subset. That is, the subset of the evaluation set where the gold (i.e., developer-written) statement is runnable. We follow the same procedure to check if the gold statement is runnable as described in Section IV-D. Not all gold statements can be successfully executed because of the difficulties in setting up the proper runtime environment, such as missing resources (that may need to be downloaded or generated via other commands), requiring other runtime environments than Java, etc. Our runnable subset contains 25,074 statements (83.04% of all statements in the evaluation set) from 4,223 test methods. To study the test oracle generation task, we evaluate models on the oracle subset: the subset of the evaluation set where the statement to generate is the first assertion statement in the test method, which contains 4,212 statements. To compute compilable and runnable metrics on the test oracle generation task, we evaluate models on the oracle-runnable subset: the subset of the oracle subset where the gold statement is runnable, which contains 3,540 statements. D. Evaluation Metrics (1) Lexical-level metrics: We use the following automatic metrics to measure how close the predicted statements are to the gold statements; these metrics have been frequently used in prior work on code generation and comment generation [31], [33], [57], [58]: Exact-match accuracy (XM) is the percentage of predicted statements matches exactly with the gold. This metric is the most strict one; each point of improvement directly entails a larger portion of code that is both syntactically and semanti- cally correct, yet it does not take into account paraphrases or give any partial credit. 7 TABLE II: Results for TECO and baseline models. The best number for each metric is bolded. In each table, numbers marked with the same greek letter prefix are not statistically significantly different. (a) On the evaluation set. Model XM Acc@10 BLEU CodeBLEU EditSim ROUGE CodeT5 CodeT5-noFt CodeGPT TECO 13.57 0.00 12.20 17.61 24.11 0.00 22.67 38.33 0.00 36.30 27.20 42.01 33.88 3.36 31.84 37.61 60.81 1.68 59.09 63.49 62.40 0.02 61.10 65.23 (b) On the runnable subset. Model %Compile %Run XM Acc@10 BLEU CodeBLEU EditSim ROUGE CodeT5 CodeT5-noFt CodeGPT TECO 54.84 0.00 53.77 17.62 14.38 0.00 0.00 15.13 12.95 25.39 0.00 24.03 39.26 0.00 37.19 76.22 28.63 18.96 28.40 43.15 34.55 3.35 32.46 38.45 61.36 1.65 59.75 64.12 63.15 0.03 61.90 66.09 (c) On the oracle subset. Model XM Acc@10 BLEU CodeBLEU EditSim ROUGE CodeT5 8.45 CodeT5-noFt α0.00 10.56 CodeGPT α0.21 ATLAS 9.01 TOGA 24.04 0.00 27.19 0.66 9.01 39.03 0.00 40.91 21.55 25.46 TECO 16.44 27.41 43.09 31.03 1.18 33.33 13.39 24.73 35.88 66.50 1.86 67.63 54.06 29.60 68.05 66.63 0.01 67.94 50.70 28.06 68.71 (d) On the oracle-runnable subset. Model %Compile %Run XM Acc@10 BLEU CodeBLEU EditSim ROUGE CodeT5 CodeT5-noFt CodeGPT ATLAS TOGA 44.45 0.00 47.39 3.62 25.61 16.87 8.79 0.00 α0.00 16.13 10.41 1.45 α0.23 9.37 9.10 24.37 0.00 28.17 0.68 9.10 40.26 0.00 41.56 21.81 26.51 TECO 67.93 30.29 17.37 27.39 44.27 32.23 1.26 33.79 13.56 25.74 36.98 67.08 1.87 67.78 54.19 31.00 68.43 67.42 0.01 68.43 50.87 29.38 69.35 Top-10 accuracy (Acc@10) is the percentage of any top- 10 predicted statements matches exactly with the gold. This metric evaluates the use case where the developer can see and select from the top-10 predictions of the model. BLEU [36] calculates the number of n-grams (consecutive n subtokens) in the prediction that also appear in the gold; specifically, we compute the 1 ∼ 4-grams overlap between the subtokens in the prediction and the subtokens in the gold, averaged between 1 ∼ 4-grams with smoothing method proposed by Lin and Och [59]. CodeBLEU [37] is an improved version of BLEU adapted for code. It is a combination of the traditional BLEU, the BLEU if only considering keywords, syntactical AST match, and semantic data-flow match. Edit similarity (EditSim) = 1 - Levenshtein edit distance, where the Levenshtein edit distance measures the amount of single-character edits (including insertion, substitution, or deletion) that need to be made to transform the prediction to the gold, normalized by the maximum number of characters in the prediction and the gold. This metric was proposed and used in prior work on code completion [29]. ROUGE [38] measures the overlap between the prediction subtokens and the gold subtokens based on the Longest Common Subsequence statistics, using F1 score. (2) Functional correctness: The aforementioned metrics only capture the lexical similarity between the prediction against the gold, but the gold statement may not be the only correct solution for competing the next statement. Namely, the prediction can be functionally correct despite being different from the gold statement. To measure the functional correct- ness, we additionally use the following automatic metrics: %Compile is the percentage of the predicted statements that are compilable when appended to the incomplete test. %Run is the percentage of the predicted statements that are compilable and runnable when appended to the incomplete test, without incurring assertion failures or runtime errors. Note that %Compile and %Run are over-estimations of the functional correctness, as they do not consider whether the underlying logic of the code is meaningful. That said, most functional correctness errors relevant to tests, such as generating the wrong expected outputs, can be captured by the %Run metric. Prior work has used a similar methodology to 8 TABLE III: Results for TECO without and with reranking by execution. The best number for each metric is bolded. The differences between models for each metric are statistical significant. (a) On the evaluation set. Model XM BLEU CodeBLEU EditSim ROUGE CodeT5 13.57 TECO-noRr 15.25 17.61 TECO 38.33 40.84 42.01 33.88 36.34 37.61 60.81 62.92 63.49 62.40 64.71 65.23 (b) On the runnable subset. Model %Compile %Run XM BLEU CodeBLEU EditSim ROUGE CodeT5 TECO-noRr TECO 54.84 60.80 76.22 17.62 14.38 19.49 15.99 28.63 18.96 39.26 41.64 43.15 34.55 36.82 38.45 61.36 63.38 64.12 63.15 65.42 66.09 (c) On the oracle subset. Model XM BLEU CodeBLEU EditSim ROUGE CodeT5 TECO-noRr TECO 8.45 9.92 16.44 39.03 40.81 43.09 31.03 32.90 35.88 66.50 67.32 68.05 66.63 67.92 68.71 (d) On the oracle-runnable subset. Model %Compile %Run XM BLEU CodeBLEU EditSim ROUGE CodeT5 TECO-noRr TECO 44.45 48.13 67.93 16.87 8.79 18.45 9.62 30.29 17.37 40.26 41.55 44.27 32.23 33.44 36.98 67.08 67.57 68.43 67.42 68.41 69.35 evaluate the functional correctness of text-to-code transduction by running generated code with test cases [30], which was performed on a rather small dataset because of the difficulty in collecting manual labelled data. Thanks to the executable nature of tests, we are able to design the two automatic functional correctness metrics for a large corpus. VII. RESULTS A. RQ1: Performance of TECO vs. Baseline Models Table IIa shows the results of TECO and baseline models on solving the test completion task. Our model TECO sig- nificantly outperforms all baseline models on all automatic metrics. TECO achieves 17.61 exact-match accuracy, which is 29% higher than the best baseline model, CodeT5's 13.57. This indicates that using code semantics and reranking by exe- cution can greatly improve deep learning model's performance on test completion. The non-fine-tuned baseline model, CodeT5-noFt, is not capable of solving test completion task. This is because the model is optimized to solve different tasks during pre-training and does not have the domain knowledge of the input-output format of the test completion task. CodeGPT has shown to be effective on the task of code completion [29], [54], where the primary goal is to continue generating code similar to the context code. However, it performs slightly worse than the encoder-decoder baseline CodeT5 on test completion, because the task requires gen- erating statement in the test method which has different style than the method under test in the provided context. B. RQ2: Functional Correctness Table IIb shows the results of TECO and baseline models on the runnable subset, with %Compile and %Run metrics that measure the functional correctness of the generated state- ments. Our model, TECO can generate runnable statements for 28.63% of the time, and compilable statements for 76.22% of the time, much higher than the best baseline model's 17.62% and 54.84%. On this runnable subset, TECO also outperforms all baseline models on other metrics measuring lexical similarity. The other and CodeGPT, fail to generate any compilable or runnable state- ments. After closer inspection, we found that CodeT5-noFt always generate broken non-code outputs, as it is not fine- tuned to process the inputs; and CodeGPT always generate code that is not a valid statement in Java, e.g., code that starts with a method signature. two baseline models, CodeT5-noFt C. RQ3: Performance on Test Oracle Generation Tables IIc and IId show the results of the downstream application of test oracle generation, on the oracle subset and the oracle-runnable subset, respectively. TECO significantly improves the exact-match accuracy on this task by a large margin (by 82%), from 9.01 for the prior state-of-the-art, TOGA, to ours 16.44. Note that TOGA's exact-match accuracy is on-par with CodeT5, the model that TECO is fine-tuned from, which confirms that TECO's improvements primarily come from using code semantics and reranking by execution. TOGA is the strongest prior model on this task in terms of exact-match accuracy. However, it is worse than the CodeT5 9 baseline model on other metrics that consider partial matches. This is because TOGA is a classification model that ranks a set of assertion statement candidates generated using heuristics, and when the gold statement is not in the set, the model fails to correctly rank a sub-optimal candidate. D. RQ4: Improvements from Reranking by Execution Table III shows the results of TECO-noRr (the top-10 accuracy for TECO-noRr is always the same as TECO, because the reranking is performed on top-10 predictions, thus we did not include this metric in the table). Comparing TECO with TECO-noRr on the evaluation set (Table IIIa), reranking by execution alone contributes to 2 points in exact-match accuracy. However, the improvements over other similarity metrics, which take into account partial matches, are smaller. This indicates that reranking by exe- cution is effective in prioritizing the exact correct generated statement than other non-runnable candidates most of the times, but in a few cases it may prioritize runnable candidates that are less similar to the gold statement than the original top- 1. TECO-noRr still significantly outperforms CodeT5 on all metrics. On the runnable subset (Table IIIb), TECO improves both %Compile and %Run over TECO-noRr by large margins, which shows that reranking by execution is an effective strategy for improving the quality of generated statements. Reranking by execution ended up being very important for improving performance on the task of test oracle generation, as shown on the oracle subset (Table IIIc) and the oracle-runnable subset (Table IIId). For example, TECO outperforms TECO- noRr by 6–8 points in exact-match accuracy and 12 points in %Run. This is because logical errors in assertion statements can be easily found by execution (e.g., generating the wrong expected value will cause an assertion to fail). E. RQ5: Comparisons of Code Semantics Tables IVa and IVb show the results of the TECO models with only one kind of code semantics, comparing with the strongest baseline model CodeT5, on the full evaluation set and the oracle subset, respectively. We did not perform statisti- cal significance tests for the results here as the performances of the models are too close. Each model outperforms CodeT5 on at least one metric, meaning that each code semantics provides some information useful for test completion. In Table IVa, TECO-S2 (absent types) is the best model in terms of BLEU, CodeBLEU, EditSim and ROUGE metrics, and TECO-S4 (setup teardown) is the best model in terms of exact-match accuracy and top-10 accuracy, which indicates that these two kinds of code semantics are relatively more important than others. Interestingly, in Table IVb, the models that achieved the best performance among single-data models changed: TECO- S3 (unset fields) is the best model in terms of BLEU, EditSim, and ROUGE, and TECO-S6 (similar statement) is the best model in terms of exact-match accuracy, top-10 accuracy, and CodeBLEU. Thus, different kinds of code semantics provide complementary information for test completion. TABLE IV: Results for TECO models with only one kind of code semantics on the evaluation set. The best number for each metric is bolded. (a) On the evaluation set. Model XM Acc@10 BLEU CodeBLEU EditSim ROUGE CodeT5 13.57 24.11 38.33 TECO-S1 13.88 TECO-S2 14.06 TECO-S3 14.04 TECO-S4 14.44 TECO-S5 14.05 TECO-S6 14.13 24.93 25.11 24.40 25.55 24.78 24.74 39.12 39.56 38.81 39.39 38.74 38.70 33.88 34.66 35.17 34.24 35.00 34.34 34.36 60.81 61.58 62.20 61.21 61.63 61.26 60.86 62.40 63.51 63.92 62.87 63.40 63.00 62.52 (b) On the oracle subset. Model XM Acc@10 BLEU CodeBLEU EditSim ROUGE CodeT5 TECO-S1 TECO-S2 TECO-S3 TECO-S4 TECO-S5 TECO-S6 8.45 8.86 8.23 8.72 8.14 8.43 9.81 24.04 39.03 24.37 23.69 23.57 23.84 24.10 25.47 38.03 38.13 39.90 38.54 38.67 39.88 31.03 29.93 30.27 31.96 30.77 30.85 32.20 66.50 65.59 65.52 67.20 65.59 66.17 66.89 66.63 65.95 65.98 67.44 65.92 66.23 66.97 VIII. LIMITATIONS AND FUTURE WORK We discuss several limitations of our work and the future work inspired by those limitations. Usability. We envision our models being integrated into an IDE. At any point, a user would be able to see top-k results from our models and potentially decide to use one of the suggestions. This is similar to email completion that has recently been integrated into several popular web-based email clients, e.g., GMail. Structured representation. Currently we do not considering using any structured representation of code, e.g., abstract syntax trees (ASTs). Such a representation could enhance performance of our models and enable a quick check of validity of generated code. We leave this for future work. Test-Driven Development (TDD). We assume that code under test is written before tests when defining the test completion task, which is the opposite order of TDD. Future work could explore the mirror task of code completion with a test method context that is applicable to projects adopting TDD. Testing frameworks. We focused on tests written in the JUnit style. Although other testing frameworks are available (e.g., TestNG), JUnit is the most popular among Java projects. Large language models for code. Recent large language models that scale up to billions of parameters create new state-of-the-art for many code-related tasks [30], [60], [61]. However, these models do not perform well on simple code execution tasks [50]. Incorporating code semantics into large language models for code is a promising direction which we leave as future work. 10 IX. RELATED WORK Automated test generation. Existing automatic test gener- ation work includes fuzz/random testing [1]–[3], property- based testing [4]–[10], search-based testing [11], [12], and combinatorial testing [13]. The typical goal in automated test generation techniques, e.g., Randoop [1] and EvoSuite [12], is to achieve high code coverage of the code under test by generating a large amount of tests, either randomly or systematically. However, the generated tests would not be added to the manually written tests in the code repository due to their low quality and the excessive amount. Some prior work explored improving the quality of the generated tests, for example: Helmes et al. [9] proposed to use relative LOC to guide the choosing of test generation targets; Reddy et al. [62] proposed to use reinforcement learning to guide the random input generator in property-based test generation. So far, these automated techniques are used only in addition to manually written tests. In contrast, we focus on improving developers' productivity when writing manual tests. Another disadvantage of the automated test generation ap- proaches is the lack of test oracles. To remedy that, prior work explored extracting test oracles from code comments, focusing on test oracles related to exceptional behaviors, null pointer checks, and boundary conditions [63]–[66]. These techniques target generating/completing test oracles, but we target completing any part of the tests, including test oracles. Prior work also explored using deep learning models for test oracle generation without the use of comments, including ATLAS [39] and TOGA [40]. We have described both models in Section VI-B and compared TECO with them on the task of test oracle generation, which can be considered as downstream application of our test completion task. Tufano et al. [67] developed a code generation technique for tests based on a BART architecture pre-trained on English and code corpora. While they target to generate the entire test method as a whole, we target to complete one statement at a time, which allows the developer to observe and control the process of writing a test method. Test recommendation. Prior work also explored improving developers' productivity in testing by test recommendation: given a method under test, suggest relevant test methods from the existing test suite using a recommendation system [68]– [71]. These techniques rely on having a set of relevant existing tests to recommend tests from, which is usually not the case when developers are starting a new project or adding tests to a project without tests. Our technique helps developers by providing completions while they are writing tests and does not have this limitation. ML for SE. The applications of ML models on SE tasks is an active research area in recent years. One of the most studied task is code completion, which improves develop- ers' productivity by suggesting next tokens or statements as developers are writing code [26]–[29], [35], [54], [72]–[76]. Researchers have also studied developing ML models for other SE tasks, including code summarization [31]–[33], [47], [57], [58], [77], [78], code and comment maintenance [79]–[82], bug fixing [83]–[85], etc. In this work, we propose the novel task of test completion, which brings several unique features (e.g., method under test) and necessitates reasoning about code execution. We also compared TECO to recent work on code completion [35], [54]. Prior work explored the use of code execution data in ML for SE. Wang et al. [86] proposed to train semantic code embeddings from execution traces, which can be used to improve the performance of program repair models. Wang and Su [87] blended syntactical and semantic code embeddings and applied them in a method naming model. Nie et al. [88] developed Roosterize, a model for suggesting lemma names in verification projects which is trained using the runtime representations of lemmas. Pei et al. [89] developed a transfer learning framework called TREX that learns execution se- mantics from forced-execution traces to detect similar binary functions. Pi et al. [90] proposed PoEt improves the reasoning capabilities of language models by pre-training on code execution data. Shi et al. [91] proposed to improve code generation models' outputs using a minimum Bayes risk decoding algorithm based on execution results. TECO is the first model designed with code execution in the testing domain, specifically on the test completion task, where reasoning about the execution of the code under test is needed. Moreover, TECO integrates execution to improve both training (using code semantics) and inference (using reranking via execution) of the model. that X. CONCLUSION We introduced an idea of designing ML models for code- related tasks with code semantics inputs and reranking based on test execution outcomes. Based on this idea, we developed a concrete model, named TECO, targeting a novel task: test completion. We evaluated TECO on a new corpus, containing 130,934 methods and 101,965 executable methods. Our results show that TECO significantly outperforms the state-of-the- art on code completion and oracle generation tasks, across a number of evaluation metrics. We believe that TECO is only a starting point in the exciting area of ML for code with code semantics and execution data. ACKNOWLEDGMENTS We thank Nader Al Awar, Alex Dimakis, Greg Durrett, Kush Jain, Yu Liu, Sheena Panthaplackel, August Shi, Aditya Thimmaiah, Zhiqiang Zang, Jiyang Zhang, and the anonymous reviewers for their comments and feedback. The authors ac- knowledge the Texas Advanced Computing Center (TACC) at The University of Texas at Austin for providing HPC resources that have contributed to the research results reported within this paper. This work is partially supported by the US National Science Foundation under Grant Nos. CCF-1652517, CCF- 2107291, IIS-2145479, and CCF-2217696. 11 REFERENCES [1] C. Pacheco, S. K. Lahiri, M. D. Ernst, and T. Ball, "Feedback-directed random test generation," in International Conference on Software Engi- neering, 2007, pp. 75–84. [2] A. Zeller, R. Gopinath, M. B ̈ohme, G. Fraser, and C. Holler, The Fuzzing Book, 2019. [3] Z. Zang, N. Wiatrek, M. Gligoric, and A. Shi, "Compiler testing using template java programs," in Automated Software Engineering, 2022, pp. 1–13. [4] K. Claessen and J. Hughes, "QuickCheck: A lightweight tool for random testing of Haskell programs," in International Conference on Functional Programming, 2000, pp. 268–279. [5] C. Boyapati, S. Khurshid, and D. Marinov, "Korat: Automated testing based on Java predicates," in International Symposium on Software Testing and Analysis, 2002, pp. 123–133. [6] M. Gligoric, T. Gvero, V. Jagannath, S. Khurshid, V. Kuncak, and D. Marinov, "Test generation through programming in UDITA," in International Conference on Software Engineering, 2010, pp. 225–234. [7] I. Kuraj, V. Kuncak, and D. Jackson, "Programming with enumerable sets of structures," in International Conference on Object-Oriented Programming, Systems, Languages, and Applications, 2015, pp. 37–56. [8] A. Celik, S. Pai, S. Khurshid, and M. Gligoric, "Bounded exhaustive test-input generation on GPUs," in International Conference on Object- Oriented Programming, Systems, Languages, and Applications, 2017, pp. 94:1–94:25. [9] J. Holmes, I. Ahmed, C. Brindescu, R. Gopinath, H. Zhang, and A. Groce, "Using relative lines of code to guide automated test generation for python," Transactions on Software Engineering and Methodology, vol. 29, no. 4, pp. 1–38, 2020. [10] N. Al Awar, K. Jain, C. J. Rossbach, and M. Gligoric, "Programming and execution models for parallel bounded exhaustive testing," in International Conference on Object-Oriented Programming, Systems, Languages, and Applications, 2021, pp. 1–28. [11] M. Harman and P. McMinn, "A theoretical and empirical study of search-based testing: Local, global, and hybrid search," Transactions on Software Engineering, vol. 36, no. 2, pp. 226–247, 2010. [12] G. Fraser and A. Arcuri, "EvoSuite: Automatic test suite generation for object-oriented software," in International Conference on Software Engineering, 2011, pp. 416–419. [13] M. B. Cohen, J. Snyder, and G. Rothermel, "Testing across configu- rations: Implications for combinatorial testing," Software Engineering Notes, vol. 31, no. 6, pp. 1–9, 2006. [14] E. Daka, J. M. Rojas, and G. Fraser, "Generating unit tests with descriptive names or: Would you name your children thing1 and thing2?" in International Symposium on Software Testing and Analysis, 2017, pp. 57–67. [15] B. Robinson, M. D. Ernst, J. H. Perkins, V. Augustine, and N. Li, "Scal- ing up automated test generation: Automatically generating maintainable regression unit tests for programs," in Automated Software Engineering, 2011, pp. 23–32. [16] B. Zhang, E. Hill, and J. Clause, "Towards automatically generating descriptive names for unit tests," in Automated Software Engineering, 2016, pp. 625–636. [17] A. Hindle, E. T. Barr, Z. Su, M. Gabel, and P. Devanbu, "On the natural- ness of software," in International Conference on Software Engineering, 2012, pp. 837–847. [18] M. Rahman, D. Palani, and P. Rigby, "Natural software revisited," in International Conference on Software Engineering, 2019, pp. 37–48. [19] D. E. Rumelhart, G. E. Hinton, and R. J. Williams, "Learning repre- sentations by back-propagating errors," Nature, vol. 323, no. 6088, pp. 533–536, 1986. [20] S. Hochreiter and J. Schmidhuber, "Long short-term memory," Neural Computation, vol. 9, no. 8, pp. 1735–1780, 1997. [21] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin, "Attention is all you need," in Conference on Neural Information Processing Systems, 2017, pp. 6000–6010. [22] A. Radford, J. Wu, R. Child, D. Luan, D. Amodei, and I. Sutskever, "Language models are unsupervised multitask learners," OpenAI blog, vol. 1, no. 8, p. 9, 2019. [23] M. Lewis, Y. Liu, N. Goyal, M. Ghazvininejad, A. Mohamed, O. Levy, V. Stoyanov, and L. Zettlemoyer, "BART: Denoising sequence-to- sequence pre-training for natural language generation, translation, and comprehension," Annual Meeting of the Association for Computational Linguistics, pp. 7871–7880, 2020. [24] C. Raffel, N. Shazeer, A. Roberts, K. Lee, S. Narang, M. Matena, Y. Zhou, W. Li, and P. J. Liu, "Exploring the limits of transfer learning with a unified text-to-text transformer," Journal of Machine Learning Research, vol. 21, pp. 1–67, 2020. [25] S. Proksch, J. Lerch, and M. Mezini, "Intelligent code completion with Bayesian networks," Transactions on Software Engineering and Methodology, vol. 25, no. 1, pp. 1–31, 2015. [26] A. Svyatkovskiy, Y. Zhao, S. Fu, and N. Sundaresan, "Pythia: AI-assisted code completion system," in International Conference on Knowledge Discovery and Data Mining, 2019, pp. 2727–2735. [27] J. Li, Y. Wang, M. R. Lyu, and I. King, "Code completion with neural attention and pointer networks," in International Joint Conference on Artificial Intelligence, 2018, pp. 4159–4165. [28] V. Raychev, M. Vechev, and E. Yahav, "Code completion with statistical language models," in Conference on Programming Language Design and Implementation, 2014, pp. 419–428. [29] A. Svyatkovskiy, S. K. Deng, S. Fu, and N. Sundaresan, "Intellicode compose: Code generation using transformer," in International Sympo- sium on the Foundations of Software Engineering, 2020, pp. 1433–1443. [30] M. Chen, J. Tworek, H. Jun, Q. Yuan, H. P. d. O. Pinto, J. Kaplan, H. Edwards, Y. Burda, N. Joseph, G. Brockman et al., "Evaluating large language models trained on code," arXiv preprint arXiv:2107.03374, 2021. [31] S. Iyer, I. Konstas, A. Cheung, and L. Zettlemoyer, "Summarizing source code using a neural attention model," in Annual Meeting of the Association for Computational Linguistics, 2016, pp. 2073–2083. [32] W. U. Ahmad, S. Chakraborty, B. Ray, and K. Chang, "A transformer- based approach for source code summarization," in Annual Meeting of the Association for Computational Linguistics, 2020, pp. 4998–5007. [33] A. LeClair, S. Jiang, and C. McMillan, "A neural model for generating natural language summaries of program subroutines," in International Conference on Software Engineering, 2019, pp. 795–806. [34] W. Ahmad, S. Chakraborty, B. Ray, and K.-W. Chang, "Unified pre- training for program understanding and generation," in Conference of the Association for Computational the North American Chapter of Linguistics: Human Language Technologies, 2021, pp. 2655–2668. [35] Y. Wang, W. Wang, S. Joty, and S. C. Hoi, "CodeT5: Identifier-aware unified pre-trained encoder-decoder models for code understanding and generation," in Empirical Methods in Natural Language Processing, 2021, pp. 8696–8708. [36] K. Papineni, S. Roukos, T. Ward, and W. Zhu, "BLEU: A method for automatic evaluation of machine translation," in Annual Meeting of the Association for Computational Linguistics, 2002, pp. 311–318. [37] S. Ren, D. Guo, S. Lu, L. Zhou, S. Liu, D. Tang, N. Sundaresan, M. Zhou, A. Blanco, and S. Ma, "CodeBLEU: A method for automatic evaluation of code synthesis," arXiv preprint arXiv:2009.10297, 2020. [38] C. Lin and F. J. Och, "Automatic evaluation of machine translation quality using longest common subsequence and skip-bigram statistics," in Annual Meeting of the Association for Computational Linguistics, 2004, pp. 605–612. [39] C. Watson, M. Tufano, K. Moran, G. Bavota, and D. Poshyvanyk, test cases," in "On learning meaningful assert statements for unit International Conference on Software Engineering, 2020, pp. 1398– 1409. [40] E. Dinella, G. Ryan, T. Mytkowicz, and S. K. Lahiri, "TOGA: A neural method for test oracle generation," in International Conference on Software Engineering, 2022, pp. 2130–2141. [41] The JUnit Team, "JUnit 5," https://junit.org/junit5/. [42] S. E. Robertson, S. Walker, and M. Beaulieu, "Experimentation as a way of life: Okapi at TREC," Information Processing & Management, vol. 36, no. 1, pp. 95–108, 2000. [43] JavaParser Team, "JavaParser," https://github.com/javaparser/javaparser. [44] E. Bruneton, R. Lenglet, and T. Coupaye, "ASM: A code manipula- tion tool to implement adaptable systems," Adaptable and Extensible Component Systems, vol. 30, no. 19, 2002. [45] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vander- plas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duch- esnay, "Scikit-learn: Machine learning in Python," Journal of Machine Learning Research, vol. 12, pp. 2825–2830, 2011. [46] X. V. Lin, C. Wang, L. Zettlemoyer, and M. D. Ernst, "NL2Bash: A corpus and semantic parser for natural language interface to the Linux 12 operating system," in International Conference on Language Resources and Evaluation, 2018. [47] B. Wei, G. Li, X. Xia, Z. Fu, and Z. Jin, "Code generation as a dual task of code summarization," in Conference on Neural Information Processing Systems, 2019, pp. 6563–6573. [48] R. Sennrich, B. Haddow, and A. Birch, "Neural machine translation of rare words with subword units," in Annual Meeting of the Association for Computational Linguistics, 2016, pp. 1715–1725. [49] Z. Feng, D. Guo, D. Tang, N. Duan, X. Feng, M. Gong, L. Shou, B. Qin, T. Liu, D. Jiang et al., "CodeBERT: A pre-trained model for programming and natural languages," in Empirical Methods in Natural Language Processing, 2020, pp. 1536–1547. [50] M. Nye, A. J. Andreassen, G. Gur-Ari, H. Michalewski, J. Austin, D. Bieber, D. Dohan, A. Lewkowycz, M. Bosma, D. Luan et al., "Show your work: Scratchpads for intermediate computation with language models," arXiv preprint arXiv:2112.00114, 2021. [51] N. S. Keskar, B. McCann, L. R. Varshney, C. Xiong, and R. Socher, "Ctrl: A conditional transformer language model for controllable gen- eration," arXiv preprint arXiv:1909.05858, 2019. [52] The JUnit Team, "JUnit - about," https://junit.org/junit4/. [53] H. Husain, H.-H. Wu, T. Gazit, M. Allamanis, and M. Brockschmidt, "CodeSearchNet challenge: Evaluating the state of semantic code search," arXiv:1909.09436, 2020. [54] S. Lu, D. Guo, S. Ren, J. Huang, A. Svyatkovskiy, A. Blanco, C. Clement, D. Drain, D. Jiang, D. Tang et al., "CodeXGLUE: A machine learning benchmark dataset for code understanding and gener- ation," arXiv preprint arXiv:2102.04664, 2021. [55] JDK Team, "Lambda expression," https://docs.oracle.com/javase/ tutorial/java/javaOO/lambdaexpressions.html. [56] T. Berg-Kirkpatrick, D. Burkett, and D. Klein, "An empirical investiga- tion of statistical significance in NLP," in Joint Conference on Empirical Methods in Natural Language Processing and Computational Natural Language Learning, 2012, pp. 995–1005. [57] X. Hu, G. Li, X. Xia, D. Lo, and Z. Jin, "Deep code comment generation with hybrid lexical and syntactical information," Empirical Software Engineering, pp. 1–39, 2019. [58] Y. Liang and K. Q. Zhu, "Automatic generation of text descriptive com- ments for code blocks," in AAAI Conference on Artificial Intelligence, 2018, pp. 5229–5236. [59] C. Lin and F. J. Och, "ORANGE: A method for evaluating automatic evaluation metrics for machine translation," in International Conference on Computational Linguistics, 2004, pp. 501–507. [60] A. Chowdhery, S. Narang, J. Devlin, M. Bosma, G. Mishra, A. Roberts, P. Barham, H. W. Chung, C. Sutton, S. Gehrmann et al., "PaLM: Scaling language modeling with pathways," arXiv preprint arXiv:2204.02311, 2022. [61] Y. Li, D. Choi, J. Chung, N. Kushman, J. Schrittwieser, R. Leblond, T. Eccles, J. Keeling, F. Gimeno, A. D. Lago et al., "Competition-level code generation with AlphaCode," arXiv preprint arXiv:2203.07814, 2022. [62] S. Reddy, C. Lemieux, R. Padhye, and K. Sen, "Quickly generating diverse valid test inputs with reinforcement learning," in International Conference on Software Engineering, 2020, pp. 1410–1421. [63] S. H. Tan, D. Marinov, L. Tan, and G. T. Leavens, "@tComment: Testing javadoc comments to detect comment-code inconsistencies," in Inter- national Conference on Software Testing, Verification, and Validation, 2012, pp. 260–269. [64] A. Goffi, A. Gorla, M. D. Ernst, and M. Pezz`e, "Automatic generation of oracles for exceptional behaviors," in International Symposium on Software Testing and Analysis, 2016, pp. 213–224. [65] A. Blasi, A. Goffi, K. Kuznetsov, A. Gorla, M. D. Ernst, M. Pezz`e, and S. D. Castellanos, "Translating code comments to procedure specifica- tions," in International Symposium on Software Testing and Analysis, 2018, pp. 242–253. [66] M. Motwani and Y. Brun, "Automatically generating precise oracles from structured natural language specifications," in International Con- ference on Software Engineering, 2019, pp. 188–199. [67] M. Tufano, D. Drain, A. Svyatkovskiy, S. K. Deng, and N. Sun- daresan, "Unit test case generation with transformers," arXiv preprint arXiv:2009.05617, 2020. [69] R. Pham, Y. Stoliar, and K. Schneider, "Automatically recommending test code examples to inexperienced developers," in International Sym- posium on the Foundations of Software Engineering, NIER, 2015, pp. 890–893. [70] R. Qian, Y. Zhao, D. Men, Y. Feng, Q. Shi, Y. Huang, and Z. Chen, "Test recommendation system based on slicing coverage filtering," in International Symposium on Software Testing and Analysis, Tool Demonstrations, 2020, pp. 573–576. [71] C. Zhu, W. Sun, Q. Liu, Y. Yuan, C. Fang, and Y. Huang, "HomoTR: Online test recommendation system based on homologous code match- ing," in Automated Software Engineering, Tool Demonstrations, 2020. [72] R. Robbes and M. Lanza, "Improving code completion with program history," Automated Software Engineering, vol. 17, no. 2, pp. 181–212, 2010. [73] M. Bruch, M. Monperrus, and M. Mezini, "Learning from examples to improve code completion systems," in International Symposium on the Foundations of Software Engineering, 2009, pp. 213–222. [74] S. Han, D. R. Wallace, and R. C. Miller, "Code completion from abbreviated input," in Automated Software Engineering, 2009, pp. 332– 343. [75] A. T. Nguyen, T. T. Nguyen, H. A. Nguyen, A. Tamrawi, H. V. Nguyen, J. Al-Kofahi, and T. N. Nguyen, "Graph-based pattern-oriented, context-sensitive source code completion," in International Conference on Software Engineering, 2012, pp. 69–79. [76] J. Lee, P. Nie, J. J. Li, and M. Gligoric, "On the naturalness of hardware descriptions," in International Symposium on the Foundations of Software Engineering, 2020, pp. 530–542. [77] J. Zhang, S. Panthaplackel, P. Nie, J. J. Li, R. J. Mooney, and M. Glig- oric, "Leveraging class hierarchy for code comprehension," in Workshop on Computer Assisted Programming, 2020. [78] P. Nie, J. Zhang, J. J. Li, R. J. Mooney, and M. Gligoric, "Impact of evaluation methodologies on code summarization," in Annual Meeting of the Association for Computational Linguistics, 2022, pp. 4936–4960. [79] S. Panthaplackel, P. Nie, M. Gligoric, J. J. Li, and R. J. Mooney, "Learning to update natural language comments based on code changes," in Annual Meeting of the Association for Computational Linguistics, 2020, pp. 1853–1868. [80] J. Zhang, S. Panthaplackel, P. Nie, J. J. Li, and M. Gligoric, "CoditT5: Pretraining for source code and natural language editing," in Automated Software Engineering, 2022, pp. 1–12. [81] S. Panthaplackel, J. J. Li, M. Gligoric, and R. J. Mooney, "Deep just- in-time inconsistency detection between comments and source code," in AAAI Conference on Artificial Intelligence, 2021, pp. 427–435. [82] S. Panthaplackel, M. Gligoric, R. J. Mooney, and J. J. Li, "Associating natural language comment and source code entities," in AAAI Conference on Artificial Intelligence, 2020, pp. 8592–8599. [83] S. Panthaplackel, J. J. Li, M. Gligoric, and R. J. Mooney, "Using developer discussions to guide fixing bugs in software," in Empirical Methods in Natural Language Processing, 2022, pp. 2292–2301. [84] --, "Learning to describe solutions for bug reports based on developer discussions," in Annual Meeting of the Association for Computational Linguistics, 2022, pp. 2935–2952. [85] S. Chakraborty and B. Ray, "On multi-modal learning of editing source code," in Automated Software Engineering, 2021, pp. 443–455. [86] K. Wang, Z. Su, and R. Singh, "Dynamic neural program embeddings for program repair," in International Conference on Learning Represen- tations, 2018. [87] K. Wang and Z. Su, "Blended, precise semantic program embeddings," in Conference on Programming Language Design and Implementation, 2020, pp. 121–134. [88] P. Nie, K. Palmskog, J. J. Li, and M. Gligoric, "Deep generation of Coq lemma names using elaborated terms," in International Joint Conference on Automated Reasoning, 2020, pp. 97–118. [89] K. Pei, Z. Xuan, J. Yang, S. Jana, and B. Ray, "Learning approximate execution semantics from traces for binary function similarity," Trans- actions on Software Engineering, pp. 1–14, 2022. [90] X. Pi, Q. Liu, B. Chen, M. Ziyadi, Z. Lin, Q. Fu, Y. Gao, J.-G. Lou, and W. Chen, "Reasoning like program executors," in Empirical Methods in Natural Language Processing, 2022, pp. 761–779. [68] W. Janjic and C. Atkinson, "Utilizing software reuse experience for auto- mated test recommendation," in International Workshop on Automation of Software Test, 2013, pp. 100–106. [91] F. Shi, D. Fried, M. Ghazvininejad, L. Zettlemoyer, and S. I. Wang, "Natural language to code translation with execution," in Empirical Methods in Natural Language Processing, 2022, pp. 3533–3546. 13 [92] P. Bareiss, B. Souza, M. d'Amorim, and M. Pradel, "Code generation tools (almost) for free? a study of few-shot, pre-trained language models on code," arXiv preprint arXiv:2206.01335, 2022. [93] M. Sch ̈afer, S. Nadi, A. Eghbali, and F. Tip, "Adaptive test generation using a large language model," arXiv preprint arXiv:2302.06527, 2023. [94] C. Lemieux, J. P. Inala, S. K. Lahiri, and S. Sen, "CODAMOSA: Escaping coverage plateaus in test generation with pre-trained large language models," in International Conference on Software Engineering, 2023, p. to apper. [95] T. Kojima, S. S. Gu, M. Reid, Y. Matsuo, and Y. Iwasawa, "Large language models are zero-shot reasoners," in Conference on Neural Information Processing Systems, 2022. 14 generate the next statement. Because Codex is pre-trained to complete code, the prompt needs to be carefully designed as a code fragment to be completed. Fig. 6 illustrates the prompt format we used. We configured Codex to generate until seeing the first ';', similar to the way we used CodeGPT. Because the current generation speed of Codex is quite slow, we configured Codex to only generate the top-1 next statement using the greedy decoding algorithm. We used the code-davinci-002 version of the Codex model. Running Codex on our evaluation set (with 30,194 statements) took 18 hours. Table V shows the results of Codex for the test comple- tion task with comparisons to TECO and the other baseline models; the results are organized into four parts-on the full evaluation set, runnable subset, oracle subset, and oracle- runnable subset-as explained in Section VI. TECO statis- tically significantly outperforms Codex on all metrics, which confirms the importance of using code semantics and code execution together with ML. Compared with the other baseline models (CodeT5/CodeGPT), Codex has better performance on some metrics (e.g., %Run on the runnable subset and oracle- runnable subset; exact-match accuracy on the oracle subset and oracle-runnable subset) but has slightly worse performance on others. Although Codex is expected to be much more powerful than CodeT5/CodeGPT due to the larger scale (billions of parameters vs. millions of parameters) and more pre-training data, we hypothesize that fine-tuning CodeT5/CodeGPT on our large test completion corpus helped with improving their per- formance. Codex performs better on the test oracle generation task than the test completion task, which may be because of the more prior statements context available when performing test oracle generation. 1 public GMOperation addImage(final File file) { 2 3 throw new IllegalArgumentException("file must be if (file == null) { defined"); } getCmdArgs().add(file.getPath()); return this; 4 5 6 7 } 8 9 // Here is a test for the above method. Please complete the next statement of the test 10 @Test public void addImage_ThrowsException_WhenFileIsNull() throws Exception { 11 exception.except(IllegalArgumentException.class); 12 // Please compete the next statement: Fig. 6: The prompt to Codex for the example test completion task in Fig. 1. APPENDIX A COMPARISONS WITH LARGE LANGUAGE MODELS Recent large language models for code that scale up to billions of parameters, such as Codex [30], have been shown to be promising for many code-related tasks. In parallel with our work, researchers applied large language models to generate tests [92]–[94]. In this appendix, we perform an additional to evaluate the performance of large language experiment models on test completion and compare with TECO. The large language model we used is Codex [30], which is the state-of-the-art specialized large language model for code. Following the contemporary work on using large language models for test generation [92]–[94], we used Codex to per- form test completion in the zero-shot learning setup [95], i.e., providing Codex with a prompt that contains the method under test, test method signature, and prior statements, and letting it 15 TABLE V: Results for Codex, TECO, and other baseline models on test completion. The best number for each metric is bolded. In each table, numbers marked with the same greek letter prefix are not statistically significantly different. (a) On the evaluation set. Model XM Acc@10 BLEU CodeBLEU EditSim ROUGE Codex CodeT5 CodeT5-noFt CodeGPT TECO 12.69 13.57 0.00 12.20 17.61 N/A 34.53 38.33 0.00 36.30 24.11 0.00 22.67 27.20 42.01 29.91 33.88 3.36 31.84 37.61 58.08 60.81 1.68 59.09 63.49 56.04 62.40 0.02 61.10 65.23 (b) On the runnable subset. Model %Compile %Run XM Acc@10 BLEU CodeBLEU EditSim ROUGE Codex CodeT5 CodeT5-noFt CodeGPT TECO 38.80 54.84 0.00 53.77 19.12 12.88 17.62 14.38 0.00 0.00 15.13 12.95 N/A 34.89 39.26 0.00 37.19 25.39 0.00 24.03 76.22 28.63 18.96 28.40 43.15 30.12 34.55 3.35 32.46 38.45 58.44 61.36 1.65 59.75 64.12 56.58 63.15 0.03 61.90 66.09 (c) On the oracle subset. Model XM Acc@10 BLEU CodeBLEU EditSim ROUGE 12.30 Codex 8.45 CodeT5 CodeT5-noFt α0.00 10.56 CodeGPT α0.21 ATLAS 9.01 TOGA N/A 35.09 39.03 0.00 40.91 21.55 25.46 24.04 0.00 27.19 0.66 9.01 TECO 16.44 27.41 43.09 30.24 31.03 1.18 33.33 13.39 24.73 35.88 59.59 66.50 1.86 67.63 54.06 29.60 68.05 57.67 66.63 0.01 67.94 50.70 28.06 68.71 (d) On the oracle-runnable subset. Model %Compile %Run XM Acc@10 BLEU CodeBLEU EditSim ROUGE Codex CodeT5 CodeT5-noFt CodeGPT ATLAS TOGA 39.46 44.45 0.00 47.39 3.62 25.61 20.73 12.15 16.87 8.79 0.00 α0.00 16.13 10.41 1.45 α0.23 9.37 9.10 N/A 35.05 40.26 0.00 41.56 21.81 26.51 24.37 0.00 28.17 0.68 9.10 TECO 67.93 30.29 17.37 27.39 44.27 30.12 32.23 1.26 33.79 13.56 25.74 36.98 59.79 67.08 1.87 67.78 54.19 31.00 68.43 57.86 67.42 0.01 68.43 50.87 29.38 69.35 16